From 102be577a7f8df2ae30045d55a1a5fc584f90363 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 19 十二月 2022 18:31:38 +0800 Subject: [PATCH] 2022-12-19 --- src/templates/zshare/verifycard/index.jsx | 727 ++++++++++++++++++++++++++++++++----------------------- 1 files changed, 417 insertions(+), 310 deletions(-) diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 5e448f2..e6e6c4f 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -1,12 +1,16 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { fromJS } from 'immutable' -import { Form, Tabs, Row, Col, Radio, Button, Select, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd' +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' @@ -16,6 +20,8 @@ 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 @@ -27,14 +33,19 @@ static propTpyes = { btnTab: PropTypes.any, // 琛ㄥ崟鏍囩椤碉紙鎸夐挳锛夊弬鏁� config: PropTypes.any, // 琛ㄥ崟鏍囩椤靛弬鏁� - dict: PropTypes.object, // 瀛楀吀椤� card: PropTypes.object, // 鎸夐挳淇℃伅 columns: PropTypes.array } state = { initsql: '', // sql楠岃瘉鏃跺彉閲忓0鏄庡強璧嬪�� + verifyInter: 'system', // 鎺ュ彛绫诲瀷 + activeKey: 'base', + appType: sessionStorage.getItem('appType'), notes: [], // 鐭俊妯℃澘 + setting: null, + visible: false, + scriptId: '', verify: {}, fields: [], usefulfields: '', @@ -95,15 +106,15 @@ 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" /> + <div style={{color: '#ff4d4f'}}> + 绂佺敤 + <StopOutlined style={{marginLeft: '5px'}} /> </div> ) : ( - <div> - {this.props.dict['model.status.open']} - <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> + <div style={{color: '#26C281'}}> + 鍚敤 + <CheckCircleOutlined style={{marginLeft: '5px'}}/> </div> ) } @@ -131,15 +142,15 @@ 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" /> + <div style={{color: '#ff4d4f'}}> + 绂佺敤 + <StopOutlined style={{marginLeft: '5px'}} /> </div> ) : ( - <div> - {this.props.dict['model.status.open']} - <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> + <div style={{color: '#26C281'}}> + 鍚敤 + <CheckCircleOutlined style={{marginLeft: '5px'}}/> </div> ) }, @@ -205,15 +216,15 @@ 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" /> + <div style={{color: '#ff4d4f'}}> + 绂佺敤 + <StopOutlined style={{marginLeft: '5px'}} /> </div> ) : ( - <div> - {this.props.dict['model.status.open']} - <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> + <div style={{color: '#26C281'}}> + 鍚敤 + <CheckCircleOutlined style={{marginLeft: '5px'}}/> </div> ) } @@ -226,12 +237,12 @@ 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> ) } @@ -257,15 +268,15 @@ width: '9%', render: (text, record) => record.status === 'false' ? ( - <div> - {this.props.dict['model.status.forbidden']} - <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> + <div style={{color: '#ff4d4f'}}> + 绂佺敤 + <StopOutlined style={{marginLeft: '5px'}} /> </div> ) : ( - <div> - {this.props.dict['model.status.open']} - <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> + <div style={{color: '#26C281'}}> + 鍚敤 + <CheckCircleOutlined style={{marginLeft: '5px'}}/> </div> ) }, @@ -276,14 +287,14 @@ dataIndex: 'operation', render: (text, record) => (<div style={{textAlign: 'center'}}> - <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.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> + <span className="operation-btn" title="缂栬緫" onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><EditOutlined /></span> + <span className="operation-btn" title="鐘舵�佸垏鎹�" onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><SwapOutlined /></span> <Popconfirm overlayClassName="popover-confirm" - title={this.props.dict['model.query.delete']} + title="纭畾鍒犻櫎鍚�?" 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>) } @@ -296,12 +307,12 @@ 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> ) } @@ -312,11 +323,11 @@ 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> } } }, @@ -326,33 +337,33 @@ width: '10%', render: (text, record) => record.status === 'false' ? ( - <div> - {this.props.dict['model.status.forbidden']} - <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> + <div style={{color: '#ff4d4f'}}> + 绂佺敤 + <StopOutlined style={{marginLeft: '5px'}} /> </div> ) : ( - <div> - {this.props.dict['model.status.open']} - <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> + <div style={{color: '#26C281'}}> + 鍚敤 + <CheckCircleOutlined style={{marginLeft: '5px'}}/> </div> ) }, { title: '鎿嶄綔', align: 'center', - width: '20%', + width: '140px', dataIndex: 'operation', render: (text, record) => (<div style={{textAlign: 'center'}}> - <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.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> + <span className="operation-btn" title="缂栬緫" onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><EditOutlined /></span> + <span className="operation-btn" title="鐘舵�佸垏鎹�" onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span> <Popconfirm overlayClassName="popover-confirm" - title={this.props.dict['model.query.delete']} + title="纭畾鍒犻櫎鍚�?" 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>) } @@ -365,12 +376,12 @@ 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> ) } @@ -381,9 +392,9 @@ 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> } } }, @@ -393,15 +404,15 @@ width: '10%', render: (text, record) => record.status === 'false' ? ( - <div> - {this.props.dict['model.status.forbidden']} - <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> + <div style={{color: '#ff4d4f'}}> + 绂佺敤 + <StopOutlined style={{marginLeft: '5px'}} /> </div> ) : ( - <div> - {this.props.dict['model.status.open']} - <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> + <div style={{color: '#26C281'}}> + 鍚敤 + <CheckCircleOutlined style={{marginLeft: '5px'}}/> </div> ) }, @@ -412,21 +423,21 @@ 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'}}><Icon type="edit" /></span> - <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'cbscripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> + <span className="operation-btn" title="缂栬緫" onClick={() => this.handleEdit(record, 'cbscripts')} style={{color: '#1890ff'}}><EditOutlined /></span> + <span className="operation-btn" title="鐘舵�佸垏鎹�" onClick={() => this.handleStatus(record, 'cbscripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span> <Popconfirm overlayClassName="popover-confirm" - title={this.props.dict['model.query.delete']} + title="纭畾鍒犻櫎鍚�?" onConfirm={() => this.handleDelete(record, 'cbscripts') }> - <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> + <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> </Popconfirm> </div>) } ], orderColumns: [ { - title: this.props.dict['header.form.funcvar'], + title: '鍑芥暟鍙橀噺', dataIndex: 'fieldName', width: '12%', render: (text, record) => (`${record.fieldName || ''}(${record.field})`) @@ -467,7 +478,7 @@ let _type = record.Type if (_type && typeof(_type) === 'string') { _type = parseInt(_type) - } else { + } else if (!_type) { _type = 4 } @@ -494,15 +505,15 @@ width: '8%', render: (text, record) => record.status === 'false' ? ( - <div> - {this.props.dict['model.status.forbidden']} - <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> + <div style={{color: '#ff4d4f'}}> + 绂佺敤 + <StopOutlined style={{marginLeft: '5px'}} /> </div> ) : ( - <div> - {this.props.dict['model.status.open']} - <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> + <div style={{color: '#26C281'}}> + 鍚敤 + <CheckCircleOutlined style={{marginLeft: '5px'}}/> </div> ) }, @@ -513,14 +524,14 @@ dataIndex: 'operation', render: (text, record) => (<div style={{textAlign: 'center'}}> - <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.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> + <span className="operation-btn" title="缂栬緫" onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><EditOutlined /></span> + <span className="operation-btn" title="鐘舵�佸垏鎹�" onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><SwapOutlined /></span> <Popconfirm overlayClassName="popover-confirm" - title={this.props.dict['model.query.delete']} + title="纭畾鍒犻櫎鍚�?" 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>) } @@ -529,7 +540,7 @@ UNSAFE_componentWillMount() { const { columns, config, card, btnTab } = this.props - let _verify = card.verify || {} + let _verify = fromJS(card.verify || {}).toJS() let _invalid = _verify.invalid @@ -541,6 +552,7 @@ } _verify.default = _verify.default || 'true' + _verify.wxNote = _verify.wxNote || 'false' // 鍏紬鍙锋秷鎭帹閫佹槸鍚﹀紑鍚� _verify.noteEnable = _verify.noteEnable || 'false' // 鐭俊鍙戦�佹槸鍚﹀紑鍚� _verify.noteType = _verify.noteType || 'N' // 鐭俊鍙戦�佹ā寮忥細Y锛堝疄鏃讹級銆丯锛堝畾鏃讹級 _verify.noteTemp = _verify.noteTemp || 'Y' // 鐭俊鍙戦�佹ā鏉匡細Y锛堢浉鍚岋級銆丯锛堜笉鍚岋級 @@ -571,22 +583,50 @@ }) } - this.setState({ - verify: _verify + _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 }) - if (config.Template !== 'FormTab' && (card.intertype === 'inner' || card.intertype === 'outer')) { // 鍐呴儴鎴栧閮ㄦ帴鍙� + let verifyInter = card.intertype === 'system' || card.procMode === 'system' ? 'system' : 'inner' + let activeKey = verifyInter === 'system' || card.intertype === 'inner' ? 'base' : 'tip' + + if (card.callbackType === 'script') { + activeKey = 'cbScripts' + } + + this.setState({ + activeKey: activeKey, + verifyInter: verifyInter, + setting: config.setting || {}, + verify: _verify, + oriVerify: fromJS(_verify).toJS() + }) + + if (config.Template !== 'FormTab' && card.intertype === 'inner') { return } 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) - } else if (card.modal) { + } else if (card.modal && card.OpenType === 'pop') { _fields = card.modal.fields || [] resolve(_fields) } else if (card.OpenType === 'pop') { @@ -624,14 +664,22 @@ resolve(_fields) } }).then(_fields => { - let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'UserName', 'FullName', 'login_city', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode'] - let _declare = ['@UserName nvarchar(50)', '@FullName 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=\'\'', '@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', 'tbid'] + let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@RoleID nvarchar(512)', '@mk_departmentcode nvarchar(512)', '@mk_organization nvarchar(512)', '@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)', '@tbid 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()) @@ -652,41 +700,32 @@ 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) { // 鍞竴鎬ч獙璇佹坊鍔燘ID uniqueFields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) - } - - if (!hasBid && (card.sqlType === 'insert' || card.sqlType === 'insertOrUpdate')) { // 琛ㄥ崟涓鍔燘ID _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 = btnTab.Ot !== 'notRequired' + } else if (card.Ot !== 'notRequired') { hasColumn = true } } @@ -748,6 +787,7 @@ let _defaultsql = '' let _insertsql = '' let _updatesql = '' + let _primaryKey = config.setting.primaryKey || 'id' if (card.sqlType === 'insert' || card.sqlType === 'insertOrUpdate') { let keys = [] @@ -765,8 +805,8 @@ } }) - 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')) { @@ -785,6 +825,10 @@ keys.push('bid') values.push('@BID@') } + if (!keys.includes('typename')) { + keys.push('typename') + values.push('@typename@') + } keys = keys.join(', ') values = values.join(', ') @@ -799,22 +843,44 @@ 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') { if (!_arr.includes('submitdate')) { _form.push('submitdate=getdate()') } + if (!_arr.includes('submituser')) { + _form.push('submituser=@username') + } + if (!_arr.includes('submitstaff')) { + _form.push('submitstaff=@fullname') + } if (!_arr.includes('submituserid')) { _form.push('submituserid=@userid@') + } + if (!_arr.includes('typename')) { + _form.push(`typename=@typename@`) } } else { if (!_arr.includes('modifydate')) { _form.push('modifydate=getdate()') } + if (!_arr.includes('modifyuser')) { + _form.push('modifyuser=@username') + } + if (!_arr.includes('modifystaff')) { + _form.push('modifystaff=@fullname') + } if (!_arr.includes('modifyuserid')) { _form.push('modifyuserid=@userid@') + } + if (!_arr.includes('typename')) { + _form.push(`typename=@typename@`) } } @@ -831,7 +897,7 @@ } _form = _form.join(', ') - _updatesql = `update ${card.sql} set ${_form} where ${config.setting.primaryKey}${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') { @@ -840,7 +906,7 @@ _defaultsql = _updatesql } else if (card.sqlType === 'insertOrUpdate') { _defaultsql += `select @tbid='' - select @tbid='X' from ${card.sql} where ${config.setting.primaryKey}=@ID@ + select @tbid='X' from ${card.sql} where ${_primaryKey}=@ID@ if @tbid='' begin ${_insertsql} @@ -855,7 +921,7 @@ if (_verify.voucher && _verify.voucher.enabled) { _voucher = ',BVoucher=@BVoucher,FIBVoucherDate=@FIBVoucherDate,FiYear=@FiYear' } - _defaultsql = `update ${card.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@${_voucher} where ${config.setting.primaryKey}${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') { @@ -867,7 +933,7 @@ _index++ }) } - _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('鍒犻櫎琛�:${card.sql} 鏁版嵁: ${_msg}${config.setting.primaryKey}='+@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,typename) select left('鍒犻櫎琛�:${card.sql} 鏁版嵁: ${_msg}${_primaryKey}='+@ID@,200),@userid@,@username,@fullname,@typename@ delete ${card.sql} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` } let _columns = [] @@ -886,7 +952,7 @@ _columns.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) } } - + this.setState({ fields: _fields, columnsFields: _columns, @@ -1067,6 +1133,8 @@ verify.scripts.push(values) } + MKEmitter.emit('editLineId', values.uuid) + this.setState({ verify }) } @@ -1108,39 +1176,6 @@ 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) => { const { verify } = this.state @@ -1158,17 +1193,22 @@ } handleEdit = (record, type) => { + let node = null + if (type === 'customverify') { this.customForm.edit(record) + node = document.getElementById('mk-custom-script') } else if (type === 'ordercode') { this.orderForm.edit(record) } else if (type === 'scripts') { this.scriptsForm.edit(record) + node = document.getElementById('mk-normal-script') } else if (type === 'cbscripts') { this.cbscriptsForm.edit(record) + node = document.getElementById('mk-callback-script') } - let node = document.getElementById('verify-card-box-tab').parentNode + // let node = document.getElementById('verify-card-box-tab').parentNode if (node && node.scrollTop) { let inter = Math.ceil(node.scrollTop / 10) @@ -1237,35 +1277,66 @@ } 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('鎵ц澶辫触锛�') + } } } @@ -1313,7 +1384,21 @@ handleConfirm = () => { const { card } = this.props + 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) => { @@ -1324,10 +1409,10 @@ duration: 5 }) return - } else if (verify.accountdate === 'true' && !verify.accountfield) { + } else if (verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 300) { notification.warning({ top: 92, - message: '寮�鍚处鏈熸椂锛岄渶瑕侀�夋嫨楠岃瘉鍏徃锛�', + message: '鏁版嵁婧愪腑鑷畾涔夎剼鏈繃浜庡鏉傦紝涓嶈兘浣跨敤澶辨晥楠岃瘉锛�', duration: 5 }) return @@ -1344,12 +1429,6 @@ 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) { @@ -1381,6 +1460,44 @@ }) } + 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鏇存柊 */ @@ -1392,7 +1509,7 @@ 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, setting, 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 }, @@ -1405,132 +1522,33 @@ } 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鎵ц椤哄簭涓鸿嚜瀹氫箟鑴氭湰涔嬪墠'}> - <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> - 榛樿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={'楠岃瘉鏃ユ湡涓虹┖鏃讹紝榛樿涓哄綋澶┿��'}> - <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> - 楠岃瘉鏃ユ湡 - </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={'閫夋嫨鍙戦�佺煭淇℃椂锛岄渶瀹屽杽鐭俊璁剧疆銆�'}> - <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> - 鍙戦�佺煭淇� - </Tooltip> - }> - <Radio.Group value={verify.noteEnable} onChange={(e) => {this.onOptionChange(e, 'noteEnable')}}> - <Radio value="true">寮�鍚�</Radio> - <Radio value="false">涓嶅紑鍚�</Radio> - </Radio.Group> - </Form.Item> - </Col> - {verify.noteEnable === 'true' ? <Col span={8}> - <Form.Item label="鐭俊妯℃澘"> - <Select value={verify.noteCode} onSelect={this.onNoteCodeChange}> - {notes.map(option => - <Select.Option key={option.value} 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涓敤鎴枫��'}> - <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> - 鍙戦�佹柟寮� - </Tooltip> - }> - <Radio.Group value={verify.noteType} onChange={(e) => {this.onOptionChange(e, 'noteType')}}> - <Radio value="Y">瀹炴椂</Radio> - <Radio value="N">瀹氭椂</Radio> - </Radio.Group> - </Form.Item> - </Col> : null} - {verify.noteEnable === 'true' ? <Col span={8}> - <Form.Item label="鐭俊鍐呭"> - <Radio.Group value={verify.noteTemp} onChange={(e) => {this.onOptionChange(e, 'noteTemp')}}> - <Radio value="Y">鐩稿悓</Radio> - <Radio value="N">涓嶅悓</Radio> - </Radio.Group> - </Form.Item> - </Col> : null} - </Row> - </Form> + <div> + {card.label ? <div className="mk-com-name">{card.label} - 楠岃瘉淇℃伅</div> : null} + <Tabs activeKey={activeKey} className="mk-verify-tabs" 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} setting={setting} 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"> - <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}})}/> + } key="contrasts"> + <ContrastForm contrastChange={this.contrastChange}/> + <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" id="mk-custom-script"> <CustomForm - dict={this.props.dict} btn={this.props.card} initsql={this.state.initsql} usefulfields={this.state.usefulfields} @@ -1539,18 +1557,17 @@ /> <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} billcodes={verify.billcodes} columns={this.props.columns} - dict={this.props.dict} modular={orderModular} modularDetail={orderModularDetail} orderChange={this.orderChange} @@ -1558,28 +1575,26 @@ /> <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} columns={this.props.columns} voucherobj={verify.voucher} @@ -1588,15 +1603,25 @@ 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" id="mk-normal-script"> + <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} initsql={this.state.initsql} customScripts={verify.scripts} defaultsql={this.state.defaultsql} @@ -1607,15 +1632,14 @@ /> <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={ + {card.callbackType === 'script' ? <TabPane tab={ <span> 鍥炶皟鑴氭湰 {verify.cbScripts.length ? <span className="count-tip">{verify.cbScripts.length}</span> : null} </span> - } key="6a"> + } key="cbScripts" id="mk-callback-script"> <CallBackCustomScript btn={this.props.card} - dict={this.props.dict} initsql={this.state.initsql} customScripts={verify.cbScripts} usefulfields={this.state.usefulfields} @@ -1625,7 +1649,7 @@ /> <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}> @@ -1663,7 +1687,7 @@ </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> @@ -1678,7 +1702,7 @@ </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> @@ -1713,6 +1737,89 @@ </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> + } + + if (item.status === 'false') { + return ( + <div className="script-item" key={item.uuid}> + <div style={{cursor: 'not-allowed'}}> + {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} + <span style={{color: '#ff4d4f', marginLeft: '20px'}}> + 绂佺敤 + <StopOutlined style={{marginLeft: '5px'}} /> + </span> + </div> + </div> + <div style={{height: '24px'}}></div> + </div> + ) + } else { + 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} + <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="纭畾鍒犻櫎鍚�?" + 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} + 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> ) } -- Gitblit v1.8.0