From a8e94242166881639cecf3809e45ca527233ebd7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 23 三月 2021 16:42:20 +0800 Subject: [PATCH] 2021-03-23 --- src/tabviews/zshare/actionList/normalbutton/index.jsx | 77 +++++++++++--------------------------- 1 files changed, 22 insertions(+), 55 deletions(-) diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 7c27ad4..b3dfeee 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -11,6 +11,7 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import asyncSpinComponent from '@/utils/asyncSpinComponent' +import { updateForm } from '@/utils/utils-update.js' import MKEmitter from '@/utils/events.js' import './index.scss' @@ -1404,52 +1405,24 @@ handleModelConfig = (config) => { let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID - if (config.groups.length > 0) { - config.groups.forEach(group => { - group.sublist = group.sublist.map(cell => { - // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛� 鏉冮檺榛戝悕鍗曞瓧娈佃缃负闅愯棌琛ㄥ崟 - if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { - let _option = Utils.getSelectQueryOptions(cell) + config.fields = config.fields.map(cell => { + // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗� + if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { + let _option = Utils.getSelectQueryOptions(cell) - // 澶栬仈鏁版嵁搴撴浛鎹� - if (window.GLOB.externalDatabase !== null) { - _option.sql = _option.sql.replace(/@db@/ig, window.GLOB.externalDatabase) - } + cell.data_sql = Utils.formatOptions(_option.sql) + cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) + cell.arr_field = _option.field + } - cell.data_sql = Utils.formatOptions(_option.sql) - cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) - cell.arr_field = _option.field - } + // 瀛楁鏉冮檺榛戝悕鍗� + if (!cell.blacklist || cell.blacklist.length === 0) return cell + if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { + cell.hidden = 'true' + } - // 瀛楁鏉冮檺榛戝悕鍗� - if (!cell.blacklist || cell.blacklist.length === 0) return cell - if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { - cell.hidden = 'true' - } - - return cell - }) - }) - } else { - config.fields = config.fields.map(cell => { - // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗� - if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { - let _option = Utils.getSelectQueryOptions(cell) - - cell.data_sql = Utils.formatOptions(_option.sql) - cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) - cell.arr_field = _option.field - } - - // 瀛楁鏉冮檺榛戝悕鍗� - if (!cell.blacklist || cell.blacklist.length === 0) return cell - if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { - cell.hidden = 'true' - } - - return cell - }) - } + return cell + }) return config } @@ -1499,6 +1472,7 @@ }) this.updateStatus('over') } else { + _LongParam = updateForm(_LongParam) _LongParam = this.handleModelConfig(_LongParam) this.setState({ @@ -1549,17 +1523,10 @@ const { BData } = this.props const { btnconfig, tabledata } = this.state let _this = this - let _fields = [] - - if (btnconfig.groups.length > 0) { - btnconfig.groups.forEach(group => { - _fields = [..._fields, ...group.sublist] - }) - } else { - _fields = btnconfig.fields - } - let result = _fields.map(item => { + let result = [] + btnconfig.fields.forEach(item => { + if (!item.field) return let _readin = item.readin !== 'false' let _initval = item.initval @@ -1590,7 +1557,7 @@ _initval = '' } - return { + result.push({ key: item.field, readonly: item.readonly === 'true', readin: _readin, @@ -1598,7 +1565,7 @@ writein: item.writein !== 'false', type: item.type, value: _initval - } + }) }) confirm({ -- Gitblit v1.8.0