Commit 100ac083df0e0e66e0999ae04ed42e3672242b8b

Authored by 史婷婷
1 parent 7d904a52

feat: 上传附件组件优化,以及引用附件组件的地方

1 <template> 1 <template>
2 <view class="file-upload"> 2 <view class="file-upload">
3 <view class="btn" @click="selectFile">{{ innerName ? '重新上传' : '上传附件' }}</view> 3 <view class="btn" @click="selectFile">{{ innerName ? '重新上传' : '上传附件' }}</view>
4 - <view v-if="showName && innerName" class="file-name">{{ innerName }}</view> 4 + <view v-if="innerName" class="file-name">{{ innerName }}</view>
5 </view> 5 </view>
6 </template> 6 </template>
7 7
8 <script> 8 <script>
9 import { uploadFileApi } from '@/api/base.js' 9 import { uploadFileApi } from '@/api/base.js'
10 import upload from '@/utils/upload' 10 import upload from '@/utils/upload'
11 -import config from '@/config'  
12 -import { getToken } from '@/utils/auth'  
13 export default { 11 export default {
14 name: 'FileUpload', 12 name: 'FileUpload',
15 props: { 13 props: {
@@ -101,7 +99,14 @@ export default { @@ -101,7 +99,14 @@ export default {
101 </script> 99 </script>
102 100
103 <style scoped> 101 <style scoped>
104 -.file-upload { display: flex; align-items: center; }  
105 -.btn { color: #3D48A3; font-size: 28rpx; margin-right: 20rpx; cursor: pointer; }  
106 -.file-name { font-size: 28rpx; color: rgba(0,0,0,0.9); }  
107 -</style>  
  102 +.file-upload {
  103 + display: flex;
  104 + }
  105 +.btn {
  106 + color: #3D48A3; font-size: 28rpx; margin-right: 20rpx; cursor: pointer;
  107 + flex-shrink: 0;
  108 +}
  109 +.file-name {
  110 + font-size: 28rpx; color: rgba(0,0,0,0.9);
  111 + }
  112 +</style>
@@ -88,7 +88,6 @@ @@ -88,7 +88,6 @@
88 <view class="upload-row"> 88 <view class="upload-row">
89 <FileUpload v-model="fileInfo" /> 89 <FileUpload v-model="fileInfo" />
90 </view> 90 </view>
91 - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>  
92 <view class="row1" @click="openStandardizedSheet" v-if="uploadType === 'standard'"> 91 <view class="row1" @click="openStandardizedSheet" v-if="uploadType === 'standard'">
93 <view class="label1">合同是否规范</view> 92 <view class="label1">合同是否规范</view>
94 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons> 93 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons>
@@ -95,7 +95,6 @@ @@ -95,7 +95,6 @@
95 <view class="upload-row"> 95 <view class="upload-row">
96 <FileUpload v-model="fileInfo" /> 96 <FileUpload v-model="fileInfo" />
97 </view> 97 </view>
98 - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>  
99 <view class="row1" @click="openStandardizedSheet" v-if="uploadType !== 'seal'"> 98 <view class="row1" @click="openStandardizedSheet" v-if="uploadType !== 'seal'">
100 <view class="label1">合同是否规范</view> 99 <view class="label1">合同是否规范</view>
101 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons> 100 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons>
@@ -96,7 +96,6 @@ @@ -96,7 +96,6 @@
96 <view class="upload-row"> 96 <view class="upload-row">
97 <FileUpload v-model="fileInfo" /> 97 <FileUpload v-model="fileInfo" />
98 </view> 98 </view>
99 - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>  
100 <view class="row1" @click="openStandardizedSheet" v-if="uploadType !== 'seal'"> 99 <view class="row1" @click="openStandardizedSheet" v-if="uploadType !== 'seal'">
101 <view class="label1">合同是否规范</view> 100 <view class="label1">合同是否规范</view>
102 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons> 101 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons>
@@ -87,7 +87,6 @@ @@ -87,7 +87,6 @@
87 <view class="upload-row"> 87 <view class="upload-row">
88 <FileUpload v-model="fileInfo" /> 88 <FileUpload v-model="fileInfo" />
89 </view> 89 </view>
90 - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>  
91 <view class="row1" @click="openStandardizedSheet"> 90 <view class="row1" @click="openStandardizedSheet">
92 <view class="label1">合同是否规范</view> 91 <view class="label1">合同是否规范</view>
93 <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons> 92 <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons>
@@ -91,7 +91,6 @@ @@ -91,7 +91,6 @@
91 <view class="upload-row"> 91 <view class="upload-row">
92 <FileUpload v-model="fileInfo" /> 92 <FileUpload v-model="fileInfo" />
93 </view> 93 </view>
94 - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>  
95 <view class="row1" @click="openStandardizedSheet"> 94 <view class="row1" @click="openStandardizedSheet">
96 <view class="label1">合同是否规范</view> 95 <view class="label1">合同是否规范</view>
97 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons> 96 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons>
@@ -90,7 +90,6 @@ @@ -90,7 +90,6 @@
90 <view class="upload-row"> 90 <view class="upload-row">
91 <FileUpload v-model="fileInfo" /> 91 <FileUpload v-model="fileInfo" />
92 </view> 92 </view>
93 - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>  
94 <view class="row1" @click="openStandardizedSheet"> 93 <view class="row1" @click="openStandardizedSheet">
95 <view class="label1">合同是否规范</view> 94 <view class="label1">合同是否规范</view>
96 <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons> 95 <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons>
@@ -96,7 +96,6 @@ @@ -96,7 +96,6 @@
96 <view class="upload-row"> 96 <view class="upload-row">
97 <FileUpload v-model="fileInfo" /> 97 <FileUpload v-model="fileInfo" />
98 </view> 98 </view>
99 - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>  
100 <view class="row1" @click="openStandardizedSheet"> 99 <view class="row1" @click="openStandardizedSheet">
101 <view class="label1">合同是否规范</view> 100 <view class="label1">合同是否规范</view>
102 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons> 101 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons>
@@ -45,14 +45,10 @@ @@ -45,14 +45,10 @@
45 <view class="dialog_row"> 45 <view class="dialog_row">
46 <text class="dialog_label">上传工商信息</text> 46 <text class="dialog_label">上传工商信息</text>
47 <FileUpload v-model="businessFile" /> 47 <FileUpload v-model="businessFile" />
48 - <view v-if="businessFile && businessFile.name" class="upload-show">{{ businessFile.name }}  
49 - </view>  
50 </view> 48 </view>
51 <view class="dialog_row"> 49 <view class="dialog_row">
52 <text class="dialog_label">上传股东信息</text> 50 <text class="dialog_label">上传股东信息</text>
53 <FileUpload v-model="shareholderFile" /> 51 <FileUpload v-model="shareholderFile" />
54 - <view v-if="shareholderFile && shareholderFile.name" class="upload-show">{{ shareholderFile.name  
55 - }}</view>  
56 </view> 52 </view>
57 </view> 53 </view>
58 <view class="dialog_footer"> 54 <view class="dialog_footer">
@@ -49,8 +49,6 @@ @@ -49,8 +49,6 @@
49 <uni-list-item title="撤销确认凭证"> 49 <uni-list-item title="撤销确认凭证">
50 <template v-slot:footer> 50 <template v-slot:footer>
51 <FileUpload v-model="confirmationVoucherFile" /> 51 <FileUpload v-model="confirmationVoucherFile" />
52 - <view v-if="confirmationVoucherFile && confirmationVoucherFile.name" class="upload-show">{{ confirmationVoucherFile.name  
53 - }}</view>  
54 </template> 52 </template>
55 </uni-list-item> 53 </uni-list-item>
56 </view> 54 </view>
@@ -8,11 +8,6 @@ @@ -8,11 +8,6 @@
8 <view class="readonly-text">{{ form.orderNo }}</view> 8 <view class="readonly-text">{{ form.orderNo }}</view>
9 </template> 9 </template>
10 </uni-list-item> 10 </uni-list-item>
11 - <uni-list-item title="供货单位">  
12 - <template v-slot:footer>  
13 - <view class="readonly-text">{{ getDicName('SUPPLIER', form.supplyUnit, dicOptions.SUPPLIER) }}</view>  
14 - </template>  
15 - </uni-list-item>  
16 <uni-list-item title="订货单位"> 11 <uni-list-item title="订货单位">
17 <template v-slot:footer> 12 <template v-slot:footer>
18 <view class="readonly-text">{{ form.orderingUnitName }}</view> 13 <view class="readonly-text">{{ form.orderingUnitName }}</view>
@@ -23,20 +18,14 @@ @@ -23,20 +18,14 @@
23 <view class="readonly-text">{{ form.orderDate }}</view> 18 <view class="readonly-text">{{ form.orderDate }}</view>
24 </template> 19 </template>
25 </uni-list-item> 20 </uni-list-item>
26 - <uni-list-item title="生产厂"> 21 + <uni-list-item title="申请撤单日期">
27 <template v-slot:footer> 22 <template v-slot:footer>
28 - <view class="readonly-text">{{ form.workshopName }}</view> 23 + <view class="readonly-text">{{ form.documentPreparationDate }}</view>
29 </template> 24 </template>
30 </uni-list-item> 25 </uni-list-item>
31 - <uni-list-item title="结算方式或期限">  
32 - <template v-slot:footer>  
33 - <view class="readonly-text">{{ form.settlementTerms }}</view>  
34 - </template>  
35 - </uni-list-item>  
36 -  
37 - <uni-list-item title="交货方式"> 26 + <uni-list-item title="所属办">
38 <template v-slot:footer> 27 <template v-slot:footer>
39 - <uni-easyinput v-model="form.deliveryMethod" placeholder="请输入交货方式" :inputBorder="false" /> 28 + <view class="readonly-text">{{ form.deptName }}</view>
40 </template> 29 </template>
41 </uni-list-item> 30 </uni-list-item>
42 </view> 31 </view>
@@ -47,90 +36,21 @@ @@ -47,90 +36,21 @@
47 </view> 36 </view>
48 37
49 <view class="section"> 38 <view class="section">
50 - <uni-list-item title="价格表编号">  
51 - <template v-slot:footer>  
52 - <uni-easyinput v-model="form.priceListNo" placeholder="请输入价格表编号" :inputBorder="false" />  
53 - </template>  
54 - </uni-list-item>  
55 - <uni-list-item title="开票情况">  
56 - <template v-slot:footer>  
57 - <uni-easyinput v-model="form.invoicingStatus" placeholder="请输入开票情况" :inputBorder="false" />  
58 - </template>  
59 - </uni-list-item>  
60 - <uni-list-item class="amount-item">  
61 - <template v-slot:body>  
62 - <view class="item-title"><text>运费</text></view>  
63 - </template> 39 + <uni-list-item title="撤销原因">
64 <template v-slot:footer> 40 <template v-slot:footer>
65 - <view class="amount-row">  
66 - <uni-easyinput type="number" v-model="form.shippingCost" placeholder="0.00" :inputBorder="false" />  
67 - <text class="unit">元</text>  
68 - </view> 41 + <uni-easyinput type="textarea" v-model="form.revokeReason" placeholder="请输入撤销原因"
  42 + :inputBorder="false" />
69 </template> 43 </template>
70 </uni-list-item> 44 </uni-list-item>
71 - <uni-list-item class="amount-item">  
72 - <template v-slot:body>  
73 - <view class="item-title"><text>包装费</text></view>  
74 - </template> 45 + </view>
  46 +
  47 + <view class="section">
  48 + <uni-list-item title="撤销确认凭证">
75 <template v-slot:footer> 49 <template v-slot:footer>
76 - <view class="amount-row">  
77 - <uni-easyinput type="number" v-model="form.packagingFee" placeholder="0.00" :inputBorder="false" />  
78 - <text class="unit">元</text>  
79 - </view>  
80 - </template>  
81 - </uni-list-item>  
82 - <uni-list-item class="select-item" :class="form.executionStandardName ? 'is-filled' : 'is-empty'" clickable  
83 - @click="openSheet('executionStandard')" :rightText="form.executionStandardName || '请选择'" showArrow>  
84 - <template v-slot:body>  
85 - <view class="item-title"><text>执行标准</text></view> 50 + <FileUpload v-model="confirmationVoucherFile" />
86 </template> 51 </template>
87 </uni-list-item> 52 </uni-list-item>
88 </view> 53 </view>
89 -  
90 -  
91 - <view class="title-header">  
92 - <image class="title-header_icon" src="/static/images/title.png" />  
93 - <span>具体质量要求</span>  
94 - </view>  
95 -  
96 - <uni-list-item title="件重条头">  
97 - <template v-slot:footer>  
98 - <uni-easyinput type="textarea" v-model="form.pieceWeightHeader" placeholder="请输入件重条头"  
99 - :inputBorder="false" />  
100 - </template>  
101 - </uni-list-item>  
102 - <uni-list-item title="表面">  
103 - <template v-slot:footer>  
104 - <uni-easyinput type="textarea" v-model="form.surface" placeholder="请输入表面" :inputBorder="false" />  
105 - </template>  
106 - </uni-list-item>  
107 - <uni-list-item title="公差">  
108 - <template v-slot:footer>  
109 - <uni-easyinput type="textarea" v-model="form.tolerance" placeholder="请输入公差" :inputBorder="false" />  
110 - </template>  
111 - </uni-list-item>  
112 - <uni-list-item title="性能">  
113 - <template v-slot:footer>  
114 - <uni-easyinput type="textarea" v-model="form.performance" placeholder="请输入性能" :inputBorder="false" />  
115 - </template>  
116 - </uni-list-item>  
117 - <uni-list-item title="成分">  
118 - <template v-slot:footer>  
119 - <uni-easyinput type="textarea" v-model="form.element" placeholder="请输入成分" :inputBorder="false" />  
120 - </template>  
121 - </uni-list-item>  
122 - <uni-list-item title="包装">  
123 - <template v-slot:footer>  
124 - <uni-easyinput type="textarea" v-model="form.packaging" placeholder="请输入包装" :inputBorder="false" />  
125 - </template>  
126 - </uni-list-item>  
127 - <uni-list-item title="备注">  
128 - <template v-slot:footer>  
129 - <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" />  
130 - </template>  
131 - </uni-list-item>  
132 -  
133 -  
134 </uni-list> 54 </uni-list>
135 </scroll-view> 55 </scroll-view>
136 56
@@ -152,44 +72,37 @@ @@ -152,44 +72,37 @@
152 import { getDetailApi, updateApi } from '@/api/revoke_list.js' 72 import { getDetailApi, updateApi } from '@/api/revoke_list.js'
153 import Product from './product.vue' 73 import Product from './product.vue'
154 import SingleSelectSheet from '@/components/single-select/index.vue' 74 import SingleSelectSheet from '@/components/single-select/index.vue'
  75 +import FileUpload from '@/components/file-upload/index.vue'
155 import { getDicName } from '@/utils/dic.js' 76 import { getDicName } from '@/utils/dic.js'
156 import { getDicByCodes } from '@/utils/dic' 77 import { getDicByCodes } from '@/utils/dic'
157 78
158 export default { 79 export default {
159 name: 'RevokeListModify', 80 name: 'RevokeListModify',
160 - components: { Product, SingleSelectSheet }, 81 + components: { Product, SingleSelectSheet, FileUpload },
161 data() { 82 data() {
162 return { 83 return {
163 id: '', 84 id: '',
164 form: { 85 form: {
165 - orderId: '',  
166 - purchaseOrderId: '', 86 + purchaseOrderId: '',
  87 + id: '',
  88 + // 订单基础信息
167 orderNo: '', 89 orderNo: '',
168 - supplyUnit: '',  
169 orderingUnit: '', 90 orderingUnit: '',
170 - orderDate: new Date().toISOString().substring(0, 10),  
171 - workshopId: '',  
172 - settlementTerms: '',  
173 - deliveryMethod: '',  
174 - priceListNo: '',  
175 - invoicingStatus: '',  
176 - shippingCost: '',  
177 - packagingFee: '',  
178 - executionStandard: '',  
179 - executionStandardRemarks: '', 91 + orderDate: '',
  92 + // 默认当前日期 格式为 yyyy-MM-dd
  93 + documentPreparationDate: new Date().toISOString().substring(0, 10),
  94 + deptName: '',
180 totalQuantity: '', 95 totalQuantity: '',
181 - afterTotalQuantity: '',  
182 - pieceWeightHeader: '',  
183 - surface: '',  
184 - tolerance: '',  
185 - performance: '',  
186 - element: '',  
187 - packaging: '',  
188 - remarks: '', 96 + totalRevokeQuantity: '',
  97 + revokeReason: '',
  98 + // 文件上传
  99 + confirmationVoucherFileName: '',
  100 + confirmationVoucherFileId: '',
189 }, 101 },
190 initPurchaseOrderLineList: [], 102 initPurchaseOrderLineList: [],
191 dicOptions: { SUPPLIER: [], APPLICABLE_STANDARD: [] }, 103 dicOptions: { SUPPLIER: [], APPLICABLE_STANDARD: [] },
192 - sheet: { visible: false, title: '请选择', options: [], value: '', field: '' } 104 + sheet: { visible: false, title: '请选择', options: [], value: '', field: '' },
  105 + confirmationVoucherFile: { id: '', name: '' },
193 } 106 }
194 }, 107 },
195 onLoad(query) { 108 onLoad(query) {
@@ -215,7 +128,11 @@ export default { @@ -215,7 +128,11 @@ export default {
215 next.purchaseOrderId = m.orderId || ''; 128 next.purchaseOrderId = m.orderId || '';
216 next.purchaseOrderLineList = Array.isArray(m.afterChangeSpecList) ? m.afterChangeSpecList.map(x => ({ ...x })) : [] 129 next.purchaseOrderLineList = Array.isArray(m.afterChangeSpecList) ? m.afterChangeSpecList.map(x => ({ ...x })) : []
217 this.form = next; 130 this.form = next;
218 - this.initPurchaseOrderLineList = next.purchaseOrderLineList || []; 131 + this.initPurchaseOrderLineList = next.purchaseOrderRevokeLineList || [];
  132 + this.confirmationVoucherFile = {
  133 + id: m.confirmationVoucherFileId || '',
  134 + name: m.confirmationVoucherFileName || '',
  135 + }
219 this.refreshStandardName() 136 this.refreshStandardName()
220 } catch (e) { 137 } catch (e) {
221 uni.showToast({ title: '加载失败', icon: 'none' }) 138 uni.showToast({ title: '加载失败', icon: 'none' })