Răsfoiți Sursa

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend into dev

chencc 1 an în urmă
părinte
comite
535a8a442c

+ 34 - 28
src/views/rulesManagement/earlyWarningRules/components/matter-add.vue

@@ -100,9 +100,9 @@
           border
           :header-cell-style="{ background: '#F0F3F3' }"
         >
-          <el-table-column type="index" width="50" align="left"  >
+          <el-table-column type="index" width="50" align="left">
             <template slot="header">
-              <el-button type="text" @click="addItem"  style="padding: 0"
+              <el-button type="text" @click="addItem" style="padding: 0"
                 >新增</el-button
               >
             </template>
@@ -185,15 +185,17 @@
             label="模板编码"
             width="500"
           >
-            <template slot-scope="scope" >
+            <template slot-scope="scope">
               <el-form-item
                 :prop="
                   'actionList.' + scope.$index + '.alertMessageTempateCode'
-                " style="width: 100%"
+                "
+                style="width: 100%"
                 label-width="0"
                 :rules="contentConfigFormRules.alertMessageTempateCode"
               >
-                <el-select style="width: 100%"
+                <el-select
+                  style="width: 100%"
                   placeholder="请选择"
                   v-model="scope.row.alertMessageTempateCode"
                   @change="changeTemplate(scope.row, scope.$index)"
@@ -251,7 +253,11 @@
     rulesSave,
     rulesUpdate,
     getCode,
-    getDetail
+    getDetail,
+    listAllRulesObj,
+    listAllDateUnit,
+    listAllActionType,
+    listAllAlertLevel
   } from '@/api/ruleManagement/earlyWarning';
   import { notifyTemplatePageAPI } from '@/api/notifyManage';
   import { getUserPage } from '@/api/system/organization';
@@ -338,27 +344,11 @@
     },
     watch: {},
     created() {
+      this.getAllData();
       this.gettemplateList();
       this.getInfo();
     },
-    mounted() {
-      const str1 = localStorage.getItem('allRulesData');
-      if (str1) {
-        this.allRulesData = JSON.parse(str1);
-      }
-      const str2 = localStorage.getItem('cycleUnitOpt');
-      if (str2) {
-        this.cycleUnitOpt = JSON.parse(str2);
-      }
-      const str3 = localStorage.getItem('operationTypeData');
-      if (str3) {
-        this.operationTypeData = JSON.parse(str3);
-      }
-      const str4 = localStorage.getItem('allAlertLevelData');
-      if (str4) {
-        this.allAlertLevelData = JSON.parse(str4);
-      }
-    },
+
     methods: {
       handleInput(value) {
         this.formData.alertCycleValue = this.$handleInputPublic(value);
@@ -375,7 +365,21 @@
         }
         this.formData.actionList[index].thresholdValue = finalValue;
       },
