Commit 1faf485d9c1bd05a12c71a51a53e5492f19d944e

Authored by boyang
1 parent a940a118

基本信息保存按钮添加Loading

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