فهرست منبع

Merge branch 'master' of http://49.4.49.126:3000/wxw/ZhangShan_VueProject

WXW 4 سال پیش
والد
کامیت
8e176506b6
2فایلهای تغییر یافته به همراه57 افزوده شده و 226 حذف شده
  1. 56 225
      src/views/rule/edit_form.vue
  2. 1 1
      src/views/rule/list.vue

+ 56 - 225
src/views/rule/edit_form.vue

@@ -23,78 +23,49 @@
           </el-form-item>
         </el-col>
         <el-col :span="9" style="display:flex;justify-content:space-between;align-items:center">
-          <el-form-item prop="category">
-            <el-tag slot="label">报警类别</el-tag>
-            <el-select v-model="form.category" class="select-mini">
-              <el-option key="1" label="风机" value="1" />
-              <el-option key="2" label="电气" value="2" />
+          <el-form-item prop="part">
+            <el-tag slot="label">工艺环节</el-tag>
+            <el-select v-model="form.part" class="select-mini">
+              <el-option key="1" label="预处理" value="pretreatment" />
+              <el-option key="2" label="干燥塔" value="drying" />
+              <el-option key="3" label="蒸发车间" value="evaporation" />
             </el-select>
           </el-form-item>
           <el-form-item prop="rank">
             <el-tag slot="label">报警级别</el-tag>
             <el-select v-model="form.rank" class="select-mini">
-              <el-option key="1" label="低" value="1" />
-              <el-option key="2" label="中低" value="2" />
-              <el-option key="3" label="中" value="3" />
-              <el-option key="4" label="中高" value="4" />
-              <el-option key="5" label="高" value="5" />
+              <el-option key="1" label="低" :value="1" />
+              <el-option key="2" label="中低" :value="2" />
+              <el-option key="3" label="中" :value="3" />
+              <el-option key="4" label="中高" :value="4" />
+              <el-option key="5" label="高" :value="5" />
             </el-select>
           </el-form-item>
           <el-form-item prop="enabled">
             <el-tag slot="label">是否启用</el-tag>
             <el-switch
               v-model="form.enabled"
-              active-value="1"
-              inactive-value="0"
+              :active-value="true"
+              :inactive-value="false"
               active-color="#13ce66"
             />
           </el-form-item>
         </el-col>
       </el-row>
       <el-row :gutter="10">
-        <el-col :span="6">
-          <el-form-item prop="station">
-            <el-tag slot="label">风场</el-tag>
-            <el-select v-model="form.station" style="width:100%">
-              <el-option
-                v-for="item in stationList"
-                :key="item.id"
-                :value="item.id"
-                :label="item.name"
-              />
-            </el-select>
-          </el-form-item>
-          <el-form-item prop="modelId" v-show="isWindturbine">
-            <el-tag slot="label">风机类型</el-tag>
-            <el-select v-model="form.modelId" style="width:100%">
-              <el-option v-for="item in modelList" :key="item" :label="item" :value="item" />
-            </el-select>
-          </el-form-item>
-          <el-form-item prop="relatedParts" v-show="isWindturbine">
-            <el-tag slot="label">所属部件</el-tag>
-            <el-select v-model="form.relatedParts" style="width:100%">
-              <el-option
-                v-for="i in relatePartList"
-                :key="i.partCode"
-                :value="i.partCode"
-                :label="i.name"
-              />
-            </el-select>
-          </el-form-item>
-        </el-col>
-        <el-col :span="9">
+        <el-col :span="12">
           <el-form-item prop="expression">
             <el-tag slot="label">表达式</el-tag>
             <el-input
               type="textarea"
-              rows="12"
+              rows="11"
               v-model="form.expression"
               :value="form.expression"
               id="expressionInput"
             />
           </el-form-item>
         </el-col>
-        <el-col :span="9">
+        <el-col :span="12">
           <el-tabs type="border-card">
             <el-tab-pane label="AI测点">
               <el-input v-model="AIPointSearch" @input="AIInputChange">
@@ -111,7 +82,7 @@
                 :data="AIPointList"
                 @row-dblclick="tbAI_DBClickHandle"
               >
-                <el-table-column prop="uniformCode" />
+                <el-table-column prop="point" />
                 <el-table-column prop="name" />
               </el-table>
             </el-tab-pane>
@@ -130,7 +101,7 @@
                 :data="DIPointList"
                 @row-dblclick="tbDI_DBClickHandle"
               >
-                <el-table-column prop="uniformCode" />
+                <el-table-column prop="point" />
                 <el-table-column prop="name" />
               </el-table>
             </el-tab-pane>
