From 75623dd039b742dbb44fb4c6b4af563404ed9c7f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 03 二月 2020 16:06:04 +0800 Subject: [PATCH] 2020-02-03 --- src/tabviews/subtable/subTable/index.jsx | 4 src/templates/ushare/modalform/index.scss | 0 src/templates/formtabconfig/index.jsx | 120 ++++--- src/templates/comtableconfig/index.jsx | 42 +- src/tabviews/tableshare/actionList/index.jsx | 7 src/templates/modalconfig/index.jsx | 243 +---------------- src/api/index.js | 56 ++- src/tabviews/subtable/index.jsx | 11 src/templates/tableshare/searchform/index.jsx | 6 src/tabviews/subtabtable/index.jsx | 3 src/locales/zh-CN/comtable.js | 4 src/tabviews/commontable/index.jsx | 12 src/templates/ushare/editable/index.jsx | 0 public/options.js | 2 src/tabviews/commontable/mainTable/index.jsx | 4 src/locales/en-US/comtable.js | 4 src/utils/utils.js | 21 + src/tabviews/tableshare/mutilform/index.jsx | 55 +++ src/templates/ushare/editable/index.scss | 0 src/components/sidemenu/editthdmenu/index.jsx | 101 ------ src/templates/subtableconfig/index.jsx | 17 + src/store/options.js | 2 src/templates/formtabconfig/modalform/index.jsx | 11 src/templates/tableshare/formconfig.js | 56 +++ src/templates/ushare/modalform/index.jsx | 14 25 files changed, 331 insertions(+), 464 deletions(-) diff --git a/public/options.js b/public/options.js index f4050c3..3df2754 100644 --- a/public/options.js +++ b/public/options.js @@ -2,7 +2,7 @@ service: 'mkwms', appId: '201912040924165801464FF1788654BC5AC73', appkey: '20191106103859640976D6E924E464D029CF0', - mainSystemApi: 'http://cloud.mk9h.cn/webapi/dostar', + mainSystemApi: 'http://cloud.mk9h.cn/webapi/dostars', title: '', platName: '', logo: '', diff --git a/src/api/index.js b/src/api/index.js index fb39ac7..117c6e1 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -27,6 +27,7 @@ const setCurrentUrl = () => { if (!!(window.history && window.history.pushState)) { + sessionStorage.clear() window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') window.location.reload() } @@ -134,19 +135,19 @@ _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 }) } @@ -161,29 +162,32 @@ 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 } @@ -196,9 +200,17 @@ 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 => { @@ -222,8 +234,16 @@ 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 }) } diff --git a/src/components/sidemenu/editthdmenu/index.jsx b/src/components/sidemenu/editthdmenu/index.jsx index 88615d5..026d4eb 100644 --- a/src/components/sidemenu/editthdmenu/index.jsx +++ b/src/components/sidemenu/editthdmenu/index.jsx @@ -61,7 +61,9 @@ tabConfig: null, // 鏍囩閰嶇疆淇℃伅 editSubTab: null, // 缂栬緫瀛愭爣绛撅紙鏍囩涓殑鏍囩锛� subTabConfig: null, // 瀛愭爣绛鹃厤缃俊鎭� - subConfig: null // 瀛愰厤缃俊鎭� + subConfig: null, // 瀛愰厤缃俊鎭� + btnTab: null, // 鎵撳紑鏂版爣绛炬垨褰撳墠椤甸潰鍒锋柊鐨勬寜閽� + btnTabConfig: null // 鎵撳紑鏂版爣绛炬寜閽厤缃� } /** @@ -184,7 +186,7 @@ this.setState({ tabview: 'template', editMenu: { - MenuID: '', + MenuID: Utils.getuuid(), MenuName: '', MenuNo: '', type: '', @@ -445,15 +447,6 @@ 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: '' @@ -463,81 +456,6 @@ 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' - }) } }) } @@ -668,6 +586,8 @@ 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} @@ -679,6 +599,8 @@ 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} /> @@ -686,10 +608,9 @@ {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} /> } {/* 鍥剧墖棰勮 */} diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js index 919eff6..274e553 100644 --- a/src/locales/en-US/comtable.js +++ b/src/locales/en-US/comtable.js @@ -180,6 +180,10 @@ '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': '鎸夐挳-缂栬緫', diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js index 47339c6..99b5bab 100644 --- a/src/locales/zh-CN/comtable.js +++ b/src/locales/zh-CN/comtable.js @@ -180,6 +180,10 @@ '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': '鎸夐挳-缂栬緫', diff --git a/src/store/options.js b/src/store/options.js index 2f38340..1e0da73 100644 --- a/src/store/options.js +++ b/src/store/options.js @@ -2,7 +2,7 @@ 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' diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 4aa7255..6f0699b 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -225,6 +225,7 @@ 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', @@ -237,7 +238,7 @@ 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) }) @@ -308,7 +309,7 @@ pickup: false }) - this.handleTableId('mainTable', '') + this.handleTableId('mainTable', '', '') if (!param) { // 鏈幏鍙栧弬鏁版椂锛屼笉鍙戣姹� return @@ -638,13 +639,14 @@ /** * @description 琛ㄦ牸Id鍙樺寲 */ - handleTableId = (type, id) => { + handleTableId = (type, id, data) => { const { BIDs } = this.state this.setState({ BIDs: { ...BIDs, - [type]: id + [type]: id, + [type + 'data']: data } }) } @@ -799,7 +801,6 @@ 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> @@ -813,6 +814,7 @@ 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} diff --git a/src/tabviews/commontable/mainTable/index.jsx b/src/tabviews/commontable/mainTable/index.jsx index b2223cd..edca5f5 100644 --- a/src/tabviews/commontable/mainTable/index.jsx +++ b/src/tabviews/commontable/mainTable/index.jsx @@ -294,16 +294,18 @@ 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 = () => { diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 15f61d1..85b41b9 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -21,6 +21,7 @@ static propTpyes = { Tab: PropTypes.object, // 鏍囩淇℃伅 BID: PropTypes.string, // 涓婄骇鏁版嵁ID + BData: PropTypes.any, // 涓婄骇鏁版嵁 MenuID: PropTypes.string, // 鑿滃崟Id SupMenuID: PropTypes.string, // 涓婄骇鑿滃崟Id handleTableId: PropTypes.func, // 鎺у埗琛ㄦ牸鏁版嵁鍒囨崲鏃讹紝鏇存柊鍦ㄤ富琛ㄤ腑鐨刬d @@ -202,6 +203,7 @@ 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', @@ -214,7 +216,7 @@ 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) }) @@ -285,7 +287,7 @@ param = this.getDefaultParam(_BID) } - this.handleTableId('') + this.handleTableId() let result = await Api.genericInterface(param) if (result.status) { @@ -574,8 +576,8 @@ /** * @description 琛ㄦ牸Id鍙樺寲 */ - handleTableId = (id = '') => { - this.props.handleTableId(this.props.Tab.uuid, id) + handleTableId = (id = '', data = '') => { + this.props.handleTableId(this.props.Tab.uuid, id, data) } /** @@ -635,6 +637,7 @@ 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} diff --git a/src/tabviews/subtable/subTable/index.jsx b/src/tabviews/subtable/subTable/index.jsx index 2352786..6aea1fa 100644 --- a/src/tabviews/subtable/subTable/index.jsx +++ b/src/tabviews/subtable/subTable/index.jsx @@ -303,12 +303,14 @@ 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() { diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 7a3ac06..79c3949 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -181,6 +181,7 @@ 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', @@ -193,7 +194,7 @@ 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) }) diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx index 52c1104..9c65c49 100644 --- a/src/tabviews/tableshare/actionList/index.jsx +++ b/src/tabviews/tableshare/actionList/index.jsx @@ -12,6 +12,7 @@ class MainAction extends Component { static propTpyes = { BID: PropTypes.string, + BData: PropTypes.any, Tab: PropTypes.any, type: PropTypes.string, MenuID: PropTypes.string, @@ -378,7 +379,7 @@ }).then(res => { if (!res) return // 澶栭儴璇锋眰 - _outParam = res + _outParam = JSON.parse(JSON.stringify(res)) return Api.genericInterface(res) }).then(response => { if (!response) return @@ -763,6 +764,7 @@ 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', @@ -775,7 +777,7 @@ 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) }) @@ -937,6 +939,7 @@ inputSubmit={this.handleOk} configMap={this.state.configMap} data={this.state.tabledata[0]} + BData={this.props.BData} wrappedComponentRef={(inst) => this.formRef = inst} /> </Modal> diff --git a/src/tabviews/tableshare/mutilform/index.jsx b/src/tabviews/tableshare/mutilform/index.jsx index 90be271..b56eea3 100644 --- a/src/tabviews/tableshare/mutilform/index.jsx +++ b/src/tabviews/tableshare/mutilform/index.jsx @@ -15,6 +15,7 @@ action: PropTypes.object, // 鎸夐挳淇℃伅銆佽〃鍗曞垪琛� dict: PropTypes.object, // 瀛楀吀椤� data: PropTypes.any, // 琛ㄦ牸鏁版嵁 + BData: PropTypes.any, // 涓昏〃鏁版嵁 configMap: PropTypes.object, // 鎸夐挳鍙婁笅鎷夎〃鍗曢厤缃俊鎭泦 inputSubmit: PropTypes.func // input鍥炶溅鎻愪氦 } @@ -26,7 +27,7 @@ } componentDidMount () { - const { data } = this.props + const { data, BData } = this.props let action = JSON.parse(JSON.stringify(this.props.action)) let datatype = {} @@ -83,7 +84,9 @@ } } - 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] } @@ -443,16 +446,32 @@ </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 @@ -493,13 +512,23 @@ 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 => { @@ -552,8 +581,8 @@ }) } 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) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 60b8e4c..6718bf5 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -86,6 +86,7 @@ if (!menu.isSubtable) { // 涓嶆槸閫夋嫨涓诲瓙琛ㄦ椂锛岄殣钘忔爣绛鹃〉 _config.tabs = [] } + _config.isAdd = true } else { _config = _LongParam } @@ -1293,17 +1294,19 @@ 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 = '' @@ -1323,6 +1326,7 @@ // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser delete _config.type + delete _config.isAdd try { _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) @@ -1611,18 +1615,8 @@ 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'], @@ -2017,11 +2011,13 @@ 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 @@ -2038,6 +2034,8 @@ tabConfig: null, editSubTab: null, subTabConfig: null, + btnTab: _btnTab, + btnTabConfig: null, editAction: isbutton ? item : '', subConfig: '', tabview: _view diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index a059ebf..c691a2d 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -35,10 +35,9 @@ 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 = { @@ -73,21 +72,20 @@ * 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: [ { @@ -101,7 +99,7 @@ type: 'text', key: 'actionName', label: '鎸夐挳鍚嶇О', - initVal: editAction.label, + initVal: btnTab.label, readonly: true } ] @@ -231,6 +229,26 @@ 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) => { @@ -1139,21 +1157,23 @@ * @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 = '' @@ -1167,6 +1187,8 @@ } }) } + + delete _config.isAdd try { _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) @@ -1199,9 +1221,9 @@ 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 ') @@ -1212,10 +1234,10 @@ 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 } @@ -1363,7 +1385,7 @@ duration: 2 }) if (this.state.closeVisible) { - this.props.handleConfig('') + this.handleViewBack() } else { this.setState({ menuloading: false, @@ -1384,13 +1406,13 @@ 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() {} }) @@ -1402,7 +1424,7 @@ closeVisible: true }) } else { - this.props.handleConfig('') + this.handleViewBack() } } } @@ -1617,19 +1639,10 @@ * @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: '鑿滃崟灏氭湭淇濆瓨锛岃淇濆瓨鑿滃崟閰嶇疆锛�', @@ -1650,21 +1663,22 @@ 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({ @@ -1680,15 +1694,11 @@ } } - 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 @@ -2168,7 +2178,7 @@ 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 diff --git a/src/templates/formtabconfig/modalform/index.jsx b/src/templates/formtabconfig/modalform/index.jsx index ff106e1..9ed3ea8 100644 --- a/src/templates/formtabconfig/modalform/index.jsx +++ b/src/templates/formtabconfig/modalform/index.jsx @@ -26,12 +26,12 @@ 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') { @@ -55,7 +55,6 @@ form.type = 'select' } else if (type === 'number' && form.key === 'initval') { form.type = 'number' - form.initVal = 0 } form.hidden = !_options.includes(form.key) return form @@ -78,12 +77,12 @@ 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') { @@ -139,7 +138,7 @@ 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') { diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 6e4ef74..3db06af 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -3,19 +3,22 @@ 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' @@ -31,6 +34,8 @@ editSubTab: PropTypes.any, tabConfig: PropTypes.any, subTabConfig: PropTypes.any, + btnTab: PropTypes.any, + btnTabConfig: PropTypes.any, editAction: PropTypes.object, subConfig: PropTypes.any, handleView: PropTypes.func @@ -220,7 +225,7 @@ // 椤甸潰杩斿洖 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 @@ -230,6 +235,8 @@ tabConfig: tabConfig, editSubTab: editSubTab, subTabConfig: subTabConfig, + btnTab: btnTab, + btnTabConfig: btnTabConfig, editAction: null, subConfig: subTabConfig || tabConfig || null, tabview: _view @@ -359,227 +366,7 @@ 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) }) } diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index e0a3e2a..9283033 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -38,6 +38,8 @@ editTab: PropTypes.any, tabConfig: PropTypes.any, editSubTab: PropTypes.any, + btnTab: PropTypes.any, + btnTabConfig: PropTypes.any, config: PropTypes.any, handleView: PropTypes.func } @@ -270,15 +272,20 @@ // 椤甸潰杩斿洖 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 = { @@ -287,8 +294,10 @@ tabConfig: null, editSubTab: null, subTabConfig: null, + btnTab: btnTab, + btnTabConfig: btnTabConfig, editAction: null, - subConfig: tabConfig, + subConfig: _subconfig, tabview: _tabview } @@ -1698,7 +1707,7 @@ * @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) { @@ -1739,6 +1748,8 @@ tabConfig: editSubTab ? tabConfig : originConfig, editSubTab: _subtab, subTabConfig: editSubTab ? originConfig : null, + btnTab: btnTab, + btnTabConfig: btnTabConfig, editAction: btn, subConfig: '', tabview: _view diff --git a/src/templates/tableshare/formconfig.js b/src/templates/tableshare/formconfig.js index 38c3fc0..6d4b5b0 100644 --- a/src/templates/tableshare/formconfig.js +++ b/src/templates/tableshare/formconfig.js @@ -190,6 +190,19 @@ 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'] + }] } ] } @@ -673,7 +686,16 @@ * @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', @@ -727,7 +749,11 @@ }, { value: 'textarea', text: Formdict['header.form.textarea'] - }] + }, { + value: 'funcvar', + text: Formdict['header.form.funcvar'] + }, + ..._openType] }, { type: 'text', @@ -872,6 +898,32 @@ }] }, { + 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'], diff --git a/src/templates/tableshare/searchform/index.jsx b/src/templates/tableshare/searchform/index.jsx index 63aeea8..d66a79c 100644 --- a/src/templates/tableshare/searchform/index.jsx +++ b/src/templates/tableshare/searchform/index.jsx @@ -35,7 +35,7 @@ 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') { @@ -100,7 +100,7 @@ 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') { @@ -173,7 +173,7 @@ 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') { diff --git a/src/templates/modalconfig/editable/index.jsx b/src/templates/ushare/editable/index.jsx similarity index 100% rename from src/templates/modalconfig/editable/index.jsx rename to src/templates/ushare/editable/index.jsx diff --git a/src/templates/modalconfig/editable/index.scss b/src/templates/ushare/editable/index.scss similarity index 100% rename from src/templates/modalconfig/editable/index.scss rename to src/templates/ushare/editable/index.scss diff --git a/src/templates/modalconfig/modalform/index.jsx b/src/templates/ushare/modalform/index.jsx similarity index 96% rename from src/templates/modalconfig/modalform/index.jsx rename to src/templates/ushare/modalform/index.jsx index 37555a0..d0a7029 100644 --- a/src/templates/modalconfig/modalform/index.jsx +++ b/src/templates/ushare/modalform/index.jsx @@ -31,7 +31,7 @@ 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') { @@ -44,6 +44,8 @@ _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({ @@ -82,7 +84,7 @@ 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') { @@ -95,6 +97,8 @@ _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({ @@ -118,7 +122,7 @@ }, () => { 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 @@ -136,7 +140,7 @@ 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') { @@ -371,6 +375,8 @@ duration: 10 }) } + } else if (values.type === 'linkMain') { + values.initval = '' } if (isvalid) { diff --git a/src/templates/modalconfig/modalform/index.scss b/src/templates/ushare/modalform/index.scss similarity index 100% rename from src/templates/modalconfig/modalform/index.scss rename to src/templates/ushare/modalform/index.scss diff --git a/src/utils/utils.js b/src/utils/utils.js index 0355853..3492fa5 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -548,14 +548,21 @@ }) } - 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 @@ -600,7 +607,10 @@ 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 { @@ -608,6 +618,7 @@ values.push('\'' + item.value + '\'') } }) + keys = keys.join(',') values = values.join(',') _sql += `declare @UserName nvarchar(50),@FullName nvarchar(50) @@ -617,7 +628,9 @@ } 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 + '\'') -- Gitblit v1.8.0