Browse Source

EAM ——> 定时任务 生成保养计划 保养工单

master_hella_20240701
gaojs 6 months ago
parent
commit
15a80b17b4
  1. 34
      src/api/eam/maintenance/index.ts
  2. 4
      src/views/eam/basicMaintenanceOption/basicMaintenanceOption.data.ts
  3. 74
      src/views/eam/maintenance/index.vue
  4. 127
      src/views/eam/maintenance/maintenance.data.ts
  5. 9
      src/views/eam/maintenanceItem/maintenanceItem.data.ts

34
src/api/eam/maintenance/index.ts

@ -4,14 +4,20 @@ import {InspectionItemSelectSetVO} from "@/api/eam/inspectionItemSelectSet";
export interface MaintenanceVO { export interface MaintenanceVO {
id: number id: number
number: string number: string
describing: string name: string
equipmentCode: string equipmentCode: string
type: string type: string
optionCode: string optionCode: string
cycle: string cycle: string
classes: string startTime: Date
peoples: number endTime: Date
estimatedMinutes: number status: string
approver: number
approveContent: string
approveTime: Date
autoExamine: string
autoAgree: string
directCreateRecord: string
factoryAreaCode: string factoryAreaCode: string
workshopCode: string workshopCode: string
workshopSectionCode: string workshopSectionCode: string
@ -29,43 +35,43 @@ export const getMaintenancePage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = {...params} const data = {...params}
return await request.post({ url: '/eam/basic/maintenance/senior', data }) return await request.post({ url: '/eam/maintenance/senior', data })
} else { } else {
return await request.get({ url: `/eam/basic/maintenance/page`, params }) return await request.get({ url: `/eam/maintenance/page`, params })
} }
} }
// 查询保养计划详情 // 查询保养计划详情
export const getMaintenance = async (id: number) => { export const getMaintenance = async (id: number) => {
return await request.get({ url: `/eam/basic/maintenance/get?id=` + id }) return await request.get({ url: `/eam/maintenance/get?id=` + id })
} }
// 新增保养计划 // 新增保养计划
export const createMaintenance = async (data: MaintenanceVO) => { export const createMaintenance = async (data: MaintenanceVO) => {
return await request.post({ url: `/eam/basic/maintenance/create`, data }) return await request.post({ url: `/eam/maintenance/create`, data })
} }
// 修改保养计划 // 修改保养计划
export const updateMaintenance = async (data: MaintenanceVO) => { export const updateMaintenance = async (data: MaintenanceVO) => {
return await request.put({ url: `/eam/basic/maintenance/update`, data }) return await request.put({ url: `/eam/maintenance/update`, data })
} }
// 删除保养计划 // 删除保养计划
export const deleteMaintenance = async (id: number) => { export const deleteMaintenance = async (id: number) => {
return await request.delete({ url: `/eam/basic/maintenance/delete?id=` + id }) return await request.delete({ url: `/eam/maintenance/delete?id=` + id })
} }
// 导出保养计划 Excel // 导出保养计划 Excel
export const exportMaintenance = async (params) => { export const exportMaintenance = async (params) => {
return await request.download({ url: `/eam/basic/maintenance/export-excel`, params }) return await request.download({ url: `/eam/maintenance/export-excel`, params })
} }
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/eam/basic/maintenance/get-import-template' }) return request.download({ url: '/eam/maintenance/get-import-template' })
} }
// 启用 / 禁用 // 启用 / 禁用
export const updateEnableCode = async (data: InspectionItemSelectSetVO) => { export const updateEnableCode = async (data: MaintenanceVO) => {
return await request.post({ url: `/eam/basic/maintenance/ables` , data }) return await request.post({ url: `/eam/maintenance/ables` , data })
} }

4
src/views/eam/basicMaintenanceOption/basicMaintenanceOption.data.ts

