From b4048fbe80dba8e7756ae557a15ab60b4f80a44b Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期二, 04 四月 2023 09:09:07 +0800
Subject: [PATCH] 合并开源主线

---
 web_src/src/components/dialog/catalogEdit.vue |   40 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/web_src/src/components/dialog/catalogEdit.vue b/web_src/src/components/dialog/catalogEdit.vue
index 13cabfb..e1cd8d2 100644
--- a/web_src/src/components/dialog/catalogEdit.vue
+++ b/web_src/src/components/dialog/catalogEdit.vue
@@ -49,11 +49,42 @@
   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,
@@ -62,12 +93,12 @@
       },
       rules: {
         name: [{ required: true, message: "璇疯緭鍏ュ悕绉�", trigger: "blur" }],
-        id: [{ required: true, message: "璇疯緭鍏D", trigger: "blur" }]
+        id: [{ required: true, trigger: "blur",validator: checkId  }]
       },
     };
   },
   methods: {
-    openDialog: function (isEdit, id, name, parentId, callback) {
+    openDialog: function (isEdit, id, name, parentId, treeType, level, callback) {
       console.log("parentId: " + parentId)
       console.log(this.form)
       this.isEdit = isEdit;
@@ -77,6 +108,8 @@
       this.form.parentId = parentId;
       this.showDialog = true;
       this.submitCallback = callback;
+      this.treeType = treeType;
+      this.level = level;
     },
     onSubmit: function () {
       console.log("onSubmit");
@@ -85,8 +118,7 @@
         method:"post",
         url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`,
         data: this.form
-      })
-        .then((res)=> {
+      }).then((res)=> {
           if (res.data.code === 0) {
             if (this.submitCallback)this.submitCallback(this.form)
           }else {

--
Gitblit v1.8.0