From 3bb266595fbfa9af6b97405737496ed61c6b7c55 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 01 三月 2022 17:10:57 +0800
Subject: [PATCH] 2022-03-01

---
 src/templates/zshare/modalform/index.jsx |   39 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index d79df83..87f09d5 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -414,6 +414,36 @@
     }
   }
 
+  handleEmpty = () => {
+    let field = this.props.form.getFieldValue('valueField')
+
+    if (!field) {
+      notification.warning({
+        top: 92,
+        message: '璇峰~鍐欏�悸峰瓧娈点��',
+        duration: 5
+      })
+      return
+    }
+
+    let text = this.props.form.getFieldValue('valueText')
+
+    if (!text) {
+      notification.warning({
+        top: 92,
+        message: '璇峰~鍐欐枃鏈峰瓧娈点��',
+        duration: 5
+      })
+      return
+    }
+
+    let resource = this.props.form.getFieldValue('dataSource') || ''
+
+    resource = `select '' as ${field},'鍏ㄩ儴' as ${text} union all \n${resource}`
+
+    this.props.form.setFieldsValue({dataSource: resource})
+  }
+
   getFields() {
     const { getFieldDecorator } = this.props.form
     const { dict } = this.props
@@ -427,6 +457,7 @@
       let rules = []
       let className = ''
       let content = null
+      let extra = null
       let initVal = item.initVal || ''
 
       if (item.type === 'text') {
@@ -513,6 +544,10 @@
         span = 24
         className = 'text-area'
 
+        if (this.record.type === 'select' || this.record.type === 'link') {
+          extra = <span className="add-row-empty" onClick={this.handleEmpty}>绌�</span>
+        }
+
         content = <CodeMirror />
       } else if (item.type === 'textarea') {
         span = 24
@@ -536,7 +571,7 @@
           if (type === 'radio' && this.record.linkField) {
             type = 'link'
           }
-          content = <EditTable type={type} transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/>
+          content = <EditTable type={type} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/>
         } else {
           if (this.record.multiple === 'true') {
             linkSubFields = []
@@ -565,7 +600,7 @@
 
       fields.push(
         <Col span={span} key={index}>
-          <Form.Item className={className} label={item.tooltip ?
+          <Form.Item className={className} extra={extra} label={item.tooltip ?
             <Tooltip placement="topLeft" title={item.tooltip}>
               <QuestionCircleOutlined className="mk-form-tip" />
               {item.label}

--
Gitblit v1.8.0