| | |
| | | service: 'mkwms', |
| | | appId: '201912040924165801464FF1788654BC5AC73', |
| | | appkey: '20191106103859640976D6E924E464D029CF0', |
| | | mainSystemApi: 'http://cloud.mk9h.cn/webapi/dostar', |
| | | mainSystemApi: 'http://cloud.mk9h.cn/webapi/dostars', |
| | | title: '', |
| | | platName: '', |
| | | logo: '', |
| | |
| | | |
| | | const setCurrentUrl = () => { |
| | | if (!!(window.history && window.history.pushState)) { |
| | | sessionStorage.clear() |
| | | window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | window.location.reload() |
| | | } |
| | |
| | | _rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | // param.nonc = Utils.getuuid() |
| | | // param._ = new Date().getTime() |
| | | |
| | | // let keys = Object.keys(param).sort() |
| | | // let values = keys.map(key => key + param[key]).join('') |
| | | // param.sign = md5(values) |
| | | param.nonc = Utils.getuuid() |
| | | |
| | | let keys = Object.keys(param).sort() |
| | | let values = keys.map(key => key + param[key]).join('') |
| | | param.sign = md5(values) |
| | | param.t = new Date().getTime() |
| | | |
| | | if (_rduri) { |
| | | param.rduri = _rduri |
| | | } |
| | | |
| | | return axios({ |
| | | url: '/webapi/dostar', |
| | | url: '/webapi/dostars', |
| | | data: param |
| | | }) |
| | | } |
| | |
| | | param.LoginUID = sessionStorage.getItem('LoginUID') || '' |
| | | param.appkey = window.GLOB.appkey || '' |
| | | |
| | | // param.nonc = Utils.getuuid() |
| | | // param._ = new Date().getTime() |
| | | |
| | | // let keys = Object.keys(param).sort() |
| | | // let values = keys.map(key => key + param[key]).join('') |
| | | // param.sign = md5(values) |
| | | param.nonc = Utils.getuuid() |
| | | |
| | | let keys = Object.keys(param).sort() |
| | | let values = keys.map(key => key + param[key]).join('') |
| | | param.sign = md5(values) |
| | | param.t = new Date().getTime() |
| | | |
| | | return axios({ |
| | | url: '/webapi/dostar', |
| | | url: '/webapi/dostars', |
| | | data: param |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统配置,优先从缓存中取值,增加appkey |
| | | * @param {Object} param 请求参数 |
| | | * @param {Boolean} SSO 是否为单点登录地址 |
| | | */ |
| | | getSystemCacheConfig (param) { |
| | | getSystemCacheConfig (param, SSO = true) { |
| | | param.userid = sessionStorage.getItem('UserID') |
| | | param.lang = localStorage.getItem('lang') || '' |
| | | param.SessionUid = sessionStorage.getItem('SessionUid') || '' |
| | | param.LoginUID = sessionStorage.getItem('LoginUID') || '' |
| | | param.appkey = window.GLOB.appkey || '' |
| | | if (window.GLOB.mainSystemApi) { |
| | | |
| | | if (window.GLOB.mainSystemApi && SSO) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | |
| | | if (GlobMap.has(_param)) { |
| | | return Promise.resolve(GlobMap.get(_param)) |
| | | } else { |
| | | param.nonc = Utils.getuuid() |
| | | |
| | | let keys = Object.keys(param).sort() |
| | | keys = keys.filter(key => key !== 'rduri') |
| | | let values = keys.map(key => key + param[key]).join('') |
| | | param.sign = md5(values) |
| | | param.t = new Date().getTime() |
| | | |
| | | return new Promise(resolve => { |
| | | axios({ |
| | | url: '/webapi/dostar', |
| | | url: '/webapi/dostars', |
| | | data: param |
| | | }).then(res => { |
| | | |
| | |
| | | param.appkey = window.GLOB.appkey || '' |
| | | } |
| | | |
| | | param.nonc = Utils.getuuid() |
| | | |
| | | let keys = Object.keys(param).sort() |
| | | keys = keys.filter(key => key !== 'rduri' && key !== 't') |
| | | let values = keys.map(key => key + param[key]).join('') |
| | | param.sign = md5(values) |
| | | param.t = new Date().getTime() |
| | | |
| | | return axios({ |
| | | url: '/webapi/dostar', |
| | | url: '/webapi/dostars', |
| | | data: param |
| | | }) |
| | | } |
| | |
| | | tabConfig: null, // 标签配置信息 |
| | | editSubTab: null, // 编辑子标签(标签中的标签) |
| | | subTabConfig: null, // 子标签配置信息 |
| | | subConfig: null // 子配置信息 |
| | | subConfig: null, // 子配置信息 |
| | | btnTab: null, // 打开新标签或当前页面刷新的按钮 |
| | | btnTabConfig: null // 打开新标签按钮配置 |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState({ |
| | | tabview: 'template', |
| | | editMenu: { |
| | | MenuID: '', |
| | | MenuID: Utils.getuuid(), |
| | | MenuName: '', |
| | | MenuNo: '', |
| | | type: '', |
| | |
| | | document.getElementById('root').style.overflowY = 'unset' |
| | | } |
| | | |
| | | handleConfig = (type) => { |
| | | this.setState({tabview: type}) |
| | | if (type) { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | } else { |
| | | document.getElementById('root').style.overflowY = 'unset' |
| | | } |
| | | } |
| | | |
| | | handleView = (param) => { |
| | | this.setState({ |
| | | tabview: '' |
| | |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | } else { |
| | | document.getElementById('root').style.overflowY = 'unset' |
| | | } |
| | | }) |
| | | } |
| | | |
| | | handleSubConfig = (item, originMenu, config, type) => { |
| | | this.setState({ |
| | | tabview: '' |
| | | }, () => { |
| | | if (type === 'button') { // 三级菜单页面,按钮配置 |
| | | if (item.OpenType === 'pop') { |
| | | let pageParam = '' |
| | | if (config && config.type === 'Modal') { |
| | | pageParam = config |
| | | } |
| | | |
| | | this.setState({ |
| | | editMenu: originMenu, |
| | | editTab: '', |
| | | editAction: item, |
| | | btnParam: pageParam, |
| | | tabview: 'Modal' |
| | | }) |
| | | } |
| | | } else if (type === 'tab') { // 三级菜单页面,标签配置 |
| | | if (item.type === 'SubTable' || item.tabType === 'SubTable') { |
| | | this.setState({ |
| | | editMenu: originMenu, |
| | | editTab: config, |
| | | editAction: '', |
| | | tabview: 'SubTable' |
| | | }) |
| | | } |
| | | } else if (type === 'tabButton') { // 三级菜单下,标签下,按钮配置 |
| | | |
| | | let pageParam = '' |
| | | if (item.OpenType === 'popview') { |
| | | if (config && config.Template === 'SubTable') { |
| | | pageParam = config |
| | | } else { |
| | | pageParam = { |
| | | ...item, |
| | | uuid: item.linkTab, |
| | | create: true |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | editMenu: originMenu, |
| | | editTab: pageParam, |
| | | editAction: item, |
| | | tabview: 'SubTable' |
| | | }) |
| | | } else { |
| | | if (config && config.type === 'Modal') { |
| | | pageParam = config |
| | | } |
| | | this.setState({ |
| | | editTab: originMenu, |
| | | editAction: item, |
| | | btnParam: pageParam, |
| | | tabview: 'Modal' |
| | | }) |
| | | } |
| | | } else if (type === 'tabview') { // 三级菜单下,打开新标签页或当前页跳转,类型的按钮配置 |
| | | let pageParam = '' |
| | | if (config && config.type === 'FormTab') { |
| | | pageParam = config |
| | | } |
| | | |
| | | this.setState({ |
| | | editMenu: originMenu, |
| | | editAction: item, |
| | | btnParam: pageParam, |
| | | tabview: 'FormTab' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | tabConfig={this.state.tabConfig} |
| | | editSubTab={this.state.editSubTab} |
| | | subTabConfig={this.state.subTabConfig} |
| | | btnTab={this.state.btnTab} |
| | | btnTabConfig={this.state.btnTabConfig} |
| | | editAction={this.state.editAction} |
| | | subConfig={this.state.subConfig} |
| | | handleView={this.handleView} |
| | |
| | | editTab={this.state.editTab} |
| | | editSubTab={this.state.editSubTab} |
| | | tabConfig={this.state.tabConfig} |
| | | btnTab={this.state.btnTab} |
| | | btnTabConfig={this.state.btnTabConfig} |
| | | config={this.state.subConfig} |
| | | handleView={this.handleView} |
| | | /> |
| | |
| | | {this.state.tabview === 'FormTab' && |
| | | <FormTabConfig |
| | | menu={this.state.editMenu} |
| | | config={this.state.btnParam} |
| | | editAction={this.state.editAction} |
| | | handleConfig={this.handleConfig} |
| | | handleSubConfig={this.handleSubConfig} |
| | | btnTab={this.state.btnTab} |
| | | config={this.state.subConfig} |
| | | handleView={this.handleView} |
| | | /> |
| | | } |
| | | {/* 图片预览 */} |
| | |
| | | 'header.form.queryType': '查询类型', |
| | | 'header.form.query': '查询', |
| | | 'header.form.statistics': '统计', |
| | | 'header.form.database': '数据库', |
| | | 'header.form.database.local': '本地', |
| | | 'header.form.database.sso': '系统', |
| | | 'header.form.linkMain': '关联主表', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | 'header.form.queryType': '查询类型', |
| | | 'header.form.query': '查询', |
| | | 'header.form.statistics': '统计', |
| | | 'header.form.database': '数据库', |
| | | 'header.form.database.local': '本地', |
| | | 'header.form.database.sso': '系统', |
| | | 'header.form.linkMain': '关联主表', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | export default { |
| | | systemType: 'local', // Cloud 、 SSO 、 local, 云端使用系统配置appId |
| | | AppId: '201912040924165801464FF1788654BC5AC73', |
| | | cloudServiceApi: 'http://cloud.mk9h.cn/webapi/dostar', |
| | | cloudServiceApi: 'http://cloud.mk9h.cn/webapi/dostars', |
| | | cloudLoginApi: 'http://cloud.mk9h.cn/webapi/dologon', |
| | | cloudDatabase: 'sqlserver', |
| | | localDatabase: 'mysql' |
| | |
| | | if (item.resourceType === '1' && item.dataSource) { |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | let _sql = Utils.formatOptions(_option.sql) |
| | | let isSSO = item.database === 'sso' |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | let defer = new Promise(resolve => { |
| | | Api.getSystemCacheConfig(param).then(res => { |
| | | Api.getSystemCacheConfig(param, isSSO).then(res => { |
| | | res.search = item |
| | | resolve(res) |
| | | }) |
| | |
| | | pickup: false |
| | | }) |
| | | |
| | | this.handleTableId('mainTable', '') |
| | | this.handleTableId('mainTable', '', '') |
| | | |
| | | if (!param) { // 未获取参数时,不发请求 |
| | | return |
| | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = (type, id) => { |
| | | handleTableId = (type, id, data) => { |
| | | const { BIDs } = this.state |
| | | |
| | | this.setState({ |
| | | BIDs: { |
| | | ...BIDs, |
| | | [type]: id |
| | | [type]: id, |
| | | [type + 'data']: data |
| | | } |
| | | }) |
| | | } |
| | |
| | | return ( |
| | | <Tabs defaultActiveKey="0" key={group}> |
| | | {config[group].map((_tab, index) => { |
| | | // return !_tab.supMenu || (_tab.supMenu && this.state.BIDs[_tab.supMenu]) ? |
| | | return ( |
| | | <TabPane tab={ |
| | | <span> |
| | |
| | | MenuID={_tab.linkTab} |
| | | SupMenuID={this.props.MenuID} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | handleMainTable={this.handleMainTable} |
| | | /> : null} |
| | |
| | | changedata = (index) => { |
| | | const { data, setting } = this.props |
| | | let _id = '' |
| | | let _data = '' |
| | | |
| | | if (data && data.length > 0 && index !== '') { |
| | | _id = data[index][setting.primaryKey] || '' |
| | | _data = data[index] || '' |
| | | } |
| | | |
| | | this.setState({ |
| | | selectId: _id |
| | | }) |
| | | |
| | | this.props.handleTableId('mainTable', _id) |
| | | this.props.handleTableId('mainTable', _id, _data) |
| | | } |
| | | |
| | | resetTable = () => { |
| | |
| | | static propTpyes = { |
| | | Tab: PropTypes.object, // 标签信息 |
| | | BID: PropTypes.string, // 上级数据ID |
| | | BData: PropTypes.any, // 上级数据 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | SupMenuID: PropTypes.string, // 上级菜单Id |
| | | handleTableId: PropTypes.func, // 控制表格数据切换时,更新在主表中的id |
| | |
| | | if (item.resourceType === '1' && item.dataSource) { |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | let _sql = Utils.formatOptions(_option.sql) |
| | | let isSSO = item.database === 'sso' |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | let defer = new Promise(resolve => { |
| | | Api.getSystemCacheConfig(param).then(res => { |
| | | Api.getSystemCacheConfig(param, isSSO).then(res => { |
| | | res.search = item |
| | | resolve(res) |
| | | }) |
| | |
| | | param = this.getDefaultParam(_BID) |
| | | } |
| | | |
| | | this.handleTableId('') |
| | | this.handleTableId() |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = (id = '') => { |
| | | this.props.handleTableId(this.props.Tab.uuid, id) |
| | | handleTableId = (id = '', data = '') => { |
| | | this.props.handleTableId(this.props.Tab.uuid, id, data) |
| | | } |
| | | |
| | | /** |
| | |
| | | actions={actions} |
| | | Tab={this.props.Tab} |
| | | BID={this.props.BID} |
| | | BData={this.props.BData} |
| | | dict={this.state.dict} |
| | | MenuID={this.props.SupMenuID} |
| | | refreshdata={this.refreshbyaction} |
| | |
| | | changedata = (index) => { |
| | | const { data, setting } = this.props |
| | | let _id = '' |
| | | let _data = '' |
| | | |
| | | if (data && data.length > 0 && index !== '') { |
| | | _id = data[index][setting.primaryKey] || '' |
| | | _data = data[index] || '' |
| | | } |
| | | |
| | | this.props.handleTableId(_id) |
| | | this.props.handleTableId(_id, _data) |
| | | } |
| | | |
| | | render() { |
| | |
| | | if (item.resourceType === '1' && item.dataSource) { |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | let _sql = Utils.formatOptions(_option.sql) |
| | | let isSSO = item.database === 'sso' |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | let defer = new Promise(resolve => { |
| | | Api.getSystemCacheConfig(param).then(res => { |
| | | Api.getSystemCacheConfig(param, isSSO).then(res => { |
| | | res.search = item |
| | | resolve(res) |
| | | }) |
| | |
| | | class MainAction extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.string, |
| | | BData: PropTypes.any, |
| | | Tab: PropTypes.any, |
| | | type: PropTypes.string, |
| | | MenuID: PropTypes.string, |
| | |
| | | }).then(res => { |
| | | if (!res) return |
| | | // 外部请求 |
| | | _outParam = res |
| | | _outParam = JSON.parse(JSON.stringify(res)) |
| | | return Api.genericInterface(res) |
| | | }).then(response => { |
| | | if (!response) return |
| | |
| | | let deffers = subfields.map(item => { |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | let _sql = Utils.formatOptions(_option.sql) |
| | | let isSSO = item.database === 'sso' |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | return new Promise(resolve => { |
| | | Api.getSystemCacheConfig(param).then(res => { |
| | | Api.getSystemCacheConfig(param, isSSO).then(res => { |
| | | res.search = item |
| | | resolve(res) |
| | | }) |
| | |
| | | inputSubmit={this.handleOk} |
| | | configMap={this.state.configMap} |
| | | data={this.state.tabledata[0]} |
| | | BData={this.props.BData} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> |
| | | </Modal> |
| | |
| | | action: PropTypes.object, // 按钮信息、表单列表 |
| | | dict: PropTypes.object, // 字典项 |
| | | data: PropTypes.any, // 表格数据 |
| | | BData: PropTypes.any, // 主表数据 |
| | | configMap: PropTypes.object, // 按钮及下拉表单配置信息集 |
| | | inputSubmit: PropTypes.func // input回车提交 |
| | | } |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { data } = this.props |
| | | const { data, BData } = this.props |
| | | let action = JSON.parse(JSON.stringify(this.props.action)) |
| | | |
| | | let datatype = {} |
| | |
| | | } |
| | | } |
| | | |
| | | if (!/^date/.test(item.type) && this.props.data && this.props.data.hasOwnProperty(item.field)) { |
| | | if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) { |
| | | item.initval = BData[item.field] |
| | | } else if (!/^date/.test(item.type) && this.props.data && this.props.data.hasOwnProperty(item.field)) { |
| | | item.initval = this.props.data[item.field] |
| | | } |
| | | |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'funcvar') { |
| | | } else if (item.type === 'linkMain') { |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.linkfield || '', |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly === 'true'} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'funcvar') { |
| | | // fields.push( |
| | | // <Col span={24 / cols} key={index}> |
| | | // <Form.Item label={item.label}> |
| | | // {getFieldDecorator(item.field, { |
| | | // initialValue: item.linkfield || '', |
| | | // })(<Input placeholder="" autoComplete="off" disabled={item.readonly === 'true'} />)} |
| | | // </Form.Item> |
| | | // </Col> |
| | | // ) |
| | | } else if (item.type === 'textarea') { |
| | | let _labelcol = cols !== 3 ? 8 / cols : 3 |
| | | let _wrapcol = cols !== 3 ? 16 + (cols - 1) * 4 : 21 |
| | |
| | | let search = [] |
| | | // 隐藏表单 |
| | | this.state.formlist.forEach(item => { |
| | | if (item.hidden !== 'true' || !item.field) return |
| | | search.push({ |
| | | type: this.state.datatype[item.field], |
| | | readonly: this.state.readtype[item.field], |
| | | key: item.field, |
| | | value: item.initval |
| | | }) |
| | | if (!item.field) return |
| | | |
| | | if (item.type === 'funcvar') { |
| | | search.push({ |
| | | type: 'funcvar', |
| | | readonly: 'true', |
| | | key: item.field, |
| | | value: '' |
| | | }) |
| | | } else if (item.hidden === 'true') { |
| | | search.push({ |
| | | type: this.state.datatype[item.field], |
| | | readonly: this.state.readtype[item.field], |
| | | key: item.field, |
| | | value: item.initval |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | Object.keys(values).forEach(key => { |
| | |
| | | }) |
| | | } else if (this.state.datatype[key] === 'fileupload') { |
| | | let vals = [] |
| | | |
| | | if (values[key].length > 0) { |
| | | |
| | | if (values[key] && values[key].length > 0) { |
| | | values[key].forEach(_val => { |
| | | if (_val.origin && _val.url) { |
| | | vals.push(_val.url) |
| | |
| | | if (!menu.isSubtable) { // 不是选择主子表时,隐藏标签页 |
| | | _config.tabs = [] |
| | | } |
| | | _config.isAdd = true |
| | | } else { |
| | | _config = _LongParam |
| | | } |
| | |
| | | |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | |
| | | if (config.search[0] && config.search[0].origin) { |
| | | config.search = config.search.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.columns[0] && config.columns[0].origin) { |
| | | config.columns = config.columns.filter(item => !item.origin) |
| | | } |
| | | if (config.tabs[0] && config.tabs[0].origin) { |
| | | config.tabs = config.tabs.filter(item => !item.origin) |
| | | if (config.isAdd) { |
| | | if (config.search[0] && config.search[0].origin) { |
| | | config.search = config.search.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.columns[0] && config.columns[0].origin) { |
| | | config.columns = config.columns.filter(item => !item.origin) |
| | | } |
| | | if (config.tabs[0] && config.tabs[0].origin) { |
| | | config.tabs = config.tabs.filter(item => !item.origin) |
| | | } |
| | | } |
| | | |
| | | let _LongParam = '' |
| | |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | | delete _config.isAdd |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | |
| | | const { config, originMenu } = this.state |
| | | |
| | | let _this = this |
| | | let isAdd = false |
| | | |
| | | if ( |
| | | (config.search[0] && config.search[0].origin) || |
| | | (config.action[0] && config.action[0].origin) || |
| | | (config.columns[0] && config.columns[0].origin) || |
| | | (config.tabs[0] && config.tabs[0].origin) |
| | | ) { |
| | | isAdd = true |
| | | } |
| | | |
| | | if (isAdd) { |
| | | if (config.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['header.confirm'], |
| | |
| | | let _view = '' |
| | | let uuid = item.uuid |
| | | let isbutton = true |
| | | let _btnTab = null |
| | | |
| | | if (type === 'button' && item.OpenType === 'pop') { |
| | | _view = 'Modal' // 表单页面 |
| | | } else if (type === 'button' && (item.OpenType === 'tab' || item.OpenType === 'blank')) { |
| | | _view = item.tabTemplate // 新标签页模板 |
| | | _btnTab = item |
| | | } else if (type === 'button' && item.OpenType === 'popview') { |
| | | _view = item.tabType // 新弹窗标签模板 |
| | | uuid = item.linkTab |
| | |
| | | tabConfig: null, |
| | | editSubTab: null, |
| | | subTabConfig: null, |
| | | btnTab: _btnTab, |
| | | btnTabConfig: null, |
| | | editAction: isbutton ? item : '', |
| | | subConfig: '', |
| | | tabview: _view |
| | |
| | | class ComTableConfig extends Component { |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | editAction: PropTypes.object, |
| | | btnTab: PropTypes.object, |
| | | config: PropTypes.any, |
| | | handleConfig: PropTypes.func, |
| | | handleSubConfig: PropTypes.func |
| | | handleView: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | |
| | | * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { menu, editAction, config } = this.props |
| | | const { menu, btnTab, config } = this.props |
| | | |
| | | let _config = '' |
| | | let _originMenu = '' |
| | | |
| | | if (!config) { |
| | | _config = JSON.parse(JSON.stringify(Source.baseConfig)) |
| | | _config.isAdd = true |
| | | } else { |
| | | _config = config |
| | | _originMenu = JSON.parse(JSON.stringify(_config)) |
| | | } |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | originMenu: _originMenu, |
| | | originMenu: JSON.parse(JSON.stringify(_config)), |
| | | selectedTables: _config.tables, |
| | | menuformlist: [ |
| | | { |
| | |
| | | type: 'text', |
| | | key: 'actionName', |
| | | label: '按钮名称', |
| | | initVal: editAction.label, |
| | | initVal: btnTab.label, |
| | | readonly: true |
| | | } |
| | | ] |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | // 页面返回 |
| | | handleViewBack = () => { |
| | | const { menu } = this.props |
| | | let _tabview = menu ? menu.LongParam.Template : '' |
| | | let param = { |
| | | editMenu: menu, |
| | | editTab: null, |
| | | tabConfig: null, |
| | | editSubTab: null, |
| | | subTabConfig: null, |
| | | btnTab: null, |
| | | btnTabConfig: null, |
| | | editAction: null, |
| | | subConfig: null, |
| | | tabview: _tabview |
| | | } |
| | | |
| | | this.props.handleView(param) |
| | | } |
| | | |
| | | handleList = (type, list, card, groupId, elementId) => { |
| | |
| | | * @description 菜单保存 |
| | | */ |
| | | submitConfig = () => { |
| | | const { menu, editAction } = this.props |
| | | const { menu, btnTab } = this.props |
| | | const { delActions } = this.state |
| | | |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | |
| | | if (config.groups[0] && config.groups[0].sublist[0] && config.groups[0].sublist[0].origin) { |
| | | config.groups[0].sublist = config.groups[0].sublist.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.tabs[0] && config.tabs[0].origin) { |
| | | config.tabs = config.tabs.filter(item => !item.origin) |
| | | if (config.isAdd) { |
| | | if (config.groups[0] && config.groups[0].sublist[0] && config.groups[0].sublist[0].origin) { |
| | | config.groups[0].sublist = config.groups[0].sublist.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.tabs[0] && config.tabs[0].origin) { |
| | | config.tabs = config.tabs.filter(item => !item.origin) |
| | | } |
| | | } |
| | | |
| | | let _LongParam = '' |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | delete _config.isAdd |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | |
| | | |
| | | let tabParam = { // 添加菜单tab页 |
| | | func: 'sPC_sMenusTab_AddUpt', |
| | | MenuID: editAction.uuid, |
| | | MenuID: btnTab.uuid, |
| | | LText: config.tabs.map((item, index) => { |
| | | return `select '${editAction.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort` |
| | | return `select '${btnTab.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort` |
| | | }) |
| | | } |
| | | tabParam.LText = tabParam.LText.join(' union all ') |
| | |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: menu.MenuID, |
| | | MenuID: editAction.uuid, |
| | | MenuID: btnTab.uuid, |
| | | MenuNo: menu.MenuNo, |
| | | Template: 'FormTab', |
| | | MenuName: editAction.label, |
| | | MenuName: btnTab.label, |
| | | PageParam: JSON.stringify({Template: 'FormTab'}), |
| | | LongParam: _LongParam |
| | | } |
| | |
| | | duration: 2 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | this.props.handleConfig('') |
| | | this.handleViewBack() |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | |
| | | |
| | | let _this = this |
| | | |
| | | if (!originMenu) { |
| | | if (config.isAdd) { |
| | | confirm({ |
| | | content: '按钮配置尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | _this.props.handleConfig('') |
| | | _this.handleViewBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.props.handleConfig('') |
| | | this.handleViewBack() |
| | | } |
| | | } |
| | | } |
| | |
| | | * @description 设置可配置标签 |
| | | */ |
| | | setSubConfig = (btn, type) => { |
| | | const {menu, btnTab} = this.props |
| | | const { config, originMenu } = this.state |
| | | |
| | | let isAdd = false |
| | | |
| | | if ( |
| | | (config.search[0] && config.search[0].origin) || |
| | | (config.action[0] && config.action[0].origin) || |
| | | (config.tabs[0] && config.tabs[0].origin) |
| | | ) { |
| | | isAdd = true |
| | | } |
| | | |
| | | if (isAdd) { |
| | | if (config.isAdd) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未保存,请保存菜单配置!', |
| | |
| | | loading: true |
| | | }) |
| | | |
| | | let uuid = '' |
| | | let _type = type |
| | | if (type === 'button' && btn.OpenType === 'popview') { |
| | | _type = 'tab' |
| | | } |
| | | |
| | | if (_type === 'button') { |
| | | uuid = btn.uuid |
| | | } else { |
| | | uuid = btn.linkTab |
| | | let param = { |
| | | editMenu: menu, |
| | | editTab: btn, |
| | | tabConfig: null, |
| | | editSubTab: null, |
| | | subTabConfig: null, |
| | | btnTab: btnTab, |
| | | btnTabConfig: _config, |
| | | editAction: null, |
| | | subConfig: '', |
| | | tabview: btn.type |
| | | } |
| | | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: uuid |
| | | MenuID: btn.linkTab |
| | | }).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | |
| | | } |
| | | } |
| | | |
| | | if (_type === 'tab' && !_LongParam) { |
| | | _LongParam = { |
| | | ...btn, |
| | | uuid: btn.linkTab, |
| | | create: true |
| | | } |
| | | if (_LongParam && param.tabview === 'SubTable' && _LongParam.Template === 'SubTable') { |
| | | param.subConfig = _LongParam |
| | | } |
| | | |
| | | this.props.handleSubConfig(btn, originMenu, _LongParam, _type) |
| | | this.props.handleView(param) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | onCancel={() => { this.setState({closeVisible: false}) }} |
| | | footer={[ |
| | | <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig('')}}>{this.state.dict['header.notsave']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>{this.state.dict['header.notsave']}</Button>, |
| | | <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | |
| | | |
| | | let type = formlist.filter(cell => cell.key === 'type')[0].initVal |
| | | let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required'] // 默认显示项 |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden'] // 默认显示项 |
| | | |
| | | if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'options'] |
| | | } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } else if (type === 'number') { |
| | | _options = [..._options, 'decimal', 'min', 'max'] |
| | | } else if (type === 'fileupload') { |
| | |
| | | form.type = 'select' |
| | | } else if (type === 'number' && form.key === 'initval') { |
| | | form.type = 'number' |
| | | form.initVal = 0 |
| | | } |
| | | form.hidden = !_options.includes(form.key) |
| | | return form |
| | |
| | | |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'type') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required'] |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden'] |
| | | |
| | | if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'options'] |
| | | } else if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } else if (value === 'number') { |
| | | _options = [..._options, 'decimal', 'min', 'max'] |
| | | } else if (value === 'fileupload') { |
| | |
| | | if (value === '0') { |
| | | _options = [..._options, 'options'] |
| | | } else if (value === '1') { |
| | | _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } |
| | | |
| | | if (openType === 'select') { |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Button, Card, Modal, Collapse, notification, Select, List, Icon, Empty } from 'antd' |
| | | import moment from 'moment' |
| | | import { Button, Card, Modal, Collapse, notification, Select, List, Icon, Empty } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import zhCN from '@/locales/zh-CN/comtable.js' |
| | | import enUS from '@/locales/en-US/comtable.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getModalForm } from '@/templates/tableshare/formconfig' |
| | | |
| | | import ModalForm from '@/templates/ushare/modalform' |
| | | import DragElement from './dragelement' |
| | | import SourceElement from './dragelement/source' |
| | | import Api from '@/api' |
| | | import ModalForm from './modalform' |
| | | import SettingForm from './settingform' |
| | | import GroupForm from './groupform' |
| | | import EditCard from './editcard' |
| | | import MenuForm from './menuform' |
| | | import zhCN from '@/locales/zh-CN/comtable.js' |
| | | import enUS from '@/locales/en-US/comtable.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import Source from './source' |
| | | import './index.scss' |
| | | |
| | |
| | | editSubTab: PropTypes.any, |
| | | tabConfig: PropTypes.any, |
| | | subTabConfig: PropTypes.any, |
| | | btnTab: PropTypes.any, |
| | | btnTabConfig: PropTypes.any, |
| | | editAction: PropTypes.object, |
| | | subConfig: PropTypes.any, |
| | | handleView: PropTypes.func |
| | |
| | | |
| | | // 页面返回 |
| | | handleViewBack = () => { |
| | | const {menu, editTab, editSubTab, tabConfig, subTabConfig} = this.props |
| | | const {menu, editTab, editSubTab, tabConfig, subTabConfig, btnTab, btnTabConfig} = this.props |
| | | |
| | | let _view = (subTabConfig && subTabConfig.Template) || (tabConfig && tabConfig.Template) || menu.LongParam.Template |
| | | |
| | |
| | | tabConfig: tabConfig, |
| | | editSubTab: editSubTab, |
| | | subTabConfig: subTabConfig, |
| | | btnTab: btnTab, |
| | | btnTabConfig: btnTabConfig, |
| | | editAction: null, |
| | | subConfig: subTabConfig || tabConfig || null, |
| | | tabview: _view |
| | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: [ |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: this.state.dict['header.form.name'], |
| | | initVal: card.label, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'field', |
| | | label: this.state.dict['header.form.field'], |
| | | initVal: card.field, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'type', |
| | | label: this.state.dict['header.form.type'], |
| | | initVal: card.type, |
| | | required: true, |
| | | options: [{ |
| | | value: 'text', |
| | | text: this.state.dict['header.form.text'] |
| | | }, { |
| | | value: 'number', |
| | | text: this.state.dict['header.form.number'] |
| | | }, { |
| | | value: 'select', |
| | | text: this.state.dict['header.form.select'] |
| | | }, { |
| | | value: 'multiselect', |
| | | text: this.state.dict['header.form.multiselect'] |
| | | }, { |
| | | value: 'link', |
| | | text: this.state.dict['header.form.link'] |
| | | }, { |
| | | value: 'fileupload', |
| | | text: this.state.dict['header.form.fileupload'] |
| | | }, { |
| | | value: 'date', |
| | | text: this.state.dict['header.form.dateday'] |
| | | }, { |
| | | value: 'datemonth', |
| | | text: this.state.dict['header.form.datemonth'] |
| | | }, { |
| | | value: 'datetime', |
| | | text: this.state.dict['header.form.datetime'] |
| | | }, { |
| | | value: 'textarea', |
| | | text: this.state.dict['header.form.textarea'] |
| | | }, { |
| | | value: 'funcvar', |
| | | text: this.state.dict['header.form.funcvar'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'initval', |
| | | label: this.state.dict['header.form.initval'], |
| | | initVal: card.initval, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'resourceType', |
| | | label: this.state.dict['header.form.resourceType'], |
| | | initVal: card.resourceType || '0', |
| | | required: true, |
| | | options: [{ |
| | | value: '0', |
| | | text: this.state.dict['header.form.custom'] |
| | | }, { |
| | | value: '1', |
| | | text: this.state.dict['header.form.datasource'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'setAll', |
| | | label: this.state.dict['header.form.setAll'], |
| | | initVal: card.setAll || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: this.state.dict['header.form.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'dataSource', |
| | | label: this.state.dict['header.form.datasource'], |
| | | initVal: card.dataSource || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'options', |
| | | key: 'options', |
| | | label: '', |
| | | initVal: card.options || [], |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'linkField', |
| | | label: this.state.dict['header.form.linkField'], |
| | | initVal: card.linkField || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'valueField', |
| | | label: this.state.dict['header.form.valueField'], |
| | | initVal: card.valueField || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'valueText', |
| | | label: this.state.dict['header.form.valueText'], |
| | | initVal: card.valueText || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'orderBy', |
| | | label: this.state.dict['header.form.orderBy'], |
| | | initVal: card.orderBy || '', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'orderType', |
| | | label: this.state.dict['header.form.orderType'], |
| | | initVal: card.orderType || 'asc', |
| | | options: [{ |
| | | value: 'asc', |
| | | text: this.state.dict['header.form.asc'] |
| | | }, { |
| | | value: 'desc', |
| | | text: this.state.dict['header.form.desc'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'decimal', |
| | | label: this.state.dict['header.form.decimal'], |
| | | initVal: card.decimal || 0, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'min', |
| | | label: '最小值', |
| | | initVal: card.min || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'max', |
| | | label: '最大值', |
| | | initVal: card.max || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'readonly', |
| | | label: this.state.dict['header.form.readonly'], |
| | | initVal: card.readonly || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: this.state.dict['header.form.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'required', |
| | | label: this.state.dict['header.form.field.required'], |
| | | initVal: card.required || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: this.state.dict['header.form.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidden', |
| | | label: this.state.dict['header.form.field.ishidden'], |
| | | initVal: card.hidden || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: this.state.dict['header.form.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkSubField', |
| | | label: this.state.dict['header.form.linkForm'], |
| | | initVal: card.linkSubField || [], |
| | | options: _inputfields |
| | | } |
| | | ] |
| | | formlist: getModalForm(card, _inputfields, !!this.props.editTab) |
| | | }) |
| | | } |
| | | |
| | |
| | | editTab: PropTypes.any, |
| | | tabConfig: PropTypes.any, |
| | | editSubTab: PropTypes.any, |
| | | btnTab: PropTypes.any, |
| | | btnTabConfig: PropTypes.any, |
| | | config: PropTypes.any, |
| | | handleView: PropTypes.func |
| | | } |
| | |
| | | |
| | | // 页面返回 |
| | | handleViewBack = () => { |
| | | const {menu, editTab, tabConfig, editSubTab} = this.props |
| | | const {menu, editTab, tabConfig, editSubTab, btnTab, btnTabConfig} = this.props |
| | | let _tabview = menu ? menu.LongParam.Template : '' |
| | | let _subconfig = null |
| | | |
| | | if (editSubTab) { |
| | | _subconfig = tabConfig |
| | | if (editTab.hasOwnProperty('OpenType')) { |
| | | _tabview = editTab.tabType |
| | | } else { |
| | | _tabview = editTab.type |
| | | } |
| | | } else if (!editSubTab && btnTab) { |
| | | _tabview = btnTab.tabTemplate |
| | | _subconfig = btnTabConfig |
| | | } |
| | | |
| | | let param = { |
| | |
| | | tabConfig: null, |
| | | editSubTab: null, |
| | | subTabConfig: null, |
| | | btnTab: btnTab, |
| | | btnTabConfig: btnTabConfig, |
| | | editAction: null, |
| | | subConfig: tabConfig, |
| | | subConfig: _subconfig, |
| | | tabview: _tabview |
| | | } |
| | | |
| | |
| | | * @description 设置可配置按钮 |
| | | */ |
| | | setSubConfig = (btn) => { |
| | | const {menu, editTab, tabConfig, editSubTab} = this.props |
| | | const {menu, editTab, tabConfig, editSubTab, btnTab, btnTabConfig} = this.props |
| | | const { config, originConfig } = this.state |
| | | |
| | | if (originConfig.isAdd) { |
| | |
| | | tabConfig: editSubTab ? tabConfig : originConfig, |
| | | editSubTab: _subtab, |
| | | subTabConfig: editSubTab ? originConfig : null, |
| | | btnTab: btnTab, |
| | | btnTabConfig: btnTabConfig, |
| | | editAction: btn, |
| | | subConfig: '', |
| | | tabview: _view |
| | |
| | | value: 'button', |
| | | text: Formdict['header.form.button'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'database', |
| | | label: Formdict['header.form.database'], |
| | | initVal: card.database || 'local', |
| | | options: [{ |
| | | value: 'local', |
| | | text: Formdict['header.form.database.local'] |
| | | }, { |
| | | value: 'sso', |
| | | text: Formdict['header.form.database.sso'] |
| | | }] |
| | | } |
| | | ] |
| | | } |
| | |
| | | * @param {*} card |
| | | * @param {*} inputfields |
| | | */ |
| | | export function getModalForm (card, inputfields) { |
| | | export function getModalForm (card, inputfields, subtable = false) { |
| | | let _openType = [] |
| | | |
| | | if (subtable) { |
| | | _openType.push({ |
| | | value: 'linkMain', |
| | | text: Formdict['header.form.linkMain'] |
| | | }) |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | |
| | | }, { |
| | | value: 'textarea', |
| | | text: Formdict['header.form.textarea'] |
| | | }] |
| | | }, { |
| | | value: 'funcvar', |
| | | text: Formdict['header.form.funcvar'] |
| | | }, |
| | | ..._openType] |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidden', |
| | | label: Formdict['header.form.field.ishidden'], |
| | | initVal: card.hidden || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['header.form.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['header.form.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'database', |
| | | label: Formdict['header.form.database'], |
| | | initVal: card.database || 'local', |
| | | options: [{ |
| | | value: 'local', |
| | | text: Formdict['header.form.database.local'] |
| | | }, { |
| | | value: 'sso', |
| | | text: Formdict['header.form.database.sso'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkSubField', |
| | | label: Formdict['header.form.linkForm'], |
| | |
| | | if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options = [..._options, 'resourceType', 'options', 'display'] |
| | | } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display'] |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display', 'database'] |
| | | } |
| | | |
| | | if (type === 'select' || type === 'link') { |
| | |
| | | if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options = [..._options, 'resourceType', 'options', 'display'] |
| | | } else if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display'] |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display', 'database'] |
| | | } |
| | | |
| | | if (value === 'select' || value === 'link') { |
| | |
| | | if (value === '0') { |
| | | _options = [..._options, 'options'] |
| | | } else if (value === '1') { |
| | | _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } |
| | | |
| | | if (openType === 'select' || openType === 'link') { |
File was renamed from src/templates/modalconfig/modalform/index.jsx |
| | |
| | | if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'options'] |
| | | } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } else if (type === 'number') { |
| | | _options = [..._options, 'decimal', 'min', 'max'] |
| | | } else if (type === 'fileupload') { |
| | |
| | | _options = [..._options, 'setAll', 'linkField'] |
| | | } else if (type === 'funcvar') { // 设置为函数变量时,不需要其他信息 |
| | | _options = ['label', 'field', 'type'] |
| | | } else if (type === 'linkMain') { |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden'] |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'options'] |
| | | } else if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } else if (value === 'number') { |
| | | _options = [..._options, 'decimal', 'min', 'max'] |
| | | } else if (value === 'fileupload') { |
| | |
| | | _options = [..._options, 'setAll', 'linkField'] |
| | | } else if (value === 'funcvar') { |
| | | _options = ['label', 'field', 'type'] |
| | | } else if (value === 'linkMain') { |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden'] |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | }, () => { |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'initval' && value !== 'fileupload' && value !== 'funcvar') { |
| | | if (form.key === 'initval' && value !== 'fileupload' && value !== 'funcvar' && value !== 'linkMain') { |
| | | form.show = true |
| | | } |
| | | return form |
| | |
| | | if (value === '0') { |
| | | _options = [..._options, 'options'] |
| | | } else if (value === '1') { |
| | | _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } |
| | | |
| | | if (openType === 'select') { |
| | |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } else if (values.type === 'linkMain') { |
| | | values.initval = '' |
| | | } |
| | | |
| | | if (isvalid) { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (verify && verify.billcodes.length > 0) { |
| | | if (verify && verify.billcodes.length > 0) { // 单号生成 |
| | | verify.billcodes.forEach(item => { |
| | | let _ModularDetailCode = '' |
| | | if (item.TypeCharOne === 'Lp' || item.TypeCharOne === 'BN') { |
| | | _ModularDetailCode = item.TypeCharOne + item.linkField |
| | | let _val = '' |
| | | if (item.linkField === 'BID' && BID) { // 替换bid |
| | | _val = BID |
| | | } else if (data.hasOwnProperty(item.linkField)) { |
| | | _val = data[item.linkField] |
| | | } |
| | | _ModularDetailCode = item.TypeCharOne + _val |
| | | } else { |
| | | _ModularDetailCode = item.ModularDetailCode |
| | | } |
| | | |
| | | _sql += `Declare @${item.field} nvarchar(50) |
| | | select @BillCode='', @${item.field}='' |
| | | exec s_get_BillCode |
| | |
| | | let keys = [] |
| | | let values = [] |
| | | formdata.forEach(item => { |
| | | if (item.type === 'number') { |
| | | if (item.type === 'funcvar') { |
| | | keys.push(item.key) |
| | | values.push('@' + item.key) |
| | | } else if (item.type === 'number') { |
| | | keys.push(item.key) |
| | | values.push(item.value) |
| | | } else { |
| | |
| | | values.push('\'' + item.value + '\'') |
| | | } |
| | | }) |
| | | |
| | | keys = keys.join(',') |
| | | values = values.join(',') |
| | | _sql += `declare @UserName nvarchar(50),@FullName nvarchar(50) |
| | |
| | | } else if (btn.OpenType === 'pop' && btn.sqlType === 'update') { |
| | | let _form = [] |
| | | formdata.forEach(item => { |
| | | if (item.type === 'number') { |
| | | if (item.type === 'funcvar') { |
| | | _form.push(item.key + '=@' + item.key) |
| | | } else if (item.type === 'number') { |
| | | _form.push(item.key + '=' + item.value) |
| | | } else { |
| | | _form.push(item.key + '=\'' + item.value + '\'') |