From 8bc25357d5742f07710baa7a6f1d6ac4023da3ac Mon Sep 17 00:00:00 2001
From: wangting <wangting@vci-tech.com>
Date: 星期三, 25 十二月 2024 12:00:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/plt-web/plt-web-ui/src/views/systemModel/systemConfig/index.vue |  452 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 450 insertions(+), 2 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/systemModel/systemConfig/index.vue b/Source/plt-web/plt-web-ui/src/views/systemModel/systemConfig/index.vue
index 54b19c1..fdf5ef9 100644
--- a/Source/plt-web/plt-web-ui/src/views/systemModel/systemConfig/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/systemModel/systemConfig/index.vue
@@ -1,10 +1,458 @@
-<template>
+  <template>
+  <el-container>
+    <el-aside>
+      <basic-container>
+        <div style="max-height: calc(100vh - 150px);overflow: auto">
+          <avue-tree :key="refresh" ref="tree" :data="treeData" :option="treeOption" @node-click="nodeClick">
+          <span slot-scope="{ node, data }" class="el-tree-node__label">
+           <span>
+              <i class="el-icon-s-promotion"></i>
+                {{ (node || {}).label }}
+            </span>
+          </span>
+          </avue-tree>
+        </div>
+      </basic-container>
+    </el-aside>
+    <el-main>
+      <basic-container>
+        <avue-crud
+          ref="crud"
+          :data="configData"
+          :option="nodeRow.id === 'firstNode'? firstOption : configOption"
+          :table-loading="configLoading"
+          @selection-change="selectChange"
+          @row-click="rowClickHandler">
+          <template slot="menuLeft">
+            <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">澧炲姞
+            </el-button>
+            <el-button icon="el-icon-close" plain size="small" type="danger" @click="delClickHandler">鍒犻櫎
+            </el-button>
+            <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭
+            </el-button>
+          </template>
 
+          <template #menu="{row,index,size}">
+            <el-button icon="el-icon-edit" size="small" type="text" @click.stop="rowEditHandler(row,index)">缂栬緫
+            </el-button>
+            <el-button icon="el-icon-delete" size="small" type="text" @click.stop="rowDeleteHandler(row)">鍒犻櫎</el-button>
+          </template>
+        </avue-crud>
+      </basic-container>
+    </el-main>
+    <el-dialog
+      v-dialogDrag
+      :title="nodeRow.id === 'firstNode' ? '閰嶇疆椤瑰垎绫�' : '閰嶇疆椤�'"
+      :visible.sync="addVisible"
+      append-to-body="true"
+      class="avue-dialog"
+      width="600px"
+      @close="addVisibleClose">
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px" size="small">
+        <el-form-item label="鍚嶇О锛�" prop="name">
+          <el-input v-model="form.name" ></el-input>
+        </el-form-item>
+        <el-form-item v-if="nodeRow.id !== 'firstNode'" label="key锛�" prop="key">
+          <el-input v-model="form.key"></el-input>
+        </el-form-item>
+        <el-form-item v-if="nodeRow.id !== 'firstNode'" label="鍊硷細" prop="value">
+          <el-input v-model="form.value"></el-input>
+        </el-form-item>
+        <el-form-item label="鎻忚堪锛�">
+          <el-input v-model="form.desc" type="textarea" prop="desc"></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button size="small" type="primary" @click="addSaveClickHandler">纭� 瀹�</el-button>
+        <el-button size="small" @click="addVisibleClose">鍙� 娑�</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 瀵煎嚭绌挎妗� -->
+    <transfer ref="transfer" :left-role-data="leftRoleData" :right-role-data="rightRoleData"
+              :select-list="selectList" :top-methods-obj="topMethodsObj" :transferTitle="transferTitle" title="瀵煎嚭"
+              @transferSend="exportSendHandler">
+    </transfer>
+  </el-container>
 </template>
 
 <script>
