| | |
| | | deForms: hasBid ? deForms : null |
| | | }, () => { |
| | | if (deForms.length > 0 && (!hasBid || BID)) { |
| | | if (window.backend && window.GLOB.CacheData.has('sql_' + deForms[0].uuid)) { |
| | | this.improveBackActionForm(deForms, BID) |
| | | } else { |
| | | this.improveActionForm(deForms, BID) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | |
| | | const { deForms } = this.state |
| | | |
| | | if (deForms && nextProps.BID !== BID) { |
| | | if (window.backend && window.GLOB.CacheData.has('sql_' + deForms[0].uuid)) { |
| | | this.improveBackActionForm(deForms, nextProps.BID) |
| | | } else { |
| | | this.improveActionForm(deForms, nextProps.BID) |
| | | } |
| | | } |
| | | if (parCtrl && !is(fromJS(this.props.columns), fromJS(nextProps.columns))) { |
| | | let getColumns = (cols, sk) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | improveBackActionForm = (deForms, BID) => { |
| | | let sysvals = { |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | bid: BID || '', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' |
| | | } |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | sysvals.db = window.GLOB.externalDatabase |
| | | } |
| | | |
| | | let deffers = [] |
| | | let mainItems = [] // 云端或单点数据 |
| | | let localItems = [] // 本地数据 |
| | | |
| | | deForms.forEach(item => { |
| | | let ex = window.GLOB.CacheData.get('sql_' + item.uuid) |
| | | |
| | | if (!ex) return |
| | | |
| | | let exps = [] |
| | | ex.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (sysvals.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: sysvals[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let cell = { |
| | | id: ex.id, |
| | | exps: exps, |
| | | menuname: item.label + '(表单)', |
| | | md5_id: '' |
| | | } |
| | | |
| | | if (item.database === 'sso' && window.GLOB.mainSystemApi) { |
| | | mainItems.push(cell) |
| | | } else { |
| | | localItems.push(cell) |
| | | } |
| | | }) |
| | | |
| | | if (localItems.length) { |
| | | deffers.push({ |
| | | $backend: true, |
| | | data: localItems |
| | | }) |
| | | } |
| | | |
| | | if (mainItems.length) { |
| | | deffers.push({ |
| | | $backend: true, |
| | | data: mainItems, |
| | | rduri: window.GLOB.mainSystemApi |
| | | }) |
| | | } |
| | | |
| | | if (!deffers.length) return |
| | | |
| | | deffers = deffers.map(item => { |
| | | return new Promise(resolve => { |
| | | Api.getSystemCacheConfig(item, false).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | Promise.all(deffers).then(response => { |
| | | let result = {...response[0], ...(response[1] || {})} |
| | | |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.message |
| | | delete result.status |
| | | |
| | | this.resetFormList(result) |
| | | }) |
| | | } |
| | | |
| | | resetFormList = (result) => { |
| | | const { columns, edData } = this.state |
| | | |
| | |
| | | |
| | | if (!data) return |
| | | |
| | | let result = getEditTableSql(submit, data, forms) |
| | | |
| | | let param = { |
| | | excel_in: result.lines, |
| | | BID: BID || '' |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | if (submit.intertype === 'system') { // 系统存储过程 |
| | | param.func = 'sPC_TableData_InUpDe' |
| | | if (submit.intertype === 'system' && window.backend && window.GLOB.CacheData.has('sql_' + submit.$menuId)) { |
| | | let ex = window.GLOB.CacheData.get('sql_' + submit.$menuId) |
| | | let param = this.getExps(ex, submit, data, forms) |
| | | |
| | | delete param.excel_in |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res, record) |
| | | } else { |
| | | this.execError(res, record) |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | | |
| | | this.execError({}) |
| | | }) |
| | | } else if (submit.intertype === 'system') { // 系统存储过程 |
| | | let result = getEditTableSql(submit, data, forms) |
| | | let param = {} |
| | | |
| | | param.func = 'sPC_TableData_InUpDe' |
| | | param.BID = BID || '' |
| | | |
| | | param.exec_type = window.GLOB.execType || 'y' |
| | | param.LText = Utils.formatOptions(result.sql, param.exec_type) |
| | |
| | | this.execError({}) |
| | | }) |
| | | } else if (submit.intertype === 'inner' && submit.innerFunc) { // 自定义存储过程 |
| | | let result = getEditTableSql(submit, data, forms) |
| | | let param = {} |
| | | |
| | | param.func = submit.innerFunc |
| | | param.BID = BID || '' |
| | | param.excel_in = result.lines |
| | | |
| | | if (submit.recordUser === 'true') { |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | |
| | | } |
| | | } |
| | | |
| | | getExps = (ex, btn, data, forms) => { |
| | | const { BID } = this.props |
| | | |
| | | let exps = [] |
| | | let values = { |
| | | time_id: Utils.getguid(), |
| | | roleid: sessionStorage.getItem('role_id') || '', |
| | | mk_departmentcode: sessionStorage.getItem('departmentcode') || '', |
| | | mk_organization: sessionStorage.getItem('organization') || '', |
| | | mk_user_type: sessionStorage.getItem('mk_user_type') || '', |
| | | mk_nation: sessionStorage.getItem('nation') || '', |
| | | mk_province: sessionStorage.getItem('province') || '', |
| | | mk_city: sessionStorage.getItem('city') || '', |
| | | mk_district: sessionStorage.getItem('district') || '', |
| | | mk_address: sessionStorage.getItem('address') || '', |
| | | bid: BID || '', |
| | | typename: 'admin', |
| | | datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', |
| | | } |
| | | |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | values.db = window.GLOB.externalDatabase |
| | | } |
| | | |
| | | let lines = data.map(item => { |
| | | let vals = [] |
| | | forms.forEach(col => { |
| | | vals.push(item[col.field]) |
| | | }) |
| | | |
| | | vals.push(item.$$uuid) |
| | | vals.push(item.$type || 'upt') |
| | | vals.push(BID) |
| | | |
| | | return vals |
| | | }) |
| | | |
| | | ex.reps.forEach(n => { |
| | | let key = n.toLowerCase() |
| | | if (values.hasOwnProperty(key)) { |
| | | exps.push({ |
| | | key: n, |
| | | value: values[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | exps.push({ |
| | | key: 'mk_excel_data', |
| | | value: lines |
| | | }) |
| | | |
| | | let md5_id = '' |
| | | if (window.GLOB.probation) { |
| | | md5_id = md5(ex.id + JSON.stringify(exps) + Math.floor(new Date().getTime() / 600000)) |
| | | md5_id = moment().format('YYYYMMDDHHmmss') + md5_id.slice(-18) |
| | | } |
| | | |
| | | return { |
| | | $backend: true, |
| | | data: [{ |
| | | id: ex.id, |
| | | exps: exps, |
| | | menuname: btn.logLabel || '', |
| | | md5_id: md5_id |
| | | }] |
| | | } |
| | | } |
| | | |
| | | execSuccess = (res, record) => { |
| | | const { submit } = this.props |
| | | const { edData, dict } = this.state |