|
|
@@ -69,7 +69,7 @@ export function useListPage(options: ListPageOptions) {
|
|
|
if (realUrl) {
|
|
|
const title = typeof name === 'function' ? name() : name;
|
|
|
// 代码逻辑说明: erp代码生成 子表 导出报错,原因未知-
|
|
|
- let paramsForm:any = {};
|
|
|
+ let paramsForm: any = {};
|
|
|
try {
|
|
|
//当useSearchFor不等于false的时候,才去触发validate
|
|
|
if (options?.tableProps?.useSearchForm !== false) {
|
|
|
@@ -81,8 +81,8 @@ export function useListPage(options: ListPageOptions) {
|
|
|
}
|
|
|
|
|
|
// 代码逻辑说明: [/issues/409]导出功能没有按排序结果导出,设置导出默认排序,创建时间倒序
|
|
|
- if(!paramsForm?.column){
|
|
|
- Object.assign(paramsForm,{column:'createTime',order:'desc'});
|
|
|
+ if (!paramsForm?.column) {
|
|
|
+ Object.assign(paramsForm, { column: 'createTime', order: 'desc' });
|
|
|
}
|
|
|
|
|
|
//如果参数不为空,则整合到一起
|
|
|
@@ -102,13 +102,13 @@ export function useListPage(options: ListPageOptions) {
|
|
|
}
|
|
|
|
|
|
//是否显示表格设置
|
|
|
- if(options?.tableProps?.showTableSetting !== false){
|
|
|
+ if (options?.tableProps?.showTableSetting !== false) {
|
|
|
//是否显示配置字段
|
|
|
- if(options?.tableProps?.tableSetting?.setting !== false){
|
|
|
- await exportColumns(paramsForm)
|
|
|
+ if (options?.tableProps?.tableSetting?.setting !== false) {
|
|
|
+ await exportColumns(paramsForm);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return handleExportXls(title as string, realUrl, filterObj(paramsForm));
|
|
|
} else {
|
|
|
$message.createMessage.warn('没有传递 exportConfig.url 参数');
|
|
|
@@ -118,30 +118,30 @@ export function useListPage(options: ListPageOptions) {
|
|
|
|
|
|
/**
|
|
|
* 设置导出的列
|
|
|
- *
|
|
|
+ *
|
|
|
* @param paramsForm
|
|
|
*/
|
|
|
async function exportColumns(paramsForm: any) {
|
|
|
//获取表格的列
|
|
|
const columns = getColumns();
|
|
|
- if(columns && columns.length >0){
|
|
|
+ if (columns && columns.length > 0) {
|
|
|
//需要导出的字段
|
|
|
- const exportFields:any = [];
|
|
|
+ const exportFields: any = [];
|
|
|
//是否有隐藏列
|
|
|
let hiddenColumns = false;
|
|
|
for (const column of columns) {
|
|
|
- if(!column.defaultHidden){
|
|
|
+ if (!column.defaultHidden) {
|
|
|
let dataIndex = column?.dataIndex;
|
|
|
- if(column?.dataIndex!.toString().indexOf('_dictText')){
|
|
|
- dataIndex = column?.dataIndex!.toString().replace('_dictText','')
|
|
|
+ if (column?.dataIndex!.toString().indexOf('_dictText')) {
|
|
|
+ dataIndex = column?.dataIndex!.toString().replace('_dictText', '');
|
|
|
}
|
|
|
exportFields.push(dataIndex);
|
|
|
} else {
|
|
|
hiddenColumns = true;
|
|
|
}
|
|
|
}
|
|
|
- if(hiddenColumns){
|
|
|
- paramsForm['exportFields'] = exportFields.join(",");
|
|
|
+ if (hiddenColumns) {
|
|
|
+ paramsForm['exportFields'] = exportFields.join(',');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -233,7 +233,7 @@ export function useListTable(tableProps: TableProps): [
|
|
|
rowSelection: any;
|
|
|
selectedRows: Ref<Recordable[]>;
|
|
|
selectedRowKeys: Ref<any[]>;
|
|
|
- }
|
|
|
+ },
|
|
|
] {
|
|
|
// 自适应列配置
|
|
|
const adaptiveColProps: Partial<ColEx> = {
|
|
|
@@ -272,17 +272,17 @@ export function useListTable(tableProps: TableProps): [
|
|
|
},
|
|
|
wrapperCol: {},
|
|
|
// 是否显示 展开/收起 按钮
|
|
|
- showAdvancedButton: true,
|
|
|
+ showAdvancedButton: false,
|
|
|
// 超过指定列数默认折叠
|
|
|
autoAdvancedCol: 3,
|
|
|
// 操作按钮配置
|
|
|
actionColOptions: {
|
|
|
...adaptiveColProps,
|
|
|
- style: { textAlign: 'left' },
|
|
|
+ style: { textAlign: 'right' },
|
|
|
},
|
|
|
},
|
|
|
// 斑马纹
|
|
|
- striped: false,
|
|
|
+ striped: true,
|
|
|
// 是否可以自适应高度
|
|
|
canResize: true,
|
|
|
// 表格最小高度
|
|
|
@@ -296,7 +296,7 @@ export function useListTable(tableProps: TableProps): [
|
|
|
// 是否显示序号列
|
|
|
showIndexColumn: false,
|
|
|
// 显示表格设置
|
|
|
- showTableSetting: true,
|
|
|
+ showTableSetting: false,
|
|
|
// 表格全屏设置
|
|
|
tableSetting: {
|
|
|
fullScreen: false,
|
|
|
@@ -316,7 +316,7 @@ export function useListTable(tableProps: TableProps): [
|
|
|
// 合并用户个性化配置
|
|
|
if (tableProps) {
|
|
|
// 代码逻辑说明: 【issues/6180】前端代码配置表变查询条件显示列不生效---
|
|
|
- if(tableProps.formConfig){
|
|
|
+ if (tableProps.formConfig) {
|
|
|
setTableProps(tableProps.formConfig);
|
|
|
}
|
|
|
// merge 方法可深度合并对象
|
|
|
@@ -370,11 +370,11 @@ export function useListTable(tableProps: TableProps): [
|
|
|
* @param formConfig
|
|
|
*/
|
|
|
function setTableProps(formConfig: any) {
|
|
|
- const replaceAttributeArray: string[] = ['baseColProps','labelCol'];
|
|
|
+ const replaceAttributeArray: string[] = ['baseColProps', 'labelCol'];
|
|
|
for (const item of replaceAttributeArray) {
|
|
|
- if(formConfig && formConfig[item]){
|
|
|
- if(defaultTableProps.formConfig){
|
|
|
- const defaultFormConfig:any = defaultTableProps.formConfig;
|
|
|
+ if (formConfig && formConfig[item]) {
|
|
|
+ if (defaultTableProps.formConfig) {
|
|
|
+ const defaultFormConfig: any = defaultTableProps.formConfig;
|
|
|
defaultFormConfig[item] = formConfig[item];
|
|
|
}
|
|
|
formConfig[item] = {};
|