From 9981d4d90db5a6ee6b138eeea400502636f7f098 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期二, 27 八月 2024 17:57:04 +0800
Subject: [PATCH] 完善业务类型创建索引&&完善系统配置模块(管理功能模块、业务功能模块、操作类型管理、系统配置、系统运行监控)

---
 Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/businessType/index.vue |  275 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 259 insertions(+), 16 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/businessType/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/businessType/index.vue
index 6d4bb28..ef8fede 100644
--- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/businessType/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/businessType/index.vue
@@ -451,7 +451,7 @@
         </span>
     </el-dialog>
 
-    <!-- 涓�鑷存�ф鏌� -->
+    <!-- 鏌ョ湅绱㈠紩 -->
     <el-dialog
       v-dialogDrag
       :visible.sync="indexVisible"
@@ -459,8 +459,61 @@
       class="avue-dialog"
       title="绱㈠紩淇℃伅"
       width="60%"
+      @close="indexDialogClose"
     >
-
+      <div v-loading="indexLoading" style="display: flex;height: 500px;width: 100%">
+        <basic-container>
+          <div style="height: 390px">
+            <el-button plain size="mini" style="margin-bottom: 5px" type="danger"
+                       @click="deleteIndexLeftTreeClickHandler">鍒犻櫎绱㈠紩
+            </el-button>
+            <avue-tree
+              :data="indexLeftData"
+              :option="indexLeftOption"
+              @node-click="indexLeftNodeClick"></avue-tree>
+          </div>
+        </basic-container>
+        <div style="padding: 20px;width: 75%">
+          <div>
+            <el-form ref="form" :model="indexForm" label-width="90px" size="mini">
+              <el-form-item label="绱㈠紩鍚嶇О锛�">
+                <el-input v-model="indexForm.name" :readOnly="indexFormRead"></el-input>
+              </el-form-item>
+              <el-form-item label="鎻忚堪锛�">
+                <el-input v-model="indexForm.desc"></el-input>
+              </el-form-item>
+            </el-form>
+            <div style="display: flex;justify-content: center">
+              <el-button plain size="mini" type="success" @click="rightIndexAddClick">澧炲姞</el-button>
+              <el-button plain size="mini" type="danger">鍒犻櫎</el-button>
+            </div>
+          </div>
+          <avue-crud
+            :data="indexData"
+            :option="indexOption"></avue-crud>
+        </div>
+      </div>
+      <el-dialog
+        v-dialogDrag
+        :visible.sync="indexAttrVisible"
+        append-to-body="true"
+        class="avue-dialog"
+        title="灞炴�т俊鎭�"
+        width="60%"
+      >
+        <avue-crud
+          :data="indexAttrData"
+          :option="indexAttrOption"
+          @row-click="indexAttrRowClick"></avue-crud>
+        <span slot="footer" class="dialog-footer">
+         <el-button @click="indexAttrVisible = false">鍙� 娑�</el-button>
+         <el-button type="primary" @click="indexAttrClickAddHandler">纭� 瀹�</el-button>
+        </span>
+      </el-dialog>
+      <span slot="footer" class="dialog-footer">
+         <el-button @click="indexDialogClose">鍙� 娑�</el-button>
+         <el-button type="primary" @click="indexClickAddHandler">淇� 瀛�</el-button>
+        </span>
     </el-dialog>
 
   </el-container>
@@ -478,7 +531,10 @@
   getUsedBtmLinkList,
   checkBtmConsistency,
   executeRepair,
-  getIndexByCondition
+  getIndexByCondition,
+  delIndex,
+  getAllAttributesByBtmId,
+  addIndex
 } from "@/api/modeling/businessType/api"
 import {gridAttribute} from "@/api/modeling/attributePool/api";
 import func from "@/util/func";
