From 0a7b35fc7e69f59576e7825d890e22f4057f74a5 Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Fri, 21 Jun 2024 16:48:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(app):=20=E6=B7=BB=E5=8A=A0=E4=BF=9D?= =?UTF-8?q?=E5=85=BB=E7=BB=B4=E4=BF=AE=E5=B7=A5=E5=8D=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/eam/basicFaultType.js | 5 + src/api/eam/device.js | 5 + src/api/eam/repairOrder.js | 10 +- src/api/eam/upkeepOrder.js | 104 +++ src/api/{ => eam}/user.js | 10 +- src/api/upkeepOrder.js | 40 - src/api/wms/workShop.js | 5 + src/common/utils/common.ts | 138 +++ src/common/utils/dateTime.ts | 50 ++ src/common/utils/http.ts | 19 + src/common/utils/utils.ts | 31 + src/common/utils/validator.ts | 783 +++++++++++++++++ src/components/item/slectItemList.vue | 269 ++++++ src/pages.json | 8 +- src/pages/eam/repairOrder/addForm.vue | 243 +++--- .../eam/repairOrder/addServiceRecord.vue | 21 +- src/pages/eam/repairOrder/detail.vue | 280 ++++-- src/pages/eam/repairOrder/index.vue | 20 +- .../addForm.vue | 1 - .../upkeepOrder/addServiceRecord.vue | 97 ++- src/pages/eam/upkeepOrder/detail.vue | 798 ++++++++++++++++++ src/pages/{ => eam}/upkeepOrder/index.vue | 63 +- src/pages/{ => eam}/upkeepOrder/myOrder.vue | 10 +- src/pages/upkeepOrder/detail.vue | 484 ----------- src/plugins/auth.js | 2 +- 25 files changed, 2711 insertions(+), 785 deletions(-) create mode 100644 src/api/eam/basicFaultType.js create mode 100644 src/api/eam/upkeepOrder.js rename src/api/{ => eam}/user.js (51%) delete mode 100644 src/api/upkeepOrder.js create mode 100644 src/common/utils/common.ts create mode 100644 src/common/utils/dateTime.ts create mode 100644 src/common/utils/http.ts create mode 100644 src/common/utils/utils.ts create mode 100644 src/common/utils/validator.ts create mode 100644 src/components/item/slectItemList.vue rename src/pages/{ => eam}/upkeepOrder/addServiceRecord.vue (84%) create mode 100644 src/pages/eam/upkeepOrder/detail.vue rename src/pages/{ => eam}/upkeepOrder/index.vue (53%) rename src/pages/{ => eam}/upkeepOrder/myOrder.vue (93%) delete mode 100644 src/pages/upkeepOrder/detail.vue diff --git a/src/api/eam/basicFaultType.js b/src/api/eam/basicFaultType.js new file mode 100644 index 0000000..9e0750e --- /dev/null +++ b/src/api/eam/basicFaultType.js @@ -0,0 +1,5 @@ +import http from '../http' +// 根据模具号查询信息 +export function getBasicFaultTypeNoPage(params) { + return http.get('/eam/basic-fault-type/noPage',{params}) +} diff --git a/src/api/eam/device.js b/src/api/eam/device.js index c34043c..1b2935f 100644 --- a/src/api/eam/device.js +++ b/src/api/eam/device.js @@ -35,4 +35,9 @@ export function getSubList(params) { // 新增申领备件时获取备件列表 export function getApplyDeviceList() { return http.get('/eam/device/equipment-accounts/noPage') +} + +// 设备列表不分页 +export function deviceList(params) { + return http.get('/eam/device/equipment-accounts/noPage',{params}) } \ No newline at end of file diff --git a/src/api/eam/repairOrder.js b/src/api/eam/repairOrder.js index c12ed39..0c5e186 100644 --- a/src/api/eam/repairOrder.js +++ b/src/api/eam/repairOrder.js @@ -36,9 +36,9 @@ export function getDeviceRepairDetail(params,type) { // 接单 export function orderClick(params,type) { if (type == 'DEVICE') { - return http.get('/eam/equipment-repair-job-main/orderClick', {params}) + return http.post('/eam/equipment-repair-job-main/updateOrder', params) } else if (type == 'EQUIPMENT') { - return http.get('/eam/equipment-repair-job-main/orderClick', {params}) + return http.post('/eam/equipment-repair-job-main/updateOrder', params) } } // 完成 @@ -84,9 +84,9 @@ export function repairOrderDetailUpdate(data,type) { // 获得维修工单子列表 export function repairOrderDetailList(params,type) { if (type == 'DEVICE') { - return http.get('/eam/equipment-repair-job-detail/page', {params}) + return http.get('/eam/equipment-repair-job-detail/noPage', {params}) } else if (type == 'EQUIPMENT') { - return http.get('/eam/equipment-repair-job-detail/page', {params}) + return http.get('/eam/equipment-repair-job-detail/noPage', {params}) } } // 删除维修工单子 @@ -113,7 +113,7 @@ export function repairOrderList(params) { } // 获取维修工单的报修信息 export function getDeviceRepairDetailsByNumber(params) { - return http.get('/eam/device-repair-request/getDetailsByNumber', { + return http.get('/eam/equipment-repair-job-main/detail', { params }) } \ No newline at end of file diff --git a/src/api/eam/upkeepOrder.js b/src/api/eam/upkeepOrder.js new file mode 100644 index 0000000..feedb82 --- /dev/null +++ b/src/api/eam/upkeepOrder.js @@ -0,0 +1,104 @@ + import http from '../http' + + +// 添加工单 +export function upkeepOrderCreate(data,type) { + if (type == 'DEVICE') { + return http.post('/eam/equipment-maintenance-main/create',data) + } else if (type == 'EQUIPMENT') { + return http.post('/eam/equipment-maintenance-main/create',data) + } +} +// 编辑工单 +export function upkeepOrderUpdate(data,type) { + if (type == 'DEVICE') { + return http.put('/eam/equipment-maintenance-main/update',data) + } else if (type == 'EQUIPMENT') { + return http.put('/eam/equipment-maintenance-main/update',data) + } +} +// 工单列表 +export function upkeepOrderPage(params,type) { + if (type == 'DEVICE') { + return http.get('/eam/equipment-maintenance-main/page',{params}) + } else if (type == 'EQUIPMENT') { + return http.get('/eam/equipment-maintenance-main/page',{params}) + } +} + +// 工单列表 +export function upkeepOrderInfo(params,type) { + if (type == 'DEVICE') { + return http.get('/eam/equipment-maintenance-main/get',{params}) + } else if (type == 'EQUIPMENT') { + return http.get('/eam/equipment-maintenance-main/get',{params}) + } +} + +// 接单 +export function orderClick(params,type) { + if (type == 'DEVICE') { + return http.post('/eam/equipment-maintenance-main/updateOrder',params) + } else if (type == 'EQUIPMENT') { + return http.post('/eam/equipment-maintenance-main/updateOrder',params) + } +} + +export function orderClickVerify(params,type) { + if (type == 'DEVICE') { + return http.get('/eam/equipment-maintenance-main/orderClickVerify',{params}) + } else if (type == 'EQUIPMENT') { + return http.get('/eam/equipment-maintenance-main/orderClickVerify',{params}) + } +} + +// 完成保养工单 +export function orderClickFinish(params,type) { + if (type == 'DEVICE') { + return http.post('/eam/equipment-maintenance-main/updateOrders',params) + } else if (type == 'EQUIPMENT') { + return http.post('/eam/equipment-maintenance-main/updateOrders',params) + } +} + +// 修改保养工单完成状态 +export function excuteFinish(params,type) { + if (type == 'DEVICE') { + return http.post('/eam/equipment-maintenance-main/execute',params) + } else if (type == 'EQUIPMENT') { + return http.post('/eam/equipment-maintenance-main/execute',params) + } +} + +// 添加维修工单子项维修内容 +export function upkeepOrderDetailCreate(data,type) { + if (type == 'DEVICE') { + return http.post('/eam/device-maintain-job-detail/create',data) + } else if (type == 'EQUIPMENT') { + return http.post('/eam/device-maintain-job-detail/create',data) + } +} +// 编辑维修工单子项维修内容 +export function upkeepOrderDetailUpdate(data,type) { + if (type == 'DEVICE') { + return http.put('/eam/equipment-maintenance-detail/update',data) + } else if (type == 'EQUIPMENT') { + return http.put('/eam/equipment-maintenance-detail/update',data) + } +} +// 获得维修工单子列表 +export function upkeepOrderDetailList(params,type) { + if (type == 'DEVICE') { + return http.post('/eam/equipment-maintenance-detail/noPage',params) + } else if (type == 'EQUIPMENT') { + return http.post('/eam/equipment-maintenance-detail/noPage',params) + } +} +// 删除维修工单子 +export function upkeepOrderDetailDelete(id,type) { + if (type == 'DEVICE') { + return http.delete('/eam/device-maintain-job-detail/delete?id='+id) + } else if (type == 'EQUIPMENT') { + return http.delete('/eam/device-maintain-job-detail/delete?id='+id) + } +} diff --git a/src/api/user.js b/src/api/eam/user.js similarity index 51% rename from src/api/user.js rename to src/api/eam/user.js index ae2ca87..cff4026 100644 --- a/src/api/user.js +++ b/src/api/eam/user.js @@ -1,5 +1,11 @@ -import http from './http' +import http from '../http' // 用户密码重置 export function updateUserPassword(data) { return http.put('/eam/device-accounts/getDetailsByNumber',data) -} \ No newline at end of file +} + + +export function getAllUserSimpleInfo(){ + return http.get('/system/user/list-all-simple') +} + diff --git a/src/api/upkeepOrder.js b/src/api/upkeepOrder.js deleted file mode 100644 index 923ba55..0000000 --- a/src/api/upkeepOrder.js +++ /dev/null @@ -1,40 +0,0 @@ -import http from './http' - - -// 添加工单 -export function upkeepOrderCreate(data) { - return http.post('/eam/device-maintain-job-main/create',data) -} -// 编辑工单 -export function upkeepOrderUpdate(data) { - return http.put('/eam/device-maintain-job-main/update',data) -} -// 工单列表 -export function upkeepOrderPage(params) { - return http.get('/eam/device-maintain-job-main/getAppPage',{params}) -} -// 接单 -export function orderClick(params) { - return http.get('/eam/device-maintain-job-main/orderClick',{params}) -} - -// 完成保养工单 -export function orderClickFinish(params) { - return http.get('/eam/device-maintain-job-main/orderClickFinish',{params}) -} -// 添加维修工单子项维修内容 -export function upkeepOrderDetailCreate(data) { - return http.post('/eam/device-maintain-job-detail/create',data) -} -// 编辑维修工单子项维修内容 -export function upkeepOrderDetailUpdate(data) { - return http.put('/eam/device-maintain-job-detail/update',data) -} -// 获得维修工单子列表 -export function upkeepOrderDetailList(params) { - return http.get('/eam/device-maintain-job-detail/selectListByNumber',{params}) -} -// 删除维修工单子 -export function upkeepOrderDetailDelete(id) { - return http.delete('/eam/device-maintain-job-detail/delete?id='+id) -} diff --git a/src/api/wms/workShop.js b/src/api/wms/workShop.js index 7dda968..d3bff7c 100644 --- a/src/api/wms/workShop.js +++ b/src/api/wms/workShop.js @@ -13,4 +13,9 @@ export function getAreaBasicInfoNoPage(params) { // 获取库位 export function getLocationBasicInfoNoPage(params) { return http.get('/wms/locationgroup/list',{params}) +} + +// 获取班组 +export function getTeamNoPage(params) { + return http.get('/wms/team/noPage',{params}) } \ No newline at end of file diff --git a/src/common/utils/common.ts b/src/common/utils/common.ts new file mode 100644 index 0000000..1dc4fca --- /dev/null +++ b/src/common/utils/common.ts @@ -0,0 +1,138 @@ + + +const _dTo = function(url) { + if (!_getSync('isLogin')) { + _gTo('/pages/login/index') + return; + } + uni.navigateTo({ + url: url + }); +} +const _gTo = function(url) { + uni.navigateTo({ + url: url + }); +} +const _getSync = (i) => { + return uni.getStorageSync(i); +} +const _removeSync = (i) => { + return uni.removeStorageSync(i); +} +const _setSync = (i, data) => { + return uni.setStorageSync(i, data); +} +const _alert = (txt, cb) => { + uni.showModal({ + title: '温馨提示', + content: txt, + showCancel: false, + confirmColor: '#2979ff', + success: function() { + cb && cb(); + } + }); +} + +const _confirm = function(txt, cb) { + uni.showModal({ + title: '温馨提示', + content: txt, + showCancel: true, + confirmColor: '#2979ff', + success: function(res) { + if (res.confirm) { + cb && cb(); + } + } + }); +} + +const _toast = function(txt) { + uni.showToast({ + title: txt, + icon: 'none', + duration: 1500 + }); +} + + +const _backT = function() { + uni.navigateBack(); +} +const _call = function(tel) { + uni.makePhoneCall({ + phoneNumber: tel + }); +} + +const _showLoading = (msg = '') => uni.showLoading({ + mask: true, + title: msg +}); + +/** + * 关闭loading + */ +const _closeLoading = () => uni.hideLoading(); + +// 获取截图宽高 +const _screenshot = function(fromWhere, widthProp, proportion) { + var width = 0, + height = 0; + uni.getSystemInfo({ + //整个手机屏幕的高 + success: function(res) { + width = parseInt(res.screenWidth * widthProp) //宽等于屏幕款*百分比 + height = width * proportion + } + }); + _gTo('../u-avatar-cropper/u-avatar-cropper?destWidth=' + (width * 2) + '&destHeight=' + (height * 2) + + '&rectWidth=' + width + '&rectHeight=' + height + '&fileType=jpg' + '&fromWhere=' + + fromWhere) +} +// 复制 +const _copy = (data) => { + uni.setClipboardData({ + data: data, + success: function() { + } + }); +} +const _upLoad = function(tempFilePaths) { + return new Promise((resolve, reject) => { + uni.uploadFile({ + url: import.meta.env.VITE_BASE_URL + '/common/upload', //仅为示例,非真实的接口地址 + filePath: tempFilePaths, + name: 'file', + formData: { + 'user': 'test' + }, + header: { "Content-Type": "multipart/form-data", 'openId': uni.getStorageSync('openId') }, + success: (uploadFileRes) => { + let item = JSON.parse(uploadFileRes.data.replace(/\ufeff/g, "")); + resolve(item) + }, + fail(err) { + } + }); + }) +} +export { + _dTo, + _gTo, + _toast, + _backT, + _call, + _confirm, + _alert, + _getSync, + _setSync, + _removeSync, + _showLoading, + _closeLoading, + _screenshot, + _copy, + _upLoad +}; diff --git a/src/common/utils/dateTime.ts b/src/common/utils/dateTime.ts new file mode 100644 index 0000000..2e1495a --- /dev/null +++ b/src/common/utils/dateTime.ts @@ -0,0 +1,50 @@ +const zeroPadd = function(date,seperator) { + var hours = date.getHours(); // 获取时 + var minutes = date.getMinutes(); // 获取分 + var second = date.getSeconds(); // 获取秒 + var seperator1 = seperator?seperator:"-"; // 自定义日期分隔符 + var year = date.getFullYear(); // 获取年 + var month = date.getMonth() + 1; // 获取月 + var strDate = date.getDate(); // 获取日 + + if (month >= 1 && month <= 9) { + month = "0" + month; + } + if (strDate >= 0 && strDate <= 9) { + strDate = "0" + strDate; + } + if (hours >= 0 && hours <= 9) { + hours = "0" + hours; + } + if (minutes >= 0 && minutes <= 9) { + minutes = "0" + minutes; + } + if (second >= 0 && second <= 9) { + second = "0" + second; + } + var time = hours + ":" + minutes + ":" + second; // 时分秒 + var currentdate = year + seperator1 + month + seperator1 + strDate; // 年月日 + var date = { + time, currentdate + } + return date; +} + +// 获取当前日期 时间 +const getNowFormatDate = function(date,seperator) { + return zeroPadd(date,seperator); +} + +//获取一小时后的日期 时间 +const accessTimeInAnHour = function(date, h,seperator) { + var date1 = date.getTime(); // 获取当前时间戳 + // 当前时间戳+3600s(一小时,其他时间通过计算时间戳进行相应加减),重新设置 Date 对象 + date.setTime(date1 + h * 3600000); + return zeroPadd(date,seperator); +} + + +export { + getNowFormatDate, + accessTimeInAnHour, +}; diff --git a/src/common/utils/http.ts b/src/common/utils/http.ts new file mode 100644 index 0000000..0c62a65 --- /dev/null +++ b/src/common/utils/http.ts @@ -0,0 +1,19 @@ +// @ts-ignore +import buildURL from 'axios/lib/helpers/buildURL' +import type { AxiosRequestConfig } from 'axios' + +type ParamsSerializer = AxiosRequestConfig['paramsSerializer'] + +export function getFullURL( + baseURL: string, + url: string, + params: Record, + paramsSerializer?: ParamsSerializer +) { + if (url.startsWith('http')) { + return buildURL(url, params, paramsSerializer) + } + baseURL = baseURL.endsWith('/') ? baseURL : `${baseURL}/` + url = url.startsWith('/') ? url.slice(1) : url + return buildURL(`${baseURL}${url}`, params, paramsSerializer) +} diff --git a/src/common/utils/utils.ts b/src/common/utils/utils.ts new file mode 100644 index 0000000..023eb13 --- /dev/null +++ b/src/common/utils/utils.ts @@ -0,0 +1,31 @@ + + +function compareVersion(v1, v2) { + v1 = v1.split('.') + v2 = v2.split('.') + const len = Math.max(v1.length, v2.length) + + while (v1.length < len) { + v1.push('0') + } + while (v2.length < len) { + v2.push('0') + } + + for (let i = 0; i < len; i++) { + const num1 = parseInt(v1[i]) + const num2 = parseInt(v2[i]) + + if (num1 > num2) { + return 1 + } else if (num1 < num2) { + return -1 + } + } + + return 0 +} + +export default { + compareVersion +} diff --git a/src/common/utils/validator.ts b/src/common/utils/validator.ts new file mode 100644 index 0000000..7452a7c --- /dev/null +++ b/src/common/utils/validator.ts @@ -0,0 +1,783 @@ +//校验学校编码 只能为数字 +export function validateCode(rule, value, callback) { + if (!value) { + return callback(new Error('学校编码不能为空')) + } else { + const codeReg = /^[0-9]+$/ + const codeMax = /^\d{0,5}$/ + if (codeReg.test(value)) { + if (codeMax.test(value)) { + callback() + } else { + callback(new Error('学校编码不能大于5位')) + } + + } else { + callback(new Error('请输入正确的学校编码,只能是数字')) + } + } +} + +//校验邮箱 +export function validateEmail(rule, value, callback) { + if (value) { + const mailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/ + if (mailReg.test(value)) { + callback() + } else { + callback(new Error('请输入正确的邮箱格式')) + } + } else { + callback() + } +} + +//校验英文 +export function validateEng(rule, value, callback) { + if (value) { + const mailReg = /^[A-Za-z\-\&\(\)\Ⅰ\Ⅱ\Ⅲ\Ⅳ\Ⅴ\Ⅵ\Ⅶ\Ⅷ\Ⅸ\Ⅹ\s]+$/; + if (mailReg.test(value)) { + callback() + } else { + callback(new Error('请输入正确的英文名字')) + } + } else { + callback() + } +} + +//校验姓名拼音 +export function validateEngName(rule, value, callback) { + if (value) { + const EngNameReg = /^[A-Za-z \(\)\s]+$/ + if (EngNameReg.test(value)) { + callback() + } else { + callback(new Error('请输入正确的姓名拼音')) + } + } else { + callback() + } +} + +//校验手机号码 +export function validateHanset(rule, value, callback) { + if (value) { + // const regs =/^[1][3,4,5,6,7,8,9][0-9]{9}$/; + // const regs = /^1[3|4|5|7|8][0-9]\d{8}$/ + const regs = /^1[3-9]\d{9}$/ + if (regs.test(value)) { + callback() + } else { + return callback(new Error('请输入正确的手机号')) + } + } else { + callback() + } +} + +//校验座机电话 +export function validatePhone(rule, value, callback) { + if (value) { + //const reg = /^1[3|4|5|7|8][0-9]\d{8}$/ + // const regs = /^([0-9]{3,4}-)?[0-9]{7,8}$/; + const regs = /^((0\d{2,3}-\d{7,8}))$/; + if (regs.test(value)) { + callback() + } else { + return callback(new Error('请输入正确的座机号')) + } + } else { + callback() + } +} + +//校验家庭电话 手机或者座机 +export function validateFamilyPhone(rule, value, callback) { + if (value) { + const isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/; + const isMob = /^((\+?86)|(\+86))?(13[0123456789][0-9]{8}|15[0123456789][0-9]{8}|17[0123456789][0-9]{8}|18[0123456789][0-9]{8}|147[0-9]{8}|1349[0-9]{7})$/; + if (isPhone.test(value) || isMob.test(value)) { + callback() + } else { + return callback(new Error('请输入正确的手机或者座机电话')) + } + } else { + callback() + } +} + +// 校验只能为中文 +export function validateChinese(rule, value, callback) { + if (value) { + const chineseReg = /^[\u4E00-\u9FA5]+$/ + if (chineseReg.test(value)) { + callback() + } else { + callback(new Error('请输入简介,只能为中文')) + } + } else { + callback() + } +} + +// 校验名称既能为中文也可以为英文 +export function validateName(rule, value, callback) { + if (value) { + const chineseReg = /^[\u4E00-\u9FA5]+$/ + const engLish = /^[A-Za-z]+$/ + if (chineseReg.test(value) || engLish.test(value)) { + callback() + } else { + callback(new Error('请输入正确的中文或者英文名称')) + } + } else { + callback() + } +} + +// 校验负责人既能为中文也可以为英文 +export function validateChargeperson(rule, value, callback) { + if (value) { + const chineseReg = /^[\u4E00-\u9FA5]+$/ + const engLish = /^[A-Za-z]+$/ + if (chineseReg.test(value) || engLish.test(value)) { + callback() + } else { + callback(new Error('请输入正确的负责人(中英文都可以)')) + } + } else { + callback() + } +} + +//校验学校名称不能为空 +export function validateXXMC(rule, value, callback) { + if (!value) { + return callback(new Error('案例名称不能为空')) + } else { + const chineseReg = /^[\u4E00-\u9FA5]+$/ + if (chineseReg.test(value)) { + callback() + } else { + callback(new Error('请输入正确的案例名称,只能是汉字')) + } + } +} + +//校验中英文数字和下划线都可以 +export function validateZYS(rule, value, callback) { + if (value) { + //const postReg =/^[\u4e00-\u9fa5_a-zA-Z0-9_]{4,10}+$/ + const Reg = /^[\u4e00-\u9fa5a-zA-Z0-9]+$/ + if (Reg.test(value)) { + callback() + } else { + callback(new Error('请输入正确的名称')) + } + } else { + callback() + } +} + +// 校验邮政编码 +export function validatePostCode(rule, value, callback) { + if (value) { + const postReg = /^[1-9]\d{5}$/ + if (postReg.test(value)) { + callback() + } else { + callback(new Error('请输入正确的邮政编码')) + } + } else { + callback() + } +} + +// 数字 +export function validateNum(rule, value, callback) { + if (value) { + const numReg = /^[\d]+$/ + if (numReg.test(value)) { + callback() + } else { + callback(new Error('请输入数字')) + } + } else { + callback() + } +} + +//数字和小数点 +export function validateNumDot(rule, value, callback) { + if (value) { + const numReg = /^\d+$|^\d+\.\d+$/g + if (numReg.test(value)) { + callback() + } else { + callback(new Error('请输入数字或小数点')) + } + } else { + callback() + } +} + +// 组织机构代码 +export function validateOrganization(rule, value, callback) { + if (value) { + const orgReg = /^[A-Za-z0-9]\w{14}$/g + if (orgReg.test(value)) { + callback() + } else { + callback(new Error('请输入组织机构代码')) + } + } else { + callback() + } + +} + +// 传真 +export function validateFax(rule, value, callback) { + if (value) { + const faxReg = /^(\d{3,4}-)?\d{7,8}$/ + if (faxReg.test(value)) { + callback() + } else { + callback(new Error('请输入正确的传真')) + } + } else { + callback() + } +} + +// 主页地址 +export function validateHome(rule, value, callback) { + if (value) { + const homeReg = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\*\+,;=.]+$/ + if (homeReg.test(value)) { + callback() + } else { + return callback(new Error('请输入正确的主页地址')) + } + } else { + callback() + } +} + +// 学分 小数,且保留最多三位小数 +export function validateXf(rule, value, callback) { + if (!value) { + return callback(new Error('学分不能为空')) + } else { + const numReg = /^[0-9]+\.[0-9]{0,3}$/ + if (numReg.test(value)) { + callback() + } else { + callback(new Error('请输入小数,且小数点后最多三位')) + } + } +} + +// 数字格式 小数点后一位 +export function validateOneNum(rule, value, callback) { + if (value) { + const numReg = /^\d+(\.\d+)?$/ + const numOneReg = /^\d*\.{0,1}\d{0,1}$/ + if (numReg.test(value)) { + if (numOneReg.test(value)) { + callback() + } else { + callback(new Error('小数点后最多1位')) + } + } else { + callback(new Error('请输入数字')) + } + } + callback() +} + +// 数字格式 小数点后两位 +export function validateTwoNum(rule, value, callback) { + if (value) { + const numReg = /^\d+(\.\d+)?$/ + const numTwoReg = /^\d*\.{0,2}\d{0,2}$/ + if (numReg.test(value)) { + if (numTwoReg.test(value)) { + callback() + } else { + callback(new Error('小数点后最多2位')) + } + } else { + callback(new Error('请输入数字')) + } + } + callback() +} + +// 数字格式 小数点后两位 小数点前保留五位 +export function validateTwoNumThree(rule, value, callback) { + if (value) { + if (Number(value) > 10000) {// 校验value值不能大于10000 + callback(new Error('数值过大,请重新输入')) + } const numReg = /^\d+(\.\d+)?$/ + const numTwoReg = /^\d*\.{0,2}\d{0,2}$/ + if (numReg.test(value)) { + if (numTwoReg.test(value)) { + callback() + } else { + callback(new Error('小数点后最多2位')) + } + } else { + callback(new Error('请输入数字')) + } + } + + callback() +} + +// 数字格式 小数点后三位 +export function validateThreeNum(rule, value, callback) { + if (value) { + const numReg = /^\d+(\.\d+)?$/ + const numTwoReg = /^\d*\.{0,3}\d{0,3}$/ + if (numReg.test(value)) { + if (numTwoReg.test(value)) { + callback() + } else { + callback(new Error('小数点后最多3位')) + } + } else { + callback(new Error('请输入数字')) + } + } + callback() + // if (!value) { + // return callback(new Error('字段不能为空')) + // } else { + // const numReg = /^\d+(\.\d+)?$/ + // const numTwoReg = /^\d*\.{0,3}\d{0,3}$/ + // if (numReg.test(value)) { + // if (numTwoReg.test(value)) { + // callback() + // } else { + // callback(new Error('小数点后最多3位')) + // } + // } else { + // callback(new Error('请输入数字')) + // } + // } +} + +//校验年份必须为4位数字 +export function validateNF(rule, value, callback) { + if (value) { + const NFReg = /^\d{4}$/ + if (NFReg.test(value)) { + callback() + } else { + callback(new Error('请输入4位数字')) + } + } else { + callback() + } +} + +//校验年份必须为4位数字 +export function validateXQ(rule, value, callback) { + if (value) { + const NFReg = /^\d{5}$/ + if (NFReg.test(value)) { + callback() + } else { + callback(new Error('请输入5位数字')) + } + } else { + callback() + } +} + +//校验分数最大值 +export function validateMaxNumber(rule, value, callback) { + if (parseInt(value) <= 200) { + callback() + } else { + callback(new Error('分数不能大于200')) + } + +} + +//校验正整数 +export function validateInteger(rule, value, callback) { + if (value) { + const integerReg = /^[+]{0,1}(\d+)$/ + if (integerReg.test(value)) { + callback() + } else { + callback(new Error('请输入正确的整数')) + } + } else { + callback() + } +} + +//校验整数 +export function validateroundNumber(rule, value, callback) { + if (value) { + const numReg = /^[1-9]\d*$/ + if (numReg.test(value)) { + callback() + } else { + callback(new Error('请输入正确的整数')) + } + } else { + callback() + } +} +// 校验车牌号 +export function validateCarNumber(rule, value, callback) { + if (value) { + // 新能源 + const numReg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([A-HJ-K][A-HJ-NP-Z0-9][0-9]{4}$))/; + // 燃油车 + const numReg1 = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/; + if (value.length == 7) { + if (numReg1.test(value)) { + callback() + }else{ + callback(new Error('请输入正确的车牌号')) + } + } else if (value.length == 8) { + if (numReg.test(value)) { + callback() + }else{ + callback(new Error('请输入正确的车牌号')) + } + } else { + callback(new Error('请输入正确的车牌号')) + } + } else { + callback() + } +} + +//校验身份证号 +export function validateCard(rule, value, callback) { + if (value) { + let cardBoolean = IdCardValidate(value); + // const cardReg =/(^\d{18}$)|(^\d{17}(\d|X|x)$)/ + // if (cardReg.test(value)) { + if (cardBoolean) { + callback() + } else { + callback(new Error('请输入正确的身份证号')) + } + } else { + callback() + } +} + +//身份证:身份证校验 +function IdCardValidate(code) { + var tip = ""; + if (code != "") { + var city = { + 11: "北京", + 12: "天津", + 13: "河北", + 14: "山西", + 15: "内蒙古", + 21: "辽宁", + 22: "吉林", + 23: "黑龙江 ", + 31: "上海", + 32: "江苏", + 33: "浙江", + 34: "安徽", + 35: "福建", + 36: "江西", + 37: "山东", + 41: "河南", + 42: "湖北 ", + 43: "湖南", + 44: "广东", + 45: "广西", + 46: "海南", + 50: "重庆", + 51: "四川", + 52: "贵州", + 53: "云南", + 54: "西藏 ", + 61: "陕西", + 62: "甘肃", + 63: "青海", + 64: "宁夏", + 65: "新疆", + 71: "台湾", + 81: "香港", + 82: "澳门", + 91: "国外 " + }; + + var pass = true; + + //是否为空 + if (code === '') { + tip = "请输入身份证号,身份证号不能为空"; + pass = false; + } + //校验长度,类型 + else if (isCardNo(code) === false) { + tip = "您输入的身份证号码不正确,请重新输入"; + pass = false; + } + //检查省份 + else if (checkProvince(code, city) === false) { + tip = "您输入的身份证号码不正确,请重新输入"; + pass = false; + } + //校验生日 + else if (checkBirthday(code) === false) { + tip = "您输入的身份证号码生日不正确,请重新输入"; + pass = false; + } else { + //18位身份证需要验证最后一位校验位 + if (code.length == 18) { + code = code.split(''); + //∑(ai×Wi)(mod 11) + //加权因子 + var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; + //校验位 + var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2]; + var sum = 0; + var ai = 0; + var wi = 0; + for (var i = 0; i < 17; i++) { + ai = code[i]; + wi = factor[i]; + sum += ai * wi; + } + var last = parity[sum % 11]; + if (parity[sum % 11] != code[17]) { + tip = "身份证格式错误"; + pass = false; + } + } + } + return pass; + } +} + +//身份证:检查身份证号码是否符合规范,包括长度,类型 +function isCardNo(card) { + //身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X + var reg = /(^\d{15}$)|(^\d{17}(\d|X)$)/; + if (reg.test(card) === false) { + return false; + } + return true; +}; + +//身份证:取身份证前两位,校验省份 +function checkProvince(card, city) { + var province = card.substr(0, 2); + if (city[province] == undefined) { + return false; + } + return true; +}; + +//身份证:检查生日是否正确 +function checkBirthday(card) { + var len = card.length; + //身份证15位时,次序为省(3位)市(3位)年(2位)月(2位)日(2位)校验位(3位),皆为数字 + if (len == '15') { + var re_fifteen = /^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/; + var arr_data = card.match(re_fifteen); + var year = arr_data[2]; + var month = arr_data[3]; + var day = arr_data[4]; + var birthday = new Date('19' + year + '/' + month + '/' + day); + return verifyBirthday('19' + year, month, day, birthday); + } + //身份证18位时,次序为省(3位)市(3位)年(4位)月(2位)日(2位)校验位(4位),校验位末尾可能为X + if (len == '18') { + var re_eighteen = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/; + var arr_data = card.match(re_eighteen); + var year = arr_data[2]; + var month = arr_data[3]; + var day = arr_data[4]; + var birthday = new Date(year + '/' + month + '/' + day); + return verifyBirthday(year, month, day, birthday); + } + return false; +}; + +//身份证:校验日期 +function verifyBirthday(year, month, day, birthday) { + var now = new Date(); + var now_year = now.getFullYear(); + //年月日是否合理 + if (birthday.getFullYear() == year && (birthday.getMonth() + 1) == month && birthday.getDate() == day) { + //判断年份的范围(3岁到100岁之间) + var time = now_year - year; + if (time >= 3 && time <= 100) { + return true; + } + return false; + } + return false; +}; + +/** + * 判断身份证号码为18位时最后的验证位是否正确 + * @param a_idCard 身份证号码数组 + * @return + */ +function isTrueValidateCodeBy18IdCard(a_idCard) { + let By18Val = a_idCard[17].toLowerCase(); // 获取第十八位值 + const numReg = /^[1-9]\d*$/ + let numVal = false; // 校验第十八位是否为整数 + if (numReg.test(Number(By18Val))) { + numVal = true + } else { + numVal = false + } + if (By18Val == 'x' || By18Val == 'X' || numVal) { + return true + } else { + return false + } +} + +/** + * 验证身份证号码前两位,省级编码的准确性 + * @param AddressNum + * @constructor + */ +function IdCardValidateAddress(AddressNum) { + var city = { + 11: "北京", + 12: "天津", + 13: "河北", + 14: "山西", + 15: "内蒙古", + 21: "辽宁", + 22: "吉林", + 23: "黑龙江 ", + 31: "上海", + 32: "江苏", + 33: "浙江", + 34: "安徽", + 35: "福建", + 36: "江西", + 37: "山东", + 41: "河南", + 42: "湖北 ", + 43: "湖南", + 44: "广东", + 45: "广西", + 46: "海南", + 50: "重庆", + 51: "四川", + 52: "贵州", + 53: "云南", + 54: "西藏 ", + 61: "陕西", + 62: "甘肃", + 63: "青海", + 64: "宁夏", + 65: "新疆", + 71: "台湾", + 81: "香港", + 82: "澳门", + 91: "国外 " + }; + if (city[AddressNum.substr(0, 2)]) { + return true + } else { + return false + } +} + +/** + * 验证18位数身份证号码中的生日是否是有效生日 + * @param idCard 18位书身份证字符串 + * @return + */ +function isValidityBrithBy18IdCard(idCard18) { + var year = idCard18.substring(6, 10); + var month = idCard18.substring(10, 12); + var day = idCard18.substring(12, 14); + var temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day)); + // 这里用getFullYear()获取年份,避免千年虫问题 + if (temp_date.getFullYear() != parseFloat(year) + || temp_date.getMonth() != parseFloat(month) - 1 + || temp_date.getDate() != parseFloat(day)) { + return false; + } else { + return true; + } +} + +/** + * 验证15位数身份证号码中的生日是否是有效生日 + * @param idCard15 15位书身份证字符串 + * @return + */ +function isValidityBrithBy15IdCard(idCard15) { + var year = idCard15.substring(6, 8); + var month = idCard15.substring(8, 10); + var day = idCard15.substring(10, 12); + var temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day)); + // 对于老身份证中的你年龄则不需考虑千年虫问题而使用getYear()方法 + if (temp_date.getYear() != parseFloat(year) + || temp_date.getMonth() != parseFloat(month) - 1 + || temp_date.getDate() != parseFloat(day)) { + return false; + } else { + return true; + } +} + +/** + * 去掉字符串头尾空格 + * @param str + * @returns {*} + */ +function trim(str) { + return str.replace(/(^\s*)|(\s*$)/g, ""); +} + +export default { + validateCode, + validateEmail, + validateEng, + validatePhone, + validateChinese, + validatePostCode, + validateNum, + validateNumDot, + validateZYS, + validateOrganization, + validateFax, + validateHome, + validateXXMC, + validateXf, + validateOneNum, + validateMaxNumber, + validateTwoNum, + validateTwoNumThree, + validateThreeNum, + validateInteger, + validateNF, + validateXQ, + validateroundNumber, + validateEngName, + validateCard, + validateHanset, + validateFamilyPhone, + validateName, + validateChargeperson, + validateCarNumber +} diff --git a/src/components/item/slectItemList.vue b/src/components/item/slectItemList.vue new file mode 100644 index 0000000..8c67e40 --- /dev/null +++ b/src/components/item/slectItemList.vue @@ -0,0 +1,269 @@ + + + + + + \ No newline at end of file diff --git a/src/pages.json b/src/pages.json index cac104e..c5f1921 100644 --- a/src/pages.json +++ b/src/pages.json @@ -1814,27 +1814,27 @@ "navigationStyle": "custom" } },{ - "path": "pages/upkeepOrder/index", + "path": "pages/eam/upkeepOrder/index", "style": { "navigationBarTitleText": "保养工单", "navigationStyle": "custom" } },{ - "path": "pages/upkeepOrder/detail", + "path": "pages/eam/upkeepOrder/detail", "style": { "navigationBarTitleText": "保养工单详情", "navigationBarBackgroundColor": "#409eff", "navigationBarTextStyle": "white" } },{ - "path": "pages/upkeepOrder/addServiceRecord", + "path": "pages/eam/upkeepOrder/addServiceRecord", "style": { "navigationBarTitleText": "添加保养内容", "navigationBarBackgroundColor": "#409eff", "navigationBarTextStyle": "white" } },{ - "path": "pages/upkeepOrder/myOrder", + "path": "pages/eam/upkeepOrder/myOrder", "style": { "navigationBarTitleText": "我的保养工单", "navigationStyle": "custom" diff --git a/src/pages/eam/repairOrder/addForm.vue b/src/pages/eam/repairOrder/addForm.vue index 940be20..a5c3889 100644 --- a/src/pages/eam/repairOrder/addForm.vue +++ b/src/pages/eam/repairOrder/addForm.vue @@ -2,8 +2,8 @@ - - + + @@ -16,38 +16,38 @@ - - - + 扫描 - - - - + + - - + + - + + {{form.faultTypeName}} @@ -69,6 +69,17 @@ + + + + {{form.urgencyName}} + + + {{`请选择紧急程度`}} + + + + @@ -91,10 +102,12 @@ getCurrentInstance } from 'vue' import * as deviceApi from "@/api/eam/device.js" - import * as moldApi from "@/api/eam/tool.js" + import * as toolApi from "@/api/eam/tool.js" import * as dictApi from "@/api/eam/dict.js" import * as repairOrderApi from "@/api/eam/repairOrder.js" import { useCountStore } from '@/store' + import * as workShopApi from "@/api/wms/workShop.js" + import * as basicFaultTypeApi from "@/api/eam/basicFaultType.js" const { proxy } = getCurrentInstance() // 获取自定义的store @@ -105,12 +118,12 @@ const type = ref('') const form = ref({ id: '', - describes: "", - deviceNumber: '', + maintenanceDesc: "", + equipmentCode: '', deviceName: '', - factoryAreaName: '', - factoryAreaNumber: '', - classes: '', + workshopName: '', + workshopCode: '', + // classes: '', type: '', faultType: '' }) @@ -124,6 +137,7 @@ const faultType = ref([]) const choosesingleColumnItem = ref() const msg = ref('') + const urgency = ref([]) // 扫描设备条码 function chickRightButton(field) { if (!form.value.type) { @@ -132,94 +146,107 @@ } uni.scanCode({ success: function (res) { - form.value.deviceNumber = res.result + form.value.equipmentCode = res.result getDetailsByNumber() } }); } function blur() { - if (form.value.deviceNumber) { + if (form.value.equipmentCode) { getDetailsByNumber() } else { form.value.deviceName = '' - form.value.factoryAreaName = '' - form.value.factoryAreaNumber = '' + form.value.workshopName = '' + form.value.workshopCode = '' } } - // 根据设备/模具号查询信息 + // 根据设备/工装号查询信息 function getDetailsByNumber() { - if (type.value == 'DEVICE' || type.value == 'TECH') { + if (type.value == 'DEVICE') { deviceApi.getDeviceDetailsByNumber({ - number: form.value.deviceNumber, - type: type.value + number: form.value.equipmentCode, }).then((res) => { - if (!res.data) { - msg.value = res.msg - form.value.deviceName = '' - form.value.factoryAreaName = '' - form.value.factoryAreaNumber = '' - return; - } - form.value.deviceName = res.data.name - form.value.factoryAreaName = res.data.factoryAreaName - form.value.factoryAreaNumber = res.data.factoryAreaNumber + workShopApi.getWorkshopNoPage().then(response=>{ + res.data.workshopName = response.data.find(item=>{ + return item.code == res.data.workshopCode + }).name + if (!res.data) { + msg.value = res.msg + form.value.deviceName = '' + form.value.workshopName = '' + form.value.workshopCode = '' + return; + } + form.value.deviceName = res.data.name + form.value.workshopName = res.data.workshopName + form.value.workshopCode = res.data.workshopCode + }) + }).catch(() => { form.value.deviceName = '' - form.value.factoryAreaName = '' - form.value.factoryAreaNumber = '' + form.value.workshopName = '' + form.value.workshopCode = '' }) - } else if (type.value == 'MOLD') { - moldApi.getMoldDetailsByNumber({ - number: form.value.deviceNumber + } else if (type.value == 'EQUIPMENT') { + toolApi.getMoldDetailsByNumber({ + number: form.value.equipmentCode }).then(res => { - if (!res.data) { - msg.value = res.msg - form.value.deviceName = '' - form.value.factoryAreaName = '' - form.value.factoryAreaNumber = '' - return; - } - form.value.deviceName = res.data.name - form.value.factoryAreaName = res.data.factoryAreaName - form.value.factoryAreaNumber = res.data.factoryAreaNumber + workShopApi.getWorkshopNoPage().then(response=>{ + res.data.workshopName = response.data.find(item=>{ + return item.code == res.data.workshopCode + }).name + if (!res.data) { + msg.value = res.msg + form.value.deviceName = '' + form.value.workshopName = '' + form.value.workshopCode = '' + return; + } + form.value.deviceName = res.data.name + form.value.workshopName = res.data.workshopName + form.value.workshopCode = res.data.workshopCode + }) }).catch(() => { form.value.deviceName = '' - form.value.factoryAreaName = '' - form.value.factoryAreaNumber = '' + form.value.workshopName = '' + form.value.workshopCode = '' }) } } // 触发提交表单 function submit() { // 校验 - if (!form.value.describes) { + if (!form.value.maintenanceDesc) { proxy.$modal.showToast('请输入故障描述') return; } - if (!form.value.deviceNumber) { - proxy.$modal.showToast(`请选择${type.value == 'DEVICE' || type.value == 'TECH' ? '设备' : '模具'}名称`) + if (!form.value.equipmentCode) { + proxy.$modal.showToast(`请选择${type.value == 'DEVICE' || type.value == 'TECH' ? '设备' : '工装'}名称`) return; } if (!form.value.deviceName) { proxy.$modal.showToast(msg.value) return; } - if (!form.value.factoryAreaName) { + if (!form.value.workshopName) { proxy.$modal.showToast('请输入区域') return; } - if (!form.value.classes) { - proxy.$modal.showToast('请选择班次') - return; - } + // if (!form.value.classes) { + // proxy.$modal.showToast('请选择班次') + // return; + // } const data = { id: form.value && form.value.id ? form.value.id : '', - describes: form.value.describes, + maintenanceDesc: form.value.maintenanceDesc, type: form.value.type, - deviceNumber: form.value.deviceNumber, - factoryAreaNumber: form.value.factoryAreaNumber, - classes: form.value.classes, - faultType: form.value.faultType + equipmentCode: form.value.equipmentCode, + workshopCode: form.value.workshopCode, + // classes: form.value.classes, + faultType: form.value.faultType, + sources: 1, + urgency: form.value.urgency, + status: 3 } if (form.value.id) { proxy.$modal.confirm('是否修改维修工单').then(() => { @@ -250,7 +277,7 @@ proxy.$modal.confirm('是否添加维修工单').then(() => { proxy.$modal.loading('加载中') loading.value = true - repairOrderApi.repairOrderCreate(data).then((res) => { + repairOrderApi.repairOrderCreate(data,type.value).then((res) => { proxy.$modal.closeLoading() if (res.data) { proxy.$modal.showToast('添加成功') @@ -277,7 +304,7 @@ // 重置 function reset() { if (form.value.id) { - form.value.classes = undefined; + // form.value.classes = undefined; form.value.faultType = undefined } else { form.value = {} @@ -286,8 +313,16 @@ // 单列模式 function openSingleColumn(fieldName, val, list) { - if ((fieldName == 'deviceNumber' || fieldName == 'type') && form.value.id) return; + if ((fieldName == 'equipmentCode' || fieldName == 'type') && form.value.id) return; singleColumnList.value = list + if(fieldName == 'faultType'){ + singleColumnList.value = list.data.map(item=>{ + return { + value: item.code, + label: item.name + } + }) + } field.value = fieldName if (val) { singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)] @@ -299,34 +334,38 @@ // 单列模式点击确定之后 function chooseSingleColumn(e) { form.value[field.value] = e[0].value - if (field.value == 'deviceNumber') { + if (field.value == 'equipmentCode') { choosesingleColumnItem.value = singleColumnList.value.filter(item => item.number == e[0].value) - form.value.factoryAreaName = choosesingleColumnItem.value[0].factoryAreaName - form.value.factoryAreaNumber = choosesingleColumnItem.value[0].factoryAreaNumber + form.value.workshopName = choosesingleColumnItem.value[0].workshopName + form.value.workshopCode = choosesingleColumnItem.value[0].workshopCode form.value.deviceName = choosesingleColumnItem.value[0].name - }else if(field.value == 'classes'){ - form.value.classesName =e[0].label - }else if(field.value == 'faultType'){ + } + // else if(field.value == 'classes'){ + // form.value.classesName =e[0].label + // } + else if(field.value == 'faultType'){ form.value.faultTypeName =e[0].label }else if(field.value == 'type'){ form.value.typeName =e[0].label + }else if(field.value == 'urgency'){ + form.value.urgencyName =e[0].label } singleColumnShow.value = false } - // 获取设备/模具列表 + // 获取设备/工装列表 async function getDeviceList() { if (type.value == 'DEVICE') { await deviceApi.deviceList().then(res => { res.data.map(item => { - item.value = item.number + item.value = item.code item.label = item.name }) deviceList.value = res.data }).catch(() => { }) - } else if (type.value == 'MOLD') { - await moldApi.moldList().then(res => { + } else if (type.value == 'EQUIPMENT') { + await toolApi.moldList().then(res => { res.data.map(item => { - item.value = item.number + item.value = item.code item.label = item.name }) deviceList.value = res.data @@ -341,36 +380,26 @@ let data = JSON.parse(decodeURIComponent(option.data)) form.value = { id: data.id, - describes: data.describes, - deviceNumber: data.deviceNumber, + maintenanceDesc: data.maintenanceDesc, + equipmentCode: data.equipmentCode, deviceName: data.name, - factoryAreaName: data.factoryAreaName, - factoryAreaNumber: data.factoryAreaNumber, - classes: data.classes || data.classes == 0 ? data.classes : undefined, + workshopName: data.workshopName, + workshopCode: data.workshopCode, + // classes: data.classes || data.classes == 0 ? data.classes : undefined, faultType: data.faultType, type: data.type } }; await getDeviceList() maintenanceShift.value = await dictApi.getDict('maintenance_shift') - appDeviceMoldType1.value = await dictApi.getDict('app_device_mold_type') - faultType.value = await dictApi.getDict('fault_type') - if (type.value == 'MOLD') { - appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "MOLD")) + appDeviceMoldType1.value = await dictApi.getDict('device_type') + urgency.value = await dictApi.getDict('eam_maintenance_urgency') + faultType.value = await basicFaultTypeApi.getBasicFaultTypeNoPage() + if (type.value == 'EQUIPMENT') { + appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "EQUIPMENT")) } else { - appDeviceMoldType.value = [] - - if(store.roles.some(item=>item.indexOf('device')>-1)){ - appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "DEVICE")) - } - if(store.roles.some(item=>item.indexOf('tech')>-1)){ - appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "TECH")) - } - if(store.roles.some(item=>item.indexOf('tech')>-1&&item.indexOf('device')>-1)){ - appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value != "MOLD")) - } + appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "DEVICE")) } - form.value.type = appDeviceMoldType.value[0].value form.value.typeName = appDeviceMoldType.value[0].label }) diff --git a/src/pages/eam/repairOrder/addServiceRecord.vue b/src/pages/eam/repairOrder/addServiceRecord.vue index 576a38e..ae77135 100644 --- a/src/pages/eam/repairOrder/addServiceRecord.vue +++ b/src/pages/eam/repairOrder/addServiceRecord.vue @@ -2,11 +2,11 @@ - - + + - - + + @@ -132,8 +132,8 @@ const isShowSelecUser = ref(false) const form = ref({ number: '', - describes: '', - describes1: '', + describing: '', + faultCause: '', workOut: '', maintenances: '', itemNumbers: [], @@ -149,11 +149,11 @@ // 触发提交表单 function submit() { // 校验 - if (!form.value.describes) { + if (!form.value.describing) { proxy.$modal.showToast('请输入故障描述') return; } - if (!form.value.describes1) { + if (!form.value.faultCause) { proxy.$modal.showToast(`请输入故障真因`) return; } @@ -220,8 +220,8 @@ } // 重置 function reset() { - form.value.describes = '' - form.value.describes1 = '' + form.value.describing = '' + form.value.faultCause = '' form.value.workOut = '' form.value.maintenances = '' form.value.itemNumbers = [] @@ -335,6 +335,7 @@ if (option.type) type.value = option.type; if (option.factoryAreaNumber) factoryAreaNumber.value = option.factoryAreaNumber; if (option.number) form.value.number = option.number; + if (option.masterId) form.value.masterId = option.masterId; if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option .data)).id) { form.value = JSON.parse(decodeURIComponent(option.data)) diff --git a/src/pages/eam/repairOrder/detail.vue b/src/pages/eam/repairOrder/detail.vue index 2a44a5e..292f752 100644 --- a/src/pages/eam/repairOrder/detail.vue +++ b/src/pages/eam/repairOrder/detail.vue @@ -6,10 +6,14 @@ 维修工单 + + v-if="data.status == '5'"> 转办 @@ -20,12 +24,12 @@ 报修描述: - {{data.describes}} + {{data.maintenanceDesc}} - + v-if="data.status == '5'"> + @@ -48,11 +52,12 @@ - + + - -
@@ -115,19 +119,15 @@ 设备编号: - {{data.deviceNumber}} + {{data.equipmentCode}} 设备名称: - {{data.name}} - - - 所属厂区: - {{data.factoryAreaName}} + {{data.equipmentName}} 设备类型: - {{data.type == 'DEVICE'?'设备':data.type == 'TECH'?'工艺':'模具'}} + {{data.type == 'DEVICE'?'设备':'工装'}} @@ -137,11 +137,11 @@ 报修描述: - {{data1.describes}} + {{data1.maintenanceDesc}} 报修人: - {{data1.declarName}} + {{data1.repairerName}} 报修时间: @@ -159,17 +159,17 @@ - {{item.describes}} + {{item.maintenanceDesc}} + v-if="data.status == '5'"> 故障真因: - {{item.describes1}} + {{item.maintenanceDesc1}} 解决措施: @@ -198,8 +198,8 @@ - - + 添加维修内容 @@ -207,23 +207,35 @@ + v-if="data.status == '3'"> 接单 - + + 修改工单 + + 完成 + + + v-if="((data.status == 'COMPLETED' && !data.repairNumber) || (data.status == '6')) && ((type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:orderClickVerifyAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:orderClickVerifyAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:orderClickVerifyAPP')))"> 验证 + v-if="(data.status == 'COMPLETED' && data.repairNumber && data.applyer == store.id)&& ((type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:orderClickConfirmAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:orderClickConfirmAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:orderClickConfirmAPP')))"> 维修确认 @@ -264,7 +276,7 @@ - 通过 + 通过 驳回 @@ -287,6 +299,9 @@ import * as dictApi from "@/api/eam/dict" import * as repairOrderApi from "@/api/eam/repairOrder" import { useCountStore } from '@/store' + import * as deviceApi from "@/api/eam/device.js" + import * as basicFaultTypeApi from "@/api/eam/basicFaultType.js" + import * as userApi from "@/api/eam/user.js" const { proxy } = getCurrentInstance() // 获取自定义的store @@ -332,20 +347,20 @@ } // 添加表格表单 function addSubForm(clickType, item) { - if (data.value.status == 'APPLYPASS' || data.value.status == 'COMPLETED') { + if (data.value.status == '6' || data.value.status == '7') { return } - if (data.value.status == 'PENDING') { + if (data.value.status == '3') { proxy.$modal.showToast('请先接单') return } if (clickType == 'updata') { proxy.$tab.navigateTo( - `/pages/eam/repairOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}&data=${encodeURIComponent(JSON.stringify(item))}&deviceNumber=${data.value.deviceNumber}` + `/pages/eam/repairOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}&data=${encodeURIComponent(JSON.stringify(item))}&equipmentCode=${data.value.equipmentCode}&masterId=${data.value.id}` ) } else { proxy.$tab.navigateTo( - `/pages/eam/repairOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}&deviceNumber=${data.value.deviceNumber}` + `/pages/eam/repairOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}&equipmentCode=${data.value.equipmentCode}&masterId=${data.value.id}` ) } } @@ -353,7 +368,7 @@ // 完成按钮 function orderClickSuccess() { // 如果点击完成是否与接单人员一致 - if (data.value.status == 'PECEIVED') { + if (data.value.status == '5') { if (store.id != data.value.maintenance) { proxy.$modal.showToast('当前人员与接单人员不一致') return; @@ -401,15 +416,15 @@ status: data.value.status, id: data.value.id, result: result.value, - requestNumber: data.value.requestNumber, + repairNumber: data.value.repairNumber, content: data.value.applyContent ? data.value.applyContent : '' } // 修改工单接口参数 const dataTwo = { id: data.value && data.value.id ? data.value.id : '', - describes: data.value.describes, + maintenanceDesc: data.value.maintenanceDesc, type: data.value.type, - deviceNumber: data.value.deviceNumber, + equipmentCode: data.value.equipmentCode, factoryAreaNumber: data.value.factoryAreaNumber, classes: data.value.classes, faultType: data.value.faultType @@ -449,7 +464,7 @@ status: data.value.status, id: data.value.id, result: result.value , - requestNumber: data.value.requestNumber, + repairNumber: data.value.repairNumber, content: data.value.applyContent ? data.value.applyContent : '' } proxy.$modal.loading('加载中') @@ -480,7 +495,7 @@ status: data.value.status, id: data.value.id, result: result.value, - requestNumber: data.value.requestNumber, + repairNumber: data.value.repairNumber, content: data.value.applyContent ? data.value.applyContent : '' } proxy.$modal.loading('加载中') @@ -501,15 +516,115 @@ loading.value = false }) } + // APP维修工单接单、点击完成、验证 + // async function orderClick(type1) { + // // 如果是接单 + // // if (this.data.status == '3') { + // // if (this.$store.state.user.dept.parentId != this.data.factoryAreaNumber) { + // // this.$modal.showToast('当前人员厂区与工单来源的厂区不一致') + // // return; + // // } + // // if (this.$store.state.user.dept.classType != this.data.type) { + // // this.$modal.showToast('当前人员班组与工单类型不一致') + // // return; + // // } + // // } + + + // const dataOne = { + // number: data.value.number, + // status: data.value.status, + // id: data.value.id, + // result: type1 == 2||type1 == 3 ? result.value : '', + // repairNumber: data.value.repairNumber, + // content:data.value.applyContent ? data.value.applyContent:'' + // } + // // 修改工单接口参数 + // const dataTwo = { + // id: data.value && data.value.id ? data.value.id : '', + // maintenanceDesc: data.value.maintenanceDesc, + // type: data.value.type, + // equipmentCode: data.value.equipmentCode, + // factoryAreaNumber: data.value.factoryAreaNumber, + // classes: data.value.classes, + // faultType: data.value.faultType + // } + // let tips = data.value.status == '3' ? '是否接单?' : data.value.status == '5' ? '是否完成?' : data.value.status == 'COMPLETED' && data.value.repairNumber && data.value.applyer == store.id ? '是否确认提交?' :data.value.status == 'COMPLETED' && !data.value.repairNumber ? '是否验证完结?':data.value.status == '6' ? '是否验证完结?':'' + // if(type1 == 2 || type1 ==3){ + // // 如果直接点击完成先走修改工单接口 + // if (data.value.status == '5') { + // await repairOrderApi.repairOrderUpdate(dataTwo).then((res) => { }).catch(() => { + // proxy.$modal.closeLoading() + // loading.value = false + // }) + // } + // proxy.$modal.confirm(tips).then(async () => { + // proxy.$modal.loading('加载中') + // loading.value = true + // await repairOrderApi.orderClick(dataOne).then((res) => { + // if (res.data) { + // proxy.$modal.showToast('操作成功') + // setTimeout(() => { + // if(type1==3){ + // // proxy.$tab.navigateTo(`/pages/repairOrder/index?type=${type.value}&flag=2`) + // proxy.$tab.navigateBack() + // }else{ + // // proxy.$tab.navigateTo(`/pages/repairOrder/index?type=${type.value}`) + // proxy.$tab.navigateBack() + // } + + // loading.value = false + // }, 1500) + // } else { + // proxy.$modal.showToast('操作失败') + // loading.value = false + // } + // }).catch(() => { + // proxy.$modal.closeLoading() + // loading.value = false + // }) + // }) + // }else{ + // proxy.$modal.confirm(tips).then(async () => { + // proxy.$modal.loading('加载中') + // loading.value = true + // // 如果直接点击完成先走修改工单接口 + // if (data.value.status == '5') { + // await repairOrderApi.repairOrderUpdate(dataTwo).then((res) => { }).catch(() => { + // proxy.$modal.closeLoading() + // loading.value = false + // }) + // } + // await repairOrderApi.orderClick(dataOne).then(async(res) => { + // if (res.data) { + // proxy.$modal.showToast('操作成功') + // await getDeviceRepairDetail(number.value) + // await getDeviceRepairDetailsByNumber() + // loading.value = false + // // setTimeout(() => { + // // // proxy.$tab.navigateBack() + + // // }, 1500) + // } else { + // proxy.$modal.showToast('操作失败') + // loading.value = false + // } + // }).catch(() => { + // proxy.$modal.closeLoading() + // loading.value = false + // }) + // }) + // } + // } // 点击接单 async function orderClick() { const dataOne = { - number: data.value.number, - status: data.value.status, + // number: data.value.number, + status: 4, id: data.value.id, - result: '', - requestNumber: data.value.requestNumber, - content: data.value.applyContent ? data.value.applyContent : '' + // result: '', + // repairNumber: data.value.repairNumber, + // content: data.value.applyContent ? data.value.applyContent : '' } proxy.$modal.confirm('是否接单').then(async () => { proxy.$modal.loading('加载中') @@ -533,23 +648,34 @@ // 获取维修报修信息 async function getDeviceRepairDetailsByNumber() { - if (data.value.requestNumber) { - await repairOrderApi.getDeviceRepairDetailsByNumber({ - type: type.value, - requestNumber: data.value.requestNumber - }, type.value).then((res) => { - if (res.data) { - data1.value = res.data - } - }).catch(() => { }) - } + if (data.value.repairNumber) { + try { + const res = await repairOrderApi.getDeviceRepairDetailsByNumber({ + number: data.value.repairNumber + }, type.value); + + const response = await userApi.getAllUserSimpleInfo(); + + if (res.data) { + // 匹配 response.data 的 id 和 res.data 的 repairer 字段 + const matchedUser = response.data.find(element => element.id == res.data.repairer); + if (matchedUser) { + res.data.repairerName = matchedUser.nickname; + } + + data1.value = res.data; + } + } catch (error) { + console.error('Error fetching data:', error); + } + } } // 获取维修内容列表 function getRepairOrderDetaiList() { repairOrderApi.repairOrderDetailList({ number: number.value, }, type.value).then((res) => { - if (res.data) { + if (res?.data) { serviceList.value = res.data } }).catch(() => { }) @@ -565,7 +691,7 @@ }) } function transfer() { - proxy.$tab.navigateTo(`/pages/repairOrder/transfer?type=${data.value.type}&id=${data.value.id}&deviceNumber=${data.value.deviceNumber}`) + proxy.$tab.navigateTo(`/pages/eam/repairOrder/transfer?type=${data.value.type}&id=${data.value.id}&equipmentCode=${data.value.equipmentCode}`) } function previewImage(current, array) { uni.previewImage({ @@ -606,9 +732,9 @@ function editForm() { const paramesData = { id: data.value && data.value.id ? data.value.id : '', - describes: data.value.describes, + maintenanceDesc: data.value.maintenanceDesc, type: data.value.type, - deviceNumber: data.value.deviceNumber, + equipmentCode: data.value.equipmentCode, factoryAreaNumber: data.value.factoryAreaNumber, classes: data.value.classes, faultType: data.value.faultType @@ -635,14 +761,30 @@ }) } async function getDeviceRepairDetail(number) { - const detailParam = { + const paramDetail = { number: number, - type: type.value, + type: type.value } - await repairOrderApi.getDeviceRepairDetail(detailParam, type.value).then((res) => { + try{ + let res = await repairOrderApi.getDeviceRepairDetail(paramDetail, type.value) + const resp = await deviceApi.deviceNoPage(); + const response = await basicFaultTypeApi.getBasicFaultTypeNoPage(); proxy.$modal.closeLoading() data.value = res.data.list[0] - if (data.value.requestNumber) { + debugger + const findDevice = resp.data.find(item=>{ + return item.code == data.value.equipmentCode + }) + const findFaultType = response.data.find(item=>{ + return item.code == data.value.faultType + }) + if(findDevice){ + data.value.equipmentName = findDevice.name + } + if(findFaultType){ + data.value.faultTypeName = findFaultType.name + } + if (data.value.repairNumber) { list.value = [{ name: '设备信息', value: 1 @@ -663,10 +805,10 @@ }] } loading.value = false - }).catch(() => { - proxy.$modal.closeLoading() - loading.value = false - }) + } catch (error) { + proxy.$modal.closeLoading(); + console.error('Error fetching data:', error); + } } // 获取维修工单详情 onLoad(async (option) => { @@ -685,7 +827,7 @@ getRepairOrderDetaiList() maintenanceShift.value = await dictApi.getDict('maintenance_shift') - faultType.value = await dictApi.getDict('fault_type') + faultType.value = await basicFaultTypeApi.getBasicFaultTypeNoPage(); }) diff --git a/src/pages/eam/repairOrder/index.vue b/src/pages/eam/repairOrder/index.vue index 91f2e95..16076e7 100644 --- a/src/pages/eam/repairOrder/index.vue +++ b/src/pages/eam/repairOrder/index.vue @@ -4,7 +4,8 @@ @@ -29,13 +30,13 @@ 工单单号:{{item.number}} - 类型:设备 + 类型:{{item.type=='DEVICE'?'设备':'工装'}} - 设备编号:{{item.equipmentCode}} + {{`${params.type=='DEVICE'?'设备' : '工装'}`}}编号:{{item.equipmentCode}} - 设备名称:{{item.equipmentName}} + {{`${params.type=='DEVICE'?'设备' : '工装'}`}}名称:{{item.equipmentName}} 故障类型:{{item.faultTypeName}} @@ -70,6 +71,7 @@ import * as repairOrderApi from "@/api/eam/repairOrder" import { useCountStore } from '@/store' import * as deviceApi from "@/api/eam/device.js" + import * as basicFaultTypeApi from "@/api/eam/basicFaultType.js" const { proxy } = getCurrentInstance() // 获取自定义的store @@ -96,17 +98,21 @@ try { const res = await repairOrderApi.repairOrderPage(params.value, params.value.type); const resp = await deviceApi.deviceNoPage(); - + const response = await basicFaultTypeApi.getBasicFaultTypeNoPage(); proxy.$modal.closeLoading(); - if (res.data.list.length > 0) { // 匹配并设置 equipmentName res.data.list.forEach(element => { - const matchedItem = resp.data.find(item => item.equipmentCode === element.code); + const matchedItem = resp.data.find(item => item.equipmentCode == element.code); + const matchedItemFaultType = response.data.find(itemFaultType => itemFaultType.code == element.faultType); if (matchedItem) { element.equipmentName = matchedItem.name; } + if (matchedItemFaultType) { + element.faultTypeName = matchedItemFaultType.name + } }); + list.value = list.value.concat(res.data.list); params.value.pageNo++; diff --git a/src/pages/eam/sparePartsServiceWorkOrderList/addForm.vue b/src/pages/eam/sparePartsServiceWorkOrderList/addForm.vue index f45a95c..683a02d 100644 --- a/src/pages/eam/sparePartsServiceWorkOrderList/addForm.vue +++ b/src/pages/eam/sparePartsServiceWorkOrderList/addForm.vue @@ -253,7 +253,6 @@ return false; // 过滤掉该项 }); sparePartsList.value = filteredData; - debugger }); }).catch(() => { }); } diff --git a/src/pages/upkeepOrder/addServiceRecord.vue b/src/pages/eam/upkeepOrder/addServiceRecord.vue similarity index 84% rename from src/pages/upkeepOrder/addServiceRecord.vue rename to src/pages/eam/upkeepOrder/addServiceRecord.vue index 9a9142d..bbfd55d 100644 --- a/src/pages/upkeepOrder/addServiceRecord.vue +++ b/src/pages/eam/upkeepOrder/addServiceRecord.vue @@ -2,8 +2,8 @@ - - + + + + + + 保养工单 + + + + 工单单号: + {{data.number}} + + + 保养计划单号: + {{data.planNumber}} + + + 故障类型: + {{data.faultTypeName}} + + + 创建时间: + {{$time.formatDate(data.createTime)}} + + + 创建人员: + {{data.creator}} + + + 接单时间: + {{$time.formatDate(data.receivingTime)}} + + + 保养人员: + {{data.maintenanceName}} + + + 完成时间: + {{$time.formatDate(data.completionTime)}} + + + +
+ + + + + + + {{changeItem.name}} + + + + 设备编号: + {{data.equipmentCode}} + + + 设备名称: + {{data.equipmentName}} + + + 所属车间: + {{data.workshopName}} + + + 设备类型: + {{data.type == 'DEVICE'?'设备':'工装'}} + + + + + + + + {{item.contents}} + + + + + 预估人数: + {{item.peoples}}人 + + + 预估分钟: + {{item.estimatedMinutes}}分钟 + + + 实际分钟: + {{item.actualMinutes}}分钟 + + + 保养部位: + {{item.equipmentParts}} + + + 责任人: + {{item.chargePeoplesName}} + + + 完成情况: + + {{item.result==0 || item.result == '0'? '完成':item.result==1 ||item.result == '1'?'未完成':''}} + + + + 完成时间: + {{$time.formatDate(item.completionTime)}} + + + + 未完成原因: + {{item.uncompleted}} + + + 备件: + + + + {{cur.name}} + + + 备件编号:{{cur.number}} + + + 数量:{{cur.qty}} + + + + + + + + + + + 接单 + 执行 + 完成 + 验证 + + + + + + + + + + + + {{formatStartDate}} + + + {{`请选择开始时间`}} + + + + + + + + {{formatEndDate}} + + + {{`请选择完成时间`}} + + + + + + + 取消 + 确认 + + + + + + + 验证完结意见 + + + + + 取消 + 确认 + + + +
+ + + + + \ No newline at end of file diff --git a/src/pages/upkeepOrder/index.vue b/src/pages/eam/upkeepOrder/index.vue similarity index 53% rename from src/pages/upkeepOrder/index.vue rename to src/pages/eam/upkeepOrder/index.vue index 11c5d52..7064f3c 100644 --- a/src/pages/upkeepOrder/index.vue +++ b/src/pages/eam/upkeepOrder/index.vue @@ -11,12 +11,16 @@ {{item.describes}} - - - - - - + + + + + + + + + +
保养单号:{{item.number}} @@ -25,13 +29,10 @@ 保养计划单号:{{item.planNumber}} - {{`${params.type=='DEVICE'?'设备' : '模具'}`}}编号:{{item.deviceNumber}} + {{`${params.type=='DEVICE'?'设备' : '工装'}`}}编号:{{item.equipmentCode}} - {{`${params.type=='DEVICE'?'设备' : '模具'}`}}名称:{{item.name}} - - - 所属厂区:{{item.factoryAreaName}} + {{`${params.type=='DEVICE'?'设备' : '工装'}`}}名称:{{item.equipmentName}} 故障类型:{{item.faultTypeName}} @@ -61,37 +62,61 @@ ref, getCurrentInstance } from 'vue' - import * as upkeepOrderApi from "@/api/upkeepOrder.js" + import * as upkeepOrderApi from "@/api/eam/upkeepOrder" + import * as deviceApi from "@/api/eam/device.js" + import * as basicFaultTypeApi from "@/api/eam/basicFaultType.js" + import * as workShopApi from "@/api/wms/workShop.js" const { proxy } = getCurrentInstance() const params = ref({ pageNo: 1, pageSize: 10, - type: '', + type: 'DEVICE', }) const status = ref('loadmore') //是否显示没有更多了 const list = ref([]) function itemClick(item, index) { - proxy.$tab.navigateTo(`/pages/upkeepOrder/detail?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`) + proxy.$tab.navigateTo(`/pages/eam/upkeepOrder/detail?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`) } function addForm(item) { - proxy.$tab.navigateTo(`/pages/upkeepOrder/addForm?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`) + proxy.$tab.navigateTo(`/pages/eam/upkeepOrder/addForm?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`) } async function getList() { if (status.value == 'nomore') return; status.value = 'loading'; proxy.$modal.loading('加载中') - await upkeepOrderApi.upkeepOrderPage(params.value).then((res) => { + try { + const res = await upkeepOrderApi.upkeepOrderPage(params.value,params.value.type); + const resp = await deviceApi.deviceNoPage(); + const response = await basicFaultTypeApi.getBasicFaultTypeNoPage(); + const workshopList = await workShopApi.getWorkshopNoPage(); proxy.$modal.closeLoading() if (res.data.list.length > 0) { + res.data.list.forEach(element => { + const matchedItem = resp.data.find(item => item.equipmentCode == element.code); + const matchedItemFaultType = response.data.find(itemFaultType => itemFaultType.code == element.faultType); + const matchedWorkShop = workshopList.data.find(workShop=>{ + return workShop.code == element.workshopCode + }) + if (matchedItem) { + element.equipmentName = matchedItem.name; + } + if (matchedItemFaultType) { + element.faultTypeName = matchedItemFaultType.name + } + if (matchedWorkShop) { + element.workshopName = matchedWorkShop.name + } + }); list.value = list.value.concat(res.data.list); params.value.pageNo++; status.value = 'loadmore' } else { status.value = 'nomore' } - }).catch(() => { - proxy.$modal.closeLoading() - }) + } catch (error) { + proxy.$modal.closeLoading(); + console.error('Error fetching data:', error); + } } onLoad((option) => { if (option.type) params.value.type = option.type; diff --git a/src/pages/upkeepOrder/myOrder.vue b/src/pages/eam/upkeepOrder/myOrder.vue similarity index 93% rename from src/pages/upkeepOrder/myOrder.vue rename to src/pages/eam/upkeepOrder/myOrder.vue index 4dfa7cc..33b443a 100644 --- a/src/pages/upkeepOrder/myOrder.vue +++ b/src/pages/eam/upkeepOrder/myOrder.vue @@ -45,6 +45,12 @@ 完成时间:{{$time.formatDate(item.completionTime)}} + + 审核人:{{item.verifyName}} + + + 审核时间:{{`${$time.formatDate(item.verifyTime)}`}} + @@ -70,7 +76,7 @@ ref, getCurrentInstance } from 'vue' - import * as upkeepOrderApi from "@/api/upkeepOrder.js" + import * as upkeepOrderApi from "@/api/eam/upkeepOrder" const { proxy } = getCurrentInstance() const params = ref({ pageNo: 1, @@ -83,7 +89,7 @@ if (status.value == 'nomore') return; status.value = 'loading'; proxy.$modal.loading('加载中') - await upkeepOrderApi.upkeepOrderPage(params.value).then((res) => { + await upkeepOrderApi.upkeepOrderPage(params.value,'DEVICE').then((res) => { proxy.$modal.closeLoading() if (res.data.list.length > 0) { list.value = list.value.concat(res.data.list); diff --git a/src/pages/upkeepOrder/detail.vue b/src/pages/upkeepOrder/detail.vue deleted file mode 100644 index 93b0d34..0000000 --- a/src/pages/upkeepOrder/detail.vue +++ /dev/null @@ -1,484 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/plugins/auth.js b/src/plugins/auth.js index 84ab418..b254346 100644 --- a/src/plugins/auth.js +++ b/src/plugins/auth.js @@ -57,4 +57,4 @@ export default { return authRole(item) }) } -} +} \ No newline at end of file