Procházet zdrojové kódy

feat(工单): 添加批量设置状态功能并优化状态显示为"正常/异常

yusheng před 5 měsíci
rodič
revize
447e36f0ab

+ 84 - 8
src/views/maintenance/components/signingUpWork.vue

@@ -31,10 +31,13 @@
         <!-- 巡点检、保养设备 -->
         <div class="maintain_equipment_info">
           <HeaderTitle title="运行设备" size="16px"></HeaderTitle>
+          <div style="text-align: right; margin-bottom: 15px">
+            <el-button type="primary" @click="allSet">批量设置</el-button></div
+          >
           <div class="maintain_equipment_info_content">
             <div
               class="equipment_item"
-              v-for="item in infoData.planDeviceList"
+              v-for="(item, index) in infoData.planDeviceList"
               :key="item.id"
             >
               <div class="equipment_info" v-if="item.substance">
@@ -69,7 +72,14 @@
               </div>
               <p>操作事项</p>
               <div class="ruleMatters_box">
-                <el-table :data="item.workItems" border>
+                <el-table
+                  row-key="id"
+                  :data="item.workItems"
+                  border
+                  :ref="'table' + index"
+                >
+                  <el-table-column type="selection" width="55" align="center">
+                  </el-table-column>
                   <el-table-column label="序号" width="50">
                     <template slot-scope="scope">
                       <span>{{ scope.$index + 1 }}</span>
@@ -129,6 +139,7 @@
                         <el-select
                           v-model="scope.row.status"
                           placeholder="请选择"
+                          @change="handleStatusChange(scope.row)"
                         >
                           <el-option
                             v-for="item in options"
@@ -160,6 +171,26 @@
       <el-button @click="cancel">返回</el-button>
       <el-button type="primary" @click="submit">提交</el-button>
     </div>
+    <el-dialog
+      :visible.sync="allVisible"
+      title="批量设置"
+      width="500px"
+      append-to-body
+    >
+      <el-select v-model="allData.status" placeholder="请选择">
+        <el-option
+          v-for="item in options"
+          :label="item.label"
+          :value="item.value"
+          :key="item.value"
+        >
+        </el-option>
+      </el-select>
+      <div slot="footer" class="footer">
+        <el-button @click="allVisible = false">取消</el-button>
+        <el-button type="primary" @click="allSave">确认</el-button>
+      </div>
+    </el-dialog>
   </el-dialog>
 </template>
 