+import {
+  getAppConfigCategoryInfo,
+  getAppConfigDetailsByID,
+  addAppConf,
+  updateAppConf,
+  delAppConf,
+  exportSysConf
+} from "@/api/systemModel/systemConfig/api"
+import basicOption from "@/util/basic-option";
+import func from "@/util/func";
+
 export default {
-  name: "index"
+  name: "index",
+  data() {
+    return {
+      topMethodsObj: {
+        select: true,
+        all: true,
+        page: false
+      },
+      transferTitle: ['鏈�夋嫨', '宸查�夋嫨'],
+      leftRoleData: [],
+      rightRoleData: [],
+      editStatus: false,
+      form: {
+        name: "",
+        key:"",
+        value:"",
+        desc: ""
+      },
+      rules: {
+        name: [
+          {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'}
+        ],
+        key: [{required: true, message: '璇疯緭鍏ey', trigger: 'blur'}],
+        value: [{required: true, message: '璇疯緭鍏ュ��', trigger: 'blur'}]
+      },
+      addVisible: false,
+      nodeRow: {},
+      configLoading: false,
+      configData: [],
+      configOption: {
+        ...basicOption,
+        addBtn: false,
+        editBtn: false,
+        delBtn: false,
+        calcHeight: -50,
+        column: [
+          {
+            label: '鍚嶇О',
+            prop: 'name',
+            sortable: true
+          },
+          {
+            label: 'key',
+            prop: 'key',
+            sortable: true
+          },
+          {
+            label: '鍊�',
+            prop: 'value',
+            overHidden: true,
+            sortable: true
+          },
+          {
+            label: '鎻忚堪',
+            overHidden: true,
+            prop: 'desc',
+          }
+        ]
+      },
+      defaultData: [], // 椤跺眰鑺傜偣鏂板鍚庤祴鍊兼暟缁�
+      firstOption: {
+        ...basicOption,
+        addBtn: false,
+        editBtn: false,
+        delBtn: false,
+        column: [
+          {
+            label: '鍚嶇О',
+            prop: 'name',
+            sortable: true
+          },
+          {
+            label: '鎻忚堪',
+            prop: 'desc',
+          }
+        ]
+      },
+      refresh: Math.random(),
+      treeOption: {
+        height: 'auto',
+        menu: false,
+        addBtn: false,
+        defaultExpandAll: true,
+        props: {
+          label: 'name',
+          value: 'id',
+          children: 'children',
+        },
+      },
+      treeData: [
+        {
+          name: '绯荤粺閰嶇疆鍒嗙被',
+          id: 'firstNode',
+          children: []
+        }
+      ],
+      selectList: [],
+      lastIndex: null
+    }
+  },
+  created() {
+    this.getTreeList();
+  },
+  methods: {
+    // 宸︿晶鏍戞煡璇�
+    getTreeList(val) {
+      getAppConfigCategoryInfo().then(res => {
+        if (res.data.code === 200) {
+          const data = res.data.data;
+          this.treeData[0].children = data;
+          if (val === 'save') {
+            this.configData = data;
+          }
+        }
+      })
+    },
+
+    // 鏍戣妭鐐圭偣鍑�
+    nodeClick(row) {
+      console.log(row);
+      this.nodeRow = row;
+      if (row.id === 'firstNode') {
+        this.configData = row.children;
+      } else {
+        this.configLoading = true;
+        getAppConfigDetailsByID({clsId: row.id}).then(res => {
+          if (res.data.code === 200) {
+            const data = res.data.data;
+            this.configData = data;
+            this.configLoading = false;
+          }
+        })
+      }
+    },
+
+    // 澧炲姞鎸夐挳
+    addClickHandler() {
+      if (func.isEmptyObject(this.nodeRow)) {
+        this.$message.error('璇烽�夋嫨涓�鏉¤妭鐐硅繘琛屾坊鍔狅紒')
+        return;
+      }
+      this.addVisible = true;
+      this.editStatus = false;
+    },
+
+    // 鏂板瀵硅瘽妗嗗叧闂�
+    addVisibleClose() {
+      Object.keys(this.form).forEach(key => {
+        this.form[key] = "";
+      })
+      this.addVisible = false;
+      this.$refs.form.clearValidate();
+    },
+
+    // 淇濆瓨
+    addSaveClickHandler() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          const params = this.nodeRow.id === 'firstNode' ? {
+            appConfigDetailInfo: {
+              name: this.form.name,
+              desc: this.form.desc,
+              id: this.editStatus ? this.form.id : null
+            },
+            isConfCategorys: true //true琛ㄧず缁欓《灞傛坊鍔犻厤缃」鍒嗙被
+          } : {
+            appConfigDetailInfo: {
+              categoryId: this.nodeRow.id,
+              name: this.form.name,
+              desc: this.form.desc,
+              key: this.form.key,
+              value: this.form.value,
+              id: this.editStatus ? this.form.id : null
+            },
+            isConfCategorys: false //true琛ㄧず缁欓《灞傛坊鍔犻厤缃」鍒嗙被
+          }
+          const saveApi = this.editStatus ? updateAppConf : addAppConf;
+          saveApi(params).then(res => {
+            if (res.data.code === 200) {
+              this.$message.success(res.data.obj);
+              this.addVisibleClose();
+              if (this.nodeRow.id === 'firstNode') {
+                this.getTreeList('save');
+              } else {
+                this.configLoading = true;
+                getAppConfigDetailsByID({clsId: this.nodeRow.id}).then(res => {
+                  if (res.data.code === 200) {
+                    const data = res.data.data;
+                    this.configData = data;
+                    this.configLoading = false;
+                  }
+                })
+              }
+            }
+          })
+        }
+      });
+    },
+
+    // 缂栬緫鎸夐挳
+    rowEditHandler(row) {
+      this.addVisible = true;
+      this.form = {...row};
+      this.editStatus = true;
+    },
+
+    // 琛屽垹闄�
+    rowDeleteHandler(row) {
+      const params = {
+        ids: row.id,
+        isConfCategorys: this.nodeRow.id === 'firstNode' ? true : false
+      }
+      this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎褰撳墠鏁版嵁鍚楋紵', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        delAppConf(params).then(res => {
+          if (res.data.code === 200) {
+            this.$message.success('鍒犻櫎鎴愬姛');
+            if (this.nodeRow.id === 'firstNode') {
+              this.getTreeList('save');
+            } else {
+              this.configLoading = true;
+              getAppConfigDetailsByID({clsId: this.nodeRow.id}).then(res => {
+                if (res.data.code === 200) {
+                  const data = res.data.data;
+                  this.configData = data;
+                  this.configLoading = false;
+                }
+              })
+            }
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '宸插彇娑堝垹闄�'
+        });
+      });
+    },
+
+    // 閫夋嫨妗�
+    selectChange(row) {
+      this.selectList = row;
+    },
+
+    // 鐐瑰嚮琛�
+    rowClickHandler(row) {
+      func.rowClickHandler(
+        row,
+        this.$refs.crud,
+        this.lastIndex,
+        (newIndex) => {
+          this.lastIndex = newIndex;
+        },
+        () => {
+          this.selectList = [];
+        }
+      );
+    },
+
+    // 澶氶�夊垹闄�
+    delClickHandler() {
+      if (this.selectList.length <= 0) {
+        this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�');
+        return;
+      }
+
+      const params = {
+        ids: this.selectList.map(item => {
+          return item.id
+        }).join(','),
+        isConfCategorys: this.nodeRow.id === 'firstNode' ? true : false
+      }
+
+      this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎褰撳墠鏁版嵁鍚楋紵', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        delAppConf(params).then(res => {
+          if (res.data.code === 200) {
+            this.$message.success('鍒犻櫎鎴愬姛');
+            if (this.nodeRow.id === 'firstNode') {
+              this.getTreeList('save');
+            } else {
+              this.configLoading = true;
+              getAppConfigDetailsByID({clsId: this.nodeRow.id}).then(res => {
+                if (res.data.code === 200) {
+                  const data = res.data.data;
+                  this.configData = data;
+                  this.configLoading = false;
+                }
+              })
+            }
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '宸插彇娑堝垹闄�'
+        });
+      });
+    },
+
+    // 瀵煎嚭鎸夐挳
+    exportClickHandler() {
+      if (func.isEmptyObject(this.nodeRow)) {
+        this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�');
+        return;
+      }
+      this.leftRoleData = this.nodeRow.id === 'firstNode' ? [
+        {
+          name: '鍚嶇О',
+          oid: 'name'
+        },
+        {
+          name: '鎻忚堪',
+          oid: 'desc'
+        }
+      ] : [
+        {
+          name: '鍚嶇О',
+          oid: 'name'
+        },
+        {
+          name: 'key',
+          oid: 'key'
+        },
+        {
+          name: 'value',
+          oid: 'value'
+        },
+        {
+          name: '鎻忚堪',
+          oid: 'desc'
+        }
+      ]
+      this.$refs.transfer.visible = true;
+    },
+
+    // 瀵煎嚭淇濆瓨
+    exportSendHandler(row, index) {
+      console.log(row, index);
+      const params = {
+        expType: index === 0 ? 'select' : index === 1 ? 'all' : '',
+        expAttrNames: row,
+        selectDataIdentify: index === 0 ? this.selectList.map(item => {
+          return item.id
+        }) : null,
+        conditionMap: {
+          "isExpAppConfDetail": this.nodeRow.id === 'firstNode' ? false : true,
+          "clsId": this.nodeRow.id !== 'firstNode' ? this.nodeRow.id : null
+        }
+      }
+      exportSysConf(params).then(res => {
+        func.downloadFileByBlobHandler(res);
+        this.$message.success('瀵煎嚭鎴愬姛');
+      }).catch(err => {
+        this.$message.error(err);
+      })
+    }
+  }
 }
 </script>
 

--
Gitblit v1.9.3