diff --git a/src/api/eam/relationMaintenancePlanItem/index.ts b/src/api/eam/relationMaintenancePlanItem/index.ts new file mode 100644 index 000000000..9381fb777 --- /dev/null +++ b/src/api/eam/relationMaintenancePlanItem/index.ts @@ -0,0 +1,57 @@ +import request from '@/config/axios' + +export interface RelationMaintenancePlanItemVO { + id: number + planNumber: string + itemCode: string + itemName: string + isSelectd: boolean + departmentCode: string + remark: string + siteId: string + available: string + deletionTime: Date + deleterId: byte[] + concurrencyStamp: number +} + +// 查询保养计划表和保养项关系列表 +export const getRelationMaintenancePlanItemPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/eam/relation-maintenance-plan-item/senior', data }) + } else { + return await request.get({ url: `/eam/relation-maintenance-plan-item/page`, params }) + } +} + +// 查询保养计划表和保养项关系详情 +export const getRelationMaintenancePlanItem = async (id: number) => { + return await request.get({ url: `/eam/relation-maintenance-plan-item/get?id=` + id }) +} + +// 新增保养计划表和保养项关系 +export const createRelationMaintenancePlanItem = async (data: RelationMaintenancePlanItemVO) => { + return await request.post({ url: `/eam/relation-maintenance-plan-item/create`, data }) +} + +// 修改保养计划表和保养项关系 +export const updateRelationMaintenancePlanItem = async (data: RelationMaintenancePlanItemVO) => { + return await request.put({ url: `/eam/relation-maintenance-plan-item/update`, data }) +} + +// 删除保养计划表和保养项关系 +export const deleteRelationMaintenancePlanItem = async (id: number) => { + return await request.delete({ url: `/eam/relation-maintenance-plan-item/delete?id=` + id }) +} + +// 导出保养计划表和保养项关系 Excel +export const exportRelationMaintenancePlanItem = async (params) => { + return await request.download({ url: `/eam/relation-maintenance-plan-item/export-excel`, params }) +} + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/eam/relation-maintenance-plan-item/get-import-template' }) +} \ No newline at end of file diff --git a/src/components/BasicForm/src/BasicForm.vue b/src/components/BasicForm/src/BasicForm.vue index 86316b478..2dfe94013 100644 --- a/src/components/BasicForm/src/BasicForm.vue +++ b/src/components/BasicForm/src/BasicForm.vue @@ -731,7 +731,6 @@ const clearInput = (field, row, index) => { * @param cur 改变后值 */ const onChange = (field, cur) => { - console.log(2222222222222) emit('onChange', field, cur, formRef) } diff --git a/src/views/eam/equipmentMaintenanceMain/DetailEam.vue b/src/views/eam/equipmentMaintenanceMain/MaintenanceOrderDetail.vue similarity index 94% rename from src/views/eam/equipmentMaintenanceMain/DetailEam.vue rename to src/views/eam/equipmentMaintenanceMain/MaintenanceOrderDetail.vue index 401ae4c61..7626c0627 100644 --- a/src/views/eam/equipmentMaintenanceMain/DetailEam.vue +++ b/src/views/eam/equipmentMaintenanceMain/MaintenanceOrderDetail.vue @@ -585,9 +585,11 @@ const formRef = ref() const titleNameRef = ref() const titleValueRef = ref() const count =ref(0) +const planNumber = ref(); const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => { titleNameRef.value = titleName titleValueRef.value = titleValue + planNumber.value = row.planNumber remarksData.data = { tableId: row.masterId||row.id, tableName: tableName @@ -707,7 +709,7 @@ const isShowMainButton = (row, val) => { const { getList } = tableMethodsRef.value // 头部按钮事件 -const buttonBaseClick = (val, item) => { +const buttonBaseClick = (val, item ,row) => { if (val == 'add') { // 新增 if(props.isOpenSearchTable){ @@ -728,6 +730,8 @@ const buttonBaseClick = (val, item) => { undefined,undefined ) }else{ + console.log(planNumber.value) + openForm('create') } } else if (val == 'import') { @@ -824,10 +828,8 @@ const buttonTableClick = async (val, row) => { } /** 添加/修改操作 */ const openForm = async (type: string, row?: number) => { - formRef.value.open(type, row, masterParmas.value) emit('detailOpenForm', type, row) - if(type == "create"){ EquipmentMaintenanceDetail.allSchemas.formSchema.forEach((item) => { if(item.field == 'peoples'){ @@ -854,19 +856,41 @@ const openForm = async (type: string, row?: number) => { } if(item.field == 'name'){ EquipmentMaintenanceDetailRules.name[0].required = true + item.componentProps.searchCondition = [] + const newItem1 = {}; + newItem1['action'] = '=='; + newItem1['value'] = planNumber.value; + newItem1['key'] = 'planNumber'; + item.componentProps.searchCondition.push(newItem1) + const newItem2 = {}; + newItem2['action'] = '=='; + newItem2['value'] = 'TRUE'; + newItem2['key'] = 'available'; + item.componentProps.searchCondition.push(newItem2) + const newItem3 = {}; + newItem3['action'] = '=='; + newItem3['value'] = false; + newItem3['key'] = 'isSelectd'; + item.componentProps.searchCondition.push(newItem3) } }) }else{ - row.peoples = row.peoples.toString() - row.estimatedMinutes = row.estimatedMinutes.toString() - row.actualMinutes = row.actualMinutes.toString() + if(row.peoples !== null && row.peoples !== undefined){ + row.peoples = row.peoples.toString() + } + if(row.estimatedMinutes !== null && row.estimatedMinutes !== undefined){ + row.estimatedMinutes = row.estimatedMinutes.toString() + } + if(row.actualMinutes !== null && row.actualMinutes !== undefined){ + row.actualMinutes = row.actualMinutes.toString() + } EquipmentMaintenanceDetail.allSchemas.formSchema.forEach((item) => { if(item.field == 'peoples'){ item.componentProps.disabled = false EquipmentMaintenanceDetailRules.peoples[0].required = true } if(item.field == 'estimatedMinutes'){ - EquipmentMaintenanceDetailRules.estimatedMinutes[0].required = false + EquipmentMaintenanceDetailRules.estimatedMinutes[0].required = true } if(item.field == 'actualMinutes'){ item.componentProps.disabled = false @@ -885,6 +909,22 @@ const openForm = async (type: string, row?: number) => { } if(item.field == 'name'){ EquipmentMaintenanceDetailRules.name[0].required = true + item.componentProps.searchCondition = [] + const newItem1 = {}; + newItem1['action'] = '=='; + newItem1['value'] = planNumber.value; + newItem1['key'] = 'planNumber'; + item.componentProps.searchCondition.push(newItem1) + const newItem2 = {}; + newItem2['action'] = '=='; + newItem2['value'] = 'TRUE'; + newItem2['key'] = 'available'; + item.componentProps.searchCondition.push(newItem2) + const newItem3 = {}; + newItem3['action'] = '=='; + newItem3['value'] = false; + newItem3['key'] = 'isSelectd'; + item.componentProps.searchCondition.push(newItem3) } }) } @@ -950,7 +990,12 @@ const handleDelete = async (id: number) => { // 刷新列表 await getList() updateKey.value += 1 - } catch {} + } catch { + emit('handleMainFefresh') + // 刷新列表 + await getList() + updateKey.value += 1 + } } // 筛选提交 const searchFormClick = async (searchData) => { diff --git a/src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts b/src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts index 83ed676a5..d2f92e2ed 100644 --- a/src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts +++ b/src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts @@ -4,9 +4,10 @@ import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts import * as EquipmentItemApi from "@/api/eam/equipmentAccounts"; import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data"; import * as WorkshopApi from "@/api/wms/workshop"; -import {MaintenanceItem} from "@/views/eam/maintenanceItem/maintenanceItem.data"; -import * as ItemApi from "@/api/eam/maintenanceItem"; +import {RelationMaintenancePlanItem} from "@/views/eam/maintenance/maintenance.data"; +import * as ItemApi from "@/api/eam/relationMaintenancePlanItem"; import {validateroundNumber} from "@/utils/validator"; +import {getRelationMaintenancePlanItemPage} from "@/api/eam/relationMaintenancePlanItem"; // 表单校验 export const EquipmentMaintenanceMainRules = reactive({ @@ -505,16 +506,12 @@ export const EquipmentMaintenanceDetail = useCrudSchemas(reactive( form: { componentProps: { isSearchList: true, // 开启查询弹窗 - searchListPlaceholder: '请选择 类别编码', - searchTitle: '保养项信息', // 查询弹窗标题 - searchAllSchemas: MaintenanceItem.allSchemas, // 查询弹窗所需类 - searchField: 'name', // 查询弹窗赋值字段 - searchPage: ItemApi.getMaintenanceItemPage, // 查询弹窗所需分页方法 - searchCondition: [{ - key: 'available', - value: 'TRUE', - action: '==' - }] + searchListPlaceholder: '请选择 非必选保养项', + searchTitle: '非必选保养项信息', // 查询弹窗标题 + searchAllSchemas: RelationMaintenancePlanItem.allSchemas, // 查询弹窗所需类 + searchField: 'itemName', // 查询弹窗赋值字段 + searchPage: ItemApi.getRelationMaintenancePlanItemPage, // 查询弹窗所需分页方法 + searchCondition: [] } } }, diff --git a/src/views/eam/equipmentMaintenanceMain/index.vue b/src/views/eam/equipmentMaintenanceMain/index.vue index 7c8d057c1..4e0295cb2 100644 --- a/src/views/eam/equipmentMaintenanceMain/index.vue +++ b/src/views/eam/equipmentMaintenanceMain/index.vue @@ -82,12 +82,13 @@ import * as EquipmentMaintenanceDetailApi from '@/api/eam/equipmentMaintenanceDe import * as defaultButtons from '@/utils/disposition/defaultButtons' import TableHead from '@/components/TableHead/src/TableHead.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue' -import Detail from '@/views/eam/equipmentMaintenanceMain/DetailEam.vue' +import Detail from '@/views/eam/equipmentMaintenanceMain/MaintenanceOrderDetail.vue' import {Maintenance} from "@/views/eam/maintenance/maintenance.data"; import {EquipmentAccounts} from "@/views/eam/equipmentAccounts/equipmentAccounts.data"; import * as EquipmentItemApi from "@/api/eam/equipmentAccounts"; import {ToolAccounts} from "@/views/eam/toolAccounts/toolAccounts.data"; import * as ToolItemApi from "@/api/eam/toolAccounts"; +import {updateMaintenanceOrder} from "@/api/eam/equipmentMaintenanceMain"; defineOptions({ name: 'EquipmentMaintenanceMain' }) @@ -122,7 +123,7 @@ const { getList, setSearchParams } = tableMethods // 列表头部按钮 const HeadButttondata = [ - defaultButtons.defaultAddBtn({hasPermi:'eam:equipmentMaintenanceMain:create'}), // 新增 + //defaultButtons.defaultAddBtn({hasPermi:'eam:equipmentMaintenanceMain:create'}), // 新增 //defaultButtons.defaultImportBtn({hasPermi:'eam:equipmentMaintenanceMain:import'}), // 导入 defaultButtons.defaultExportBtn({hasPermi:'eam:equipmentMaintenanceMain:export'}), // 导出 defaultButtons.defaultFreshBtn(null), // 刷新 @@ -256,7 +257,7 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { const setV = {} let result = ''; for (var i = 0; i < val.length; i++) { - result += val[i].name + ','; + result += val[i].itemName + ','; } if(result.endsWith(',')){ result = result.substring(0,result.length -1) @@ -320,8 +321,8 @@ const handleExecute = async (id: number) => { }) params.value.id = id params.value.status = '5' - // 发起删除 - await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value) + // 发起 + await EquipmentMaintenanceMainApi.updateMaintenanceOrder(params.value) message.success(t('执行成功')) // 刷新列表 await getList() @@ -339,7 +340,7 @@ const handleFinish = async (id: number) => { }) params.value.id = id params.value.status = '5' - // 发起删除 + // 发起 await EquipmentMaintenanceMainApi.executeMaintenanceOrder(params.value) message.success(t('工单已完成')) // 刷新列表 diff --git a/src/views/eam/maintenance/maintenance.data.ts b/src/views/eam/maintenance/maintenance.data.ts index 480ae1d0e..92afca62c 100644 --- a/src/views/eam/maintenance/maintenance.data.ts +++ b/src/views/eam/maintenance/maintenance.data.ts @@ -357,3 +357,163 @@ export const Maintenance = useCrudSchemas(reactive([ } } ])) + + +// 表单校验 +export const RelationMaintenancePlanItemRules = reactive({ + planNumber: [required], + itemCode: [required], + itemName: [required], +}) + +export const RelationMaintenancePlanItem = useCrudSchemas(reactive([ + { + label: 'id', + field: 'id', + sort: 'custom', + isSearch: false, + isTable: false, + isForm: false, + isDetail:false, + }, + { + label: '计划编号', + field: 'planNumber', + sort: 'custom', + isSearch: true, + }, + { + label: '项编号', + field: 'itemCode', + sort: 'custom', + isSearch: true, + }, + { + label: '保养名称', + field: 'itemName', + sort: 'custom', + isSearch: true, + }, + { + label: '是否必选', + field: 'isSelectd', + sort: 'custom', + isSearch: true, + dictType: DICT_TYPE.FALSE_OR_TRUE, + dictClass: 'string', + }, + { + label: '创建时间', + field: 'createTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: false, + isTable: false, + isForm: false, + isDetail:false, + 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')] + } + }, + isForm: false, + }, + { + label: '部门id', + field: 'departmentCode', + sort: 'custom', + isSearch: false, + isTable: false, + isForm: false, + isDetail:false, + }, + { + label: '备注', + field: 'remark', + sort: 'custom', + isSearch: false, + isTable: false, + isForm: false, + isDetail:false, + }, + { + label: '地点ID', + field: 'siteId', + sort: 'custom', + isSearch: false, + isTable: false, + isForm: false, + isDetail:false, + }, + { + label: '是否可用默认TRUE', + field: 'available', + sort: 'custom', + isSearch: false, + isTable: false, + isForm: false, + isDetail:false, + }, + { + label: '删除时间', + field: 'deletionTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: false, + isTable: false, + isForm: false, + isDetail:false, + 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: '删除人id', + field: 'deleterId', + sort: 'custom', + isSearch: false, + isTable: false, + isForm: false, + isDetail:false, + }, + { + label: '并发乐观锁', + field: 'concurrencyStamp', + sort: 'custom', + isSearch: false, + isTable: false, + isForm: false, + isDetail:false, + form: { + component: 'InputNumber', + value: 0 + }, + }, + { + label: '操作', + field: 'action', + isSearch: false, + isTable: false, + isForm: false, + isDetail:false, + table: { + width: 150, + fixed: 'right' + } + } +]))