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