From ffd0af47ee31a9592cfab56a907e9841a9113c52 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 20 七月 2023 10:37:17 +0800
Subject: [PATCH] 代码提交,前端代码打包

---
 Source/UBCS-WEB/dist/src/views/base/region.vue |  429 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 429 insertions(+), 0 deletions(-)

diff --git a/Source/UBCS-WEB/dist/src/views/base/region.vue b/Source/UBCS-WEB/dist/src/views/base/region.vue
new file mode 100644
index 0000000..e080546
--- /dev/null
+++ b/Source/UBCS-WEB/dist/src/views/base/region.vue
@@ -0,0 +1,429 @@
+<template>
+  <el-row>
+    <el-col :span="9">
+      <div class="box">
+        <el-scrollbar>
+          <basic-container>
+            <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
+          </basic-container>
+        </el-scrollbar>
+      </div>
+    </el-col>
+    <el-col :span="15">
+      <basic-container>
+        <el-button-group>
+          <el-button v-if="permission.region_add" type="primary" size="small" icon="el-icon-circle-plus-outline" @click="addChildren">鏂板涓嬬骇</el-button>
+          <el-button v-if="permission.region_delete" type="primary" size="small" icon="el-icon-delete" @click="handleDelete">鍒犻櫎</el-button>
+          <el-button v-if="permission.region_import" type="primary" size="small" icon="el-icon-upload2" @click="handleImport">瀵煎叆</el-button>
+          <el-button v-if="permission.region_export" type="primary" size="small" icon="el-icon-download" @click="handleExport">瀵煎嚭</el-button>
+          <el-button v-if="permission.region_debug" type="primary" size="small" icon="el-icon-video-play" @click="handleDebug">璋冭瘯</el-button>
+        </el-button-group>
+      </basic-container>
+      <basic-container>
+        <avue-form ref="form" :option="regionOption" v-model="regionForm" @submit="handleSubmit">
+          <template slot="code" slot-scope="{}">
+            <el-input placeholder="璇疯緭鍏� 鍖哄垝瀛愮紪鍙�" v-model="regionForm.subCode">
+              <template slot="prepend">{{regionForm.parentCode}}</template>
+            </el-input>
+          </template>
+        </avue-form>
+        <el-dialog title="琛屾斂鍖哄垝鏁版嵁瀵煎叆"
+                   append-to-body
+                   :visible.sync="excelBox"
+                   width="555px">
+          <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
+            <template slot="excelTemplate">
+              <el-button type="primary" @click="handleTemplate">
+                鐐瑰嚮涓嬭浇<i class="el-icon-download el-icon--right"></i>
+              </el-button>
+            </template>
+          </avue-form>
+        </el-dialog>
+        <el-dialog title="琛屾斂鍖哄垝鏁版嵁璋冭瘯"
+                   append-to-body
+                   :visible.sync="debugBox"
+                   width="350px">
+          <avue-form :option="debugOption" v-model="debugForm"/>
+        </el-dialog>
+      </basic-container>
+    </el-col>
+  </el-row>
+</template>
+
+<script>
+  import {getLazyTree, getDetail, submit, remove} from "@/api/base/region";
+  import {exportBlob} from "@/api/common";
+  import {mapGetters} from "vuex";
+  import {validatenull} from "@/util/validate";
+  import {downloadXls} from "@/util/util";
+  import {dateNow} from "@/util/date";
+  import {getToken} from "@/util/auth";
+  import NProgress from 'nprogress';
+  import 'nprogress/nprogress.css';
+
+  export default {
+    data() {
+      return {
+        topCode: '00',
+        treeCode: '',
+        treeParentCode: '',
+        treeData: [],
+        treeOption: {
+          nodeKey: 'id',
+          lazy: true,
+          treeLoad: function (node, resolve) {
+            const parentCode = (node.level === 0) ? "00" : node.data.id;
+            getLazyTree(parentCode).then(res => {
+              resolve(res.data.data.map(item => {
+                return {
+                  ...item,
+                  leaf: !item.hasChildren
+                }
+              }))
+            });
+          },
+          addBtn: false,
+          menu: false,
+          size: 'small',
+          props: {
+            labelText: '鏍囬',
+            label: 'title',
+            value: 'value',
+            children: 'children'
+          }
+        },
+        regionForm: {},
+        regionOption: {
+          labelWidth: 100,
+          column: [
+            {
+              label: "鐖跺尯鍒掔紪鍙�",
+              prop: "parentCode",
+              span: 24,
+              disabled: true,
+              rules: [{
+                required: true,
+                message: "璇疯緭鍏ョ埗鍖哄垝缂栧彿",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "鐖跺尯鍒掑悕绉�",
+              prop: "parentName",
+              span: 24,
+              disabled: true,
+            },
+            {
+              label: "鍖哄垝缂栧彿",
+              prop: "code",
+              formslot: true,
+              span: 24,
+              rules: [{
+                required: true,
+                message: "璇疯緭鍏ュ尯鍒掔紪鍙�",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "鍖哄垝瀛愮紪鍙�",
+              prop: "subCode",
+              display: false,
+            },
+            {
+              label: "鍖哄垝鍚嶇О",
+              prop: "name",
+              span: 24,
+              rules: [{
+                required: true,
+                message: "璇疯緭鍏ュ尯鍒掑悕绉�",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "鍖哄垝绛夌骇",
+              prop: "regionLevel",
+              type: "radio",
+              dicUrl: "/api/ubcs-system/dict/dictionary?code=region",
+              props: {
+                label: "dictValue",
+                value: "dictKey"
+              },
+              dataType: "number",
+              span: 24,
+              rules: [{
+                required: true,
+                message: "璇烽�夋嫨鍖哄垝绛夌骇",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "鍖哄垝鎺掑簭",
+              prop: "sort",
+              type: "number",
+              span: 24,
+              rules: [{
+                required: true,
+                message: "璇疯緭鍏ュ尯鍒掓帓搴�",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "鍖哄垝澶囨敞",
+              prop: "remark",
+              type: "textarea",
+              minRows: 6,
+              span: 24,
+            },
+          ]
+        },
+        excelBox: false,
+        excelForm: {},
+        excelOption: {
+          submitBtn: false,
+          emptyBtn: false,
+          column: [
+            {
+              label: '妯℃澘涓婁紶',
+              prop: 'excelFile',
+              type: 'upload',
+              drag: true,
+              loadText: '妯℃澘涓婁紶涓紝璇风◢绛�',
+              span: 24,
+              propsHttp: {
+                res: 'data'
+              },
+              tip: '璇蜂笂浼� .xls,.xlsx 鏍囧噯鏍煎紡鏂囦欢',
+              action: "/api/ubcs-system/region/import-region"
+            },
+            {
+              label: "鏁版嵁瑕嗙洊",
+              prop: "isCovered",
+              type: "switch",
+              align: "center",
+              width: 80,
+              dicData: [
+                {
+                  label: "鍚�",
+                  value: 0
+                },
+                {
+                  label: "鏄�",
+                  value: 1
+                }
+              ],
+              value: 0,
+              slot: true,
+              rules: [
+                {
+                  required: true,
+                  message: "璇烽�夋嫨鏄惁瑕嗙洊",
+                  trigger: "blur"
+                }
+              ]
+            },
+            {
+              label: '妯℃澘涓嬭浇',
+              prop: 'excelTemplate',
+              formslot: true,
+              span: 24,
+            }
+          ]
+        },
+        debugBox: false,
+        debugForm: {},
+        debugOption: {
+          labelWidth: 50,
+          submitBtn: false,
+          emptyBtn: false,
+          column: [
+            {
+              label: '鐪佷唤',
+              prop: 'province',
+              type: 'select',
+              props: {
+                label: 'name',
+                value: 'code'
+              },
+              cascader: ['city'],
+              dicUrl: '/api/ubcs-system/region/select',
+              span: 24,
+            },
+            {
+              label: '鍦板競',
+              prop: 'city',
+              type: 'select',
+              props: {
+                label: 'name',
+                value: 'code'
+              },
+              cascader: ['district'],
+              dicFlag: false,
+              dicUrl: '/api/ubcs-system/region/select?code={{province}}',
+              span: 24,
+            },
+            {
+              label: '鍖哄幙',
+              prop: 'district',
+              type: 'select',
+              props: {
+                label: 'name',
+                value: 'code'
+              },
+              dicFlag: false,
+              dicUrl: '/api/ubcs-system/region/select?code={{city}}',
+              span: 24,
+            }
+          ]
+        }
+      };
+    },
+    watch: {
+      'regionForm.subCode'() {
+        this.regionForm.code = this.regionForm.parentCode + this.regionForm.subCode;
+      },
+      'excelForm.isCovered'() {
+        if (this.excelForm.isCovered !== '') {
+          const column = this.findObject(this.excelOption.column, "excelFile");
+          column.action = `/api/ubcs-system/region/import-region?isCovered=${this.excelForm.isCovered}`;
+        }
+      }
+    },
+    computed: {
+      ...mapGetters(["permission"]),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permission.region_add, false),
+          viewBtn: this.vaildData(this.permission.region_view, false),
+          delBtn: this.vaildData(this.permission.region_delete, false),
+          editBtn: this.vaildData(this.permission.region_edit, false)
+        };
+      },
+      ids() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids.join(",");
+      }
+    },
+    methods: {
+      initTree() {
+        this.treeData = [];
+        getLazyTree(this.topCode).then(res => {
+          this.treeData = res.data.data.map(item => {
+            return {
+              ...item,
+              leaf: !item.hasChildren
+            }
+          })
+        });
+      },
+      nodeClick(data) {
+        const column = this.findObject(this.regionOption.column, "parentCode");
+        column.disabled = true;
+        this.treeCode = data.id;
+        this.treeParentCode = data.parentId;
+        getDetail(this.treeCode).then(res => {
+          this.regionForm = res.data.data;
+          this.regionForm.subCode = this.regionForm.code.replace(this.regionForm.parentCode, '');
+        })
+      },
+      addChildren() {
+        if (validatenull(this.regionForm.code) || validatenull(this.regionForm.name)) {
+          this.$message.warning("璇峰厛閫夋嫨涓�椤瑰尯鍒�");
+          return;
+        }
+        this.regionForm.parentCode = this.regionForm.code;
+        this.regionForm.parentName = this.regionForm.name;
+        this.regionForm.code = '';
+        this.regionForm.subCode = '';
+        this.regionForm.name = '';
+        this.regionForm.regionLevel = (this.regionForm.regionLevel === 5) ? 5 : this.regionForm.regionLevel + 1;
+      },
+      handleSubmit(form, done, loading) {
+        const parentCode = form.parentCode === this.topCode ? '' : form.parentCode;
+        form.code = parentCode + form.subCode;
+        submit(form).then(() => {
+          this.$message({
+            type: "success",
+            message: "鎿嶄綔鎴愬姛!"
+          });
+          this.initTree();
+          this.regionForm.subCode = '';
+          this.$refs.form.resetForm();
+          done();
+        }, error => {
+          loading();
+          window.console.log(error);
+        });
+      },
+      handleDelete() {
+        if (validatenull(this.regionForm.code)) {
+          this.$message.warning("璇峰厛閫夋嫨涓�椤瑰尯鍒�");
+          return;
+        }
+        this.$confirm(`纭畾灏� [${this.regionForm.name}] 鏁版嵁鍒犻櫎?`, {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(this.treeCode);
+          })
+          .then(() => {
+            this.$message({
+              type: "success",
+              message: "鎿嶄綔鎴愬姛!"
+            });
+            this.initTree();
+            this.regionForm.subCode = '';
+            this.$refs.form.resetForm();
+          });
+      },
+      uploadAfter(res, done, loading, column) {
+        window.console.log(column);
+        this.excelBox = false;
+        this.initTree();
+        done();
+      },
+      handleDebug() {
+        this.debugBox = true;
+      },
+      handleImport() {
+        this.excelBox = true;
+      },
+      handleExport() {
+        this.$confirm("鏄惁瀵煎嚭琛屾斂鍖哄垝鏁版嵁?", "鎻愮ず", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning"
+        }).then(() => {
+          NProgress.start();
+          exportBlob(`/api/ubcs-system/region/export-region?${this.website.tokenHeader}=${getToken()}`).then(res => {
+            downloadXls(res.data, `琛屾斂鍖哄垝鏁版嵁${dateNow()}.xlsx`);
+            NProgress.done();
+          })
+        });
+      },
+      handleTemplate() {
+        exportBlob(`/api/ubcs-system/region/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
+          downloadXls(res.data, "琛屾斂鍖哄垝妯℃澘.xlsx");
+        })
+      },
+    }
+  };
+</script>
+
+<style>
+  .box {
+    height: 800px;
+  }
+
+  .el-scrollbar {
+    height: 100%;
+  }
+
+  .box .el-scrollbar__wrap {
+    overflow: scroll;
+  }
+</style>

--
Gitblit v1.9.3