ソースを参照

维保工单添加风机编号选择,再选择MIS工单

HD_wangm 5 ヶ月 前
コミット
5527b2de94
1 ファイル変更75 行追加34 行削除
  1. 75 34
      ygtx-ui/src/views/gxt/gxtOrder/index.vue

+ 75 - 34
ygtx-ui/src/views/gxt/gxtOrder/index.vue

@@ -287,15 +287,28 @@
                 <el-input v-model="form.workOrderProjectNo" maxlength="50" show-word-limit v-chinese-limit readonly/>
               </el-form-item>
             </el-col>
+            <el-col :span="12">
+              <el-form-item label="风机编号" prop="pcsDeviceName">
+                <el-input v-model="form.pcsDeviceName" readonly>
+                  <template #append>
+                    <el-button @click="handleSelectEquipment" icon="Search"></el-button>
+                  </template>
+                </el-input>
+              </el-form-item>
+            </el-col>
+            <!-- MIS选择组件 -->
+            <MisInfoSelectSingle :key="commonKey" v-model="misInfoSelectVisible" @onSelected="onMisInfoSelected" :pcsDeviceName="form.pcsDeviceName"></MisInfoSelectSingle>
+          </el-row>
+          <el-row :gutter="20">
             <el-col :span="12">
               <el-form-item label="MIS工单编码" prop="misNo">
                 <el-input v-model="form.misNo"
-                  placeholder="请输入MIS工单编码或点击搜索选择"
-                  clearable
-                  @focus="handleMisNoInputFocus"
-                  @blur="handleMisNoInputBlur"
-                  @input="handleMisNoInput"
-                  @clear="handleMisNoClear"
+                          placeholder="请输入MIS工单编码或点击搜索选择"
+                          clearable
+                          @focus="handleMisNoInputFocus"
+                          @blur="handleMisNoInputBlur"
+                          @input="handleMisNoInput"
+                          @clear="handleMisNoClear"
                 >
                   <template #append>
                     <el-button @click="handleSelectMisInfo" icon="Search"></el-button>
@@ -309,10 +322,10 @@
                       class="quick-select-item"
                       @click="handleMisNoQuickSelect(item)">
                     <span class="mis-no">{{ item.misNo }}</span>
-<!--                    <span class="mis-info">-->
-<!--                    <span class="device">{{ item.pcsDeviceName }}</span>-->
-<!--                    <span class="station">{{ item.pcsStationName }}</span>-->
-<!--                    </span>-->
+                    <!--                    <span class="mis-info">-->
+                    <!--                    <span class="device">{{ item.pcsDeviceName }}</span>-->
+                    <!--                    <span class="station">{{ item.pcsStationName }}</span>-->
+                    <!--                    </span>-->
                   </div>
                 </div>
                 <div class="quick-select-dropdown no-data" v-show="showMisNoQuickSelect && quickMisNoList.length === 0 && form.misNo">
@@ -320,15 +333,6 @@
                 </div>
               </el-form-item>
             </el-col>
-            <!-- MIS选择组件 -->
-            <MisInfoSelectSingle :key="commonKey" v-model="misInfoSelectVisible" @onSelected="onMisInfoSelected"></MisInfoSelectSingle>
-          </el-row>
-          <el-row :gutter="20">
-            <el-col :span="12">
-              <el-form-item label="风机编号" prop="pcsDeviceName">
-                <el-input v-model="form.pcsDeviceName" readonly />
-              </el-form-item>
-            </el-col>
             <el-col :span="12">
               <el-form-item label="维保中心" prop="gxtCenter">
                 <el-input v-model="form.gxtCenter" readonly />
@@ -1423,6 +1427,8 @@
         </div>
       </template>
     </el-dialog>
+    <!-- 设备选择组件 -->
+    <equipment-select-single v-model="equipmentSelectVisible" @onSelected="onEquipmentSelected"></equipment-select-single>
   </div>
 </template>
 
@@ -1461,6 +1467,7 @@ import MisInfoSelectSingle from "@/components/misInfoSelect/single.vue";
 import {genCode} from "@/api/system/autocode/rule.js";
 import {listMisInfo, listWorkPerson} from "@/api/gxt/misInfo.js";
 import {ElMessageBox} from "element-plus";
+import EquipmentSelectSingle from "@/components/equipmentSelect/single.vue";
 
 // 工作负责人快速检索相关响应式数据
 const showTeamLeaderQuickSelect = ref(false)
