From 247aa6397ebdb5249a1213af11aaaf560568b0c3 Mon Sep 17 00:00:00 2001
From: yuxc <yuxc@vci-tech.com>
Date: 星期五, 02 八月 2024 15:43:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue |  483 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 480 insertions(+), 3 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue
index a042dbb..cecfaa4 100644
--- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue
@@ -1,13 +1,490 @@
 <template>
-  <p>鐗堟湰绠$悊</p>
+  <el-container>
+    <el-aside>
+      <basic-container>
+        <div ref="TreeBox" style="height: calc(100vh - 144px);!important;">
+          <div class="headerCon">
+            <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓
+            </el-button>
+            <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editClickHandler">淇敼
+            </el-button>
+            <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delClickHandler">鍒犻櫎
+            </el-button>
+            <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭
+            </el-button>
+            <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">瀵煎叆
+            </el-button>
+            <el-button plain size="small" style="width: 100px;text-align: center" type="primary"
+                       @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿
+            </el-button>
+          </div>
+          <!-- 宸︿晶鏍�         -->
+          <div style="height:  calc(100vh - 300px);">
+            <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick">
+          <span slot-scope="{ node, data }" class="el-tree-node__label">
+           <span style="font-size: 15px">
+              <i class="el-icon-s-promotion"></i>
+                {{ (node || {}).label }}
+            </span>
+          </span>
+            </avue-tree>
+          </div>
+        </div>
+      </basic-container>
+    </el-aside>
+
+    <el-main>
+      <basic-container>
+        <el-descriptions :column="1" border class="margin-top" size="medium" title="灞炴�т俊鎭�">
+          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
+                                :labelStyle="descriptionOption.labelStyle">
+            <template slot="label">
+              <i :class="icons.id"></i>
+              鍚嶇О
+            </template>
+            <el-tag v-if="nodeRow.id">{{ nodeRow.id }}</el-tag>
+          </el-descriptions-item>
+          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
+                                :labelStyle="descriptionOption.labelStyle">
+            <template slot="label">
+              <i :class="icons.name"></i>
+              鏍囩
+            </template>
+            <el-tag v-if="nodeRow.name">{{ nodeRow.name }}</el-tag>
+          </el-descriptions-item>
+          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
+                                :labelStyle="descriptionOption.labelStyle">
+            <template slot="label">
+              <i :class="icons.jump"></i>
+              璺宠穬瀛楃
+            </template>
+            <el-tag v-if="nodeRow.jumpCharacter">{{ nodeRow.jumpCharacter }}</el-tag>
+          </el-descriptions-item>
+          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
+                                :labelStyle="descriptionOption.labelStyle">
+            <template slot="label">
+              <i :class="icons.init"></i>
+              鍒濆鍊�
+            </template>
+            <el-tag v-if="nodeRow.initialValue">{{ nodeRow.initialValue }}</el-tag>
+          </el-descriptions-item>
+          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
+                                :labelStyle="descriptionOption.labelStyle">
+            <template slot="label">
+              <i :class="icons.length"></i>
+              姝ラ暱
+            </template>
+            <el-tag v-if="nodeRow.stepLength">{{ nodeRow.stepLength }}</el-tag>
+          </el-descriptions-item>
+          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
+                                :labelStyle="descriptionOption.labelStyle">
+            <template slot="label">
+              <i :class="icons.left"></i>
+              鍓嶇紑
+            </template>
+            <el-tag v-if="nodeRow.prefixion">{{ nodeRow.prefixion }}</el-tag>
+          </el-descriptions-item>
+          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
+                                :labelStyle="descriptionOption.labelStyle">
+            <template slot="label">
+              <i :class="icons.right"></i>
+              鍚庣紑
+            </template>
+            <el-tag v-if="nodeRow.suffix">{{ nodeRow.suffix }}</el-tag>
+          </el-descriptions-item>
+          <el-descriptions-item :contentStyle="descriptionOption.contentStyle"
+                                :labelStyle="descriptionOption.labelStyle">
+            <template slot="label">
+              <i :class="icons.desc"></i>
+              鎻忚堪
+            </template>
+            <el-tag v-if="nodeRow.description">{{ nodeRow.description }}</el-tag>
+          </el-descriptions-item>
+        </el-descriptions>
+      </basic-container>
+    </el-main>
+
+    <!-- 鏂板 淇敼   -->
+    <el-dialog
+      v-dialogDrag
+      :title="dialogTitle === 'add' ? '鍒涘缓' : '淇敼'"
+      :visible.sync="visible"
+      append-to-body="true"
+      class="avue-dialog"
+      width="40%"
+      @close="visibleCloseHandler"
+    >
+      <el-form ref="form" :model="form" :rules="rules" label-width="95px">
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="鍚嶇О锛�" prop="id">
+              <el-input v-model="form.id"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鏍囩锛�" prop="name">
+              <el-input v-model="form.name"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="璺宠穬瀛楃锛�" prop="jumpCharacter">
+              <el-input v-model="form.jumpCharacter"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鍒濆鍊硷細" prop="initialValue">
+              <el-input v-model="form.initialValue"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="姝ラ暱锛�" prop="stepLength">
+              <el-input-number v-model="form.stepLength" :max="9" :min="1" label="鎻忚堪鏂囧瓧"></el-input-number>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鍓嶇紑锛�" prop="prefixion">
+              <el-input v-model="form.prefixion"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鍚庣紑锛�" prop="suffix">
+              <el-input v-model="form.suffix"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="鎻忚堪锛�" prop="description">
+              <el-input v-model="form.description" :rows="2" type="textarea"></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+         <el-button @click="visibleCloseHandler">鍙� 娑�</el-button>
+         <el-button type="primary" @click="addSaveHandler">纭� 瀹�</el-button>
+        </span>
+    </el-dialog>
+
+    <!-- 瀵煎叆    -->
+    <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆"
+                 @updata="getTreeList"></upload-file>
+
+    <!-- 鏌ョ湅浣跨敤鑼冨洿    -->
+    <el-dialog
+      v-dialogDrag
+      :visible.sync="checkViewVisible"
+      append-to-body="true"
+      class="avue-dialog"
+      title="鏌ョ湅浣跨敤鑼冨洿"
+      width="60%"
+    >
+      <avue-crud
+        ref="checkViewCrud"
+        :data="checkViewData"
+        :option="checkViewOption"
+        :table-loading="checkViewLoading"
+        @search-change="checkHandleSearch"
+        @search-reset="checkHandleReset"
+      >
+      </avue-crud>
+    </el-dialog>
+  </el-container>
 </template>
 
 <script>