@@ -174,18 +205,16 @@
     data() {
       return {
         fullscreen: false,
+        allVisible: false,
         time: [],
+        allData: { status: '' },
         options: [
-          {
-            label: '未定义',
-            value: 0
-          },
           {
             label: '正常',
             value: 1
           },
           {
-            label: '缺陷',
+            label: '异常',
             value: -1
           }
         ],
@@ -194,6 +223,47 @@
       };
     },
     methods: {
+      allSet() {
+        this.multipleSelection = [];
+        this.infoData.planDeviceList.forEach((item, index) => {
+          this.multipleSelection = [
+            ...this.multipleSelection,
+            ...this.$refs['table' + index][0].selection
+          ];
+        });
+        if (!this.multipleSelection.length) {
+          this.$message.error('请选择至少一条记录');
+
+          return;
+        }
+        this.allVisible = true;
+      },
+      allSave() {
+        this.allVisible = false;
+        this.multipleSelection.forEach((item, index) => {
+          this.$set(
+            this.multipleSelection[index],
+            'status',
+            this.allData.status
+          );
+          this.$set(
+            this.multipleSelection[index],
+            'result',
+            this.allData.status == '-1'
+              ? '异常'
+              : this.allData.status == '1'
+              ? '正常'
+              : ''
+          );
+        });
+        this.infoData.planDeviceList.forEach((item, index) => {
+          this.$refs['table' + index][0].clearSelection();
+        });
+      },
+      handleStatusChange(row) {
+        row.result =
+          row.status == '-1' ? '异常' : row.status == '1' ? '正常' : '';
+      },
       open(row) {
         console.log(row);
         this.getInfo(row);
@@ -230,7 +300,13 @@
       // 表格数据
       async getInfo(row) {
         let res = await getById(row.planId);
-        console.log(row);
+        res.data.planDeviceList.forEach((item, index) => {
+          item.workItems.forEach((item1, index1) => {
+            item1.status = 1;
+            item1.result = '正常';
+            item1.normal = '正常';
+          });
+        });
         this.infoData = res.data;
         this.infoData.workOrderId = row.id;
       }

+ 27 - 18
src/views/maintenance/patrol/workOrder/details.vue

@@ -37,23 +37,23 @@
                 <el-form-item label="指定执行人">
                   <span v-if="infoData.executeUsers">
                     <span v-if="executeUserType == 1">
-                    {{
-                      infoData.executeUsers
-                        .map((i) => {
-                          return `${i.teamName}`;
-                        })
-                        .join(',')
-                    }}
-                  </span>
-                  <span v-else>
-                    {{
-                      infoData.executeUsers
-                        .map((i) => {
-                          return `${i.groupName}-${i.userName}`;
-                        })
-                        .join(',')
-                    }}
-                  </span>
+                      {{
+                        infoData.executeUsers
+                          .map((i) => {
+                            return `${i.teamName}`;
+                          })
+                          .join(',')
+                      }}
+                    </span>
+                    <span v-else>
+                      {{
+                        infoData.executeUsers
+                          .map((i) => {
+                            return `${i.groupName}-${i.userName}`;
+                          })
+                          .join(',')
+                      }}
+                    </span>
                   </span>
                 </el-form-item>
               </el-col>
@@ -200,6 +200,15 @@
                     item.substance.positionNames
                   }}</span>
                 </div>
+                <div class="item_info">
+                  <span class="item_label">设备编号</span>
+                  <span class="item_value">{{
+                    item.substance.codeNumber
+                  }}</span>
+                </div>
+                <div class="item_info" style="display: none;">
+               
+                </div>
               </div>
               <p>操作事项</p>
               <div class="ruleMatters_box">
@@ -408,7 +417,7 @@
         options: {
           0: '未定义',
           1: '正常',
-          '-1': '缺陷'
+          '-1': '异常'
         },
         num: 1,
         infoData: {},

+ 5 - 2
src/views/maintenance/patrol/workOrder/index.vue

@@ -20,7 +20,7 @@
           <jimureportBrowse
             :businessId="row.id"
             businessCode="eampatrolinspectionprint"
-            v-if="row.orderStatus==3"
+            v-if="row.orderStatus == 3"
           ></jimureportBrowse>
           <el-link
             v-if="row.orderStatus !== 3 && row.orderStatus !== 4"
@@ -42,7 +42,7 @@
           </el-link>
           <el-link
             v-if="
-              row.orderStatus !== 3 && row.orderStatus !== 4 && row.isGroup != 1
+              row.orderStatus !== 3 && row.orderStatus !== 4 
             "
             type="primary"
             :underline="false"
@@ -140,6 +140,9 @@
             align: 'center',
             showOverflowTooltip: true,
             formatter: (row) => {
+              if (row.executeUserName) {
+                return row.executeUserName;
+              }
               if (row.executeUserType == 0) {
                 return row.executeUsers.map((i) => i.userName).join(',');
               }

+ 1 - 1
src/views/maintenance/runRecord/workOrder/index.vue

@@ -198,7 +198,7 @@
             align: 'center',
             showOverflowTooltip: true,
             formatter(row) {
-              return { 0: '缺陷', 1: '正常' }[row.isAbnormal];
+              return { 0: '异常', 1: '正常' }[row.isAbnormal];
             }
           },
           {

+ 0 - 1
src/views/sparePartsApply/components/AssetsDialog.vue

@@ -37,7 +37,6 @@
                 v-model="dimension"
                 placeholder="请选择"
               >
-                <el-option label="物料维度" value="4"> </el-option>
                 <el-option label="包装维度" value="3"> </el-option>
                 <el-option label="批次维度" value="2"> </el-option>
                 <el-option label="物品维度" value="1"> </el-option>