@@ -1649,8 +1656,8 @@ const searchMisNoList = async (keyword) => {
       pageNum: 1,
       // pageSize: 10, // 只显示前10条结果
       misNo: keyword,
-      pcsDeviceName: keyword,
-      pcsStationName: keyword
+      pcsDeviceName: form.value.pcsDeviceName,
+      // pcsStationName: keyword
       // 注意:这里假设后端API支持这些字段的模糊查询
       // 如果后端不支持多字段同时查询,可能需要调整
     })
@@ -1734,6 +1741,7 @@ const flowDialogVisible = ref(false)
 const detailDialogVisible = ref(false)
 const acceptDialogVisible = ref(false)
 const restartDialogVisible = ref(false)
+const equipmentSelectVisible = ref(false)
 const userList = ref([])
 const flowList = ref([])
 const detailData = ref({})
@@ -1778,7 +1786,9 @@ const personUpload = reactive({
 })
 
 const data = reactive({
-  form: {},
+  form: {
+    // pcsDeviceName: undefined,
+  },
   queryParams: {
     pageNum: 1,
     pageSize: 10,
@@ -2642,7 +2652,6 @@ function handleSelectMisInfo() {
 
 /** 设备MIS信息回调 */
 function onMisInfoSelected(row) {
-  debugger
   if (row) {
     listGxtOrder({pageNum: 1, pageSize: 10, misNo: row.misNo }).then(response => {
       const  gxtOrders= response.rows
@@ -2651,22 +2660,24 @@ function onMisInfoSelected(row) {
         return
       }
       form.value.misNo = row.misNo
-      form.value.pcsDeviceName = row.pcsDeviceName
-      form.value.pcsStationName = row.pcsStationName
       form.value.content = row.content
       form.value.realStartTime = row.realStartTime
       form.value.realEndTime = row.realEndTime
       form.value.planStartTime = row.planStartTime
       form.value.planEndTime = row.planEndTime
-      listEquipment({ station: row.pcsStationName, equipmentCode: row.pcsDeviceName }).then(response => {
-        const equipments = response.rows
-        if (equipments) {
-          form.value.pcsDeviceId = equipments[0].equipmentId
-          form.value.gxtCenter = equipments[0].maintenanceCenter
-          form.value.brand = equipments[0].brand
-          form.value.model = equipments[0].model
-        }
-      });
+      if (!form.value.pcsDeviceId) {
+        form.value.pcsDeviceName = row.pcsDeviceName
+        form.value.pcsStationName = row.pcsStationName
+        listEquipment({station: row.pcsStationName, equipmentCode: row.pcsDeviceName}).then(response => {
+          const equipments = response.rows
+          if (equipments) {
+            form.value.pcsDeviceId = equipments[0].equipmentId
+            form.value.gxtCenter = equipments[0].maintenanceCenter
+            form.value.brand = equipments[0].brand
+            form.value.model = equipments[0].model
+          }
+        });
+      }
       misInfoSelectVisible.value = false
     })
   }
@@ -2679,6 +2690,36 @@ function handleAutoGenChange(){
     });
 }
 
+/** 打开设备选择对话框 */
+function handleSelectEquipment() {
+  equipmentSelectVisible.value = true
+}
+
+/** 设备选择回调 */
+function onEquipmentSelected(row) {
+  if (row) {
+    // 检查维保中心ID和场站ID是否存在
+    if (!row.maintenanceCenterId) {
+      proxy.$modal.msgError("该设备的维保中心没有对应的部门,请完善部门信息后再更新设备数据!");
+      return;
+    }
+    if (!row.stationId) {
+      proxy.$modal.msgError("该设备的场站没有对应的部门,请完善部门信息后再更新设备数据!");
+      return;
+    }
+    form.value.pcsDeviceId = row.equipmentId
+    form.value.pcsDeviceName = row.equipmentCode
+    form.value.gxtCenterId = row.maintenanceCenterId
+    form.value.gxtCenter = row.maintenanceCenter
+    form.value.pcsStationId = row.stationId
+    form.value.pcsStationName = row.station
+    form.value.brand = row.brand
+    form.value.model = row.model
+  }
+  equipmentSelectVisible.value = false
+  commonKey++
+}
+
 getList()
 </script>
 <style scoped>