-
+      async getAllData() {
+        try {
+          const res1 = await listAllRulesObj();
+          this.allRulesData = res1;
+          const res2 = await listAllDateUnit();
+          this.cycleUnitOpt = res2;
+          const res3 = await listAllActionType();
+          this.operationTypeData = res3;
+          const res4 = await listAllAlertLevel();
+          this.allAlertLevelData = res4;
+        } catch (error) {
+          console.error('Failed to load data:', error);
+          throw error;
+        }
+      },
       handleAddInfo(row, index) {
         this.NumberOfPeople = '';
         this.formData.actionList[index].targetAddress = '';
@@ -415,7 +419,6 @@
         });
         if (res?.list) {
           this.templateData = res.list;
-          localStorage.setItem('templateData', JSON.stringify(res.list));
         }
       },
       async getInfo() {
@@ -518,7 +521,7 @@
 
       // 保存
       dataKeep() {
-        console.log(this.isBindPlan,'dsdsds')
+        console.log(this.isBindPlan, 'dsdsds');
         let form = deepClone(this.formData);
         console.log(form, 'form');
         if (form.actionList.length < 1) {
@@ -526,7 +529,10 @@
         }
         this.$refs.contentConfigForm.validate(async (valid) => {
           if (valid) {
-            let request = (this.isBindPlan != 'add'&&this.isBindPlan != 'clone' )? rulesUpdate : rulesSave;
+            let request =
+              this.isBindPlan != 'add' && this.isBindPlan != 'clone'
+                ? rulesUpdate
+                : rulesSave;
 
             let res = await request(form);
             if (res) {

+ 25 - 23
src/views/rulesManagement/earlyWarningRules/details.vue

@@ -124,8 +124,12 @@
   import RuleCycle from './components/rule-cycle';
   import {
     getDetail,
-    listAllRulesObj
+    listAllRulesObj,
+    listAllDateUnit,
+    listAllActionType,
+    listAllAlertLevel
   } from '@/api/ruleManagement/earlyWarning';
+  import { notifyTemplatePageAPI } from '@/api/notifyManage';
   export default {
     mixins: [dictMixins],
     components: { RuleCycle },
@@ -144,33 +148,31 @@
       };
     },
     async created() {
-      await this.getAll();
+      await this.getAllData();
       if (this.$route.query.id) this.getInfo();
     },
     mounted() {},
     methods: {
-      getAll() {
-        const str1 = localStorage.getItem('allRulesData');
-        if (str1) {
-          this.allRulesData = JSON.parse(str1);
-        }
-        const str2 = localStorage.getItem('cycleUnitOpt');
-        if (str2) {
-          this.cycleUnitOpt = JSON.parse(str2);
-        }
-        const str3 = localStorage.getItem('operationTypeData');
-        if (str3) {
-          this.operationTypeData = JSON.parse(str3);
-        }
-        const str4 = localStorage.getItem('allAlertLevelData');
-        if (str4) {
-          this.allAlertLevelData = JSON.parse(str4);
-        }
-        const str5 = localStorage.getItem('templateData');
-        if (str4) {
-          this.templateData = JSON.parse(str5);
+      async getAllData() {
+        try {
+          const res1 = await listAllRulesObj();
+          this.allRulesData = res1;
+          const res2 = await listAllDateUnit();
+          this.cycleUnitOpt = res2;
+          const res3 = await listAllActionType();
+          this.operationTypeData = res3;
+          const res4 = await listAllAlertLevel();
+          this.allAlertLevelData = res4;
+
+          const res5 = await notifyTemplatePageAPI({
+            pageNum: 1,
+            size: 999
+          });
+          this.templateData = res5?.list;
+        } catch (error) {
+          console.error('Failed to load data:', error);
+          throw error;
         }
-        console.log(this.templateData, 'this.templateData');
       },
       // 表格数据
       async getInfo() {

+ 6 - 28
src/views/rulesManagement/earlyWarningRules/index.vue

@@ -85,10 +85,7 @@
     getList,
     getDetail,
     removeRule,
-    listAllDateUnit,
-    listAllRulesObj,
-    listAllActionType,
-    listAllAlertLevel
+    listAllDateUnit
   } from '@/api/ruleManagement/earlyWarning';
   import dictMixins from '@/mixins/dictMixins';
   export default {
@@ -175,10 +172,7 @@
         pageType: 'add',
         dialogTitle: '',
 
-        allRulesData: {},
-        cycleUnitOpt: {},
-        operationTypeData: {},
-        allAlertLevelData: {}
+        cycleUnitOpt: {}
       };
     },
     computed: {},
@@ -186,7 +180,7 @@
       // this.requestDict('规则周期');
       this.requestDict('预警类型');
       this.requestDict('规则状态');
-      this.getAllData();
+      this.getData();
     },
     methods: {
       /* 表格数据源 */
@@ -197,25 +191,9 @@
       reload(where) {
         this.$refs.table.reload({ page: 1, where });
       },
-
-      async getAllData() {
-        try {
-          const res1 = await listAllRulesObj();
-          this.allRulesData = res1;
-          localStorage.setItem('allRulesData', JSON.stringify(res1));
-          const res2 = await listAllDateUnit();
-          this.cycleUnitOpt = res2;
-          localStorage.setItem('cycleUnitOpt', JSON.stringify(res2));
-          const res3 = await listAllActionType();
-          this.operationTypeData = res3;
-          localStorage.setItem('operationTypeData', JSON.stringify(res3));
-          const res4 = await listAllAlertLevel();
-          this.allAlertLevelData = res4;
-          localStorage.setItem('allAlertLevelData', JSON.stringify(res4));
-        } catch (error) {
-          console.error('Failed to load data:', error);
-          throw error;
-        }
+      async getData() {
+        const res2 = await listAllDateUnit();
+        this.cycleUnitOpt = res2;
       },
 
       remove(row) {

+ 2 - 2
vue.config.js

@@ -35,10 +35,10 @@ module.exports = {
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
-        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.158:18086',
         // target: 'http://192.168.1.176:18086',
-        // target: 'http://192.168.1.251:18086',
+        target: 'http://192.168.1.251:18086',
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {