From 2d704fb62459923206071b319f8423c3381145f8 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 11 六月 2025 00:18:20 +0800 Subject: [PATCH] 2025-06-11 --- src/tabviews/subtabtable/index.jsx | 94 +++++++++++++++++++++++++++------------------- 1 files changed, 55 insertions(+), 39 deletions(-) diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 3388d62..888ef15 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -4,8 +4,6 @@ import { notification, Spin, Modal } from 'antd' import Api from '@/api' -import zhCN from '@/locales/zh-CN/main.js' -import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' import UtilsDM from '@/utils/utils-datamanage.js' import { updateSubTabTable } from '@/utils/utils-update.js' @@ -30,14 +28,12 @@ } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, loadingview: true, // 椤甸潰鍔犺浇涓� viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - arr_field: '', // 鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� @@ -50,7 +46,6 @@ statFields: [], // 鍚堣瀛楁 statFValue: [], // 鍚堣鍊� absFields: [], // 缁濆鍊煎瓧娈� - hasReqFields: false } /** @@ -90,7 +85,7 @@ this.setState({ loadingview: false, viewlost: true, - lostmsg: this.state.dict['main.view.unenabled'] + lostmsg: '鎶辨瓑锛屾偍璁块棶鐨勯〉闈㈡湭鍚敤锛岃鑱旂郴绠$悊鍛樸��' }) return } @@ -126,14 +121,7 @@ // 鏉冮檺杩囨护 config.action = config.action.filter(item => item.hidden !== 'true') - config.search = Utils.initSearchVal(config.search) - - let hasReqFields = false - config.search.forEach(field => { - if (field.required) { - hasReqFields = true - } - }) + Utils.initSearchVal(config) // 瀛楁鏉冮檺榛戝悕鍗� let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID @@ -204,11 +192,28 @@ let _actions = [] // 宸ュ叿鏍忔寜閽� let _operations = [] // 鎿嶄綔鍒楁寜閽紙瀛樺湪鏃讹級 + let colors = { primary: '#1890ff', yellow: '#c49f47', orange: 'orange', danger: '#ff4d4f', green: '#26C281', dgreen: '#32c5d2', purple: '#8E44AD', cyan: '#13c2c2', gray: '#E7E7EF', default: 'rgba(0, 0, 0, 0.65)' } config.action.forEach(item => { item.logLabel = Tab.label + '-' + item.label // 鐢ㄤ簬sPC_TableData_InUpDe璁板綍鎿嶄綔鎸夐挳 item.$menuId = this.props.MenuID item.$old = true + + if (item.OpenType === 'popview') return + + if (item.OpenType === 'excelOut') { // 瀵煎嚭 + item.$menuName = Tab.label + } + + if (item.verify && item.verify.invalid === 'true') { + if (item.sqlType === 'insert') { + item.verify.invalid = 'false' + } else if (item.Ot === 'notRequired') { + item.verify.invalid = 'false' + } else if (item.intertype !== 'system' && item.procMode !== 'system') { + item.verify.invalid = 'false' + } + } if (item.controlField) { if (/,/ig.test(item.controlVal)) { @@ -218,10 +223,25 @@ } } + item.show = 'button' + + let _c = item.class ? item.class.replace('border-', '') : '' + let color = colors[_c] || '#1890ff' + if (item.position === 'toolbar') { item.$toolbtn = true + + if (item.class === 'default') { + item.style = {color: 'rgba(0, 0, 0, 0.65)', backgroundColor: '#fff', borderColor: '#d9d9d9', marginRight: '15px'} + } else if (item.class.indexOf('border') > -1) { + item.style = {color: color, backgroundColor: '#fff', borderColor: color, marginRight: '15px'} + } else { + item.style = {color: item.class === 'gray' ? 'rgba(0, 0, 0, 0.65)' : '#fff', backgroundColor: color, borderColor: color, marginRight: '15px'} + } + _actions.push(item) } else if (item.position === 'grid') { + item.style = {color: color, backgroundColor: 'transparent', borderColor: 'transparent'} _operations.push(item) } }) @@ -259,10 +279,8 @@ } if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*') - config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/') - config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*') - config.setting.customScript = config.setting.customScript.replace(/@\$/ig, '*/') + config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/') + config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/') } else { config.setting.dataresource = config.setting.dataresource.replace(/@\$|\$@/ig, '') config.setting.customScript = config.setting.customScript.replace(/@\$|\$@/ig, '') @@ -270,11 +288,6 @@ let userName = sessionStorage.getItem('User_Name') || '' let fullName = sessionStorage.getItem('Full_Name') || '' - - if (sessionStorage.getItem('isEditState') === 'true') { - userName = sessionStorage.getItem('CloudUserName') || '' - fullName = sessionStorage.getItem('CloudFullName') || '' - } let regs = [ { reg: /@userName@/ig, value: `'${userName}'` }, @@ -285,6 +298,8 @@ config.setting.dataresource = config.setting.dataresource.replace(cell.reg, cell.value) config.setting.customScript = config.setting.customScript.replace(cell.reg, cell.value) }) + } else { + config.setting.dataresource = '' } if (config.setting.selected !== 'init' && config.setting.selected !== 'always') { @@ -313,7 +328,10 @@ searchRatio: config.setting.searchRatio || '', searchLwidth: config.setting.searchLwidth, borderRadius: config.setting.borderRadius, + resetContrl: config.setting.resetContrl, } + + config.setting.arr_field = _arrField.join(',') this.setState({ pageSize: config.setting.pageSize || 10, @@ -324,9 +342,7 @@ setting: config.setting, actions: _actions, columns: _columns, - arr_field: _arrField.join(','), search: Utils.initMainSearch(config.search), // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 - hasReqFields }, () => { if (config.setting.onload !== 'false') { // 鍒濆鍖栧彲鍔犺浇 this.loadData() @@ -346,11 +362,11 @@ } loadData = (id) => { - const { setting, search, hasReqFields } = this.state + const { setting, search, config } = this.state let searches = fromJS(search).toJS() - if (hasReqFields) { + if (config.$s_req) { let requireFields = searches.filter(item => item.required && item.value === '') if (requireFields.length > 0) { this.setState({ @@ -381,7 +397,7 @@ */ async loadmaindata (id) { const { BID } = this.props - const { setting, arr_field, search, orderBy, pageIndex, pageSize, absFields } = this.state + const { setting, search, orderBy, pageIndex, pageSize, absFields } = this.state let searches = fromJS(search).toJS() @@ -390,7 +406,9 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) + let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID) + + delete param.s_version_up let result = await Api.genericInterface(param) @@ -506,7 +524,7 @@ */ async loadmainLinedata (id) { const { BID } = this.props - const { setting, arr_field, search, orderBy, pageIndex, pageSize, absFields } = this.state + const { setting, search, orderBy, pageIndex, pageSize, absFields } = this.state let searches = fromJS(search).toJS() @@ -515,7 +533,9 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id) + let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID, id) + + delete param.s_version_up let result = await Api.genericInterface(param) if (result.status) { @@ -639,16 +659,14 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { Tab, MenuID } = this.props - const { arr_field, orderBy, search, setting} = this.state + const { MenuID } = this.props + const { orderBy, search, setting} = this.state if (MenuID !== menuId) return callback({ - arr_field: arr_field, orderBy: orderBy || setting.order, - search: search, - menuName: Tab.label + search: search }) } @@ -702,7 +720,7 @@ return ( <div className="subtabtable" id={'subtabtable' + this.props.MenuID}> {loadingview && <Spin />} - {config.search && config.search.length ? + {config && config.search && config.search.length ? <SubSearch BID={this.props.BID} config={config} refreshdata={this.refreshbysearch}/> : null } {config ? <div style={{minHeight: '25px'}}> @@ -711,7 +729,6 @@ actions={actions} columns={columns} BID={this.props.BID} - dict={this.state.dict} BData={this.props.BData} selectedData={selectedData} MenuID={this.props.SupMenuID} @@ -723,7 +740,6 @@ columns={columns} pageSize={pageSize} data={this.state.data} - dict={this.state.dict} BData={this.props.BData} total={this.state.total} MenuID={this.props.MenuID} -- Gitblit v1.8.0