@ -36,7 +36,7 @@ export const BasicMaintenanceOption = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true, isSearch: true,
}, },
{ {
label: '选择集', label: '选择集ID',
field: 'selectId', field: 'selectId',
sort: 'custom', sort: 'custom',
isDetail: true, isDetail: true,
@ -45,7 +45,7 @@ export const BasicMaintenanceOption = useCrudSchemas(reactive<CrudSchema[]>([
isSearchList: true, // 开启查询弹窗 isSearchList: true, // 开启查询弹窗
searchTitle: '保养选择集信息', // 查询弹窗标题 searchTitle: '保养选择集信息', // 查询弹窗标题
searchAllSchemas: BasicMaintenanceItemSelectSet.allSchemas, // 查询弹窗所需类 searchAllSchemas: BasicMaintenanceItemSelectSet.allSchemas, // 查询弹窗所需类
searchField: 'name', // 查询弹窗赋值字段 searchField: 'id', // 查询弹窗赋值字段
searchPage: ItemApi.getBasicMaintenanceItemSelectSetPage, // 查询弹窗所需分页方法 searchPage: ItemApi.getBasicMaintenanceItemSelectSetPage, // 查询弹窗所需分页方法
multiple:true, multiple:true,
searchCondition: [{ searchCondition: [{

74
src/views/eam/maintenance/index.vue

@ -4,15 +4,15 @@
<Search :schema="Maintenance.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="Maintenance.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead
:HeadButttondata="HeadButttondata" :HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick" @button-base-click="buttonBaseClick"
:routeName="routeName" :routeName="routeName"
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="Maintenance.allSchemas" :allSchemas="Maintenance.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
@ -66,9 +66,10 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
import * as BasicInspectionOptionApi from "@/api/eam/basicInspectionOption";
import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data"; import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data";
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts"; import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
import { ToolAccounts } from "@/views/eam/toolAccounts/toolAccounts.data"; import { ToolAccounts } from "@/views/eam/toolAccounts/ToolAccounts.data";
import * as ToolItemApi from "@/api/eam/toolAccounts"; import * as ToolItemApi from "@/api/eam/toolAccounts";
defineOptions({ name: 'Maintenance' }) defineOptions({ name: 'Maintenance' })
@ -248,32 +249,32 @@ const handleDisable = async (id: number) => {
} }
const onChange = (field, item) => { const onChange = (field, item) => {
console.log(field) console.log(field)
console.log(item) console.log(item)
// //
if(field == 'type' && item == 'DEVICE'){ if(field == 'type' && item == 'DEVICE'){
Maintenance.allSchemas.formSchema.forEach((items) => { Maintenance.allSchemas.formSchema.forEach((items) => {
if (items.field == 'equipmentCode') { if (items.field == 'equipmentCode') {
basicFormRef.value.formRef.setValues({ basicFormRef.value.formRef.setValues({
equipmentCode:'' equipmentCode:''
}) })
items.componentProps.searchAllSchemas = EquipmentAccounts.allSchemas items.componentProps.searchAllSchemas = EquipmentAccounts.allSchemas
items.componentProps.searchPage = EquipmentItemApi.getEquipmentAccountsPage items.componentProps.searchPage = EquipmentItemApi.getEquipmentAccountsPage
} }
}) })
} }
// //
if(field == 'type' && item == 'EQUIPMENT'){ if(field == 'type' && item == 'EQUIPMENT'){
Maintenance.allSchemas.formSchema.forEach((items) => { Maintenance.allSchemas.formSchema.forEach((items) => {
if (items.field == 'equipmentCode') { if (items.field == 'equipmentCode') {
basicFormRef.value.formRef.setValues({ basicFormRef.value.formRef.setValues({
equipmentCode:'' equipmentCode:''
}) })
items.componentProps.searchAllSchemas = ToolAccounts.allSchemas items.componentProps.searchAllSchemas = ToolAccounts.allSchemas
items.componentProps.searchPage = ToolItemApi.getToolAccountsPage items.componentProps.searchPage = ToolItemApi.getToolAccountsPage
} }
}) })
} }
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
@ -322,3 +323,4 @@ onMounted(async () => {
}) })
</script> </script>

127
src/views/eam/maintenance/maintenance.data.ts

@ -1,15 +1,17 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type {CrudSchema} from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import {dateFormatter} from '@/utils/formatTime'
import { EquipmentAccounts } from "@/views/eam/equipmentAccounts/equipmentAccounts.data"; import { EquipmentAccounts } from "@/views/eam/equipmentAccounts/equipmentAccounts.data";
import * as EquipmentItemApi from "@/api/eam/equipmentAccounts"; import * as EquipmentItemApi from "@/api/eam/equipmentAccounts";
// 表单校验 // 表单校验
export const MaintenanceRules = reactive({ export const MaintenanceRules = reactive({
number: [required], number: [required],
name: [required],
equipmentCode: [required], equipmentCode: [required],
optionCode: [required], optionCode: [required],
factoryAreaCode: [required], cycle: [required],
concurrencyStamp: [required], startTime: [required],
endTime: [required],
}) })
export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
@ -29,8 +31,8 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true, isSearch: true,
}, },
{ {
label: '描述', label: '计划名称',
field: 'describing', field: 'name',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
}, },
@ -43,7 +45,7 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true, isSearch: true,
}, },
{ {
label: '设备编号', label: '设备工装编号',
field: 'equipmentCode', field: 'equipmentCode',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
@ -82,31 +84,115 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true, isSearch: true,
}, },
{ {
label: '班次', label: '计划开始时间',
field: 'classes', field: 'startTime',
sort: 'custom', sort: 'custom',
formatter: dateFormatter,
isSearch: true, isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
}, },
{ {
label: '人数', label: '计划结束时间',
field: 'peoples', field: 'endTime',
sort: 'custom', sort: 'custom',
formatter: dateFormatter,
isSearch: true, isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: { form: {
component: 'InputNumber', component: 'DatePicker',
value: 0 componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}, },
}, },
{ {
label: '预计所需时间', label: '状态',
field: 'estimatedMinutes', field: 'status',
sort: 'custom',
isSearch: true,
},
{
label: '审核人',
field: 'approver',
sort: 'custom',
isSearch: true,
},
{
label: '审核内容',
field: 'approveContent',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form: { form: {
component: 'InputNumber', component: 'Editor',
value: 0 componentProps: {
valueHtml: '',
height: 200
}
},
},
{
label: '审核时间',
field: 'approveTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}, },
}, },
{
label: '自动审核',
field: 'autoExamine',
sort: 'custom',
isSearch: true,
},
{
label: '自动通过',
field: 'autoAgree',
sort: 'custom',
isSearch: true,
},
{
label: '直接生成记录',
field: 'directCreateRecord',
sort: 'custom',
isSearch: true,
},
{ {
label: '所属厂区编号', label: '所属厂区编号',
field: 'factoryAreaCode', field: 'factoryAreaCode',
@ -130,10 +216,7 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
field: 'createTime', field: 'createTime',
sort: 'custom', sort: 'custom',
formatter: dateFormatter, formatter: dateFormatter,
isSearch: false, isSearch: true,
isTable: false,
isForm: false,
isDetail:false,
search: { search: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@ -157,7 +240,7 @@ export const Maintenance = useCrudSchemas(reactive<CrudSchema[]>([
label: '备注', label: '备注',
field: 'remark', field: 'remark',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: true,
}, },
{ {
label: '地点ID', label: '地点ID',

9
src/views/eam/maintenanceItem/maintenanceItem.data.ts

@ -1,5 +1,4 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { handleTreeToComponentOptions } from '@/utils/tree' import { handleTreeToComponentOptions } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept' import * as DeptApi from '@/api/system/dept'
const deptList = ref<Tree[]>([]) // 树形结构 const deptList = ref<Tree[]>([]) // 树形结构
@ -27,7 +26,13 @@ export const MaintenanceItem = useCrudSchemas(reactive<CrudSchema[]>([
}, },
}, },
{ {
label: '保养内容', label: '保养名称',
field: 'name',
sort: 'custom',
isSearch: true
},
{
label: '保养要求',
field: 'content', field: 'content',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,

Loading…
Cancel
Save