ljlong_2630
5 months ago
25 changed files with 2711 additions and 785 deletions
@ -0,0 +1,5 @@ |
|||
import http from '../http' |
|||
// 根据模具号查询信息
|
|||
export function getBasicFaultTypeNoPage(params) { |
|||
return http.get('/eam/basic-fault-type/noPage',{params}) |
|||
} |
@ -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) |
|||
} |
|||
} |
@ -1,5 +1,11 @@ |
|||
import http from './http' |
|||
import http from '../http' |
|||
// 用户密码重置
|
|||
export function updateUserPassword(data) { |
|||
return http.put('/eam/device-accounts/getDetailsByNumber',data) |
|||
} |
|||
} |
|||
|
|||
|
|||
export function getAllUserSimpleInfo(){ |
|||
return http.get('/system/user/list-all-simple') |
|||
} |
|||
|
@ -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) |
|||
} |
@ -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 |
|||
}; |
@ -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, |
|||
}; |
@ -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) |
|||
} |
@ -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 |
|||
} |
@ -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 |
|||
} |
@ -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> |
|||
|
@ -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> |
@ -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…
Reference in new issue