From 8701e6928b20cc3c4af763f8e72be5396c2be99d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 09 十月 2020 18:57:15 +0800
Subject: [PATCH] 2020-10-09

---
 src/templates/zshare/verifycard/index.jsx |  256 +++++++++++++++++++++++++-------------------------
 1 files changed, 128 insertions(+), 128 deletions(-)

diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index 3f19cc9..bf578fe 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Tabs, Row, Col, Radio, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd'
+import { Form, Tabs, Row, Col, Radio, Button, Table, Select, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd'
 import moment from 'moment'
 
 import Api from '@/api'
@@ -30,7 +30,8 @@
   }
 
   state = {
-    initsql: '',          // sql楠岃瘉鏃跺彉閲忓0鏄庡強璧嬪��
+    initsql: '',            // sql楠岃瘉鏃跺彉閲忓0鏄庡強璧嬪��
+    notes: [],              // 鐭俊妯℃澘
     verify: {},
     fields: [],
     usefulfields: '',
@@ -451,6 +452,9 @@
     }
 
     _verify.default = _verify.default || 'true'
+    _verify.noteEnable = _verify.noteEnable || 'false' // 鐭俊鍙戦�佹槸鍚﹀紑鍚�
+    _verify.noteType = _verify.noteType || 'N'         // 鐭俊鍙戦�佹ā寮忥細Y锛堝疄鏃讹級銆丯锛堝畾鏃讹級
+    _verify.noteTemp = _verify.noteTemp || 'Y'         // 鐭俊鍙戦�佹ā鏉匡細Y锛堢浉鍚岋級銆丯锛堜笉鍚岋級
     _verify.invalid = _invalid
     _verify.uniques = _verify.uniques || []
     _verify.contrasts = _verify.contrasts || []
