فهرست منبع

无下拉的告警

chenrui  2 سال پیش
والد
کامیت
bd1a39c9c5
3فایلهای تغییر یافته به همراه240 افزوده شده و 82 حذف شده
  1. 2 0
      public/demo.js
  2. 225 81
      src/views/systemSettings/warningEdit/index.vue
  3. 13 1
      src/views/systemSettings/warningSet/index.vue

+ 2 - 0
public/demo.js

@@ -51,6 +51,8 @@ const DATACONTENT_ID = {
   sysServiceTabId: 2, //系统设置-服务管理-表格-id
   sysLogTable: 12, //系统设置-日志-表格
   sysServiceWarningId: 18029, //查询预警报警场景列表
+  sysServiceWarnId: 18030, //预警报警场景(按照ID)
+  sysServiceStrategyId: 18033, //预警报警策略(按照ID)
   sysSourceId: 13, //系统设置-数据源-id
   sysServiceTopTable: 31, //系统设置-服务管理-服务拓扑-查看日志
 };

+ 225 - 81
src/views/systemSettings/warningEdit/index.vue

@@ -10,15 +10,15 @@
       >
       <div class="diacont">
         <el-form :model="tableForm" class="w100 fw">
-          <div class="outersurface pd30">
+          <!-- <div class="outersurface pd30">
             <el-form-item label="策略名称" size="default">
               <el-input v-model="tableForm.name" placeholder="请输入策略名称" />
             </el-form-item>
-          </div>
+          </div> -->
           <div class="outersurface pd30">
             <el-form-item label="航司二字码" size="default">
               <el-input
-                v-model="tableForm.china"
+                v-model="tableForm.IATACode"
                 placeholder="请输入航司二字码"
               />
             </el-form-item>
@@ -27,7 +27,7 @@
             <el-form-item label="起飞机场" size="default">
               <el-select
                 style="width: 100%"
-                v-model="tableForm.englin"
+                v-model="tableForm.departmentAirport"
                 class="input-shadow"
                 filterable
                 default-first-option
@@ -48,7 +48,7 @@
             <el-form-item label="降落机场" size="default">
               <el-select
                 style="width: 100%"
-                v-model="tableForm.two"
+                v-model="tableForm.landingAirport"
                 class="input-shadow"
                 filterable
                 default-first-option
@@ -67,23 +67,36 @@
           </div>
           <div class="outersurface">
             <el-form-item label="航班号" size="default">
-              <el-input v-model="tableForm.three" placeholder="请输入航班号" />
+              <el-input
+                v-model="tableForm.flightNo"
+                placeholder="请输入航班号"
+              />
             </el-form-item>
           </div>
-          <div class="outertwowid pd30">
-            <el-form-item label="起止时间" size="default">
+          <div class="outersurface pd30">
+            <el-form-item label="生效时间" size="default">
               <el-date-picker
-                v-model="tableForm.time"
-                type="daterange"
-                range-separator="-"
-                start-placeholder="开始时间"
-                end-placeholder="结束时间"
-              />
+                v-model="tableForm.startDate"
+                :rows="1"
+                type="datetime"
+                format="YYYY-MM-DD HH:mm:ss"
+                value-format="YYYY-MM-DD HH:mm:ss"
+                placeholder="选择日期时间"
+              >
+              </el-date-picker>
             </el-form-item>
           </div>
-          <div class="outerthreewid">
-            <el-form-item label="备注" size="default">
-              <el-input v-model="tableForm.text" placeholder="请输入备注" />
+          <div class="outersurface pd30">
+            <el-form-item label="失效时间" size="default">
+              <el-date-picker
+                format="YYYY-MM-DD HH:mm:ss"
+                value-format="YYYY-MM-DD HH:mm:ss"
+                v-model="tableForm.endDate"
+                :rows="1"
+                type="datetime"
+                placeholder="选择日期时间"
+              >
+              </el-date-picker>
             </el-form-item>
           </div>
         </el-form>
@@ -106,7 +119,7 @@
     </div>
     <div class="containers scroll-y">
       <DataTable
