| | |
| | | } |
| | | |
| | | this.record = record |
| | | let ID = this.props.data ? this.props.data.$$uuid || '' : '' |
| | | |
| | | this.setState({ formlist, ID: this.props.data ? this.props.data.$$uuid || '' : '' }, () => { |
| | | this.setState({ formlist, ID }, () => { |
| | | if (unload) return |
| | | |
| | | if (action.setting && action.setting.focus && fieldMap.has(action.setting.focus)) { |
| | |
| | | } |
| | | |
| | | if (deForms.length > 0) { |
| | | if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { |
| | | this.improveSimpleActionForm(deForms) |
| | | if (action.$cache && action.setting.cache !== 'false') { |
| | | Api.getLCacheConfig(action.uuid, action.$time, this.props.BID, ID).then(res => { |
| | | if (!res.valid) { |
| | | this.getFormData(deForms) |
| | | } else { |
| | | this.resetFormList(res.data, true) |
| | | } |
| | | }) |
| | | } else { |
| | | this.improveActionForm(deForms) |
| | | this.getFormData(deForms) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | getFormData = (deForms) => { |
| | | if (deForms.length === 1) { |
| | | this.improveSimpleActionForm(deForms) |
| | | } else if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { |
| | | this.improveSimpleActionForm(deForms) |
| | | } else { |
| | | this.improveActionForm(deForms) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | let deffers = [] |
| | | let mainItems = [] // 云端或单点数据 |
| | | let localItems = [] // 本地数据 |
| | | let cache = action.setting.cache !== 'false' |
| | | let debug = window.GLOB.debugger === true |
| | | let cache = action.setting.cache !== 'false' && !action.$cache |
| | | let skip = false |
| | | |
| | | let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n` |
| | | let _sso = _sql |
| | |
| | | sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) |
| | | sql = sql.replace(/@BID@/ig, `'${BID}'`) |
| | | |
| | | if (debug) { |
| | | if (window.GLOB.debugger === true) { |
| | | console.info(sql) |
| | | } |
| | | |
| | |
| | | sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) |
| | | sql = sql.replace(/@BID@/ig, `'${BID}'`) |
| | | |
| | | if (debug) { |
| | | if (window.GLOB.debugger === true) { |
| | | console.info(sql) |
| | | } |
| | | |
| | |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | skip = true |
| | | } |
| | | resolve(res) |
| | | }) |
| | |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | skip = true |
| | | } |
| | | resolve(res) |
| | | }) |
| | |
| | | delete result.message |
| | | delete result.status |
| | | |
| | | this.resetFormList(result) |
| | | this.resetFormList(result, skip) |
| | | }) |
| | | } |
| | | |
| | |
| | | * @description 测试系统获取下拉表单选项信息 |
| | | */ |
| | | improveSimpleActionForm = (deForms) => { |
| | | let cache = this.props.action.setting.cache !== 'false' |
| | | const { action } = this.props |
| | | |
| | | let cache = this.props.action.setting.cache !== 'false' && !action.$cache |
| | | let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n` |
| | | let skip = false |
| | | |
| | | let deffers = deForms.map((form, index) => { |
| | | let param = { |
| | |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | skip = true |
| | | } |
| | | resolve(res) |
| | | }) |
| | |
| | | |
| | | Promise.all(deffers).then(response => { |
| | | let result = {} |
| | | |
| | | response.forEach(res => { |
| | | result = {...result, ...res} |
| | | }) |
| | |
| | | delete result.message |
| | | delete result.status |
| | | |
| | | this.resetFormList(result) |
| | | this.resetFormList(result, skip) |
| | | }) |
| | | } |
| | | |
| | | resetFormList = (result) => { |
| | | resetFormList = (result, skip) => { |
| | | const { BID, action } = this.props |
| | | |
| | | if (action.$cache && action.setting.cache !== 'false' && !skip) { |
| | | Api.writeCacheConfig(action.uuid, fromJS(result).toJS(), BID, this.state.ID) |
| | | } |
| | | |
| | | let reFieldsVal = null |
| | | let _formlist = fromJS(this.state.formlist).toJS().map(item => { |
| | | if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |