| | |
| | | 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' |
| | |
| | | } |
| | | |
| | | state = { |
| | | initsql: '', // sql验证时变量声明及赋值 |
| | | initsql: '', // sql验证时变量声明及赋值 |
| | | notes: [], // 短信模板 |
| | | verify: {}, |
| | | fields: [], |
| | | usefulfields: '', |
| | |
| | | } |
| | | |
| | | _verify.default = _verify.default || 'true' |
| | | _verify.noteEnable = _verify.noteEnable || 'false' // 短信发送是否开启 |
| | | _verify.noteType = _verify.noteType || 'N' // 短信发送模式:Y(实时)、N(定时) |
| | | _verify.noteTemp = _verify.noteTemp || 'Y' // 短信发送模板:Y(相同)、N(不同) |
| | | _verify.invalid = _invalid |
| | | _verify.uniques = _verify.uniques || [] |
| | | _verify.contrasts = _verify.contrasts || [] |
| | |
| | | } |
| | | |
| | | 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 |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | _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 = [] |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } |
| | | |
| | | onNoteCodeChange = (val) => { |
| | | const { verify } = this.state |
| | | |
| | | this.setState({ |
| | | verify: {...verify, noteCode: val} |
| | | }) |
| | | } |
| | | |
| | |
| | | _loading = true |
| | | } |
| | | |
| | | if (verify.noteEnable === 'true' && !verify.noteCode) { // 开启短信时,需要模板编码 |
| | | verify.noteEnable = 'false' |
| | | } else if (verify.noteEnable !== 'true' && verify.noteCode) { |
| | | verify.noteCode = '' |
| | | } |
| | | |
| | | if (_loading) { |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | |
| | | |
| | | 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 }, |
| | |
| | | </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> |