-        :tableHeader="state.list"
+        :tableHeader="tableCols"
         :tableData="tableData"
         :tableBtnGroup="tableBtnGroup"
         :tableProperty="{ rowKey: 'ID' }"
@@ -120,6 +133,8 @@
       :msgTitle="msgTitle"
       @resetForm="resetForm"
       @delRest="delRest"
+      @submitForm="submitForm"
+      @delRemove="delRemove"
     >
       <div class="diacont">
         <el-form :model="tableForms">
@@ -127,7 +142,7 @@
             <el-col :span="12">
               <el-form-item label="策略名称" size="default">
                 <el-input
-                  v-model="tableForms.name"
+                  v-model="tableForms.StrategyName"
                   placeholder="请输入策略名称"
                 />
               </el-form-item>
@@ -136,7 +151,7 @@
               <el-form-item label="计算依据" size="default">
                 <el-select
                   style="width: 100%"
-                  v-model="tableForms.china"
+                  v-model="tableForms.calculationBasis"
                   class="input-shadow"
                   filterable
                   default-first-option
@@ -156,7 +171,7 @@
             <el-col :span="12">
               <el-form-item label="预警时长" size="default">
                 <el-input
-                  v-model="tableForms.englin"
+                  v-model="tableForms.warningDuration"
                   placeholder="请输入预警时长"
                 />
               </el-form-item>
@@ -164,7 +179,7 @@
             <el-col :span="12">
               <el-form-item label="报警时长" size="default">
                 <el-input
-                  v-model="tableForms.two"
+                  v-model="tableForms.alarmDuration"
                   placeholder="请输入报警时长"
                 />
               </el-form-item>
@@ -173,7 +188,7 @@
               <el-form-item label="开始节点" size="default">
                 <el-select
                   style="width: 100%"
-                  v-model="tableForms.three"
+                  v-model="tableForms.beginNode"
                   class="input-shadow"
                   filterable
                   default-first-option
@@ -194,7 +209,7 @@
               <el-form-item label="开始位置" size="default">
                 <el-select
                   style="width: 100%"
-                  v-model="tableForms.text"
+                  v-model="tableForms.beginPosition"
                   class="input-shadow"
                   filterable
                   default-first-option
@@ -215,7 +230,7 @@
               <el-form-item label="结束节点" size="default">
                 <el-select
                   style="width: 100%"
-                  v-model="tableForms.text1"
+                  v-model="tableForms.endNode"
                   class="input-shadow"
                   filterable
                   default-first-option
@@ -236,7 +251,7 @@
               <el-form-item label="结束位置" size="default">
                 <el-select
                   style="width: 100%"
-                  v-model="tableForms.text2"
+                  v-model="tableForms.endPosition"
                   class="input-shadow"
                   filterable
                   default-first-option
@@ -264,56 +279,44 @@
 import Minheader from "@/components/minheader/index.vue";
 import DataTable from "@/components/tableTemp/index.vue";
 import Dialog from "@/components/dialog/index.vue";
+import { Query, GeneralDataReception } from "@/api/webApi";
+import { ElMessage } from "element-plus";
+const route = useRoute();
+const page = ref<number>(0); //分页参数
+const dataContent = ref<object>({});
+const noMore = ref<Boolean>(false);
+const rowTitle = ref<String>("");
+const tableCols = ref([]); //表头数据
+const serviceId = ref<String>("");
+const tableObj = ref({}); //增删改数据缓存
 const tableForm = reactive({
-  name: "",
-  china: "",
-  englin: "",
-  two: "",
-  three: "",
-  text: "",
-  time: "",
+  IATACode: "",
+  departmentAirport: "",
+  landingAirport: "",
+  flightNo: "",
+  startDate: "",
+  endDate: "",
+  event: 2,
 }); //报警预警场景
 const tableForms = reactive({
-  name: "",
-  china: "",
-  englin: "",
-  two: "",
-  three: "",
-  text: "",
-  text1: "",
-  text2: "",
+  alarmStrategyID: "",
+  StrategyName: "",
+  calculationBasis: "",
+  warningDuration: "",
+  alarmDuration: "",
+  beginNode: "",
+  beginPosition: "",
+  endNode: "",
+  endPosition: "",
+  alarmSceneId: route.query.alarmSceneId,
+  event: "",
 }); //弹窗内容
 const tableOptionser = ref<Array>([]); //下拉
 const flag = ref<Boolean>(false); //弹窗开关
 const type = ref<String>(""); //判断是否删除
 const msgTitle = ref<String>("新增报警预警策略"); //弹窗标题
 //列表
