From bca9d545b6b10e1d0120b8edaece22f9acbe12f3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 30 十月 2023 16:08:14 +0800 Subject: [PATCH] 2023-10-30 --- src/tabviews/custom/components/table/edit-table/index.jsx | 70 +++++++++++++++++++++++++++++++++++ 1 files changed, 70 insertions(+), 0 deletions(-) diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index 359886a..4f2d6c0 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -130,6 +130,15 @@ return !cell.Hide }) + } else if (item.editType === 'popSelect') { + if (item.pops) { + item.pops.forEach(cell => { + this.resetPop(cell) + cell.tabName = cell.initval.replace(/^tab:/, '') + }) + } else { + this.resetPop(item) + } } } } @@ -200,6 +209,67 @@ }) } + resetPop = (config) => { + let arrfield = config.columns.map(f => f.field) + + if (config.linkSubField && config.linkSubField.length > 0) { + config.linkSubField.forEach(n => { + if (!arrfield.includes(n)) { + arrfield.push(n) + } + }) + } + + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 + config.dataSource = config.dataSource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + } else { + config.dataSource = config.dataSource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + } + + config.dataSource = config.dataSource.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) + config.dataSource = config.dataSource.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) + config.dataSource = config.dataSource.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) + config.dataSource = config.dataSource.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + + if (/\s/.test(config.dataSource)) { // 鎷兼帴鍒悕 + config.dataSource = '(' + config.dataSource + ') tb' + } + + let labels = {} + config.cols = [] + config.columns.forEach(col => { + labels[col.field] = col.label + + if (col.Hide === 'true') return + + config.cols.push({ + dataIndex: col.field, + title: col.label, + sorter: col.IsSort === 'true', + width: col.Width || 120 + }) + }) + + let placeholder = '' + if (!config.searchKey) { + config.onload = 'true' + } else { + placeholder = [] + config.searchKey.split(',').forEach(key => { + if (!labels[key]) { + placeholder = '' + } else if (placeholder) { + placeholder.push(labels[key]) + } + }) + + placeholder = placeholder ? placeholder.join('銆�') : '' + } + + config.placeholder = placeholder + config.arr_field = arrfield.join(',') + } + /** * @description 涓昏〃鏁版嵁鍔犺浇 * @param { Boolean } reset 琛ㄦ牸鏄惁閲嶇疆 -- Gitblit v1.8.0