| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Tabs, Row, Col, Radio, Button, Select, Popconfirm, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd' |
| | | import { QuestionCircleOutlined, CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Tabs, Row, Col, Button, Popconfirm, notification, Modal, message, InputNumber, Typography } from 'antd' |
| | | import { CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined, ExclamationOutlined, BorderOutlined } from '@ant-design/icons' |
| | | import Toast from 'antd-mobile/es/components/toast' |
| | | import Dialog from 'antd-mobile/es/components/dialog' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import BaseForm from './baseform' |
| | | import UniqueForm from './uniqueform' |
| | | import ContrastForm from './contrastform' |
| | | import CustomForm from './customform' |
| | |
| | | import VoucherForm from './voucherform' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { updateForm } from '@/utils/utils-update.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MinView from '@/assets/img/minview.png' |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | |
| | | |
| | | state = { |
| | | initsql: '', // sql验证时变量声明及赋值 |
| | | verifyInter: 'system', // 接口类型 |
| | | activeKey: 'base', |
| | | appType: sessionStorage.getItem('appType'), |
| | | notes: [], // 短信模板 |
| | | setting: null, |
| | | visible: false, |
| | | scriptId: '', |
| | | verify: {}, |
| | | fields: [], |
| | | usefulfields: '', |
| | |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | 禁用 |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | 禁用 |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | 禁用 |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | render: (text) => { |
| | | let title = text.match(/^\s*\/\*.+\*\//) |
| | | title = title && title[0] ? title[0] : '' |
| | | text = title ? text.replace(title, '') : text |
| | | let _text = title ? text.replace(title, '') : text |
| | | |
| | | return ( |
| | | <div> |
| | | {title ? <span style={{color: '#a50'}}>{title}</span> : null} |
| | | <Paragraph copyable ellipsis={{ rows: 4, expandable: true }}>{text}</Paragraph> |
| | | {title ? <span style={{color: '#a50'}}>{title}<span style={{fontSize: '12px', marginLeft: '5px'}}>{_text.length}</span></span> : null} |
| | | <Paragraph copyable={{ text: text }} ellipsis={{ rows: 4, expandable: true }}>{_text}</Paragraph> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | width: '9%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | 禁用 |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | render: (text) => { |
| | | let title = text.match(/^\s*\/\*.+\*\//) |
| | | title = title && title[0] ? title[0] : '' |
| | | text = title ? text.replace(title, '') : text |
| | | let _text = title ? text.replace(title, '') : text |
| | | |
| | | return ( |
| | | <div> |
| | | {title ? <span style={{color: '#a50'}}>{title}</span> : null} |
| | | <Paragraph copyable ellipsis={{ rows: 4, expandable: true }}>{text}</Paragraph> |
| | | {title ? <span style={{color: '#a50'}}>{title}<span style={{fontSize: '12px', marginLeft: '5px'}}>{_text.length}</span></span> : null} |
| | | <Paragraph copyable={{ text: text }} ellipsis={{ rows: 4, expandable: true }}>{_text}</Paragraph> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | width: '10%', |
| | | render: (text, record) => { |
| | | if (record.position === 'init') { |
| | | return '初始化' |
| | | return <span style={{color: 'orange'}}>初始化</span> |
| | | } else if (record.position === 'front') { |
| | | return 'sql前' |
| | | return <span style={{color: '#26C281'}}>sql前</span> |
| | | } else { |
| | | return 'sql后' |
| | | return <span style={{color: '#1890ff'}}>sql后</span> |
| | | } |
| | | } |
| | | }, |
| | |
| | | width: '10%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | 禁用 |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '20%', |
| | | width: '140px', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div style={{textAlign: 'center'}}> |
| | |
| | | render: (text) => { |
| | | let title = text.match(/^\s*\/\*.+\*\//) |
| | | title = title && title[0] ? title[0] : '' |
| | | text = title ? text.replace(title, '') : text |
| | | let _text = title ? text.replace(title, '') : text |
| | | |
| | | return ( |
| | | <div> |
| | | {title ? <span style={{color: '#a50'}}>{title}</span> : null} |
| | | <Paragraph copyable ellipsis={{ rows: 4, expandable: true }}>{text}</Paragraph> |
| | | {title ? <span style={{color: '#a50'}}>{title}<span style={{fontSize: '12px', marginLeft: '5px'}}>{_text.length}</span></span> : null} |
| | | <Paragraph copyable={{ text: text }} ellipsis={{ rows: 4, expandable: true }}>{_text}</Paragraph> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | width: '10%', |
| | | render: (text, record) => { |
| | | if (record.position === 'front') { |
| | | return 'sql前' |
| | | return <span style={{color: '#26C281'}}>sql前</span> |
| | | } else { |
| | | return 'sql后' |
| | | return <span style={{color: '#1890ff'}}>sql后</span> |
| | | } |
| | | } |
| | | }, |
| | |
| | | width: '10%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | 禁用 |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | let _type = record.Type |
| | | if (_type && typeof(_type) === 'string') { |
| | | _type = parseInt(_type) |
| | | } else { |
| | | } else if (!_type) { |
| | | _type = 4 |
| | | } |
| | | |
| | |
| | | width: '8%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | 禁用 |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { columns, config, card, btnTab } = this.props |
| | | let _verify = card.verify || {} |
| | | let _verify = fromJS(card.verify || {}).toJS() |
| | | |
| | | let _invalid = _verify.invalid |
| | | |
| | |
| | | } |
| | | |
| | | _verify.default = _verify.default || 'true' |
| | | _verify.wxNote = _verify.wxNote || 'false' // 公众号消息推送是否开启 |
| | | _verify.noteEnable = _verify.noteEnable || 'false' // 短信发送是否开启 |
| | | _verify.noteType = _verify.noteType || 'N' // 短信发送模式:Y(实时)、N(定时) |
| | | _verify.noteTemp = _verify.noteTemp || 'Y' // 短信发送模板:Y(相同)、N(不同) |
| | |
| | | }) |
| | | } |
| | | |
| | | _verify.customverifys.forEach((item, i) => { |
| | | item.$index = i + 1 |
| | | }) |
| | | _verify.scripts.forEach((item, i) => { |
| | | item.$index = i + 1 |
| | | }) |
| | | _verify.cbScripts.forEach((item, i) => { |
| | | item.$index = i + 1 |
| | | }) |
| | | |
| | | let verifyInter = card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? 'system' : 'inner' |
| | | |
| | | this.setState({ |
| | | activeKey: verifyInter === 'system' || card.intertype === 'inner' ? 'base' : 'tip', |
| | | verifyInter: verifyInter, |
| | | setting: config.setting || {}, |
| | | verify: _verify |
| | | verify: _verify, |
| | | oriVerify: fromJS(_verify).toJS() |
| | | }) |
| | | |
| | | if (config.Template !== 'FormTab' && (card.intertype === 'inner' || card.intertype === 'outer')) { // 内部或外部接口 |
| | |
| | | |
| | | new Promise(resolve => { |
| | | let _fields = [] |
| | | if (config.Template === 'FormTab') { |
| | | if (card.OpenType === 'form') { |
| | | _fields.push({ |
| | | field: card.field, |
| | | label: card.label, |
| | | type: 'text' |
| | | }) |
| | | resolve(_fields) |
| | | } else if (config.Template === 'FormTab') { |
| | | config.groups.forEach(group => { |
| | | _fields.push(...group.sublist) |
| | | }) |
| | |
| | | resolve(_fields) |
| | | } |
| | | }).then(_fields => { |
| | | let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'login_city', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode'] |
| | | let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@RoleID nvarchar(512)', '@mk_departmentcode nvarchar(50)', '@mk_organization nvarchar(50)', '@login_city nvarchar(50)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)'] |
| | | let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@login_city=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\''] |
| | | let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode'] |
| | | let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@RoleID nvarchar(512)', '@mk_departmentcode nvarchar(50)', '@mk_organization nvarchar(50)', '@mk_user_type nvarchar(20)', '@mk_nation nvarchar(50)', '@mk_province nvarchar(50)', '@mk_city nvarchar(50)', '@mk_district nvarchar(50)', '@mk_address nvarchar(100)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)'] |
| | | let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@mk_user_type=\'\'', '@mk_nation=\'\'', '@mk_province=\'\'', '@mk_city=\'\'', '@mk_district=\'\'', '@mk_address=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'', '@bid=\'\''] |
| | | let fieldArr = _usefulfields.map(_f => _f.toLowerCase()) |
| | | let hasBid = false |
| | | |
| | | _usefulfields = [] |
| | | |
| | | fieldArr.push('bid') |
| | | |
| | | _fields = _fields.filter(_f => _f.field) |
| | | _fields.forEach(_f => { |
| | | if (_f.field.toLowerCase() === 'bid') { |
| | | hasBid = true |
| | | } |
| | | |
| | | if (fieldArr.includes(_f.field.toLowerCase())) return |
| | | |
| | | fieldArr.push(_f.field.toLowerCase()) |
| | |
| | | |
| | | if (_f.type.match(/date/ig)) { |
| | | _type = 'datetime' |
| | | _select.push(`@${_f.field}='1900-01-01'`) |
| | | _select.push(`@${_f.field}='1949-10-01'`) |
| | | } else if (_f.type === 'number') { |
| | | _type = `decimal(18,${_fieldlen})` |
| | | _select.push(`@${_f.field}=0`) |
| | | } else if (_f.type === 'rate') { |
| | | _type = `decimal(18,2)` |
| | | _select.push(`@${_f.field}=0`) |
| | | } else { |
| | | _select.push(`@${_f.field}=''`) |
| | | } |
| | | |
| | | _declare.push(`@${_f.field} ${_type}`) |
| | | |
| | | if (_f.field.toLowerCase() === 'bid') { |
| | | hasBid = true |
| | | } |
| | | }) |
| | | |
| | | let uniqueFields = fromJS(_fields).toJS() |
| | |
| | | if (!hasBid) { // 唯一性验证添加BID |
| | | uniqueFields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) |
| | | _fields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) |
| | | fieldArr.push('bid') |
| | | _declare.push(`@bid nvarchar(50)`) |
| | | _select.push(`@bid=''`) |
| | | } |
| | | |
| | | let hasColumn = false |
| | |
| | | let _defaultsql = '' |
| | | let _insertsql = '' |
| | | let _updatesql = '' |
| | | let _primaryKey = config.setting.primaryKey || 'id' |
| | | |
| | | if (card.sqlType === 'insert' || card.sqlType === 'insertOrUpdate') { |
| | | let keys = [] |
| | |
| | | } |
| | | }) |
| | | |
| | | if (config.setting.primaryKey && !keys.includes(config.setting.primaryKey.toLowerCase())) { |
| | | keys.push(config.setting.primaryKey.toLowerCase()) |
| | | if (!keys.includes(_primaryKey.toLowerCase())) { |
| | | keys.push(_primaryKey.toLowerCase()) |
| | | values.push('@ID@') |
| | | } |
| | | if (!keys.includes('createuserid')) { |
| | |
| | | if (!item.field || item.writein === 'false') return |
| | | |
| | | _arr.push(item.field.toLowerCase()) |
| | | _form.push(item.field + '=@' + item.field) |
| | | if (item.field.toLowerCase() === 'bid' && item.uuid === 'BID') { |
| | | _form.push(item.field + '=@BID@') |
| | | } else { |
| | | _form.push(item.field + '=@' + item.field) |
| | | } |
| | | }) |
| | | |
| | | if (this.props.card.sqlType === 'audit') { |
| | |
| | | } |
| | | |
| | | _form = _form.join(', ') |
| | | _updatesql = `update ${card.sql} set ${_form} where ${config.setting.primaryKey || 'id'}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` |
| | | _updatesql = `update ${card.sql} set ${_form} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` |
| | | } |
| | | |
| | | if (card.sqlType === 'insert') { |
| | |
| | | _defaultsql = _updatesql |
| | | } else if (card.sqlType === 'insertOrUpdate') { |
| | | _defaultsql += `select @tbid='' |
| | | select @tbid='X' from ${card.sql} where ${config.setting.primaryKey || 'id'}=@ID@ |
| | | select @tbid='X' from ${card.sql} where ${_primaryKey}=@ID@ |
| | | if @tbid='' |
| | | begin |
| | | ${_insertsql} |
| | |
| | | if (_verify.voucher && _verify.voucher.enabled) { |
| | | _voucher = ',BVoucher=@BVoucher,FIBVoucherDate=@FIBVoucherDate,FiYear=@FiYear' |
| | | } |
| | | _defaultsql = `update ${card.sql} set deleted=1,modifydate=getdate(),modifyuser=@username,modifyuserid=@userid@${_voucher} where ${config.setting.primaryKey || 'id'}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` |
| | | _defaultsql = `update ${card.sql} set deleted=1,modifydate=getdate(),modifyuser=@username,modifyuserid=@userid@${_voucher} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` |
| | | } else if (card.sqlType === 'delete') { |
| | | let _msg = '' |
| | | if (columns && columns.length > 0 && card.Ot !== 'notRequired' && card.Ot !== 'requiredOnce') { |
| | |
| | | _index++ |
| | | }) |
| | | } |
| | | _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('删除表:${card.sql} 数据: ${_msg}${config.setting.primaryKey || 'id'}='+@ID@,200),@userid@,@username,@fullname delete ${card.sql} where ${config.setting.primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` |
| | | _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('删除表:${card.sql} 数据: ${_msg}${_primaryKey}='+@ID@,200),@userid@,@username,@fullname delete ${card.sql} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` |
| | | } |
| | | |
| | | let _columns = [] |
| | |
| | | _columns.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) |
| | | } |
| | | } |
| | | |
| | | |
| | | this.setState({ |
| | | fields: _fields, |
| | | columnsFields: _columns, |
| | |
| | | verify.scripts.push(values) |
| | | } |
| | | |
| | | MKEmitter.emit('editLineId', values.uuid) |
| | | |
| | | this.setState({ verify }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | this.setState({ verify }) |
| | | } |
| | | |
| | | onNoteCodeChange = (val, option) => { |
| | | const { verify } = this.state |
| | | |
| | | this.setState({ |
| | | verify: {...verify, noteCode: val, noteId: option.props.id} |
| | | }) |
| | | } |
| | | |
| | | onOptionChange = (e, key) => { |
| | | const { verify } = this.state |
| | | let value = e.target.value |
| | | |
| | | this.setState({ |
| | | verify: {...verify, [key]: value} |
| | | }) |
| | | } |
| | | |
| | | changeAccField = (val) => { |
| | | const { verify } = this.state |
| | | |
| | | this.setState({ |
| | | verify: {...verify, accountfield: val} |
| | | }) |
| | | } |
| | | |
| | | changeAccDate = (val) => { |
| | | const { verify } = this.state |
| | | |
| | | this.setState({ |
| | | verify: {...verify, voucherdate: val} |
| | | }) |
| | | } |
| | | |
| | | handleDelete = (record, type) => { |
| | |
| | | } |
| | | |
| | | showError = (errorType) => { |
| | | const { verify, appType } = this.state |
| | | |
| | | if (errorType === 'S') { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '执行成功!', |
| | | duration: 2 |
| | | }) |
| | | let time = verify.stime || 2 |
| | | if (appType === 'mob') { |
| | | Toast.show({ icon: 'success', content: '执行成功!', duration: time * 1000 }) |
| | | } else { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '执行成功!', |
| | | duration: time |
| | | }) |
| | | } |
| | | |
| | | } else if (errorType === 'Y') { |
| | | Modal.success({ |
| | | title: '执行成功!' |
| | | }) |
| | | if (appType === 'mob') { |
| | | Dialog.alert({content: '执行成功!', confirmText: '知道了'}) |
| | | } else { |
| | | Modal.success({ |
| | | title: '执行成功!' |
| | | }) |
| | | } |
| | | } else if (errorType === 'F') { |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | top: 92, |
| | | message: '执行失败!', |
| | | duration: 10 |
| | | }) |
| | | if (appType === 'mob') { |
| | | let time = verify.ftime || 3 |
| | | Toast.show({ icon: 'fail', content: '执行失败!', duration: time * 1000 }) |
| | | } else { |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | top: 92, |
| | | message: '执行失败!', |
| | | duration: verify.ftime || 10 |
| | | }) |
| | | } |
| | | } else if (errorType === 'N') { |
| | | notification.error({ |
| | | top: 92, |
| | | message: '执行失败!', |
| | | duration: 10 |
| | | }) |
| | | if (appType === 'mob') { |
| | | let time = verify.ntime || 3 |
| | | Toast.show({ content: '执行失败!', duration: time * 1000 }) |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | | message: '执行失败!', |
| | | duration: verify.ntime || 10 |
| | | }) |
| | | } |
| | | } else if (errorType === 'E') { |
| | | Modal.error({ |
| | | title: '执行失败!' |
| | | }) |
| | | if (appType === 'mob') { |
| | | Dialog.alert({content: '执行失败!', confirmText: '知道了'}) |
| | | } else { |
| | | Modal.error({ |
| | | title: '执行失败!' |
| | | }) |
| | | } |
| | | } else if (errorType === 'NM') { |
| | | message.error('执行失败!') |
| | | if (appType === 'mob') { |
| | | let time = verify.ntime || 3 |
| | | Toast.show({ content: '执行失败!', duration: time * 1000 }) |
| | | } else { |
| | | message.error('执行失败!') |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | handleConfirm = () => { |
| | | const { card } = this.props |
| | | const { setting } = this.state |
| | | const { setting, activeKey } = this.state |
| | | let verify = fromJS(this.state.verify).toJS() |
| | | |
| | | if (activeKey === 'base') { |
| | | let msg = this.baseForm.handleConfirm() |
| | | |
| | | if (msg) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: msg, |
| | | duration: 5 |
| | | }) |
| | | return Promise.reject() |
| | | } |
| | | } |
| | | |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (verify.accountdate === 'true' && !verify.accountfield) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '开启账期时,需要选择验证公司!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 100) { |
| | | } else if (verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 300) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据源中自定义脚本过于复杂,不能使用失效验证!', |
| | |
| | | msg = '自定义脚本' |
| | | } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) { |
| | | msg = '自定义脚本' |
| | | } |
| | | |
| | | if (verify.noteEnable === 'true' && !verify.noteCode) { // 开启短信时,需要模板编码 |
| | | verify.noteEnable = 'false' |
| | | } else if (verify.noteEnable !== 'true' && verify.noteCode) { |
| | | verify.noteCode = '' |
| | | } |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | |
| | | }) |
| | | } |
| | | |
| | | handleCancel = () => { |
| | | const { verify, oriVerify } = this.state |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | | if (!is(fromJS(verify), fromJS(oriVerify))) { |
| | | confirm({ |
| | | content: '验证信息已修改,确定取消吗?', |
| | | onOk() { |
| | | resolve() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | resolve() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | changeTab = (val) => { |
| | | const { activeKey } = this.state |
| | | |
| | | if (activeKey === 'base') { |
| | | let msg = this.baseForm.handleConfirm() |
| | | |
| | | if (msg) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: msg, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | this.setState({ |
| | | activeKey: val |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | |
| | | |
| | | render() { |
| | | const { card } = this.props |
| | | const { verify, fields, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes } = this.state |
| | | const { activeKey, verifyInter, verify, fields, visible, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | |
| | | return ( |
| | | <div id="verify-card-box-tab"> |
| | | <Tabs defaultActiveKey="1" className="verify-card-box"> |
| | | {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab="基础验证" key="1"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | {this.props.card.sqlType !== 'custom' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title={'默认sql执行顺序为自定义脚本之前'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 默认sql |
| | | </Tooltip> |
| | | }> |
| | | <Radio.Group value={verify.default} onChange={(e) => {this.onOptionChange(e, 'default')}}> |
| | | <Radio value="true">执行</Radio> |
| | | <Radio value="false">不执行</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | <Form.Item label={'账期验证'}> |
| | | <Radio.Group value={verify.accountdate} onChange={(e) => {this.onOptionChange(e, 'accountdate')}}> |
| | | <Radio value="true">开启</Radio> |
| | | <Radio value="false">不开启</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | {verify.accountdate === 'true' ? <Col span={8}> |
| | | <Form.Item label={'验证公司'} required> |
| | | <Select defaultValue={verify.accountfield || ''} onChange={this.changeAccField}> |
| | | {unionFields.map(option => |
| | | <Select.Option key={option.uuid} value={option.field}> |
| | | {option.label} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {verify.accountdate === 'true' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title={'验证日期为空时,默认为当天。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 验证日期 |
| | | </Tooltip> |
| | | }> |
| | | <Select allowClear defaultValue={verify.voucherdate || ''} onChange={this.changeAccDate}> |
| | | {unionFields.map(option => |
| | | <Select.Option key={option.uuid} value={option.field}> |
| | | {option.label} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | <Form.Item label={'失效验证'}> |
| | | <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e, 'invalid')}}> |
| | | <Radio value="true">开启</Radio> |
| | | <Radio value="false">不开启</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title={'选择发送短信时,需完善短信设置。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 发送短信 |
| | | </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} id={option.id} 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个用户。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 发送方式 |
| | | </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> |
| | | <Tabs activeKey={activeKey} className="verify-card-box" onChange={this.changeTab}> |
| | | {verifyInter === 'system' || card.intertype === 'inner' ? <TabPane tab={ |
| | | <span> |
| | | 基础验证 |
| | | {verify.default === 'false' ? <span className="count-tip"><ExclamationOutlined style={{color: 'orange'}}/></span> : null} |
| | | </span> |
| | | } key="base"> |
| | | <BaseForm card={card} unionFields={unionFields} verify={verify} notes={notes} onChange={(verify) => this.setState({verify})} wrappedComponentRef={(inst) => this.baseForm = inst}/> |
| | | </TabPane> : null} |
| | | {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ |
| | | {verifyInter === 'system' ? <TabPane tab={ |
| | | <span> |
| | | 比较验证 |
| | | {verify.contrasts.length ? <span className="count-tip">{verify.contrasts.length}</span> : null} |
| | | </span> |
| | | } key="2x"> |
| | | } key="contrasts"> |
| | | <ContrastForm dict={this.props.dict} contrastChange={this.contrastChange}/> |
| | | <EditTable actions={['edit', 'move', 'copy', 'del']} type="contrastverify" data={verify.contrasts} columns={contrastColumns} onChange={(contrasts) => this.setState({verify: {...verify, contrasts}})}/> |
| | | <EditTable actions={['edit', 'move', 'copy', 'del', 'status']} type="contrastverify" data={verify.contrasts} columns={contrastColumns} onChange={(contrasts) => this.setState({verify: {...verify, contrasts}})}/> |
| | | </TabPane> : null} |
| | | {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ |
| | | {verifyInter === 'system' ? <TabPane tab={ |
| | | <span> |
| | | 自定义验证 |
| | | {verify.customverifys.length ? <span className="count-tip">{verify.customverifys.length}</span> : null} |
| | | </span> |
| | | } key="3"> |
| | | } key="customverifys"> |
| | | <CustomForm |
| | | dict={this.props.dict} |
| | | btn={this.props.card} |
| | |
| | | /> |
| | | <EditTable actions={['move']} data={verify.customverifys} columns={customColumns} onChange={(customverifys) => {this.setState({verify: {...verify, customverifys}})}}/> |
| | | </TabPane> : null} |
| | | {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ |
| | | {verifyInter === 'system' ? <TabPane tab={ |
| | | <span> |
| | | 单号生成 |
| | | {verify.billcodes.length ? <span className="count-tip">{verify.billcodes.length}</span> : null} |
| | | </span> |
| | | } key="4"> |
| | | } key="billcodes"> |
| | | <BillcodeForm |
| | | fields={fields} |
| | | btn={this.props.card} |
| | |
| | | /> |
| | | <EditTable actions={['move']} data={verify.billcodes} columns={orderColumns} onChange={(billcodes) => {this.setState({verify: {...verify, billcodes}})}}/> |
| | | </TabPane> : null} |
| | | {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ |
| | | {verifyInter === 'system' ? <TabPane tab={ |
| | | <span> |
| | | {card.Ot !== 'requiredOnce' ? '唯一性验证' : '同类数据验证'} |
| | | {verify.uniques.length ? <span className="count-tip">{verify.uniques.length}</span> : null} |
| | | </span> |
| | | } key="2"> |
| | | } key="uniques"> |
| | | <UniqueForm |
| | | btn={card} |
| | | fields={card.Ot !== 'requiredOnce' ? uniqueFields : columnsFields} |
| | | dict={this.props.dict} |
| | | uniqueChange={this.uniqueChange} |
| | | /> |
| | | <EditTable actions={['edit', 'move', 'del']} data={verify.uniques} columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} onChange={this.changeUniques}/> |
| | | <EditTable actions={['edit', 'move', 'del', 'status']} data={verify.uniques} columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} onChange={this.changeUniques}/> |
| | | </TabPane> : null} |
| | | {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ |
| | | {verifyInter === 'system' ? <TabPane tab={ |
| | | <span> |
| | | 创建凭证 |
| | | {verify.voucher && verify.voucher.enabled ? <span className="count-tip">1</span> : null} |
| | | </span> |
| | | } key="5"> |
| | | } key="voucher"> |
| | | <VoucherForm |
| | | dict={this.props.dict} |
| | | voucher={voucher} |
| | |
| | | wrappedComponentRef={(inst) => this.voucherForm = inst} |
| | | /> |
| | | </TabPane> : null} |
| | | {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ |
| | | {verifyInter === 'system' ? <TabPane tab={ |
| | | <span> |
| | | 自定义脚本 |
| | | {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null} |
| | | </span> |
| | | } key="6"> |
| | | } key="scripts"> |
| | | <BorderOutlined className="full-scripts" onClick={() => { |
| | | if (this.scriptsForm && (this.scriptsForm.state.editItem || (this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))))) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请保存自定义脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | this.setState({visible: true, scriptId: ''}) |
| | | }}/> |
| | | <CustomScript |
| | | btn={this.props.card} |
| | | dict={this.props.dict} |
| | |
| | | 回调脚本 |
| | | {verify.cbScripts.length ? <span className="count-tip">{verify.cbScripts.length}</span> : null} |
| | | </span> |
| | | } key="6a"> |
| | | } key="cbScripts"> |
| | | <CallBackCustomScript |
| | | btn={this.props.card} |
| | | dict={this.props.dict} |
| | |
| | | /> |
| | | <EditTable actions={['move']} data={verify.cbScripts} columns={cbScriptsColumns} onChange={(cbScripts) => {this.setState({verify: {...verify, cbScripts}})}}/> |
| | | </TabPane> : null} |
| | | <TabPane tab="信息提示" key="7"> |
| | | <TabPane tab="信息提示" key="tip"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={verify.ntime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} /> |
| | | <InputNumber defaultValue={verify.ntime || (appType === 'mob' ? 3 : 10)} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={verify.ftime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} /> |
| | | <InputNumber defaultValue={verify.ftime || (appType === 'mob' ? 3 : 10)} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | |
| | | </Form> |
| | | </TabPane> |
| | | </Tabs> |
| | | <Modal |
| | | wrapClassName="model-custom-scripts-modal" |
| | | title="自定义脚本" |
| | | visible={visible} |
| | | width={'95vw'} |
| | | maskClosable={false} |
| | | destroyOnClose |
| | | > |
| | | <img className="unfull-scripts" src={MinView} onClick={() => this.setState({visible: false, scriptId: ''})} alt=""/> |
| | | <div className="script-table-wrap"> |
| | | {verify.scripts.map(item => { |
| | | let title = item.sql.match(/^\s*\/\*.+\*\//) |
| | | title = title && title[0] ? title[0] : '' |
| | | let _text = title ? item.sql.replace(title, '') : item.sql |
| | | |
| | | let position = null |
| | | if (item.position === 'init') { |
| | | position = <span style={{color: 'orange'}}>初始化</span> |
| | | } else if (item.position === 'front') { |
| | | position = <span style={{color: '#26C281'}}>sql前</span> |
| | | } else { |
| | | position = <span style={{color: '#1890ff'}}>sql后</span> |
| | | } |
| | | |
| | | return ( |
| | | <div className={'script-item ' + (this.state.scriptId === item.uuid ? 'active' : '') } key={item.uuid}> |
| | | <div style={{cursor: 'pointer'}} onClick={() => { |
| | | this.scriptsFullForm.edit(item) |
| | | this.setState({scriptId: item.uuid}) |
| | | }}> |
| | | {title ? <div style={{color: '#a50', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>{title}</div> : null} |
| | | <Paragraph copyable={{ text: item.sql }} ellipsis={{ rows: 4 }}>{_text}</Paragraph> |
| | | <div>{position}{item.status === 'false' ? |
| | | <span style={{color: '#ff4d4f', marginLeft: '20px'}}> |
| | | 禁用 |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </span> : |
| | | <span style={{color: '#26C281', marginLeft: '20px'}}> |
| | | 启用 |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </span>} |
| | | </div> |
| | | </div> |
| | | <div style={{textAlign: 'right'}}> |
| | | <span className="operation-btn" onClick={() => this.handleStatus(item, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(item, 'scripts') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> |
| | | </Popconfirm> |
| | | </div> |
| | | </div> |
| | | ) |
| | | })} |
| | | </div> |
| | | <CustomScript |
| | | type="fullscreen" |
| | | btn={this.props.card} |
| | | dict={this.props.dict} |
| | | initsql={this.state.initsql} |
| | | customScripts={verify.scripts} |
| | | defaultsql={this.state.defaultsql} |
| | | usefulfields={this.state.usefulfields} |
| | | systemScripts={this.state.systemScripts} |
| | | scriptsChange={this.scriptsChange} |
| | | wrappedComponentRef={(inst) => this.scriptsFullForm = inst} |
| | | /> |
| | | </Modal> |
| | | </div> |
| | | ) |
| | | } |