diff --git a/src/api/eam/equipmentMaintenanceDetail/index.ts b/src/api/eam/equipmentMaintenanceDetail/index.ts index 81a8696e1..0869a000d 100644 --- a/src/api/eam/equipmentMaintenanceDetail/index.ts +++ b/src/api/eam/equipmentMaintenanceDetail/index.ts @@ -43,6 +43,11 @@ export const createEquipmentMaintenanceDetail = async (data: EquipmentMaintenanc return await request.post({ url: `/eam/equipment-maintenance-detail/create`, data }) } +// 新增设备保养工单 通过主表添加 +export const createItemEquipmentMaintenanceDetail = async (data: EquipmentMaintenanceDetailVO) => { + return await request.post({ url: `/eam/equipment-maintenance-detail/createItem`, data }) +} + // 修改设备保养工单子 export const updateEquipmentMaintenanceDetail = async (data: EquipmentMaintenanceDetailVO) => { return await request.put({ url: `/eam/equipment-maintenance-detail/update`, data }) @@ -61,4 +66,4 @@ export const exportEquipmentMaintenanceDetail = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/eam/equipment-maintenance-detail/get-import-template' }) -} \ No newline at end of file +} diff --git a/src/api/eam/equipmentMaintenanceMain/index.ts b/src/api/eam/equipmentMaintenanceMain/index.ts index a3ba8d8db..5bc59771d 100644 --- a/src/api/eam/equipmentMaintenanceMain/index.ts +++ b/src/api/eam/equipmentMaintenanceMain/index.ts @@ -79,7 +79,12 @@ export const updateEnableCode = async (data: EquipmentMainPartVO) => { return await request.post({ url: `/eam/equipment-maintenance-main/ables` , data }) } -// 执行保养工单 +// 修改保养工单状态 +export const updateMaintenanceOrder = async (data: EquipmentMainPartVO) => { + return await request.post({ url: `/eam/equipment-maintenance-main/updateOrder`, data }) +} + +//执行保养工单 export const executeMaintenanceOrder = async (data: EquipmentMainPartVO) => { return await request.post({ url: `/eam/equipment-maintenance-main/execute`, data }) } diff --git a/src/hooks/web/useMessage.ts b/src/hooks/web/useMessage.ts index ac2b552e0..373f39245 100644 --- a/src/hooks/web/useMessage.ts +++ b/src/hooks/web/useMessage.ts @@ -59,6 +59,14 @@ export const useMessage = () => { type: 'warning' }) }, + // 确认窗体 + confirmPassword(content: string, tip?: string) { + return ElMessageBox.confirm(content, tip ? tip : t('common.confirmTitle'), { + confirmButtonText: t('通过'), + cancelButtonText: t('不通过'), + type: 'warning' + }) + }, // 删除窗体 delConfirm(content?: string, tip?: string) { return ElMessageBox.confirm( diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts index b32418e0a..69927ae74 100644 --- a/src/utils/disposition/defaultButtons.ts +++ b/src/utils/disposition/defaultButtons.ts @@ -325,6 +325,19 @@ export function mainListReceiveBtn(option:any) { }) } +// 主列表-接单按钮 +export function mainListReceiveOrderBtn(option:any) { + return __defaultBtnOption(option,{ + label: t(`ts.接单`).replace('ts.', ''), + name: 'receive', + hide: false, + type: 'primary', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + // 主列表-执行按钮 export function mainListExecuteBtn(option:any) { return __defaultBtnOption(option,{ @@ -351,6 +364,19 @@ export function mainListFinishBtn(option:any) { }) } +// 主列表-验证按钮 +export function mainListValidateBtn(option:any) { + return __defaultBtnOption(option,{ + label: t(`ts.验证`).replace('ts.', ''), + name: 'validate', + hide: false, + type: 'primary', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} + // 主列表-绑定 export function mainListBindBtn(option:any) { return __defaultBtnOption(option,{ diff --git a/src/components/Detail/src/DetailQmsNumber.vue b/src/views/eam/equipmentMaintenanceMain/DetailEam.vue similarity index 68% rename from src/components/Detail/src/DetailQmsNumber.vue rename to src/views/eam/equipmentMaintenanceMain/DetailEam.vue index 424b6c479..73d717f9e 100644 --- a/src/components/Detail/src/DetailQmsNumber.vue +++ b/src/views/eam/equipmentMaintenanceMain/DetailEam.vue @@ -2,17 +2,18 @@
- + + - -
- + +
+ + + + + + + + + + - + - + + + + + - + + + + + - - + + - @@ -154,12 +199,15 @@ import Tabs from '@/components/Tabs/src/Tabs.vue' import * as RemarkApi from '@/api/wms/remark' import * as FileApi from '@/api/wms/file' import * as defaultButtons from '@/utils/disposition/defaultButtons' -import BasicFormQmsNumber from '@/components/BasicForm/src/BasicFormQmsNumber.vue' +import BasicForm from '@/components/BasicForm/src/BasicForm.vue' import TableHead from '@/components/TableHead/src/TableHead.vue' import DetailTable from '@/components/DetailTable/src/DetailTable.vue' import { SearchTable } from '@/components/SearchTable' +import { + EquipmentMaintenanceDetail, EquipmentMaintenanceDetailRules, +} from "@/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data"; -defineOptions({ name: 'DetailQmsNumber' }) +defineOptions({ name: 'Detail' }) const message = useMessage() // 消息弹窗 const { t } = useI18n() // 国际化 @@ -177,6 +225,24 @@ const props = defineProps({ required: true, default: null }, + //展示附件组件的tab标签 + annexTable: { + type: Array, + required: false, + default: ()=>[] + }, + //展示附件组件的tab标签 + annexAlias: { + type: Object, + required: false, + default: ()=>({ + label: '附件', + showDownload:false, + showPreview:false, + hiddenDelete:false + }) + }, + // 是否是基础数据 展现详情顶部表单 isBasic: { type: Boolean, @@ -311,16 +377,15 @@ const props = defineProps({ required: false, default: false }, - //个性化功能标志 - myFuncTypeSign:{ - type: String, + //扩展其他按钮 + otherHeadButttonData:{ + type:Array, required: false, - default: null - }, + default: () => [] + } }) const isShowDrawer = ref(false) const detailLoading = ref(false) -const myFuncTypeSign = props.myFuncTypeSign const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : ''))) if (props.isBasic == true) { @@ -342,23 +407,38 @@ if (props.isBasic == true) { } } -const otherList = [] - +const otherList = [...props.annexTable,{ + label:props.annexAlias.label, + prop:'Annex' +},{ + label:'备注', + prop:'Remarks' +},{ + label:'变更记录', + prop:'ChangeRecord' +}] tabsList.value = [...tabsList?.value,...otherList] if (!tabsList.value || tabsList.value && tabsList.value.length == otherList.length) { tabsList.value.unshift({ - label: '明细', - prop: 'Detail' + label: '明细', + prop: 'Detail' + }) +} +if(!props.isBasic){ + tabsList.value.unshift({ + label: '主数据', + prop: 'Descriptions' }) } -// Tabs + +// Tabs const tabRef = ref() //滚动条 -const scrollbar = ref() +const scrollbar = ref() //附件 备注 变更记录 高度计算 -const remarkHeight = computed(() => { +const remarkHeight = computed(() => { const tab = unref(tabRef) const tabTop = tab?.$el.getBoundingClientRect().top const tabHeight = tab?.$el.getBoundingClientRect().height @@ -372,6 +452,8 @@ const remarkHeight = computed(() => { const annexData = reactive({ annexList: [] }) +// // 其他附件默认数据数组 +const annexTableData = ref>([]) // 备注数据 const remarksData = reactive({ @@ -393,6 +475,48 @@ const getFileList = async () => { detailLoading.value = false } } +// 获取其他附件列表篇 +const getAnnexFileList = async (row) => { + props.annexTable?.forEach(async (item) => { + let requstData = {...remarksData.data,tableName: item?.tableName} + if(item?.queryParams){ + item?.queryParams?.forEach(queryItem => { + requstData[queryItem.queryField] = row[queryItem.rowField] + }); + } + const annexList = await FileApi.getFileList(requstData) + const annexData = annexTableData.value.find(annex=>annex.label === item.label) + if(annexData){ + annexData.annexList = annexList + }else{ + annexTableData.value.push({ + align:item.align, + label: item.label, + tableName: item?.tableName || '', + annexList, + hasSubDetail:item.hasSubDetail||false, + subDetailTableData:item.subDetailTableData, + fileType:item.fileType||['apk','doc', 'xls', 'ppt', 'txt', 'pdf','png', 'jpg', 'jpeg'], + showPreview:item.showPreview||false, // 是否展示预览按钮 + showDownload:item.showDownload||false, // 是否展示下载按钮 + hiddenDelete:item.hiddenDelete || false, // 是否展示删除按钮 + }) + if(item?.subDetailTableData){ + const { tableObject:subTableObject, tableMethods:subTableMethods } = useTable({ + getListApi: item.subDetailTableData.getSubList // 分页接口 + }) + const {getList:getSubList} = subTableMethods + subTableObject.params= {} + item.subDetailTableData.queryParams.forEach(queryItem => { + subTableObject.params[queryItem.queryField] = row[queryItem.rowField] + }); + await getSubList() + item.subDetailTableData.tableList = subTableObject.tableList + console.log('subTableObject',annexTableData.value) + } + } + }) +} /** 添加附件 */ const handleAnnexSuccess = () => { getFileList() @@ -403,6 +527,11 @@ const deleteAnnexSuccess = async () => { getFileList() getChangeRecordList() } +/** 追加的附件 */ +const updateAnnexTableHandle = () => { + getAnnexFileList(detailData.value) + getChangeRecordList() +} // Tabs当前选择 const current = ref(0) @@ -413,14 +542,14 @@ const change = (item, index) => { // 附件/备注/变更记录 -- 点击回到顶部 scrollbar.value.scrollTo({ top: 0}); } - + } //主表所需的参数 const masterParmas = ref({ masterId: '', //主表id number: '', //主表单据号 - status: '', //主表状态 用于控制子表新增编辑按钮显示情况 + status: '' //主表状态 用于控制子表新增编辑按钮显示情况 }) // 列表头部按钮 @@ -455,17 +584,23 @@ const searchTableFormType = ref('') // 表单的类型:create - 新增;updat const formRef = ref() const titleNameRef = ref() const titleValueRef = ref() +const count =ref(0) const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => { titleNameRef.value = titleName titleValueRef.value = titleValue + remarksData.data = { + tableId: row.masterId||row.id, + tableName: tableName + } + count.value++ // 加载明细列表 if (!props.isBasic) { // 设置主表id - masterParmas.value.masterId = row.id + masterParmas.value.masterId = row.masterId||row.id masterParmas.value.number = row.number masterParmas.value.status = row.status tableObjectRef.value.params = { - masterId: row.id + masterId: row.masterId||row.id } await getList() } @@ -474,9 +609,10 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: detailLoading.value = true try { detailData.value = row - // getRemarkList() - // getFileList() - // getChangeRecordList() + getRemarkList() + getFileList() + getAnnexFileList(row) + getChangeRecordList() // 判断详情按钮是否显示 let detailButtonFilter: any = [] let detailButtonAdd: any = [] @@ -502,7 +638,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: defaultButtons.defaultFilterBtn(null) // 筛选 ] } - + HeadButttondata.value = [...HeadButttondata.value,...props.otherHeadButttonData] let detailButtonEdit: any = [] let detailButtonDelete: any = [] if (props.detailButtonIsShowEdit) { @@ -564,11 +700,6 @@ detailAllSchemasRef.value = props.detailAllSchemas // 根据状态返回该按钮是否显示 const isShowMainButton = (row, val) => { - // if (val.indexOf(row.status) > -1) { - // return false - // } else { - // return true - // } return false } @@ -588,13 +719,13 @@ const buttonBaseClick = (val, item) => { }) const item = props.detailAllSchemas.formSchema[0] opensearchTable( - item.field, item?.componentProps?.searchField, - item?.componentProps?.searchTitle, - item?.componentProps?.searchAllSchemas, - item?.componentProps?.searchPage, - item?.componentProps?.searchCondition, - item?.componentProps?.multiple, - undefined,undefined + item.field, item?.componentProps?.searchField, + item?.componentProps?.searchTitle, + item?.componentProps?.searchAllSchemas, + item?.componentProps?.searchPage, + item?.componentProps?.searchCondition, + item?.componentProps?.multiple, + undefined,undefined ) }else{ openForm('create') @@ -613,6 +744,7 @@ const buttonBaseClick = (val, item) => { } else { // 其他按钮 console.log('其他按钮', item) + emit('buttonBaseClick',val, item) } } @@ -643,8 +775,6 @@ const opensearchTable = ( } } } - console.log(searchCondition) - console.log(_searchCondition) searchTableRef.value.open( searchTitle, searchAllSchemas, @@ -674,13 +804,13 @@ const buttonTableClick = async (val, row) => { } const item = props.detailAllSchemas.formSchema[0] opensearchTable( - item.field, item?.componentProps?.searchField, - item?.componentProps?.searchTitle, - item?.componentProps?.searchAllSchemas, - item?.componentProps?.searchPage, - item?.componentProps?.searchCondition, - item?.componentProps?.multiple, - undefined,undefined + item.field, item?.componentProps?.searchField, + item?.componentProps?.searchTitle, + item?.componentProps?.searchAllSchemas, + item?.componentProps?.searchPage, + item?.componentProps?.searchCondition, + item?.componentProps?.multiple, + undefined,undefined ) }else{ openForm('update', row) @@ -694,8 +824,69 @@ const buttonTableClick = async (val, row) => { } /** 添加/修改操作 */ const openForm = async (type: string, row?: number) => { + + formRef.value.open(type, row, masterParmas.value) - emit('detailOpenForm', type, row, masterParmas.value) + emit('detailOpenForm', type, row) + if(type == "create"){ + EquipmentMaintenanceDetail.allSchemas.formSchema.forEach((item) => { + if(item.field == 'peoples'){ + item.componentProps.disabled = true + EquipmentMaintenanceDetailRules.peoples[0].required = false + } + if(item.field == 'estimatedMinutes'){ + EquipmentMaintenanceDetailRules.estimatedMinutes[0].required = true + } + if(item.field == 'actualMinutes'){ + item.componentProps.disabled = true + EquipmentMaintenanceDetailRules.actualMinutes[0].required = false + } + if(item.field == 'completionTime'){ + item.componentProps.disabled = true + EquipmentMaintenanceDetailRules.completionTime[0].required = false + } + if(item.field == 'result'){ + item.componentProps.disabled = true + EquipmentMaintenanceDetailRules.result[0].required = false + } + if(item.field == 'uncompletedCause'){ + item.componentProps.disabled = true + EquipmentMaintenanceDetailRules.uncompletedCause[0].required = false + } + if(item.field == 'name'){ + EquipmentMaintenanceDetailRules.name[0].required = true + } + }) + }else{ + 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 + } + if(item.field == 'actualMinutes'){ + item.componentProps.disabled = false + EquipmentMaintenanceDetailRules.actualMinutes[0].required = true + } + if(item.field == 'completionTime'){ + item.componentProps.disabled = false + EquipmentMaintenanceDetailRules.completionTime[0].required = true + } + if(item.field == 'result'){ + item.componentProps.disabled = false + EquipmentMaintenanceDetailRules.result[0].required = true + } + if(item.field == 'uncompletedCause'){ + item.componentProps.disabled = false + EquipmentMaintenanceDetailRules.uncompletedCause[0].required = false + } + if(item.field == 'name'){ + EquipmentMaintenanceDetailRules.name[0].required = true + } + }) + } } // form 提交 const submitForm = async (formType, data) => { @@ -710,6 +901,7 @@ const submitForm = async (formType, data) => { await props.apiUpdate(data) message.success(t('common.updateSuccess')) } + emit('handleMainFefresh') formRef.value.dialogVisible = false // 刷新当前列表 await getList() @@ -740,7 +932,8 @@ const emit = defineEmits([ 'openImage', 'onBlur', 'detailBasicFormOnChange', - 'formFormDateChange' + 'formFormDateChange', + 'buttonBaseClick' ]) /** 删除按钮操作 */ const handleDelete = async (id: number) => { @@ -752,6 +945,7 @@ const handleDelete = async (id: number) => { await props.apiDelete(id) tableObject.loading = false message.success(t('common.delSuccess')) + emit('handleMainFefresh') // 刷新列表 await getList() updateKey.value += 1 @@ -796,16 +990,16 @@ const openImage=(item)=>{ * @param field 当前操作字段 * @param cur 改变后值 */ - const detailBasicFormOnChange = (field, cur) => { +const detailBasicFormOnChange = (field, cur) => { emit('detailBasicFormOnChange', field, cur) } /** * 监听失焦事件 * @param field 当前操作字段 - * @param e + * @param e */ - const onBlur = (field, e) => { +const onBlur = (field, e) => { emit('onBlur', field, e) } diff --git a/src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts b/src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts index 08f0a4438..b6a83c179 100644 --- a/src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts +++ b/src/views/eam/equipmentMaintenanceMain/equipmentMaintenanceMain.data.ts @@ -4,6 +4,9 @@ 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 {validateInteger, validateroundNumber} from "@/utils/validator"; // 表单校验 export const EquipmentMaintenanceMainRules = reactive({ @@ -355,7 +358,55 @@ export const EquipmentMaintenanceMain = useCrudSchemas(reactive([ export const EquipmentMaintenanceDetailRules = reactive({ number: [required], - contents: [required], + masterId: [required], + peoples: [ + { + required:false , + message:'该项为必填项', + tagger:['blur'] + }, + { + validator:validateroundNumber, + message: '请输入正确的正整数', + trigger: 'blur'}], + estimatedMinutes: [ + { + required:false , + message:'该项为必填项', + tagger:['blur'] + }, + { + validator:validateroundNumber, + message: '请输入正确的正整数', + trigger: 'blur'}], + actualMinutes: [ + { + required:false , + message:'该项为必填项', + tagger:['blur'] + }, + { + validator:validateroundNumber, + message: '请输入正确的正整数', + trigger: 'blur'}], + completionTime: [ + { + required:false , + message:'该项为必填项', + tagger:['blur'] + }], + result: [ + { + required:false , + message:'该项为必填项', + tagger:['blur'] + }], + name: [required], + uncompletedCause:[{ + required:false , + message:'该项为必填项', + tagger:['blur','change'] + }] }) export const EquipmentMaintenanceDetail = useCrudSchemas(reactive([ @@ -373,38 +424,41 @@ export const EquipmentMaintenanceDetail = useCrudSchemas(reactive( field: 'number', sort: 'custom', isSearch: true, + form:{ + componentProps: { + disabled: true + } + } }, { label: '主表id', field: 'masterId', sort: 'custom', isSearch: true, + form:{ + componentProps: { + disabled: true + } + } }, { label: '人数', field: 'peoples', sort: 'custom', isSearch: true, + isForm: true, }, { label: '预计分钟', field: 'estimatedMinutes', sort: 'custom', isSearch: true, - form: { - component: 'InputNumber', - value: 0 - }, }, { label: '实际分钟', field: 'actualMinutes', sort: 'custom', isSearch: true, - form: { - component: 'InputNumber', - value: 0 - }, }, { label: '责任人多选', @@ -445,25 +499,43 @@ export const EquipmentMaintenanceDetail = useCrudSchemas(reactive( field: 'result', sort: 'custom', isSearch: true, + dictType: DICT_TYPE.IS_COMPLETED, + dictClass: 'string', }, { - label: '保养名称', + label: '保养项名称', field: 'name', sort: 'custom', isSearch: true, + isForm: true, + form: { + componentProps: { + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择 类别编码', + searchTitle: '保养项信息', // 查询弹窗标题 + searchAllSchemas: MaintenanceItem.allSchemas, // 查询弹窗所需类 + searchField: 'name', // 查询弹窗赋值字段 + searchPage: ItemApi.getMaintenanceItemPage, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'available', + value: 'TRUE', + action: '==' + }] + } + } }, - { - label: '保养内容', - field: 'content', - sort: 'custom', - isSearch: true, - }, - { - label: '保养部位', - field: 'equipmentParts', - sort: 'custom', - isSearch: true, - }, + // { + // label: '保养内容', + // field: 'content', + // sort: 'custom', + // isSearch: true, + // }, + // { + // label: '保养部位', + // field: 'equipmentParts', + // sort: 'custom', + // isSearch: true, + // }, { label: '创建时间', field: 'createTime', @@ -508,7 +580,10 @@ export const EquipmentMaintenanceDetail = useCrudSchemas(reactive( label: '是否可用', field: 'available', sort: 'custom', - isSearch: true, + isSearch: false, + isTable: false, + isForm: false, + isDetail:false, dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 }, diff --git a/src/views/eam/equipmentMaintenanceMain/index.vue b/src/views/eam/equipmentMaintenanceMain/index.vue index 7317de2b2..f0606d3fb 100644 --- a/src/views/eam/equipmentMaintenanceMain/index.vue +++ b/src/views/eam/equipmentMaintenanceMain/index.vue @@ -55,10 +55,19 @@ @@ -67,30 +76,28 @@