From 4de0acf2a232ae29f2b5bd7bb2ee61a238c5d2d0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 24 十月 2023 17:31:55 +0800 Subject: [PATCH] 2023-10-24 --- src/tabviews/custom/components/table/edit-table/index.jsx | 54 +++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index fc305fe..9d5d2cb 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -27,7 +27,6 @@ config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - arr_field: '', // 鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� @@ -36,7 +35,8 @@ pageIndex: 1, // 椤电爜 pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 orderBy: '', // 鎺掑簭 - search: '' // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� + search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� + allSearch: null } /** @@ -85,6 +85,10 @@ if (item.Hide === 'true') return false item.tableId = setting.tableId + + if (setting.commit === 'blur') { + item.blur = true + } if (item.type === 'colspan') { item.subcols = getColumns(item.subcols) @@ -164,6 +168,18 @@ _config.lineMarks = null } + let allSearch = null + if (_config.colsCtrls && _config.colsCtrls.length > 0) { + allSearch = [{key: 'BID', value: BID || ''}] + allSearch.push(..._config.$searches) + if (_config.setting.useMSearch) { + let mainSearch = window.GLOB.SearchBox.get(_config.$searchId) || [] + allSearch.push(...mainSearch) + } + } else { + _config.colsCtrls = null + } + this.setState({ pageSize: setting.pageSize || 10, BID: BID || '', @@ -173,8 +189,8 @@ setting: setting, actions: _config.action, columns: _columns, - arr_field: _config.columns.map(col => col.field).join(','), - search: _config.$searches + search: _config.$searches, + allSearch }, () => { if (_config.setting.onload === 'true') { setTimeout(() => { @@ -190,7 +206,7 @@ * @param { String } repage 琛ㄦ牸鏄惁閲嶇疆椤电爜 */ async loadmaindata (reset, repage) { - const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state + const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state if (setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� this.setState({ @@ -222,7 +238,7 @@ }) 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) let result = await Api.genericInterface(param) if (result.status) { @@ -257,9 +273,16 @@ total = data[data.length - 1].mk_total || 0 } + let allSearch = null + if (config.colsCtrls) { + allSearch = [{key: 'BID', value: BID || ''}] + allSearch.push(...searches) + } + this.setState({ data: data, selectedData: [], + allSearch: allSearch, total: total, loading: false }) @@ -303,8 +326,13 @@ * @description 鑾峰彇鍗曡鏁版嵁 */ async loadmainLinedata (id) { - const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state + const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state + if (config.forbidLine) { + this.reloadtable() + return + } + let searches = fromJS(search).toJS() if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢 let mainSearch = window.GLOB.SearchBox.get(config.$searchId) || [] @@ -321,7 +349,7 @@ }) 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) let result = await Api.genericInterface(param) if (result.status) { @@ -440,7 +468,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config, orderBy, search, setting} = this.state + const { config, orderBy, search, setting } = this.state if (config.uuid !== menuId) return @@ -456,10 +484,8 @@ } callback({ - arr_field: arr_field, orderBy: orderBy || setting.order, - search: searches, - menuName: config.name + search: searches }) } @@ -584,7 +610,7 @@ } render() { - const { BID, setting, actions, config, columns, BData, data, selectedData } = this.state + const { BID, setting, actions, config, columns, BData, data, selectedData, allSearch } = this.state let style = {...config.style} if (config.wrap.empty === 'hidden' && data.length === 0) { @@ -610,9 +636,11 @@ setting={setting} columns={columns} MenuID={config.uuid} + allSearch={allSearch} submit={config.submit} fields={config.columns} total={this.state.total} + colsCtrls={config.colsCtrls} lineMarks={config.lineMarks} loading={this.state.loading} refreshdata={this.refreshbytable} -- Gitblit v1.8.0