Commit b5069032 authored by sxl's avatar sxl 💬

fix: 修复bug

parent 4178a60e
{
"mcpServers": {}
}
\ No newline at end of file
...@@ -23,7 +23,11 @@ ...@@ -23,7 +23,11 @@
<el-table-column label="设备名称" align="center" prop="deviceName" /> <el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备编码" align="center" prop="deviceNo" /> <el-table-column label="设备编码" align="center" prop="deviceNo" />
<el-table-column label="巡检人" align="center" prop="inspectionUserName" /> <el-table-column label="巡检人" align="center" prop="inspectionUserName" />
<el-table-column label="设备故障描述" align="center" prop="deviceErroDetail" /> <el-table-column label="设备故障描述" align="center" prop="deviceErrorDetail">
<template slot-scope="scope">
<span>{{ scope.row.deviceErrorDetail || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="维修单日期" align="center" prop="repairsDate" width="180"> <el-table-column label="维修单日期" align="center" prop="repairsDate" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.repairsDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.repairsDate, '{y}-{m}-{d}') }}</span>
...@@ -58,8 +62,8 @@ ...@@ -58,8 +62,8 @@
<el-form-item label="巡检人id" prop="inspectionUserId"> <el-form-item label="巡检人id" prop="inspectionUserId">
<el-input v-model="form.inspectionUserId" placeholder="请输入巡检人id" /> <el-input v-model="form.inspectionUserId" placeholder="请输入巡检人id" />
</el-form-item> </el-form-item>
<el-form-item label="设备故障描述" prop="deviceErroDetail"> <el-form-item label="设备故障描述" prop="deviceErrorDetail">
<el-input v-model="form.deviceErroDetail" placeholder="请输入设备故障描述" /> <el-input v-model="form.deviceErrorDetail" placeholder="请输入设备故障描述" />
</el-form-item> </el-form-item>
<el-form-item label="维修单日期" prop="repairsDate"> <el-form-item label="维修单日期" prop="repairsDate">
<el-date-picker clearable v-model="form.repairsDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择维修单日期"> </el-date-picker> <el-date-picker clearable v-model="form.repairsDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择维修单日期"> </el-date-picker>
...@@ -120,7 +124,7 @@ export default { ...@@ -120,7 +124,7 @@ export default {
deviceNo: null, deviceNo: null,
deviceName: null, deviceName: null,
inspectionUserId: null, inspectionUserId: null,
deviceErroDetail: null, deviceErrorDetail: null,
repairsDate: null, repairsDate: null,
maintainUserId: null, maintainUserId: null,
maintainDetail: null, maintainDetail: null,
...@@ -172,7 +176,7 @@ export default { ...@@ -172,7 +176,7 @@ export default {
deviceNo: null, deviceNo: null,
deviceName: null, deviceName: null,
inspectionUserId: null, inspectionUserId: null,
deviceErroDetail: null, deviceErrorDetail: null,
repairsDate: null, repairsDate: null,
maintainUserId: null, maintainUserId: null,
maintainDetail: null, maintainDetail: null,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<el-option v-for="item in deviceTypeList" :key="item.id" :label="item.typeName" :value="item.id"> </el-option> <el-option v-for="item in deviceTypeList" :key="item.id" :label="item.typeName" :value="item.id"> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="" prop="deviceName"> <el-form-item label="设备名称" prop="deviceName">
<el-input v-model="queryParams.deviceName" placeholder="请输入设备名称" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.deviceName" placeholder="请输入设备名称" clearable @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -241,11 +241,38 @@ export default { ...@@ -241,11 +241,38 @@ export default {
}, },
// 设备名称 // 设备名称
getDeviceName(val) { getDeviceName(val) {
// 清空部门
this.deptOptions = []
const typeDeptIds = this.deviceTypeList.find((item) => item.id === val).typeDeptIds
// 如果有关联的部门ID,则进行查询
if (typeDeptIds && typeDeptIds.length > 0) {
// 创建所有 listDept 请求的 Promise 数组
const deptPromises = typeDeptIds.map((deptId) =>
listDept({ deptId: deptId })
.then((response) => {
// 处理并返回数据
return this.handleTree(response.data, 'deptId')
})
.catch((error) => {
return [] // 返回空数组,避免 Promise.all 失败
})
)
//等待所有请求完成
Promise.all(deptPromises)
.then((deptData) => {
this.deptOptions = deptData.flat()
})
.catch((error) => {
console.error('获取部门数据失败:', error)
})
}
listDeviceName({ deviceType: val }).then((response) => { listDeviceName({ deviceType: val }).then((response) => {
this.deviceNameList = response.rows this.deviceNameList = response.rows
}) })
this.form.deviceName = null this.form.deviceName = null
this.form.deviceNo = null this.form.deviceNo = null
this.form.maintainDeptId = null
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
...@@ -298,9 +325,9 @@ export default { ...@@ -298,9 +325,9 @@ export default {
this.reset() this.reset()
this.open = true this.open = true
this.title = '添加工单派遣' this.title = '添加工单派遣'
listDept().then((response) => { // listDept().then((response) => {
this.deptOptions = this.handleTree(response.data, 'deptId') // this.deptOptions = this.handleTree(response.data, 'deptId')
}) // })
}, },
/** 派单 */ /** 派单 */
handleUpdate(row) { handleUpdate(row) {
...@@ -317,9 +344,9 @@ export default { ...@@ -317,9 +344,9 @@ export default {
// 查看 // 查看
handleView(row) { handleView(row) {
const id = row.id || this.ids const id = row.id || this.ids
listDept().then((response) => { // listDept().then((response) => {
this.deptOptions = this.handleTree(response.data, 'deptId') // this.deptOptions = this.handleTree(response.data, 'deptId')
}) // })
getWorkOrder(id).then((response) => { getWorkOrder(id).then((response) => {
this.form = response.data this.form = response.data
this.open = true this.open = true
...@@ -340,6 +367,7 @@ export default { ...@@ -340,6 +367,7 @@ export default {
}, },
deptSelect(val) { deptSelect(val) {
this.queryParamsUser.deptId = val.deptId this.queryParamsUser.deptId = val.deptId
this.form.maintainUserId = null
this.getUserList() this.getUserList()
}, },
/** 查询用户列表 */ /** 查询用户列表 */
...@@ -349,6 +377,7 @@ export default { ...@@ -349,6 +377,7 @@ export default {
}) })
}, },
getDeviceNo(val) { getDeviceNo(val) {
this.form._deviceName = val
this.form.deviceName = val.deviceName this.form.deviceName = val.deviceName
this.form.deviceNo = val.deviceNo this.form.deviceNo = val.deviceNo
this.form.deviceId = val.deviceId this.form.deviceId = val.deviceId
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment