Commit 1faf485d9c1bd05a12c71a51a53e5492f19d944e

Authored by boyang
1 parent a940a118

基本信息保存按钮添加Loading

src/api/project/invoice.ts
... ... @@ -23,6 +23,7 @@ enum Api {
23 23 CHECK_DETAIL = '/order/erp/check_bill/list_base_order_info_by', //基础订单查询
24 24 CHECK_ANALYSIS = '/order/erp/check_bill/list_analysis_by', //分析列表
25 25 EXPORT_CHECK_ANALYSIS = '/order/erp/check_bill/export', //导出分析列表
  26 + GETDEDUCTURL_BY_ID = '/order/erp/check_bill/getDeductUrl_by_id', //获取扣款信息
26 27 }
27 28  
28 29 export const getRefundDate = async (params: any, data?: any) => {
... ... @@ -161,3 +162,10 @@ export const exportCheckAnalysis = async (params: any) => {
161 162 params,
162 163 });
163 164 };
  165 +
  166 +export const getDeductUrlById = async (params: any) => {
  167 + return await defHttp.post<any>({
  168 + url: Api.GETDEDUCTURL_BY_ID,
  169 + params,
  170 + });
  171 +};
... ...
src/views/project/config/CreateModal.vue
... ... @@ -41,7 +41,7 @@
41 41  
42 42 const { customerCode: customerCodeOptions } = useOrderInfo(orderStore);
43 43 var [registerForm, { getFieldsValue, validate }] = useForm({
44   - labelWidth: 80,
  44 + labelWidth: 100,
45 45 schemas: [
46 46 {
47 47 field: 'settingValue',
... ... @@ -58,7 +58,14 @@
58 58 {
59 59 field: 'relationValue',
60 60 component: 'InputNumber',
61   - label: props.column === 1 ? '利润率' : props.column === 2 ? '包装费用' : '销售额',
  61 + label:
  62 + props.column === 1
  63 + ? '利润率'
  64 + : props.column === 2
  65 + ? '包装费用'
  66 + : props.column === 5
  67 + ? '最后回款日期'
  68 + : '销售额',
62 69 rules: [{ required: true }],
63 70 colProps: {
64 71 span: 24,
... ... @@ -101,11 +108,12 @@
101 108 ? 'profitRate'
102 109 : props.column === 2
103 110 ? 'packetPrice'
  111 + : props.column === 5
  112 + ? 'orderHodTime'
104 113 : 'salesAmount',
105 114 relationName: '包装费用',
106 115 relationValue: values.relationValue,
107 116 };
108   -
109 117 await addConfig(params);
110 118 emit('modal-success');
111 119 closeModal();
... ...
src/views/project/config/TablePanel.vue
... ... @@ -123,19 +123,16 @@
123 123 reload();
124 124 }
125 125 function handleCostEdit(record: any) {
126   - console.log('5656hasedit');
127 126 openDrawerEdit(true, {
128 127 data: record,
129 128 isUpdate: true,
130 129 });
131 130 }
132 131 function handleCostCreate(record: any) {
133   - console.log(56561);
134 132 openCostCreateModal(true, {
135 133 data: record,
136 134 isUpdate: true,
137 135 });
138   - console.log(56562);
139 136 }
140 137 function handleEdit(record: any) {
141 138 record.onEdit?.(true);
... ...
src/views/project/finance/pay/DeductShow.vue
... ... @@ -3,10 +3,21 @@
3 3 v-bind="$attrs"
4 4 @register="register"
5 5 title="扣款单"
6   - width="500px"
  6 + width="700px"
7 7 :bodyStyle="{ height: '240px' }"
8 8 @ok="handleOk"
9 9 >
  10 + <a-list item-layout="horizontal" :data-source="itemArray">
  11 + <template #renderItem="{ item }">
  12 + <a-list-item>
  13 + <a-list-item-meta>
  14 + <template #title>
  15 + <a :href="item.url" target="_blank" rel="noopener noreferrer">{{ item.name }}</a>
  16 + </template>
  17 + </a-list-item-meta>
  18 + </a-list-item>
  19 + </template>
  20 + </a-list>
10 21 </BasicModal>
11 22 </template>
12 23 <script lang="ts" setup>
... ... @@ -15,16 +26,30 @@
15 26 import type { UploadProps, UploadChangeParam } from 'ant-design-vue';
16 27 import { InboxOutlined } from '@ant-design/icons-vue';
17 28 import { message } from 'ant-design-vue';
18   - import { updateInvoiceInfo } from '@/api/project/invoice';
  29 + import { getDeductUrlById } from '@/api/project/invoice';
19 30  
20   - const deductUrl = ref();
  31 + interface Item {
  32 + name: string;
  33 + url: string;
  34 + }
  35 +
  36 + const list = ref();
21 37 const id = ref();
  38 + const itemArray = ref<Item[]>([]);
22 39  
23 40 const [register, { closeModal }] = useModalInner(async (data) => {
24   - deductUrl.value = data;
  41 + itemArray.value = [];
  42 + const res = await getDeductUrlById({ id: data.data.id });
  43 + for (let item in res) {
  44 + const url = res[item];
  45 + const name = item;
  46 + // 将 name 和 url 放入对象并添加到数组中
  47 + itemArray.value.push({ name, url });
  48 + }
25 49 });
26 50  
27 51 async function handleOk() {
  52 + itemArray.value = [];
28 53 closeModal();
29 54 }
30 55 </script>
... ...
src/views/project/finance/pay/TrackEdit.vue
... ... @@ -47,6 +47,7 @@
47 47 import { UploadOutlined } from '@ant-design/icons-vue';
48 48 import type { UploadProps } from 'ant-design-vue';
49 49 import { updateDeductInfo } from '@/api/project/invoice';
  50 + import { useMessage } from '/@/hooks/web/useMessage';
50 51  
51 52 const emit = defineEmits(['success']);
52 53 const fileList = ref<UploadProps['fileList']>([]);
... ... @@ -58,6 +59,9 @@
58 59 const deductDept = ref();
59 60 const uploadUrl = ref('http://47.104.8.35:18000/api/localStorage/upload_file_oss?name=');
60 61 const updateDeductUrl = ref('http://47.104.8.35:18000/api/localStorage/upload_file_oss?name=');
  62 + const deductUrlOld = ref();
  63 + const { createMessage } = useMessage();
  64 + const { error } = createMessage;
61 65  
62 66 const [register, { setDrawerProps, closeDrawer }] = useDrawerInner((data) => {
63 67 id.value = data.data.id;
... ... @@ -65,6 +69,7 @@
65 69 input1.value = data.data.deductAmount;
66 70 deductDept.value = data.data.deductDept;
67 71 deductUrl.value = data.data.deductUrl;
  72 + deductUrlOld.value = data.data.deductUrl;
68 73 });
69 74  
70 75 function handleChange(info) {
... ... @@ -72,6 +77,10 @@
72 77 updateDeductUrl.value = info.file.response.data.fileUrl;
73 78 deductUrl.value = updateDeductUrl.value;
74 79 }
  80 + if (info.fileList.length == 0) {
  81 + info.file = null;
  82 + deductUrl.value = '';
  83 + }
75 84 }
76 85 function beforeUpload(info) {
77 86 updateDeductUrl.value = uploadUrl.value + info.name;
... ... @@ -79,16 +88,24 @@
79 88  
80 89 //完成编辑
81 90 async function handleSubmit() {
82   - await updateDeductInfo({
83   - id: id.value,
84   - checkNo: checkNo.value,
85   - deductAmount: input1.value,
86   - deductDept: deductDept.value,
87   - deductUrl: deductUrl.value,
88   - });
89   - // await updateDeduct(requestData);
90   - fileList.value = [];
91   - emit('success');
92   - closeDrawer();
  91 + if (!input1.value || deductUrl.value == '' || !deductDept.value) {
  92 + error('选项不能为空');
  93 + } else {
  94 + //没传新扣款单,不传url
  95 + if (deductUrl.value == deductUrlOld.value || deductUrl.value == '') {
  96 + error('请上传扣款单');
  97 + } else {
  98 + await updateDeductInfo({
  99 + id: id.value,
  100 + checkNo: checkNo.value,
  101 + deductAmount: input1.value,
  102 + deductDept: deductDept.value,
  103 + deductUrl: deductUrl.value,
  104 + });
  105 + fileList.value = [];
  106 + emit('success');
  107 + closeDrawer();
  108 + }
  109 + }
93 110 }
94 111 </script>
... ...
src/views/project/finance/pay/index.vue
... ... @@ -397,7 +397,7 @@
397 397 }
398 398 function handleDeductShow(record) {
399 399 openDeductShow(true, {
400   - data: record.deductUrl,
  400 + data: record,
401 401 });
402 402 }
403 403 function handleDetail(record) {
... ...
src/views/project/finance/pay/pay.data.tsx
... ... @@ -67,7 +67,6 @@ export const columns: BasicColumn[] = [
67 67 dataIndex: 'deductUrl',
68 68 width: 120,
69 69 customRender: (column) => {
70   - console.log(column, '5656column');
71 70 const deductUrl = column.record.deductUrl;
72 71 if (deductUrl == undefined) {
73 72 return;
... ...
src/views/project/finance/receive/TrackEdit.vue
... ... @@ -44,6 +44,7 @@
44 44 import { UploadOutlined } from '@ant-design/icons-vue';
45 45 import type { UploadProps } from 'ant-design-vue';
46 46 import { updateDeduct } from '@/api/project/invoice';
  47 + import { useMessage } from '/@/hooks/web/useMessage';
47 48  
48 49 const emit = defineEmits(['success']);
49 50 const fileList = ref<UploadProps['fileList']>([]);
... ... @@ -54,12 +55,16 @@
54 55 const invoiceNo = ref();
55 56 const uploadUrl = ref('http://47.104.8.35:18000/api/localStorage/upload_file_oss?name=');
56 57 const updateDeductUrl = ref('http://47.104.8.35:18000/api/localStorage/upload_file_oss?name=');
  58 + const deductUrlOld = ref();
  59 + const { createMessage } = useMessage();
  60 + const { error } = createMessage;
57 61  
58 62 const [register, { setDrawerProps, closeDrawer }] = useDrawerInner((data) => {
59 63 id.value = data.data.id;
60 64 invoiceNo.value = data.data.invoiceNo;
61 65 input1.value = data.data.deductAmount;
62 66 deductUrl.value = data.data.deductUrl;
  67 + deductUrlOld.value = data.data.deductUrl;
63 68 });
64 69  
65 70 function handleChange(info) {
... ... @@ -67,6 +72,10 @@
67 72 updateDeductUrl.value = info.file.response.data.fileUrl;
68 73 deductUrl.value = updateDeductUrl.value;
69 74 }
  75 + if (info.fileList.length == 0) {
  76 + info.file = null;
  77 + deductUrl.value = '';
  78 + }
70 79 }
71 80 function beforeUpload(info) {
72 81 updateDeductUrl.value = uploadUrl.value + info.name;
... ... @@ -74,21 +83,23 @@
74 83  
75 84 //完成编辑
76 85 async function handleSubmit() {
77   - const requestData = {
78   - id: id.value,
79   - invoiceNo: invoiceNo.value,
80   - deductAmount: input1.value,
81   - deductUrl: deductUrl.value,
82   - };
83   - await updateDeduct({
84   - id: id.value,
85   - invoiceNo: invoiceNo.value,
86   - deductAmount: input1.value,
87   - deductUrl: deductUrl.value,
88   - });
89   - // await updateDeduct(requestData);
90   - fileList.value = [];
91   - emit('success');
92   - closeDrawer();
  86 + console.log(input1.value, '5656', deductUrl.value);
  87 + if (!input1.value || deductUrl.value == '') {
  88 + error('选项不能为空');
  89 + } else {
  90 + if (deductUrl.value == deductUrlOld.value || deductUrl.value == '') {
  91 + error('请上传扣款单');
  92 + } else {
  93 + await updateDeduct({
  94 + id: id.value,
  95 + invoiceNo: invoiceNo.value,
  96 + deductAmount: input1.value,
  97 + deductUrl: deductUrl.value,
  98 + });
  99 + fileList.value = [];
  100 + emit('success');
  101 + closeDrawer();
  102 + }
  103 + }
93 104 }
94 105 </script>
... ...
src/views/project/order/FormDetail/index.vue
... ... @@ -11,6 +11,7 @@
11 11 :isDetail="true"
12 12 :showDetailBack="false"
13 13 okText="保存"
  14 + :loading="isLoading"
14 15 :mask="false"
15 16 class="z-20"
16 17 >
... ... @@ -162,6 +163,9 @@
162 163 const altexUpdate = ref('');
163 164 const sgsUpdate = ref('');
164 165  
  166 + //loading
  167 + const isLoading = ref(false);
  168 +
165 169 //修改之前的包装费用
166 170 const originPackagePrice = ref(-1.0);
167 171  
... ... @@ -345,6 +349,7 @@
345 349 });
346 350 const handleSubmit = async () => {
347 351 try {
  352 + isLoading.value = true;
348 353 if (id.value) {
349 354 const forms = { orderId: id.value } as any;
350 355 if (activeKey.value === '1') {
... ... @@ -458,6 +463,9 @@
458 463 }
459 464 } catch (error) {
460 465 console.log(error);
  466 + } finally {
  467 + // 无论成功或失败,都将 loading 状态设置为 false
  468 + isLoading.value = false;
461 469 }
462 470 };
463 471 const getFormattedDate = (): string => {
... ... @@ -499,6 +507,7 @@
499 507 altexUpdate,
500 508 sgsUpdate,
501 509 getFormattedDate,
  510 + isLoading,
502 511 };
503 512 },
504 513 });
... ...