+import {
+  getVersionRuleAllList,
+  addVersionRule,
+  updateVersionRule,
+  deleteVersionRule,
+  exportVersionRule,
+  getUsedVersionRuleList
+} from "@/api/modeling/version/api";
+import func from "@/util/func";
+import basicOption from "@/util/basic-option";
+
 export default {
-  name: "index"
+  name: "index",
+  data() {
+    return {
+      checkViewVisible: false,
+      checkViewData: [],
+      checkViewDataSearch: [],
+      checkViewLoading: false,
+      checkViewOption: {
+        ...basicOption,
+        addBtn: false,
+        menu: false,
+        searchMenuSpan: 8,
+        refreshBtn: false,
+        selection: false,
+        column: [
+          {
+            label: '鍚嶇О',
+            prop: 'versionRuleName',
+            sortable: true,
+          },
+          {
+            label: '鏉ユ簮',
+            prop: 'source',
+            sortable: true,
+            search: true
+          },
+          {
+            label: '璇存槑',
+            prop: 'description',
+          }
+        ]
+      },
+      tipList: [
+        "鍚嶇О涓嶈兘涓虹┖涓斿彧鑳借緭鍏ヨ嫳鏂囧瓧绗�",
+        "璺宠穬瀛楃鍙兘杈撳叆鏁板瓧鎴栧瓧姣嶏紝骞朵笖浠ヨ嫳鏂囬�楀彿鍒嗛殧",
+        "鍒濆鍊煎彧鑳借緭鍏ユ暟瀛椼�佸瓧姣嶆垨鑻辨枃绗﹀彿",
+        "姝ラ暱涓嶈兘涓虹┖涓斿繀椤讳负1-9鐨勬暣鏁�",
+      ],
+      upFileType: ['xls', 'xlsx'],
+      fileUrl: 'api/revisionRuleController/importVersionRules',
+      rules: {
+        id: [
+          {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'},
+          {pattern: /^[a-zA-Z]+$/, message: '鍙兘杈撳叆鑻辨枃瀛楃', trigger: 'blur'}
+        ],
+        initialValue: [
+          {required: true, message: '璇疯緭鍏ュ垵濮嬪��', trigger: 'blur'},
+          {pattern: /^[a-zA-Z0-9!@#$%^&*()_+{}\[\]:;"'<>,.?/\\|-]*$/, message: '鍙兘杈撳叆鏁板瓧銆佸瓧姣嶆垨鑻辨枃绗﹀彿', trigger: 'blur'}
+        ],
+        jumpCharacter: [
+          {required: true, message: '璇疯緭鍏ヨ烦璺冨瓧绗�', trigger: 'blur'},
+          {pattern: /^[a-zA-Z0-9]+(?:,[a-zA-Z0-9]+)*$/, message: '鍙兘杈撳叆鏁板瓧鎴栧瓧姣嶏紝骞朵笖浠ラ�楀彿鍒嗛殧', trigger: 'blur'}
+        ]
+      },
+      form: {
+        id: '',
+        name: '',
+        jumpCharacter: '',
+        initialValue: '',
+        stepLength: 1,
+        prefixion: '',
+        suffix: '',
+        description: ''
+      },
+      visible: false,
+      dialogTitle: '',
+      nodeRow: {},
+      treeData: [],
+      treeOption: {
+        height: 'auto',
+        defaultExpandAll: false,
+        menu: false,
+        addBtn: false,
+        props: {
+          label: 'id',
+          value: 'id',
+          children: 'children'
+        }
+      },
+      descriptionOption: {
+        labelStyle: 'text-align:center;width:120px',
+        contentStyle: 'width:240px;text-align:center;word-break;break-all;'
+      },
+      icons: {
+        id: 'el-icon-finished',
+        name: 'el-icon-tickets',
+        jump: 'el-icon-mouse',
+        init: 'el-icon-s-promotion',
+        length: 'el-icon-collection-tag',
+        left: 'el-icon-caret-left',
+        right: 'el-icon-caret-right',
+        desc: 'el-icon-chat-line-square'
+      },
+    }
+  },
+  created() {
+    this.getTreeList();
+  },
+  methods: {
+    //宸︿晶鏍戞煡璇�
+    getTreeList() {
+      getVersionRuleAllList().then(res => {
+        console.log(res);
+        const data = res.data.data;
+        this.treeData = data;
+      }).catch(err => {
+        this.$message.error(err)
+      });
+    },
+
+    // 宸︿晶鏍戣鐐瑰嚮
+    nodeClick(row) {
+      this.nodeRow = row;
+    },
+
+    // 鍒涘缓鎸夐挳
+    addClickHandler() {
+      this.dialogTitle = 'add';
+      this.visible = true;
+    },
+
+    // 淇敼鎸夐挳
+    editClickHandler() {
+      if (func.isEmptyObject(this.nodeRow)) {
+        this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
+        return;
+      }
+      this.visible = true;
+      this.dialogTitle = 'edit';
+      this.form = this.nodeRow;
+    },
+
+    // 鏂板淇敼瀵硅瘽妗嗗叧闂�
+    visibleCloseHandler() {
+      const form = {
+        id: '',
+        name: '',
+        jumpCharacter: '',
+        initialValue: '',
+        stepLength: 1,
+        prefixion: '',
+        suffix: '',
+        description: ''
+      }
+      this.form = form;
+      this.visible = false;
+      this.$refs.form.clearValidate();
+    },
+
+    // 鏂板 缂栬緫 淇濆瓨
+    addSaveHandler() {
+      const saveFunction = this.dialogTitle === 'add' ? addVersionRule : updateVersionRule;
+
+      saveFunction(this.form).then(res => {
+        if (res.data.code === 200) {
+          this.$message.success(res.data.obj);
+          this.getTreeList();
+          this.visible = false;
+        } else {
+          this.$message.error(res.data.obj);
+        }
+      }).catch(error => {
+        this.$message.error(error);
+      });
+    },
+
+    // 鍒犻櫎鎸夐挳
+    delClickHandler() {
+      if (func.isEmptyObject(this.nodeRow)) {
+        this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
+        return;
+      }
+      this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        const list = [this.nodeRow];
+        deleteVersionRule(list).then(res => {
+          if (res.data.code === 200) {
+            this.$message.success(res.data.obj);
+            this.getTreeList();
+            this.nodeRow = {};
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '宸插彇娑堝垹闄�'
+        });
+      });
+    },
+
+    // 瀵煎嚭
+    exportClickHandler() {
+      if (func.isEmptyObject(this.nodeRow)) {
+        this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
+        return;
+      }
+
+      exportVersionRule({vrNames: this.nodeRow.id}).then(res => {
+        func.downloadFileByBlobHandler(res);
+        this.$message.success('瀵煎嚭鎴愬姛');
+      }).catch(err => {
+        this.$message.error(err);
+      })
+    },
+
+    // 瀵煎叆
+    uploadClickHandler() {
+      this.$refs.upload.visible = true;
+    },
+
+    // 鏌ョ湅浣跨敤鑼冨洿
+    checkViewClickHandler() {
+      if (func.isEmptyObject(this.nodeRow)) {
+        this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
+        return;
+      }
+      getUsedVersionRuleList({vrName: this.nodeRow.id}).then(res => {
+        if (res.data.code === 200) {
+          this.checkViewVisible = true;
+          const data = res.data.data;
+          this.checkViewData = res.data.data;
+          this.checkViewDataSearch = res.data.data;
+        }
+      })
+    },
+
+    // 鏌ョ湅浣跨敤鑼冨洿鏌ヨ
+    checkHandleSearch(params, done) {
+      const {source} = params;
+
+      if (!params.source) {
+        this.checkViewData = this.checkViewDataSearch;
+        return done();
+      }
+      ;
+
+      this.checkViewData = this.checkViewData.filter(item => {
+        return item.source && item.source.includes(source);
+      });
+
+      done();
+
+    },
+
+    // 鏌ョ湅浣跨敤鑼冨洿閲嶇疆
+    checkHandleReset() {
+      this.checkViewData = this.checkViewDataSearch;
+    },
+  }
 }
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
+::v-deep {
+  .el-scrollbar__wrap {
+    overflow: auto !important;
+  }
+}
+
+.headerCon {
+  display: flex;
+  flex-wrap: wrap;
+  margin-bottom: 5px;
+
+  .el-button + .el-button {
+    margin-left: 5px;
+  }
+
+  .el-button {
+    margin-top: 5px;
+  }
+}
+
+.headerCon > .el-button:nth-child(4) {
+  margin-left: 0;
+}
+
+.headerCon > .el-button:nth-child(7) {
+  margin-left: 0;
+}
 
 </style>

--
Gitblit v1.9.3