| | |
| | | import BillcodeForm from './billcodeform' |
| | | import VoucherForm from './voucherform' |
| | | import './index.scss' |
| | | import { fromJS } from 'immutable'; |
| | | |
| | | const { TabPane } = Tabs |
| | | const { confirm } = Modal |
| | |
| | | btnTab: PropTypes.any, // 表单标签页(按钮)参数 |
| | | config: PropTypes.any, // 表单标签页参数 |
| | | dict: PropTypes.object, // 字典项 |
| | | card: PropTypes.object, |
| | | card: PropTypes.object, // 按钮信息 |
| | | columns: PropTypes.array |
| | | } |
| | | |
| | |
| | | verify: {}, |
| | | fields: [], |
| | | usefulfields: '', |
| | | defaultsql: '', // 默认Sql |
| | | orderModular: [], |
| | | orderModularDetail: [], |
| | | voucher: [], |
| | |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'unique')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <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 |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['header.confirm']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['header.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'unique') |
| | | }> |
| | |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'contrast')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <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 |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['header.confirm']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['header.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'contrast') |
| | | }> |
| | |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <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> |
| | | <Popconfirm |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['header.confirm']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['header.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'customverify') |
| | | }> |
| | |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <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> |
| | | <Popconfirm |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['header.confirm']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['header.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'scripts') |
| | | }> |
| | |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <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> |
| | | <Popconfirm |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['header.confirm']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['header.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'ordercode') |
| | | }> |
| | |
| | | verify: _verify |
| | | }) |
| | | |
| | | if (this.props.card.btnType) { // 按钮-表单标签页 |
| | | // 按钮-表单标签页 |
| | | if (this.props.card.btnType) { |
| | | let _fields = [] |
| | | |
| | | config.groups.forEach(group => { |
| | |
| | | Select ${_select.join(', ')} |
| | | ` |
| | | |
| | | // 默认sql |
| | | let _insertsql = '' |
| | | let _updatesql = '' |
| | | |
| | | if (this.props.card.sqlType === 'insert' || this.props.card.sqlType === 'insertOrUpdate') { |
| | | let keys = [] |
| | | let values = [] |
| | | _fields.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('\'\'') |
| | | } |
| | | 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(',') |
| | | _insertsql = `insert into ${this.props.card.sql} (${keys}) select ${values};` |
| | | } |
| | | |
| | | if (this.props.card.sqlType === 'update' || this.props.card.sqlType === 'insertOrUpdate') { |
| | | let _form = [] |
| | | let _arr = [] |
| | | |
| | | _fields.forEach(item => { |
| | | if (!item.field) 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 (_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') |
| | | } |
| | | } |
| | | |
| | | let primaryKeyName = config.setting.primaryKey |
| | | if (primaryKeyName && ['id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'].includes(primaryKeyName.toLowerCase())) { |
| | | primaryKeyName = primaryKeyName + '@' |
| | | } |
| | | |
| | | _form = _form.join(',') |
| | | _updatesql = `update ${this.props.card.sql} set ${_form} where ${config.setting.primaryKey}=@${primaryKeyName};` |
| | | } |
| | | |
| | | let _defaultsql = '' |
| | | |
| | | if (this.props.card.sqlType === 'insert') { |
| | | _defaultsql = _insertsql |
| | | } else if (this.props.card.sqlType === 'update') { |
| | | _defaultsql = _updatesql |
| | | } else if (this.props.card.sqlType === 'insertOrUpdate') { |
| | | _defaultsql += `select @tbid='' |
| | | select @tbid='X' from ${this.props.card.sql} where ${config.setting.primaryKey}=@ID@ |
| | | if @tbid='' |
| | | begin |
| | | ${_insertsql} |
| | | end |
| | | else |
| | | begin |
| | | ${_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', |
| | |
| | | } |
| | | } |
| | | |
| | | if (!_LongParam) return |
| | | if (!_LongParam) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '表单未添加或解析错误,请检查表单设置!', |
| | | duration: 5 |
| | | }) |
| | | |
| | | this.getsysScript() |
| | | |
| | | return |
| | | } |
| | | |
| | | let _fields = [] |
| | | if (_LongParam.groups.length > 0) { |
| | |
| | | let _select = ['@UserName=\'\'', '@FullName=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\''] |
| | | let hasBid = false |
| | | let fieldArr = _usefulfields.map(_f => _f.toLowerCase()) |
| | | let _defaultfields = fromJS(_fields).toJS() |
| | | |
| | | _fields.forEach(_f => { |
| | | if (_f.field) { |
| | |
| | | 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('\'\'') |
| | | } |
| | | 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') { |
| | | let _form = [] |
| | | let _arr = [] |
| | | |
| | | _defaultfields.forEach(item => { |
| | | if (!item.field) 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 (_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') |
| | | } |
| | | } |
| | | |
| | | let primaryKeyName = config.setting.primaryKey |
| | | if (primaryKeyName && ['id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'].includes(primaryKeyName.toLowerCase())) { |
| | | primaryKeyName = primaryKeyName + '@' |
| | | } |
| | | |
| | | _form = _form.join(',') |
| | | _defaultsql = `update ${this.props.card.sql} set ${_form} where ${config.setting.primaryKey}=@${primaryKeyName};` |
| | | } |
| | | |
| | | this.setState({ |
| | | fields: _fields, |
| | | initsql: _sql, |
| | | defaultsql: _defaultsql, |
| | | usefulfields: _usefulfields |
| | | }, () => { |
| | | this.getsysScript() |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | this.getsysScript() |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | Select ${_select.join(', ')} |
| | | ` |
| | | |
| | | // 默认sql |
| | | let _defaultsql = '' |
| | | let primaryKeyName = config.setting.primaryKey |
| | | |
| | | if (primaryKeyName && ['id', 'bid', 'loginuid', 'sessionuid', 'userid', 'appkey'].includes(primaryKeyName.toLowerCase())) { |
| | | primaryKeyName = primaryKeyName + '@' |
| | | } |
| | | |
| | | if (this.props.card.sqlType === 'LogicDelete') { |
| | | _defaultsql = `update ${this.props.card.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${config.setting.primaryKey}=@${primaryKeyName};` |
| | | } else if (this.props.card.sqlType === 'delete') { |
| | | let _msg = '' |
| | | if (columns && columns.length > 0 && this.props.card.Ot !== 'notRequired') { |
| | | let _index = 0 |
| | | columns.forEach(col => { |
| | | if (col.field && col.Hide !== 'true' && _index < 4) { |
| | | _msg += col.label + '=\'\',' |
| | | _index++ |
| | | } |
| | | }) |
| | | } |
| | | _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('删除表:${this.props.card.sql} 数据: ${_msg}${config.setting.primaryKey}='+@${primaryKeyName},200),@userid@,@username,@fullname delete ${this.props.card.sql} where ${config.setting.primaryKey}=@${primaryKeyName};` |
| | | } |
| | | |
| | | this.setState({ |
| | | initsql: _sql, |
| | | defaultsql: _defaultsql, |
| | | usefulfields: _usefulfields |
| | | }, () => { |
| | | this.getsysScript() |
| | | }) |
| | | } |
| | | } |
| | |
| | | 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) |
| | |
| | | |
| | | Api.getSystemConfig(_sParam).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | systemScripts: res.data.map(item => { |
| | | return { |
| | | name: item.funcname, |
| | | value: Utils.formatOptions(item.longparam, true) |
| | | } |
| | | let _scripts = [] |
| | | |
| | | if (defaultsql) { |
| | | _scripts.push({ |
| | | name: '默认sql', |
| | | value: defaultsql |
| | | }) |
| | | } |
| | | |
| | | res.data.forEach(item => { |
| | | let _item = { |
| | | name: item.funcname, |
| | | value: Utils.formatOptions(item.longparam, true) |
| | | } |
| | | |
| | | _scripts.push(_item) |
| | | }) |
| | | |
| | | this.setState({ |
| | | systemScripts: _scripts |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | |
| | | if (_loading) { |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | | okText: this.props.dict['header.confirm'], |
| | | okText: this.props.dict['model.confirm'], |
| | | cancelText: this.props.dict['header.cancel'], |
| | | onOk() { |
| | | resolve(verify) |
| | |
| | | <TabPane tab="自定义验证" key="3"> |
| | | <CustomForm |
| | | dict={this.props.dict} |
| | | btn={this.props.card} |
| | | initsql={this.state.initsql} |
| | | usefulfields={this.state.usefulfields} |
| | | customChange={this.customChange} |
| | |
| | | usefulfields={this.state.usefulfields} |
| | | initsql={this.state.initsql} |
| | | dict={this.props.dict} |
| | | btn={this.props.card} |
| | | customScripts={verify.scripts} |
| | | systemScripts={this.state.systemScripts} |
| | | scriptsChange={this.scriptsChange} |