zhaoke 1 jaar geleden
bovenliggende
commit
5f0ad7d822
2 gewijzigde bestanden met toevoegingen van 60 en 12 verwijderingen
  1. 3 4
      src/views/newScene/index.vue
  2. 57 8
      src/views/table/index.vue

+ 3 - 4
src/views/newScene/index.vue

@@ -2,7 +2,7 @@
   <div class="newScene">
     <div class="newScene-head flex">
       <div class="manageTitle">预警报警场景</div>
-      <el-button type="primary" @click="handleAdd" size="small">新增</el-button>
+      <el-button plain type="primary" @click="handleAdd" size="small">新增</el-button>
     </div>
     <div v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" class="newScene-content">
       <el-table v-el-table-infinite-scroll="load" :data="tableData" border height="100%" style="width: 100%">
@@ -14,8 +14,8 @@
         </el-table-column>
         <el-table-column label="操作" width="300px">
           <template slot-scope="scope">
-            <el-button type="primary" @click="handleEdit(scope.row)" size="small">编辑</el-button>
-            <el-button type="danger" @click="handleRemove(scope.row)" size="small">删除</el-button>
+            <el-button plain type="primary" @click="handleEdit(scope.row)" size="small">编辑</el-button>
+            <el-button plain type="danger" @click="handleRemove(scope.row)" size="small">删除</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -47,7 +47,6 @@ import AdvanceQuery from './components/advanceQuery.vue';
 import { getAuthData } from "@/utils/validate";
 import { Query, newData, modifyData, moveData } from "@/api/webApi";
 import pb from '@/layout/mixin/publicFunc'
-import { remove } from 'js-cookie';
 export default {
   name: 'NewScene',
   mixins: [pb],

+ 57 - 8
src/views/table/index.vue

@@ -434,8 +434,8 @@ export default {
     },
     eledite () {
       this.flag = false;
-      const arrbegin = _.cloneDeep(this.tableOptionscp);
-      this.tableOptions = arrbegin;
+      // const arrbegin = _.cloneDeep(this.tableOptionscp);
+      // this.tableOptions = arrbegin;
     },
     load () {
       //
@@ -651,12 +651,12 @@ export default {
               : await moveData(params);
         if (code == 0) {
           this.$message.success("操作成功");
-          this.resetTable();
-          this.getQuery(this.queryId);
           this.flag = false;
           this.rmFlag = false;
           this.tableObj = {};
           this.tableForm = {};
+          this.resetTable();
+          this.load();
           // this.$router.go(0);
         } else {
           this.$message.error("操作失败");
@@ -694,6 +694,30 @@ export default {
         if (item.needGroup) {
           this.tableGroups.push(item.columnName);
         }
+        if (item.listqueryTemplateID || item.listqueryTemplateID == 0) {
+          this.tableArrs.push(item.columnName);
+          // const reqUt = this.getSelectData(item.listqueryTemplateID)
+          // reqUts.push(reqUt)
+          if (!this.tableOptions[item.columnName]) {
+            //开始位置beginPosition 结束位置endPosition (区分开始结束位置必须传null)
+            if (
+              item.columnName == "alarmSceneId"
+            ) {
+              this.tableOptions[item.columnName] = await this.getSelectData(
+                item.listqueryTemplateID,
+                this.urlParams,
+                true
+              );
+            } else {
+              this.tableOptions[item.columnName] = await this.getSelectData(
+                item.listqueryTemplateID
+              );
+            }
+            this.tabledatacopy[item.columnName] = _.cloneDeep(
+              this.tableOptions[item.columnName]
+            );
+          }
+        }
       });
       const dats = this.setTableFilters(this.tableData, this.tableDataFilters)
       this.tableDataFilters = _.cloneDeep(dats)
@@ -733,14 +757,39 @@ export default {
         });
     },
     //获取弹框-下拉数据
-    async getSelectData (id, name) {
+    async getSelectData (id, name = [], flag = false) {
       // name ? [name] : name === null ? [null]: [],
       const { code, returnData } = await Query({
-        id,
-        dataContent: name ? [name] : name === null ? [null] : [],
+        serviceId: id,
+        dataContent: name,
+        event: '0'
       });
       if (code == 0) {
-        return returnData.listValues;
+        const datas = [...returnData]
+        if (datas && datas.length) {
+          const datasObj = datas[0]
+          const arrs = []
+          if (flag) {
+            for (const key in datasObj) {
+              const obj = {
+                v: datasObj[key],
+                k: datasObj[key]
+              }
+              arrs.push(obj)
+            }
+          } else {
+            for (const key in datasObj) {
+              const obj = {
+                k: datasObj[key],
+                v: key
+              }
+              arrs.push(obj)
+            }
+          }
+          return arrs
+        } else {
+          return []
+        }
       } else {
         return [];
       }