@@ -983,134 +987,71 @@
   }
 
   componentDidMount() {
-    // 鑾峰彇鐢熸垚鍗曞彿涓�绾ц彍鍗�
-    let defer1 = new Promise(resolve => {
-      let _orderSql = `select distinct ModularCode as ID,ModularCode+ModularName+ModularNo as NameNO from sModular where deleted=0 and Appkey=case when Appkey='' then '' else @Appkey@ end order by ID asc`
-      _orderSql = Utils.formatOptions(_orderSql)
-
-      let orderParam = {
-        func: 'sPC_Get_SelectedList',
-        LText: _orderSql,
-        obj_name: 'data',
-        arr_field: 'ID,NameNO'
+    let mutilForms = [
+      {
+        obj_name: 'modular',
+        arr_field: 'ID,NameNO',
+        LText: window.btoa(window.encodeURIComponent(`select distinct ModularCode as ID,ModularCode+ModularName+ModularNo as NameNO from sModular where deleted=0 and Appkey=case when Appkey='' then '' else @Appkey@ end order by ID asc`))
+      },
+      {
+        obj_name: 'modularDetail',
+        arr_field: 'ModularDetailCode,CodeName,BID,Type',
+        LText: window.btoa(window.encodeURIComponent(`select distinct ModularDetailCode,ModularDetailCode+ModularDetailName as CodeName,ModularCode as BID,Type from sModularDetail where Deleted=0 and Appkey=case when Appkey='' then '' else @Appkey@ end order by ModularDetailCode`))
+      },
+      {
+        obj_name: 'voucher',
+        arr_field: 'ID,NameNO,TypeCharOne',
+        LText: window.btoa(window.encodeURIComponent('select distinct ModularCode as ID,ModularCode+ModularName+ModularNo as NameNO,TypeCharOne from sModular where deleted=0  and Appkey=case when Appkey=\'\' then \'\' else @Appkey@ end  order by ModularCode'))
+      },
+      {
+        obj_name: 'voucherDetail',
+        arr_field: 'ModularDetailCode,CodeName,BID,VoucherTypeTwo,IDefine1',
+        LText: window.btoa(window.encodeURIComponent('select distinct ModularDetailCode,ModularDetailCode+ModularDetailName as CodeName,ModularCode as BID, VoucherTypeTwo, IDefine1 from sModularDetail where Deleted=0 and VoucherTypeTwo!=\'\' and Appkey=case when Appkey=\'\' then \'\' else @Appkey@ end  order by ModularDetailCode'))
+      },
+      {
+        obj_name: 'noteCodes',
+        arr_field: 'templatecode,describe',
+        LText: window.btoa(window.encodeURIComponent(`select templatecode,'['+SignName+']'+describe as describe from (select * from bd_msn_sms_temp where  deleted=0 and TypeDesc='QX' and status=20 ) t inner join (select openid from susers where uid=@userid@) u on t.openid =t.openid`))
       }
+    ]
 
-      orderParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-      orderParam.secretkey = Utils.encrypt(orderParam.LText, orderParam.timestamp)
-      orderParam.open_key = Utils.encryptOpenKey(orderParam.secretkey, orderParam.timestamp) // 浜戠鏁版嵁楠岃瘉
-      
-      Api.getSystemConfig(orderParam).then(res => {
-        if (res.status) {
-          resolve(res)
-        } else {
-          notification.warning({
-            top: 92,
-            message: res.message,
-            duration: 5
+    mutilForms = mutilForms.map(item => `select '${item.obj_name}' as obj_name,'${item.arr_field}' as arr_field,'${item.LText}' as LText`)
+
+    let mutilparam = {
+      func: 'sPC_Get_SelectedList',
+      LText: mutilForms.join(' union all '),
+      obj_name: '',
+      arr_field: '',
+      table_type: 'Y'
+    }
+
+    mutilparam.LText = Utils.formatOptions(mutilparam.LText)
+    mutilparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+    mutilparam.secretkey = Utils.encrypt(mutilparam.LText, mutilparam.timestamp)
+
+    mutilparam.open_key = Utils.encryptOpenKey(mutilparam.secretkey, mutilparam.timestamp)
+
+    Api.getCloudCacheConfig(mutilparam).then(res => {
+      if (res.status) {
+        this.setState({
+          orderModular: res.modular,
+          orderModularDetail: res.modularDetail,
+          voucher: res.voucher,
+          voucherDetail: res.voucherDetail,
+          notes: res.noteCodes.map(item => {
+            return {
+              name: item.describe,
+              value: item.templatecode
+            }
           })
-        }
-      })
-    })
-
-    // 鑾峰彇鐢熸垚鍗曞彿浜岀骇鑿滃崟
-    let defer2 = new Promise(resolve => {
-      let _orderDetailSql = `select distinct ModularDetailCode,ModularDetailCode+ModularDetailName as CodeName,ModularCode as BID,Type from sModularDetail where Deleted=0 and Appkey=case when Appkey='' then '' else @Appkey@ end order by ModularDetailCode`
-      _orderDetailSql = Utils.formatOptions(_orderDetailSql)
-
-      let orderDetailParam = {
-        func: 'sPC_Get_SelectedList',
-        LText: _orderDetailSql,
-        obj_name: 'data',
-        arr_field: 'ModularDetailCode,CodeName,BID,Type'
+        })
+      } else {
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 5
+        })
       }
-
-      orderDetailParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-      orderDetailParam.secretkey = Utils.encrypt(orderDetailParam.LText, orderDetailParam.timestamp)
-      orderDetailParam.open_key = Utils.encryptOpenKey(orderDetailParam.secretkey, orderDetailParam.timestamp) // 浜戠鏁版嵁楠岃瘉
-      
-      Api.getSystemConfig(orderDetailParam).then(res => {
-        if (res.status) {
-          resolve(res)
-        } else {
-          notification.warning({
-            top: 92,
-            message: res.message,
-            duration: 5
-          })
-        }
-      })
-    })
-    
-    Promise.all([defer1, defer2]).then(result => {
-      this.setState({
-        orderModular: result[0].data,
-        orderModularDetail: result[1].data
-      })
-    })
-
-    // 鑾峰彇鍑瘉浜岀骇鑿滃崟
-    let defer3 = new Promise(resolve => {
-      let _voucherSql = 'select distinct ModularCode as ID,ModularCode+ModularName+ModularNo as NameNO,TypeCharOne from sModular where deleted=0  and Appkey=case when Appkey=\'\' then \'\' else @Appkey@ end  order by ModularCode'
-      _voucherSql = Utils.formatOptions(_voucherSql)
-
-      let voucherParam = {
-        func: 'sPC_Get_SelectedList',
-        LText: _voucherSql,
-        obj_name: 'data',
-        arr_field: 'ID,NameNO,TypeCharOne'
-      }
-
-      voucherParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-      voucherParam.secretkey = Utils.encrypt(voucherParam.LText, voucherParam.timestamp)
-      voucherParam.open_key = Utils.encryptOpenKey(voucherParam.secretkey, voucherParam.timestamp) // 浜戠鏁版嵁楠岃瘉
-      
-      Api.getSystemConfig(voucherParam).then(res => {
-        if (res.status) {
-          resolve(res)
-        } else {
-          notification.warning({
-            top: 92,
-            message: res.message,
-            duration: 5
-          })
-        }
-      })
-    })
-
-    // 鑾峰彇鍑瘉涓夌骇鑿滃崟
-    let defer4 = new Promise(resolve => {
-      let _voucherDetailSql = 'select distinct ModularDetailCode,ModularDetailCode+ModularDetailName as CodeName,ModularCode as BID, VoucherTypeTwo, IDefine1 from sModularDetail where Deleted=0 and VoucherTypeTwo!=\'\' and Appkey=case when Appkey=\'\' then \'\' else @Appkey@ end  order by ModularDetailCode'
-      _voucherDetailSql = Utils.formatOptions(_voucherDetailSql)
-
-      let voucherDetailParam = {
-        func: 'sPC_Get_SelectedList',
-        LText: _voucherDetailSql,
-        obj_name: 'data',
-        arr_field: 'ModularDetailCode,CodeName,BID,VoucherTypeTwo,IDefine1'
-      }
-
-      voucherDetailParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-      voucherDetailParam.secretkey = Utils.encrypt(voucherDetailParam.LText, voucherDetailParam.timestamp)
-      voucherDetailParam.open_key = Utils.encryptOpenKey(voucherDetailParam.secretkey, voucherDetailParam.timestamp) // 浜戠鏁版嵁楠岃瘉
-      
-      Api.getSystemConfig(voucherDetailParam).then(res => {
-        if (res.status) {
-          resolve(res)
-        } else {
-          notification.warning({
-            top: 92,
-            message: res.message,
-            duration: 5
-          })
-        }
-      })
-    })
-    
-    Promise.all([defer3, defer4]).then(result => {
-      this.setState({
-        voucher: result[0].data,
-        voucherDetail: result[1].data
-      })
     })
   }
 
@@ -1132,7 +1073,7 @@
     _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp)
     _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉
     
-    Api.getSystemConfig(_sParam).then(res => {
+    Api.getCloudCacheConfig(_sParam).then(res => {
       if (res.status) {
         let _scripts = []
 
@@ -1267,6 +1208,14 @@
 
     this.setState({
       verify: verify
+    })
+  }
+
+  onNoteCodeChange = (val) => {
+    const { verify } = this.state
+
+    this.setState({
+      verify: {...verify, noteCode: val}
     })
   }
 
@@ -1559,6 +1508,12 @@
         _loading = true
       }
 
+      if (verify.noteEnable === 'true' && !verify.noteCode) { // 寮�鍚煭淇℃椂锛岄渶瑕佹ā鏉跨紪鐮�
+        verify.noteEnable = 'false'
+      } else if (verify.noteEnable !== 'true' && verify.noteCode) {
+        verify.noteCode = ''
+      }
+
       if (_loading) {
         confirm({
           content: `瀛樺湪鏈繚瀛橀」锛岀‘瀹氭彁浜ゅ悧锛焋,
@@ -1584,7 +1539,7 @@
 
   render() {
     const { card } = this.props
-    const { verify, fields, uniqueColumns, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail } = this.state
+    const { verify, fields, uniqueColumns, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -1631,6 +1586,51 @@
                     </Radio.Group>
                   </Form.Item>
                 </Col>
+                <Col span={8}>
+                  <Form.Item label={
+                    <Tooltip placement="bottomLeft" title={'閫夋嫨鍙戦�佺煭淇℃椂锛岄渶瀹屽杽鐭俊璁剧疆銆�'}>
+                      <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
+                      鍙戦�佺煭淇�
+                    </Tooltip>
+                  }>
+                    <Radio.Group value={verify.noteEnable} onChange={(e) => {this.onOptionChange(e, 'noteEnable')}}>
+                      <Radio value="true">寮�鍚�</Radio>
+                      <Radio value="false">涓嶅紑鍚�</Radio>
+                    </Radio.Group>
+                  </Form.Item>
+                </Col>
+                {verify.noteEnable === 'true' ? <Col span={8}>
+                  <Form.Item label="鐭俊妯℃澘">
+                    <Select value={verify.noteCode} onSelect={this.onNoteCodeChange}>
+                      {notes.map(option =>
+                        <Select.Option key={option.value} value={option.value}>
+                          {option.name}
+                        </Select.Option>
+                      )}
+                    </Select>
+                  </Form.Item>
+                </Col> : null}
+                {verify.noteEnable === 'true' ? <Col span={8}>
+                  <Form.Item label={
+                    <Tooltip placement="bottomLeft" title={'瀹炴椂鍙戦�佹渶澶氬悓鏃跺彂閫�5涓敤鎴凤紝瀹氭椂鍙戦�佹渶澶氬悓鏃跺彂閫�100涓敤鎴枫��'}>
+                      <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
+                      鍙戦�佹柟寮�
+                    </Tooltip>
+                  }>
+                    <Radio.Group value={verify.noteType} onChange={(e) => {this.onOptionChange(e, 'noteType')}}>
+                      <Radio value="Y">瀹炴椂</Radio>
+                      <Radio value="N">瀹氭椂</Radio>
+                    </Radio.Group>
+                  </Form.Item>
+                </Col> : null}
+                {verify.noteEnable === 'true' ? <Col span={8}>
+                  <Form.Item label="鐭俊鍐呭">
+                    <Radio.Group value={verify.noteTemp} onChange={(e) => {this.onOptionChange(e, 'noteTemp')}}>
+                      <Radio value="Y">鐩稿悓</Radio>
+                      <Radio value="N">涓嶅悓</Radio>
+                    </Radio.Group>
+                  </Form.Item>
+                </Col> : null}
               </Row>
             </Form>
           </TabPane>

--
Gitblit v1.8.0