| | |
| | | |
| | | import MutilForm from './mutilform' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import { updateForm } from '@/utils/utils-update.js' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | | class CreateFunc extends Component { |
| | | class CreateInterface extends Component { |
| | | static propTypes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | trigger: PropTypes.func |
| | | } |
| | | |
| | |
| | | required: true, |
| | | options: [{ |
| | | value: 'Y', |
| | | text: this.props.dict['model.true'] |
| | | text: '是' |
| | | }, { |
| | | value: 'N', |
| | | text: this.props.dict['model.false'] |
| | | text: '否' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | |
| | | required: true, |
| | | options: [{ |
| | | value: 'Y', |
| | | text: this.props.dict['model.true'] |
| | | text: '是' |
| | | }, { |
| | | value: 'N', |
| | | text: this.props.dict['model.false'] |
| | | text: '否' |
| | | }] |
| | | }] |
| | | }) |
| | |
| | | |
| | | new Promise(resolve => { |
| | | // 获取云端存储过程信息 |
| | | Api.getLocalConfig(param).then(result => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (!result.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | Ltexttableparam: '', |
| | | Ltext: '', |
| | | menuType: menu.type, |
| | | systemType: options.sysType |
| | | systemType: window.GLOB.sysType |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | |
| | | new Promise(resolve => { |
| | | if (btn.OpenType === 'pop') { |
| | | Api.getSystemConfig({ |
| | | Api.getCloudConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: btn.uuid |
| | | }).then(result => { |
| | |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | let fields = [] |
| | | |
| | | if (_LongParam && _LongParam.type === 'Modal') { |
| | | if (_LongParam.groups.length > 0) { |
| | | _LongParam.groups.forEach(group => { |
| | | fields = [...fields, ...group.sublist] |
| | | }) |
| | | } else { |
| | | fields = _LongParam.fields |
| | | } |
| | | _LongParam = updateForm(_LongParam) |
| | | } |
| | | |
| | | if (fields && fields.length > 0) { |
| | | formlist = fields.map(cell => { |
| | | if (_LongParam && _LongParam.fields.length > 0) { |
| | | _LongParam.fields.forEach(cell => { |
| | | if (!cell.field) return |
| | | let _fieldlen = cell.fieldlength || 50 |
| | | |
| | | if (cell.type === 'textarea' || cell.type === 'fileupload' || cell.type === 'multiselect') { |
| | |
| | | _fieldtype = 'datetime' |
| | | } else if (_field.type === 'number') { |
| | | _fieldtype = `decimal(18,${_fieldlen})` |
| | | } else if (_field.type === 'rate') { |
| | | _fieldtype = `decimal(18,2)` |
| | | } |
| | | |
| | | _field.fieldtype = _fieldtype |
| | |
| | | _field.value = '' |
| | | } |
| | | |
| | | return _field |
| | | formlist.push(_field) |
| | | }) |
| | | } |
| | | resolve(true) |
| | |
| | | |
| | | _mainParam = fromJS(param).toJS() |
| | | |
| | | return Api.getLocalConfig(param) |
| | | return Api.genericInterface(param) |
| | | }).then(res => { |
| | | if (res === false) return res |
| | | |
| | |
| | | _type = 'datetime' |
| | | } else if (form.type === 'number') { |
| | | _type = `decimal(18,${form.fieldlen})` |
| | | } else if (form.type === 'rate') { |
| | | _type = `decimal(18,2)` |
| | | } |
| | | |
| | | _declarefields.push(`@${_key} ${_type}`) |
| | |
| | | if (item.writein === false) return |
| | | |
| | | keys.push(item.key.toLowerCase()) |
| | | values.push('@' + item.key + '@') |
| | | values.push('@' + item.key) |
| | | }) |
| | | |
| | | if (!keys.includes(primaryKey.toLowerCase())) { |
| | |
| | | if (item.writein === false) return |
| | | |
| | | _arr.push(item.key.toLowerCase()) |
| | | _form.push(item.key + `=@${item.key}@`) |
| | | _form.push(item.key + `=@${item.key}`) |
| | | }) |
| | | |
| | | if (!_arr.includes('modifydate')) { |
| | |
| | | } |
| | | if (!_arr.includes('modifyuserid')) { |
| | | _form.push('modifyuserid=@userid@') |
| | | } |
| | | if (!_arr.includes('modifyuser')) { |
| | | _form.push('modifyuser=@username') |
| | | } |
| | | if (hasvoucher) { |
| | | if (!_arr.includes('bvoucher')) { |
| | |
| | | } else if (_actionType === 'LogicDelete') { // 逻辑删除 |
| | | _sql += ` |
| | | /* 默认sql */ |
| | | update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${primaryKey}=@${primaryKey}@;` |
| | | update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuser=@username,modifystaff=@fullname,modifyuserid=@userid@ where ${primaryKey}=@${primaryKey}@;` |
| | | |
| | | } else if (_actionType === 'delete') { // 物理删除 |
| | | let _msg = '' |
| | |
| | | onClick={this.props.trigger} |
| | | loading={this.state.loading} |
| | | > |
| | | {this.props.dict['header.menu.interface.create']} |
| | | 创建接口 |
| | | </Button> |
| | | {/* 接口选项 */} |
| | | <Modal |
| | | title={this.props.dict['header.menu.interface.create']} |
| | | title="创建接口" |
| | | visible={this.state.visible} |
| | | width={500} |
| | | maskClosable={false} |
| | |
| | | destroyOnClose |
| | | > |
| | | <MutilForm |
| | | dict={this.props.dict} |
| | | formlist={this.state.formlist} |
| | | wrappedComponentRef={(inst) => this.FormRef = inst} |
| | | /> |
| | |
| | | } |
| | | } |
| | | |
| | | export default CreateFunc |
| | | export default CreateInterface |