From e1034e8661e811215809a2a375767d50ccd32541 Mon Sep 17 00:00:00 2001
From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com>
Date: 星期二, 14 十月 2025 08:51:38 +0800
Subject: [PATCH] 修改新增

---
 src/views/work/qualityInfo/infrastructureMng/reviewRecordStatistics/components/editDialog.vue |   72 ++++++++++++++++++++++++++---------
 1 files changed, 53 insertions(+), 19 deletions(-)

diff --git a/src/views/work/qualityInfo/infrastructureMng/reviewRecordStatistics/components/editDialog.vue b/src/views/work/qualityInfo/infrastructureMng/reviewRecordStatistics/components/editDialog.vue
index 9c9a18e..38272ea 100644
--- a/src/views/work/qualityInfo/infrastructureMng/reviewRecordStatistics/components/editDialog.vue
+++ b/src/views/work/qualityInfo/infrastructureMng/reviewRecordStatistics/components/editDialog.vue
@@ -61,6 +61,28 @@
         <el-table :data="state.form.annualMaintenanceEvaluateDeviceList" class="customedTable" :border="true">
           <el-table-column label="序号" type="index" width="80" align="center">
           </el-table-column>
+          <el-table-column label="设备名称" prop="deviceName" align="center">
+            <template #default="scope">
+<!--              <el-input-->
+<!--                  v-model.trim="scope.row.deviceName"-->
+<!--                  size="large"-->
+<!--                  type="textarea"-->
+<!--                  style="width: 100%;"-->
+<!--                  clearable-->
+<!--                  :readonly="state.title =='查看'"-->
+<!--              >-->
+<!--              </el-input>-->
+
+              <el-select clearable v-model="scope.row.deviceName" :disabled="state.title =='查看'" filterable placeholder="设备名称" style="width: 100%" @change="getDeviceInfo(scope.row.deviceName,scope.$index)">
+                <el-option
+                    v-for="item in state.deviceList"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.name"
+                />
+              </el-select>
+            </template>
+          </el-table-column>
           <el-table-column label="设备编号" prop="deviceNumber" align="center">
             <template #default="scope">
               <el-input
@@ -69,20 +91,7 @@
                   type="textarea"
                   style="width: 100%;"
                   clearable
-                  :readonly="state.title =='查看'"
-              >
-              </el-input>
-            </template>
-          </el-table-column>
-          <el-table-column label="设备名称" prop="deviceName" align="center">
-            <template #default="scope">
-              <el-input
-                  v-model.trim="scope.row.deviceName"
-                  size="large"
-                  type="textarea"
-                  style="width: 100%;"
-                  clearable
-                  :readonly="state.title =='查看'"
+                  readonly
               >
               </el-input>
             </template>
@@ -95,7 +104,7 @@
                   type="textarea"
                   style="width: 100%;"
                   clearable
-                  :readonly="state.title =='查看'"
+                  readonly
               >
               </el-input>
             </template>
@@ -121,7 +130,7 @@
                   type="textarea"
                   style="width: 100%;"
                   clearable
-                  :readonly="state.title =='查看'"
+                  readonly
               >
               </el-input>
             </template>
@@ -134,7 +143,7 @@
                   type="textarea"
                   style="width: 100%;"
                   clearable
-                  :readonly="state.title =='查看'"
+                  readonly
               >
               </el-input>
             </template>
@@ -200,7 +209,7 @@
 import {getToken} from "@/utils/auth";
 import {
   updateMaintenanceEvaluate,
-  getMaintenanceEvaluateDetail
+  getMaintenanceEvaluateDetail, getStandingBookList
 } from "@/api/infrastructureMng/ledger";
 
 import {listUser} from "@/api/system/user";
@@ -246,7 +255,8 @@
   },
   isAdmin: false,
   companyList: [],
-  userList: []
+  userList: [],
+  deviceList: []
 })
 onMounted(() => {
 
@@ -258,6 +268,7 @@
     state.companyList = companyList
   }
   await getUserList(companyId)
+  await getDeviceList(companyId)
   state.title = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看'
   state.form.companyId = companyId
   if(state.title == '编辑'||state.title == '查看'){
@@ -285,6 +296,29 @@
   state.form.annualMaintenanceEvaluateDeviceList = state.form.annualMaintenanceEvaluateDeviceList.filter((item,index) => index != i)
 }
 
+const getDeviceList = async (companyId) => {
+  const res = await getStandingBookList({pageNum: 1, pageSize: 999, companyId: companyId})
+  if(res.code == 200){
+    state.deviceList = res.data.list || []
+  }else{
+    ElMessage.warning(res.message)
+  }
+}
+
+const getDeviceInfo = (name,index)=>{
+  const foundNode = state.deviceList.find(i=>i.name == name)
+  state.form.annualMaintenanceEvaluateDeviceList[index] = {
+    ...state.form.annualMaintenanceEvaluateDeviceList[index],
+    deviceNumber: foundNode.number,
+    deviceName: foundNode.name,
+    model: foundNode.model,
+    location: foundNode.location,
+    useUser: foundNode.personResponsibleName,
+    deptName: foundNode.deptName,
+    resultType: foundNode.status
+  }
+}
+
 const onSubmit = async () => {
   const valid = await superRef.value.validate();
   if(valid){

--
Gitblit v1.9.2