Browse Source

feat(app): 添加保养维修工单功能

master
ljlong_2630 5 months ago
parent
commit
0a7b35fc7e
  1. 5
      src/api/eam/basicFaultType.js
  2. 5
      src/api/eam/device.js
  3. 10
      src/api/eam/repairOrder.js
  4. 104
      src/api/eam/upkeepOrder.js
  5. 8
      src/api/eam/user.js
  6. 40
      src/api/upkeepOrder.js
  7. 5
      src/api/wms/workShop.js
  8. 138
      src/common/utils/common.ts
  9. 50
      src/common/utils/dateTime.ts
  10. 19
      src/common/utils/http.ts
  11. 31
      src/common/utils/utils.ts
  12. 783
      src/common/utils/validator.ts
  13. 269
      src/components/item/slectItemList.vue
  14. 8
      src/pages.json
  15. 243
      src/pages/eam/repairOrder/addForm.vue
  16. 21
      src/pages/eam/repairOrder/addServiceRecord.vue
  17. 280
      src/pages/eam/repairOrder/detail.vue
  18. 20
      src/pages/eam/repairOrder/index.vue
  19. 1
      src/pages/eam/sparePartsServiceWorkOrderList/addForm.vue
  20. 97
      src/pages/eam/upkeepOrder/addServiceRecord.vue
  21. 798
      src/pages/eam/upkeepOrder/detail.vue
  22. 63
      src/pages/eam/upkeepOrder/index.vue
  23. 10
      src/pages/eam/upkeepOrder/myOrder.vue
  24. 484
      src/pages/upkeepOrder/detail.vue

5
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})
}

5
src/api/eam/device.js

@ -36,3 +36,8 @@ export function getSubList(params) {
export function getApplyDeviceList() { export function getApplyDeviceList() {
return http.get('/eam/device/equipment-accounts/noPage') return http.get('/eam/device/equipment-accounts/noPage')
} }
// 设备列表不分页
export function deviceList(params) {
return http.get('/eam/device/equipment-accounts/noPage',{params})
}

10
src/api/eam/repairOrder.js

@ -36,9 +36,9 @@ export function getDeviceRepairDetail(params,type) {
// 接单 // 接单
export function orderClick(params,type) { export function orderClick(params,type) {
if (type == 'DEVICE') { 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') { } 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) { export function repairOrderDetailList(params,type) {
if (type == 'DEVICE') { 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') { } 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) { export function getDeviceRepairDetailsByNumber(params) {
return http.get('/eam/device-repair-request/getDetailsByNumber', { return http.get('/eam/equipment-repair-job-main/detail', {
params params
}) })
} }

104
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)
}
}

8
src/api/user.js → src/api/eam/user.js

@ -1,5 +1,11 @@
import http from './http' import http from '../http'
// 用户密码重置 // 用户密码重置
export function updateUserPassword(data) { export function updateUserPassword(data) {
return http.put('/eam/device-accounts/getDetailsByNumber',data) return http.put('/eam/device-accounts/getDetailsByNumber',data)
} }
export function getAllUserSimpleInfo(){
return http.get('/system/user/list-all-simple')
}

40
src/api/upkeepOrder.js

@ -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)
}

5
src/api/wms/workShop.js

@ -14,3 +14,8 @@ export function getAreaBasicInfoNoPage(params) {
export function getLocationBasicInfoNoPage(params) { export function getLocationBasicInfoNoPage(params) {
return http.get('/wms/locationgroup/list',{params}) return http.get('/wms/locationgroup/list',{params})
} }
// 获取班组
export function getTeamNoPage(params) {
return http.get('/wms/team/noPage',{params})
}

138
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
};

50
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,
};

19
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<string, any>,
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)
}

31
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
}

783
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
}

269
src/components/item/slectItemList.vue

@ -0,0 +1,269 @@
<template>
<!-- 选择备件 -->
<u-popup v-model="props.isShowSelectItem" mode="center" border-radius="14">
<view class="popup-title">选择备件</view>
<view class="popup">
<!-- <input v-model="searchKeyword" @input="filterItems" placeholder="搜索备件名称"> -->
<u-search placeholder="搜索" v-model="form1.searchName" @change="searchItem" clearabled=false></u-search>
<!-- <u-input v-model="form1.searchName" placeholder="请输入备件名称" @change="searchItem"/>
<u-button>搜索</u-button> -->
<view class="list">
<view class="item" v-for="(item,index) in singleColumnList" :key="index" @click="chooseItem(item)">
<u-checkbox v-model="item.checked" shape="circle" style="margin-top: 8rpx;"></u-checkbox>
<view class="right">
<view class="item-name">
备件名称:<span>{{item.name}}</span>
</view>
<view class="item-dec">
备件编码:<span>{{item.number}}</span>
</view>
</view>
</view>
</view>
</view>
<view class="popup-footer">
<view @click="chooseItem1(0)">取消</view>
<view class="sure" @click="chooseItem1(1)">确认</view>
</view>
</u-popup>
</template>
<script setup lang="ts">
import {
ref,
defineProps,
defineEmits,
getCurrentInstance,
watch
} from 'vue'
import {
onLoad,
} from '@dcloudio/uni-app'
import * as repairOrderApi from "@/api/repairOrder"
const props = defineProps({
isShowSelectItem: {
type: Boolean,
default: () => { return false },
require: true
},
singleColumnList:{
type: Array,
default: () => { return [] },
require: false
},
});
// isShowSelectItem
watch(() => props.isShowSelectItem, (newValue, oldValue) => {
if(newValue){
console.log('props.isShowSelectItem',props.isShowSelectItem);
form1.value.searchName = null
form1.value.temporarilyNumber = null
form1.value.temporarilyName = null
}
});
const { proxy } = getCurrentInstance()
const repairOrderList = ref([])
const itemList = ref([])
const type = ref('')
const isShowSelectItem = ref(false);
const selectVal = ref(null);
const emits = defineEmits(['searchItem','chooseItem1']);
const form1 = ref({
number: "",
name:"",
qty: 0,
temporarilyNumber:"",//
temporarilyName:"",//
searchName:"",//
})
onLoad((option) => {
if (option.type) type.value = option.type;
if (option.type) isShowSelectItem.value = option.isShowSelectItem;//
if (option.selectVal) selectVal.value = option.selectVal;//
})
//
function chooseItem1(type){
if(type==1){
form1.value.number = form1.value.temporarilyNumber
form1.value.name = form1.value.temporarilyName
}
emits('chooseItem1',type,form1);
}
function searchItem(){
emits('searchItem',form1.value.searchName);
}
function chooseItem(item){
console.log('props.isShowSelectItem',props.isShowSelectItem);
console.log('props.singleColumnList',props.singleColumnList);
let arr = props.singleColumnList.filter(cur=>cur.number != item.number)
arr.forEach(item=>{
item.checked = false
})
item.checked = !item.checked
let arr1 = props.singleColumnList.filter(cur=>cur.number == item.number)
form1.value.temporarilyNumber = arr1[0].number;
form1.value.temporarilyName = arr1[0].name;
}
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 30rpx 140rpx;
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 22;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.title {
padding: 32rpx 0px;
position: relative;
span {
position: absolute;
left: -16rpx;
color: #fa3534;
padding-top: 6rpx;
}
}
.list {
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
background: #F5F5F5;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
}
}
.dec {
color: #9c9c9c;
padding: 20rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx 30rpx 0px
}
.popup {
width: 600rpx;
padding: 30rpx 60rpx 30rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
::v-deep .u-checkbox-group {
display: grid !important;
}
</style>

8
src/pages.json

@ -1814,27 +1814,27 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},{ },{
"path": "pages/upkeepOrder/index", "path": "pages/eam/upkeepOrder/index",
"style": { "style": {
"navigationBarTitleText": "保养工单", "navigationBarTitleText": "保养工单",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},{ },{
"path": "pages/upkeepOrder/detail", "path": "pages/eam/upkeepOrder/detail",
"style": { "style": {
"navigationBarTitleText": "保养工单详情", "navigationBarTitleText": "保养工单详情",
"navigationBarBackgroundColor": "#409eff", "navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
} }
},{ },{
"path": "pages/upkeepOrder/addServiceRecord", "path": "pages/eam/upkeepOrder/addServiceRecord",
"style": { "style": {
"navigationBarTitleText": "添加保养内容", "navigationBarTitleText": "添加保养内容",
"navigationBarBackgroundColor": "#409eff", "navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
} }
},{ },{
"path": "pages/upkeepOrder/myOrder", "path": "pages/eam/upkeepOrder/myOrder",
"style": { "style": {
"navigationBarTitleText": "我的保养工单", "navigationBarTitleText": "我的保养工单",
"navigationStyle": "custom" "navigationStyle": "custom"

243
src/pages/eam/repairOrder/addForm.vue

@ -2,8 +2,8 @@
<!-- 添加维修工单 --> <!-- 添加维修工单 -->
<view class="add-form-container"> <view class="add-form-container">
<u-form :model="form" ref="formRef" label-width="160rpx"> <u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="故障描述" prop="describes" required> <u-form-item label="故障描述" prop="maintenanceDesc" required>
<u-input v-model="form.describes" placeholder="请输入故障描述" :disabled="form&&form.id?true:false" /> <u-input v-model="form.maintenanceDesc" placeholder="请输入故障描述" :disabled="form&&form.id?true:false" />
</u-form-item> </u-form-item>
<u-form-item label="类型" prop="type" required> <u-form-item label="类型" prop="type" required>
<view class="select" @click="openSingleColumn('type',form.type,appDeviceMoldType)"> <view class="select" @click="openSingleColumn('type',form.type,appDeviceMoldType)">
@ -16,38 +16,38 @@
<u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon> <u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon>
</view> </view>
</u-form-item> </u-form-item>
<!-- <u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}名称`" prop="deviceNumber" required> <!-- <u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '工装'}名称`" prop="equipmentCode" required>
<view class="select" @click="openSingleColumn('deviceNumber',form.deviceNumber,deviceList)"> <view class="select" @click="openSingleColumn('equipmentCode',form.equipmentCode,deviceList)">
<view class="input" v-if='form.deviceName'> <view class="input" v-if='form.deviceName'>
{{form.deviceName}} {{form.deviceName}}
</view> </view>
<view class="placeholder" v-else> <view class="placeholder" v-else>
{{`请输入${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}名称`}} {{`请输入${type=='DEVICE'||type == 'TECH'?'设备' : '工装'}名称`}}
</view> </view>
<u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon> <u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon>
</view> </view>
</u-form-item> --> </u-form-item> -->
<u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码`" prop="deviceNumber" required> <u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '工装'}编码`" prop="equipmentCode" required>
<u-input v-model="form.deviceNumber" :placeholder="`请输入${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码`" <u-input v-model="form.equipmentCode" :placeholder="`请输入${type=='DEVICE'||type == 'TECH'?'设备' : '工装'}编码`"
@blur="blur()" @confirm='blur()'/> @blur="blur()" @confirm='blur()'/>
<view class="right-button" @click="chickRightButton"> <view class="right-button" @click="chickRightButton">
扫描 扫描
</view> </view>
</u-form-item> </u-form-item>
<u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}名称`" prop="deviceNumber" required <u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '工装'}名称`" prop="equipmentCode" required
class="disabled"> class="disabled">
<u-input v-model="form.deviceName" :placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码获得`" <u-input v-model="form.deviceName" :placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '工装'}编码获得`"
disabled /> disabled />
</u-form-item> </u-form-item>
<u-form-item :label="`厂区编码`" prop="factoryAreaNumber" required class="disabled"> <u-form-item :label="`车间编码`" prop="workshopCode" required class="disabled">
<u-input v-model="form.factoryAreaNumber" <u-input v-model="form.workshopCode"
:placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码获得`" disabled /> :placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '工装'}编码获得`" disabled />
</u-form-item> </u-form-item>
<u-form-item :label="`厂区名称`" prop="factoryAreaName" required class="disabled"> <u-form-item :label="`车间名称`" prop="workshopName" required class="disabled">
<u-input v-model="form.factoryAreaName" <u-input v-model="form.workshopName"
:placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码获得`" disabled /> :placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '工装'}编码获得`" disabled />
</u-form-item> </u-form-item>
<u-form-item label="班次" prop="classes" required> <!-- <u-form-item label="班次" prop="classes" required>
<view class="select" @click="openSingleColumn('classes',form.classes,maintenanceShift)"> <view class="select" @click="openSingleColumn('classes',form.classes,maintenanceShift)">
<view class="input" v-if='(form.classes||form.classes==0)&&maintenanceShift.length>0'> <view class="input" v-if='(form.classes||form.classes==0)&&maintenanceShift.length>0'>
{{form.classesName}} {{form.classesName}}
@ -57,8 +57,8 @@
</view> </view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> <u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view> </view>
</u-form-item> </u-form-item> -->
<u-form-item label="故障类型" prop="classes" required> <u-form-item label="故障类型" prop="faultType" required>
<view class="select" @click="openSingleColumn('faultType',form.faultType,faultType)"> <view class="select" @click="openSingleColumn('faultType',form.faultType,faultType)">
<view class="input" v-if='form.faultType'> <view class="input" v-if='form.faultType'>
{{form.faultTypeName}} {{form.faultTypeName}}
@ -69,6 +69,17 @@
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> <u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="紧急程度" prop="urgency" required>
<view class="select" @click="openSingleColumn('urgency',form.urgency,urgency)">
<view class="input" v-if='form.urgency'>
{{form.urgencyName}}
</view>
<view class="placeholder" v-else>
{{`请选择紧急程度`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
</u-form> </u-form>
<view class="footer"> <view class="footer">
<view class="btns"> <view class="btns">
@ -91,10 +102,12 @@
getCurrentInstance getCurrentInstance
} from 'vue' } from 'vue'
import * as deviceApi from "@/api/eam/device.js" 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 dictApi from "@/api/eam/dict.js"
import * as repairOrderApi from "@/api/eam/repairOrder.js" import * as repairOrderApi from "@/api/eam/repairOrder.js"
import { useCountStore } from '@/store' import { useCountStore } from '@/store'
import * as workShopApi from "@/api/wms/workShop.js"
import * as basicFaultTypeApi from "@/api/eam/basicFaultType.js"
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
// store // store
@ -105,12 +118,12 @@
const type = ref('') const type = ref('')
const form = ref({ const form = ref({
id: '', id: '',
describes: "", maintenanceDesc: "",
deviceNumber: '', equipmentCode: '',
deviceName: '', deviceName: '',
factoryAreaName: '', workshopName: '',
factoryAreaNumber: '', workshopCode: '',
classes: '', // classes: '',
type: '', type: '',
faultType: '' faultType: ''
}) })
@ -124,6 +137,7 @@
const faultType = ref([]) const faultType = ref([])
const choosesingleColumnItem = ref() const choosesingleColumnItem = ref()
const msg = ref('') const msg = ref('')
const urgency = ref([])
// //
function chickRightButton(field) { function chickRightButton(field) {
if (!form.value.type) { if (!form.value.type) {
@ -132,94 +146,107 @@
} }
uni.scanCode({ uni.scanCode({
success: function (res) { success: function (res) {
form.value.deviceNumber = res.result form.value.equipmentCode = res.result
getDetailsByNumber() getDetailsByNumber()
} }
}); });
} }
function blur() { function blur() {
if (form.value.deviceNumber) { if (form.value.equipmentCode) {
getDetailsByNumber() getDetailsByNumber()
} else { } else {
form.value.deviceName = '' form.value.deviceName = ''
form.value.factoryAreaName = '' form.value.workshopName = ''
form.value.factoryAreaNumber = '' form.value.workshopCode = ''
} }
} }
// / // /
function getDetailsByNumber() { function getDetailsByNumber() {
if (type.value == 'DEVICE' || type.value == 'TECH') { if (type.value == 'DEVICE') {
deviceApi.getDeviceDetailsByNumber({ deviceApi.getDeviceDetailsByNumber({
number: form.value.deviceNumber, number: form.value.equipmentCode,
type: type.value
}).then((res) => { }).then((res) => {
if (!res.data) { workShopApi.getWorkshopNoPage().then(response=>{
msg.value = res.msg res.data.workshopName = response.data.find(item=>{
form.value.deviceName = '' return item.code == res.data.workshopCode
form.value.factoryAreaName = '' }).name
form.value.factoryAreaNumber = '' if (!res.data) {
return; msg.value = res.msg
} form.value.deviceName = ''
form.value.deviceName = res.data.name form.value.workshopName = ''
form.value.factoryAreaName = res.data.factoryAreaName form.value.workshopCode = ''
form.value.factoryAreaNumber = res.data.factoryAreaNumber return;
}
form.value.deviceName = res.data.name
form.value.workshopName = res.data.workshopName
form.value.workshopCode = res.data.workshopCode
})
}).catch(() => { }).catch(() => {
form.value.deviceName = '' form.value.deviceName = ''
form.value.factoryAreaName = '' form.value.workshopName = ''
form.value.factoryAreaNumber = '' form.value.workshopCode = ''
}) })
} else if (type.value == 'MOLD') { } else if (type.value == 'EQUIPMENT') {
moldApi.getMoldDetailsByNumber({ toolApi.getMoldDetailsByNumber({
number: form.value.deviceNumber number: form.value.equipmentCode
}).then(res => { }).then(res => {
if (!res.data) { workShopApi.getWorkshopNoPage().then(response=>{
msg.value = res.msg res.data.workshopName = response.data.find(item=>{
form.value.deviceName = '' return item.code == res.data.workshopCode
form.value.factoryAreaName = '' }).name
form.value.factoryAreaNumber = '' if (!res.data) {
return; msg.value = res.msg
} form.value.deviceName = ''
form.value.deviceName = res.data.name form.value.workshopName = ''
form.value.factoryAreaName = res.data.factoryAreaName form.value.workshopCode = ''
form.value.factoryAreaNumber = res.data.factoryAreaNumber return;
}
form.value.deviceName = res.data.name
form.value.workshopName = res.data.workshopName
form.value.workshopCode = res.data.workshopCode
})
}).catch(() => { }).catch(() => {
form.value.deviceName = '' form.value.deviceName = ''
form.value.factoryAreaName = '' form.value.workshopName = ''
form.value.factoryAreaNumber = '' form.value.workshopCode = ''
}) })
} }
} }
// //
function submit() { function submit() {
// //
if (!form.value.describes) { if (!form.value.maintenanceDesc) {
proxy.$modal.showToast('请输入故障描述') proxy.$modal.showToast('请输入故障描述')
return; return;
} }
if (!form.value.deviceNumber) { if (!form.value.equipmentCode) {
proxy.$modal.showToast(`请选择${type.value == 'DEVICE' || type.value == 'TECH' ? '设备' : '模具'}名称`) proxy.$modal.showToast(`请选择${type.value == 'DEVICE' || type.value == 'TECH' ? '设备' : '工装'}名称`)
return; return;
} }
if (!form.value.deviceName) { if (!form.value.deviceName) {
proxy.$modal.showToast(msg.value) proxy.$modal.showToast(msg.value)
return; return;
} }
if (!form.value.factoryAreaName) { if (!form.value.workshopName) {
proxy.$modal.showToast('请输入区域') proxy.$modal.showToast('请输入区域')
return; return;
} }
if (!form.value.classes) { // if (!form.value.classes) {
proxy.$modal.showToast('请选择班次') // proxy.$modal.showToast('')
return; // return;
} // }
const data = { const data = {
id: form.value && form.value.id ? form.value.id : '', id: form.value && form.value.id ? form.value.id : '',
describes: form.value.describes, maintenanceDesc: form.value.maintenanceDesc,
type: form.value.type, type: form.value.type,
deviceNumber: form.value.deviceNumber, equipmentCode: form.value.equipmentCode,
factoryAreaNumber: form.value.factoryAreaNumber, workshopCode: form.value.workshopCode,
classes: form.value.classes, // classes: form.value.classes,
faultType: form.value.faultType faultType: form.value.faultType,
sources: 1,
urgency: form.value.urgency,
status: 3
} }
if (form.value.id) { if (form.value.id) {
proxy.$modal.confirm('是否修改维修工单').then(() => { proxy.$modal.confirm('是否修改维修工单').then(() => {
@ -250,7 +277,7 @@
proxy.$modal.confirm('是否添加维修工单').then(() => { proxy.$modal.confirm('是否添加维修工单').then(() => {
proxy.$modal.loading('加载中') proxy.$modal.loading('加载中')
loading.value = true loading.value = true
repairOrderApi.repairOrderCreate(data).then((res) => { repairOrderApi.repairOrderCreate(data,type.value).then((res) => {
proxy.$modal.closeLoading() proxy.$modal.closeLoading()
if (res.data) { if (res.data) {
proxy.$modal.showToast('添加成功') proxy.$modal.showToast('添加成功')
@ -277,7 +304,7 @@
// //
function reset() { function reset() {
if (form.value.id) { if (form.value.id) {
form.value.classes = undefined; // form.value.classes = undefined;
form.value.faultType = undefined form.value.faultType = undefined
} else { } else {
form.value = {} form.value = {}
@ -286,8 +313,16 @@
// //
function openSingleColumn(fieldName, val, list) { 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 singleColumnList.value = list
if(fieldName == 'faultType'){
singleColumnList.value = list.data.map(item=>{
return {
value: item.code,
label: item.name
}
})
}
field.value = fieldName field.value = fieldName
if (val) { if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)] singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
@ -299,34 +334,38 @@
// //
function chooseSingleColumn(e) { function chooseSingleColumn(e) {
form.value[field.value] = e[0].value 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) choosesingleColumnItem.value = singleColumnList.value.filter(item => item.number == e[0].value)
form.value.factoryAreaName = choosesingleColumnItem.value[0].factoryAreaName form.value.workshopName = choosesingleColumnItem.value[0].workshopName
form.value.factoryAreaNumber = choosesingleColumnItem.value[0].factoryAreaNumber form.value.workshopCode = choosesingleColumnItem.value[0].workshopCode
form.value.deviceName = choosesingleColumnItem.value[0].name form.value.deviceName = choosesingleColumnItem.value[0].name
}else if(field.value == 'classes'){ }
form.value.classesName =e[0].label // else if(field.value == 'classes'){
}else if(field.value == 'faultType'){ // form.value.classesName =e[0].label
// }
else if(field.value == 'faultType'){
form.value.faultTypeName =e[0].label form.value.faultTypeName =e[0].label
}else if(field.value == 'type'){ }else if(field.value == 'type'){
form.value.typeName =e[0].label form.value.typeName =e[0].label
}else if(field.value == 'urgency'){
form.value.urgencyName =e[0].label
} }
singleColumnShow.value = false singleColumnShow.value = false
} }
// / // /
async function getDeviceList() { async function getDeviceList() {
if (type.value == 'DEVICE') { if (type.value == 'DEVICE') {
await deviceApi.deviceList().then(res => { await deviceApi.deviceList().then(res => {
res.data.map(item => { res.data.map(item => {
item.value = item.number item.value = item.code
item.label = item.name item.label = item.name
}) })
deviceList.value = res.data deviceList.value = res.data
}).catch(() => { }) }).catch(() => { })
} else if (type.value == 'MOLD') { } else if (type.value == 'EQUIPMENT') {
await moldApi.moldList().then(res => { await toolApi.moldList().then(res => {
res.data.map(item => { res.data.map(item => {
item.value = item.number item.value = item.code
item.label = item.name item.label = item.name
}) })
deviceList.value = res.data deviceList.value = res.data
@ -341,36 +380,26 @@
let data = JSON.parse(decodeURIComponent(option.data)) let data = JSON.parse(decodeURIComponent(option.data))
form.value = { form.value = {
id: data.id, id: data.id,
describes: data.describes, maintenanceDesc: data.maintenanceDesc,
deviceNumber: data.deviceNumber, equipmentCode: data.equipmentCode,
deviceName: data.name, deviceName: data.name,
factoryAreaName: data.factoryAreaName, workshopName: data.workshopName,
factoryAreaNumber: data.factoryAreaNumber, workshopCode: data.workshopCode,
classes: data.classes || data.classes == 0 ? data.classes : undefined, // classes: data.classes || data.classes == 0 ? data.classes : undefined,
faultType: data.faultType, faultType: data.faultType,
type: data.type type: data.type
} }
}; };
await getDeviceList() await getDeviceList()
maintenanceShift.value = await dictApi.getDict('maintenance_shift') maintenanceShift.value = await dictApi.getDict('maintenance_shift')
appDeviceMoldType1.value = await dictApi.getDict('app_device_mold_type') appDeviceMoldType1.value = await dictApi.getDict('device_type')
faultType.value = await dictApi.getDict('fault_type') urgency.value = await dictApi.getDict('eam_maintenance_urgency')
if (type.value == 'MOLD') { faultType.value = await basicFaultTypeApi.getBasicFaultTypeNoPage()
appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "MOLD")) if (type.value == 'EQUIPMENT') {
appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "EQUIPMENT"))
} else { } else {
appDeviceMoldType.value = [] appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "DEVICE"))
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"))
}
} }
form.value.type = appDeviceMoldType.value[0].value form.value.type = appDeviceMoldType.value[0].value
form.value.typeName = appDeviceMoldType.value[0].label form.value.typeName = appDeviceMoldType.value[0].label
}) })

21
src/pages/eam/repairOrder/addServiceRecord.vue

@ -2,11 +2,11 @@
<!-- 添加维修工单 --> <!-- 添加维修工单 -->
<view class="add-form-container"> <view class="add-form-container">
<u-form :model="form" ref="formRef" label-width="160rpx"> <u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="故障描述" prop="describes" required> <u-form-item label="故障描述" prop="describing" required>
<u-input v-model="form.describes" placeholder="请输入故障描述" /> <u-input v-model="form.describing" placeholder="请输入故障描述" />
</u-form-item> </u-form-item>
<u-form-item label="故障真因" prop="describes" required> <u-form-item label="故障真因" prop="faultCause" required>
<u-input v-model="form.describes1" placeholder="请输入故障真因" /> <u-input v-model="form.faultCause" placeholder="请输入故障真因" />
</u-form-item> </u-form-item>
<u-form-item label="解决措施" prop="describes" required> <u-form-item label="解决措施" prop="describes" required>
<u-input type='textarea' v-model="form.workOut" placeholder="请输入解决措施" /> <u-input type='textarea' v-model="form.workOut" placeholder="请输入解决措施" />
@ -132,8 +132,8 @@
const isShowSelecUser = ref(false) const isShowSelecUser = ref(false)
const form = ref({ const form = ref({
number: '', number: '',
describes: '', describing: '',
describes1: '', faultCause: '',
workOut: '', workOut: '',
maintenances: '', maintenances: '',
itemNumbers: [], itemNumbers: [],
@ -149,11 +149,11 @@
// //
function submit() { function submit() {
// //
if (!form.value.describes) { if (!form.value.describing) {
proxy.$modal.showToast('请输入故障描述') proxy.$modal.showToast('请输入故障描述')
return; return;
} }
if (!form.value.describes1) { if (!form.value.faultCause) {
proxy.$modal.showToast(`请输入故障真因`) proxy.$modal.showToast(`请输入故障真因`)
return; return;
} }
@ -220,8 +220,8 @@
} }
// //
function reset() { function reset() {
form.value.describes = '' form.value.describing = ''
form.value.describes1 = '' form.value.faultCause = ''
form.value.workOut = '' form.value.workOut = ''
form.value.maintenances = '' form.value.maintenances = ''
form.value.itemNumbers = [] form.value.itemNumbers = []
@ -335,6 +335,7 @@
if (option.type) type.value = option.type; if (option.type) type.value = option.type;
if (option.factoryAreaNumber) factoryAreaNumber.value = option.factoryAreaNumber; if (option.factoryAreaNumber) factoryAreaNumber.value = option.factoryAreaNumber;
if (option.number) form.value.number = option.number; 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 if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
.data)).id) { .data)).id) {
form.value = JSON.parse(decodeURIComponent(option.data)) form.value = JSON.parse(decodeURIComponent(option.data))

280
src/pages/eam/repairOrder/detail.vue

@ -6,10 +6,14 @@
<view class="title"> <view class="title">
<view>维修工单</view> <view>维修工单</view>
<!-- <view @click="transfer" <!-- <view @click="transfer"
v-if="data.status == 'PECEIVED' && (!serviceList || serviceList && serviceList.length == 0)">转办 v-if="data.status == '5' && (!serviceList || serviceList && serviceList.length == 0)">转办
</view> -->
<!-- <view @click="transfer"
v-if="data.status == '5'&&((type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:turnToAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:turnToAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:turnToAPP')))">
转办
</view> --> </view> -->
<view @click="transfer" <view @click="transfer"
v-if="data.status == 'PECEIVED'&&((type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:turnToAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:turnToAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:turnToAPP')))"> v-if="data.status == '5'">
转办 转办
</view> </view>
</view> </view>
@ -20,12 +24,12 @@
</view> </view>
<view class="dec-item"> <view class="dec-item">
<view>报修描述</view> <view>报修描述</view>
<view>{{data.describes}}</view> <view>{{data.maintenanceDesc}}</view>
</view> </view>
<u-form :model="data" ref="form1" label-width="160rpx" <u-form :model="data" ref="form1" label-width="160rpx"
style="border-top: 1px solid rgba(220,220,220,0.5);border-bottom: 1px solid rgba(220,220,220,0.5);margin-bottom: 20rpx;" style="border-top: 1px solid rgba(220,220,220,0.5);border-bottom: 1px solid rgba(220,220,220,0.5);margin-bottom: 20rpx;"
v-if="data.status == 'PECEIVED'"> v-if="data.status == '5'">
<u-form-item label="班次" prop="classes" required> <!-- <u-form-item label="班次" prop="classes" required>
<view class="select" @click="openSingleColumn('classes',data.classes,maintenanceShift)"> <view class="select" @click="openSingleColumn('classes',data.classes,maintenanceShift)">
<view class="input" v-if='data.classes||data.classes==0'> <view class="input" v-if='data.classes||data.classes==0'>
{{data.classesName}} {{data.classesName}}
@ -35,7 +39,7 @@
</view> </view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> <u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view> </view>
</u-form-item> </u-form-item> -->
<u-form-item label="故障类型" prop="classes" required> <u-form-item label="故障类型" prop="classes" required>
<view class="select" @click="openSingleColumn('faultType',data.faultType,faultType)"> <view class="select" @click="openSingleColumn('faultType',data.faultType,faultType)">
<view class="input" v-if='data.faultType'> <view class="input" v-if='data.faultType'>
@ -48,11 +52,12 @@
</view> </view>
</u-form-item> </u-form-item>
</u-form> </u-form>
<view class="dec-item" v-if="data.status != 'PECEIVED'"> <!--
<view class="dec-item" v-if="data.status != '5'">
<view>班次</view> <view>班次</view>
<view>{{data.classesName}}</view> <view>{{data.classesName}}</view>
</view> </view>
<view class="dec-item" v-if="data.status != 'PECEIVED'"> <view class="dec-item" v-if="data.status != '5'">
<view>故障类型</view> <view>故障类型</view>
<view>{{data.faultTypeName}}</view> <view>{{data.faultTypeName}}</view>
</view> </view>
@ -96,10 +101,9 @@
<view class="dec-item" v-if="data.verifyContent"> <view class="dec-item" v-if="data.verifyContent">
<view>验证内容</view> <view>验证内容</view>
<view>{{data.verifyContent}}</view> <view>{{data.verifyContent}}</view>
</view> </view> -->
</view>
</view>
</view> </view>
<div class="line"></div> <div class="line"></div>
<view class="info" style="padding-bottom: 130rpx;"> <view class="info" style="padding-bottom: 130rpx;">
@ -115,19 +119,15 @@
<view class="dec" v-if="changeItem.value == 1"> <view class="dec" v-if="changeItem.value == 1">
<view class="dec-item"> <view class="dec-item">
<view>设备编号</view> <view>设备编号</view>
<view>{{data.deviceNumber}}</view> <view>{{data.equipmentCode}}</view>
</view> </view>
<view class="dec-item"> <view class="dec-item">
<view>设备名称</view> <view>设备名称</view>
<view>{{data.name}}</view> <view>{{data.equipmentName}}</view>
</view>
<view class="dec-item">
<view>所属厂区</view>
<view>{{data.factoryAreaName}}</view>
</view> </view>
<view class="dec-item"> <view class="dec-item">
<view>设备类型</view> <view>设备类型</view>
<view>{{data.type == 'DEVICE'?'设备':data.type == 'TECH'?'工艺':'模具'}}</view> <view>{{data.type == 'DEVICE'?'设备':'工装'}}</view>
</view> </view>
</view> </view>
<view class="dec" v-if="changeItem.value == 2"> <view class="dec" v-if="changeItem.value == 2">
@ -137,11 +137,11 @@
</view> </view>
<view class="dec-item"> <view class="dec-item">
<view>报修描述</view> <view>报修描述</view>
<view>{{data1.describes}}</view> <view>{{data1.maintenanceDesc}}</view>
</view> </view>
<view class="dec-item"> <view class="dec-item">
<view>报修人</view> <view>报修人</view>
<view>{{data1.declarName}}</view> <view>{{data1.repairerName}}</view>
</view> </view>
<view class="dec-item"> <view class="dec-item">
<view>报修时间</view> <view>报修时间</view>
@ -159,17 +159,17 @@
<view class="item-box"> <view class="item-box">
<view class="spare-title"> <view class="spare-title">
<view class="title-txt"> <view class="title-txt">
{{item.describes}} {{item.maintenanceDesc}}
</view> </view>
<view class="" @click.stop="delService(item)"> <view class="" @click.stop="delService(item)">
<u-icon name="trash" color="#aaaaaa" size="40" <u-icon name="trash" color="#aaaaaa" size="40"
v-if="data.status == 'PECEIVED'"></u-icon> v-if="data.status == '5'"></u-icon>
</view> </view>
</view> </view>
<view class="dec2"> <view class="dec2">
<view>故障真因</view> <view>故障真因</view>
<view>{{item.describes1}}</view> <view>{{item.maintenanceDesc1}}</view>
</view> </view>
<view class="dec2"> <view class="dec2">
<view>解决措施</view> <view>解决措施</view>
@ -198,8 +198,8 @@
</view> </view>
<!-- <u-icon name="minus-circle" color="#aaaaaa" size="60" ></u-icon> --> <!-- <u-icon name="minus-circle" color="#aaaaaa" size="60" ></u-icon> -->
</view> </view>
<view class="add-btn" v-if="data.status == 'PENDING' || data.status == 'PECEIVED'"> <view class="add-btn" v-if="data.status == '3' || data.status == '5'">
<u-button type="primary" @click="addSubForm('creat')"><u-icon name="plus-circle" color="#ffffff" <u-button type="primary" @click="addSubForm('create')"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加维修内容</u-button> size="36"></u-icon>添加维修内容</u-button>
</view> </view>
</view> </view>
@ -207,23 +207,35 @@
</view> </view>
<view class="footer"> <view class="footer">
<view class="btns" <view class="btns"
v-if="data.status == 'PENDING'&&((type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:orderClickAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:orderClickAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:orderClickAPP')))"> v-if="data.status == '3'">
<u-button type="primary" @click="orderClick(1)" :loading='loading' :disabled='loading'>接单</u-button>
</view>
<view class="btns" v-if="data.status == '5'">
<u-button shape="shape" type="warning" style="min-width: 120rpx;" :loading='loading1' @click="editForm"
:disabled='loading1'>修改工单</u-button>
<u-button type="primary" @click="orderClickSuccess()" :loading='loading' :disabled='loading'
>完成</u-button>
</view>
<!-- <view class="btns"
v-if="data.status == '3'&&((type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:orderClickAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:orderClickAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:orderClickAPP')))">
<u-button type="primary" @click="orderClick(1)" :loading='loading' :disabled='loading'>接单</u-button> <u-button type="primary" @click="orderClick(1)" :loading='loading' :disabled='loading'>接单</u-button>
</view> </view>
<view class="btns" v-if="data.status == 'PECEIVED'"> <view class="btns" v-if="data.status == '5'">
<u-button shape="shape" type="warning" style="min-width: 120rpx;" :loading='loading1' @click="editForm" <u-button shape="shape" type="warning" style="min-width: 120rpx;" :loading='loading1' @click="editForm"
:disabled='loading1' v-if="(type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:updateAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:updateAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:updateAPP'))">修改工单</u-button> :disabled='loading1' v-if="(type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:updateAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:updateAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:updateAPP'))">修改工单</u-button>
<u-button type="primary" @click="orderClickSuccess()" :loading='loading' :disabled='loading' <u-button type="primary" @click="orderClickSuccess()" :loading='loading' :disabled='loading'
v-if="(type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:orderClickFinishAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:orderClickFinishAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:orderClickFinishAPP'))">完成</u-button> v-if="(type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:orderClickFinishAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:orderClickFinishAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:orderClickFinishAPP'))">完成</u-button>
</view> </view> -->
<view class="btns" <view class="btns"
v-if="((data.status == 'COMPLETED' && !data.requestNumber) || (data.status == 'APPLYPASS')) && ((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.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')))">
<u-button type="primary" @click="verify()" :loading='loading' :disabled='loading'>验证</u-button> <u-button type="primary" @click="verify()" :loading='loading' :disabled='loading'>验证</u-button>
</view> </view>
<view class="btns" <view class="btns"
v-if="(data.status == 'COMPLETED' && data.requestNumber && 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')))"> 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')))">
<u-button type="primary" @click="orderClickApply()" :loading='loading' <u-button type="primary" @click="orderClickApply()" :loading='loading'
:disabled='loading'>维修确认</u-button> :disabled='loading'>维修确认</u-button>
</view> </view>
@ -264,7 +276,7 @@
<textarea v-model="data.applyContent" placeholder="请输入内容"></textarea> <textarea v-model="data.applyContent" placeholder="请输入内容"></textarea>
</view> </view>
<view class="popup-footer"> <view class="popup-footer">
<view class="sure" @click="orderClickConfirm('APPLYPASS')">通过</view> <view class="sure" @click="orderClickConfirm('6')">通过</view>
<view class="reject" @click="orderClickConfirm('APPLYREJECTED')" style="color: red;">驳回</view> <view class="reject" @click="orderClickConfirm('APPLYREJECTED')" style="color: red;">驳回</view>
</view> </view>
</u-popup> </u-popup>
@ -287,6 +299,9 @@
import * as dictApi from "@/api/eam/dict" import * as dictApi from "@/api/eam/dict"
import * as repairOrderApi from "@/api/eam/repairOrder" import * as repairOrderApi from "@/api/eam/repairOrder"
import { useCountStore } from '@/store' 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() const { proxy } = getCurrentInstance()
// store // store
@ -332,20 +347,20 @@
} }
// //
function addSubForm(clickType, item) { function addSubForm(clickType, item) {
if (data.value.status == 'APPLYPASS' || data.value.status == 'COMPLETED') { if (data.value.status == '6' || data.value.status == '7') {
return return
} }
if (data.value.status == 'PENDING') { if (data.value.status == '3') {
proxy.$modal.showToast('请先接单') proxy.$modal.showToast('请先接单')
return return
} }
if (clickType == 'updata') { if (clickType == 'updata') {
proxy.$tab.navigateTo( 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 { } else {
proxy.$tab.navigateTo( 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() { function orderClickSuccess() {
// //
if (data.value.status == 'PECEIVED') { if (data.value.status == '5') {
if (store.id != data.value.maintenance) { if (store.id != data.value.maintenance) {
proxy.$modal.showToast('当前人员与接单人员不一致') proxy.$modal.showToast('当前人员与接单人员不一致')
return; return;
@ -401,15 +416,15 @@
status: data.value.status, status: data.value.status,
id: data.value.id, id: data.value.id,
result: result.value, result: result.value,
requestNumber: data.value.requestNumber, repairNumber: data.value.repairNumber,
content: data.value.applyContent ? data.value.applyContent : '' content: data.value.applyContent ? data.value.applyContent : ''
} }
// //
const dataTwo = { const dataTwo = {
id: data.value && data.value.id ? data.value.id : '', id: data.value && data.value.id ? data.value.id : '',
describes: data.value.describes, maintenanceDesc: data.value.maintenanceDesc,
type: data.value.type, type: data.value.type,
deviceNumber: data.value.deviceNumber, equipmentCode: data.value.equipmentCode,
factoryAreaNumber: data.value.factoryAreaNumber, factoryAreaNumber: data.value.factoryAreaNumber,
classes: data.value.classes, classes: data.value.classes,
faultType: data.value.faultType faultType: data.value.faultType
@ -449,7 +464,7 @@
status: data.value.status, status: data.value.status,
id: data.value.id, id: data.value.id,
result: result.value , result: result.value ,
requestNumber: data.value.requestNumber, repairNumber: data.value.repairNumber,
content: data.value.applyContent ? data.value.applyContent : '' content: data.value.applyContent ? data.value.applyContent : ''
} }
proxy.$modal.loading('加载中') proxy.$modal.loading('加载中')
@ -480,7 +495,7 @@
status: data.value.status, status: data.value.status,
id: data.value.id, id: data.value.id,
result: result.value, result: result.value,
requestNumber: data.value.requestNumber, repairNumber: data.value.repairNumber,
content: data.value.applyContent ? data.value.applyContent : '' content: data.value.applyContent ? data.value.applyContent : ''
} }
proxy.$modal.loading('加载中') proxy.$modal.loading('加载中')
@ -501,15 +516,115 @@
loading.value = false 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() { async function orderClick() {
const dataOne = { const dataOne = {
number: data.value.number, // number: data.value.number,
status: data.value.status, status: 4,
id: data.value.id, id: data.value.id,
result: '', // result: '',
requestNumber: data.value.requestNumber, // repairNumber: data.value.repairNumber,
content: data.value.applyContent ? data.value.applyContent : '' // content: data.value.applyContent ? data.value.applyContent : ''
} }
proxy.$modal.confirm('是否接单').then(async () => { proxy.$modal.confirm('是否接单').then(async () => {
proxy.$modal.loading('加载中') proxy.$modal.loading('加载中')
@ -533,23 +648,34 @@
// //
async function getDeviceRepairDetailsByNumber() { async function getDeviceRepairDetailsByNumber() {
if (data.value.requestNumber) { if (data.value.repairNumber) {
await repairOrderApi.getDeviceRepairDetailsByNumber({ try {
type: type.value, const res = await repairOrderApi.getDeviceRepairDetailsByNumber({
requestNumber: data.value.requestNumber number: data.value.repairNumber
}, type.value).then((res) => { }, type.value);
if (res.data) {
data1.value = res.data const response = await userApi.getAllUserSimpleInfo();
}
}).catch(() => { }) 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() { function getRepairOrderDetaiList() {
repairOrderApi.repairOrderDetailList({ repairOrderApi.repairOrderDetailList({
number: number.value, number: number.value,
}, type.value).then((res) => { }, type.value).then((res) => {
if (res.data) { if (res?.data) {
serviceList.value = res.data serviceList.value = res.data
} }
}).catch(() => { }) }).catch(() => { })
@ -565,7 +691,7 @@
}) })
} }
function transfer() { 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) { function previewImage(current, array) {
uni.previewImage({ uni.previewImage({
@ -606,9 +732,9 @@
function editForm() { function editForm() {
const paramesData = { const paramesData = {
id: data.value && data.value.id ? data.value.id : '', id: data.value && data.value.id ? data.value.id : '',
describes: data.value.describes, maintenanceDesc: data.value.maintenanceDesc,
type: data.value.type, type: data.value.type,
deviceNumber: data.value.deviceNumber, equipmentCode: data.value.equipmentCode,
factoryAreaNumber: data.value.factoryAreaNumber, factoryAreaNumber: data.value.factoryAreaNumber,
classes: data.value.classes, classes: data.value.classes,
faultType: data.value.faultType faultType: data.value.faultType
@ -635,14 +761,30 @@
}) })
} }
async function getDeviceRepairDetail(number) { async function getDeviceRepairDetail(number) {
const detailParam = { const paramDetail = {
number: number, 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() proxy.$modal.closeLoading()
data.value = res.data.list[0] 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 = [{ list.value = [{
name: '设备信息', name: '设备信息',
value: 1 value: 1
@ -663,10 +805,10 @@
}] }]
} }
loading.value = false loading.value = false
}).catch(() => { } catch (error) {
proxy.$modal.closeLoading() proxy.$modal.closeLoading();
loading.value = false console.error('Error fetching data:', error);
}) }
} }
// //
onLoad(async (option) => { onLoad(async (option) => {
@ -685,7 +827,7 @@
getRepairOrderDetaiList() getRepairOrderDetaiList()
maintenanceShift.value = await dictApi.getDict('maintenance_shift') maintenanceShift.value = await dictApi.getDict('maintenance_shift')
faultType.value = await dictApi.getDict('fault_type') faultType.value = await basicFaultTypeApi.getBasicFaultTypeNoPage();
}) })
</script> </script>

20
src/pages/eam/repairOrder/index.vue

@ -4,7 +4,8 @@
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff' <u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
:title="params.flag == 2 ? '报修确认' : '维修工单'"> :title="params.flag == 2 ? '报修确认' : '维修工单'">
<template v-slot:right v-if="params.flag!='2'"> <template v-slot:right v-if="params.flag!='2'">
<u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm" v-if="(params.type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:createAPP'))||(params.type==='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:createAPP'))||(params.type==='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:createAPP'))"></u-icon> <u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm" ></u-icon>
<!-- <u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm" v-if="(params.type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:createAPP'))||(params.type==='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:createAPP'))||(params.type==='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:createAPP'))"></u-icon> -->
</template> </template>
</u-navbar> </u-navbar>
<view class="list"> <view class="list">
@ -29,13 +30,13 @@
工单单号:<span>{{item.number}}</span> 工单单号:<span>{{item.number}}</span>
</view> </view>
<view class="dec"> <view class="dec">
类型:<span>设备</span> 类型:<span>{{item.type=='DEVICE'?'设备':'工装'}}</span>
</view> </view>
<view class="dec"> <view class="dec">
设备编号:<span>{{item.equipmentCode}}</span> {{`${params.type=='DEVICE'?'设备' : '工装'}`}}编号:<span>{{item.equipmentCode}}</span>
</view> </view>
<view class="dec"> <view class="dec">
设备名称:<span>{{item.equipmentName}}</span> {{`${params.type=='DEVICE'?'设备' : '工装'}`}}名称:<span>{{item.equipmentName}}</span>
</view> </view>
<view class="dec"> <view class="dec">
故障类型:<span>{{item.faultTypeName}}</span> 故障类型:<span>{{item.faultTypeName}}</span>
@ -70,6 +71,7 @@
import * as repairOrderApi from "@/api/eam/repairOrder" import * as repairOrderApi from "@/api/eam/repairOrder"
import { useCountStore } from '@/store' import { useCountStore } from '@/store'
import * as deviceApi from "@/api/eam/device.js" import * as deviceApi from "@/api/eam/device.js"
import * as basicFaultTypeApi from "@/api/eam/basicFaultType.js"
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
// store // store
@ -96,18 +98,22 @@
try { try {
const res = await repairOrderApi.repairOrderPage(params.value, params.value.type); const res = await repairOrderApi.repairOrderPage(params.value, params.value.type);
const resp = await deviceApi.deviceNoPage(); const resp = await deviceApi.deviceNoPage();
const response = await basicFaultTypeApi.getBasicFaultTypeNoPage();
proxy.$modal.closeLoading(); proxy.$modal.closeLoading();
if (res.data.list.length > 0) { if (res.data.list.length > 0) {
// equipmentName // equipmentName
res.data.list.forEach(element => { 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) { if (matchedItem) {
element.equipmentName = matchedItem.name; element.equipmentName = matchedItem.name;
} }
if (matchedItemFaultType) {
element.faultTypeName = matchedItemFaultType.name
}
}); });
list.value = list.value.concat(res.data.list); list.value = list.value.concat(res.data.list);
params.value.pageNo++; params.value.pageNo++;
status.value = 'loadmore'; status.value = 'loadmore';

1
src/pages/eam/sparePartsServiceWorkOrderList/addForm.vue

@ -253,7 +253,6 @@
return false; // return false; //
}); });
sparePartsList.value = filteredData; sparePartsList.value = filteredData;
debugger
}); });
}).catch(() => { }); }).catch(() => { });
} }

97
src/pages/upkeepOrder/addServiceRecord.vue → src/pages/eam/upkeepOrder/addServiceRecord.vue

@ -2,8 +2,8 @@
<!-- 添加维修工单 --> <!-- 添加维修工单 -->
<view class="add-form-container"> <view class="add-form-container">
<u-form :model="form" ref="formRef" label-width="160rpx"> <u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="保养内容" prop="contents" required class="disabled"> <u-form-item label="保养内容" prop="content" required class="disabled">
<u-input v-model="form.contents" placeholder="请输入保养内容" maxlength="50" disabled/> <u-input v-model="form.content" placeholder="请输入保养内容" maxlength="50" disabled/>
</u-form-item> </u-form-item>
<!-- <u-form-item label="保养部位" prop="equipmentParts" required> <!-- <u-form-item label="保养部位" prop="equipmentParts" required>
<u-input v-model="form.equipmentParts" placeholder="请输入保养部位" maxlength="50" disabled/> <u-input v-model="form.equipmentParts" placeholder="请输入保养部位" maxlength="50" disabled/>
@ -28,9 +28,9 @@
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> <u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="完成情况" prop="status" required> <u-form-item label="完成情况" prop="result" required>
<view class="select" @click="openSingleColumn('status',form.status,jxDetailsStatus,'form')"> <view class="select" @click="openSingleColumn('result',form.result,jxDetailsStatus,'form')">
<view class="input" v-if='form.status'> <view class="input" v-if='form.result'>
{{form.statusTxt}} {{form.statusTxt}}
</view> </view>
<view class="placeholder" v-else> <view class="placeholder" v-else>
@ -39,7 +39,7 @@
<u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon> <u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="完成时间" prop="completionTime" required v-if='form.status === 0||form.status === "0"'> <u-form-item label="完成时间" prop="completionTime" required v-if='form.result === 0||form.result === "0"'>
<view class="select" @click="openDatetime('completionTime',formatDate,params,formatValue)"> <view class="select" @click="openDatetime('completionTime',formatDate,params,formatValue)">
<view class="input" v-if='formatDate'> <view class="input" v-if='formatDate'>
{{formatDate}} {{formatDate}}
@ -50,12 +50,9 @@
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> <u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="未完成原因" prop="uncompleted" required v-if='form.status === 1||form.status === "1"'> <u-form-item label="未完成原因" prop="uncompleted" required v-if='form.result === 1||form.result === "1"'>
<u-input type='textarea' v-model="form.uncompleted" placeholder="请输入未完成原因" maxlength="200" /> <u-input type='textarea' v-model="form.uncompleted" placeholder="请输入未完成原因" maxlength="200" />
</u-form-item> </u-form-item>
<u-form-item label="工程师确认" prop="engineer">
<u-input v-model="form.engineer" placeholder="请输入工程师确认" maxlength="50"/>
</u-form-item>
</u-form> </u-form>
<view class="list"> <view class="list">
@ -125,7 +122,7 @@
<view class="popup"> <view class="popup">
<u-checkbox-group @change="checkboxGroupChange"> <u-checkbox-group @change="checkboxGroupChange">
<u-checkbox v-model="item.checked" v-for="(item, index) in selecUserList" :key="index" <u-checkbox v-model="item.checked" v-for="(item, index) in selecUserList" :key="index"
:name="item.id">{{item.name}}</u-checkbox> :name="item.id">{{item.nickname}}</u-checkbox>
</u-checkbox-group> </u-checkbox-group>
</view> </view>
@ -134,6 +131,7 @@
<view class="sure" @click="chooseUser">确认</view> <view class="sure" @click="chooseUser">确认</view>
</view> </view>
</u-popup> </u-popup>
<SelectItemList :isShowSelectItem=isShowSelectItem :singleColumnList=singleColumnList @searchItem='searchItem' @chooseItem1='chooseItem1'/>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue' <u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select> :list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select>
<u-picker mode="time" v-model="datetimeShow" :default-time='datetimeDefaultValue' :params="params" @confirm='chooseDatetime' @cancle='datetimeShow = false'></u-picker> <u-picker mode="time" v-model="datetimeShow" :default-time='datetimeDefaultValue' :params="params" @confirm='chooseDatetime' @cancle='datetimeShow = false'></u-picker>
@ -148,17 +146,19 @@
ref, ref,
getCurrentInstance getCurrentInstance
} from 'vue' } from 'vue'
import * as upkeepOrderApi from "@/api/upkeepOrder.js" import * as upkeepOrderApi from "@/api/eam/upkeepOrder"
import * as sparePartsApi from "@/api/eam/spareParts.js" import * as sparePartsApi from "@/api/eam/spareParts"
import * as deptApi from "@/api/dept.js" import * as deptApi from "@/api/dept"
import * as dictApi from "@/api/eam/dict.js" import * as dictApi from "@/api/eam/dict"
import SelectItemList from "../../../components/item/slectItemList.vue"
import * as workshopApi from "@/api/wms/workShop"
const { proxy} = getCurrentInstance() const { proxy} = getCurrentInstance()
const loading = ref(false) const loading = ref(false)
const type = ref('') const type = ref('')
// //
const isPopupShow = ref(false) const isPopupShow = ref(false)
const sparePartsList = ref([]) const sparePartsList = ref([])
const isShowSelectItem = ref(false)
const singleColumnShow = ref(false) const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([]) const singleColumnDefaultValue = ref([])
const singleColumnList = ref([]) const singleColumnList = ref([])
@ -167,6 +167,8 @@
const isShowSelecUser = ref(false) const isShowSelecUser = ref(false)
const jxDetailsStatus = ref([])// const jxDetailsStatus = ref([])//
const formatDate = ref('')// const formatDate = ref('')//
const equipmentCode = ref(null);
const workshopCode = ref(null);
const form = ref({ const form = ref({
number: '', number: '',
name:'', name:'',
@ -174,7 +176,7 @@ const form = ref({
estimatedMinutes: '', estimatedMinutes: '',
actualMinutes: '', actualMinutes: '',
chargePeoples: '', chargePeoples: '',
status: null, result: null,
completionTime: '', completionTime: '',
engineer: '', engineer: '',
uncompleted: '', uncompleted: '',
@ -233,17 +235,17 @@ const form = ref({
proxy.$modal.showToast('请选择负责人') proxy.$modal.showToast('请选择负责人')
return; return;
} }
if (!form.value.status) { if (!form.value.result) {
proxy.$modal.showToast('请选择完成情况') proxy.$modal.showToast('请选择完成情况')
return; return;
} }
if (form.value.status == 0) { if (form.value.result == 0) {
if (!form.value.completionTime) { if (!form.value.completionTime) {
proxy.$modal.showToast('请选择完成时间') proxy.$modal.showToast('请选择完成时间')
return; return;
} }
} }
if (form.value.status == 1) { if (form.value.result == 1) {
if (!form.value.uncompleted) { if (!form.value.uncompleted) {
proxy.$modal.showToast('请输入未完成原因') proxy.$modal.showToast('请输入未完成原因')
return; return;
@ -253,7 +255,7 @@ const form = ref({
proxy.$modal.confirm('是否修改保养内容').then(() => { proxy.$modal.confirm('是否修改保养内容').then(() => {
proxy.$modal.loading('加载中') proxy.$modal.loading('加载中')
loading.value = true loading.value = true
upkeepOrderApi.upkeepOrderDetailUpdate(form.value).then((res) => { upkeepOrderApi.upkeepOrderDetailUpdate(form.value,type.value).then((res) => {
proxy.$modal.closeLoading() proxy.$modal.closeLoading()
if (res.data) { if (res.data) {
proxy.$modal.showToast('修改成功') proxy.$modal.showToast('修改成功')
@ -278,7 +280,7 @@ const form = ref({
proxy.$modal.confirm('是否添加保养内容').then(() => { proxy.$modal.confirm('是否添加保养内容').then(() => {
proxy.$modal.loading('加载中') proxy.$modal.loading('加载中')
loading.value = true loading.value = true
upkeepOrderApi.upkeepOrderDetailCreate(form.value).then((res) => { upkeepOrderApi.upkeepOrderDetailCreate(form.value,type.value).then((res) => {
proxy.$modal.closeLoading() proxy.$modal.closeLoading()
if (res.data) { if (res.data) {
proxy.$modal.showToast('添加成功') proxy.$modal.showToast('添加成功')
@ -306,7 +308,7 @@ const form = ref({
function reset() { function reset() {
form.value.actualMinutes ='' form.value.actualMinutes =''
form.value.chargePeoples ='' form.value.chargePeoples =''
form.value.status =null form.value.result =null
form.value.statusTxt ='' form.value.statusTxt =''
form.value.completionTime ='' form.value.completionTime =''
form.value.engineer ='' form.value.engineer =''
@ -326,8 +328,10 @@ const form = ref({
if (form.value.chargePeoples) { if (form.value.chargePeoples) {
arr = form.value.chargePeoples.split(',') arr = form.value.chargePeoples.split(',')
} }
await deptApi.getSelecUser(paramsData).then(res => {
res.data.forEach(item => { // const workshopList = await workShopApi.getWorkshopNoPage();
await workshopApi.getTeamNoPage({teamGroup:'4',workshopCode:workshopCode.value}).then(res => {
res.data[0].memberJson.forEach(item => {
item.checked = false item.checked = false
arr.forEach(cur => { arr.forEach(cur => {
if (item.id == cur) { if (item.id == cur) {
@ -335,7 +339,7 @@ const form = ref({
} }
}) })
}) })
selecUserList.value = res.data selecUserList.value = res.data[0].memberJson
}).catch(() => { }) }).catch(() => { })
} }
// //
@ -348,7 +352,7 @@ const form = ref({
// //
function selectFormatCheck(val, array) { function selectFormatCheck(val, array) {
const arr = val.split(',').map(Number) const arr = val.split(',').map(Number)
let str = array.filter(item => arr.includes(item.id)).map(item => item.name).join(',') let str = array.filter(item => arr.includes(item.id)).map(item => item.nickname).join(',')
return str return str
} }
// //
@ -359,7 +363,7 @@ const form = ref({
const whichForm = ref() const whichForm = ref()
// //
function openSingleColumn(fieldName, val, list, from) { function openSingleColumn(fieldName, val, list, from) {
if (fieldName == 'deviceNumber' && form.value.id) return; if (fieldName == 'equipmentCode' && form.value.id) return;
whichForm.value = from whichForm.value = from
singleColumnList.value = list singleColumnList.value = list
field.value = fieldName field.value = fieldName
@ -369,12 +373,13 @@ const form = ref({
singleColumnDefaultValue.value = [] singleColumnDefaultValue.value = []
} }
singleColumnShow.value = true singleColumnShow.value = true
// isShowSelectItem.value = true;
} }
// //
function chooseSingleColumn(e) { function chooseSingleColumn(e) {
if(whichForm.value == 'form'){ if(whichForm.value == 'form'){
form.value[field.value] = e[0].value form.value[field.value] = e[0].value
if(field.value=='status'){ if(field.value=='result'){
form.value.statusTxt = e[0].label form.value.statusTxt = e[0].label
formatDate.value = '' formatDate.value = ''
} }
@ -385,17 +390,22 @@ const form = ref({
form1.value.name = e[0].label form1.value.name = e[0].label
} }
} }
singleColumnShow.value = false singleColumnShow.value = false
} }
// //
async function getSparePartsList() { async function getSparePartsList(number,name) {
await sparePartsApi.getSparePartsList().then(res => { number =equipmentCode.value
let param = {
number:number,
name:name
}
await sparePartsApi.getSparePartsList(param).then(res => {
res.data.map(item => { res.data.map(item => {
item.value = item.number item.value = item.number
item.label = item.name item.label = item.name
}) })
sparePartsList.value = res.data sparePartsList.value = res.data
singleColumnList.value = sparePartsList.value
}).catch(() => { }) }).catch(() => { })
} }
// //
@ -440,6 +450,22 @@ const form = ref({
datetimeDefaultValue.value = val ? val : proxy.$time.formatDate() datetimeDefaultValue.value = val ? val : proxy.$time.formatDate()
datetimeShow.value = true datetimeShow.value = true
} }
async function searchItem(name){
await getSparePartsList(null,name);
}
async function chooseItem1(type,forms){
if(!forms.value.number&&type==1){
proxy.$modal.showToast('请选择备件')
return
}
if(type==1){
form1.value.number = forms.value.temporarilyNumber
form1.value.name =forms.value.temporarilyName
}
await getSparePartsList(null,null);
isShowSelectItem.value = false;
}
// //
function chooseDatetime(e) { function chooseDatetime(e) {
let array1 = [] let array1 = []
@ -470,14 +496,17 @@ const form = ref({
if (option.type) type.value = option.type; if (option.type) type.value = option.type;
if (option.factoryAreaNumber) factoryAreaNumber.value = option.factoryAreaNumber; if (option.factoryAreaNumber) factoryAreaNumber.value = option.factoryAreaNumber;
if (option.number) form.value.number = option.number; if (option.number) form.value.number = option.number;
if (option.equipmentCode) equipmentCode.value = option.equipmentCode;
if (option.workshopCode) workshopCode.value = option.workshopCode;
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
.data)).id) { .data)).id) {
form.value = JSON.parse(decodeURIComponent(option.data)) form.value = JSON.parse(decodeURIComponent(option.data))
form.value.itemNumbers = form.value.items form.value.itemNumbers = form.value.items
formatDate.value = form.value.completionTime ? proxy.$time.formatDate(form.value.completionTime) : '' formatDate.value = form.value.completionTime ? proxy.$time.formatDate(form.value.completionTime) : ''
form.value.statusTxt = form.value.status == 0 ? '完成' :'未完成' form.value.statusTxt = form.value.result == 0 ? '完成' :'未完成'
}; };
jxDetailsStatus.value = await dictApi.getDict('jx_details_status')
jxDetailsStatus.value = await dictApi.getDict('IS_COMPLETED')
await getSelecUser() await getSelecUser()
await getSparePartsList() await getSparePartsList()

798
src/pages/eam/upkeepOrder/detail.vue

@ -0,0 +1,798 @@
<template>
<!-- 详情 -->
<view class="detail-container">
<view class="info">
<view class="title">
<view>保养工单</view>
</view>
<view class="dec">
<view class="dec-item">
<view>工单单号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>保养计划单号</view>
<view>{{data.planNumber}}</view>
</view>
<view class="dec-item">
<view>故障类型</view>
<view>{{data.faultTypeName}}</view>
</view>
<view class="dec-item" v-if="data.createTime">
<view>创建时间</view>
<view>{{$time.formatDate(data.createTime)}}</view>
</view>
<view class="dec-item" v-if="data.creator">
<view>创建人员</view>
<view>{{data.creator}}</view>
</view>
<view class="dec-item" v-if="data.receivingTime">
<view>接单时间</view>
<view>{{$time.formatDate(data.receivingTime)}}</view>
</view>
<view class="dec-item" v-if="data.maintenanceName">
<view>保养人员</view>
<view>{{data.maintenanceName}}</view>
</view>
<view class="dec-item" v-if="data.completionTime">
<view>完成时间</view>
<view>{{$time.formatDate(data.completionTime)}}</view>
</view>
</view>
</view>
<div class="line"></div>
<view class="info" style="padding-bottom: 130rpx;">
<view class="tab">
<u-tabs :list="list" :is-scroll="false" bar-height="2" bar-width="250" v-model="current"
@change="change"></u-tabs>
</view>
<view>
<view class="title">
<view>{{changeItem.name}}</view>
</view>
<view class="dec" v-if="current == 0">
<view class="dec-item">
<view>设备编号</view>
<view>{{data.equipmentCode}}</view>
</view>
<view class="dec-item">
<view>设备名称</view>
<view>{{data.equipmentName}}</view>
</view>
<view class="dec-item">
<view>所属车间</view>
<view>{{data.workshopName}}</view>
</view>
<view class="dec-item">
<view>设备类型</view>
<view>{{data.type == 'DEVICE'?'设备':'工装'}}</view>
</view>
</view>
<view class="list" v-if="current == 1">
<view class="item " v-for="(item,index) in serviceList" :key="index"
@click="addSubForm('updata',item)">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.contents}}
</view>
</view>
<!-- <view class="dec2">
<view>保养部位</view>
<view>{{item.equipmentParts}}</view>
</view> -->
<view class="dec2">
<view>预估人数</view>
<view v-if="item.peoples||item.peoples==0">{{item.peoples}}</view>
</view>
<view class="dec2">
<view>预估分钟</view>
<view v-if='item.estimatedMinutes'>{{item.estimatedMinutes}}分钟</view>
</view>
<view class="dec2">
<view>实际分钟</view>
<view v-if='item.actualMinutes'>{{item.actualMinutes}}分钟</view>
</view>
<view class="dec2">
<view>保养部位</view>
<view>{{item.equipmentParts}}</view>
</view>
<view class="dec2">
<view>责任人</view>
<view>{{item.chargePeoplesName}}</view>
</view>
<view class="dec2">
<view>完成情况</view>
<view>
{{item.result==0 || item.result == '0'? '完成':item.result==1 ||item.result == '1'?'未完成':''}}
</view>
</view>
<view class="dec2" v-if='item.result === 0 || item.result === "0"'>
<view>完成时间</view>
<view>{{$time.formatDate(item.completionTime)}}</view>
</view>
<!-- <view class="dec2">
<view>工程师确认</view>
<view>{{item.engineer}}</view>
</view> -->
<view class="dec2" v-if="item.result === 1 || item.result === '1'">
<view>未完成原因</view>
<view>{{item.uncompleted}}</view>
</view>
<view class="dec2">
备件
</view>
<view class="items" v-for="(cur,key) in item.items" :key="key">
<view class="items-name">
{{cur.name}}
</view>
<view class="items-dec">
备件编号{{cur.number}}
</view>
<view class="items-dec">
数量{{cur.qty}}
</view>
</view>
</view>
<!-- <u-icon name="minus-circle" color="#aaaaaa" size="60" ></u-icon> -->
</view>
</view>
</view>
</view>
<view class="footer">
<view class="btns">
<u-button type="primary"
v-if="data.status == '3'"
@click="orderClickAccept()" :loading='loading' :disabled='loading'>接单</u-button>
<u-button type="primary"
v-if="data.status == '4'"
@click="orderClickExcute()" :loading='loading' :disabled='loading'>执行</u-button>
<u-button type="primary"
v-if="data.status == '5'"
@click="orderClickFinish()" :loading='loading' :disabled='loading'>完成</u-button>
<u-button type="primary"
v-if="data.status == '7'"
@click="verify()" :loading='loading' :disabled='loading'>验证</u-button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 表单弹出框 -->
<u-popup v-model="formPopupVisible" @close="formPopupVisible = false" mode="bottom">
<view class="add-form-container">
<u-form :model="form" ref="formRef2" label-width="160rpx">
<u-form-item label="开始时间:" prop="startTime" required >
<view class="select" @click="openDatetime('startTime',formatDate,params,formatValue)">
<view class="input" v-if='formatStartDate'>
{{formatStartDate}}
</view>
<view class="placeholder" v-else>
{{`请选择开始时间`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="完成时间:" prop="endTime" required>
<view class="select" @click="openDatetime('endTime',formatDate,params,formatValue)">
<view class="input" v-if='formatEndDate'>
{{formatEndDate}}
</view>
<view class="placeholder" v-else>
{{`请选择完成时间`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
</u-form>
<view class="popup-footer">
<u-button @click="formPopupVisible = false">取消</u-button>
<u-button type="primary" @click="confirmKeepOrderForm">确认</u-button>
</view>
</view>
</u-popup>
<!-- 验证完结-->
<u-popup v-model="isVerifyShowSuccess" mode="center" border-radius="14">
<view class="popup-title">验证完结意见</view>
<view class="popup">
<textarea v-model="data.applyContent" placeholder="请输入内容"></textarea>
</view>
<view class="popup-footer">
<view @click="cancel">取消</view>
<view class="sure" @click="orderClickVerify">确认</view>
</view>
</u-popup>
<u-picker mode="time" v-model="datetimeShow" :default-time='datetimeDefaultValue' :params="params" @confirm='chooseDatetime' @cancle='datetimeShow = false'></u-picker>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as moldApi from "@/api/eam/tool"
import * as upkeepOrderApi from "@/api/eam/upkeepOrder"
import * as workShopApi from "@/api/wms/workShop"
import * as userApi from "@/api/eam/user"
import * as deviceApi from "@/api/eam/device"
import * as basicFaultTypeApi from "@/api/eam/basicFaultType"
const { proxy } = getCurrentInstance()
const list = ref([{
name: '设备信息'
}, {
name: '保养内容'
}])
const current = ref(0)
const changeItem = ref({
name: '设备信息',
value: 1
})
const data = ref()
const loading = ref(false)
const type = ref('')
const serviceList = ref([])
const isTrue = ref(false)
const isVerifyShowSuccess = ref(false)
const formPopupVisible = ref(false)
const form2 = ref({
startTime: '',
endTime: ''
})
const params = ref({
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: true,
timestamp: true,
})
const datetimeDefaultValue = ref('')
const formatValue = ref('YYYY-MM-DD hh:mm:ss')
function change(index) {
current.value = index
changeItem.value = list.value[current.value]
}
//
function addSubForm(clickType, item) {
if (data.value.status == '7') {//
return
}
if (data.value.status == '3') {
proxy.$modal.showToast('请先接单')
return
}
if (data.value.status == '4') {
proxy.$modal.showToast('请先点击执行')
return
}
if (clickType == 'updata') {
proxy.$tab.navigateTo(
`/pages/eam/upkeepOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}&data=${encodeURIComponent(JSON.stringify(item))}&equipmentCode=${data.value.equipmentCode}&workshopCode=${data.value.workshopCode}`
)
} else {
proxy.$tab.navigateTo(
`/pages/eam/upkeepOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}&equipmentCode=${data.value.equipmentCode}&workshopCode=${data.value.workshopCode}`
)
}
}
function orderClickAccept(type1) {
const paramsData = {
id: data.value.id,
status: '4'
}
proxy.$modal.confirm('是否接单?').then(() => {
proxy.$modal.loading('加载中')
upkeepOrderApi.orderClick(paramsData,type.value).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
reloadPage()
}, 1500)
} else {
proxy.$modal.showToast('操作失败')
}
}).catch(() => {
proxy.$modal.closeLoading()
})
})
}
function orderClickExcute(type1) {
const paramsData = {
id: data.value.id,
status: '5'
}
proxy.$modal.confirm('是否开始执行?').then(() => {
proxy.$modal.loading('加载中')
upkeepOrderApi.orderClick(paramsData,type.value).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
reloadPage()
}, 1500)
} else {
proxy.$modal.showToast('操作失败')
}
}).catch(() => {
proxy.$modal.closeLoading()
})
})
}
//
function orderClickVerify() {
if (!serviceList.value || serviceList.value && serviceList.value.length == 0) {
proxy.$modal.showToast('没有保养内容')
return;
}
const paramsData = {
id: data.value.id,
verifyContent: data.value.applyContent
}
proxy.$modal.confirm('是否验证完结?').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
upkeepOrderApi.orderClickVerify(paramsData,type.value).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast('操作失败')
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
//
function orderClickFinish() {
if (!serviceList.value || serviceList.value && serviceList.value.length == 0) {
proxy.$modal.showToast('没有保养内容')
return;
}
let flag = true;
serviceList.value.forEach(item=>{
if(item.result == null || item.result != '0'){
flag = false;
}
})
if(!flag){
proxy.$modal.showToast('有未完成保养项')
return;
}
formPopupVisible.value = true
}
function confirmKeepOrderForm(){
if (!(formatStartDate.value && formatStartDate.value.trim() != '')) {
proxy.$modal.showToast('请选择创建时间')
return
}else if (!(formatEndDate.value && formatStartDate.value.trim() != '')) {
proxy.$modal.showToast('请选择结束时间')
return
}else if(form2.value.startTime >= form2.value.endTime){
proxy.$modal.showToast('创建时间要小于结束时间')
return
}else{
formPopupVisible.value = false
}
const paramsData = {
id: data.value.id,
verifyContent: data.value.applyContent,
startTime: form2.value.startTime,
endTime: form2.value.endTime,
number: data.value.number,
}
proxy.$modal.confirm('是否完成?').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
upkeepOrderApi.orderClickFinish(paramsData,type.value).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
upkeepOrderApi.excuteFinish({id:data.value.id,status:'5'},type.value).then(resp=>{
setTimeout(() => {
// proxy.$tab.navigateTo(`/pages/eam/upkeepOrder/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
})
})
}
//
function getUpkeepOrderDetailList() {
upkeepOrderApi.upkeepOrderDetailList({
number: data.value.number
}, type.value).then((res) => {
userApi.getAllUserSimpleInfo().then(response => {
if (res.data) {
res.data.forEach(element => {
if (element.chargePeoples) {
// chargePeoples ID
const userIds = element.chargePeoples.split(',');
// ID
const userNicknames = userIds.map(userId => {
const user = response.data.find(user => user.id == userId);
return user ? user.nickname : '';
});
//
element.chargePeoplesName = userNicknames.join(',');
}
});
// serviceList
serviceList.value = res.data;
}
});
}).catch(() => { });
}
//
function delService(item) {
proxy.$modal.confirm('确定删除保养内容吗?').then(() => {
proxy.$modal.loading('加载中')
upkeepOrderApi.upkeepOrderDetailDelete(item.id,type.value).then((res) => {
proxy.$modal.closeLoading()
getUpkeepOrderDetailList()
}).catch(() => { })
})
}
onLoad(async (option) => {
if (option.type) type.value = option.type;
if (option.data) {
data.value = JSON.parse(decodeURIComponent(option.data))
}
changeItem.value = list.value[current.value]
await reloadPage()
})
onShow(() => {
getUpkeepOrderDetailList()
})
/**
* 点击验证完结填写意见
*/
function verify() {
data.value.applyContent = null;
isVerifyShowSuccess.value = true
}
function cancel() {
data.applyContent = null;
isVerifyShowSuccess.value = false
}
const field = ref('')
const datetimeShow = ref(false)
const formatStartDate = ref('')//
const formatEndDate = ref('')//
//
function chooseDatetime(e) {
let array1 = []
let array2 = []
if (formatValue.value.indexOf('YYYY') > -1) {
array1.push(e.year)
}
if (formatValue.value.indexOf('MM') > -1) {
array1.push(e.month)
}
if (formatValue.value.indexOf('DD') > -1) {
array1.push(e.day)
}
if (formatValue.value.indexOf('hh') > -1) {
array2.push(e.hour)
}
if (formatValue.value.indexOf('mm') > -1) {
array2.push(e.minute)
}
if (formatValue.value.indexOf('ss') > -1) {
array2.push(e.second)
}
let str = array1.join('-') + ' ' + array2.join(':')
if(field.value == 'startTime'){
formatStartDate.value = str
}else if(field.value == 'endTime'){
formatEndDate.value = str
}
form2.value[field.value] = e.timestamp*1000
}
function openDatetime(fieldName, val, params, format) {
params.value = params
formatValue.value = format
field.value = fieldName
datetimeDefaultValue.value = val ? val : proxy.$time.formatDate()
datetimeShow.value = true
}
async function reloadPage() {
proxy.$modal.loading('加载中')
try {
const res = await upkeepOrderApi.upkeepOrderInfo({id:data.value.id},type.value);
const resp = await deviceApi.deviceNoPage();
const response = await basicFaultTypeApi.getBasicFaultTypeNoPage();
const workshopList = await workShopApi.getWorkshopNoPage();
const detailRes = await upkeepOrderApi.upkeepOrderDetailList({masterId: data.value.id}, type.value);
const userResponse = await userApi.getAllUserSimpleInfo();
if (res.data) {
let element = res.data
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
}
data.value = element
if (detailRes.data) {
detailRes.data.forEach(element => {
if (element.chargePeoples) {
// chargePeoples ID
const userIds = element.chargePeoples.split(',');
// ID
const userNicknames = userIds.map(userId => {
const user = userResponse.data.find(user => user.id == userId);
return user ? user.nickname : '';
});
//
element.chargePeoplesName = userNicknames.join(',');
}
});
// serviceList
serviceList.value = detailRes.data;
}
}
proxy.$modal.closeLoading()
} catch (error) {
proxy.$modal.closeLoading();
console.error('Error fetching data:', error);
}
}
</script>
<style lang="scss" scoped>
.detail-container {
min-height: 100vh;
background: white;
}
.line {
background: #f5f5f5;
height: 20rpx;
}
.info {
background: white;
}
.tab {
border-bottom: 1px solid #e4e4e4;
}
.title {
display: flex;
align-items: center;
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
view {
&:nth-child(1) {
flex: 1;
border-left: 10rpx solid #409eff;
padding-left: 20rpx;
font-weight: bold;
}
}
}
.dec {
padding: 30rpx;
.dec-item {
padding-bottom: 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 200rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
}
.dec2 {
padding: 10rpx 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 180rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
.items {
margin: 20rpx 30rpx;
border-radius: 12rpx;
background: #F5F5F5;
padding-bottom: 20rpx;
.items-name {
padding: 20rpx;
border-bottom: 1px solid #dedede;
}
.items-dec {
padding: 0px 20rpx;
margin-top: 20rpx;
}
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx
}
.popup {
width: 600rpx;
padding: 0rpx 60rpx 0rpx;
}
.popup-footer {
display: flex;
// border-top: 1px solid #e4e4e4;
justify-content: space-between;
margin-top: 20rpx;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
background: white;
z-index: 22;
}
.btns {
display: flex;
padding: 20rpx;
box-shadow: 0px -2rpx 20rpx rgba(0, 0, 0, 0.1);
button {
flex: 1;
margin: 0px 10rpx;
}
.sure {
background: #409eff;
color: white;
border-radius: 8rpx;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
}
.list {
padding: 20rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
border-radius: 12rpx;
border: 1px solid #dedede;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
display: flex;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
flex: 1;
}
}
.dec {
color: #9c9c9c;
padding: 0rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
.select {
display: flex;
width: 100%;
.u-icon{
margin-left: auto; /* 将图标推到最右侧 */
}
}
.input {
height: 1.5625rem;
line-height:1.5625rem;
}
</style>

63
src/pages/upkeepOrder/index.vue → src/pages/eam/upkeepOrder/index.vue

@ -11,12 +11,16 @@
<view class="title-txt"> <view class="title-txt">
{{item.describes}} {{item.describes}}
</view> </view>
<u-tag text="待接单" v-if="item.status == 'PENDING'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="primary" shape='circle'/> <u-tag text="待派工" v-if="item.status == '0'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="primary" shape='circle'/>
<u-tag text="已撤回" v-else-if="item.status=='REJECTED'" bg-color='rgba(255,255,255,0)' color='#d7d7d7' border-color='#d7d7d7 ' type="warning" shape='circle'/> <u-tag text="已逾期" v-if="item.status == '1'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="primary" shape='circle'/>
<u-tag text="已转办" v-else-if="item.status=='TRANSFERRED'" bg-color='rgba(255,255,255,0)' color='#e01f54' border-color='#e01f54' type="success" shape='circle'/> <u-tag text="已退单" v-if="item.status == '2'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="primary" shape='circle'/>
<u-tag text="已接单" v-else-if="item.status=='PECEIVED'" bg-color='rgba(255,255,255,0)' color='#005eaa' border-color='#005eaa ' type="error" shape='circle'/> <u-tag text="待接单" v-if="item.status == '3'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="primary" shape='circle'/>
<u-tag text="已验证" v-else-if="item.status=='VERIFIED'" bg-color='rgba(255,255,255,0)' color='#2EC7C9' border-color='#2EC7C9' type="info" shape='circle'/> <u-tag text="待执行" v-else-if="item.status=='4'" bg-color='rgba(255,255,255,0)' color='#005eaa' border-color='#005eaa ' type="error" shape='circle'/>
<u-tag text="已完成" v-else-if="item.status=='COMPLETED'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/> <u-tag text="执行中" v-else-if="item.status=='5'" bg-color='rgba(255,255,255,0)' color='#005eaa' border-color='#005eaa ' type="error" shape='circle'/>
<u-tag text="待维修验证" v-else-if="item.status=='6'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
<u-tag text="待报修验证" v-else-if="item.status=='7'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
<u-tag text="已完成" v-else-if="item.status=='8'" bg-color='rgba(255,255,255,0)' color='#2EC7C9' border-color='#2EC7C9' type="info" shape='circle'/>
<u-tag text="已作废" v-else-if="item.status=='9'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
</view> </view>
<view class="dec"> <view class="dec">
保养单号:<span>{{item.number}}</span> 保养单号:<span>{{item.number}}</span>
@ -25,13 +29,10 @@
保养计划单号:<span>{{item.planNumber}}</span> 保养计划单号:<span>{{item.planNumber}}</span>
</view> </view>
<view class="dec"> <view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span> {{`${params.type=='DEVICE'?'设备' : '工装'}`}}编号:<span>{{item.equipmentCode}}</span>
</view> </view>
<view class="dec"> <view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span> {{`${params.type=='DEVICE'?'设备' : '工装'}`}}名称:<span>{{item.equipmentName}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view> </view>
<view class="dec"> <view class="dec">
故障类型:<span>{{item.faultTypeName}}</span> 故障类型:<span>{{item.faultTypeName}}</span>
@ -61,37 +62,61 @@
ref, ref,
getCurrentInstance getCurrentInstance
} from 'vue' } 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 { proxy } = getCurrentInstance()
const params = ref({ const params = ref({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
type: '', type: 'DEVICE',
}) })
const status = ref('loadmore') // const status = ref('loadmore') //
const list = ref([]) const list = ref([])
function itemClick(item, index) { 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) { 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() { async function getList() {
if (status.value == 'nomore') return; if (status.value == 'nomore') return;
status.value = 'loading'; status.value = 'loading';
proxy.$modal.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() proxy.$modal.closeLoading()
if (res.data.list.length > 0) { 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); list.value = list.value.concat(res.data.list);
params.value.pageNo++; params.value.pageNo++;
status.value = 'loadmore' status.value = 'loadmore'
} else { } else {
status.value = 'nomore' status.value = 'nomore'
} }
}).catch(() => { } catch (error) {
proxy.$modal.closeLoading() proxy.$modal.closeLoading();
}) console.error('Error fetching data:', error);
}
} }
onLoad((option) => { onLoad((option) => {
if (option.type) params.value.type = option.type; if (option.type) params.value.type = option.type;

10
src/pages/upkeepOrder/myOrder.vue → src/pages/eam/upkeepOrder/myOrder.vue

@ -45,6 +45,12 @@
<view class="dec"> <view class="dec">
完成时间:<span>{{$time.formatDate(item.completionTime)}}</span> 完成时间:<span>{{$time.formatDate(item.completionTime)}}</span>
</view> </view>
<view class="dec" v-if="item.verifyName">
审核人:<span>{{item.verifyName}}</span>
</view>
<view class="time" v-if="item.verifyName">
审核时间:{{`${$time.formatDate(item.verifyTime)}`}}
</view>
</view> </view>
<view class="bottom"> <view class="bottom">
<view class="time" style="flex: 1;"> <view class="time" style="flex: 1;">
@ -70,7 +76,7 @@
ref, ref,
getCurrentInstance getCurrentInstance
} from 'vue' } from 'vue'
import * as upkeepOrderApi from "@/api/upkeepOrder.js" import * as upkeepOrderApi from "@/api/eam/upkeepOrder"
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const params = ref({ const params = ref({
pageNo: 1, pageNo: 1,
@ -83,7 +89,7 @@
if (status.value == 'nomore') return; if (status.value == 'nomore') return;
status.value = 'loading'; status.value = 'loading';
proxy.$modal.loading('加载中') proxy.$modal.loading('加载中')
await upkeepOrderApi.upkeepOrderPage(params.value).then((res) => { await upkeepOrderApi.upkeepOrderPage(params.value,'DEVICE').then((res) => {
proxy.$modal.closeLoading() proxy.$modal.closeLoading()
if (res.data.list.length > 0) { if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list); list.value = list.value.concat(res.data.list);

484
src/pages/upkeepOrder/detail.vue

@ -1,484 +0,0 @@
<template>
<!-- 详情 -->
<view class="detail-container">
<view class="info">
<view class="title">
<view>保养工单</view>
</view>
<view class="dec">
<view class="dec-item">
<view>工单单号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>保养计划单号</view>
<view>{{data.planNumber}}</view>
</view>
<view class="dec-item">
<view>故障类型</view>
<view>{{data.faultTypeName}}</view>
</view>
<view class="dec-item" v-if="data.createTime">
<view>创建时间</view>
<view>{{$time.formatDate(data.createTime)}}</view>
</view>
<view class="dec-item" v-if="data.creator">
<view>创建人员</view>
<view>{{data.creator}}</view>
</view>
<view class="dec-item" v-if="data.receivingTime">
<view>接单时间</view>
<view>{{$time.formatDate(data.receivingTime)}}</view>
</view>
<view class="dec-item" v-if="data.maintenanceName">
<view>维修人员</view>
<view>{{data.maintenanceName}}</view>
</view>
<view class="dec-item" v-if="data.completionTime">
<view>完成时间</view>
<view>{{$time.formatDate(data.completionTime)}}</view>
</view>
</view>
</view>
<div class="line"></div>
<view class="info" style="padding-bottom: 130rpx;">
<view class="tab">
<u-tabs :list="list" :is-scroll="false" bar-height="2" bar-width="250" v-model="current"
@change="change"></u-tabs>
</view>
<view>
<view class="title">
<view>{{changeItem.name}}</view>
</view>
<view class="dec" v-if="current == 0">
<view class="dec-item">
<view>设备编号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>设备名称</view>
<view>{{data.name}}</view>
</view>
<view class="dec-item">
<view>所属厂区</view>
<view>{{data.factoryAreaName}}</view>
</view>
<view class="dec-item">
<view>设备类型</view>
<view>{{data.type == 'DEVICE'?'设备':data.type == 'TECH'?'工艺':'模具'}}</view>
</view>
</view>
<view class="list" v-if="current == 1">
<view class="item " v-for="(item,index) in serviceList" :key="index"
@click="addSubForm('updata',item)">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.contents}}
</view>
</view>
<!-- <view class="dec2">
<view>保养部位</view>
<view>{{item.equipmentParts}}</view>
</view> -->
<view class="dec2">
<view>预估人数</view>
<view v-if="item.peoples||item.peoples==0">{{item.peoples}}</view>
</view>
<view class="dec2">
<view>预估分钟</view>
<view v-if='item.estimatedMinutes'>{{item.estimatedMinutes}}分钟</view>
</view>
<view class="dec2">
<view>实际分钟</view>
<view v-if='item.actualMinutes'>{{item.actualMinutes}}分钟</view>
</view>
<view class="dec2">
<view>责任人</view>
<view>{{item.chargePeoplesName}}</view>
</view>
<view class="dec2" >
<view>完成情况</view>
<view>{{item.status===0 || item.status === '0'? '完成':item.status===1 ||item.status === '1'?'未完成':''}}</view>
</view>
<view class="dec2" v-if='item.status === 0 || item.status === "0"'>
<view>完成时间</view>
<view>{{$time.formatDate(item.completionTime)}}</view>
</view>
<view class="dec2">
<view>工程师确认</view>
<view>{{item.engineer}}</view>
</view>
<view class="dec2" v-if="item.status === 1 || item.status === '1'">
<view>未完成原因</view>
<view>{{item.uncompleted}}</view>
</view>
<view class="dec2">
备件
</view>
<view class="items" v-for="(cur,key) in item.items" :key="key">
<view class="items-name">
{{cur.name}}
</view>
<view class="items-dec">
备件编号{{cur.number}}
</view>
<view class="items-dec">
数量{{cur.qty}}
</view>
</view>
</view>
<!-- <u-icon name="minus-circle" color="#aaaaaa" size="60" ></u-icon> -->
</view>
</view>
</view>
</view>
<view class="footer">
<view class="btns">
<u-button type="primary" v-if="data.status == 'PENDING'" @click="orderClick(1)" :loading='loading'
:disabled='loading'>接单</u-button>
<u-button type="primary" v-if="data.status == 'PECEIVED'" @click="orderClick(2)" :loading='loading'
:disabled='loading'>完成</u-button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as moldApi from "@/api/eam/tool.js"
import * as upkeepOrderApi from "@/api/upkeepOrder.js"
const { proxy } = getCurrentInstance()
const list = ref([{
name: '设备信息'
}, {
name: '保养内容'
}])
const current = ref(0)
const changeItem = ref({
name: '设备信息',
value: 1
})
const data = ref()
const loading = ref(false)
const type = ref('')
const serviceList = ref([])
const isTrue = ref(false)
function change(index) {
current.value = index
changeItem.value = list.value[current.value]
}
//
function addSubForm(clickType, item) {
if (data.value.status == 'PENDING') {
proxy.$modal.showToast('请先接单')
return
}
if (clickType == 'updata') {
proxy.$tab.navigateTo(
`/pages/upkeepOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}&data=${encodeURIComponent(JSON.stringify(item))}`
)
} else {
proxy.$tab.navigateTo(
`/pages/upkeepOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}`
)
}
}
function orderClick(type) {
if(!serviceList.value || serviceList.value&&serviceList.value.length == 0){
proxy.$modal.showToast('没有保养内容')
return;
}
// if(type == 2){
// isTrue.value = serviceList.value.some(item=>item.items.length == 0)
// if(isTrue.value){
// proxy.$modal.showToast('')
// return;
// }
// }
const paramsData = {
id: data.value.id
}
let tips = data.value.status == 'PENDING' ? '是否接单?' : data.value.status == 'PECEIVED' ? '是否完成?' : ''
proxy.$modal.confirm(tips).then(() => {
proxy.$modal.loading('加载中')
loading.value = true
if(type == 1){
upkeepOrderApi.orderClick(paramsData).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast('操作失败')
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
}else if(type == 2){
upkeepOrderApi.orderClickFinish(paramsData).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast('操作失败')
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
}
})
}
//
function getUpkeepOrderDetailList() {
upkeepOrderApi.upkeepOrderDetailList({
number: data.value.number
}).then((res) => {
if (res.data) {
serviceList.value = res.data
}
}).catch(() => { })
}
//
function delService(item) {
proxy.$modal.confirm('确定删除维修内容吗?').then(() => {
proxy.$modal.loading('加载中')
upkeepOrderApi.upkeepOrderDetailDelete(item.id).then((res) => {
proxy.$modal.closeLoading()
getUpkeepOrderDetailList()
}).catch(() => { })
})
}
onLoad(async (option) => {
if (option.type) type.value = option.type;
if (option.data) {
data.value = JSON.parse(decodeURIComponent(option.data))
}
changeItem.value = list.value[current.value]
})
onShow(() => {
getUpkeepOrderDetailList()
})
</script>
<style lang="scss" scoped>
.detail-container{
min-height: 100vh;
background: white;
}
.line{
background: #f5f5f5;
height: 20rpx;
}
.info {
background: white;
}
.tab {
border-bottom: 1px solid #e4e4e4;
}
.title {
display: flex;
align-items: center;
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
view {
&:nth-child(1) {
flex: 1;
border-left: 10rpx solid #409eff;
padding-left: 20rpx;
font-weight: bold;
}
}
}
.dec {
padding: 30rpx;
.dec-item {
padding-bottom: 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 200rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
}
.dec2 {
padding: 10rpx 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 180rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
.items {
margin: 20rpx 30rpx;
border-radius: 12rpx;
background: #F5F5F5;
padding-bottom: 20rpx;
.items-name {
padding: 20rpx;
border-bottom: 1px solid #dedede;
}
.items-dec {
padding: 0px 20rpx;
margin-top: 20rpx;
}
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx
}
.popup {
width: 600rpx;
padding: 0rpx 60rpx 0rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
background: white;
z-index: 22;
}
.btns {
display: flex;
padding: 20rpx;
box-shadow: 0px -2rpx 20rpx rgba(0, 0, 0, 0.1);
button {
flex: 1;
margin: 0px 10rpx;
}
.sure {
background: #409eff;
color: white;
border-radius: 8rpx;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
}
.list {
padding: 20rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
border-radius: 12rpx;
border: 1px solid #dedede;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
display: flex;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
flex: 1;
}
}
.dec {
color: #9c9c9c;
padding: 0rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
</style>
Loading…
Cancel
Save