Commit 6db3385f858108bd50fa9e121f0d4a4f046b985e

Authored by sanmu
1 parent 4674a9ae

fix: 优化导出体验

src/api/project/order.ts
@@ -130,8 +130,9 @@ export const orderExport = async (data: any = {}) => { @@ -130,8 +130,9 @@ export const orderExport = async (data: any = {}) => {
130 const userStore = useUserStoreWithOut(); 130 const userStore = useUserStoreWithOut();
131 131
132 const token = userStore.getToken; 132 const token = userStore.getToken;
  133 + message.info('正在导出中...');
133 134
134 - axios({ 135 + return axios({
135 url: '/basic-api' + Api.EXPORT, 136 url: '/basic-api' + Api.EXPORT,
136 method: 'post', 137 method: 'post',
137 responseType: 'blob', 138 responseType: 'blob',
src/views/project/order/ExportModal.vue
@@ -12,7 +12,9 @@ @@ -12,7 +12,9 @@
12 > 12 >
13 <CheckboxGroup v-model:value="checkedList" :options="options" /> 13 <CheckboxGroup v-model:value="checkedList" :options="options" />
14 <div className="mt-6"> 14 <div className="mt-6">
15 - <a-button type="primary" @click="handleExport" className="ml-4">导出</a-button> 15 + <a-button type="primary" @click="handleExport" className="ml-4" :loading="exportLoading"
  16 + >导出</a-button
  17 + >
16 </div> 18 </div>
17 </BasicModal> 19 </BasicModal>
18 </template> 20 </template>
@@ -54,6 +56,7 @@ @@ -54,6 +56,7 @@
54 // 'inspectionStageFields', 56 // 'inspectionStageFields',
55 ]); 57 ]);
56 const loading = ref(true); 58 const loading = ref(true);
  59 + const exportLoading = ref(false);
57 const activeUser = ref(); 60 const activeUser = ref();
58 const info = ref(); 61 const info = ref();
59 const searchData = ref({}); 62 const searchData = ref({});
@@ -143,7 +146,9 @@ @@ -143,7 +146,9 @@
143 146
144 //导出选中的订单 147 //导出选中的订单
145 fieldVO.orderIds = props.ids; 148 fieldVO.orderIds = props.ids;
  149 + exportLoading.value = true;
146 await orderExport({ ...searchData.value, fieldVO }); 150 await orderExport({ ...searchData.value, fieldVO });
  151 + exportLoading.value = false;
147 152
148 closeModal(); 153 closeModal();
149 } 154 }
@@ -158,6 +163,7 @@ @@ -158,6 +163,7 @@
158 activeUser, 163 activeUser,
159 exchangeRate, 164 exchangeRate,
160 checkedList, 165 checkedList,
  166 + exportLoading,
