You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1070 lines
30 KiB

<template>
<!-- 详情 -->
<view class="detail-container">
<view class="info">
<view class="title">
<view>维修工单</view>
<!-- <view @click="transfer"
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 @click="transfer"
v-if="data.status == '5'">
转办
</view>
</view>
<view class="dec">
<view class="dec-item">
<view>工单单号:</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>报修描述:</view>
<view>{{data.maintenanceDesc}}</view>
</view>
<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;"
v-if="data.status == '5'">
<!-- <u-form-item label="班次" prop="classes" required>
<view class="select" @click="openSingleColumn('classes',data.classes,maintenanceShift)">
<view class="input" v-if='data.classes||data.classes==0'>
{{data.classesName}}
</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="classes" required>
<view class="select" @click="openSingleColumn('faultType',data.faultType,faultType)">
<view class="input" v-if='data.faultType'>
{{data.faultTypeName}}
</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="dec-item" v-if="data.status != '5'">
<view>班次:</view>
<view>{{data.classesName}}</view>
</view>
<view class="dec-item" v-if="data.status != '5'">
<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 class="dec-item" v-if="data.applyTime">
<view>确认时间:</view>
<view>{{$time.formatDate(data.applyTime)}}</view>
</view>
<view class="dec-item" v-if="data.applyContent">
<view>确认意见:</view>
<view>{{data.applyContent}}</view>
</view>
<view class="dec-item" v-if="data.verifyTime">
<view>验证时间:</view>
<view>{{$time.formatDate(data.verifyTime)}}</view>
</view>
<view class="dec-item" v-if="data.verifyer">
<view>验证人员:</view>
<view>{{data.verifyer}}</view>
</view>
<view class="dec-item" v-if="data.verifyContent">
<view>验证内容:</view>
<view>{{data.verifyContent}}</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="changeItem.value == 1">
<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.type == 'DEVICE'?'设备':'工装'}}</view>
</view>
</view>
<view class="dec" v-if="changeItem.value == 2">
<view class="dec-item">
<view>报修单号:</view>
<view>{{data1.number}}</view>
</view>
<view class="dec-item">
<view>报修描述:</view>
<view>{{data1.maintenanceDesc}}</view>
</view>
<view class="dec-item">
<view>报修人:</view>
<view>{{data1.repairerName}}</view>
</view>
<view class="dec-item">
<view>报修时间:</view>
<view>{{data1.createTime? $time.formatDate(data1.createTime):null}}</view>
</view>
<!-- <view>图片:</view> -->
<view class="images">
<image :src="cur" mode="" v-for="(cur,key) in data1.filePathList" :key='key'
@click="previewImage(key,data1.filePathList)"></image>
</view>
</view>
<view class="list" v-if="changeItem.value == 3">
<view class="item " v-for="(item,index) in serviceList" :key="index"
@click.stop="addSubForm('updata',item)">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.maintenanceDesc}}
</view>
<view class="" @click.stop="delService(item)">
<u-icon name="trash" color="#aaaaaa" size="40"
v-if="data.status == '5'"></u-icon>
</view>
</view>
<view class="dec2">
<view>故障真因:</view>
<view>{{item.maintenanceDesc1}}</view>
</view>
<view class="dec2">
<view>解决措施:</view>
<view>{{item.workOut}}</view>
</view>
<view class="dec2">
<view>维修人员:</view>
<view>{{item.maintenancesName}}</view>
</view>
<view class="" v-show="item.items&&item.items.length>0">
<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>
</view>
<!-- <u-icon name="minus-circle" color="#aaaaaa" size="60" ></u-icon> -->
</view>
<view class="add-btn" v-if="data.status == '3' || data.status == '5'">
<u-button type="primary" @click="addSubForm('create')"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加维修内容</u-button>
</view>
</view>
</view>
</view>
<view class="footer">
<view class="btns"
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>
</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' 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'
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 class="btns"
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>
</view>
<view class="btns"
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'
: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="isShowSuccess" mode="center" border-radius="14">
<view class="popup-title">完成类型</view>
<view class="popup">
<u-radio-group v-model="result" @change="radioGroupChange">
<u-radio v-for="(item, index) in orderCompleteResult" :key="index" :name="item.value">
{{item.label}}
</u-radio>
</u-radio-group>
</view>
<view class="popup-footer">
<view @click="isShowSuccess = false">取消</view>
<view class="sure" @click="orderClickFinish">确认</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-popup v-model="isApplyShowSuccess" 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 class="sure" @click="orderClickConfirm('6')">通过</view>
<view class="reject" @click="orderClickConfirm('APPLYREJECTED')" style="color: red;">驳回</view>
</view>
</u-popup>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn"></u-select>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as dictApi from "@/api/eam/dict"
import * as repairOrderApi from "@/api/eam/repairOrder"
import { useCountStore } from '@/store'
import * as deviceApi from "@/api/eam/device.js"
import * as basicFaultTypeApi from "@/api/eam/basicFaultType.js"
import * as userApi from "@/api/eam/user.js"
const { proxy } = getCurrentInstance()
// 获取自定义的store
const store = useCountStore()
const list = ref([{
name: '设备信息',
value: 1
}, {
name: '报修信息',
value: 2
}, {
name: '维修内容',
value: 3
}])
const current = ref(0)
const changeItem = ref({
name: '设备信息',
value: 1
})
const data = ref({})
const loading = ref(false)
const loading1 = ref(false)
const type = ref('')
const serviceList = ref([])
const isShowSuccess = ref(false)
const isVerifyShowSuccess = ref(false)//验证确认弹出层
const isApplyShowSuccess = ref(false)//维修确认弹出层
const orderCompleteResult = ref([]) //订单完成类型
const result = ref('TEMPORARILY')
const data1 = ref('')
const number = ref('')
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
const singleColumnList = ref([])
const field = ref('')
const maintenanceShift = ref([]) //班次字典项
const faultType = ref([]) //故障类型字典项
function change(index) {
current.value = index
changeItem.value = list.value[current.value]
}
// 添加表格表单
function addSubForm(clickType, item) {
if (data.value.status == '6' || data.value.status == '7') {
return
}
if (data.value.status == '3') {
proxy.$modal.showToast('请先接单')
return
}
if (clickType == 'updata') {
proxy.$tab.navigateTo(
`/pages/eam/repairOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}&data=${encodeURIComponent(JSON.stringify(item))}&equipmentCode=${data.value.equipmentCode}&masterId=${data.value.id}`
)
} else {
proxy.$tab.navigateTo(
`/pages/eam/repairOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}&equipmentCode=${data.value.equipmentCode}&masterId=${data.value.id}`
)
}
}
// 完成按钮
function orderClickSuccess() {
// 如果点击完成是否与接单人员一致
if (data.value.status == '5') {
if (store.id != data.value.maintenance) {
proxy.$modal.showToast('当前人员与接单人员不一致')
return;
}
if (!serviceList.value || serviceList.value && serviceList.value.length == 0) {
proxy.$modal.showToast('请添加维修内容')
return;
}
if (!data.value.classesName || !data.value.faultTypeName) {
proxy.$modal.showToast('请完善班次和故障类型')
return;
}
}
isShowSuccess.value = true
}
/**
* 维修确认点击时间
*/
function orderClickApply() {
data.value.applyContent = null;
isApplyShowSuccess.value = true
}
/**
* 点击验证完结填写意见
*/
function verify() {
data.value.applyContent = null;
isVerifyShowSuccess.value = true
}
function cancel() {
data.applyContent = null;
isVerifyShowSuccess.value = false
isApplyShowSuccess.value = false
}
function radioGroupChange(e) {
result.value = e
}
// 完成
async function orderClickFinish() {
isShowSuccess.value = false
const dataOne = {
number: data.value.number,
status: data.value.status,
id: data.value.id,
result: 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
}
// 如果直接点击完成先走修改工单接口
await repairOrderApi.repairOrderUpdate(dataTwo, type.value).then((res) => { }).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
proxy.$modal.loading('加载中')
loading.value = true
await repairOrderApi.orderClickFinish(dataOne, type.value).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast(res.msg)
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
}
/**
* 维修确认
*/
async function orderClickConfirm(status) {
isApplyShowSuccess.value = false
result.value = status
isShowSuccess.value = false
const dataOne = {
number: data.value.number,
status: data.value.status,
id: data.value.id,
result: result.value ,
repairNumber: data.value.repairNumber,
content: data.value.applyContent ? data.value.applyContent : ''
}
proxy.$modal.loading('加载中')
loading.value = true
await repairOrderApi.orderClickConfirm(dataOne, type.value).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast(res.msg)
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
}
/**
* 验证确认
*/
async function orderClickVerify() {
isVerifyShowSuccess.value = false
const dataOne = {
number: data.value.number,
status: data.value.status,
id: data.value.id,
result: result.value,
repairNumber: data.value.repairNumber,
content: data.value.applyContent ? data.value.applyContent : ''
}
proxy.$modal.loading('加载中')
loading.value = true
await repairOrderApi.orderClickVerify(dataOne, type.value).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast(res.msg)
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
}
// APP维修工单接单、点击完成、验证
// async function orderClick(type1) {
// // 如果是接单
// // if (this.data.status == '3') {
// // if (this.$store.state.user.dept.parentId != this.data.factoryAreaNumber) {
// // this.$modal.showToast('当前人员厂区与工单来源的厂区不一致')
// // return;
// // }
// // if (this.$store.state.user.dept.classType != this.data.type) {
// // this.$modal.showToast('当前人员班组与工单类型不一致')
// // return;
// // }
// // }
// const dataOne = {
// number: data.value.number,
// status: data.value.status,
// id: data.value.id,
// result: type1 == 2||type1 == 3 ? result.value : '',
// repairNumber: data.value.repairNumber,
// content:data.value.applyContent ? data.value.applyContent:''
// }
// // 修改工单接口参数
// const dataTwo = {
// id: data.value && data.value.id ? data.value.id : '',
// maintenanceDesc: data.value.maintenanceDesc,
// type: data.value.type,
// equipmentCode: data.value.equipmentCode,
// factoryAreaNumber: data.value.factoryAreaNumber,
// classes: data.value.classes,
// faultType: data.value.faultType
// }
// let tips = data.value.status == '3' ? '是否接单?' : data.value.status == '5' ? '是否完成?' : data.value.status == 'COMPLETED' && data.value.repairNumber && data.value.applyer == store.id ? '是否确认提交?' :data.value.status == 'COMPLETED' && !data.value.repairNumber ? '是否验证完结?':data.value.status == '6' ? '是否验证完结?':''
// if(type1 == 2 || type1 ==3){
// // 如果直接点击完成先走修改工单接口
// if (data.value.status == '5') {
// await repairOrderApi.repairOrderUpdate(dataTwo).then((res) => { }).catch(() => {
// proxy.$modal.closeLoading()
// loading.value = false
// })
// }
// proxy.$modal.confirm(tips).then(async () => {
// proxy.$modal.loading('加载中')
// loading.value = true
// await repairOrderApi.orderClick(dataOne).then((res) => {
// if (res.data) {
// proxy.$modal.showToast('操作成功')
// setTimeout(() => {
// if(type1==3){
// // proxy.$tab.navigateTo(`/pages/repairOrder/index?type=${type.value}&flag=2`)
// proxy.$tab.navigateBack()
// }else{
// // proxy.$tab.navigateTo(`/pages/repairOrder/index?type=${type.value}`)
// proxy.$tab.navigateBack()
// }
// loading.value = false
// }, 1500)
// } else {
// proxy.$modal.showToast('操作失败')
// loading.value = false
// }
// }).catch(() => {
// proxy.$modal.closeLoading()
// loading.value = false
// })
// })
// }else{
// proxy.$modal.confirm(tips).then(async () => {
// proxy.$modal.loading('加载中')
// loading.value = true
// // 如果直接点击完成先走修改工单接口
// if (data.value.status == '5') {
// await repairOrderApi.repairOrderUpdate(dataTwo).then((res) => { }).catch(() => {
// proxy.$modal.closeLoading()
// loading.value = false
// })
// }
// await repairOrderApi.orderClick(dataOne).then(async(res) => {
// if (res.data) {
// proxy.$modal.showToast('操作成功')
// await getDeviceRepairDetail(number.value)
// await getDeviceRepairDetailsByNumber()
// loading.value = false
// // setTimeout(() => {
// // // proxy.$tab.navigateBack()
// // }, 1500)
// } else {
// proxy.$modal.showToast('操作失败')
// loading.value = false
// }
// }).catch(() => {
// proxy.$modal.closeLoading()
// loading.value = false
// })
// })
// }
// }
// 点击接单
async function orderClick() {
const dataOne = {
// number: data.value.number,
status: 4,
id: data.value.id,
// result: '',
// repairNumber: data.value.repairNumber,
// content: data.value.applyContent ? data.value.applyContent : ''
}
proxy.$modal.confirm('是否接单').then(async () => {
proxy.$modal.loading('加载中')
loading.value = true
await repairOrderApi.orderClick(dataOne, type.value).then(async (res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
await getDeviceRepairDetail(number.value)
await getDeviceRepairDetailsByNumber()
loading.value = false
} else {
proxy.$modal.showToast(res.msg)
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
// 获取维修报修信息
async function getDeviceRepairDetailsByNumber() {
if (data.value.repairNumber) {
try {
const res = await repairOrderApi.getDeviceRepairDetailsByNumber({
number: data.value.repairNumber
}, type.value);
const response = await userApi.getAllUserSimpleInfo();
if (res.data) {
// 匹配 response.data 的 id 和 res.data 的 repairer 字段
const matchedUser = response.data.find(element => element.id == res.data.repairer);
if (matchedUser) {
res.data.repairerName = matchedUser.nickname;
}
data1.value = res.data;
}
} catch (error) {
console.error('Error fetching data:', error);
}
}
}
// 获取维修内容列表
function getRepairOrderDetaiList() {
repairOrderApi.repairOrderDetailList({
number: number.value,
}, type.value).then((res) => {
if (res?.data) {
serviceList.value = res.data
}
}).catch(() => { })
}
// 删除维修内容
function delService(item) {
proxy.$modal.confirm('确定删除维修内容吗?').then(() => {
proxy.$modal.loading('加载中')
repairOrderApi.repairOrderDetailDelete(item.id).then((res) => {
proxy.$modal.closeLoading()
getRepairOrderDetaiList()
}).catch(() => { })
})
}
function transfer() {
proxy.$tab.navigateTo(`/pages/eam/repairOrder/transfer?type=${data.value.type}&id=${data.value.id}&equipmentCode=${data.value.equipmentCode}`)
}
function previewImage(current, array) {
uni.previewImage({
urls: array,
current: current,
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function (data) {
},
fail: function (err) {
}
}
});
}
// 单列模式
function openSingleColumn(fieldName, val, list) {
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
singleColumnShow.value = true
}
// 单列模式点击确定之后
function chooseSingleColumn(e) {
data.value[field.value] = e[0].value
if (field.value == 'classes') {
data.value.classesName = e[0].label
}
if (field.value == 'faultType') {
data.value.faultTypeName = e[0].label
}
singleColumnShow.value = false
}
// 修改工单
function editForm() {
const paramesData = {
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
}
proxy.$modal.confirm('是否修改维修工单').then(() => {
proxy.$modal.loading('加载中')
loading1.value = true
repairOrderApi.repairOrderUpdate(paramesData, type.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('修改成功')
// setTimeout(() => {
// this.$tab.navigateBack()
loading1.value = false
// }, 1500)
} else {
proxy.$modal.showToast('修改失败')
loading1.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
async function getDeviceRepairDetail(number) {
const paramDetail = {
number: number,
type: type.value
}
try{
let res = await repairOrderApi.getDeviceRepairDetail(paramDetail, type.value)
const resp = await deviceApi.deviceNoPage();
const response = await basicFaultTypeApi.getBasicFaultTypeNoPage();
proxy.$modal.closeLoading()
data.value = res.data.list[0]
debugger
const findDevice = resp.data.find(item=>{
return item.code == data.value.equipmentCode
})
const findFaultType = response.data.find(item=>{
return item.code == data.value.faultType
})
if(findDevice){
data.value.equipmentName = findDevice.name
}
if(findFaultType){
data.value.faultTypeName = findFaultType.name
}
if (data.value.repairNumber) {
list.value = [{
name: '设备信息',
value: 1
}, {
name: '报修信息',
value: 2
}, {
name: '维修内容',
value: 3
}]
} else {
list.value = [{
name: '设备信息',
value: 1
}, {
name: '维修内容',
value: 3
}]
}
loading.value = false
} catch (error) {
proxy.$modal.closeLoading();
console.error('Error fetching data:', error);
}
}
// 获取维修工单详情
onLoad(async (option) => {
if (option.type) type.value = option.type;
if (option.number) {
number.value = option.number
await getDeviceRepairDetail(number.value)
await getDeviceRepairDetailsByNumber()
}
changeItem.value = list.value[current.value]
orderCompleteResult.value = await dictApi.getDict('order_complete_result')
})
onShow(async () => {
getRepairOrderDetaiList()
maintenanceShift.value = await dictApi.getDict('maintenance_shift')
faultType.value = await basicFaultTypeApi.getBasicFaultTypeNoPage();
})
</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: 160rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
}
.dec2 {
padding: 10rpx 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 160rpx;
}
&: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;
}
::v-deep .u-radio-group {
display: grid !important;
padding-bottom: 20rpx;
}
.images {
display: flex;
width: 100%;
image {
width: 30%;
margin-right: 20rpx;
height: 200rpx;
border-radius: 10rpx;
}
}
.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);
}
}
</style>