sanmu
authored
|
1
|
<template>
|
sanmu
authored
|
2
|
<div class="order-page">
|
sanmu
authored
|
3
4
5
6
7
|
<BasicTable @register="registerTable" bordered>
<template #headerCell="{ column }">
<!-- <template v-if="column.key === 'address1'">
<span class="flex items-center justify-center"> 自定义字段列11 </span>
</template> -->
|
sanmu
authored
|
8
|
<template v-if="SELECT_FIELD_COLUMNS.includes(column.key) && role === ROLE.ADMIN">
|
sanmu
authored
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<span class="flex items-center justify-center">
{{ column.customTitle }}
<FormOutlined class="ml-2 cursor-pointer" @click="handleFieldVisible(column)" />
</span>
</template>
<template v-else>
<HeaderCell :column="column" />
</template>
</template>
<template #headerTop>
<a-alert type="info" show-icon>
<template #message>
<template v-if="checkedKeys.length > 0">
<span>已选中{{ checkedKeys.length }}条记录(可跨页)</span>
|
柏杨
authored
|
23
24
25
|
<a-button
:style="{ borderRadius: '5px 5px 5px 5px' }"
type="link"
|
柏杨
authored
|
26
|
@click="handleClearChoose"
|
柏杨
authored
|
27
28
29
|
size="small"
>清空</a-button
>
|
sanmu
authored
|
30
31
32
33
34
35
36
37
38
39
|
</template>
<template v-else>
<span>未选中任何订单</span>
</template>
</template>
</a-alert>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
|
柏杨
authored
|
40
|
:actions="
|
柏杨
authored
|
41
|
role !== ROLE.PRODUCE && role !== ROLE.FINANCE
|
柏杨
authored
|
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
|
? [
{
// 数据分析没有编辑权限
...(role !== ROLE.DATA_REPORT_USER && {
label: '编辑',
// icon: 'ic:outline-delete-outline',
onClick: handleEdit.bind(null, record),
}),
},
{
...(role !== ROLE.DATA_REPORT_USER && {
label: '申请权限',
// icon: 'ic:outline-delete-outline',
onClick: handleCheck.bind(null, record),
}),
},
// {
// ...(role !== ROLE.DATA_REPORT_USER && {
// label: '申请',
// // icon: 'ic:outline-delete-outline',
// onClick: handleCheck.bind(null, record),
// }),
// },
]
: []
"
|
sanmu
authored
|
68
|
:dropDownActions="
|
柏杨
authored
|
69
|
role !== ROLE.DATA_REPORT_USER && role !== ROLE.PRODUCE
|
sanmu
authored
|
70
71
72
73
74
|
? [
{
label: '历史记录',
onClick: handleHistory.bind(null, record),
},
|
|
75
|
{
|
柏杨
authored
|
76
|
label: '跟单结果记录',
|
柏杨
authored
|
77
|
onClick: handleTrackHistory.bind(null, record),
|
柏杨
authored
|
78
79
|
},
{
|
sanmu
authored
|
80
|
// 数据分析没有编辑权限
|
柏杨
authored
|
81
82
83
|
...((role === ROLE.ADMIN ||
role === ROLE.TRACKER ||
role === ROLE.FINANCE) && {
|
sanmu
authored
|
84
85
86
87
88
89
|
label: '复制',
// icon: 'ic:outline-delete-outline',
onClick: handleCopy.bind(null, record),
}),
},
{
|
|
90
91
92
93
94
95
96
97
98
|
...(role === ROLE.ADMIN && {
label: '删除',
popConfirm: {
title: '是否确认删除',
placement: 'left',
confirm: handleDelete.bind(null, record?.id),
},
}),
},
|
sanmu
authored
|
99
100
101
|
]
: []
"
|
sanmu
authored
|
102
103
104
105
106
107
|
/>
</template>
<template v-if="column.key === 'picUrl'">
<img
:width="100"
:height="100"
|
sanmu
authored
|
108
109
|
:src="record.smallPicUrl"
:key="record.smallPicUrl"
|
sanmu
authored
|
110
111
112
113
114
115
|
@click="handlePreview(record.picUrl)"
/>
</template>
</template>
<template #toolbar>
|
柏杨
authored
|
116
117
118
119
120
|
<div style="position: relative">
<div style="padding-left: 50px; right: 123px">
<!-- <a-space wrap :size="[8, 16]" :style="{ marginBottom: '2px', marginLeft: '10px' }"> -->
<a-space wrap :style="{ marginBottom: '2px', marginTop: '2px' }">
<a-button
|
|
121
122
123
124
125
126
127
128
129
130
131
132
|
:style="{backgroundColor: '#ff69b4', borderColor: '#ff69b4', color: 'white',borderRadius: '5px 5px 5px 5px' }"
shape="default"
type="primary"
@click=" handleStatementModal"
v-if="
role === ROLE.ADMIN ||
role === ROLE.BUSINESS ||
role === ROLE.TRACKER
"
>LOACL对账单</a-button
>
<a-button
|
柏杨
authored
|
133
134
135
|
:style="{ borderRadius: '5px 5px 5px 5px' }"
type="primary"
@click="handleProductInvoiceModal"
|
|
136
137
138
139
140
141
|
v-if="
role === ROLE.ADMIN ||
role === ROLE.BUSINESS ||
role === ROLE.TRACKER ||
role === ROLE.FINANCE
"
|
柏杨
authored
|
142
|
>生产对账单创建</a-button
|
柏杨
authored
|
143
|
>
|
柏杨
authored
|
144
145
146
147
148
|
<a-button
:style="{ borderRadius: '5px 5px 5px 5px' }"
shape="default"
type="primary"
@click="handleInvoiceCreateModal"
|
|
149
150
151
152
153
154
|
v-if="
role === ROLE.ADMIN ||
role === ROLE.BUSINESS ||
role === ROLE.TRACKER ||
role === ROLE.FINANCE
"
|
柏杨
authored
|
155
|
>Invoice创建</a-button
|
柏杨
authored
|
156
|
>
|
柏杨
authored
|
157
158
159
160
161
162
163
|
<a-select
ref="select"
v-model:value="value1"
@change="handleChange"
class="passCalculate"
dropdown-class-name="dropdown-class"
v-if="role === ROLE.ADMIN || role === ROLE.TRACKER || role === ROLE.BUSINESS"
|
柏杨
authored
|
164
|
>
|
柏杨
authored
|
165
166
167
168
169
170
171
172
173
174
175
|
<a-select-option value1="一次通过率">一次通过率</a-select-option>
<a-select-option value="确认样品" @click="handlePassModal('确认意见')"
>确认样品</a-select-option
>
<a-select-option value="生产样品" @click="handlePassModal('生产样品')"
>生产样品</a-select-option
>
<a-select-option value="测试样品" @click="handlePassModal('测试样品')"
>测试样品</a-select-option
>
</a-select>
|
|
176
|
<!-- <a-button
|
柏杨
authored
|
177
178
179
|
:style="{ borderRadius: '5px 5px 5px 5px' }"
type="primary"
@click="handleProductProfitModal"
|
|
180
|
v-if="role === ROLE.ADMIN || role === ROLE.FINANCE"
|
柏杨
authored
|
181
|
>内部生产净利润分析</a-button
|
|
182
183
|
> -->
<!-- <a-button
|
柏杨
authored
|
184
185
186
|
:style="{ borderRadius: '5px 5px 5px 5px' }"
type="primary"
@click="handleServiceProfitModal"
|
|
187
|
v-if="role === ROLE.ADMIN || role === ROLE.FINANCE"
|
柏杨
authored
|
188
|
>业务/研发净利润分析</a-button
|
|
189
|
> -->
|
柏杨
authored
|
190
191
192
193
194
195
196
197
198
199
200
|
<a-button
:style="{ borderRadius: '5px 5px 5px 5px' }"
type="primary"
@click="handleProductModal"
v-if="role === ROLE.ADMIN || role === ROLE.TRACKER"
>生产指示书</a-button
>
<a-button
:style="{ borderRadius: '5px 5px 5px 5px' }"
type="primary"
@click="handleRateModal"
|
|
201
|
v-if="role === ROLE.ADMIN || role === ROLE.FINANCE"
|
柏杨
authored
|
202
203
204
205
206
207
208
209
210
211
|
>比重计算</a-button
>
<a-button
:style="{ borderRadius: '5px 5px 5px 5px' }"
type="primary"
@click="handleExportModal"
v-if="
role === ROLE.ADMIN ||
role === ROLE.TRACKER ||
role === ROLE.BUSINESS ||
|
|
212
213
|
role === ROLE.FINANCE ||
role === ROLE.INSPECT
|
柏杨
authored
|
214
215
216
217
218
219
220
|
"
>导出</a-button
>
<a-button
:style="{ borderRadius: '5px 5px 5px 5px' }"
type="primary"
@click="handleProfitModal"
|
|
221
|
v-if="role === ROLE.ADMIN || role === ROLE.BUSINESS || role === ROLE.FINANCE"
|
柏杨
authored
|
222
223
224
225
226
227
228
229
230
|
>分析利润</a-button
>
<a-button
:style="{ borderRadius: '5px 5px 5px 5px' }"
type="primary"
@click="handleAdd"
v-if="role === ROLE.ADMIN || role === ROLE.TRACKER"
>创建订单</a-button
></a-space
|
柏杨
authored
|
231
|
>
|
柏杨
authored
|
232
233
|
</div></div
>
|
sanmu
authored
|
234
235
236
237
238
239
240
|
</template>
</BasicTable>
<FormDetail
@register="formDetailRegister"
:onGoCheckDetail="handleGoCheckDetail"
@success="handleFormSuccess"
/>
|
柏杨
authored
|
241
242
243
244
245
|
<ProductText
@register="productModalRegister"
:role="role"
:customerCodes="selectedCustomCodes"
/>
|
|
246
247
248
249
250
|
<Statement
@register="statementModalRegister"
:role="role"
:customerCodes="selectedCustomCodes"
/>
|
|
251
|
<InvoiceCreate @register="invoiceCreateModalRegister" @success="handleFormSuccess" />
|
柏杨
authored
|
252
253
|
<ServiceProfit @register="serviceProfitModalRegister" />
<ProductProfit @register="productProfitModalRegister" />
|
|
254
|
<ProductInvoice @register="productInvoiceModalRegister" @success="handleFormSuccess" />
|
sanmu
authored
|
255
|
<ProfitAnalysis @register="profitModalRegister" />
|
sanmu
authored
|
256
|
<RateModal @register="rateModalRegister" />
|
|
257
|
<ExportModal @register="exportModalRegister" :role="role" :ids="checkedKeys" />
|
sanmu
authored
|
258
259
|
<CheckDetail @register="checkModalRegister" :onGoFormDetail="handleGoFormDetail" />
<HistoryDetail @register="historyDetailRegister" />
|
柏杨
authored
|
260
|
<TrackHistory @register="trackHistoryRegister" />
|
sanmu
authored
|
261
|
<FieldDetail @register="fieldDetailRegister" />
|
柏杨
authored
|
262
|
<PassCalculate @register="passModalRegister" />
|
sanmu
authored
|
263
264
265
|
</div>
</template>
<script lang="ts">
|
sanmu
authored
|
266
|
import { defineComponent, onMounted, ref, toRaw, computed } from 'vue';
|
sanmu
authored
|
267
268
269
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { FormOutlined } from '@ant-design/icons-vue';
import HeaderCell from '/@/components/Table/src/components/HeaderCell.vue';
|
|
270
|
import { Alert } from 'ant-design-vue'
|
sanmu
authored
|
271
272
273
|
import { useDrawer } from '/@/components/Drawer';
import ProfitAnalysis from './ProfitAnalysis.vue';
|
柏杨
authored
|
274
|
import ProductText from './ProductText.vue';
|
|
275
|
import Statement from './Statement.vue';
|
sanmu
authored
|
276
277
|
import RateModal from './RateModal.vue';
import ExportModal from './ExportModal.vue';
|
柏杨
authored
|
278
|
import PassCalculate from './PassCalculate.vue';
|
柏杨
authored
|
279
|
import InvoiceCreate from './InvoiceCreate.vue';
|
柏杨
authored
|
280
281
|
import ServiceProfit from './ServiceProfit.vue';
import ProductProfit from './ProductProfit.vue';
|
柏杨
authored
|
282
|
import ProductInvoice from './ProductInvoice.vue';
|
sanmu
authored
|
283
284
|
import { useModal } from '/@/components/Modal';
|
sanmu
authored
|
285
286
|
import { getFormConfig, getOrderColumns, SELECT_FIELD_COLUMNS } from './tableData';
import FormDetail from './FormDetail/index.vue';
|
sanmu
authored
|
287
288
|
import CheckDetail from './CheckDetail.vue';
import HistoryDetail from './HistoryDetail.vue';
|
柏杨
authored
|
289
|
import TrackHistory from './TrackHistory.vue';
|
sanmu
authored
|
290
291
|
import FieldDetail from './FieldDetail.vue';
import { createImgPreview } from '/@/components/Preview/index';
|
|
292
|
import { getOrderList, orderDelete } from '/@/api/project/order';
|
sanmu
authored
|
293
|
import { useOrderStoreWithOut } from '/@/store/modules/order';
|
sanmu
authored
|
294
|
import { useUserStoreWithOut } from '/@/store/modules/user';
|
sanmu
authored
|
295
|
import { ROLE } from './type.d';
|
sanmu
authored
|
296
|
import { getUserList } from '/@/api/project/account';
|
柏杨
authored
|
297
298
|
import { useMessage } from '/@/hooks/web/useMessage';
import { getBaseInvoice } from '/@/api/project/invoice';
|
sanmu
authored
|
299
300
|
const orderStore = useOrderStoreWithOut();
|
sanmu
authored
|
301
|
const userStore = useUserStoreWithOut();
|
sanmu
authored
|
302
303
304
305
306
307
308
309
310
|
export default defineComponent({
components: {
HeaderCell,
BasicTable,
AAlert: Alert,
TableAction,
FormDetail,
ProfitAnalysis,
|
柏杨
authored
|
311
|
ProductText,
|
|
312
|
Statement,
|
柏杨
authored
|
313
|
PassCalculate,
|
sanmu
authored
|
314
315
316
|
FormOutlined,
CheckDetail,
HistoryDetail,
|
柏杨
authored
|
317
|
TrackHistory,
|
sanmu
authored
|
318
|
FieldDetail,
|
sanmu
authored
|
319
|
RateModal,
|
柏杨
authored
|
320
|
InvoiceCreate,
|
柏杨
authored
|
321
|
ServiceProfit,
|
柏杨
authored
|
322
|
ProductInvoice,
|
柏杨
authored
|
323
|
ProductProfit,
|
sanmu
authored
|
324
|
ExportModal,
|
sanmu
authored
|
325
326
327
|
},
setup() {
const checkedKeys = ref<Array<string | number>>([]);
|
柏杨
authored
|
328
|
// const selectedCustomCodes = ref<Array<string>>([]);
|
sanmu
authored
|
329
|
const [profitModalRegister, { openModal: openProfitModal }] = useModal();
|
柏杨
authored
|
330
|
const [invoiceCreateModalRegister, { openModal: openInvoiceCreateModal }] = useModal();
|
柏杨
authored
|
331
332
|
const [serviceProfitModalRegister, { openModal: openServiceProfitModal }] = useModal();
const [productProfitModalRegister, { openModal: openProductProfitModal }] = useModal();
|
柏杨
authored
|
333
|
const [productInvoiceModalRegister, { openModal: openProductInvoiceModal }] = useModal();
|
sanmu
authored
|
334
335
|
const [rateModalRegister, { openModal: openRateModal }] = useModal();
const [exportModalRegister, { openModal: openExportModal }] = useModal();
|
柏杨
authored
|
336
|
const [productModalRegister, { openModal: openProductModal }] = useModal();
|
柏杨
authored
|
337
|
const [passModalRegister, { openModal: openPassModal }] = useModal();
|
|
338
|
const [statementModalRegister, { openModal: openStatementModal }] = useModal();
|
sanmu
authored
|
339
|
|
sanmu
authored
|
340
341
342
|
const tooltipVisible = ref(false);
const [formDetailRegister, { openDrawer: openFormDetailDrawer }] = useDrawer();
const [historyDetailRegister, { openDrawer: openHistoryDetailDrawer }] = useDrawer();
|
柏杨
authored
|
343
|
const [trackHistoryRegister, { openDrawer: openTrackHistoryDrawer }] = useDrawer();
|
sanmu
authored
|
344
345
|
const [fieldDetailRegister, { openDrawer: openFieldDetailDrawer }] = useDrawer();
|
sanmu
authored
|
346
|
const user = userStore.getUserInfo;
|
sanmu
authored
|
347
348
349
|
const role = computed(() => {
return user?.roleSmallVO?.code;
});
|
sanmu
authored
|
350
351
352
|
// 业务员列表
const businessUsers = ref([]);
|
sanmu
authored
|
353
354
355
356
357
|
const [checkModalRegister, { openDrawer: openCheckDetailDrawer }] = useDrawer();
onMounted(async () => {
await orderStore.getDict();
});
|
sanmu
authored
|
358
359
360
361
362
363
364
365
366
367
368
369
|
onMounted(async () => {
// 获取业务员
const res = await getUserList({ page: 1, pageSize: 1000 });
businessUsers.value = res.items
.filter((item) => item.roleCode === ROLE.BUSINESS)
.map((item) => ({ value: item.userName, label: item.userName }));
});
const formConfig = computed(() => {
return getFormConfig(businessUsers.value);
});
|
sanmu
authored
|
370
|
const [registerTable, { getForm, reload, getColumns }] = useTable({
|
sanmu
authored
|
371
372
373
374
375
|
api: getOrderList,
title: '订单列表',
pagination: {
total: 60,
},
|
柏杨
authored
|
376
|
clickToRowSelect: false,
|
sanmu
authored
|
377
|
columns: getOrderColumns(user?.roleSmallVO?.code),
|
sanmu
authored
|
378
|
useSearchForm: true,
|
sanmu
authored
|
379
|
formConfig: formConfig,
|
sanmu
authored
|
380
381
382
383
384
385
386
|
showTableSetting: true,
// tableSetting: { fullScreen: true },
showIndexColumn: false,
rowKey: 'id',
rowSelection: {
type: 'checkbox',
selectedRowKeys: checkedKeys,
|
sanmu
authored
|
387
388
|
onSelect,
onSelectAll,
|
sanmu
authored
|
389
|
},
|
柏杨
authored
|
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
|
// actionColumn: {
// width: 160,
// title: 'Action',
// dataIndex: 'action',
// // slots: { customRender: 'action' },
// },
actionColumn:
role.value !== ROLE.PRODUCE
? {
width: 160,
title: 'Action',
dataIndex: 'action',
// slots: { customRender: 'action' },
}
: undefined,
|
sanmu
authored
|
405
406
407
408
|
});
function getFormValues() {
console.log(getForm().getFieldsValue());
}
|
柏杨
authored
|
409
410
411
|
type CustomerCodeEntry = [string, number]; // 定义二维数组类型 [customerCode, count]
type ProductionDepartmentEntry = [string, number]; // 定义二维数组类型 [productionDepartment, count]
|
柏杨
authored
|
412
|
type ProjectNoEntry = [string, number]; // 定义二维数组类型 [innerNo, count]
|
柏杨
authored
|
413
|
type BusinessPersonEntry = [string, number]; // 定义二维数组类型 [businessPerson, count]
|
柏杨
authored
|
414
415
416
|
const selectedCustomCodes = ref<CustomerCodeEntry[]>([]); // 创建一个二维数组的 ref
const selectedProductionDepartment = ref<ProductionDepartmentEntry[]>([]); // 创建一个二维数组的 ref
|
柏杨
authored
|
417
|
const selectedProjectNos = ref<ProjectNoEntry[]>([]); // 创建一个二维数组的 ref
|
柏杨
authored
|
418
|
const selectedBusinessPersons = ref<BusinessPersonEntry[]>([]); // 创建一个二维数组的 ref
|
柏杨
authored
|
419
420
421
|
// 单选处理函数
function onSelect(
|
柏杨
authored
|
422
423
424
425
|
record: {
customerCode: string;
productionDepartment: string;
projectNo: string;
|
柏杨
authored
|
426
|
businessPerson: string; // 添加 businessPerson 属性
|
柏杨
authored
|
427
428
|
id: string;
},
|
柏杨
authored
|
429
430
431
432
433
434
435
436
437
438
|
selected: boolean,
) {
const customerCodeIndex = selectedCustomCodes.value.findIndex(
([customerCode]) => customerCode === record.customerCode,
);
const productionDepartmentIndex = selectedProductionDepartment.value.findIndex(
([department]) => department === record.productionDepartment,
);
|
柏杨
authored
|
439
440
441
442
|
const projectNoIndex = selectedProjectNos.value.findIndex(
([projectNo]) => projectNo === record.projectNo,
);
|
柏杨
authored
|
443
444
445
446
|
const businessPersonIndex = selectedBusinessPersons.value.findIndex(
([businessPerson]) => businessPerson === record.businessPerson,
);
|
sanmu
authored
|
447
448
|
if (selected) {
checkedKeys.value = [...checkedKeys.value, record.id];
|
柏杨
authored
|
449
450
451
452
453
454
455
456
457
458
459
460
461
462
|
// 更新 selectedCustomCodes
if (customerCodeIndex !== -1) {
selectedCustomCodes.value[customerCodeIndex][1] += 1;
} else {
selectedCustomCodes.value.push([record.customerCode, 1]);
}
// 更新 selectedProductionDepartment
if (productionDepartmentIndex !== -1) {
selectedProductionDepartment.value[productionDepartmentIndex][1] += 1;
} else {
selectedProductionDepartment.value.push([record.productionDepartment, 1]);
}
|
柏杨
authored
|
463
464
465
466
467
468
469
|
// 更新 selectedProjectNos
if (projectNoIndex !== -1) {
selectedProjectNos.value[projectNoIndex][1] += 1;
} else {
selectedProjectNos.value.push([record.projectNo, 1]);
}
|
柏杨
authored
|
470
471
472
473
474
475
476
|
// 更新 selectedBusinessPersons
if (businessPersonIndex !== -1) {
selectedBusinessPersons.value[businessPersonIndex][1] += 1;
} else {
selectedBusinessPersons.value.push([record.businessPerson, 1]);
}
|
sanmu
authored
|
477
478
|
} else {
checkedKeys.value = checkedKeys.value.filter((id) => id !== record.id);
|
柏杨
authored
|
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
|
// 更新 selectedCustomCodes
if (customerCodeIndex !== -1) {
if (selectedCustomCodes.value[customerCodeIndex][1] > 1) {
selectedCustomCodes.value[customerCodeIndex][1] -= 1;
} else {
selectedCustomCodes.value.splice(customerCodeIndex, 1);
}
}
// 更新 selectedProductionDepartment
if (productionDepartmentIndex !== -1) {
if (selectedProductionDepartment.value[productionDepartmentIndex][1] > 1) {
selectedProductionDepartment.value[productionDepartmentIndex][1] -= 1;
} else {
selectedProductionDepartment.value.splice(productionDepartmentIndex, 1);
}
}
|
柏杨
authored
|
497
498
499
500
501
502
503
504
505
|
// 更新 selectedProjectNos
if (projectNoIndex !== -1) {
if (selectedProjectNos.value[projectNoIndex][1] > 1) {
selectedProjectNos.value[projectNoIndex][1] -= 1;
} else {
selectedProjectNos.value.splice(projectNoIndex, 1);
}
}
|
柏杨
authored
|
506
507
508
509
510
511
512
513
514
|
// 更新 selectedBusinessPersons
if (businessPersonIndex !== -1) {
if (selectedBusinessPersons.value[businessPersonIndex][1] > 1) {
selectedBusinessPersons.value[businessPersonIndex][1] -= 1;
} else {
selectedBusinessPersons.value.splice(businessPersonIndex, 1);
}
}
|
sanmu
authored
|
515
|
}
|
柏杨
authored
|
516
|
|
|
517
518
519
520
521
|
// console.log('Checked Keys:', checkedKeys.value);
// console.log('Selected Customer Codes:', selectedCustomCodes.value);
// console.log('Selected Production Departments:', selectedProductionDepartment.value);
// console.log('Selected Project Nos:', selectedProjectNos.value);
// console.log('Selected Business Persons:', selectedBusinessPersons.value);
|
sanmu
authored
|
522
|
}
|
柏杨
authored
|
523
524
525
|
// 全选处理函数
function onSelectAll(selected: boolean, selectedRows: any[], changeRows: any[]) {
|
sanmu
authored
|
526
|
const changeIds = changeRows.map((item) => item.id);
|
柏杨
authored
|
527
|
const changeCustomerCodes = changeRows.map((item) => item.customerCode);
|
柏杨
authored
|
528
|
const changeProductionDepartments = changeRows.map((item) => item.productionDepartment);
|
柏杨
authored
|
529
|
const changeProjectNos = changeRows.map((item) => item.projectNo);
|
柏杨
authored
|
530
|
const changeBusinessPersons = changeRows.map((item) => item.businessPerson); // 新增处理 businessPerson
|
柏杨
authored
|
531
|
|
sanmu
authored
|
532
533
|
if (selected) {
checkedKeys.value = [...checkedKeys.value, ...changeIds];
|
柏杨
authored
|
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
|
// 更新 selectedCustomCodes
changeCustomerCodes.forEach((code) => {
const index = selectedCustomCodes.value.findIndex(
([customerCode]) => customerCode === code,
);
if (index !== -1) {
selectedCustomCodes.value[index][1] += 1;
} else {
selectedCustomCodes.value.push([code, 1]);
}
});
// 更新 selectedProductionDepartment
changeProductionDepartments.forEach((department) => {
const index = selectedProductionDepartment.value.findIndex(
([prodDepartment]) => prodDepartment === department,
);
if (index !== -1) {
selectedProductionDepartment.value[index][1] += 1;
} else {
selectedProductionDepartment.value.push([department, 1]);
}
});
|
柏杨
authored
|
558
559
560
561
562
563
564
565
566
567
|
// 更新 selectedProjectNos
changeProjectNos.forEach((projectNo) => {
const index = selectedProjectNos.value.findIndex(([no]) => no === projectNo);
if (index !== -1) {
selectedProjectNos.value[index][1] += 1;
} else {
selectedProjectNos.value.push([projectNo, 1]);
}
});
|
柏杨
authored
|
568
569
570
571
572
573
574
575
576
577
|
// 更新 selectedBusinessPersons
changeBusinessPersons.forEach((businessPerson) => {
const index = selectedBusinessPersons.value.findIndex(([bp]) => bp === businessPerson);
if (index !== -1) {
selectedBusinessPersons.value[index][1] += 1;
} else {
selectedBusinessPersons.value.push([businessPerson, 1]);
}
});
|
sanmu
authored
|
578
|
} else {
|
柏杨
authored
|
579
580
581
582
583
584
585
586
587
588
589
590
591
592
|
checkedKeys.value = checkedKeys.value.filter((id) => !changeIds.includes(id));
// 更新 selectedCustomCodes
changeCustomerCodes.forEach((code) => {
const index = selectedCustomCodes.value.findIndex(
([customerCode]) => customerCode === code,
);
if (index !== -1) {
if (selectedCustomCodes.value[index][1] > 1) {
selectedCustomCodes.value[index][1] -= 1;
} else {
selectedCustomCodes.value.splice(index, 1);
}
}
|
sanmu
authored
|
593
|
});
|
柏杨
authored
|
594
595
596
597
598
599
600
601
602
603
604
605
606
|
// 更新 selectedProductionDepartment
changeProductionDepartments.forEach((department) => {
const index = selectedProductionDepartment.value.findIndex(
([prodDepartment]) => prodDepartment === department,
);
if (index !== -1) {
if (selectedProductionDepartment.value[index][1] > 1) {
selectedProductionDepartment.value[index][1] -= 1;
} else {
selectedProductionDepartment.value.splice(index, 1);
}
}
|
柏杨
authored
|
607
|
});
|
柏杨
authored
|
608
609
|
// 更新 selectedProjectNos
|
柏杨
authored
|
610
|
changeProjectNos.forEach((projectNo) => {
|
柏杨
authored
|
611
612
613
614
615
616
617
618
619
|
const index = selectedProjectNos.value.findIndex(([no]) => no === projectNo);
if (index !== -1) {
if (selectedProjectNos.value[index][1] > 1) {
selectedProjectNos.value[index][1] -= 1;
} else {
selectedProjectNos.value.splice(index, 1);
}
}
});
|
柏杨
authored
|
620
621
622
623
624
625
626
627
628
629
630
631
|
// 更新 selectedBusinessPersons
changeBusinessPersons.forEach((businessPerson) => {
const index = selectedBusinessPersons.value.findIndex(([bp]) => bp === businessPerson);
if (index !== -1) {
if (selectedBusinessPersons.value[index][1] > 1) {
selectedBusinessPersons.value[index][1] -= 1;
} else {
selectedBusinessPersons.value.splice(index, 1);
}
}
});
|
sanmu
authored
|
632
|
}
|
柏杨
authored
|
633
|
|
|
634
635
636
637
638
|
// console.log('Checked Keys:', checkedKeys.value);
// console.log('Selected Customer Codes:', selectedCustomCodes.value);
// console.log('Selected Production Departments:', selectedProductionDepartment.value);
// console.log('Selected Project Nos:', selectedProjectNos.value);
// console.log('Selected Business Persons:', selectedBusinessPersons.value);
|
柏杨
authored
|
639
640
641
642
643
644
645
646
|
}
function handleClearChoose() {
checkedKeys.value = [];
selectedCustomCodes.value = [];
selectedProductionDepartment.value = [];
selectedProjectNos.value = [];
selectedBusinessPersons.value = [];
|
sanmu
authored
|
647
648
649
650
651
652
653
654
|
}
function handleEdit(record, e) {
openFormDetailDrawer(true, { ...toRaw(record) });
e?.stopPropagation();
return false;
}
|
sanmu
authored
|
655
656
657
658
659
660
|
function handleCopy(record, e) {
openFormDetailDrawer(true, { ...toRaw(record), id: undefined, isCopy: true });
e?.stopPropagation();
return false;
}
|
sanmu
authored
|
661
|
function handleAdd() {
|
sanmu
authored
|
662
|
openFormDetailDrawer(true, {});
|
sanmu
authored
|
663
664
665
666
667
668
669
670
671
672
673
674
675
676
|
}
function handleCheck(record, e) {
openCheckDetailDrawer(true, record);
e?.stopPropagation();
return false;
}
function handleHistory(record, e) {
openHistoryDetailDrawer(true, record);
e?.stopPropagation();
return false;
}
|
柏杨
authored
|
677
678
679
|
function handleTrackHistory(record, e) {
openTrackHistoryDrawer(true, record);
return false;
|
柏杨
authored
|
680
681
|
}
|
sanmu
authored
|
682
|
function handleProfitModal() {
|
sanmu
authored
|
683
684
|
const form = getForm();
const values = form.getFieldsValue();
|
sanmu
authored
|
685
686
|
openProfitModal(true, {
data: checkedKeys.value,
|
sanmu
authored
|
687
|
searchData: values,
|
sanmu
authored
|
688
689
690
|
});
}
|
柏杨
authored
|
691
|
function handleInvoiceCreateModal(record) {
|
柏杨
authored
|
692
693
|
const form = getForm();
const values = form.getFieldsValue();
|
柏杨
authored
|
694
695
696
697
698
699
700
701
|
if (checkedKeys.value.length == 0) {
error('请选择订单');
return;
}
if (selectedCustomCodes.value.length > 1) {
error('勾选订单的客户编码需一致');
return;
}
|
柏杨
authored
|
702
|
openInvoiceCreateModal(true, {
|
柏杨
authored
|
703
704
|
record: record,
customersCodes: selectedCustomCodes.value,
|
柏杨
authored
|
705
706
707
708
709
710
711
712
|
data: checkedKeys.value,
searchData: values,
});
}
function handleProductInvoiceModal() {
const form = getForm();
const values = form.getFieldsValue();
|
柏杨
authored
|
713
714
715
716
717
718
719
720
|
if (checkedKeys.value.length == 0) {
error('请选择订单');
return;
}
if (selectedProductionDepartment.value.length > 1) {
error('勾选订单的生产科需一致');
return;
}
|
柏杨
authored
|
721
722
723
724
725
726
|
openProductInvoiceModal(true, {
data: checkedKeys.value,
searchData: values,
});
}
|
柏杨
authored
|
727
728
729
730
731
732
|
//一次通过率
const value1 = ref('一次通过率');
function handleChange() {}
function handlePassModal(title) {
const form = getForm();
const values = form.getFieldsValue();
|
柏杨
authored
|
733
734
735
736
737
|
openPassModal(true, {
check: checkedKeys.value,
title: title,
searchData: values,
});
|
柏杨
authored
|
738
|
}
|
柏杨
authored
|
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
|
// const form = getForm();
// const values = form.getFieldsValue();
// if (title == '确认样品') {
// openPassModal(true, {
// check: checkedKeys.value,
// title: title,
// });
// return false;
// } else if (title == '生产样品') {
// openPassModal(true, {
// check: checkedKeys.value,
// title: title,
// });
// return false;
// } else if (title == '测试样品') {
// openPassModal(true, {
// check: checkedKeys.value,
// title: title,
// });
// return false;
// }
// }
const { createMessage } = useMessage();
const { error } = createMessage;
|
柏杨
authored
|
763
|
function handleProductModal(record) {
|
柏杨
authored
|
764
765
|
const form = getForm();
const values = form.getFieldsValue();
|
柏杨
authored
|
766
|
if (checkedKeys.value.length == 0) {
|
柏杨
authored
|
767
768
769
|
error('请选择订单');
return;
}
|
柏杨
authored
|
770
771
772
773
774
775
776
777
|
if (selectedCustomCodes.value.length > 1) {
error('客户编码需一致');
return;
}
if (selectedBusinessPersons.value.length > 1) {
error('业务员需一致');
return;
}
|
柏杨
authored
|
778
|
openProductModal(true, {
|
柏杨
authored
|
779
|
checkedKeys: checkedKeys.value,
|
柏杨
authored
|
780
|
customers: selectedCustomCodes.value,
|
柏杨
authored
|
781
782
783
|
data: values,
});
}
|
|
784
785
786
787
788
789
790
791
792
793
794
795
796
797
|
//对账单
function handleStatementModal(record) {
const form = getForm();
const values = form.getFieldsValue();
if (checkedKeys.value.length == 0) {
error('请选择订单');
return;
}
openStatementModal(true, {
checkedKeys: checkedKeys.value,
customers: selectedCustomCodes.value,
data: values,
});
}
|
柏杨
authored
|
798
|
|
sanmu
authored
|
799
800
801
802
803
804
805
806
807
|
function handleRateModal() {
const form = getForm();
const values = form.getFieldsValue();
openRateModal(true, {
data: values,
});
}
|
sanmu
authored
|
808
809
810
811
812
813
814
815
816
817
818
819
820
821
|
function handleFieldVisible(record) {
openFieldDetailDrawer(true, record);
}
function handleGoCheckDetail() {
openCheckDetailDrawer(true);
openFormDetailDrawer(false);
}
function handleGoFormDetail() {
openCheckDetailDrawer(false);
openFormDetailDrawer(true);
}
|
sanmu
authored
|
822
|
function handlePreview(url) {
|
sanmu
authored
|
823
824
825
826
827
828
|
createImgPreview({ imageList: [url], defaultWidth: 500 });
// e?.stopPropagation();
// e?.preventDefault();
return false;
}
|
sanmu
authored
|
829
|
async function handleExportModal() {
|
sanmu
authored
|
830
831
832
833
834
|
const form = getForm();
const values = form.getFieldsValue();
openExportModal(true, {
data: values,
});
|
sanmu
authored
|
835
836
|
}
|
柏杨
authored
|
837
838
839
840
841
|
async function handleServiceProfitModal() {
if (selectedCustomCodes.value.length > 1) {
error('勾选订单的客户编码需一致');
return;
}
|
|
842
843
844
845
|
// if (selectedProjectNos.value.length > 1) {
// error('勾选订单的项目号需一致');
// return;
// }
|
柏杨
authored
|
846
847
|
const form = getForm();
const values = form.getFieldsValue();
|
柏杨
authored
|
848
849
850
851
|
const resAll = await getOrderList({});
const filteredItems = resAll.items.filter((item: { id: string }) =>
checkedKeys.value.includes(item.id),
);
|
柏杨
authored
|
852
|
openServiceProfitModal(true, {
|
柏杨
authored
|
853
|
res: filteredItems,
|
柏杨
authored
|
854
|
data: checkedKeys.value,
|
柏杨
authored
|
855
856
857
|
orderList: resAll,
customerCode: selectedCustomCodes.value,
projectNo: selectedProjectNos.value,
|
柏杨
authored
|
858
859
860
861
|
searchData: values,
});
}
|
柏杨
authored
|
862
863
864
865
866
|
async function handleProductProfitModal() {
if (selectedCustomCodes.value.length > 1) {
error('勾选订单的客户编码需一致');
return;
}
|
柏杨
authored
|
867
868
|
const form = getForm();
const values = form.getFieldsValue();
|
柏杨
authored
|
869
870
871
872
|
const resAll = await getOrderList({});
const filteredItems = resAll.items.filter((item: { id: string }) =>
checkedKeys.value.includes(item.id),
);
|
柏杨
authored
|
873
|
openProductProfitModal(true, {
|
柏杨
authored
|
874
|
filteredItems: filteredItems,
|
柏杨
authored
|
875
876
|
data: checkedKeys.value,
searchData: values,
|
柏杨
authored
|
877
878
|
customerCode: selectedCustomCodes.value,
projectNo: selectedProjectNos.value,
|
柏杨
authored
|
879
880
881
|
});
}
|
sanmu
authored
|
882
883
884
885
|
const handleFormSuccess = () => {
reload();
};
|
|
886
887
888
889
890
891
892
893
|
async function handleDelete(id: string) {
try {
await orderDelete({ ids: [id] });
reload();
} catch (error) {
console.log(error);
}
}
|
sanmu
authored
|
894
|
|
sanmu
authored
|
895
|
return {
|
sanmu
authored
|
896
|
user,
|
sanmu
authored
|
897
|
SELECT_FIELD_COLUMNS,
|
sanmu
authored
|
898
899
|
fieldDetailRegister,
profitModalRegister,
|
柏杨
authored
|
900
901
|
invoiceCreateModalRegister,
productInvoiceModalRegister,
|
柏杨
authored
|
902
903
|
serviceProfitModalRegister,
productProfitModalRegister,
|
柏杨
authored
|
904
|
handleChange,
|
sanmu
authored
|
905
906
|
rateModalRegister,
exportModalRegister,
|
柏杨
authored
|
907
|
productModalRegister,
|
|
908
|
statementModalRegister,
|
柏杨
authored
|
909
|
passModalRegister,
|
sanmu
authored
|
910
|
historyDetailRegister,
|
柏杨
authored
|
911
|
trackHistoryRegister,
|
sanmu
authored
|
912
913
|
formDetailRegister,
handleProfitModal,
|
柏杨
authored
|
914
915
|
handleInvoiceCreateModal,
handleProductInvoiceModal,
|
|
916
|
handleStatementModal,
|
sanmu
authored
|
917
918
919
920
921
|
registerTable,
getFormValues,
checkedKeys,
onSelect,
handleEdit,
|
sanmu
authored
|
922
|
handleCopy,
|
sanmu
authored
|
923
924
925
926
927
928
929
930
|
handleCheck,
onSelectAll,
tooltipVisible,
handleFieldVisible,
checkModalRegister,
handleGoCheckDetail,
handleGoFormDetail,
handleHistory,
|
柏杨
authored
|
931
932
933
934
|
focus,
value1,
handlePassModal,
handleTrackHistory,
|
sanmu
authored
|
935
936
|
handleAdd,
createImgPreview,
|
sanmu
authored
|
937
|
handleExportModal,
|
sanmu
authored
|
938
939
|
handlePreview,
handleFormSuccess,
|
柏杨
authored
|
940
|
handleProductModal,
|
sanmu
authored
|
941
942
|
handleRateModal,
openExportModal,
|
柏杨
authored
|
943
|
openProductModal,
|
|
944
|
openStatementModal,
|
柏杨
authored
|
945
|
openPassModal,
|
|
946
|
handleDelete,
|
柏杨
authored
|
947
948
|
handleServiceProfitModal,
handleProductProfitModal,
|
柏杨
authored
|
949
|
handleClearChoose,
|
柏杨
authored
|
950
|
selectedCustomCodes,
|
sanmu
authored
|
951
952
|
role,
ROLE,
|
sanmu
authored
|
953
954
955
956
957
|
};
},
});
</script>
|
柏杨
authored
|
958
|
<style lang="less">
|
sanmu
authored
|
959
960
961
962
963
964
965
|
.ant-table-thead th,
.ant-table-tbody td {
padding: 0;
white-space: pre-wrap;
}
.ant-table-cell img {
|
sanmu
authored
|
966
967
|
width: 40px;
height: 40px;
|
sanmu
authored
|
968
|
}
|
sanmu
authored
|
969
970
971
972
|
.order-page .vben-basic-table .ant-form-item .ant-picker {
width: 100%;
}
|
sanmu
authored
|
973
974
975
976
977
|
.order-page .ant-table.ant-table-middle .ant-table-tbody > tr > td {
padding-top: 0;
padding-bottom: 0;
}
|
柏杨
authored
|
978
979
980
981
|
.passCalculate .ant-select-selector {
background-color: #1890ff !important;
color: white !important;
|
柏杨
authored
|
982
|
border-radius: 5px 5px 5px 5px !important;
|
柏杨
authored
|
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
|
}
.passCalculate .ant-select-selection-item {
color: white !important;
}
.dropdown-class {
background-color: #1890ff; /* 选择框背景颜色 */
color: white;
border: none; /* 去除选择框边框 */
}
.dropdown-class .ant-select-selector {
background-color: #1890ff; /* 选择框背景颜色 */
color: white;
border: none !important; /* 去除选择框边框 */
box-shadow: none !important; /* 去除选择框阴影 */
}
.dropdown-class .ant-select-dropdown {
background-color: #1890ff; /* 下拉框背景颜色 */
border: none !important; /* 去除下拉框边框 */
box-shadow: none !important; /* 去除下拉框阴影 */
}
.dropdown-class .ant-select-item {
background-color: #1890ff; /* 下拉选项背景颜色 */
color: white !important; /* 下拉选项字体颜色 */
border: none !important; /* 去除下拉选项边框 */
}
.dropdown-class .ant-select-item:hover,
.dropdown-class .ant-select-item-option-active,
.dropdown-class .ant-select-item-option-selected {
background-color: #1967d3 !important; /* 选中和悬停状态下拉选项背景颜色 */
color: white !important; /* 选中和悬停状态下拉选项字体颜色 */
border: none !important; /* 去除选中和悬停状态下拉选项边框 */
}
.dropdown-class .ant-select-item-option {
background-color: #1890ff; /* 下拉选项背景颜色 */
color: white !important; /* 下拉选项字体颜色 */
border: none !important; /* 去除下拉选项边框 */
}
|
sanmu
authored
|
1027
|
</style>
|
sanmu
authored
|
1028
|
./constant
|