-const tableData = ref([
-  {
-    name: "中国国际航空",
-    china: "国航",
-    englin: "AIRCHINA",
-    two: "CA",
-    three: "CCA",
-    text: "CA国航",
-  },
-  {
-    name: "中国国际航空",
-    china: "国航",
-    englin: "AIRCHINA",
-    two: "CA",
-    three: "CCA",
-    text: "CA国航",
-  },
-  {
-    name: "中国国际航空",
-    china: "国航",
-    englin: "AIRCHINA",
-    two: "CA",
-    three: "CCA",
-    text: "CA国航",
-  },
-]);
+const tableData = ref([]);
 //表头
 const state = reactive({
   list: [
@@ -345,16 +348,24 @@ const addForm = () => {
   msgTitle.value = "新增报警预警策略";
   flag.value = true;
   type.value = "";
+  tableForms.event = 1;
 };
 //取消
 const resetForm = () => {
   flag.value = false;
-  tableForm.name = "";
-  tableForm.china = "";
-  tableForm.englin = "";
-  tableForm.two = "";
-  tableForm.three = "";
-  tableForm.text = "";
+  tableForms.alarmStrategyID = "";
+  tableForms.StrategyName = "";
+  tableForms.calculationBasis = "";
+  tableForms.warningDuration = "";
+  tableForms.alarmDuration = "";
+  tableForms.beginNode = "";
+  tableForms.beginPosition = "";
+  tableForms.endNode = "";
+  tableForms.endPosition = "";
+};
+const delRemove = () => {
+  tableForms.event = 3;
+  generalDataReception(tableForms);
 };
 //删除
 const delRest = () => {
@@ -366,21 +377,154 @@ const btnClick = (row, index, param) => {
     msgTitle.value = "编辑报警预警策略";
     flag.value = true;
     type.value = "";
-    tableForms.name = index.name;
-    tableForms.china = index.china;
-    tableForms.englin = index.englin;
-    tableForms.two = index.two;
-    tableForms.three = index.three;
-    tableForms.text = index.text;
-    tableForms.text1 = index.text1;
-    tableForms.text2 = index.text2;
+    tableForms.event = 2;
+    tableForms.alarmStrategyID = index.alarmStrategyID;
+    tableForms.StrategyName = index.StrategyName;
+    tableForms.calculationBasis = index.calculationBasis;
+    tableForms.warningDuration = index.warningDuration;
+    tableForms.alarmDuration = index.alarmDuration;
+    tableForms.beginNode = index.beginNode;
+    tableForms.beginPosition = index.beginPosition;
+    tableForms.endNode = index.endNode;
+    tableForms.endPosition = index.endPosition;
   } else if (param === 3) {
     msgTitle.value = "删除报警预警策略";
     flag.value = true;
     type.value = "del";
+    tableForms.event = 3;
+    tableForms.alarmStrategyID = index.alarmStrategyID;
+    tableForms.StrategyName = index.StrategyName;
+    tableForms.calculationBasis = index.calculationBasis;
+    tableForms.warningDuration = index.warningDuration;
+    tableForms.alarmDuration = index.alarmDuration;
+    tableForms.beginNode = index.beginNode;
+    tableForms.beginPosition = index.beginPosition;
+    tableForms.endNode = index.endNode;
+    tableForms.endPosition = index.endPosition;
   } else if (param === 4) {
   }
 };
+//获取预警报警场景(按照ID)
+const sysServiceWarn = async () => {
+  try {
+    let arr = [route.query.alarmSceneId];
+    // arr.push(this.$route.query.id);
+    const { code, returnData } = await Query({
+      id: DATACONTENT_ID.sysServiceWarnId,
+      dataContent: arr,
+    });
+    if (code === "0") {
+      tableForm.IATACode = returnData.listValues[0].IATACode
+        ? returnData.listValues[0].IATACode
+        : "";
+      tableForm.departmentAirport = returnData.listValues[0].departmentAirport
+        ? returnData.listValues[0].departmentAirport
+        : "";
+      tableForm.landingAirport = returnData.listValues[0].landingAirport
+        ? returnData.listValues[0].landingAirport
+        : "";
+      tableForm.flightNo = returnData.listValues[0].flightNo
+        ? returnData.listValues[0].flightNo
+        : "";
+      tableForm.startDate = returnData.listValues[0].startDate
+        ? returnData.listValues[0].startDate
+        : "";
+      tableForm.endDate = returnData.listValues[0].endDate
+        ? returnData.listValues[0].endDate
+        : "";
+    } else {
+      // this.page--;
+      // this.$message.error.message;
+      // this.loading = false;
+    }
+  } catch (error) {
+    // this.page--;
+    // this.loading = false;
+  }
+};
+//获取表格数据
+const getQuery = async () => {
+  try {
+    const { code, returnData } = await Query({
+      id: DATACONTENT_ID.sysServiceStrategyId,
+      needPage: ++page.value,
+      dataContent: [route.query.alarmSceneId],
+    });
+    if (code === "0") {
+      if (returnData.listValues.length === 0) {
+        page.value--;
+        noMore.value = true;
+      }
+      const titleColumn = returnData.columnSet.find(
+        (item) => item.needShow === 1
+      );
+      if (titleColumn) {
+        rowTitle.value = titleColumn.columnName;
+      }
+      tableData.value.push(...returnData.listValues);
+      tableCols.value = returnData.columnSet;
+      tableCols.value.forEach((element) => {
+        element.label = element.columnLabel;
+        element.key = element.columnName;
+      });
+      serviceId.value = returnData.submitID;
+    } else {
+      page.value--;
+    }
+  } catch (error) {
+    page.value--;
+  }
+};
+//确认提交
+const submitForm = () => {
+  generalDataReception(tableForms);
+};
+const resetTable = () => {
+  page.value = 0;
+  noMore.value = false;
+  tableData.value = [];
+};
+//新增-编辑-删除
+const generalDataReception = async (data) => {
+  try {
+    let obj = {
+      alarmSceneId: route.query.alarmSceneId,
+    };
+    data = {
+      ...data,
+      ...obj,
+    };
+    const { code } = await GeneralDataReception({
+      serviceId: serviceId.value,
+      dataContent: JSON.stringify(data),
+    });
+    if (code == 0) {
+      ElMessage.success(`操作成功`);
+      // this.$message.success("操作成功");
+      resetTable();
+      getQuery();
+      resetForm();
+      flag.value = false;
+      // rmFlag.value = false;
+      tableObj.value = {};
+      // this.$router.go(0);
+    } else {
+      ElMessage.error(`操作失败`);
+      // this.$message.error("操作失败");
+      // this.flag = false;
+      // this.rmFlag = false;
+      tableObj.value = {};
+      resetForm();
+    }
+  } catch (error) {
+    flag.value = false;
+    //  rmFlag.value = false;
+    tableObj.value = {};
+    resetForm();
+  }
+};
+sysServiceWarn();
+getQuery();
 </script>
 
 <style lang="scss" scoped>

+ 13 - 1
src/views/systemSettings/warningSet/index.vue

@@ -241,11 +241,23 @@ const resetForm = () => {
 //编辑-删除
 const btnClick = (row, index, param) => {
   if (param === 2) {
-    router.push({ path: "/systemSettings/warningEdit" });
+    router.push({
+      path: "/systemSettings/warningEdit",
+      query: {
+        alarmSceneId: index.alarmSceneId,
+      },
+    });
   } else if (param === 3) {
     msgTitle.value = "删除告警预警维护";
     flag.value = true;
     type.value = "del";
+    tableForm.event = 3;
+    tableForm.IATACode = index.IATACode;
+    tableForm.departmentAirport = index.departmentAirport;
+    tableForm.landingAirport = index.landingAirport;
+    tableForm.flightNo = index.flightNo;
+    tableForm.startDate = index.startDate;
+    tableForm.endDate = index.endDate;
   } else if (param === 4) {
   }
 };