From 0c1a33a33b45fc3265cb7fef20beb48407cd6c98 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 24 八月 2023 14:54:06 +0800 Subject: [PATCH] 2023-08-24 --- src/tabviews/zshare/mutilform/index.jsx | 54 ++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 42 insertions(+), 12 deletions(-) diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 33e80b9..e9a26ed 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -610,8 +610,9 @@ } 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)) { @@ -629,13 +630,29 @@ } 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) + } } /** @@ -647,8 +664,8 @@ 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 @@ -661,7 +678,7 @@ sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) sql = sql.replace(/@BID@/ig, `'${BID}'`) - if (debug) { + if (window.GLOB.debugger === true) { console.info(sql) } @@ -675,7 +692,7 @@ sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) sql = sql.replace(/@BID@/ig, `'${BID}'`) - if (debug) { + if (window.GLOB.debugger === true) { console.info(sql) } @@ -712,6 +729,7 @@ message: res.message, duration: 5 }) + skip = true } resolve(res) }) @@ -753,6 +771,7 @@ message: res.message, duration: 5 }) + skip = true } resolve(res) }) @@ -768,7 +787,7 @@ delete result.message delete result.status - this.resetFormList(result) + this.resetFormList(result, skip) }) } @@ -776,8 +795,11 @@ * @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 = { @@ -812,6 +834,7 @@ message: res.message, duration: 5 }) + skip = true } resolve(res) }) @@ -822,6 +845,7 @@ Promise.all(deffers).then(response => { let result = {} + response.forEach(res => { result = {...result, ...res} }) @@ -831,11 +855,17 @@ 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) { -- Gitblit v1.8.0