diff --git a/src/components/jeecg/OnLine/JPopupOnlReport.vue b/src/components/jeecg/OnLine/JPopupOnlReport.vue index 13b07c1..416dee1 100644 --- a/src/components/jeecg/OnLine/JPopupOnlReport.vue +++ b/src/components/jeecg/OnLine/JPopupOnlReport.vue @@ -125,6 +125,8 @@ }, ] = usePopBiz(getBindValue, tableRef); + pagination.pageSizeOptions = ['10', '100', '300']; + const showSearchFlag = computed(() => unref(queryInfo) && unref(queryInfo).length > 0); /** *监听code @@ -246,4 +248,7 @@ :deep(.jeecg-basic-table .ant-table-wrapper .ant-table-title){ min-height: 0; } + :deep(.ant-select-selector){ + min-width: 95px; + } diff --git a/src/components/jeecg/OnLine/SearchFormItem.vue b/src/components/jeecg/OnLine/SearchFormItem.vue index e60d6b6..db17993 100644 --- a/src/components/jeecg/OnLine/SearchFormItem.vue +++ b/src/components/jeecg/OnLine/SearchFormItem.vue @@ -215,7 +215,7 @@ import { CompTypeEnum } from '/@/enums/CompTypeEnum.ts'; import { JDictSelectTag, JTreeSelect, JCategorySelect, JSelectUserByDept, JSelectDept, JPopup, JAreaLinkage,JInput,JSearchSelect } from '/@/components/Form'; export default defineComponent({ - name: 'JPopupOnlReport', + name: 'SearchFormItem', components: { //JOnlineSearchSelect JDictSelectTag, diff --git a/src/components/jeecg/OnLine/hooks/usePopBiz.ts b/src/components/jeecg/OnLine/hooks/usePopBiz.ts index 1b6d799..daaa514 100644 --- a/src/components/jeecg/OnLine/hooks/usePopBiz.ts +++ b/src/components/jeecg/OnLine/hooks/usePopBiz.ts @@ -7,7 +7,7 @@ import { OnlineColumn } from '/@/components/jeecg/OnLine/types/onlineConfig'; import { h } from 'vue'; import { useRouter, useRoute } from 'vue-router'; import { useMethods } from '/@/hooks/system/useMethods'; -import { importViewsFile } from '/@/utils'; +import { importViewsFile, _eval } from '/@/utils'; export function usePopBiz(ob, tableRef?) { // update-begin--author:liaozhiyang---date:20230811---for:【issues/675】子表字段Popup弹框数据不更新 @@ -111,22 +111,35 @@ export function usePopBiz(ob, tableRef?) { * @param selectRow */ function onSelectChange(selectedRowKeys: (string | number)[]) { + // update-begin--author:liaozhiyang---date:20230919---for:【QQYUN-4263】跨页选择导出问题 if (!selectedRowKeys || selectedRowKeys.length == 0) { selectRows.value = []; + checkedKeys.value = []; } else { - // update-begin--author:liaozhiyang---date:20230830---for:【issues/726】JPopup组件里的表格全选没有选中数据 - selectRows.value = []; - for (let i = 0; i < selectedRowKeys.length; i++) { - let combineKey = combineRowKey(getRowByKey(selectedRowKeys[i])); - let keys = unref(checkedKeys); - if (combineKey && keys.indexOf(combineKey) != -1) { - let row = getRowByKey(selectedRowKeys[i]); - row && selectRows.value.push(row); - } + if (selectRows.value.length > selectedRowKeys.length) { + // 取消 + selectRows.value.forEach((item, index) => { + const rowKey = combineRowKey(item); + if (!selectedRowKeys.find((key) => key === rowKey)) { + selectRows.value.splice(index, 1); + } + }); + } else { + // 新增 + const append: any = []; + const beforeRowKeys = selectRows.value.map((item) => combineRowKey(item)); + selectedRowKeys.forEach((key) => { + if (!beforeRowKeys.find((item) => item === key)) { + // 那就是新增选中的行 + const row = getRowByKey(key); + row && append.push(row); + } + }); + selectRows.value = [...selectRows.value, ...append]; } - // update-end--author:liaozhiyang---date:20230830---for:【issues/726】JPopup组件里的表格全选没有选中数据 + checkedKeys.value = [...selectedRowKeys]; } - checkedKeys.value = selectedRowKeys; + // update-end--author:liaozhiyang---date:20230919---for:【QQYUN-4263】跨页选择导出问题 } /** * 过滤没用选项 @@ -437,7 +450,9 @@ export function usePopBiz(ob, tableRef?) { if (jsPattern.test(href)) { href = href.replace(jsPattern, function (text, s0) { try { - return eval(s0); + // update-begin--author:liaozhiyang---date:20230904---for:【QQYUN-6390】eval替换成new Function,解决build警告 + return _eval(s0); + // update-end--author:liaozhiyang---date:20230904---for:【QQYUN-6390】eval替换成new Function,解决build警告 } catch (e) { console.error(e); return text; @@ -466,7 +481,7 @@ export function usePopBiz(ob, tableRef?) { let keys = unref(checkedKeys); if (keys.length > 0) { params['force_id'] = keys - .map((i) => (getRowByKey(i) as any)?.id) + .map((i) => selectRows.value.find((item) => combineRowKey(item) === i)?.id) .filter((i) => i != null && i !== '') .join(','); } @@ -699,17 +714,17 @@ export function usePopBiz(ob, tableRef?) { arr1.push(record); arr2.push(rowKey); checkedKeys.value = arr2; - selectRows.value = arr1; + //selectRows.value = arr1; } else { if (unref(checkedKeys).indexOf(rowKey) < 0) { //不存在就选中 checkedKeys.value.push(rowKey); - selectRows.value.push(record); + //selectRows.value.push(record); } else { //已选中就取消 let rowKey_index = unref(checkedKeys).indexOf(rowKey); checkedKeys.value.splice(rowKey_index, 1); - selectRows.value.splice(rowKey_index, 1); + //selectRows.value.splice(rowKey_index, 1); } } // update-begin--author:liaozhiyang---date:20230914---for:【issues/5357】点击行选中 diff --git a/src/utils/index.ts b/src/utils/index.ts index 3db0fc2..a26a7c6 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -301,8 +301,10 @@ export function importViewsFile(path): Promise { * @param token */ export function goJmReportViewPage(url, id, token) { + // update-begin--author:liaozhiyang---date:20230904---for:【QQYUN-6390】eval替换成new Function,解决build警告 // URL支持{{ window.xxx }}占位符变量 - url = url.replace(/{{([^}]+)?}}/g, (_s1, s2) => eval(s2)) + url = url.replace(/{{([^}]+)?}}/g, (_s1, s2) => _eval(s2)) + // update-end--author:liaozhiyang---date:20230904---for:【QQYUN-6390】eval替换成new Function,解决build警告 if (url.includes('?')) { url += '&' } else { @@ -311,4 +313,58 @@ export function goJmReportViewPage(url, id, token) { url += `id=${id}` url += `&token=${token}` window.open(url) -} \ No newline at end of file +} + +/** + * 获取随机颜色 + */ +export function getRandomColor(index?) { + + const colors = [ + 'rgb(100, 181, 246)', + 'rgb(77, 182, 172)', + 'rgb(255, 183, 77)', + 'rgb(229, 115, 115)', + 'rgb(149, 117, 205)', + 'rgb(161, 136, 127)', + 'rgb(144, 164, 174)', + 'rgb(77, 208, 225)', + 'rgb(129, 199, 132)', + 'rgb(255, 138, 101)', + 'rgb(133, 202, 205)', + 'rgb(167, 214, 118)', + 'rgb(254, 225, 89)', + 'rgb(251, 199, 142)', + 'rgb(239, 145, 139)', + 'rgb(169, 181, 255)', + 'rgb(231, 218, 202)', + 'rgb(252, 128, 58)', + 'rgb(254, 161, 172)', + 'rgb(194, 163, 205)', + ]; + return index && index < 19 ? colors[index] : colors[Math.floor((Math.random()*(colors.length-1)))]; +} + +export function getRefPromise(componentRef) { + return new Promise((resolve) => { + (function next() { + const ref = componentRef.value; + if (ref) { + resolve(ref); + } else { + setTimeout(() => { + next(); + }, 100); + } + })(); + }); +} + +/** + * 2023-09-04 + * liaozhiyang + * 用new Function替换eval + */ +export function _eval(str: string) { + return new Function(`return ${str}`)(); +}