161 }; 167 };
162 }, 168 },
163 }); 169 });
src/views/project/order/FormDetail/ReportFormPanel.vue
@@ -50,6 +50,7 @@ @@ -50,6 +50,7 @@
50 ...item, 50 ...item,
51 field: `${item.field}`, 51 field: `${item.field}`,
52 componentProps: { 52 componentProps: {
  53 + ...item.componentProps,
53 ...(item.component === 'Select' && { showSearch: true }), 54 ...(item.component === 'Select' && { showSearch: true }),
54 ...(item.component === 'Select' && { options: options[optionsField] }), 55 ...(item.component === 'Select' && { options: options[optionsField] }),
55 disabled: getDisable( 56 disabled: getDisable(
src/views/project/order/FormDetail/index.vue
@@ -238,7 +238,7 @@ @@ -238,7 +238,7 @@
238 }); 238 });
239 239
240 //原始的包装费用 240 //原始的包装费用
241 - originPackagePrice.value = data.profitAnalysisInfo.packetPrice; 241 + originPackagePrice.value = data.profitAnalysisInfo?.packetPrice;
242 242
243 const exchangeRate = find(configList.value, (item) => { 243 const exchangeRate = find(configList.value, (item) => {
244 return item.settingCode === 'exchangeRate'; 244 return item.settingCode === 'exchangeRate';
@@ -357,6 +357,9 @@ @@ -357,6 +357,9 @@
357 if (!forms.profitAnalysisInfo.profitType) { 357 if (!forms.profitAnalysisInfo.profitType) {
358 forms.profitAnalysisInfo.profitType = '0'; 358 forms.profitAnalysisInfo.profitType = '0';
359 } 359 }
  360 +
  361 + //默认没有修改包装费用
  362 + forms.profitAnalysisInfo.isEditPacketPrice = false;
360 } else if (activeKey.value === '3') { 363 } else if (activeKey.value === '3') {
361 // 项目报告书 364 // 项目报告书
362 await reportFormPanelRef?.value?.validate(); 365 await reportFormPanelRef?.value?.validate();
@@ -379,8 +382,6 @@ @@ -379,8 +382,6 @@
379 forms.inspectionStageInfo = inspectionFormPanelRef?.value?.getFieldsValue() || {}; 382 forms.inspectionStageInfo = inspectionFormPanelRef?.value?.getFieldsValue() || {};
380 } 383 }
381 384
382 - //默认没有修改包装费用  
383 - forms.profitAnalysisInfo.isEditPacketPrice = false;  
384 //如果包装费用有修改过,那么传参isEditPacketPrice为true 385 //如果包装费用有修改过,那么传参isEditPacketPrice为true
385 if ( 386 if (
386 originPackagePrice.value != -1 && 387 originPackagePrice.value != -1 &&
@@ -389,9 +390,9 @@ @@ -389,9 +390,9 @@
389 forms.profitAnalysisInfo.isEditPacketPrice = true; 390 forms.profitAnalysisInfo.isEditPacketPrice = true;
390 } 391 }
391 392
392 - await orderUpdate(forms);  
393 - closeDrawer();  
394 - emit('success', {}); 393 + // await orderUpdate(forms);
  394 + // closeDrawer();
  395 + // emit('success', {});
395 } 396 }
396 } else { 397 } else {
397 await baseFormPanelRef?.value?.validate(); 398 await baseFormPanelRef?.value?.validate();
src/views/project/order/RateModal.vue
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 v-bind="$attrs" 3 v-bind="$attrs"
4 destroyOnClose 4 destroyOnClose
5 @register="register" 5 @register="register"
6 - title="利润分析表" 6 + title="比重计算"
7 width="600px" 7 width="600px"
8 @visible-change="handleShow" 8 @visible-change="handleShow"
9 :footer="null" 9 :footer="null"
src/views/project/order/tableData.tsx
@@ -816,6 +816,9 @@ export const FIELDS_REPORT_INFO = [ @@ -816,6 +816,9 @@ export const FIELDS_REPORT_INFO = [
816 optionField: 'ideaSourceRate', 816 optionField: 'ideaSourceRate',
817 labelWidth: 150, 817 labelWidth: 150,
818 label: '想法来源占比', 818 label: '想法来源占比',
  819 + componentProps: {
  820 + precision: 2,
  821 + },
819 rules: [{ required: true }], 822 rules: [{ required: true }],
820 }, 823 },
821 { 824 {
@@ -831,6 +834,9 @@ export const FIELDS_REPORT_INFO = [ @@ -831,6 +834,9 @@ export const FIELDS_REPORT_INFO = [
831 component: 'InputNumber', 834 component: 'InputNumber',
832 labelWidth: 150, 835 labelWidth: 150,
833 label: '手工初型1占比', 836 label: '手工初型1占比',
  837 + componentProps: {
  838 + precision: 2,
  839 + },
834 rules: [{ required: true }], 840 rules: [{ required: true }],
835 }, 841 },
836 { 842 {
@@ -845,6 +851,9 @@ export const FIELDS_REPORT_INFO = [ @@ -845,6 +851,9 @@ export const FIELDS_REPORT_INFO = [
845 component: 'InputNumber', 851 component: 'InputNumber',
846 labelWidth: 150, 852 labelWidth: 150,
847 label: '手工初型2占比', 853 label: '手工初型2占比',
  854 + componentProps: {
  855 + precision: 2,
  856 + },
848 rules: [{ required: true }], 857 rules: [{ required: true }],
849 }, 858 },
850 ]; 859 ];
@@ -1035,6 +1044,8 @@ export const FIELDS_PROFIT_INFO = [ @@ -1035,6 +1044,8 @@ export const FIELDS_PROFIT_INFO = [
1035 field: 'productionDepartmentPrice', 1044 field: 'productionDepartmentPrice',
1036 component: 'InputNumber', 1045 component: 'InputNumber',
1037 label: '生产科单价¥', 1046 label: '生产科单价¥',
  1047 + componentProps: { precision: 2 },
  1048 +
1038 rules: [{ required: true }], 1049 rules: [{ required: true }],
1039 }, 1050 },
1040 // { 1051 // {
@@ -1072,21 +1083,21 @@ export const FIELDS_PROFIT_INFO = [ @@ -1072,21 +1083,21 @@ export const FIELDS_PROFIT_INFO = [
1072 label: '利润率', 1083 label: '利润率',
1073 component: 'InputNumber', 1084 component: 'InputNumber',
1074 field: 'profitRate', 1085 field: 'profitRate',
1075 - fieldComponent: { disabled: true }, 1086 + componentProps: { precision: 2 },
1076 // rules: [{ required: true }], 1087 // rules: [{ required: true }],
1077 }, 1088 },
1078 { 1089 {
1079 label: '包装费用$', 1090 label: '包装费用$',
1080 component: 'InputNumber', 1091 component: 'InputNumber',
1081 field: 'packetPrice', 1092 field: 'packetPrice',
1082 - fieldComponent: { disabled: true }, 1093 + componentProps: { precision: 2 },
1083 // rules: [{ required: true }], 1094 // rules: [{ required: true }],
1084 }, 1095 },
1085 { 1096 {
1086 label: '汇率', 1097 label: '汇率',
1087 component: 'InputNumber', 1098 component: 'InputNumber',
1088 field: 'exchangeRate', 1099 field: 'exchangeRate',
1089 - fieldComponent: { disabled: true }, 1100 + componentProps: { precision: 2 },
1090 // rules: [{ required: true }], 1101 // rules: [{ required: true }],
1091 }, 1102 },
1092 // { 1103 // {