From 49d0886f6855f1fb1c628b8205a8ae299aa3db09 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 14 七月 2022 18:05:28 +0800
Subject: [PATCH] 2022-07-14

---
 src/templates/zshare/modalform/index.jsx |   49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 48 insertions(+), 1 deletions(-)

diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index ebb65e2..c719d9a 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -33,6 +33,7 @@
   datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'splitline', 'marginTop', 'marginBottom'],
   datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'],
   textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'span', 'labelwidth', 'maxRows', 'encryption', 'interception', 'tooltip', 'extra', 'count', 'placeholder', 'marginTop', 'marginBottom', 'enterReplace'],
+  cascader: ['readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'separator', 'fillField'],
   color: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom'],
   rate: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'splitline', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'allowHalf', 'rateCount', 'character', 'place'],
   hint: ['label', 'field', 'type', 'blacklist', 'message', 'span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'],
@@ -234,6 +235,36 @@
       }
     }
 
+    if (type === 'cascader') {
+      if (this.record.resourceType === '0') {        // 鑷畾涔夎祫婧�
+        shows.push('options', 'topmark')
+      } else if (this.record.resourceType === '1') { // 鏁版嵁婧�
+        shows.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'disableField', 'database', 'topmark', 'linkField')
+      }
+      reTypes.linkField = 'text'
+      reTooltip.linkField = '鐢ㄤ簬鏋勫缓鏁版嵁缁撴瀯銆�'
+      reOptions.resourceType = [{
+        value: '0',
+        text: '鑷畾涔�'
+      }, {
+        value: '1',
+        text: '鏁版嵁婧�'
+      }, {
+        value: '2',
+        text: '鐪佸競鍖�'
+      }]
+    } else {
+      reTooltip.linkField = ''
+      reTypes.linkField = 'select'
+      reOptions.resourceType = [{
+        value: '0',
+        text: '鑷畾涔�'
+      }, {
+        value: '1',
+        text: '鏁版嵁婧�'
+      }]
+    }
+
     if (['multiselect', 'checkbox'].includes(type)) {
       reTooltip.initval = '娣诲姞澶氫釜鍒濆鍊艰浣跨敤閫楀彿鍒嗛殧銆�'
     } else if (['select', 'link', 'radio'].includes(type)) {
@@ -299,6 +330,16 @@
       if (value === 'linkMain') {
         this.record.hidden = 'true'
         _fieldval.hidden = 'true'
+      }
+      
+      if (this.record.type === 'cascader' && value !== 'cascader') {
+        this.record.linkField = ''
+        _fieldval.linkField = ''
+
+        if (this.record.resourceType === '2') {
+          this.record.resourceType = '0'
+          _fieldval.resourceType = '0'
+        }
       }
 
       if (this.record.options.length > 0) {
@@ -493,7 +534,11 @@
 
       if (item.type === 'text') {
         rules = [
-          { required: item.required, message: dict['form.required.input'] + item.label + '!' }
+          { required: item.required, message: dict['form.required.input'] + item.label + '!' },
+          {
+            pattern: /^[^']*$/ig,
+            message: '涓嶅彲浣跨敤鑻辨枃鐘舵�佺殑鍗曞紩鍙凤紒'
+          }
         ]
         if (item.key === 'field') {
           rules.push({
@@ -601,6 +646,8 @@
           }
           if (type === 'radio' && this.record.linkField) {
             type = 'link'
+          } else if (type === 'cascader') {
+            type = 'link'
           }
           content = <EditTable type={type} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/>
         } else {

--
Gitblit v1.8.0