ProfitPanel.vue
4.87 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<template>
<PageWrapper contentBackground>
<BasicTable @register="registerTable">
<template #form-custom> custom-slot </template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
label: '详情',
// icon: 'ic:outline-delete-outline',
onClick: handleDetail.bind(null, record),
},
]"
/>
</template>
</template>
</BasicTable>
<BasicDrawer
:showFooter="!isApproved && role === ROLE.ADMIN"
@register="registerDrawer"
title="申请信息"
okText="通过"
@ok="handleTrue"
>
<BaseInfo :baseInfos="baseInfos" />
<h2>项目报告书信息</h2>
<div v-for="field in fieldInfos" :key="field">
<span className="w-[140px] inline-block text-right mr-3">{{ field.label }}:</span
><span>{{ field.value }}</span>
</div>
<template #appendFooter>
<a-button @click="handleFalse"> 不通过</a-button>
</template>
</BasicDrawer>
</PageWrapper>
</template>
<script lang="ts">
import { computed, defineComponent, ref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { PageWrapper } from '/@/components/Page';
import { BasicDrawer, useDrawer } from '/@/components/Drawer';
import { approveAuditApi, getApprovedListApi, getWaitListApi } from '/@/api/project/approve';
import { FIELDS_BASE_INFO, FIELDS_PROFIT_INFO, FIELDS_REPORT_INFO } from '../order/tableData';
import { ROLE } from '../order//type.d';
import { useUserStoreWithOut } from '/@/store/modules/user';
import BaseInfo from './BaseInfo.vue';
const userStore = useUserStoreWithOut();
export default defineComponent({
components: {
PageWrapper,
BasicTable,
BasicDrawer,
TableAction,
BaseInfo,
},
props: {
isApproved: { type: Boolean },
},
setup(props) {
const checkedKeys = ref<Array<string | number>>([]);
const currentKey = ref('1');
const [registerDrawer, { openDrawer, closeDrawer }] = useDrawer();
const fieldInfos = ref({});
const baseInfos = ref({});
const id = ref('');
const [registerTable, { reload }] = useTable({
api: props.isApproved ? getApprovedListApi : getWaitListApi,
searchInfo: { type: 10 },
columns: [
{
title: '申请人',
dataIndex: 'createBy',
width: 150,
},
],
// useSearchForm: true,
// formConfig: getFormConfig(),
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) {
openDrawer(true, { data });
id.value = data.id;
fieldInfos.value = FIELDS_PROFIT_INFO.map((field) => {
return {
label: field.label,
value: data.fieldInfos.profitAnalysisFields[field.field],
};
}).filter((item) => !!item.value);
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() {
await approveAuditApi({ status: 20, id: id.value });
reload();
closeDrawer();
}
const role = computed(() => {
return userStore.getUserInfo?.roleSmallVO?.code;
});
return {
handleProfitModal,
registerTable,
checkedKeys,
currentKey,
onSelect,
handleEdit,
onSelectAll,
handleDetail,
registerDrawer,
fieldInfos,
baseInfos,
handleTrue,
handleFalse,
role,
ROLE,
};
},
});
</script>
../order/constant