sanmu
authored
|
1
|
<template>
|
sanmu
authored
|
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<BasicTable @register="registerTable" className="p-0">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'picUrl'">
<img
:width="50"
:height="50"
:src="record?.orderBaseInfo?.smallPicUrl"
@click="handlePreview(record?.orderBaseInfo?.picUrl)"
/>
</template>
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
label: '详情',
// icon: 'ic:outline-delete-outline',
onClick: handleDetail.bind(null, record),
},
]"
/>
|
sanmu
authored
|
22
|
</template>
|
sanmu
authored
|
23
24
25
26
|
</template>
</BasicTable>
<BasicDrawer
width="500"
|
sanmu
authored
|
27
|
:showFooter="!isApproved && (role === ROLE.ADMIN || role === ROLE.BUSINESS)"
|
sanmu
authored
|
28
29
30
31
32
33
|
@register="registerDrawer"
title="申请信息"
okText="通过"
@ok="handleTrue"
>
<BaseInfo :baseInfos="baseInfos" />
|
sanmu
authored
|
34
35
36
37
38
39
40
41
42
|
<template v-if="fieldInfos.auditRoleCodes.includes('business_user')">
<h2 className="mt-8">基本信息申请字段</h2>
<div>{{ fieldInfos.baseFields.join(' , ') }}</div>
</template>
<template v-if="!fieldInfos.auditRoleCodes.includes('business_user')">
<h2 className="mt-8">利润分析表申请字段</h2>
<div>
{{ fieldInfos.profitFields.join(' , ') }}
</div>
|
sanmu
authored
|
43
|
|
sanmu
authored
|
44
45
46
47
|
<h2 className="mt-8">项目报告书申请字段</h2>
<div>
<span>{{ fieldInfos.reportFields.join(' , ') }}</span>
</div>
|
sanmu
authored
|
48
|
|
sanmu
authored
|
49
50
51
52
|
<h2 className="mt-8">跟单信息申请字段</h2>
<div>
<span>{{ fieldInfos.trackStageFields.join(' , ') }}</span>
</div>
|
sanmu
authored
|
53
|
|
sanmu
authored
|
54
55
56
57
58
|
<h2 className="mt-8">质量检测申请字段</h2>
<div>
<span>{{ fieldInfos.inspectionStageFields.join(' , ') }}</span>
</div>
</template>
|
sanmu
authored
|
59
60
61
62
63
|
<template #appendFooter>
<a-button @click="handleFalse"> 不通过</a-button>
</template>
</BasicDrawer>
<MsgModal v-if="msgVisible" @msg-modal-close="handleMsgModalClose" />
|
sanmu
authored
|
64
65
|
</template>
<script lang="ts">
|
sanmu
authored
|
66
|
import MsgModal from './MsgModal.vue';
|
sanmu
authored
|
67
|
import { computed, defineComponent, ref } from 'vue';
|
sanmu
authored
|
68
69
70
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { BasicDrawer, useDrawer } from '/@/components/Drawer';
import { approveAuditApi, getApprovedListApi, getWaitListApi } from '/@/api/project/approve';
|
sanmu
authored
|
71
72
73
74
75
76
77
|
import {
FIELDS_BASE_INFO,
FIELDS_INSPECTION_INFO,
FIELDS_PROFIT_INFO,
FIELDS_REPORT_INFO,
FIELDS_TRACK_STAGE_INFO,
} from '../order/tableData';
|
sanmu
authored
|
78
|
import { find, isEmpty } from 'lodash-es';
|
sanmu
authored
|
79
80
81
|
import { ROLE } from '../order//type.d';
import { useUserStoreWithOut } from '/@/store/modules/user';
import BaseInfo from './BaseInfo.vue';
|
sanmu
authored
|
82
|
import { createImgPreview } from '/@/components/Preview';
|
sanmu
authored
|
83
|
import { getFormConfig } from './data';
|
sanmu
authored
|
84
85
|
const userStore = useUserStoreWithOut();
|
sanmu
authored
|
86
87
88
89
90
91
|
export default defineComponent({
components: {
BasicTable,
BasicDrawer,
TableAction,
|
sanmu
authored
|
92
|
BaseInfo,
|
sanmu
authored
|
93
|
MsgModal,
|
sanmu
authored
|
94
95
96
97
98
|
},
props: {
isApproved: { type: Boolean },
},
setup(props) {
|
sanmu
authored
|
99
100
101
|
// visible 用于msgModal显示隐藏
const msgVisible = ref(false);
|
sanmu
authored
|
102
103
104
105
|
const checkedKeys = ref<Array<string | number>>([]);
const currentKey = ref('1');
const [registerDrawer, { openDrawer, closeDrawer }] = useDrawer();
const fieldInfos = ref({
|
sanmu
authored
|
106
|
auditRoleCodes: 'business_user',
|
sanmu
authored
|
107
108
109
|
baseFields: [],
reportFields: [],
profitFields: [],
|
sanmu
authored
|
110
111
|
inspectionStageFields: [],
trackStageFields: [],
|
sanmu
authored
|
112
113
114
115
|
});
const baseInfos = ref({});
const id = ref('');
|
sanmu
authored
|
116
117
118
119
120
121
|
let columns = [
{
title: '申请人',
dataIndex: 'createBy',
width: 150,
},
|
sanmu
authored
|
122
|
{
|
sanmu
authored
|
123
124
125
126
127
128
129
130
131
|
title: '审核字段类型',
dataIndex: 'auditRoleCodes',
width: 150,
customRender: (column) => {
const { record } = column || {};
return record?.auditRoleCodes.includes('business_user') ? '基本信息' : '其他模块';
},
},
{
|
sanmu
authored
|
132
133
134
135
136
137
138
139
|
title: '内部编号',
dataIndex: 'innerNo',
width: 150,
customRender: (column) => {
const { record } = column || {};
return record?.orderBaseInfo?.innerNo;
},
},
|
sanmu
authored
|
140
|
|
sanmu
authored
|
141
142
143
144
145
|
{
title: '图片',
dataIndex: 'picUrl',
width: 150,
},
|
柏杨
authored
|
146
147
148
149
150
|
{
title: '申请原因',
dataIndex: 'applyRemark',
width: 150,
},
|
sanmu
authored
|
151
|
];
|
sanmu
authored
|
152
|
|
sanmu
authored
|
153
154
|
if (props.isApproved) {
columns = columns.concat([
|
sanmu
authored
|
155
|
{
|
sanmu
authored
|
156
157
|
title: '状态',
dataIndex: 'status',
|
sanmu
authored
|
158
|
width: 150,
|
sanmu
authored
|
159
160
161
162
163
|
customRender: (column) => {
const { record } = column || {};
return record.status === 10 ? '通过' : '拒绝';
},
|
sanmu
authored
|
164
|
},
|
sanmu
authored
|
165
166
167
168
|
{ title: '拒绝原因', dataIndex: 'refuseRemark', width: 250 },
]);
}
const [registerTable, { reload }] = useTable({
|
sanmu
authored
|
169
|
scroll: false,
|
sanmu
authored
|
170
171
172
|
api: props.isApproved ? getApprovedListApi : getWaitListApi,
searchInfo: { type: 0 },
columns,
|
sanmu
authored
|
173
|
useSearchForm: true,
|
sanmu
authored
|
174
|
formConfig: getFormConfig(true),
|
sanmu
authored
|
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
rowKey: 'id',
actionColumn: {
width: 160,
title: 'Action',
dataIndex: 'action',
// slots: { customRender: 'action' },
},
});
function onSelect(record, selected) {
if (selected) {
checkedKeys.value = [...checkedKeys.value, record.id];
} else {
checkedKeys.value = checkedKeys.value.filter((id) => id !== record.id);
}
}
function onSelectAll(selected, selectedRows, changeRows) {
const changeIds = changeRows.map((item) => item.id);
if (selected) {
checkedKeys.value = [...checkedKeys.value, ...changeIds];
} else {
checkedKeys.value = checkedKeys.value.filter((id) => {
return !changeIds.includes(id);
});
}
}
function handleEdit(record, e) {
e?.stopPropagation();
return false;
}
function handleProfitModal() {}
async function handleDetail(data) {
fieldInfos.value = {
|
sanmu
authored
|
210
|
auditRoleCodes: data.auditRoleCodes,
|
sanmu
authored
|
211
212
213
|
baseFields: [],
reportFields: [],
profitFields: [],
|
sanmu
authored
|
214
215
|
inspectionStageFields: [],
trackStageFields: [],
|
sanmu
authored
|
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
};
openDrawer(true, { data });
!isEmpty(data.fieldInfos.baseFields) &&
Object.entries(data.fieldInfos.baseFields)?.map(([key, value]) => {
if (value === 'UN_LOCKED') {
const obj = find(FIELDS_BASE_INFO, { field: key });
fieldInfos.value.baseFields.push(obj?.label);
}
});
!isEmpty(data.fieldInfos.reportFields) &&
Object.entries(data.fieldInfos.reportFields).map(([key, value]) => {
if (value === 'UN_LOCKED') {
const obj = find(FIELDS_REPORT_INFO, { field: key });
fieldInfos.value.reportFields.push(obj?.label);
}
});
!isEmpty(data.fieldInfos.profitAnalysisFields) &&
Object.entries(data.fieldInfos.profitAnalysisFields).map(([key, value]) => {
if (value === 'UN_LOCKED') {
const obj = find(FIELDS_PROFIT_INFO, { field: key });
fieldInfos.value.profitFields.push(obj?.label);
}
});
|
sanmu
authored
|
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
!isEmpty(data.fieldInfos.trackStageFields) &&
Object.entries(data.fieldInfos.trackStageFields).map(([key, value]) => {
if (value === 'UN_LOCKED') {
const obj = find(FIELDS_TRACK_STAGE_INFO, { field: key });
fieldInfos.value.trackStageFields.push(obj?.label);
}
});
!isEmpty(data.fieldInfos.inspectionStageFields) &&
Object.entries(data.fieldInfos.inspectionStageFields).map(([key, value]) => {
if (value === 'UN_LOCKED') {
const obj = find(FIELDS_INSPECTION_INFO, { field: key });
fieldInfos.value.inspectionStageFields.push(obj?.label);
}
});
|
sanmu
authored
|
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
|
id.value = data.id;
baseInfos.value = FIELDS_BASE_INFO.map((field) => {
return {
label: field.label,
value: data.orderBaseInfo[field.field],
};
}).filter((item) => !!item.value);
}
async function handleTrue() {
await approveAuditApi({ status: 10, id: id.value });
reload();
closeDrawer();
}
async function handleFalse() {
|
sanmu
authored
|
273
|
msgVisible.value = true;
|
sanmu
authored
|
274
|
}
|
sanmu
authored
|
275
276
277
278
|
const role = computed(() => {
return userStore.getUserInfo?.roleSmallVO?.code;
});
|
sanmu
authored
|
279
280
281
282
283
284
285
286
287
288
289
|
// 定义MsgModalClose的事件,方便子组件调用
const handleMsgModalClose = async (data) => {
if (data) {
await approveAuditApi({ status: 20, id: id.value, refuseRemark: data });
reload();
closeDrawer();
}
msgVisible.value = false;
};
|
sanmu
authored
|
290
291
292
293
294
|
const handlePreview = (url) => {
createImgPreview({ imageList: [url], defaultWidth: 500 });
return false;
};
|
sanmu
authored
|
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
return {
handleProfitModal,
registerTable,
checkedKeys,
currentKey,
onSelect,
handleEdit,
onSelectAll,
handleDetail,
registerDrawer,
fieldInfos,
baseInfos,
handleTrue,
handleFalse,
|
sanmu
authored
|
309
310
|
ROLE,
role,
|
sanmu
authored
|
311
312
|
msgVisible,
handleMsgModalClose,
|
sanmu
authored
|
313
|
handlePreview,
|
sanmu
authored
|
314
315
316
317
|
};
},
});
</script>
|