From 1a14ff6035932eadfb6ef7970e3adb24b4e158a6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 18 十二月 2019 18:56:17 +0800 Subject: [PATCH] 2019-12-18 --- src/templates/comtableconfig/index.jsx | 147 +++++++++++++++++++++++++++--------------------- 1 files changed, 83 insertions(+), 64 deletions(-) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index cec7cb8..8bf970a 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -32,6 +32,7 @@ static propTpyes = { type: PropTypes.string, menu: PropTypes.any, + reloadmenu: PropTypes.func, handleConfig: PropTypes.func, handleSubConfig: PropTypes.func, supMenuList: PropTypes.array @@ -949,13 +950,17 @@ if (this.state.formtemp !== 'gridbtn') { this.formRef.handleConfirm().then(res => { let isupdate = false - + if (res.type === 'search') { if ((res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') { - let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from (' + res.values.dataSource + ')' - if (res.values.orderBy) { - sql = sql + ' ld order by ' + res.values.orderBy + ' ' + res.values.orderType + let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + res.values.dataSource + if (res.values.type === 'link') { + sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + res.values.dataSource } + if (res.values.orderBy) { + sql = sql + ' order by ' + res.values.orderBy + ' ' + res.values.orderType + } + res.values.dataSourceSql = Utils.formatOptions(sql) } } @@ -1058,6 +1063,7 @@ * @description 鍒涘缓鎸夐挳瀛樺偍杩囩▼ */ creatFunc = () => { + const { menu } = this.props let _config = JSON.parse(JSON.stringify(this.state.config)) this.formRef.handleConfirm().then(res => { @@ -1115,11 +1121,11 @@ funcName: btn.innerFunc, name: _config.setting.tableName || '', fields: fields, - menuNo: this.props.menu.MenuNo + menuNo: menu.MenuNo } - newLText = Utils.formatOptions(Utils.getfunc(_param)) + newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config.columns)) DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) - resolve(true) + resolve(false) } else { resolve(false) notification.warning({ @@ -1134,15 +1140,14 @@ funcName: btn.innerFunc, name: _config.setting.tableName || '', fields: '', - menuNo: this.props.menu.MenuNo + menuNo: menu.MenuNo } - newLText = Utils.formatOptions(Utils.getfunc(_param)) + newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config.columns)) DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) - resolve(true) + resolve(false) } }).then(res => { // 鑾峰彇浜戠鍙婃湰鍦帮紝鏄惁宸插瓨鍦ㄨ瀛樺偍杩囩▼鐨勪俊鎭� - console.log(res) if (res === false) return res let sysDefer = new Promise(resolve => { @@ -1170,7 +1175,6 @@ return Promise.all([sysDefer, localDefer]) }).then(res => { // 浜戠缁撴灉涓庢柊璇彞涓嶅悓鏃讹紝鏇存柊浜戠淇℃伅 - console.log(res) if (res === false) return res let isError = false @@ -1186,7 +1190,6 @@ } else if (index === 0) { sysTVPText = result.TVPText } else { - console.log(result.Ltext) if (result.Ltext) { // 鏈湴瀛樺偍杩囩▼鏄惁瀛樺湪 isExit = true } @@ -1231,7 +1234,6 @@ } }).then(res => { // 浜戠淇℃伅鏇存柊鍚庯紝鍒ゆ柇鏄垹闄ゆ垨鏄洿鎺ユ柊寤哄瓨鍌ㄨ繃绋� - console.log(res) if (res === false || res === 'drop') return res if (!res.status) { @@ -1248,7 +1250,6 @@ } }).then(res => { // 鍒犻櫎瀛樺偍杩囩▼ - console.log(res) if (res === false || res === 'create') return res let _param = { @@ -1263,7 +1264,6 @@ return Api.getLocalConfig(_param) }).then(res => { // 鏍规嵁涓婅堪鎿嶄綔缁撴灉锛屽垽鏂槸鍚︽柊寤哄瓨鍌ㄨ繃绋� - console.log(res) if (res === false || res === 'create') return res if (!res.status) { @@ -1278,7 +1278,6 @@ } }).then(res => { // 鏂板缓瀛樺偍杩囩▼ - console.log(res) if (res === false) return res let _param = { @@ -1292,7 +1291,6 @@ return Api.getLocalConfig(_param) }).then(res => { // 澶勭悊鏂板缓缁撴灉 - console.log(res) if (res === false) return res if (!res.status) { @@ -1312,7 +1310,6 @@ } }).then(res => { // 鏂板缓鎴愬姛鍚庯紝鏇存柊椤甸潰鎸夐挳淇℃伅 - console.log(res) if (res === false) { this.setState({ funcLoading: false @@ -1505,6 +1502,8 @@ columnsloading: false }) }) + + this.props.reloadmenu() this.submitAction(btnParam) } else { @@ -1535,65 +1534,65 @@ const { config } = this.state new Promise(resolve => { // 鍐呴儴璇锋眰 - if (param.LText) { - Api.getSystemConfig(param).then(response => { - if (response.status) { - resolve('true') - } else { - resolve(response) - } - }) - } else { - resolve('true') - } - }).then(res => { - console.log(res) - if (res === 'true' && this.state.delActions.length > 0) { + if (this.state.delActions.length > 0) { let deffers = this.state.delActions.map(item => { - let param = { + let _param = { func: 'sPC_MainMenu_Del', MenuID: item } return new Promise(resolve => { - Api.getSystemConfig(param).then(res => { + Api.getSystemConfig(_param).then(res => { resolve(res) }) }) }) - return Promise.all(deffers) - } else if (res === 'true' && this.state.delActions.length === 0) { + Promise.all(deffers).then(result => { + let error = false + result.forEach(res => { + if (!res.status) { + error = res + } + }) + + if (error) { + notification.warning({ + top: 92, + message: error.message, + duration: 10 + }) + resolve(false) + } else { + this.setState({ + delActions: [] + }) + resolve(param) + } + }) + } else if (this.state.delActions.length === 0) { + resolve(param) + } + }).then(res => { + if (res === false) return res + + if (res.LText) { + return Api.getSystemConfig(res) + } else { return 'copy' - } else if (!res.status) { + } + }).then(response => { + if (response === false || response === 'copy') return response + + if (response.status) { + return 'copy' + } else { notification.warning({ top: 92, - message: res.message, + message: response.message, duration: 10 }) return false } }).then(response => { - console.log(response) - if (response === false || response === 'copy') return response - - let res = 'copy' - if (Array.isArray(response)) { - response.forEach(result => { - if (!result.status) { - res = result - } - }) - } - - if (res === 'copy') return 'copy' - - notification.warning({ - top: 92, - message: res.message, - duration: 10 - }) - return false - }).then(response => { - console.log(response) if (response === false) return response let oriActions = [] @@ -1604,7 +1603,7 @@ oriActions.push({ prebtn: item.prebtn, - curBtn: item.curBtn + curBtn: curBtn }) }) @@ -1645,7 +1644,6 @@ }) return 'true' }).then(response => { - console.log(response) if (response === 'true') { notification.success({ top: 92, @@ -1992,8 +1990,29 @@ } settingSave = () => { + const { menu } = this.props const {config} = this.state + this.settingRef.handleConfirm().then(res => { + if ( + res.interType === 'inner' && + !res.innerFunc && + res.dataresource.length > 50 && + config.setting.dataresource !== res.dataresource + ) { + let param = { + func: 's_DataSrc_Save', + LText: res.dataresource, + MenuID: menu.MenuID + } + + param.LText = Utils.formatOptions(param.LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + Api.getLocalConfig(param) + } + this.setState({ config: {...config, setting: res}, settingVisible: false, @@ -2069,7 +2088,6 @@ _LongParam = '' } } - console.log(_LongParam) this.props.handleSubConfig(btn, originMenu, _LongParam) } else { this.setState({ @@ -2370,6 +2388,7 @@ destroyOnClose > <SettingForm + menu={this.props.menu} data={this.state.config.setting} columns={this.state.config.columns} dict={this.state.dict} -- Gitblit v1.8.0