@@ -199,7 +170,7 @@
   </el-dialog>
 </template>
 <script>
-import { fetchAIPointList, fetchDIPointList, alert_rule_postSave, } from "../../network/network";
+import { fetcPointList, alert_rule_postSave } from "../../api/requestAPI";
 import axios from "axios";
 export default {
   data()
@@ -211,33 +182,11 @@ export default {
         id: "",
         name: "",
         description: "",
-        expression: "111111",
-        tag: "",
-        rank: "",
-        enabled: "1", // 1可用-0禁用
-        modelId: "",
-        ednaValue: "",
-        category: "",
-        range: "",
-        station: "",
-        windturbine: "",
-        line: "",
-        project: "",
-        electrical: "",
-        taskstart: "",
-        relatedParts: "",
-        userName: "",
+        expression: "",
+        rank: 1,
+        enabled: true, // 1可用-0禁用
+        part: "",
       },
-      stationList: [],
-      modelList: [],
-      s_modelList: [
-        { station: "MHS_FDC", model_list: ["UP77", "UP105"] },
-        { station: "SBQ_FDC", model_list: ["UP82", "UP97", "UP105"] },
-        { station: "NSS_FDC", model_list: ["UP82"] },
-        { station: "XS_FDC", model_list: ["UP97", "UP105"] },
-        { station: "QS_FDC", model_list: ["CCWE-1500"] },
-      ],
-      relatePartList: [],
       AIDataSource: [],
       DIDataSource: [],
       AIPointList: [],
@@ -461,13 +410,12 @@ export default {
       ],
       rules: {
         name: [{ required: true, message: "请输入规则名称", trigger: "blur" }],
-        category: [
-          { required: true, message: "请选择报警类别", trigger: "change" },
+        part: [
+          { required: true, message: "请选择工艺环节", trigger: "change" },
         ],
         rank: [
           { required: true, message: "请选择报警级别", trigger: "change" },
         ],
-        station: [{ required: true, message: "请选择风场", trigger: "change" }],
         expression: [
           { required: true, message: "表达式不能为空", trigger: "change" },
         ],
@@ -483,82 +431,14 @@ export default {
     isVisible(val)
     {
       this.visible = val;
+      if (val == true) {
+        this.query_AI_DI_Point();
+      }
     },
     rowData(val)
     {
       this.form = JSON.parse(JSON.stringify(val));
     },
-    "form.station": {
-      handler(val)
-      {
-        if (this.form.category !== undefined && val !== undefined) {
-          if (this.form.category === "1") {
-            // 风机
-            if (this.form.modelId !== undefined) {
-              this.queryWindturbine_AI_DI_Point(val, this.form.modelId);
-            }
-          } else if (this.form.category === "2") {
-            // 电气
-            this.queryElectrical_AI_DI_Point(val);
-          }
-        }
-        // 场站变更 - 加载设备类型
-        if (val !== undefined) {
-          let sel_station = this.s_modelList.filter(function (item)
-          {
-            return item.station == val;
-          });
-          if (sel_station.length > 0)
-            this.modelList = sel_station[0].model_list;
-        }
-      },
-      deep: true,
-      immediate: true,
-    },
-    "form.category": {
-      handler(val)
-      {
-        if (val !== undefined) {
-          if (val === "1") {
-            // 风机
-            if (
-              this.form.station !== undefined &&
-              this.form.modelId !== undefined
-            ) {
-              this.queryWindturbine_AI_DI_Point(
-                this.form.station,
-                this.form.modelId
-              );
-            }
-          } else if (val === "2") {
-            // 电气
-            if (this.form.station !== undefined) {
-              this.queryElectrical_AI_DI_Point(this.form.station);
-            }
-          }
-        }
-        // 报警类别变更
-        if (this.form.category === "1") {
-          this.isWindturbine = true;
-        } else if (this.form.category === "2") {
-          this.isWindturbine = false;
-          this.form.modelId = "";
-          this.form.relatedParts = "";
-        }
-      },
-      deep: true,
-      immediate: true,
-    },
-    "form.modelId": {
-      handler(val)
-      {
-        if (this.form.station !== undefined && val !== undefined) {
-          this.queryWindturbine_AI_DI_Point(this.form.station, val);
-        }
-      },
-      deep: true,
-      immediate: true,
-    },
   },
   methods: {
     // 点击取消事件
@@ -580,47 +460,20 @@ export default {
         .catch((_) => { });
     },
     // 查询风场AI、DI测点
-    queryWindturbine_AI_DI_Point(station, modelId)
-    {
-
-
+    query_AI_DI_Point() {
       // 获取AI测点
-      fetchAIPointList(station, modelId).then((res) =>
-      {
-        console.log(res)
-        res.sort(function (a, b)
-        {
-          if (a.uniformCode < b.uniformCode) {
-            return -1;
-          }
-          if (a.uniformCode > b.uniformCode) {
-            return 1;
-          }
-          return 0;
-        });
-
-        this.AIPointList = res;
-        this.AIDataSource = res;
-      }).catch(error =>
-      {
-        console.log("fetchAIPointList 异常:" + error);
+      fetcPointList({ type: "AI" }).then((res) => {
+        if (res.status == 20000) {
+          this.AIPointList = res.data;
+          this.AIDataSource = res.data;
+        }
       });
       // 获取DI测点
-      fetchDIPointList(station, modelId).then((res) =>
-      {
-        res.sort(function (a, b)
-        {
-          if (a.uniformCode < b.uniformCode) {
-            return -1;
-          }
-          if (a.uniformCode > b.uniformCode) {
-            return 1;
-          }
-          return 0;
-        });
-
-        this.DIPointList = res;
-        this.DIDataSource = res;
+      fetcPointList({ type: "DI" }).then((res) => {
+        if (res.status == 20000) {
+          this.DIPointList = res.data;
+          this.DIDataSource = res.data;
+        }
       });
     },
 
@@ -673,31 +526,28 @@ export default {
       this.$refs["form"].validate((valid) =>
       {
         if (valid) {
-          let loginUser = sessionStorage.getItem("ms_username");
-          this.form.userName = loginUser;
-
           this.$confirm("确认关闭?")
-            .then(() =>
-            {
+            .then(() => {
+              console.log(this.form);
+              console.log(this.dialogStatus);
               switch (this.dialogStatus) {
                 //窗口状态:0-新增;1-修改;2-查看
                 case 0:
-                  custombj_postSave(this.form)
-                    .then((response) =>
-                    {
-                      if (response.data.success) {
+                  alert_rule_postSave(this.form)
+                    .then((response) => {
+                      console.log(response.data.status);
+                      if (response.data.status == 20000) {
                         this.$message.success("保存成功");
                         // 关闭窗口
                         this.visible = false;
                         this.$emit("cbFunc", this.visible);
                       } else if (
-                        response.data.status != null &&
-                        response.data.status == 521
+                        response.data.status == 5000 ||
+                        response.data.status == 5001
                       ) {
-                        this.$message.error("登陆过期");
+                        this.$message.error("未登陆,或登陆失效");
                         this.$router.push("/login");
-                        return;
-                      } else {
+                      } else if (response.data.status == 5002) {
                         this.$message.error(response.data.msg);
                       }
                     })
@@ -707,9 +557,8 @@ export default {
                     });
                   break;
                 case 1:
-                  custombj_postSave(this.form)
-                    .then((response) =>
-                    {
+                  alert_rule_postSave(this.form)
+                    .then((response) => {
                       if (response.data.success) {
                         this.$message.success("保存成功");
                         // 关闭窗口
@@ -764,18 +613,7 @@ export default {
       } else {
         this.AIPointSearch = "";
         this.DIPointSearch = "";
-        if (this.form.category === "1") {
-          this.isWindturbine = true;
-        } else if (this.form.category === "2") {
-          this.isWindturbine = false;
-        }
       }
-
-      // 获取关联部件
-      fetchRelatePart().then((res) =>
-      {
-        this.relatePartList = res;
-      });
     },
     // 窗口关闭事件 - 做重置表单操作
     dialogCloseHandle()
@@ -796,11 +634,6 @@ export default {
       } else {
         this.AIPointSearch = "";
         this.DIPointSearch = "";
-        if (this.form.category === "1") {
-          this.isWindturbine = true;
-        } else if (this.form.category === "2") {
-          this.isWindturbine = false;
-        }
       }
     },
     // AI测点模糊查询
@@ -819,13 +652,11 @@ export default {
         return i.name.indexOf(this.DIPointSearch) != -1;
       });
     },
-    tbAI_DBClickHandle(row)
-    {
-      this.elInputSplit(row.uniformCode);
+    tbAI_DBClickHandle(row) {
+      this.elInputSplit(row.point);
     },
-    tbDI_DBClickHandle(row)
-    {
-      this.elInputSplit(row.uniformCode);
+    tbDI_DBClickHandle(row) {
+      this.elInputSplit(row.point);
     },
     deepClone(obj)
     {

+ 1 - 1
src/views/rule/list.vue

@@ -158,7 +158,7 @@ export default {
           } else {
             this.tableData = res.data.dataList;
             this.total = res.data.total;
-            console.log(res.data)
+         
           }
         })
         .catch((err) => {