@@ -489,7 +545,79 @@
   name: "index",
   data() {
     return {
-      indexVisible:false,
+      indexLoading: false,
+      indexFormRead: false,
+      indexAttrRow: {},
+      indexAttrOption: {
+        ...basicOption,
+        height: 380,
+        highlightCurrentRow: true,
+        addBtn: false,
+        refreshBtn: false,
+        editBtn: false,
+        delBtn: false,
+        selection: false,
+        menu: false,
+        column: [
+          {
+            label: '灞炴�т俊鎭�',
+            prop: 'id',
+            sortable: true,
+          },
+        ]
+      },
+      indexAttrData: [],
+      indexData: [],
+      indexAttrVisible: false,
+      indexLeftNodeRow: {},
+      indexForm: {
+        name: '',
+        desc: ''
+      },
+      indexLeftData: [],
+      indexLeftOption: {
+        height: 'auto',
+        menu: false,
+        addBtn: false,
+        props: {
+          label: 'name',
+          value: 'id',
+          children: 'children',
+        },
+      },
+      indexOption: {
+        ...basicOption,
+        height: 280,
+        addBtn: false,
+        refreshBtn: false,
+        editBtn: false,
+        delBtn: false,
+        selection: false,
+        menu: false,
+        column: [
+          {
+            label: '涓氬姟绫诲瀷鍚嶇О',
+            prop: 'typeName',
+            sortable: true,
+          },
+          {
+            label: '绱㈠紩鍚嶇О',
+            prop: 'indexName',
+            sortable: true,
+          },
+          {
+            label: '灞炴�у悕绉�',
+            prop: 'attrNames',
+            sortable: true,
+          },
+          {
+            label: '鎻忚堪',
+            prop: 'desc',
+            sortable: true,
+          },
+        ]
+      },
+      indexVisible: false,
       conDefaultCheckData: [], // 淇濈暀涓婁釜鎺ュ彛杩斿洖鐨勬暟鎹�
       conCheckLoading: false,
       conCheckOption: {
@@ -1305,9 +1433,9 @@
         if (res.data.code === 200) {
           this.checkViewVisible = true;
           const data = res.data.data.map(item => {
-            return{
-              name:this.nodeRow.id,
-              source:item
+            return {
+              name: this.nodeRow.id,
+              source: item
             }
           });
           this.checkViewData = data;
@@ -1340,12 +1468,14 @@
     },
 
     // 涓�鑷存�ф鏌ユ寜閽偣鍑�
-    checkClickHandler(){
-      checkBtmConsistency().then(res =>{
-        if(res && res.data && res.data.data){
+    checkClickHandler() {
+      this.createViewLoading = true;
+      checkBtmConsistency().then(res => {
+        this.createViewLoading = false;
+        if (res && res.data && res.data.data) {
           this.conCheckVisible = true;
           this.conCheckLoading = true;
-          if(res.data.code === 200){
+          if (res.data.code === 200) {
             const data = res.data.data[0];
             this.conDefaultCheckData = data; // 淇濈暀涓�浠藉師濮嬫暟鎹�
             this.conCheckLoading = false;
@@ -1374,7 +1504,7 @@
             })
             this.conCheckData = outputData;
           }
-        }else {
+        } else {
           this.$message.success(res.data.msg);
         }
       })
@@ -1395,17 +1525,130 @@
     },
 
     // 鍒涘缓绱㈠紩鎸夐挳鐐瑰嚮
-    indexClickHandler(){
-      if(func.isEmptyObject(this.nodeRow)){
+    indexClickHandler() {
+      if (func.isEmptyObject(this.nodeRow)) {
         this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�');
         return;
       }
+      this.getLeftIndex();
+      this.indexVisible = true;
+    },
+
+    // 宸︿晶鏍戞洿鏂�
+    getLeftIndex() {
       const params = {
-        "conditionMap[typename]":this.nodeRow.id
+        "conditionMap[typename]": this.nodeRow.id
       }
       getIndexByCondition(params).then(res => {
-        console.log(res);
+        if (res.data.code === 200) {
+          const data = res.data.data.map(item => {
+            return {
+              indexName: item.indexName,
+              name: `${item.indexName} ${item.attrNames}`,
+              id: item.oid
+            }
+          })
+          this.indexLeftData = data;
+        }
       })
+    },
+
+    // 绱㈠紩宸︿晶鏍戠偣鍑�
+    indexLeftNodeClick(row) {
+      this.indexLeftNodeRow = row;
+    },
+
+    // 鍒犻櫎宸︿晶鏍戠储寮�
+    deleteIndexLeftTreeClickHandler() {
+      if (func.isEmptyObject(this.indexLeftNodeRow)) {
+        this.$message.error('璇烽�夋嫨涓�鏉℃暟鎹繘琛屽垹闄�');
+        return;
+      }
+      const params = {
+        btmName: this.nodeRow.id,
+        indexName: this.indexLeftNodeRow.indexName
+      };
+      delIndex(params).then(res => {
+        if (res.data.code === 200) {
+          this.$message.success('鍒犻櫎绱㈠紩鎴愬姛');
+          this.getLeftIndex();
+        }
+      })
+    },
+
+    //鍙充晶琛ㄦ牸娣诲姞灞炴��
+    indexAttrClickAddHandler() {
+      if (func.isEmptyObject(this.indexAttrRow)) {
+        this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�');
+        return;
+      }
+      this.indexData.push(
+        {
+          typeName: this.nodeRow.id,
+          attrNames: this.indexAttrRow.id,
+          indexName: this.indexForm.name,
+          desc: this.indexForm.desc
+        }
+      )
+      this.indexFormRead = true;
+      this.indexAttrVisible = false;
+    },
+
+    // 鍙充晶灞炴�ц〃鏍艰鐐瑰嚮
+    indexAttrRowClick(row) {
+      this.indexAttrRow = row;
+    },
+
+    // 鍙充晶琛ㄦ牸澧炲姞
+    rightIndexAddClick() {
+      if (!this.indexForm.name) {
+        this.$message.error('璇疯緭鍏ョ储寮曞悕绉�');
+        return;
+      }
+
+      // 妫�鏌ユ槸鍚︿负鑻辨枃瀛楃
+      const englishRegex = /^[A-Za-z]+$/;
+      if (!englishRegex.test(this.indexForm.name)) {
+        this.$message.error('绱㈠紩鍚嶇О鍙兘鍖呭惈鑻辨枃瀛楃');
+        return;
+      }
+      this.indexLoading = true;
+      getAllAttributesByBtmId({btmId: this.nodeRow.id}).then(res => {
+        if (res.data.code === 200) {
+          const data = res.data.data.map(item => {
+            return {
+              id: item.id
+            }
+          })
+          this.indexAttrData = data;
+        }
+        this.indexLoading = false;
+        this.indexAttrVisible = true;
+      })
+    },
+
+    // 鍒涘缓淇濆瓨绱㈠紩
+    indexClickAddHandler() {
+      const params = {
+        typeName: this.nodeRow.id,
+        attrNames: this.indexData.map(item => item.attrNames).join(','),
+        indexName: this.indexForm.name,
+      }
+      addIndex([params]).then(res => {
+        console.log(res)
+        this.$message.success('鍒涘缓鎴愬姛');
+        this.indexDialogClose();
+      }).catch(err => {
+        this.indexDialogClose();
+      })
+    },
+
+    // 绱㈠紩瀵硅瘽妗嗗彇娑�
+    indexDialogClose() {
+      this.indexFormRead = false;
+      this.indexForm = {};
+      this.indexData = [];
+      this.indexVisible = false;
     }
   }
 }

--
Gitblit v1.9.3