From 2b1f7a47394363e95deb4dfa0f1c67d41e747f7f Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 01 二月 2023 10:56:40 +0800
Subject: [PATCH] Merge branch 'wvp-28181-2.0' into fix-269

---
 web_src/src/components/dialog/catalogEdit.vue |  149 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 149 insertions(+), 0 deletions(-)

diff --git a/web_src/src/components/dialog/catalogEdit.vue b/web_src/src/components/dialog/catalogEdit.vue
new file mode 100644
index 0000000..e1cd8d2
--- /dev/null
+++ b/web_src/src/components/dialog/catalogEdit.vue
@@ -0,0 +1,149 @@
+<template>
+  <div id="catalogEdit" v-loading="isLoging">
+    <el-dialog
+      title="鑺傜偣缂栬緫"
+      width="40%"
+      top="2rem"
+      :append-to-body="true"
+      :close-on-click-modal="false"
+      :visible.sync="showDialog"
+      :destroy-on-close="true"
+      @close="close()"
+    >
+      <div id="shared" style="margin-top: 1rem;margin-right: 100px;">
+        <el-form ref="form" :rules="rules" :model="form" label-width="140px" >
+<!--          <el-form-item >-->
+<!--            寤鸿鐨勭被鍨嬶細-->
+<!--            <br/>-->
+<!--            &emsp;&emsp;琛屾斂鍖哄垝锛堝彲閫�2浣�/4浣�/6浣�/8浣�/10浣嶆暟瀛楋紝渚嬪锛�130432锛岃〃绀烘渤鍖楃渷閭兏甯傚箍骞冲幙锛�-->
+<!--            <br/>-->
+<!--            &emsp;&emsp;涓氬姟鍒嗙粍锛堢11銆�12銆�13浣�215锛屼緥濡傦細34020000002150000001锛�-->
+<!--            <br/>-->
+<!--            &emsp;&emsp;铏氭嫙缁勭粐锛堢11銆�12銆�13浣�216锛屼緥濡傦細34020000002160000001锛�-->
+<!--          </el-form-item>-->
+          <el-form-item label="鑺傜偣缂栧彿" prop="id" >
+            <el-input v-model="form.id" :disabled="isEdit" clearable></el-input>
+          </el-form-item>
+          <el-form-item label="鑺傜偣鍚嶇О" prop="name">
+            <el-input v-model="form.name" clearable></el-input>
+          </el-form-item>
+
+          <el-form-item>
+            <div style="float: right;">
+              <el-button type="primary" @click="onSubmit" >纭</el-button>
+              <el-button @click="close">鍙栨秷</el-button>
+            </div>
+
+          </el-form-item>
+        </el-form>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+export default {
+  name: "catalogEdit",
+  computed: {},
+  props: ['platformId'],
+  created() {},
+  data() {
+    let checkId = (rule, value, callback) => {
+      console.log("checkId")
+      console.log(this.treeType)
+      console.log(rule)
+      console.log(value)
+      console.log(value.length)
+      console.log(this.level)
+      if (!value) {
+        return callback(new Error('缂栧彿涓嶈兘涓虹┖'));
+      }
+      if (this.treeType === "BusinessGroup" && value.length !== 20) {
+        return callback(new Error('缂栧彿蹇呴』鐢�20浣嶆暟瀛楃粍鎴�'));
+      }
+      if (this.treeType === "CivilCode" && value.length <= 8 && value.length%2 !== 0) {
+        return callback(new Error('琛屾斂鍖哄垝蹇呴』鏄叓浣嶄互涓嬬殑鍋舵暟涓暟瀛楃粍鎴�'));
+      }
+      if (this.treeType === "BusinessGroup") {
+        let catalogType = value.substring(10, 13);
+        console.log(catalogType)
+        // 216 涓鸿櫄鎷熺粍缁� 215 涓轰笟鍔″垎缁勶紱鐩綍绗竴绾у繀椤讳负涓氬姟鍒嗙粍锛� 涓氬姟鍒嗙粍涓嬩负铏氭嫙缁勭粐锛岃櫄鎷熺粍缁囦笅鍙互鏈夊叾浠栬櫄鎷熺粍缁�
+        if (this.level === 1 && catalogType !== "215") {
+          return callback(new Error('涓氬姟鍒嗙粍妯″紡涓嬬涓�灞傜洰褰曠殑缂栧彿11鍒�13浣嶅繀椤讳负215'));
+        }
+        if (this.level > 1 && catalogType !== "216") {
+          return callback(new Error('涓氬姟鍒嗙粍妯″紡涓嬬涓�灞備互涓嬬洰褰曠殑缂栧彿11鍒�13浣嶅繀椤讳负216'));
+        }
+      }
+      callback();
+    }
+    return {
+      submitCallback: null,
+      showDialog: false,
+      isLoging: false,
+      isEdit: false,
+      treeType: null,
+      level: 0,
+      form: {
+        id: null,
+        name: null,
+        platformId: null,
+        parentId: null,
+      },
+      rules: {
+        name: [{ required: true, message: "璇疯緭鍏ュ悕绉�", trigger: "blur" }],
+        id: [{ required: true, trigger: "blur",validator: checkId  }]
+      },
+    };
+  },
+  methods: {
+    openDialog: function (isEdit, id, name, parentId, treeType, level, callback) {
+      console.log("parentId: " + parentId)
+      console.log(this.form)
+      this.isEdit = isEdit;
+      this.form.id = id;
+      this.form.name = name;
+      this.form.platformId = this.platformId;
+      this.form.parentId = parentId;
+      this.showDialog = true;
+      this.submitCallback = callback;
+      this.treeType = treeType;
+      this.level = level;
+    },
+    onSubmit: function () {
+      console.log("onSubmit");
+      console.log(this.form);
+      this.$axios({
+        method:"post",
+        url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`,
+        data: this.form
+      }).then((res)=> {
+          if (res.data.code === 0) {
+            if (this.submitCallback)this.submitCallback(this.form)
+          }else {
+            this.$message({
+              showClose: true,
+              message: res.data.msg,
+              type: "error",
+            });
+          }
+          this.close();
+        })
+        .catch((error)=> {
+          console.log(error);
+        });
+    },
+    close: function () {
+      this.isEdit = false;
+      this.form.id = null;
+      this.form.name = null;
+      this.form.platformId = null;
+      this.form.parentId = null;
+      this.callback = null;
+      this.showDialog = false;
+      console.log(this.form)
+    },
+  },
+};
+</script>

--
Gitblit v1.8.0