| | |
| | | static propTpyes = { |
| | | type: PropTypes.string, |
| | | menu: PropTypes.any, |
| | | reloadmenu: PropTypes.func, |
| | | handleConfig: PropTypes.func, |
| | | handleSubConfig: PropTypes.func, |
| | | supMenuList: PropTypes.array |
| | |
| | | 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) |
| | | } |
| | | } |
| | |
| | | * @description 创建按钮存储过程 |
| | | */ |
| | | creatFunc = () => { |
| | | const { menu } = this.props |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | this.formRef.handleConfirm().then(res => { |
| | |
| | | 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({ |
| | |
| | | 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 => { |
| | |
| | | return Promise.all([sysDefer, localDefer]) |
| | | }).then(res => { |
| | | // 云端结果与新语句不同时,更新云端信息 |
| | | console.log(res) |
| | | if (res === false) return res |
| | | |
| | | let isError = false |
| | |
| | | } else if (index === 0) { |
| | | sysTVPText = result.TVPText |
| | | } else { |
| | | console.log(result.Ltext) |
| | | if (result.Ltext) { // 本地存储过程是否存在 |
| | | isExit = true |
| | | } |
| | |
| | | } |
| | | }).then(res => { |
| | | // 云端信息更新后,判断是删除或是直接新建存储过程 |
| | | console.log(res) |
| | | if (res === false || res === 'drop') return res |
| | | |
| | | if (!res.status) { |
| | |
| | | } |
| | | }).then(res => { |
| | | // 删除存储过程 |
| | | console.log(res) |
| | | if (res === false || res === 'create') return res |
| | | |
| | | let _param = { |
| | |
| | | return Api.getLocalConfig(_param) |
| | | }).then(res => { |
| | | // 根据上述操作结果,判断是否新建存储过程 |
| | | console.log(res) |
| | | if (res === false || res === 'create') return res |
| | | |
| | | if (!res.status) { |
| | |
| | | } |
| | | }).then(res => { |
| | | // 新建存储过程 |
| | | console.log(res) |
| | | if (res === false) return res |
| | | |
| | | let _param = { |
| | |
| | | return Api.getLocalConfig(_param) |
| | | }).then(res => { |
| | | // 处理新建结果 |
| | | console.log(res) |
| | | if (res === false) return res |
| | | |
| | | if (!res.status) { |
| | |
| | | } |
| | | }).then(res => { |
| | | // 新建成功后,更新页面按钮信息 |
| | | console.log(res) |
| | | if (res === false) { |
| | | this.setState({ |
| | | funcLoading: false |
| | |
| | | columnsloading: false |
| | | }) |
| | | }) |
| | | |
| | | this.props.reloadmenu() |
| | | |
| | | this.submitAction(btnParam) |
| | | } else { |
| | |
| | | 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 = [] |
| | |
| | | |
| | | oriActions.push({ |
| | | prebtn: item.prebtn, |
| | | curBtn: item.curBtn |
| | | curBtn: curBtn |
| | | }) |
| | | }) |
| | | |
| | |
| | | }) |
| | | return 'true' |
| | | }).then(response => { |
| | | console.log(response) |
| | | if (response === 'true') { |
| | | notification.success({ |
| | | top: 92, |
| | |
| | | } |
| | | |
| | | 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, |
| | |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | console.log(_LongParam) |
| | | this.props.handleSubConfig(btn, originMenu, _LongParam) |
| | | } else { |
| | | this.setState({ |
| | |
| | | destroyOnClose |
| | | > |
| | | <SettingForm |
| | | menu={this.props.menu} |
| | | data={this.state.config.setting} |
| | | columns={this.state.config.columns} |
| | | dict={this.state.dict} |