quest.data.tsx
4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import { BasicColumn, FormSchema } from '/@/components/Table';
import { useUserStoreWithOut } from '/@/store/modules/user';
import { ROLE } from '../order/type.d';
import { computed } from 'vue';
const userStore = useUserStoreWithOut();
const user=userStore.getUserInfo;
// 基础列定义(包含所有可能的列)
const baseColumns: BasicColumn[] = [
{
title: '标题',
dataIndex: 'title',
key: 'title',
width: 350, // 减小宽度
customHeaderCell: () => ({ style: { color: 'red' ,fontSize:'16px'} }), // 让表头变红
},
{
title: '问题类型',
dataIndex: 'questType',
key: 'questType',
width: 150, // 设置适当宽度
customHeaderCell: () => ({ style: { color: 'red', fontSize:'16px' } }), // 让表头变红
customRender: ({ text, record }) => {
// 正常显示财务专用信息
if (record.deductAmount > 0 && record.deductAmount !== undefined) {
// 根据isRmb字段决定显示$还是¥
const currencySymbol = record.isRmb === '1' ? '¥' : '$';
// 格式化金额为$xxx.xx或¥xxx.xx格式
const formattedAmount = typeof record.deductAmount === 'number'
? `${currencySymbol}${record.deductAmount.toFixed(2)}`
: `${currencySymbol}${Number(record.deductAmount).toFixed(2)}`;
return `${text}(${formattedAmount})`;
}
return text;
},
},
{
title: '内容',
dataIndex: 'contentText',
key: 'contentText',
width: 350, // 减小宽度
format: (text) => {
if (!text) return '';
const div = document.createElement('div');
div.innerHTML = text;
const plainText = div.textContent || div.innerText || '';
return plainText.length > 30 ? plainText.substring(0, 30) + '...' : plainText;
},
customHeaderCell: () => ({ style: { color: 'red',fontSize:'16px' } }), // 让表头变红
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
width: 100,
customRender: ({ text }) => {
if (text === 10) return '已解决';
if (text === 20) return '已驳回';
return '待审核';
},
},
{
title: '操作',
dataIndex: 'action',
width: 160,
key: 'action',
fixed: 'right', // 固定在右侧
},
];
const role=computed(() =>{
return user?.roleSmallVO?.code;
});
// 问题列表表格列定义(不包含状态列)
export const columns: BasicColumn[] = [
baseColumns[0], // 标题
baseColumns[1], // 问题类型
baseColumns[2], // 内容
baseColumns[4], // 操作
];
// 审核列表表格列定义(包含状态列)
export const reviewColumns: BasicColumn[] = [
baseColumns[0], // 标题
baseColumns[1], // 问题类型
baseColumns[2], // 内容
baseColumns[3], // 状态
{
title: '操作',
dataIndex: 'action',
width: 320, // 增加宽度以容纳更多按钮
key: 'action',
fixed: 'right', // 固定在右侧
},
];
// 表单配置
export const searchFormSchema: FormSchema[] = [
{
field: 'title',
label: '标题',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'contentText',
label: '内容关键字',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'questType',
label: '问题类型',
component: 'Input',
colProps: { span: 6 },
},
{
field: `createStartTime`,
label: `生成开始时间`,
component: 'DatePicker',
colProps: {
span: 6,
},
labelWidth: 150,
},
{
field: `createEndTime`,
label: `生成结束时间`,
component: 'DatePicker',
colProps: {
span: 6,
},
labelWidth: 150,
},
];
// 导出返回所有数据的方法
export const filterFinancialData = (dataList: any[]) => {
// const currentRole = user?.roleSmallVO?.code;
// console.log('角色'+currentRole);
// // 如果用户是管理员或财务,返回所有数据
// if (currentRole === ROLE.ADMIN || currentRole === ROLE.FINANCE) {
// return dataList;
// }
// 否则过滤掉财务专用的数据
// return dataList.filter(item => item.questType !== '财务专用');
return dataList
};