|
@@ -155,7 +155,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
*/
|
|
*/
|
|
|
function filterUnuseSelect() {
|
|
function filterUnuseSelect() {
|
|
|
selectRows.value = unref(selectRows).filter((item) => {
|
|
selectRows.value = unref(selectRows).filter((item) => {
|
|
|
- let combineKey = combineRowKey(item);
|
|
|
|
|
|
|
+ const combineKey = combineRowKey(item);
|
|
|
return unref(checkedKeys).indexOf(combineKey) >= 0;
|
|
return unref(checkedKeys).indexOf(combineKey) >= 0;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -165,7 +165,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
* @param key
|
|
* @param key
|
|
|
*/
|
|
*/
|
|
|
function getRowByKey(key) {
|
|
function getRowByKey(key) {
|
|
|
- let row = unref(dataSource).filter((record) => combineRowKey(record) === key);
|
|
|
|
|
|
|
+ const row = unref(dataSource).filter((record) => combineRowKey(record) === key);
|
|
|
return row && row.length > 0 ? row[0] : '';
|
|
return row && row.length > 0 ? row[0] : '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -191,18 +191,18 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
*/
|
|
*/
|
|
|
function loadColumnsInfo() {
|
|
function loadColumnsInfo() {
|
|
|
const {code} = handleCodeParams(true)
|
|
const {code} = handleCodeParams(true)
|
|
|
- let url = `${configUrl.getColumns}${code}`;
|
|
|
|
|
|
|
+ const url = `${configUrl.getColumns}${code}`;
|
|
|
//缓存key
|
|
//缓存key
|
|
|
- let groupIdKey = props.groupId ? `${props.groupId}${url}` : '';
|
|
|
|
|
|
|
+ const groupIdKey = props.groupId ? `${props.groupId}${url}` : '';
|
|
|
httpGroupRequest(() => defHttp.get({ url }, { isTransformResponse: false, successMessageMode: 'none' }), groupIdKey).then((res) => {
|
|
httpGroupRequest(() => defHttp.get({ url }, { isTransformResponse: false, successMessageMode: 'none' }), groupIdKey).then((res) => {
|
|
|
if (res.success) {
|
|
if (res.success) {
|
|
|
initDictOptionData(res.result.dictOptions);
|
|
initDictOptionData(res.result.dictOptions);
|
|
|
cgRpConfigId.value = res.result.cgRpConfigId;
|
|
cgRpConfigId.value = res.result.cgRpConfigId;
|
|
|
title.value = res.result.cgRpConfigName;
|
|
title.value = res.result.cgRpConfigName;
|
|
|
- let currColumns = res.result.columns;
|
|
|
|
|
|
|
+ const currColumns = res.result.columns;
|
|
|
for (let a = 0; a < currColumns.length; a++) {
|
|
for (let a = 0; a < currColumns.length; a++) {
|
|
|
if (currColumns[a].customRender) {
|
|
if (currColumns[a].customRender) {
|
|
|
- let dictCode = currColumns[a].customRender;
|
|
|
|
|
|
|
+ const dictCode = currColumns[a].customRender;
|
|
|
currColumns[a].customRender = ({ text }) => {
|
|
currColumns[a].customRender = ({ text }) => {
|
|
|
return filterMultiDictText(unref(dictOptions)[dictCode], text + '');
|
|
return filterMultiDictText(unref(dictOptions)[dictCode], text + '');
|
|
|
};
|
|
};
|
|
@@ -256,12 +256,12 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
url = url + query
|
|
url = url + query
|
|
|
}
|
|
}
|
|
|
//缓存key
|
|
//缓存key
|
|
|
- let groupIdKey = props.groupId ? `${props.groupId}${url}` : '';
|
|
|
|
|
|
|
+ const groupIdKey = props.groupId ? `${props.groupId}${url}` : '';
|
|
|
httpGroupRequest(() => defHttp.get({ url }, { isTransformResponse: false, successMessageMode: 'none' }), groupIdKey).then((res) => {
|
|
httpGroupRequest(() => defHttp.get({ url }, { isTransformResponse: false, successMessageMode: 'none' }), groupIdKey).then((res) => {
|
|
|
if (res.success) {
|
|
if (res.success) {
|
|
|
initDictOptionData(res.result.dictOptions);
|
|
initDictOptionData(res.result.dictOptions);
|
|
|
cgRpConfigId.value = props.id;
|
|
cgRpConfigId.value = props.id;
|
|
|
- let { columns: metaColumnList, cgreportHeadName, fieldHrefSlots, isGroupTitle } = res.result;
|
|
|
|
|
|
|
+ const { columns: metaColumnList, cgreportHeadName, fieldHrefSlots, isGroupTitle } = res.result;
|
|
|
title.value = cgreportHeadName;
|
|
title.value = cgreportHeadName;
|
|
|
// href 跳转
|
|
// href 跳转
|
|
|
const fieldHrefSlotKeysMap = {};
|
|
const fieldHrefSlotKeysMap = {};
|
|
@@ -341,7 +341,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
*/
|
|
*/
|
|
|
function handleSumColumn(metaColumnList: OnlineColumn[], dataTotal: number): void {
|
|
function handleSumColumn(metaColumnList: OnlineColumn[], dataTotal: number): void {
|
|
|
// 获取需要合计列的dataIndex
|
|
// 获取需要合计列的dataIndex
|
|
|
- let sumColumnList = getNeedSumColumns(metaColumnList);
|
|
|
|
|
|
|
+ const sumColumnList = getNeedSumColumns(metaColumnList);
|
|
|
// 判断是否为第一次获取数据,如果是的话,则需要重新设置pageSize
|
|
// 判断是否为第一次获取数据,如果是的话,则需要重新设置pageSize
|
|
|
if (pagination.isTotal == '') {
|
|
if (pagination.isTotal == '') {
|
|
|
if (sumColumnList.length > 0) {
|
|
if (sumColumnList.length > 0) {
|
|
@@ -349,7 +349,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
// 有合计字段时,每次最多查询原pageSize-1条记录,另外需要第一次时将查询的10条中删除最后一条
|
|
// 有合计字段时,每次最多查询原pageSize-1条记录,另外需要第一次时将查询的10条中删除最后一条
|
|
|
// 删除最后一条数据 如果第一次得到的数据长度等于pageSize的话,则删除最后一条
|
|
// 删除最后一条数据 如果第一次得到的数据长度等于pageSize的话,则删除最后一条
|
|
|
if (dataSource.value.length == pagination.pageSize) {
|
|
if (dataSource.value.length == pagination.pageSize) {
|
|
|
- let remove_data = dataSource.value.pop();
|
|
|
|
|
|
|
+ const remove_data = dataSource.value.pop();
|
|
|
}
|
|
}
|
|
|
pagination.realPageSize = pagination.pageSize - 1;
|
|
pagination.realPageSize = pagination.pageSize - 1;
|
|
|
} else {
|
|
} else {
|
|
@@ -358,7 +358,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
}
|
|
}
|
|
|
// 需要添加合计字段
|
|
// 需要添加合计字段
|
|
|
if (pagination.isTotal) {
|
|
if (pagination.isTotal) {
|
|
|
- let totalRow = {};
|
|
|
|
|
|
|
+ const totalRow = {};
|
|
|
sumColumnList.forEach((dataIndex) => {
|
|
sumColumnList.forEach((dataIndex) => {
|
|
|
let count = 0;
|
|
let count = 0;
|
|
|
dataSource.value.forEach((row) => {
|
|
dataSource.value.forEach((row) => {
|
|
@@ -370,7 +370,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
totalRow[dataIndex] = isNaN(count) ? '包含非数字内容' : count.toFixed(2);
|
|
totalRow[dataIndex] = isNaN(count) ? '包含非数字内容' : count.toFixed(2);
|
|
|
|
|
|
|
|
// 长整形时合计不显示.00后缀
|
|
// 长整形时合计不显示.00后缀
|
|
|
- let v = metaColumnList.find((v) => v.dataIndex == dataIndex);
|
|
|
|
|
|
|
+ const v = metaColumnList.find((v) => v.dataIndex == dataIndex);
|
|
|
if (v && v.fieldType == 'Long') {
|
|
if (v && v.fieldType == 'Long') {
|
|
|
totalRow[dataIndex] = parseInt(totalRow[dataIndex]);
|
|
totalRow[dataIndex] = parseInt(totalRow[dataIndex]);
|
|
|
}
|
|
}
|
|
@@ -386,14 +386,14 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
* @param columns
|
|
* @param columns
|
|
|
*/
|
|
*/
|
|
|
function getNeedSumColumns(columns: OnlineColumn[]): string[] {
|
|
function getNeedSumColumns(columns: OnlineColumn[]): string[] {
|
|
|
- let arr: string[] = [];
|
|
|
|
|
- for (let column of columns) {
|
|
|
|
|
|
|
+ const arr: string[] = [];
|
|
|
|
|
+ for (const column of columns) {
|
|
|
if (column.isTotal === '1') {
|
|
if (column.isTotal === '1') {
|
|
|
arr.push(column.dataIndex!);
|
|
arr.push(column.dataIndex!);
|
|
|
}
|
|
}
|
|
|
// 【VUEN-1569】【online报表】合计无效
|
|
// 【VUEN-1569】【online报表】合计无效
|
|
|
if (column.children && column.children.length > 0) {
|
|
if (column.children && column.children.length > 0) {
|
|
|
- let subArray = getNeedSumColumns(column.children);
|
|
|
|
|
|
|
+ const subArray = getNeedSumColumns(column.children);
|
|
|
if (subArray.length > 0) {
|
|
if (subArray.length > 0) {
|
|
|
arr.push(...subArray);
|
|
arr.push(...subArray);
|
|
|
}
|
|
}
|
|
@@ -406,7 +406,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
* 处理列的href和字典翻译
|
|
* 处理列的href和字典翻译
|
|
|
*/
|
|
*/
|
|
|
function handleColumnHrefAndDict(columns: OnlineColumn[], fieldHrefSlotKeysMap: {}): OnlineColumn[] {
|
|
function handleColumnHrefAndDict(columns: OnlineColumn[], fieldHrefSlotKeysMap: {}): OnlineColumn[] {
|
|
|
- for (let column of columns) {
|
|
|
|
|
|
|
+ for (const column of columns) {
|
|
|
let { customRender, hrefSlotName, fieldType } = column;
|
|
let { customRender, hrefSlotName, fieldType } = column;
|
|
|
// online 报表中类型配置为日期(yyyy-MM-dd ),但是实际展示为日期时间格式(yyyy-MM-dd HH:mm:ss) issues/3042
|
|
// online 报表中类型配置为日期(yyyy-MM-dd ),但是实际展示为日期时间格式(yyyy-MM-dd HH:mm:ss) issues/3042
|
|
|
if (fieldType == 'Date') {
|
|
if (fieldType == 'Date') {
|
|
@@ -430,14 +430,14 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
// 如果 hrefSlotName 有值则代表使用了href跳转
|
|
// 如果 hrefSlotName 有值则代表使用了href跳转
|
|
|
// 两者可以兼容。兼容的具体思路为:先获取到字典替换的值,再添加href链接跳转
|
|
// 两者可以兼容。兼容的具体思路为:先获取到字典替换的值,再添加href链接跳转
|
|
|
if (customRender || hrefSlotName) {
|
|
if (customRender || hrefSlotName) {
|
|
|
- let dictCode = customRender as string;
|
|
|
|
|
- let replaceFlag = '_replace_text_';
|
|
|
|
|
|
|
+ const dictCode = customRender as string;
|
|
|
|
|
+ const replaceFlag = '_replace_text_';
|
|
|
column.customRender = ({ text, record }) => {
|
|
column.customRender = ({ text, record }) => {
|
|
|
let value = text;
|
|
let value = text;
|
|
|
// 如果 dictCode 有值,就进行字典转换
|
|
// 如果 dictCode 有值,就进行字典转换
|
|
|
if (dictCode) {
|
|
if (dictCode) {
|
|
|
if (dictCode.startsWith(replaceFlag)) {
|
|
if (dictCode.startsWith(replaceFlag)) {
|
|
|
- let textFieldName = dictCode.replace(replaceFlag, '');
|
|
|
|
|
|
|
+ const textFieldName = dictCode.replace(replaceFlag, '');
|
|
|
value = record[textFieldName];
|
|
value = record[textFieldName];
|
|
|
} else {
|
|
} else {
|
|
|
value = filterMultiDictText(unref(dictOptions)[dictCode], text + '');
|
|
value = filterMultiDictText(unref(dictOptions)[dictCode], text + '');
|
|
@@ -451,7 +451,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
}
|
|
}
|
|
|
// 如果 hrefSlotName 有值,就生成一个 a 标签,包裹住字典替换后(或原生)的值
|
|
// 如果 hrefSlotName 有值,就生成一个 a 标签,包裹住字典替换后(或原生)的值
|
|
|
if (hrefSlotName) {
|
|
if (hrefSlotName) {
|
|
|
- let field = fieldHrefSlotKeysMap[hrefSlotName];
|
|
|
|
|
|
|
+ const field = fieldHrefSlotKeysMap[hrefSlotName];
|
|
|
if (field) {
|
|
if (field) {
|
|
|
return h(
|
|
return h(
|
|
|
'a',
|
|
'a',
|
|
@@ -475,21 +475,21 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
* @param columns
|
|
* @param columns
|
|
|
*/
|
|
*/
|
|
|
function handleGroupTitle(columns: OnlineColumn[]): OnlineColumn[] {
|
|
function handleGroupTitle(columns: OnlineColumn[]): OnlineColumn[] {
|
|
|
- let newColumns: OnlineColumn[] = [];
|
|
|
|
|
- for (let column of columns) {
|
|
|
|
|
|
|
+ const newColumns: OnlineColumn[] = [];
|
|
|
|
|
+ for (const column of columns) {
|
|
|
//排序字段受控 ---- 此逻辑为新增逻辑 待
|
|
//排序字段受控 ---- 此逻辑为新增逻辑 待
|
|
|
if (unref(iSorter) && column.dataIndex === unref(iSorter).column) {
|
|
if (unref(iSorter) && column.dataIndex === unref(iSorter).column) {
|
|
|
column.sortOrder = unref(iSorter).order === 'asc' ? 'ascend' : 'descend';
|
|
column.sortOrder = unref(iSorter).order === 'asc' ? 'ascend' : 'descend';
|
|
|
}
|
|
}
|
|
|
//判断字段是否需要合并表头
|
|
//判断字段是否需要合并表头
|
|
|
if (column.groupTitle) {
|
|
if (column.groupTitle) {
|
|
|
- let clIndex = newColumns.findIndex((im) => im.title === column.groupTitle);
|
|
|
|
|
|
|
+ const clIndex = newColumns.findIndex((im) => im.title === column.groupTitle);
|
|
|
if (clIndex !== -1) {
|
|
if (clIndex !== -1) {
|
|
|
//表头已存在直接push children
|
|
//表头已存在直接push children
|
|
|
newColumns[clIndex].children!.push(column);
|
|
newColumns[clIndex].children!.push(column);
|
|
|
} else {
|
|
} else {
|
|
|
//表头不存在组装表头信息
|
|
//表头不存在组装表头信息
|
|
|
- let clGroup: OnlineColumn = {},
|
|
|
|
|
|
|
+ const clGroup: OnlineColumn = {},
|
|
|
child: OnlineColumn[] = [];
|
|
child: OnlineColumn[] = [];
|
|
|
child.push(column);
|
|
child.push(column);
|
|
|
clGroup.title = column.groupTitle;
|
|
clGroup.title = column.groupTitle;
|
|
@@ -505,7 +505,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取路由器对象 href跳转用到
|
|
// 获取路由器对象 href跳转用到
|
|
|
- let router = useRouter();
|
|
|
|
|
|
|
+ const router = useRouter();
|
|
|
/**
|
|
/**
|
|
|
* href 点击事件
|
|
* href 点击事件
|
|
|
* @param field
|
|
* @param field
|
|
@@ -513,9 +513,9 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
*/
|
|
*/
|
|
|
function handleClickFieldHref(field, record) {
|
|
function handleClickFieldHref(field, record) {
|
|
|
let href = field.href;
|
|
let href = field.href;
|
|
|
- let urlPattern = /(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?/;
|
|
|
|
|
- let compPattern = /\.vue(\?.*)?$/;
|
|
|
|
|
- let jsPattern = /{{([^}]+)}}/g; // {{ xxx }}
|
|
|
|
|
|
|
+ const urlPattern = /(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?/;
|
|
|
|
|
+ const compPattern = /\.vue(\?.*)?$/;
|
|
|
|
|
+ const jsPattern = /{{([^}]+)}}/g; // {{ xxx }}
|
|
|
if (typeof href === 'string') {
|
|
if (typeof href === 'string') {
|
|
|
href = href.trim().replace(/\${([^}]+)?}/g, (s1, s2) => record[s2]);
|
|
href = href.trim().replace(/\${([^}]+)?}/g, (s1, s2) => record[s2]);
|
|
|
// 执行 {{...}} JS增强语句
|
|
// 执行 {{...}} JS增强语句
|
|
@@ -551,8 +551,8 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
*/
|
|
*/
|
|
|
function handleExport() {
|
|
function handleExport() {
|
|
|
const { handleExportXls } = useMethods();
|
|
const { handleExportXls } = useMethods();
|
|
|
- let url = `${configUrl.export}${cgRpConfigId.value}`;
|
|
|
|
|
- let params = getQueryParams(); //查询条件
|
|
|
|
|
|
|
+ const url = `${configUrl.export}${cgRpConfigId.value}`;
|
|
|
|
|
+ const params = getQueryParams(); //查询条件
|
|
|
// 【VUEN-1568】如果选中了某些行,就只导出选中的行
|
|
// 【VUEN-1568】如果选中了某些行,就只导出选中的行
|
|
|
let keys = unref(checkedKeys);
|
|
let keys = unref(checkedKeys);
|
|
|
if (keys.length > 0) {
|
|
if (keys.length > 0) {
|
|
@@ -593,9 +593,9 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
*/
|
|
*/
|
|
|
function onShowTotal(total) {
|
|
function onShowTotal(total) {
|
|
|
// 重新根据是否有合计计算每页显示的数据
|
|
// 重新根据是否有合计计算每页显示的数据
|
|
|
- let start = (pagination.current - 1) * pagination.realPageSize + 1;
|
|
|
|
|
- let end = start + (pagination.isTotal ? dataSource.value.length - 1 : dataSource.value.length) - 1;
|
|
|
|
|
- let realTotal = pagination.isTotal ? pagination.realTotal : total;
|
|
|
|
|
|
|
+ const start = (pagination.current - 1) * pagination.realPageSize + 1;
|
|
|
|
|
+ const end = start + (pagination.isTotal ? dataSource.value.length - 1 : dataSource.value.length) - 1;
|
|
|
|
|
+ const realTotal = pagination.isTotal ? pagination.realTotal : total;
|
|
|
return start + '-' + end + ' 共' + realTotal + '条';
|
|
return start + '-' + end + ' 共' + realTotal + '条';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -612,9 +612,9 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
* @param data 数据结果集
|
|
* @param data 数据结果集
|
|
|
*/
|
|
*/
|
|
|
function initQueryInfo(data) {
|
|
function initQueryInfo(data) {
|
|
|
- let url = `${configUrl.getQueryInfo}${unref(cgRpConfigId)}`;
|
|
|
|
|
|
|
+ const url = `${configUrl.getQueryInfo}${unref(cgRpConfigId)}`;
|
|
|
//缓存key
|
|
//缓存key
|
|
|
- let groupIdKey = props.groupId ? `${props.groupId}${url}` : '';
|
|
|
|
|
|
|
+ const groupIdKey = props.groupId ? `${props.groupId}${url}` : '';
|
|
|
httpGroupRequest(() => defHttp.get({ url }, { isTransformResponse: false, successMessageMode: 'none' }), groupIdKey).then((res) => {
|
|
httpGroupRequest(() => defHttp.get({ url }, { isTransformResponse: false, successMessageMode: 'none' }), groupIdKey).then((res) => {
|
|
|
// console.log("获取查询条件", res);
|
|
// console.log("获取查询条件", res);
|
|
|
if (res.success) {
|
|
if (res.success) {
|
|
@@ -644,7 +644,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
if (arg == 1) {
|
|
if (arg == 1) {
|
|
|
pagination.current = 1;
|
|
pagination.current = 1;
|
|
|
}
|
|
}
|
|
|
- let params = getQueryParams(); //查询条件
|
|
|
|
|
|
|
+ const params = getQueryParams(); //查询条件
|
|
|
params['onlRepUrlParamStr'] = getUrlParamString();
|
|
params['onlRepUrlParamStr'] = getUrlParamString();
|
|
|
console.log('params', params);
|
|
console.log('params', params);
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
@@ -655,13 +655,13 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
url = url + query
|
|
url = url + query
|
|
|
}
|
|
}
|
|
|
//缓存key
|
|
//缓存key
|
|
|
- let groupIdKey = props.groupId ? `${props.groupId}${url}${JSON.stringify(params)}` : '';
|
|
|
|
|
|
|
+ const groupIdKey = props.groupId ? `${props.groupId}${url}${JSON.stringify(params)}` : '';
|
|
|
httpGroupRequest(() => defHttp.get({ url, params }, { isTransformResponse: false, successMessageMode: 'none' }), groupIdKey).then((res) => {
|
|
httpGroupRequest(() => defHttp.get({ url, params }, { isTransformResponse: false, successMessageMode: 'none' }), groupIdKey).then((res) => {
|
|
|
// 代码逻辑说明: 【TV360X-578】online报表SQL翻译,第二页不翻页数据
|
|
// 代码逻辑说明: 【TV360X-578】online报表SQL翻译,第二页不翻页数据
|
|
|
res.result.dictOptions && initDictOptionData(res.result.dictOptions);
|
|
res.result.dictOptions && initDictOptionData(res.result.dictOptions);
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
// 代码逻辑说明: 【TV360X-578】online报表SQL翻译,第二页不翻页数据
|
|
// 代码逻辑说明: 【TV360X-578】online报表SQL翻译,第二页不翻页数据
|
|
|
- let data = res.result.data;
|
|
|
|
|
|
|
+ const data = res.result.data;
|
|
|
console.log('表格信息:', data);
|
|
console.log('表格信息:', data);
|
|
|
setDataSource(data);
|
|
setDataSource(data);
|
|
|
});
|
|
});
|
|
@@ -671,8 +671,8 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
* 获取地址栏的参数
|
|
* 获取地址栏的参数
|
|
|
*/
|
|
*/
|
|
|
function getUrlParamString() {
|
|
function getUrlParamString() {
|
|
|
- let query = route.query;
|
|
|
|
|
- let arr:any[] = []
|
|
|
|
|
|
|
+ const query = route.query;
|
|
|
|
|
+ const arr:any[] = []
|
|
|
if(query && Object.keys(query).length>0){
|
|
if(query && Object.keys(query).length>0){
|
|
|
Object.keys(query).map(k=>{
|
|
Object.keys(query).map(k=>{
|
|
|
arr.push(`${k}=${query[k]}`)
|
|
arr.push(`${k}=${query[k]}`)
|
|
@@ -687,7 +687,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
function setDataSource(data) {
|
|
function setDataSource(data) {
|
|
|
if (data) {
|
|
if (data) {
|
|
|
pagination.total = Number(data.total);
|
|
pagination.total = Number(data.total);
|
|
|
- let currentPage = pagination?.current ?? 1;
|
|
|
|
|
|
|
+ const currentPage = pagination?.current ?? 1;
|
|
|
for (let a = 0; a < data.records.length; a++) {
|
|
for (let a = 0; a < data.records.length; a++) {
|
|
|
if (!data.records[a].rowIndex) {
|
|
if (!data.records[a].rowIndex) {
|
|
|
data.records[a].rowIndex = a + (currentPage - 1) * 10;
|
|
data.records[a].rowIndex = a + (currentPage - 1) * 10;
|
|
@@ -710,14 +710,14 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
* 获取查询参数
|
|
* 获取查询参数
|
|
|
*/
|
|
*/
|
|
|
function getQueryParams() {
|
|
function getQueryParams() {
|
|
|
- let paramTarget = {};
|
|
|
|
|
|
|
+ const paramTarget = {};
|
|
|
if (unref(dynamicParam)) {
|
|
if (unref(dynamicParam)) {
|
|
|
//处理自定义参数
|
|
//处理自定义参数
|
|
|
Object.keys(unref(dynamicParam)).map((key) => {
|
|
Object.keys(unref(dynamicParam)).map((key) => {
|
|
|
paramTarget['self_' + key] = unref(dynamicParam)[key];
|
|
paramTarget['self_' + key] = unref(dynamicParam)[key];
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- let param = Object.assign(paramTarget, unref(queryParam), unref(iSorter));
|
|
|
|
|
|
|
+ const param = Object.assign(paramTarget, unref(queryParam), unref(iSorter));
|
|
|
param.pageNo = pagination.current;
|
|
param.pageNo = pagination.current;
|
|
|
// 合计逻辑 [待优化 3.0]
|
|
// 合计逻辑 [待优化 3.0]
|
|
|
// 实际查询时不使用table组件的pageSize,而使用自定义的realPageSize,realPageSize会在第一次获取到数据后变化
|
|
// 实际查询时不使用table组件的pageSize,而使用自定义的realPageSize,realPageSize会在第一次获取到数据后变化
|
|
@@ -731,8 +731,8 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
function dynamicParamHandler(arr?) {
|
|
function dynamicParamHandler(arr?) {
|
|
|
if (arr && arr.length > 0) {
|
|
if (arr && arr.length > 0) {
|
|
|
//第一次加载查询条件前 初始化queryParam为空对象
|
|
//第一次加载查询条件前 初始化queryParam为空对象
|
|
|
- let queryTemp = {};
|
|
|
|
|
- for (let item of arr) {
|
|
|
|
|
|
|
+ const queryTemp = {};
|
|
|
|
|
+ for (const item of arr) {
|
|
|
if (item.mode === 'single') {
|
|
if (item.mode === 'single') {
|
|
|
queryTemp[item.field] = '';
|
|
queryTemp[item.field] = '';
|
|
|
}
|
|
}
|
|
@@ -744,7 +744,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
queryParam.value = Object.assign(queryParam.value, props.routeQuery);
|
|
queryParam.value = Object.assign(queryParam.value, props.routeQuery);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- let dynamicTemp = {};
|
|
|
|
|
|
|
+ const dynamicTemp = {};
|
|
|
if (props.param) {
|
|
if (props.param) {
|
|
|
Object.keys(props.param).map((key) => {
|
|
Object.keys(props.param).map((key) => {
|
|
|
let str = props.param[key];
|
|
let str = props.param[key];
|
|
@@ -799,9 +799,9 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
selectRows.value = [];
|
|
selectRows.value = [];
|
|
|
checkedKeys.value = [];
|
|
checkedKeys.value = [];
|
|
|
}
|
|
}
|
|
|
- let rowKey = combineRowKey(record);
|
|
|
|
|
|
|
+ const rowKey = combineRowKey(record);
|
|
|
if (!unref(checkedKeys) || unref(checkedKeys).length == 0) {
|
|
if (!unref(checkedKeys) || unref(checkedKeys).length == 0) {
|
|
|
- let arr1: any[] = [],
|
|
|
|
|
|
|
+ const arr1: any[] = [],
|
|
|
arr2: any[] = [];
|
|
arr2: any[] = [];
|
|
|
arr1.push(record);
|
|
arr1.push(record);
|
|
|
arr2.push(rowKey);
|
|
arr2.push(rowKey);
|
|
@@ -814,7 +814,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
//selectRows.value.push(record);
|
|
//selectRows.value.push(record);
|
|
|
} else {
|
|
} else {
|
|
|
//已选中就取消
|
|
//已选中就取消
|
|
|
- let rowKey_index = unref(checkedKeys).indexOf(rowKey);
|
|
|
|
|
|
|
+ const rowKey_index = unref(checkedKeys).indexOf(rowKey);
|
|
|
checkedKeys.value.splice(rowKey_index, 1);
|
|
checkedKeys.value.splice(rowKey_index, 1);
|
|
|
//selectRows.value.splice(rowKey_index, 1);
|
|
//selectRows.value.splice(rowKey_index, 1);
|
|
|
}
|
|
}
|
|
@@ -826,7 +826,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
|
|
|
|
|
//防止字典中有垃圾数据
|
|
//防止字典中有垃圾数据
|
|
|
function initDictOptionData(arr) {
|
|
function initDictOptionData(arr) {
|
|
|
- let obj = {};
|
|
|
|
|
|
|
+ const obj = {};
|
|
|
Object.keys(arr).map((k) => {
|
|
Object.keys(arr).map((k) => {
|
|
|
obj[k] = arr[k].filter((item) => {
|
|
obj[k] = arr[k].filter((item) => {
|
|
|
return item != null;
|
|
return item != null;
|
|
@@ -845,7 +845,7 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- for (let key in obj) {
|
|
|
|
|
|
|
+ for (const key in obj) {
|
|
|
if (obj.hasOwnProperty(key) && (obj[key] == null || obj[key] == undefined || obj[key] === '')) {
|
|
if (obj.hasOwnProperty(key) && (obj[key] == null || obj[key] == undefined || obj[key] === '')) {
|
|
|
delete obj[key];
|
|
delete obj[key];
|
|
|
}
|
|
}
|
|
@@ -892,15 +892,15 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
// 超链点击事件--> 打开一个modal窗口
|
|
// 超链点击事件--> 打开一个modal窗口
|
|
|
function openHrefCompModal(href) {
|
|
function openHrefCompModal(href) {
|
|
|
// 解析 href 参数
|
|
// 解析 href 参数
|
|
|
- let index = href.indexOf('?');
|
|
|
|
|
|
|
+ const index = href.indexOf('?');
|
|
|
let path = href;
|
|
let path = href;
|
|
|
if (index !== -1) {
|
|
if (index !== -1) {
|
|
|
path = href.substring(0, index);
|
|
path = href.substring(0, index);
|
|
|
- let paramString = href.substring(index + 1, href.length);
|
|
|
|
|
- let paramArray = paramString.split('&');
|
|
|
|
|
- let params = {};
|
|
|
|
|
|
|
+ const paramString = href.substring(index + 1, href.length);
|
|
|
|
|
+ const paramArray = paramString.split('&');
|
|
|
|
|
+ const params = {};
|
|
|
paramArray.forEach((paramObject) => {
|
|
paramArray.forEach((paramObject) => {
|
|
|
- let paramItem = paramObject.split('=');
|
|
|
|
|
|
|
+ const paramItem = paramObject.split('=');
|
|
|
params[paramItem[0]] = paramItem[1];
|
|
params[paramItem[0]] = paramItem[1];
|
|
|
});
|
|
});
|
|
|
hrefComponent.value.params = params;
|
|
hrefComponent.value.params = params;
|
|
@@ -916,8 +916,8 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
* emit事件 获取选中的行数据
|
|
* emit事件 获取选中的行数据
|
|
|
*/
|
|
*/
|
|
|
function getOkSelectRows(): any[] {
|
|
function getOkSelectRows(): any[] {
|
|
|
- let arr = unref(selectRows);
|
|
|
|
|
- let selectedRowKeys = checkedKeys.value;
|
|
|
|
|
|
|
+ const arr = unref(selectRows);
|
|
|
|
|
+ const selectedRowKeys = checkedKeys.value;
|
|
|
console.log('arr', arr);
|
|
console.log('arr', arr);
|
|
|
if (!selectedRowKeys || selectedRowKeys.length <= 0) {
|
|
if (!selectedRowKeys || selectedRowKeys.length <= 0) {
|
|
|
return [];
|
|
return [];
|
|
@@ -925,10 +925,10 @@ export function usePopBiz(ob, tableRef?) {
|
|
|
if (!arr || arr.length <= 0) {
|
|
if (!arr || arr.length <= 0) {
|
|
|
return [];
|
|
return [];
|
|
|
}
|
|
}
|
|
|
- let rows: any = [];
|
|
|
|
|
- for (let key of selectedRowKeys) {
|
|
|
|
|
|
|
+ const rows: any = [];
|
|
|
|
|
+ for (const key of selectedRowKeys) {
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
- let combineKey = combineRowKey(arr[i]);
|
|
|
|
|
|
|
+ const combineKey = combineRowKey(arr[i]);
|
|
|
if (key === combineKey) {
|
|
if (key === combineKey) {
|
|
|
rows.push(toRaw(arr[i]));
|
|
rows.push(toRaw(arr[i]));
|
|
|
break;
|
|
break;
|