diff --git a/src/api/repairRelation.ts b/src/api/repairRelation.ts new file mode 100644 index 0000000..e567980 --- /dev/null +++ b/src/api/repairRelation.ts @@ -0,0 +1,13 @@ +import http from './http' + + +// 维修工单点检项关系查询 +export function getRepairRelationNoPage(params) { + return http.get('/inspection/repair-relation/noPage',{params}) +} + +// 删除点检项和报修工单关系 +export function deleteBatchByIds(ids: number[]) { + return http.delete(`/inspection/repair-relation/deleteBatchByIds?ids=` + ids) +} + diff --git a/src/pages.json b/src/pages.json index 9be7f9d..3d4d2e9 100644 --- a/src/pages.json +++ b/src/pages.json @@ -272,6 +272,13 @@ { "navigationBarTitleText" : "" } + }, + { + "path" : "pages/repairOrder/customModal", + "style" : + { + "navigationBarTitleText" : "" + } } ], "tabBar": { diff --git a/src/pages/overhaulOrder/addForm.vue b/src/pages/overhaulOrder/addForm.vue index d87c002..71d85a0 100644 --- a/src/pages/overhaulOrder/addForm.vue +++ b/src/pages/overhaulOrder/addForm.vue @@ -46,6 +46,16 @@ + + + + {{form.sourceTypeName}} + + + {{`请选择工单来源`}} + + + @@ -81,7 +91,7 @@ {{item.name}} - + @@ -93,14 +103,14 @@ 预估分钟: {{item.estimatedMinutes}}分钟 - - 实际分钟: - {{item.actualMinutes}}分钟 - 责任人: {{item.chargePeoplesName}} + @@ -190,6 +200,7 @@ import * as repairOrderApi from "@/api/repairOrder" import * as deviceApi from "@/api/device" import * as deptApi from "@/api/dept" + import * as repairRelationApi from "@/api/repairRelation" const { proxy } = getCurrentInstance() const loading = ref(false) @@ -205,7 +216,9 @@ deviceNumber: '', faultTypeName: '', maintenance:'', - subList: [] + subList: [], + sourceType: '', + sourceTypeName: '' }) @@ -222,6 +235,7 @@ const isShowSelecUser = ref(false) const chooseUserInfo = ref(null) const serviceList = ref([]) + const sourceType = ref() const list = ref([{ name: '检修内容' }]) @@ -248,6 +262,24 @@ proxy.$modal.showToast('请选择维修人员') return; } + + for (let item of serviceList.value) { + if (item.name_hide_delete) { + if (!item.peoples) { + proxy.$modal.showToast('*'+item.name+'*的检修项的【预估人数】不能为空'); + return; // 中断方法执行 + } + if (!item.estimatedMinutes) { + proxy.$modal.showToast('*'+item.name+'*的检修项的【预估分钟】不能为空'); + return; // 中断方法执行 + } + if (!item.chargePeoples) { + proxy.$modal.showToast('*'+item.name+'*的检修项的【责任人】不能为空'); + return; // 中断方法执行 + } + } + } + const data = { id: form.value && form.value.id ? form.value.id : '', describes: form.value.describes, @@ -325,7 +357,10 @@ deviceNumber:'', faultTypeName:'', maintenance:'', - subList: [] + subList: [], + sourceType: '', + sourceTypeName: '' + } isDisabled.value = false } @@ -444,6 +479,7 @@ isDisabled.value = form.value.maintenanceNumber || form.value.id ? true : false }; faultType.value = await dictApi.getDict('fault_type') + sourceType.value = await dictApi.getDict('order_source_type') uni.$on('chooseOrder', data => { if (data) { form.value.maintenanceNumber = data.number @@ -453,6 +489,7 @@ form.value.factoryAreaName = data.factoryAreaName form.value.factoryAreaNumber = data.factoryAreaNumber form.value.subList= data.subList + form.value.sourceType=data.sourceType isDisabled.value = true } else { form.value.maintenanceNumber = '' @@ -462,16 +499,27 @@ form.value.factoryAreaName = '' form.value.factoryAreaNumber = '' form.value.subList= [] + form.value.sourceType='0' isDisabled.value = false } - + form.value.sourceTypeName = sourceType.value.find(item=>item.value == form.value.sourceType).label + if(form.value.sourceType == '1'){ + repairRelationApi.getRepairRelationNoPage({repairNumber:form.value.maintenanceNumber}).then(response=>{ + serviceList.value = response.data.map(item=>{ + return { + name: item.spotInspectionName, + name_hide_delete: true, + } + }) + }) + } }) // 从其他页面返回时,处理回写数据 uni.$on('handleSubmitForm', (formData) => { // 更新 serviceList - if (formData.id) { + if (formData.name_hide_delete) { // 更新已有项目 - const index = serviceList.value.findIndex(item => item.id === formData.id); + const index = serviceList.value.findIndex(item => item.name === formData.name); if (index !== -1) { serviceList.value.splice(index, 1, formData); } @@ -606,6 +654,7 @@ font-size: 28rpx; margin-top: 6rpx; color: #acacac; + padding: 3rpx 30rpx; uni-view { display: inline-block; } @@ -768,7 +817,6 @@ padding: 20rpx 30rpx; border-bottom: 1px solid #e4e4e4; display: flex; - .title-txt { color: #409eff; font-size: 30rpx; diff --git a/src/pages/overhaulOrder/addSubItem.vue b/src/pages/overhaulOrder/addSubItem.vue index 392e45e..a64e648 100644 --- a/src/pages/overhaulOrder/addSubItem.vue +++ b/src/pages/overhaulOrder/addSubItem.vue @@ -11,10 +11,7 @@ - - - - + {{selectFormatCheck(form.chargePeoples,selecUserList)}} @@ -25,6 +22,9 @@ + - + @@ -175,6 +175,7 @@ estimatedMinutes: '', actualMinutes: '', chargePeoples: '', + chargePeoplesName : '', status:null, completionTime: '', engineer: '', @@ -230,6 +231,10 @@ proxy.$modal.showToast('预估人数请输入正整数') return; } + if (!form.value.chargePeoples) { + proxy.$modal.showToast('请输入责任人') + return; + } if (form.value.peoples > 100) { proxy.$modal.showToast('预估人数不得超出100') return; @@ -276,6 +281,7 @@ form.value.estimatedMinutes = '' form.value.actualMinutes = '' form.value.chargePeoples = '' + form.value.chargePeoplesName = '' form.value.status = null form.value.completionTime = '' form.value.engineer = '' @@ -317,6 +323,7 @@ function selectFormatCheck(val, array) { const arr = val.split(',').map(Number) let str = array.filter(item => arr.includes(item.id)).map(item => item.name).join(',') + form.value.chargePeoplesName = str return str } // 选择人员 @@ -451,8 +458,7 @@ if (option.factoryAreaNumber) factoryAreaNumber.value = option.factoryAreaNumber; if (option.number) form.value.number = option.number; if (option.deviceNumber) form.value.deviceNumber = option.deviceNumber; - if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option - .data)).id) { + if (option.data && JSON.parse(decodeURIComponent(option.data))) { form.value = JSON.parse(decodeURIComponent(option.data)) form.value.itemNumbers = form.value.items formatDate.value = form.value.completionTime ? proxy.$time.formatDate(form.value.completionTime) : '' diff --git a/src/pages/overhaulOrder/customModal.vue b/src/pages/overhaulOrder/customModal.vue new file mode 100644 index 0000000..238c539 --- /dev/null +++ b/src/pages/overhaulOrder/customModal.vue @@ -0,0 +1,62 @@ + + + + + \ No newline at end of file diff --git a/src/pages/overhaulOrder/reqairOrderList.vue b/src/pages/overhaulOrder/reqairOrderList.vue index e5aa69c..5d598fe 100644 --- a/src/pages/overhaulOrder/reqairOrderList.vue +++ b/src/pages/overhaulOrder/reqairOrderList.vue @@ -6,8 +6,8 @@ - - {{item.describes}} + + {{item.describes}} @@ -53,6 +53,8 @@ + + @@ -66,10 +68,13 @@ } from 'vue' import * as repairOrderApi from "@/api/repairOrder" + import CustomModal from './customModal.vue' const { proxy } = getCurrentInstance() const repairOrderList = ref([]) const type = ref('') + const dialogVisible = ref(false) + const dialogContent = ref('') // 获取设备保修列表 function getList() { @@ -97,6 +102,13 @@ uni.$emit('chooseOrder',data) proxy.$tab.navigateBack() } + const showFullDescription = (description, event) => { + dialogContent.value = description + dialogVisible.value = true + if (event) { + event.stopPropagation(); + } + } onLoad((option) => { if (option.type) type.value = option.type; getList() @@ -133,6 +145,13 @@ width: 0px; flex: 1; word-wrap: break-word; + .ellipsis { + display: block; + max-width: 100%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } } .time { diff --git a/src/pages/repairOrder/customModal.vue b/src/pages/repairOrder/customModal.vue new file mode 100644 index 0000000..238c539 --- /dev/null +++ b/src/pages/repairOrder/customModal.vue @@ -0,0 +1,62 @@ + + + + + \ No newline at end of file diff --git a/src/pages/repairOrder/detail.vue b/src/pages/repairOrder/detail.vue index b7dd1b8..9279f3a 100644 --- a/src/pages/repairOrder/detail.vue +++ b/src/pages/repairOrder/detail.vue @@ -229,22 +229,42 @@ - - 完成类型 - - - - {{item.label}} - - - - - 取消 - 确认 + 完成类型 + +
+ + + + {{ item.label }} + + +
+
+ + +
+ +
+ + + {{ item.label }} + + +
+
+ + 取消 + 确认 +
- 验证完结意见 @@ -287,6 +307,7 @@ import * as dictApi from "@/api/dict" import * as repairOrderApi from "@/api/repairOrder" import { useCountStore } from '@/store' + import * as repairRelationApi from "@/api/repairRelation" const { proxy } = getCurrentInstance() // 获取自定义的store @@ -326,6 +347,9 @@ const field = ref('') const maintenanceShift = ref([]) //班次字典项 const faultType = ref([]) //故障类型字典项 + const isShowMultiSelect = ref(false) + const options = ref([]) + const selectedOptions = ref([]) function change(index) { current.value = index changeItem.value = list.value[current.value] @@ -368,8 +392,39 @@ return; } } - isShowSuccess.value = true + + // 检查 result 值 + if (result.value == 'TEMPORARILY') { + fetchOptions(); + }else{ + isShowMultiSelect.value =false; + } + isShowSuccess.value = true + } + + function fetchOptions() { + // 模拟从后台查询数据 + const tempParams = { + deviceNumber: data.value.deviceNumber, + type: data.value.type, + repairNumber: data.value.number, + }; + repairRelationApi.getRepairRelationNoPage(tempParams).then(res=>{ + options.value = res.data.map(element => { + return { + value: element.id, + label: element.spotInspectionName + }; + }) + if(options.value.length > 0){ + isShowMultiSelect.value = true; + }else{ + isShowMultiSelect.value =false; + } + }); } + + /** * 维修确认点击时间 */ @@ -392,6 +447,15 @@ function radioGroupChange(e) { result.value = e + if (e == 'TEMPORARILY') { + fetchOptions(); + }else{ + isShowMultiSelect.value =false; + } + } + + function selectedOptionsChange(e){ + selectedOptions.value = e } // 完成 async function orderClickFinish() { @@ -415,7 +479,9 @@ faultType: data.value.faultType } // 如果直接点击完成先走修改工单接口 - await repairOrderApi.repairOrderUpdate(dataTwo, type.value).then((res) => { }).catch(() => { + await repairOrderApi.repairOrderUpdate(dataTwo, type.value).then((res) => { + + }).catch(() => { proxy.$modal.closeLoading() loading.value = false }) @@ -423,6 +489,12 @@ loading.value = true await repairOrderApi.orderClickFinish(dataOne, type.value).then((res) => { if (res.data) { + if(result.value != 'TEMPORARILY') { + selectedOptions.value = options.value.map(option=>option.value) + } + if(selectedOptions.value.length>0){ + repairRelationApi.deleteBatchByIds(selectedOptions.value) + } proxy.$modal.showToast('操作成功') setTimeout(() => { proxy.$tab.navigateBack() @@ -1021,4 +1093,55 @@ } } + .multi-select { + display: flex; + flex-direction: column; + align-items: flex-start; /* 左对齐 */ + margin-top: 10px; + padding: 0 1.875rem 0; + } + + .form-item { + display: flex; + flex-direction: column; + align-items: flex-start; /* 标签左对齐 */ + margin-top: 10px; + } + + .form-label { + margin-bottom: 5px; + } + + .scroll-container { + max-height: 200px; /* 根据需要调整 */ + overflow-y: auto; + width: 100%; + } + + .radio-group, + .checkbox-group { + display: flex; + flex-direction: column; + align-items: center; /* 内容居中 */ + width: 100%; + padding: 0 20px; + } + + .radio-item, + .checkbox-item { + display: flex; + align-items: center; /* 复选框和内容在同一行 */ + width: 100%; + padding: 5px 0; + } + + .checkbox-label { + display: inline-block; + max-width: 150px; /* 根据需要调整 */ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + margin-left: 8px; /* 调整复选框与文本之间的距离 */ + vertical-align: middle; + } \ No newline at end of file diff --git a/src/pages/repairOrder/index.vue b/src/pages/repairOrder/index.vue index b64703e..c8a55db 100644 --- a/src/pages/repairOrder/index.vue +++ b/src/pages/repairOrder/index.vue @@ -11,8 +11,8 @@ - - {{item.describes}} + + {{item.describes}} @@ -55,6 +55,8 @@ + + @@ -71,6 +73,7 @@ } from 'vue' import * as repairOrderApi from "@/api/repairOrder" import { useCountStore } from '@/store' + import CustomModal from './customModal.vue' const { proxy } = getCurrentInstance() // 获取自定义的store @@ -82,6 +85,8 @@ }) const status = ref('loadmore') //是否显示没有更多了 const list = ref([]) + const dialogVisible = ref(false) + const dialogContent = ref('') function itemClick(item, index) { proxy.$tab.navigateTo(`/pages/repairOrder/detail?type=${params.value.type}&number=${item.number}`) } @@ -124,120 +129,111 @@ onReachBottom(() => { getList() }) - - - \ No newline at end of file diff --git a/src/pages/spotCheckOrder/addForm.vue b/src/pages/spotCheckOrder/addForm.vue index 37e8dba..cb39376 100644 --- a/src/pages/spotCheckOrder/addForm.vue +++ b/src/pages/spotCheckOrder/addForm.vue @@ -65,7 +65,17 @@ - + + + * + 巡检点检记录: + + +