yusheng 3 هفته پیش
والد
کامیت
08ade84cc1
2فایلهای تغییر یافته به همراه62 افزوده شده و 21 حذف شده
  1. 24 1
      src/views/warning/warningMessage/index.vue
  2. 38 20
      src/views/warning/warningSetting/components/addWarningDialog.vue

+ 24 - 1
src/views/warning/warningMessage/index.vue

@@ -61,7 +61,13 @@
             showOverflowTooltip: true,
             minWidth: 110,
             formatter: (_row, _column, cellValue) => {
-              const map = { 1: '提示', 2: '一般', 3: '严重', 4: '紧急', 5: '致命' };
+              const map = {
+                1: '提示',
+                2: '一般',
+                3: '严重',
+                4: '紧急',
+                5: '致命'
+              };
               return map[cellValue] || '-';
             }
           },
@@ -86,6 +92,23 @@
             showOverflowTooltip: true,
             minWidth: 180
           },
+          {
+            prop: 'generateDocumentType',
+            label: '生成单据类型',
+            formatter: (_row, _column, cellValue) => {
+              return cellValue==1?'巡点检':cellValue==2?'保养':cellValue==3?'维修':cellValue==5?'量具送检':
+            },
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'generateDocumentCode',
+            label: '生成单据编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
           {
             prop: 'remark',
             label: '备注',

+ 38 - 20
src/views/warning/warningSetting/components/addWarningDialog.vue

@@ -70,7 +70,7 @@
                 ></el-input>
               </el-form-item>
             </el-col>
-            <!-- <el-col :span="12">
+            <el-col :span="12">
               <el-form-item label="选择生成单据:">
                 <el-radio-group
                   v-model="baseInfoForm.generateDocumentType"
@@ -82,7 +82,7 @@
                   <el-radio :label="5">量具送检</el-radio>
                 </el-radio-group>
               </el-form-item>
-            </el-col> -->
+            </el-col>
           </el-row>
           <el-row>
             <el-col :span="24">
@@ -396,7 +396,11 @@
     </el-tabs>
     <span slot="footer" class="dialog-footer">
       <el-button size="small" @click="handleClose">取 消</el-button>
-      <el-button size="small" type="primary" @click="saveWarningSetting" v-if="dialogType!='view'"
+      <el-button
+        size="small"
+        type="primary"
+        @click="saveWarningSetting"
+        v-if="dialogType != 'view'"
         >确 定</el-button
       >
     </span>
@@ -465,9 +469,7 @@
             //   attributeCode: 'identifier',
             //   attributeName: '温度'
             // }
-            {
-            
-            }
+            {}
           ], // 基本信息触发条件表格
           notices: [
             {
@@ -501,7 +503,7 @@
         this.baseInfoForm.deviceId = data.id;
         this.baseInfoForm.deviceName = data.name;
         this.baseInfoForm.deviceCode = data.code;
-        this.baseInfoForm.conditions=[]
+        this.baseInfoForm.conditions = [];
         getPhysicalModel(data.id).then((res) => {
           this.temperatureList = res.properties;
         });
@@ -555,7 +557,7 @@
         );
       },
       receiver(item, index) {
-        console.log(index,'index')
+        console.log(index, 'index');
         this.$set(this.baseInfoForm.notices[index], 'receiverName', item.name);
       },
 
@@ -567,6 +569,10 @@
         }
       },
       addPostscript() {
+        if (!this.baseInfoForm?.workItems?.length) {
+          this.$message.error('请先添加规则!');
+          return;
+        }
         this.baseInfoForm.workItems.push({
           sort: null,
           name: '',
@@ -631,17 +637,29 @@
 
       // 保存
       async saveWarningSetting() {
+        if (
+          [1, 2, 5].includes(this.baseInfoForm.generateDocumentType) &&
+          !this.baseInfoForm?.workItems?.length
+        ) {
+          this.$message.error('规则不能为空!');
+          return;
+        }
         this.$refs.baseInfoFormRef.validate(async (valid) => {
-          this.saveLoading = true;
-          let api=this.baseInfoForm.id?update:save
-          api(this.baseInfoForm).then((res) => {
-            this._resetDialogInfo();
-            this.saveLoading = false;
-            this.addWarningDialog = false;
-            this.$emit('refreshList');
-            this.$message.success('操作成功!');
-            this.saveLoading = false;
-          });
+          if (valid) {
+            this.saveLoading = true;
+            let api = this.baseInfoForm.id ? update : save;
+            api(this.baseInfoForm)
+              .then((res) => {
+                this._resetDialogInfo();
+                this.saveLoading = false;
+                this.addWarningDialog = false;
+                this.$emit('refreshList');
+                this.$message.success('操作成功!');
+              })
+              .finally(() => {
+                this.saveLoading = false;
+              });
+          }
         });
       },
       // 重置弹窗信息
@@ -651,8 +669,8 @@
           alarmEquipmentId: '', // 告警设备类型id
           alarmEquipmentName: '', // 告警设备类型name
           name: '', // 告警名称
-          status: false, // 状态
-          generateDocumentType: false, // 是否生成保修工单
+          // status: false, // 状态
+          // generateDocumentType: false, // 是否生成保修工单
           description: '', // 告警描述
           alarmTrigger: 0, // 告警触发条件类型选择
           alarmMode: '', // 告警方式