Selaa lähdekoodia

字典维护添加

maxiaoxiao 8 kuukautta sitten
vanhempi
commit
de9e3a4600
2 muutettua tiedostoa jossa 73 lisäystä ja 16 poistoa
  1. 16 0
      src/api/system/zyml.js
  2. 57 16
      src/views/system/zyml/index.vue

+ 16 - 0
src/api/system/zyml.js

@@ -42,3 +42,19 @@ export function delZyml(bsm) {
     method: 'delete'
   })
 }
+
+// 共享位置
+export function Getfiledslist(params) {
+  return request({
+      url: '/apply/share/configuration/fileds/list',
+      method: 'get',
+      params
+  })
+}
+export function fileds(data) {
+  return request({
+      url: '/apply/share/configuration/filed',
+      method: 'put',
+      data
+  })
+}

+ 57 - 16
src/views/system/zyml/index.vue

@@ -142,7 +142,8 @@
             type="text"
             icon="el-icon-s-cooperation"
             v-if="
-              scope.row.parent == 0 && ['Vector'].indexOf(scope.row.type) > -1
+              scope.row.parent == 0 &&
+              ['Vector', 'wms', 'wmts'].indexOf(scope.row.type) > -1
             "
             @click="handleDict(scope.row)"
             >字典维护</el-button
@@ -461,21 +462,22 @@
                 type="index"
                 label="序号"
               ></el-table-column>
-              <el-table-column align="center" label="字段名称" prop="fieldname">
+              <el-table-column align="center" label="字段名称" prop="filedName">
               </el-table-column>
               <el-table-column prop="sort" label="字段别名" align="center">
                 <template slot-scope="{ row, column }">
                   <el-input
                     size="mini"
                     v-if="row.index == rowIndex && column.index == columnIndex"
-                    v-model="row.fieldaliasname"
+                    v-model="row.filedNameZh"
                     @blur="inputBlur(row)"
                   ></el-input>
-                  <span v-else>{{ row.fieldaliasname }}</span>
+                  <span v-else>{{ row.filedNameZh }}</span>
                 </template>
               </el-table-column>
               <el-table-column label="是否显示">
                 <template slot-scope="{ row }">
+                  {{ row.status }}
                   <el-switch
                     v-model="row.status"
                     active-text="是"
@@ -515,6 +517,8 @@ import {
   delZyml,
   addZyml,
   updateZyml,
+  Getfiledslist,
+  fileds,
 } from "@/api/system/zyml";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
@@ -899,10 +903,10 @@ export default {
     // 构建行政区tree
     resetTree(data) {
       data.forEach((item) => {
-        if (!item.isparent && item.children.length == 0) {
+        if (!item.isparent && item.children && item.children.length == 0) {
           delete item.children;
         }
-        if (item.isparent && item.children.length > 0) {
+        if (item.isparent && item.children && item.children.length > 0) {
           this.resetTree(item.children);
         }
       });
@@ -929,15 +933,16 @@ export default {
       this.tempTableData = [];
       //默认选中
       this.tabActiveName = row.name;
-      if (row.legend == "" && row.url != "") {
-        this.getDict(row);
-      } else {
-        this.processData(row);
-      }
+      this.getDictlist(row, false);
+      // if (row.legend == "" && row.url != "") {
+      //   this.getDict(row);
+      // } else {
+      //   this.processData(row);
+      // }
       this.cur_server_name_dic = row.name;
       this.dialogDictVisible = true;
     },
-    getDict(row) {
+    getDict(row, fu) {
       let indexss = row.url.lastIndexOf("/");
       var resolvess = row.url.substring(0, indexss);
       let url1 = resolvess.replace("map-", "data-");
@@ -945,9 +950,8 @@ export default {
       let url3 = row.fwgzkj + "/datasets/";
       let url2 = url1.replace("maps", "data/datasources/" + url3);
       // let reqName = row.sde.substring(row.sde.indexOf(":") + 1, row.sde.length);
-      let reqName = row.fwmc;
       //从iserver中获取数据地址
-      let newUrl = url2 + reqName + "/fields.json";
+      let newUrl = url2 + row.fwmc + "/fields.json";
       request({
         method: "get",
         url: newUrl,
@@ -963,6 +967,7 @@ export default {
               id: iindex,
             });
           });
+          if (fu) fu();
 
           this.tabelList.push({
             bsm: row.bsm,
@@ -989,9 +994,45 @@ export default {
         servicename: row.name,
       });
     },
-    refresh() {},
-    //确定字典维护的修改
+    refresh() {
+      this.tabelList = [];
+      this.tempTableData = [];
+      let row = this.tempRowData;
+      this.getDictlist(row, true);
+      // let newLegend = row.legend !== "" ? JSON.parse(row.legend) : [];
+      // this.getDict(row, () => {
+      //   this.tempTableData.forEach((temp, n) => {
+      //     const le = newLegend.find(
+      //       (item) => item.fieldname === temp.fieldname
+      //     );
+      //     if (le) this.tempTableData[n] = { ...le };
+      //   });
+      // });
+    },
+    getDictlist(row, resetType) {
+      Getfiledslist({ zymlBsm: row.bsm, resetType }).then((res) => {
+        this.tempTableData = res.data;
+        this.tabelList.push({
+          bsm: row.bsm,
+          name: row.name,
+          tabelData: this.tempTableData,
+          servicename: row.name,
+        });
+      });
+    },
     confirmUpdateDict() {
+      fileds(this.tempTableData).then((res) => {
+        if ((res.code = 200)) {
+          this.$modal.msgSuccess("修改成功");
+          this.dialogDictVisible = false;
+          //关闭弹窗时还原编辑状态
+          this.columnIndex = -1;
+          this.getList();
+        }
+      });
+    },
+    //确定字典维护的修改
+    confirmUpdateDict_old() {
       if (this.tabelList.length > 0) {
         //将数据转化为字符串存储
         this.tempRowData.legend = JSON.stringify(this.tabelList[0].tabelData);