Переглянути джерело

feat(repair): 报修人改为下拉选择并移除停机自动联动

- 报修人字段由手动输入改为带搜索的下拉选择,提交userId避免同名歧义
- 工单类别选择不再自动联动"是否停机"字段,需由用户显式选择
- 问题设备大屏增加停机未恢复设备的展示与悬停提示
- ImpBaseForm中报修人下拉从注释状态启用并增加username显示
dazhaxie 1 день тому
батько
коміт
b171a9a72f

+ 8 - 5
public/hitch-screen/index.html

@@ -26,13 +26,13 @@
   <div style="display:flex;width:1920px;justify-content:space-between;align-items:center;">
     <div id="echart" class="echart"></div>
     <div class="data">
-      <!-- 右上:当前问题设备(有进行中报修单的设备) -->
+      <!-- 右上:当前问题设备(有进行中报修单或停机未恢复的设备) -->
       <div class="panel panel-problem">
         <div class="panel-name">当前问题设备</div>
         <div class="item title">
           <span>设备编号</span>
           <span>设备名称</span>
-          <span>维修状态</span>
+          <span>状态</span>
         </div>
         <div id="problemList" class="scrollDiv str_vertical"></div>
       </div>
@@ -470,7 +470,7 @@
     });
   }
 
-  // 当前问题设备:有进行中报修单(待接收/维修中/转派审批中/委外维修中)的设备
+  // 当前问题设备:有进行中报修单的设备 + 停机且无进行中报修单的设备
   function getScreenProblemData() {
     $.ajax({
       type: "get",
@@ -479,8 +479,11 @@
       success: function (response) {
         let problemHtml = '';
         (response.data || []).forEach(item => {
-          problemHtml += buildRow(item.no, item.name, item.repairStatusLabel,
-            '报修单:' + (item.repairNo || '') + ';报修时间:' + formatTime(item.applyTime));
+          // problemType:1-有进行中报修单,2-停机(维修造成的停机已经按报修单展示,不会再单独出现)
+          let tip = item.problemType == 2
+            ? '设备状态:停机中,等待恢复运行'
+            : '报修单:' + (item.repairNo || '') + ';报修时间:' + formatTime(item.applyTime);
+          problemHtml += buildRow(item.no, item.name, item.repairStatusLabel, tip);
         })
         renderMarquee('problemList', problemHtml);
       },

+ 10 - 3
src/views/hitch-screen/index.vue

@@ -61,13 +61,13 @@
             <div class="item title">
               <span>设备编号</span>
               <span>设备名称</span>
-              <span>维修状态</span>
+              <span>状态</span>
             </div>
             <div class="scroll-wrap" ref="problemWrap">
               <div class="scroll-inner" :class="{ scrolling: needScrollProblem }"
                 :style="{ animationDuration: problemDuration }">
                 <div v-for="(item, index) in doubledProblemList" :key="'problem-' + index" class="item"
-                  :title="'报修单:' + (item.repairNo || '') + ';报修时间:' + formatTime(item.applyTime)">
+                  :title="problemTip(item)">
                   <span>{{ item.no }}</span>
                   <span class="ellipsis">{{ item.name }}</span>
                   <span>{{ item.repairStatusLabel }}</span>
@@ -130,7 +130,7 @@ export default {
       showStopped: true,
       screenData: null,
       jobData: {},
-      // 右上:当前问题设备(有进行中报修单的设备)
+      // 右上:当前问题设备(有进行中报修单或停机未恢复的设备)
       problemList: [],
       tooltip: { visible: false, left: '0%', top: '0%', info: {} },
       needScrollProblem: false,
@@ -254,6 +254,13 @@ export default {
       if (!time) return ''
       return String(time).replace('T', ' ').substring(0, 16)
     },
+    // 问题设备悬停提示:problemType 1-有进行中报修单,2-停机(维修造成的停机已经按报修单展示)
+    problemTip(item) {
+      if (item.problemType === 2) {
+        return '设备状态:停机中,等待恢复运行'
+      }
+      return '报修单:' + (item.repairNo || '') + ';报修时间:' + this.formatTime(item.applyTime)
+    },
     // 内容不足时不滚动,超出容器高度时开启无缝滚动
     checkScroll(wrapRef, flagName) {
       const wrap = this.$refs[wrapRef]

+ 17 - 14
src/views/repair/application-form/modules/BaseForm.vue

@@ -82,8 +82,17 @@
         </row-item>-->
         <row-item>
           <a-form-item label="报修人" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-            <a-input
-              v-decorator="['actualUser', { initialValue: userInfo.realName, rules: [{ required: true, message: '报修人不能为空' }] }]" />
+            <!-- 报修人账号下拉带搜索,提交 userId,避免手输同名歧义 -->
+            <a-select
+              showSearch
+              :filterOption="(input, option) => option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0"
+              v-decorator="['userId', { initialValue: userInfo.userId, rules: [{ required: true, message: '报修人不能为空' }] }]"
+              placeholder="请选择报修人"
+            >
+              <a-select-option v-for="user in userList" :key="user.userId" :value="user.userId" :label="user.realName">
+                {{ user.realName }}<template v-if="user.username">({{ user.username }})</template>
+              </a-select-option>
+            </a-select>
           </a-form-item>
         </row-item>
         <row-item>
@@ -317,6 +326,8 @@ export default {
               'remark',
               'repairErrorTypeId',
               'notifyTeamLeaders',
+              'userId',
+              'actualUser',
               'deptId'
             ])
           )
@@ -363,6 +374,9 @@ export default {
         values.checkFileList = this.checkFileList
         // 通知班长:多选数组转逗号分隔字符串
         values.notifyTeamLeaders = (values.notifyTeamLeaders || []).join(',')
+        // 报修人:根据下拉选中的 userId 同步姓名,后端以 userId 为准
+        const chosenUser = this.userList.find((user) => user.userId === values.userId)
+        values.actualUser = chosenUser ? chosenUser.realName : this.userInfo.realName
         if (this.BaseTool.String.isBlank(values.id)) {
           // 重复报修检查:该设备存在未完结报修单时需先确认再提交(允许一台设备多个报修单)
           this.confirmDuplicateAdd(values)
@@ -421,19 +435,8 @@ export default {
         })
     },
     changePlanFlag(value) {
+      // 选择工单类别不再自动联动“是否停机”:停机与否必须由报修人在“是否停机”处显式选择
       this.category = value
-      const {
-        form: { setFieldsValue },
-      } = this
-      if (this.category === 1) {
-        this.$nextTick(() => {
-          setFieldsValue({ needStop: 1 })
-        })
-      } else {
-        this.$nextTick(() => {
-          setFieldsValue({ needStop: 0 })
-        })
-      }
     },
     handleCancel(values) {
       this.visible = false

+ 1 - 10
src/views/repair/application-form/modules/EditForm.vue

@@ -145,17 +145,8 @@ export default {
 
     },
     changePlanFlag (value) {
+      // 选择工单类别不再自动联动“是否停机”:停机与否必须由用户显式选择
       this.category = value
-      const { form: { setFieldsValue } } = this
-      if (this.category === 1) {
-        this.$nextTick(() => {
-          setFieldsValue({ needStop: 1 })
-        })
-      } else {
-        this.$nextTick(() => {
-          setFieldsValue({ needStop: 0 })
-        })
-      }
     },
     save () {
       const { form: { validateFieldsAndScroll } } = this

+ 1 - 11
src/views/repair/application-form/modules/FinishForm.vue

@@ -177,7 +177,6 @@ export default {
       this.$nextTick(() => {
         setFieldsValue(Object.assign(pick(record, [
           'id',
-          'needStop',
           'level',
           'category',
           'repairErrorTypeId',
@@ -191,17 +190,8 @@ export default {
       })
     },
     changePlanFlag(value) {
+      // 维修完成仅填写维修相关内容,不再处理“是否停机”:停机与否以报修时的选择为准
       this.category = value
-      const { form: { setFieldsValue } } = this
-      if (this.category === 1) {
-        this.$nextTick(() => {
-          setFieldsValue({ needStop: 1 })
-        })
-      } else {
-        this.$nextTick(() => {
-          setFieldsValue({ needStop: 0 })
-        })
-      }
     },
     handleRepairFileChange(info) {
       this.defaultRepairFileList = info.fileList

+ 15 - 5
src/views/repair/application-form/modules/ImpBaseForm.vue

@@ -72,22 +72,28 @@
             </a-select>
           </a-form-item>
         </row-item>
-        <!--<row-item>
+        <row-item>
           <a-form-item
             label="报修人"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
-            <a-select v-decorator="['repairUserId', {rules: [{required: true, message: '报修人不能为空'}]}]" placeholder="请选择">
+            <!-- 报修人账号下拉带搜索,提交 userId,避免手输同名歧义 -->
+            <a-select
+              showSearch
+              :filterOption="(input, option) => option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0"
+              v-decorator="['userId', { initialValue: userInfo.userId, rules: [{ required: true, message: '报修人不能为空' }] }]"
+              placeholder="请选择报修人"
+            >
               <a-select-option
                 v-for="item in userList"
                 :key="item.userId"
                 :label="item.realName"
-                :value="item.userId">{{ item.realName }}
+                :value="item.userId">{{ item.realName }}<template v-if="item.username">({{ item.username }})</template>
               </a-select-option>
             </a-select>
           </a-form-item>
-        </row-item>-->
+        </row-item>
         <row-item>
           <a-form-item
             label="报修单号"
@@ -197,6 +203,7 @@ export default {
       sourceMap: {},
       levelMap: {},
       needStopMap: {},
+      userInfo: this.$store.getters.userInfo,
       statusMap: {},
       userList: []
     }
@@ -242,7 +249,7 @@ export default {
           'id',
           'sbId',
           'partId',
-          'repairUserId',
+          'userId',
           'no',
           'source',
           'level',
@@ -269,6 +276,9 @@ export default {
         }
         // 日期处理
         values.applyTime = this.BaseTool.Date.formatter(values.applyTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+        // 报修人:根据下拉选中的 userId 同步姓名,后端以 userId 为准
+        const chosenUser = this.userList.find((user) => user.userId === values.userId)
+        values.actualUser = chosenUser ? chosenUser.realName : this.userInfo.realName
         if (this.BaseTool.String.isBlank(values.id)) {
           // 重复报修检查:该设备存在未完结报修单时需先确认再提交(允许一台设备多个报修单)
           this.confirmDuplicateAdd(values)