From b8e1395f02c929eaa96b949cf6027ee2a43856a6 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 06 九月 2022 19:03:37 +0800
Subject: [PATCH] 2022-09-06

---
 src/templates/zshare/modalform/index.jsx |   74 +++++++++++++++++++++++++++++++------
 1 files changed, 62 insertions(+), 12 deletions(-)

diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index c719d9a..2b1a8e2 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Row, Col, Input, Select, Radio, notification, InputNumber, Tooltip } from 'antd'
+import { Form, Row, Col, Input, Select, Radio, notification, InputNumber, Tooltip, Checkbox } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
 
 import { formRule } from '@/utils/option.js'
@@ -19,23 +19,23 @@
 const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
 
 const modalTypeOptions = {
-  text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'scan', 'splitline', 'placeholder', 'place', 'marginTop', 'marginBottom', 'lenControl'],
+  text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'encryption', 'tooltip', 'extra', 'enter', 'cursor', 'scan', 'splitline', 'placeholder', 'place', 'marginTop', 'marginBottom', 'lenControl'],
   number: ['initval', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'splitline', 'place', 'marginTop', 'marginBottom'],
   select: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'setAll', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom'],
   checkbox: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'arrange', 'marginTop', 'marginBottom'],
   radio: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'setAll', 'emptyText', 'splitline', 'arrange', 'marginTop', 'marginBottom'],
   checkcard: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'span', 'labelwidth', 'display', 'tooltip', 'extra', 'width', 'multiple', 'splitline', 'marginTop', 'marginBottom'],
-  multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom'],
+  multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'dropdown'],
   link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'setAll', 'linkField', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom'],
-  fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress', 'splitline', 'marginTop', 'marginBottom'],
+  fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress', 'miniSet', 'splitline', 'marginTop', 'marginBottom'],
   switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom'],
   date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate', 'precision'],
   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'],
+  textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'span', 'labelwidth', 'maxRows', 'encryption', 'interception', 'tooltip', 'extra', 'count', 'placeholder', 'marginTop', 'marginBottom'],
+  cascader: ['readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'separator'],
   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'],
+  rate: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'splitline', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'allowHalf', 'color', 'rateCount', 'character', 'place'],
   hint: ['label', 'field', 'type', 'blacklist', 'message', 'span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'],
   split: ['label', 'type', 'marginTop', 'marginBottom', 'splitline'],
   formula: ['label', 'type', 'marginTop', 'marginBottom', 'splitline', 'span', 'labelwidth', 'formula', 'eval', 'postfix'],
@@ -230,16 +230,33 @@
     } else if (type === 'fileupload') {
       if (this.record.compress === 'true') {
         shows.push('limit', 'rduri', 'proRduri')
-      } else {
+      } else if (this.record.compress !== 'base64') {
         shows.push('suffix')
+      }
+      if (this.record.miniSet === 'custom') {
+        shows.push('mediaType', 'sourceType')
+
+        if (this.record.sourceType.includes('camera') && this.record.mediaType.includes('video')) {
+          shows.push('maxDuration')
+        }
+        if (this.record.mediaType.includes('image')) {
+          shows.push('sizeType')
+        }
+        if (this.record.sourceType.includes('camera')) {
+          shows.push('camera')
+        }
+      }
+    } else if (type === 'textarea') {
+      if (this.record.encryption === 'false') {
+        shows.push('enterReplace')
       }
     }
 
     if (type === 'cascader') {
       if (this.record.resourceType === '0') {        // 鑷畾涔夎祫婧�
-        shows.push('options', 'topmark')
+        shows.push('options', 'topmark', 'linkSubField')
       } else if (this.record.resourceType === '1') { // 鏁版嵁婧�
-        shows.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'disableField', 'database', 'topmark', 'linkField')
+        shows.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'disableField', 'database', 'topmark', 'linkField', 'linkSubField')
       }
       reTypes.linkField = 'text'
       reTooltip.linkField = '鐢ㄤ簬鏋勫缓鏁版嵁缁撴瀯銆�'
@@ -262,6 +279,27 @@
       }, {
         value: '1',
         text: '鏁版嵁婧�'
+      }]
+    }
+
+    if (type === 'brafteditor') {
+      reOptions.encryption = [{
+        value: 'false',
+        text: '鏃�'
+      }, {
+        value: 'true',
+        text: 'base64鍔犲瘑'
+      }]
+    } else {
+      reOptions.encryption = [{
+        value: 'false',
+        text: '鏃�'
+      }, {
+        value: 'true',
+        text: 'base64鍔犲瘑'
+      }, {
+        value: 'md5',
+        text: 'md5鍔犲瘑'
       }]
     }
 
@@ -613,6 +651,15 @@
             )
           })}
         </Radio.Group>
+      } else if (item.type === 'checkbox') {
+        rules = [
+          { required: item.required, message: dict['form.required.select'] + item.label + '!' }
+        ]
+        initVal = item.initVal
+
+        content = <Checkbox.Group onChange={(values) => {this.optionChange(item.key, values)}}>
+          {item.options.map(option => <Checkbox key={option.value} value={option.value}>{option.text}</Checkbox>)}
+        </Checkbox.Group>
       } else if (item.type === 'codemirror') {
         rules = [
           { required: item.required, message: dict['form.required.input'] + item.label + '!' }
@@ -641,13 +688,16 @@
         let linkSubFields = this.record.linkSubField || []
         
         if (type !== 'checkcard') {
-          if (!['select', 'radio', 'link'].includes(type)) {
+          if (!['select', 'radio', 'link', 'cascader'].includes(type)) {
             linkSubFields = []
           }
           if (type === 'radio' && this.record.linkField) {
             type = 'link'
           } else if (type === 'cascader') {
             type = 'link'
+            if (this.record.resourceType === '2') {        // 鑷畾涔夎祫婧�
+              linkSubFields = []
+            }
           }
           content = <EditTable type={type} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/>
         } else {
@@ -666,7 +716,7 @@
           { required: item.required, message: '璇锋坊鍔�' + item.label + '!' }
         ]
 
-        content = <FieldsTable dict={this.props.dict} onChange={this.changeField}/>
+        content = <FieldsTable onChange={this.changeField}/>
       } else if (item.type === 'color') {
         className = 'color-form-item'
         rules = [

--
Gitblit v1.8.0