| | |
| | | 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, Select, Popconfirm, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd' |
| | | import { QuestionCircleOutlined, CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | |
| | | import options from '@/store/options.js' |
| | | import UniqueForm from './uniqueform' |
| | | import ContrastForm from './contrastform' |
| | | import CustomForm from './customform' |
| | | import CustomScript from './customscript' |
| | | import CallBackCustomScript from './callbackcustomscript' |
| | | import BillcodeForm from './billcodeform' |
| | | import VoucherForm from './voucherform' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { updateForm } from '@/utils/utils-update.js' |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | const { confirm } = Modal |
| | | const { Paragraph } = Typography |
| | | const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | | floor: PropTypes.any, // 是否为子表 |
| | | btnTab: PropTypes.any, // 表单标签页(按钮)参数 |
| | | config: PropTypes.any, // 表单标签页参数 |
| | | dict: PropTypes.object, // 字典项 |
| | |
| | | } |
| | | |
| | | state = { |
| | | initsql: '', // sql验证时变量声明及赋值 |
| | | initsql: '', // sql验证时变量声明及赋值 |
| | | notes: [], // 短信模板 |
| | | setting: null, |
| | | verify: {}, |
| | | fields: [], |
| | | usefulfields: '', |
| | |
| | | voucherDetail: [], |
| | | systemScripts: [], |
| | | columnsFields: [], |
| | | unionFields: [], |
| | | uniqueFields: [], // 唯一性验证,表单字段 |
| | | uniqueColumns: [ |
| | | { |
| | | title: '字段名', |
| | | title: '名称', |
| | | dataIndex: 'fieldlabel', |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: '字段', |
| | | dataIndex: 'field', |
| | | width: '35%' |
| | | width: '20%', |
| | | editable: true, |
| | | inputType: 'multiStr', |
| | | options: [] |
| | | }, |
| | | { |
| | | title: '报错编码', |
| | | dataIndex: 'errorCode', |
| | | width: '12%' |
| | | width: '13%', |
| | | editable: true, |
| | | inputType: 'select', |
| | | options: [ |
| | | { value: 'E', text: 'E' }, |
| | | { value: 'N', text: 'N' }, |
| | | { value: 'F', text: 'F' }, |
| | | { value: 'NM', text: 'NM' } |
| | | ] |
| | | }, |
| | | { |
| | | title: '验证类型', |
| | | dataIndex: 'verifyType', |
| | | width: '13%', |
| | | render: (text, record) => record.verifyType === 'logic' ? '逻辑验证' : '物理验证' |
| | | width: '14%', |
| | | render: (text, record) => record.verifyType === 'logic' ? '逻辑验证' : '物理验证', |
| | | inputType: 'select', |
| | | editable: true, |
| | | options: [ |
| | | { value: 'physical', text: '物理验证' }, |
| | | { value: 'logic', text: '逻辑验证' } |
| | | ] |
| | | }, |
| | | { |
| | | title: '状态', |
| | | title: '是否启用', |
| | | dataIndex: 'status', |
| | | width: '15%', |
| | | width: '14%', |
| | | editable: true, |
| | | required: false, |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.open']} |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '25%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'unique')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'unique', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'unique')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'unique') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | </div>) |
| | | } |
| | | ], |
| | | onceUniqueColumns: [ |
| | | { |
| | | title: '字段名', |
| | | dataIndex: 'field', |
| | | width: '45%' |
| | | title: '名称', |
| | | dataIndex: 'fieldlabel', |
| | | width: '30%' |
| | | }, |
| | | { |
| | | title: '状态', |
| | | dataIndex: 'status', |
| | | title: '字段', |
| | | dataIndex: 'field', |
| | | width: '30%', |
| | | editable: true, |
| | | inputType: 'multiStr', |
| | | options: [] |
| | | }, |
| | | { |
| | | title: '是否启用', |
| | | dataIndex: 'status', |
| | | width: '20%', |
| | | editable: true, |
| | | required: false, |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.open']} |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '25%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'unique')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'unique', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'unique')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'unique') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | </div>) |
| | | } |
| | | ], |
| | | contrastColumns: [ |
| | | { |
| | | title: '内容1', |
| | | dataIndex: 'frontfield', |
| | | width: '13%' |
| | | width: '14%', |
| | | inputType: 'input', |
| | | editable: true |
| | | }, |
| | | { |
| | | title: '运算符', |
| | | dataIndex: 'operator', |
| | | width: '13%' |
| | | width: '14%', |
| | | editable: true, |
| | | inputType: 'select', |
| | | options: [ |
| | | { value: '=', text: '=' }, |
| | | { value: '!=', text: '!=' }, |
| | | { value: '>', text: '>' }, |
| | | { value: '<', text: '<' }, |
| | | { value: '>=', text: '>=' }, |
| | | { value: '<=', text: '<=' }, |
| | | { value: 'in', text: 'in' }, |
| | | { value: 'like', text: 'like' } |
| | | ] |
| | | }, |
| | | { |
| | | title: '内容2', |
| | | dataIndex: 'backfield', |
| | | width: '13%', |
| | | width: '14%', |
| | | inputType: 'input', |
| | | editable: true |
| | | }, |
| | | { |
| | | title: '提示信息', |
| | | dataIndex: 'errmsg', |
| | | width: '13%' |
| | | width: '14%', |
| | | inputType: 'input', |
| | | editable: true |
| | | }, |
| | | { |
| | | title: '报错编码', |
| | | dataIndex: 'errorCode', |
| | | width: '13%' |
| | | width: '14%', |
| | | editable: true, |
| | | inputType: 'select', |
| | | options: [ |
| | | { value: 'E', text: 'E' }, |
| | | { value: 'N', text: 'N' }, |
| | | { value: 'F', text: 'F' }, |
| | | { value: 'NM', text: 'NM' } |
| | | ] |
| | | }, |
| | | { |
| | | title: '状态', |
| | | title: '是否启用', |
| | | dataIndex: 'status', |
| | | width: '15%', |
| | | width: '13%', |
| | | editable: true, |
| | | required: false, |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.open']} |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '20%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'contrast')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'contrast', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'contrast', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'contrast')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'contrast') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | </div>) |
| | | } |
| | | ], |
| | | customColumns: [ |
| | |
| | | title: 'SQL', |
| | | dataIndex: 'sql', |
| | | width: '45%', |
| | | render: (text) => ( |
| | | <Paragraph copyable ellipsis={{ rows: 5, expandable: true }}>{text}</Paragraph> |
| | | ) |
| | | render: (text) => { |
| | | let title = text.match(/^\s*\/\*.+\*\//) |
| | | title = title && title[0] ? title[0] : '' |
| | | 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> |
| | | </div> |
| | | ) |
| | | } |
| | | }, |
| | | { |
| | | title: '结果处理', |
| | |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.open']} |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | width: '15%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'customverify', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'customverify', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | (<div style={{textAlign: 'center'}}> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><EditOutlined /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><SwapOutlined /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'customverify') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> |
| | | </Popconfirm> |
| | | </div>) |
| | | } |
| | |
| | | title: 'SQL', |
| | | dataIndex: 'sql', |
| | | width: '60%', |
| | | render: (text) => ( |
| | | <Paragraph copyable ellipsis={{ rows: 5, expandable: true }}>{text}</Paragraph> |
| | | ) |
| | | render: (text) => { |
| | | let title = text.match(/^\s*\/\*.+\*\//) |
| | | title = title && title[0] ? title[0] : '' |
| | | 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> |
| | | </div> |
| | | ) |
| | | } |
| | | }, |
| | | { |
| | | title: '执行位置', |
| | |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.open']} |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | width: '20%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'scripts', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'scripts', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | (<div style={{textAlign: 'center'}}> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><EditOutlined /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'scripts') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> |
| | | </Popconfirm> |
| | | </div>) |
| | | } |
| | | ], |
| | | cbScriptsColumns: [ |
| | | { |
| | | title: 'SQL', |
| | | dataIndex: 'sql', |
| | | width: '60%', |
| | | render: (text) => { |
| | | let title = text.match(/^\s*\/\*.+\*\//) |
| | | title = title && title[0] ? title[0] : '' |
| | | 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> |
| | | </div> |
| | | ) |
| | | } |
| | | }, |
| | | { |
| | | title: '执行位置', |
| | | dataIndex: 'position', |
| | | width: '10%', |
| | | render: (text, record) => { |
| | | if (record.position === 'front') { |
| | | return 'sql前' |
| | | } else { |
| | | return 'sql后' |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: '状态', |
| | | dataIndex: 'status', |
| | | width: '10%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '20%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div style={{textAlign: 'center'}}> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'cbscripts')} style={{color: '#1890ff'}}><EditOutlined /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'cbscripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'cbscripts') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> |
| | | </Popconfirm> |
| | | </div>) |
| | | } |
| | |
| | | if (record.TypeCharOne === 'n') { |
| | | _text = record.ModularDetailCode + Array(_type).join('0') + '1' |
| | | } else if (record.TypeCharOne === 'Y') { |
| | | _text = record.ModularDetailCode + moment().format('YYYYMMDD') + Array(_type).join('0') + '1' |
| | | _text = record.ModularDetailCode + moment().format('YYMMDD') + Array(_type).join('0') + '1' |
| | | } else if (record.TypeCharOne === 'Lp') { |
| | | _text = Array(_type).join('0') + '10' |
| | | } else if (record.TypeCharOne === 'BN') { |
| | | _text = moment().format('YYYYMMDD') + Array(_type).join('0') + '1' |
| | | _text = moment().format('YYMMDD') + Array(_type).join('0') + '1' |
| | | } |
| | | return _text |
| | | } |
| | |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | {this.props.dict['model.status.open']} |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | width: '15%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'ordercode', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'ordercode', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | (<div style={{textAlign: 'center'}}> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><EditOutlined /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><SwapOutlined /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | onConfirm={() => this.handleDelete(record, 'ordercode') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> |
| | | </Popconfirm> |
| | | </div>) |
| | | } |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { columns, config, card } = this.props |
| | | let _verify = this.props.card.verify || {} |
| | | const { columns, config, card, btnTab } = this.props |
| | | let _verify = card.verify || {} |
| | | |
| | | let _invalid = _verify.invalid |
| | | |
| | |
| | | } |
| | | |
| | | _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 || [] |
| | | _verify.accountdate = _verify.accountdate || 'false' |
| | | _verify.accountfield = _verify.accountfield || '' |
| | | _verify.voucherdate = _verify.voucherdate || '' |
| | | _verify.customverifys = _verify.customverifys || [] |
| | | _verify.billcodes = _verify.billcodes || [] |
| | | _verify.voucher = _verify.voucher || {enabled: false} |
| | | _verify.scripts = _verify.scripts || [] |
| | | _verify.cbScripts = _verify.cbScripts || [] |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') |
| | | _verify.customverifys.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | _verify.scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | _verify.cbScripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | setting: config.setting || {}, |
| | | verify: _verify |
| | | }) |
| | | |
| | | // 按钮-表单标签页 |
| | | if (this.props.card.btnType) { |
| | | if (config.Template !== 'FormTab' && (card.intertype === 'inner' || card.intertype === 'outer')) { // 内部或外部接口 |
| | | return |
| | | } |
| | | |
| | | new Promise(resolve => { |
| | | let _fields = [] |
| | | |
| | | config.groups.forEach(group => { |
| | | _fields.push(...group.sublist) |
| | | }) |
| | | |
| | | let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'UserName', 'FullName', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode'] |
| | | let _declare = ['@UserName nvarchar(50)', '@FullName 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=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\''] |
| | | let fieldArr = _usefulfields.map(_f => _f.toLowerCase()) |
| | | |
| | | _fields.forEach(_f => { |
| | | if (_f.field) { |
| | | if (fieldArr.includes(_f.field.toLowerCase())) return |
| | | fieldArr.push(_f.field.toLowerCase()) |
| | | |
| | | _usefulfields.push(_f.field) |
| | | |
| | | let _fieldlen = _f.fieldlength || 50 |
| | | |
| | | if (['textarea', 'fileupload', 'multiselect'].includes(_f.type)) { |
| | | _fieldlen = _f.fieldlength || 512 |
| | | } else if (_f.type === 'number') { |
| | | _fieldlen = _f.decimal ? _f.decimal : 0 |
| | | } |
| | | |
| | | if (_fieldlen > 2048) { |
| | | _fieldlen = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${_fieldlen})` |
| | | |
| | | if (_f.type.match(/date/ig)) { |
| | | _type = 'datetime' |
| | | _select.push(`@${_f.field}='1900-01-01'`) |
| | | } else if (_f.type === 'number') { |
| | | _type = `decimal(18,${_fieldlen})` |
| | | _select.push(`@${_f.field}=0`) |
| | | if (config.Template === 'FormTab') { |
| | | config.groups.forEach(group => { |
| | | _fields.push(...group.sublist) |
| | | }) |
| | | resolve(_fields) |
| | | } else if (card.modal) { |
| | | _fields = card.modal.fields || [] |
| | | resolve(_fields) |
| | | } else if (card.OpenType === 'pop') { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: card.uuid |
| | | }).then(res => { |
| | | if (res.status) { |
| | | let _LongParam = '' |
| | | if (res.LongParam) { |
| | | try { |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (!_LongParam) { |
| | | message.warning('未获取到表单信息,部分验证将无法设置!') |
| | | } else { |
| | | _LongParam = updateForm(_LongParam) |
| | | _fields = _LongParam.fields || [] |
| | | } |
| | | } else { |
| | | _select.push(`@${_f.field}=''`) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve(_fields) |
| | | }) |
| | | } else { |
| | | 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 fieldArr = _usefulfields.map(_f => _f.toLowerCase()) |
| | | let hasBid = false |
| | | |
| | | _declare.push(`@${_f.field} ${_type}`) |
| | | _fields = _fields.filter(_f => _f.field) |
| | | _fields.forEach(_f => { |
| | | if (fieldArr.includes(_f.field.toLowerCase())) return |
| | | |
| | | fieldArr.push(_f.field.toLowerCase()) |
| | | |
| | | _usefulfields.push(_f.field) |
| | | |
| | | let _fieldlen = _f.fieldlength || 50 |
| | | |
| | | if (_f.type === 'number') { |
| | | _fieldlen = _f.decimal ? _f.decimal : 0 |
| | | } |
| | | |
| | | if (_fieldlen > 2048) { |
| | | _fieldlen = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${_fieldlen})` |
| | | |
| | | if (_f.type.match(/date/ig)) { |
| | | _type = 'datetime' |
| | | _select.push(`@${_f.field}='1900-01-01'`) |
| | | } else if (_f.type === 'number') { |
| | | _type = `decimal(18,${_fieldlen})` |
| | | _select.push(`@${_f.field}=0`) |
| | | } else { |
| | | _select.push(`@${_f.field}=''`) |
| | | } |
| | | |
| | | _declare.push(`@${_f.field} ${_type}`) |
| | | |
| | | if (_f.field.toLowerCase() === 'bid') { |
| | | hasBid = true |
| | | } |
| | | }) |
| | | |
| | | if (columns && columns.length > 0 && this.props.btnTab.Ot !== 'notRequired' && this.props.btnTab.Ot !== 'requiredOnce') { |
| | | 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 |
| | | if (columns && columns.length > 0) { |
| | | if (btnTab) { // 表单标签 |
| | | if (btnTab.Ot !== 'notRequired' && btnTab.Ot !== 'requiredOnce') { |
| | | hasColumn = true |
| | | } |
| | | } else if (card.Ot !== 'notRequired' && card.Ot !== 'requiredOnce') { |
| | | hasColumn = true |
| | | } |
| | | } |
| | | |
| | | let unionFields = fromJS(_fields).toJS() |
| | | let formArr = _fields.map(_f => _f.field.toLowerCase()) |
| | | |
| | | if (hasColumn) { |
| | | columns.forEach(_f => { |
| | | if (_f.field && !formArr.includes(_f.field.toLowerCase())) { |
| | | formArr.push(_f.field.toLowerCase()) |
| | | unionFields.push(_f) |
| | | } |
| | | if (!_f.field || fieldArr.includes(_f.field.toLowerCase())) return |
| | | |
| | | fieldArr.push(_f.field.toLowerCase()) |
| | | |
| | | _usefulfields.push(_f.field) |
| | | |
| | | let _fieldlen = _f.fieldlength || 50 |
| | | if (_f.datatype) { // 自定义字段 |
| | | if (/decimal/ig.test(_f.datatype)) { |
| | | _select.push(`@${_f.field}=0`) |
| | | } else { |
| | | _select.push(`@${_f.field}=''`) |
| | | } |
| | | |
| | | if (_f.type === 'picture' || _f.type === 'textarea') { |
| | | _fieldlen = _f.fieldlength || 512 |
| | | _declare.push(`@${_f.field} ${_f.datatype}`) |
| | | return |
| | | } |
| | | |
| | | let _fieldlen = _f.fieldlength || 50 |
| | | |
| | | if (_fieldlen > 2048) { |
| | | _fieldlen = 'max' |
| | |
| | | }) |
| | | } |
| | | |
| | | _usefulfields = _usefulfields.join(', ') |
| | | let _sql = `Declare ${_declare.join(', ')} |
| | | Select ${_select.join(', ')} |
| | | ` |
| | | |
| | | // 默认sql |
| | | let _defaultsql = '' |
| | | let _insertsql = '' |
| | | let _updatesql = '' |
| | | |
| | | if (this.props.card.sqlType === 'insert' || this.props.card.sqlType === 'insertOrUpdate') { |
| | | if (card.sqlType === 'insert' || card.sqlType === 'insertOrUpdate') { |
| | | let keys = [] |
| | | let values = [] |
| | | |
| | | _fields.forEach(item => { |
| | | if (!item.field) return |
| | | if (!item.field || item.writein === 'false') return |
| | | |
| | | keys.push(item.field.toLowerCase()) |
| | | values.push('@' + item.field) |
| | | |
| | | if (item.field.toLowerCase() === 'bid' && item.uuid === 'BID') { |
| | | values.push('@BID@') |
| | | } else { |
| | | values.push('@' + item.field) |
| | | } |
| | | }) |
| | | |
| | | if (config.setting.primaryKey && !keys.includes(config.setting.primaryKey.toLowerCase())) { |
| | |
| | | |
| | | keys = keys.join(', ') |
| | | values = values.join(', ') |
| | | _insertsql = `insert into ${this.props.card.sql} (${keys}) select ${values};` |
| | | _insertsql = `insert into ${card.sql} (${keys}) select ${values};` |
| | | } |
| | | |
| | | if (this.props.card.sqlType === 'update' || this.props.card.sqlType === 'insertOrUpdate') { |
| | | |
| | | if (card.sqlType === 'update' || card.sqlType === 'audit' || card.sqlType === 'insertOrUpdate') { |
| | | let _form = [] |
| | | let _arr = [] |
| | | |
| | | _fields.forEach(item => { |
| | | if (!item.field) return |
| | | if (!item.field || item.writein === 'false') return |
| | | |
| | | _arr.push(item.field.toLowerCase()) |
| | | _form.push(item.field + '=@' + item.field) |
| | | }) |
| | | |
| | | if (!_arr.includes('modifydate')) { |
| | | _form.push('modifydate=getdate()') |
| | | } |
| | | if (!_arr.includes('modifyuserid')) { |
| | | _form.push('modifyuserid=@userid@') |
| | | if (this.props.card.sqlType === 'audit') { |
| | | if (!_arr.includes('submitdate')) { |
| | | _form.push('submitdate=getdate()') |
| | | } |
| | | if (!_arr.includes('submituserid')) { |
| | | _form.push('submituserid=@userid@') |
| | | } |
| | | if (!_arr.includes('submituser')) { |
| | | _form.push('submituser=@username') |
| | | } |
| | | } else { |
| | | if (!_arr.includes('modifydate')) { |
| | | _form.push('modifydate=getdate()') |
| | | } |
| | | if (!_arr.includes('modifyuser')) { |
| | | _form.push('modifyuser=@username') |
| | | } |
| | | if (!_arr.includes('modifyuserid')) { |
| | | _form.push('modifyuserid=@userid@') |
| | | } |
| | | } |
| | | |
| | | if (_verify.voucher && _verify.voucher.enabled) { |
| | |
| | | } |
| | | |
| | | _form = _form.join(', ') |
| | | _updatesql = `update ${this.props.card.sql} set ${_form} where ${config.setting.primaryKey}=@ID@;` |
| | | _updatesql = `update ${card.sql} set ${_form} where ${config.setting.primaryKey || 'id'}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` |
| | | } |
| | | |
| | | let _defaultsql = '' |
| | | |
| | | if (this.props.card.sqlType === 'insert') { |
| | | if (card.sqlType === 'insert') { |
| | | _defaultsql = _insertsql |
| | | } else if (this.props.card.sqlType === 'update') { |
| | | } else if (card.sqlType === 'update' || card.sqlType === 'audit') { |
| | | _defaultsql = _updatesql |
| | | } else if (this.props.card.sqlType === 'insertOrUpdate') { |
| | | } else if (card.sqlType === 'insertOrUpdate') { |
| | | _defaultsql += `select @tbid='' |
| | | select @tbid='X' from ${this.props.card.sql} where ${config.setting.primaryKey}=@ID@ |
| | | select @tbid='X' from ${card.sql} where ${config.setting.primaryKey || 'id'}=@ID@ |
| | | if @tbid='' |
| | | begin |
| | | ${_insertsql} |
| | |
| | | ${_updatesql} |
| | | end |
| | | ` |
| | | } |
| | | |
| | | this.setState({ |
| | | fields: _fields, |
| | | initsql: _sql, |
| | | defaultsql: _defaultsql, |
| | | usefulfields: _usefulfields |
| | | }, () => { |
| | | this.getsysScript() |
| | | }) |
| | | |
| | | return |
| | | } |
| | | |
| | | // 通用按钮 |
| | | if (this.props.card.OpenType === 'pop') { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: this.props.card.uuid |
| | | }).then(res => { |
| | | if (res.status) { |
| | | let _LongParam = '' |
| | | if (res.LongParam) { |
| | | try { |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (!_LongParam) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '表单未添加或解析错误,请检查表单设置!', |
| | | duration: 5 |
| | | }) |
| | | |
| | | this.getsysScript() |
| | | |
| | | return |
| | | } |
| | | |
| | | let _fields = [] |
| | | if (_LongParam.groups.length > 0) { |
| | | _LongParam.groups.forEach(group => { |
| | | _fields.push(...group.sublist) |
| | | }) |
| | | } else { |
| | | _fields = _LongParam.fields |
| | | } |
| | | |
| | | let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'UserName', 'FullName', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode'] |
| | | let _declare = ['@UserName nvarchar(50)', '@FullName 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=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\''] |
| | | let hasBid = false |
| | | let fieldArr = _usefulfields.map(_f => _f.toLowerCase()) |
| | | let _defaultfields = fromJS(_fields).toJS() |
| | | |
| | | _fields.forEach(_f => { |
| | | if (_f.field) { |
| | | if (fieldArr.includes(_f.field.toLowerCase())) return |
| | | fieldArr.push(_f.field.toLowerCase()) |
| | | |
| | | _usefulfields.push(_f.field) |
| | | |
| | | let _fieldlen = _f.fieldlength || 50 |
| | | |
| | | if (['textarea', 'fileupload', 'multiselect'].includes(_f.type)) { |
| | | _fieldlen = _f.fieldlength || 512 |
| | | } else if (_f.type === 'number') { |
| | | _fieldlen = _f.decimal ? _f.decimal : 0 |
| | | } |
| | | |
| | | if (_fieldlen > 2048) { |
| | | _fieldlen = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${_fieldlen})` |
| | | |
| | | if (_f.type.match(/date/ig)) { |
| | | _type = 'datetime' |
| | | _select.push(`@${_f.field}='1900-01-01'`) |
| | | } else if (_f.type === 'number') { |
| | | _type = `decimal(18,${_fieldlen})` |
| | | _select.push(`@${_f.field}=0`) |
| | | } else { |
| | | _select.push(`@${_f.field}=''`) |
| | | } |
| | | |
| | | _declare.push(`@${_f.field} ${_type}`) |
| | | } |
| | | if (_f.field && _f.field.toLowerCase() === 'bid') { |
| | | hasBid = true |
| | | } |
| | | }) |
| | | |
| | | if (this.props.floor === 'subtable' && !hasBid) { // 子表表单中增加BID |
| | | _fields.unshift({ |
| | | uuid: 'BID', |
| | | field: 'BID', |
| | | label: 'BID', |
| | | type: 'text' |
| | | }) |
| | | } |
| | | |
| | | if (columns && columns.length > 0 && this.props.card.Ot !== 'notRequired' && this.props.card.Ot !== 'requiredOnce') { |
| | | columns.forEach(_f => { |
| | | if (!_f.field || fieldArr.includes(_f.field.toLowerCase())) return |
| | | |
| | | fieldArr.push(_f.field.toLowerCase()) |
| | | |
| | | _usefulfields.push(_f.field) |
| | | |
| | | let _fieldlen = _f.fieldlength || 50 |
| | | |
| | | if (_f.type === 'picture' || _f.type === 'textarea') { |
| | | _fieldlen = _f.fieldlength || 512 |
| | | } |
| | | |
| | | if (_fieldlen > 2048) { |
| | | _fieldlen = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${_fieldlen})` |
| | | |
| | | if (_f.type === 'number') { |
| | | _type = `decimal(18,${_f.decimal ? _f.decimal : 0})` |
| | | } else if (_f.type === 'picture' || _f.type === 'textarea') { |
| | | _type = `nvarchar(${_fieldlen})` |
| | | } |
| | | |
| | | if (_f.type === 'number') { |
| | | _select.push(`@${_f.field}=0`) |
| | | } else { |
| | | _select.push(`@${_f.field}=''`) |
| | | } |
| | | |
| | | _declare.push(`@${_f.field} ${_type}`) |
| | | }) |
| | | } |
| | | |
| | | _usefulfields = _usefulfields.join(', ') |
| | | let _sql = `Declare ${_declare.join(', ')} |
| | | Select ${_select.join(', ')} |
| | | ` |
| | | |
| | | // 默认sql |
| | | let _defaultsql = '' |
| | | |
| | | if (this.props.card.sqlType === 'insert') { |
| | | let keys = [] |
| | | let values = [] |
| | | _defaultfields.forEach(item => { |
| | | if (!item.field) return |
| | | |
| | | keys.push(item.field.toLowerCase()) |
| | | values.push('@' + item.field) |
| | | }) |
| | | |
| | | if (config.setting.primaryKey && !keys.includes(config.setting.primaryKey.toLowerCase())) { |
| | | keys.push(config.setting.primaryKey.toLowerCase()) |
| | | values.push('@ID@') |
| | | } |
| | | if (!keys.includes('createuserid')) { |
| | | keys.push('createuserid') |
| | | values.push('@userid@') |
| | | } |
| | | if (!keys.includes('createuser')) { |
| | | keys.push('createuser') |
| | | values.push('@username') |
| | | } |
| | | if (!keys.includes('createstaff')) { |
| | | keys.push('createstaff') |
| | | values.push('@fullname') |
| | | } |
| | | if (!keys.includes('bid')) { |
| | | keys.push('bid') |
| | | values.push('@BID@') |
| | | } |
| | | |
| | | keys = keys.join(', ') |
| | | values = values.join(', ') |
| | | _defaultsql = `insert into ${this.props.card.sql} (${keys}) select ${values};` |
| | | } else if (this.props.card.sqlType === 'update' || this.props.card.sqlType === 'audit') { |
| | | let _form = [] |
| | | let _arr = [] |
| | | |
| | | _defaultfields.forEach(item => { |
| | | if (!item.field) return |
| | | |
| | | _arr.push(item.field.toLowerCase()) |
| | | _form.push(item.field + '=@' + item.field) |
| | | }) |
| | | |
| | | if (this.props.card.sqlType === 'audit') { |
| | | if (!_arr.includes('submitdate')) { |
| | | _form.push('submitdate=getdate()') |
| | | } |
| | | if (!_arr.includes('submituserid')) { |
| | | _form.push('submituserid=@userid@') |
| | | } |
| | | } else { |
| | | if (!_arr.includes('modifydate')) { |
| | | _form.push('modifydate=getdate()') |
| | | } |
| | | if (!_arr.includes('modifyuserid')) { |
| | | _form.push('modifyuserid=@userid@') |
| | | } |
| | | } |
| | | |
| | | if (_verify.voucher && _verify.voucher.enabled) { |
| | | if (!_arr.includes('bvoucher')) { |
| | | _form.push('BVoucher=@BVoucher') |
| | | } |
| | | if (!_arr.includes('fibvoucherdate')) { |
| | | _form.push('FIBVoucherDate=@FIBVoucherDate') |
| | | } |
| | | if (!_arr.includes('fiyear')) { |
| | | _form.push('FiYear=@FiYear') |
| | | } |
| | | } |
| | | |
| | | _form = _form.join(', ') |
| | | _defaultsql = `update ${this.props.card.sql} set ${_form} where ${config.setting.primaryKey}${this.props.card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` |
| | | } |
| | | |
| | | this.setState({ |
| | | fields: _fields, |
| | | initsql: _sql, |
| | | defaultsql: _defaultsql, |
| | | usefulfields: _usefulfields |
| | | }, () => { |
| | | this.getsysScript() |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | this.getsysScript() |
| | | } else if (card.sqlType === 'LogicDelete' || card.sqlType === 'custom') { |
| | | let _voucher = '' |
| | | if (_verify.voucher && _verify.voucher.enabled) { |
| | | _voucher = ',BVoucher=@BVoucher,FIBVoucherDate=@FIBVoucherDate,FiYear=@FiYear' |
| | | } |
| | | }) |
| | | } else { |
| | | let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'UserName', 'FullName', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode'] |
| | | let _declare = ['@UserName nvarchar(50)', '@FullName 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=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\''] |
| | | let fieldArr = _usefulfields.map(_f => _f.toLowerCase()) |
| | | |
| | | if (columns && columns.length > 0 && this.props.card.Ot !== 'notRequired' && this.props.card.Ot !== 'requiredOnce') { |
| | | columns.forEach(_f => { |
| | | if (!_f.field || fieldArr.includes(_f.field.toLowerCase())) return |
| | | |
| | | fieldArr.push(_f.field.toLowerCase()) |
| | | |
| | | _usefulfields.push(_f.field) |
| | | |
| | | let _fieldlen = _f.fieldlength || 50 |
| | | |
| | | if (_f.type === 'picture' || _f.type === 'textarea') { |
| | | _fieldlen = _f.fieldlength || 512 |
| | | } |
| | | |
| | | if (_fieldlen > 2048) { |
| | | _fieldlen = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${_fieldlen})` |
| | | |
| | | if (_f.type === 'number') { |
| | | _type = `decimal(18,${_f.decimal ? _f.decimal : 0})` |
| | | } else if (_f.type === 'picture' || _f.type === 'textarea') { |
| | | _type = `nvarchar(${_fieldlen})` |
| | | } |
| | | |
| | | if (_f.type === 'number') { |
| | | _select.push(`@${_f.field}=0`) |
| | | } else { |
| | | _select.push(`@${_f.field}=''`) |
| | | } |
| | | |
| | | _declare.push(`@${_f.field} ${_type}`) |
| | | }) |
| | | } |
| | | |
| | | _usefulfields = _usefulfields.join(', ') |
| | | let _sql = `Declare ${_declare.join(', ')} |
| | | Select ${_select.join(', ')} |
| | | ` |
| | | |
| | | // 默认sql |
| | | let _defaultsql = '' |
| | | |
| | | if (this.props.card.sqlType === 'LogicDelete') { |
| | | _defaultsql = `update ${this.props.card.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${config.setting.primaryKey}${this.props.card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` |
| | | } else if (this.props.card.sqlType === 'delete') { |
| | | _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@))'};` |
| | | } else if (card.sqlType === 'delete') { |
| | | let _msg = '' |
| | | if (columns && columns.length > 0 && this.props.card.Ot !== 'notRequired' && this.props.card.Ot !== 'requiredOnce') { |
| | | if (columns && columns.length > 0 && card.Ot !== 'notRequired' && card.Ot !== 'requiredOnce') { |
| | | let _index = 0 |
| | | columns.forEach(col => { |
| | | if (col.field && col.Hide !== 'true' && _index < 4) { |
| | | _msg += col.label + '=\'\',' |
| | | _index++ |
| | | } |
| | | if (!col.field || col.Hide === 'true' || _index >= 4) return |
| | | |
| | | _msg += col.label + '=\'\',' |
| | | _index++ |
| | | }) |
| | | } |
| | | _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('删除表:${this.props.card.sql} 数据: ${_msg}${config.setting.primaryKey}='+@ID@,200),@userid@,@username,@fullname delete ${this.props.card.sql} where ${config.setting.primaryKey}${this.props.card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` |
| | | _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@))'};` |
| | | } |
| | | |
| | | let _columns = [] |
| | | if (columns) { |
| | | _columns = fromJS(columns).toJS() |
| | | let hasbid = false |
| | | _columns = _columns.filter(col => { |
| | | if (col.field && col.field.toLowerCase() === 'bid') { |
| | | hasbid = true |
| | | } |
| | | |
| | | return !!col.field |
| | | }) |
| | | |
| | | if (!hasbid) { |
| | | _columns.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | fields: _fields, |
| | | columnsFields: _columns, |
| | | initsql: _sql, |
| | | defaultsql: _defaultsql, |
| | | usefulfields: _usefulfields |
| | | }, () => { |
| | | this.getsysScript() |
| | | usefulfields: _usefulfields.join(', '), |
| | | uniqueColumns: this.state.uniqueColumns.map(col => { |
| | | if (col.dataIndex === 'field') { |
| | | col.options = uniqueFields |
| | | } |
| | | return col |
| | | }), |
| | | onceUniqueColumns: this.state.onceUniqueColumns.map(col => { |
| | | if (col.dataIndex === 'field') { |
| | | col.options = _columns |
| | | } |
| | | return col |
| | | }), |
| | | unionFields, |
| | | uniqueFields |
| | | }) |
| | | } |
| | | |
| | | if (this.props.card.Ot === 'requiredOnce') { |
| | | let _columns = fromJS(config.columns).toJS() |
| | | _columns = _columns.filter(col => col.field) |
| | | |
| | | if (this.props.floor === 'subtable' && _columns.filter(col => col.field.toLowerCase() === 'bid').length === 0) { // 子表表单中增加BID |
| | | _columns.unshift({ |
| | | uuid: 'BID', |
| | | field: 'BID', |
| | | label: 'BID', |
| | | type: 'text' |
| | | }) |
| | | } |
| | | this.setState({ |
| | | columnsFields: _columns |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | 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 Appkey= @Appkey@ and deleted=0 order by ModularDetailCode desc`)) |
| | | }, |
| | | { |
| | | 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=@Appkey@ union |
| | | select distinct a.ModularDetailCode,a.ModularDetailCode+ModularDetailName as CodeName,ModularCode as BID, VoucherTypeTwo, IDefine1 |
| | | from (select * from sModularDetail where Deleted=0 and VoucherTypeTwo!='' and Appkey='') a |
| | | left join (select distinct ModularDetailCode from sModularDetail where Deleted=0 and VoucherTypeTwo!='' |
| | | and Appkey=@Appkey@) m on a.ModularDetailCode=m.ModularDetailCode where m.ModularDetailCode is null order by ModularDetailCode desc` |
| | | )) |
| | | }, |
| | | { |
| | | obj_name: 'noteCodes', |
| | | arr_field: 'templatecode,describe,id', |
| | | LText: window.btoa(window.encodeURIComponent(`select t.id,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`)) |
| | | }, |
| | | { |
| | | obj_name: 'scripts', |
| | | arr_field: 'funcname,longparam', |
| | | LText: window.btoa(window.encodeURIComponent(`Select distinct func+Remark as funcname,longparam, s.Sort from s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort`)) |
| | | } |
| | | ] |
| | | |
| | | 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 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' |
| | | } |
| | | |
| | | 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 |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | getsysScript = () => { |
| | | const { defaultsql } = this.state |
| | | |
| | | let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` |
| | | |
| | | _scriptSql = Utils.formatOptions(_scriptSql) |
| | | |
| | | let _sParam = { |
| | | let mutilparam = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: _scriptSql, |
| | | obj_name: 'data', |
| | | arr_field: 'funcname,longparam' |
| | | LText: mutilForms.join(' union all '), |
| | | obj_name: '', |
| | | arr_field: '', |
| | | table_type: 'Y' |
| | | } |
| | | |
| | | _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) |
| | | _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 云端数据验证 |
| | | |
| | | Api.getSystemConfig(_sParam).then(res => { |
| | | |
| | | 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) |
| | | |
| | | if (options.cloudServiceApi) { // 云端请求 |
| | | mutilparam.rduri = options.cloudServiceApi |
| | | mutilparam.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | mutilparam.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } |
| | | |
| | | Api.getSystemCacheConfig(mutilparam).then(res => { |
| | | if (res.status) { |
| | | let _scripts = [] |
| | | |
| | | if (defaultsql) { |
| | | _scripts.push({ |
| | | name: '默认sql', |
| | | value: defaultsql |
| | | }) |
| | | } |
| | | |
| | | res.data.forEach(item => { |
| | | let _item = { |
| | | name: item.funcname, |
| | | value: Utils.UnformatOptions(item.longparam) |
| | | } |
| | | |
| | | _scripts.push(_item) |
| | | }) |
| | | |
| | | this.setState({ |
| | | systemScripts: _scripts |
| | | orderModular: res.modular, |
| | | orderModularDetail: res.modularDetail, |
| | | voucher: res.voucher, |
| | | voucherDetail: res.voucherDetail, |
| | | notes: res.noteCodes.map(item => { |
| | | return { |
| | | name: item.describe, |
| | | value: item.templatecode, |
| | | id: item.id |
| | | } |
| | | }), |
| | | systemScripts: res.scripts.map(item => { |
| | | return { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | |
| | | } |
| | | |
| | | uniqueChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | let verify = fromJS(this.state.verify).toJS() |
| | | |
| | | if (values.uuid) { |
| | | verify.uniques = verify.uniques.map(item => { |
| | |
| | | verify.uniques.push(values) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | this.setState({ verify }) |
| | | } |
| | | |
| | | contrastChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | let verify = fromJS(this.state.verify).toJS() |
| | | |
| | | if (values.uuid) { |
| | | verify.contrasts = verify.contrasts.map(item => { |
| | | if (item.uuid === values.uuid) { |
| | | return values |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } else { |
| | | values.uuid = Utils.getuuid() |
| | | verify.contrasts.push(values) |
| | | } |
| | | values.status = 'true' |
| | | values.uuid = Utils.getuuid() |
| | | verify.contrasts.push(values) |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | this.setState({ verify }) |
| | | } |
| | | |
| | | customChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | let verify = fromJS(this.state.verify).toJS() |
| | | |
| | | if (values.uuid) { |
| | | verify.customverifys = verify.customverifys.map(item => { |
| | |
| | | verify.customverifys.push(values) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | this.setState({ verify }) |
| | | } |
| | | |
| | | scriptsChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | let verify = fromJS(this.state.verify).toJS() |
| | | |
| | | if (values.uuid) { |
| | | verify.scripts = verify.scripts.map(item => { |
| | |
| | | verify.scripts.push(values) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | this.setState({ verify }) |
| | | } |
| | | |
| | | cbScriptsChange = (values) => { |
| | | let verify = fromJS(this.state.verify).toJS() |
| | | |
| | | if (values.uuid) { |
| | | verify.cbScripts = verify.cbScripts.map(item => { |
| | | if (item.uuid === values.uuid) { |
| | | return values |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } else { |
| | | values.uuid = Utils.getuuid() |
| | | verify.cbScripts.push(values) |
| | | } |
| | | |
| | | this.setState({ verify }) |
| | | } |
| | | |
| | | orderChange = (values) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | let verify = fromJS(this.state.verify).toJS() |
| | | |
| | | if (values.uuid) { |
| | | verify.billcodes = verify.billcodes.map(item => { |
| | |
| | | verify.billcodes.push(values) |
| | | } |
| | | |
| | | this.setState({ verify }) |
| | | } |
| | | |
| | | onNoteCodeChange = (val, option) => { |
| | | const { verify } = this.state |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | verify: {...verify, noteCode: val, noteId: option.props.id} |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | 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) => { |
| | | const { verify } = this.state |
| | | |
| | | if (type === 'customverify') { |
| | | verify.customverifys = verify.customverifys.filter(item => item.uuid !== record.uuid) |
| | | } else if (type === 'unique') { |
| | | verify.uniques = verify.uniques.filter(item => item.uuid !== record.uuid) |
| | | } else if (type === 'ordercode') { |
| | | verify.billcodes = verify.billcodes.filter(item => item.uuid !== record.uuid) |
| | | } else if (type === 'scripts') { |
| | | verify.scripts = verify.scripts.filter(item => item.uuid !== record.uuid) |
| | | } else if (type === 'contrast') { |
| | | verify.contrasts = verify.contrasts.filter(item => item.uuid !== record.uuid) |
| | | } else if (type === 'cbscripts') { |
| | | verify.cbScripts = verify.cbScripts.filter(item => item.uuid !== record.uuid) |
| | | } |
| | | |
| | | this.setState({ verify: verify }) |
| | | this.setState({ verify }) |
| | | } |
| | | |
| | | handleEdit = (record, type) => { |
| | | if (type === 'customverify') { |
| | | this.customForm.edit(record) |
| | | } else if (type === 'unique') { |
| | | this.uniqueForm.edit(record) |
| | | } else if (type === 'ordercode') { |
| | | this.orderForm.edit(record) |
| | | } else if (type === 'scripts') { |
| | | this.scriptsForm.edit(record) |
| | | } else if (type === 'contrast') { |
| | | this.contrastForm.edit(record) |
| | | } else if (type === 'cbscripts') { |
| | | this.cbscriptsForm.edit(record) |
| | | } |
| | | |
| | | let node = document.getElementById('verify-card-box-tab').parentNode |
| | |
| | | } |
| | | |
| | | handleStatus = (record, type) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | let verify = fromJS(this.state.verify).toJS() |
| | | record.status = record.status === 'false' ? 'true' : 'false' |
| | | |
| | | if (type === 'customverify') { |
| | | verify.customverifys = verify.customverifys.map(item => { |
| | | if (item.uuid === record.uuid) { |
| | | return record |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } else if (type === 'unique') { |
| | | verify.uniques = verify.uniques.map(item => { |
| | | if (item.uuid === record.uuid) { |
| | | return record |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } else if (type === 'contrast') { |
| | | verify.contrasts = verify.contrasts.map(item => { |
| | | if (item.uuid === record.uuid) { |
| | | return record |
| | | } else { |
| | |
| | | return item |
| | | } |
| | | }) |
| | | } else if (type === 'cbscripts') { |
| | | verify.cbScripts = verify.cbScripts.map(item => { |
| | | if (item.uuid === record.uuid) { |
| | | return record |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } |
| | | |
| | | handleUpDown = (record, type, direction) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | let index = 0 |
| | | |
| | | if (type === 'customverify') { |
| | | verify.customverifys = verify.customverifys.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | return item.uuid !== record.uuid |
| | | }) |
| | | if ((index === 0 && direction === 'up') || (index === verify.customverifys.length && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | verify.customverifys.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.customverifys.splice(index + 1, 0, record) |
| | | } |
| | | } else if (type === 'unique') { |
| | | verify.uniques = verify.uniques.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | return item.uuid !== record.uuid |
| | | }) |
| | | if ((index === 0 && direction === 'up') || (index === verify.uniques.length && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | verify.uniques.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.uniques.splice(index + 1, 0, record) |
| | | } |
| | | } else if (type === 'contrast') { |
| | | verify.contrasts = verify.contrasts.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | return item.uuid !== record.uuid |
| | | }) |
| | | if ((index === 0 && direction === 'up') || (index === verify.contrasts.length && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | verify.contrasts.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.contrasts.splice(index + 1, 0, record) |
| | | } |
| | | } else if (type === 'ordercode') { |
| | | verify.billcodes = verify.billcodes.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | return item.uuid !== record.uuid |
| | | }) |
| | | if ((index === 0 && direction === 'up') || (index === verify.billcodes.length && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | verify.billcodes.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.billcodes.splice(index + 1, 0, record) |
| | | } |
| | | } else if (type === 'scripts') { |
| | | verify.scripts = verify.scripts.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | return item.uuid !== record.uuid |
| | | }) |
| | | if ((index === 0 && direction === 'up') || (index === verify.scripts.length && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | verify.scripts.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.scripts.splice(index + 1, 0, record) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | this.setState({ verify }) |
| | | } |
| | | |
| | | voucherChange = (voucher) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | changeUniques = (uniques) => { |
| | | const { card } = this.props |
| | | const { verify, fields, columnsFields } = this.state |
| | | |
| | | let _fields = [] |
| | | let change = {} |
| | | if (card.Ot !== 'requiredOnce') { |
| | | _fields = fields |
| | | } else { |
| | | _fields = columnsFields |
| | | } |
| | | |
| | | _fields.forEach(col => { |
| | | change[col.field] = col.label |
| | | }) |
| | | |
| | | uniques = uniques.map(item => { |
| | | item.status = item.status || 'true' |
| | | |
| | | if (Array.isArray(item.field)) { |
| | | item.fieldlabel = item.field.map(field => { |
| | | return change[field] || '' |
| | | }) |
| | | |
| | | item.fieldlabel = item.fieldlabel.join(',') |
| | | item.field = item.field.join(',') |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({verify: {...verify, uniques}}) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | const { card } = this.props |
| | | const { setting } = this.state |
| | | let verify = fromJS(this.state.verify).toJS() |
| | | |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | | if (verify.default === 'false' && verify.scripts.length === 0) { |
| | | if ((card.sqlType === 'custom' || verify.default === 'false') && verify.scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,必须设置自定义脚本!', |
| | | 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) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据源中自定义脚本过于复杂,不能使用失效验证!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _loading = false |
| | | let msg = '' |
| | | if (this.customForm && this.customForm.state.editItem) { |
| | | _loading = true |
| | | } else if (this.uniqueForm && this.uniqueForm.state.editItem) { |
| | | _loading = true |
| | | msg = '自定义验证' |
| | | } else if (this.customForm && this.customForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.customForm.props.form.getFieldValue('sql'))) { |
| | | msg = '自定义验证' |
| | | } else if (this.orderForm && this.orderForm.state.editItem) { |
| | | _loading = true |
| | | msg = '单号生成' |
| | | } else if (this.scriptsForm && this.scriptsForm.state.editItem) { |
| | | _loading = true |
| | | } else if (this.contrastForm && this.contrastForm.state.editItem) { |
| | | _loading = true |
| | | msg = '自定义脚本' |
| | | } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) { |
| | | msg = '自定义脚本' |
| | | } |
| | | |
| | | if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) { |
| | | _loading = true |
| | | } else if (this.customForm && this.customForm.props.form.getFieldValue('sql')) { |
| | | _loading = true |
| | | if (verify.noteEnable === 'true' && !verify.noteCode) { // 开启短信时,需要模板编码 |
| | | verify.noteEnable = 'false' |
| | | } else if (verify.noteEnable !== 'true' && verify.noteCode) { |
| | | verify.noteCode = '' |
| | | } |
| | | |
| | | if (_loading) { |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') |
| | | verify.customverifys.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | verify.scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | verify.cbScripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (msg) { |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | | content: msg + '未保存,确定提交吗?', |
| | | onOk() { |
| | | resolve(verify) |
| | | }, |
| | |
| | | |
| | | render() { |
| | | const { card } = this.props |
| | | const { verify, fields, uniqueColumns, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail } = this.state |
| | | const { verify, fields, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | |
| | | return ( |
| | | <div id="verify-card-box-tab"> |
| | | {card.intertype === 'system' ? <Tabs defaultActiveKey="1" className="verify-card-box"> |
| | | <TabPane tab="基础验证" key="1"> |
| | | <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执行顺序为自定义脚本之前'}> |
| | | <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 默认sql |
| | | </Tooltip> |
| | | }> |
| | |
| | | </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.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> |
| | | </TabPane> |
| | | <TabPane tab={ |
| | | </TabPane> : null} |
| | | {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ |
| | | <span> |
| | | 比较验证 |
| | | {verify.contrasts.length ? <span className="count-tip">{verify.contrasts.length}</span> : null} |
| | | </span> |
| | | } key="2x"> |
| | | <ContrastForm |
| | | dict={this.props.dict} |
| | | contrastChange={this.contrastChange} |
| | | wrappedComponentRef={(inst) => this.contrastForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.contrasts} |
| | | columns={contrastColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab={ |
| | | <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}})}/> |
| | | </TabPane> : null} |
| | | {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ |
| | | <span> |
| | | 自定义验证 |
| | | {verify.customverifys.length ? <span className="count-tip">{verify.customverifys.length}</span> : null} |
| | |
| | | customChange={this.customChange} |
| | | wrappedComponentRef={(inst) => this.customForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.customverifys} |
| | | columns={customColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab={ |
| | | <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={ |
| | | <span> |
| | | 单号生成 |
| | | {verify.billcodes.length ? <span className="count-tip">{verify.billcodes.length}</span> : null} |
| | |
| | | orderChange={this.orderChange} |
| | | wrappedComponentRef={(inst) => this.orderForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.billcodes} |
| | | columns={orderColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab={ |
| | | <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={ |
| | | <span> |
| | | {card.Ot !== 'requiredOnce' ? '唯一性验证' : '同类数据验证'} |
| | | {verify.uniques.length ? <span className="count-tip">{verify.uniques.length}</span> : null} |
| | |
| | | } key="2"> |
| | | <UniqueForm |
| | | btn={card} |
| | | fields={card.Ot !== 'requiredOnce' ? fields : columnsFields} |
| | | fields={card.Ot !== 'requiredOnce' ? uniqueFields : columnsFields} |
| | | dict={this.props.dict} |
| | | uniqueChange={this.uniqueChange} |
| | | wrappedComponentRef={(inst) => this.uniqueForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.uniques} |
| | | columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab={ |
| | | <EditTable actions={['edit', 'move', 'del']} 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={ |
| | | <span> |
| | | 创建凭证 |
| | | {verify.voucher && verify.voucher.enabled ? <span className="count-tip">1</span> : null} |
| | |
| | | voucherChange={this.voucherChange} |
| | | wrappedComponentRef={(inst) => this.voucherForm = inst} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab={ |
| | | </TabPane> : null} |
| | | {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={ |
| | | <span> |
| | | 自定义脚本 |
| | | {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null} |
| | | </span> |
| | | } key="6"> |
| | | <CustomScript |
| | | usefulfields={this.state.usefulfields} |
| | | initsql={this.state.initsql} |
| | | dict={this.props.dict} |
| | | 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.scriptsForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.scripts} |
| | | columns={scriptsColumns} |
| | | pagination={false} |
| | | <EditTable actions={['move']} data={verify.scripts} columns={scriptsColumns} onChange={(scripts) => {this.setState({verify: {...verify, scripts}})}}/> |
| | | </TabPane> : null} |
| | | {card.callbackType === 'script' && card.intertype === 'custom' ? <TabPane tab={ |
| | | <span> |
| | | 回调脚本 |
| | | {verify.cbScripts.length ? <span className="count-tip">{verify.cbScripts.length}</span> : null} |
| | | </span> |
| | | } key="6a"> |
| | | <CallBackCustomScript |
| | | btn={this.props.card} |
| | | dict={this.props.dict} |
| | | initsql={this.state.initsql} |
| | | customScripts={verify.cbScripts} |
| | | usefulfields={this.state.usefulfields} |
| | | systemScripts={this.state.systemScripts} |
| | | scriptsChange={this.cbScriptsChange} |
| | | wrappedComponentRef={(inst) => this.cbscriptsForm = inst} |
| | | /> |
| | | </TabPane> |
| | | <EditTable actions={['move']} data={verify.cbScripts} columns={cbScriptsColumns} onChange={(cbScripts) => {this.setState({verify: {...verify, cbScripts}})}}/> |
| | | </TabPane> : null} |
| | | <TabPane tab="信息提示" key="7"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | | </Tabs> : null} |
| | | {card.intertype !== 'system' ? <Tabs defaultActiveKey="7" className="verify-card-box"> |
| | | <TabPane tab="信息提示" key="7"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> S </span> |
| | | <Button onClick={() => {this.showError('S')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={verify.stime || 2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> Y </span> |
| | | <Button onClick={() => {this.showError('Y')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> N </span> |
| | | <Button onClick={() => {this.showError('N')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={verify.ntime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> F </span> |
| | | <Button onClick={() => {this.showError('F')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={verify.ftime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> E </span> |
| | | <Button onClick={() => {this.showError('E')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> NM </span> |
| | | <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> -1 </span> |
| | | 不提示 |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | | </Tabs> : null} |
| | | </Tabs> |
| | | </div> |
| | | ) |
| | | } |