Commit 100ac083df0e0e66e0999ae04ed42e3672242b8b

Authored by 史婷婷
1 parent 7d904a52

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

1 1 <template>
2 2 <view class="file-upload">
3 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 5 </view>
6 6 </template>
7 7
8 8 <script>
9 9 import { uploadFileApi } from '@/api/base.js'
10 10 import upload from '@/utils/upload'
11   -import config from '@/config'
12   -import { getToken } from '@/utils/auth'
13 11 export default {
14 12 name: 'FileUpload',
15 13 props: {
... ... @@ -101,7 +99,14 @@ export default {
101 99 </script>
102 100
103 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>
\ No newline at end of file
  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 88 <view class="upload-row">
89 89 <FileUpload v-model="fileInfo" />
90 90 </view>
91   - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
92 91 <view class="row1" @click="openStandardizedSheet" v-if="uploadType === 'standard'">
93 92 <view class="label1">合同是否规范</view>
94 93 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons>
... ...
... ... @@ -95,7 +95,6 @@
95 95 <view class="upload-row">
96 96 <FileUpload v-model="fileInfo" />
97 97 </view>
98   - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
99 98 <view class="row1" @click="openStandardizedSheet" v-if="uploadType !== 'seal'">
100 99 <view class="label1">合同是否规范</view>
101 100 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons>
... ...
... ... @@ -96,7 +96,6 @@
96 96 <view class="upload-row">
97 97 <FileUpload v-model="fileInfo" />
98 98 </view>
99   - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
100 99 <view class="row1" @click="openStandardizedSheet" v-if="uploadType !== 'seal'">
101 100 <view class="label1">合同是否规范</view>
102 101 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons>
... ...
... ... @@ -87,7 +87,6 @@
87 87 <view class="upload-row">
88 88 <FileUpload v-model="fileInfo" />
89 89 </view>
90   - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
91 90 <view class="row1" @click="openStandardizedSheet">
92 91 <view class="label1">合同是否规范</view>
93 92 <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons>
... ...
... ... @@ -91,7 +91,6 @@
91 91 <view class="upload-row">
92 92 <FileUpload v-model="fileInfo" />
93 93 </view>
94   - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
95 94 <view class="row1" @click="openStandardizedSheet">
96 95 <view class="label1">合同是否规范</view>
97 96 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons>
... ...
... ... @@ -90,7 +90,6 @@
90 90 <view class="upload-row">
91 91 <FileUpload v-model="fileInfo" />
92 92 </view>
93   - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
94 93 <view class="row1" @click="openStandardizedSheet">
95 94 <view class="label1">合同是否规范</view>
96 95 <uni-icons type="right" size="18" v-if="!standardStandardizedName" ></uni-icons>
... ...
... ... @@ -96,7 +96,6 @@
96 96 <view class="upload-row">
97 97 <FileUpload v-model="fileInfo" />
98 98 </view>
99   - <view v-if="fileInfo && fileInfo.name" class="upload-show">{{ fileInfo.name }}</view>
100 99 <view class="row1" @click="openStandardizedSheet">
101 100 <view class="label1">合同是否规范</view>
102 101 <uni-icons type="right" size="18" v-if="!standardStandardizedName"></uni-icons>
... ...
... ... @@ -45,14 +45,10 @@
45 45 <view class="dialog_row">
46 46 <text class="dialog_label">上传工商信息</text>
47 47 <FileUpload v-model="businessFile" />
48   - <view v-if="businessFile && businessFile.name" class="upload-show">{{ businessFile.name }}
49   - </view>
50 48 </view>
51 49 <view class="dialog_row">
52 50 <text class="dialog_label">上传股东信息</text>
53 51 <FileUpload v-model="shareholderFile" />
54   - <view v-if="shareholderFile && shareholderFile.name" class="upload-show">{{ shareholderFile.name
55   - }}</view>
56 52 </view>
57 53 </view>
58 54 <view class="dialog_footer">
... ...
... ... @@ -49,8 +49,6 @@
49 49 <uni-list-item title="撤销确认凭证">
50 50 <template v-slot:footer>
51 51 <FileUpload v-model="confirmationVoucherFile" />
52   - <view v-if="confirmationVoucherFile && confirmationVoucherFile.name" class="upload-show">{{ confirmationVoucherFile.name
53   - }}</view>
54 52 </template>
55 53 </uni-list-item>
56 54 </view>
... ...
... ... @@ -8,11 +8,6 @@
8 8 <view class="readonly-text">{{ form.orderNo }}</view>
9 9 </template>
10 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 11 <uni-list-item title="订货单位">
17 12 <template v-slot:footer>
18 13 <view class="readonly-text">{{ form.orderingUnitName }}</view>
... ... @@ -23,20 +18,14 @@
23 18 <view class="readonly-text">{{ form.orderDate }}</view>
24 19 </template>
25 20 </uni-list-item>
26   - <uni-list-item title="生产厂">
  21 + <uni-list-item title="申请撤单日期">
27 22 <template v-slot:footer>
28   - <view class="readonly-text">{{ form.workshopName }}</view>
  23 + <view class="readonly-text">{{ form.documentPreparationDate }}</view>
29 24 </template>
30 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 27 <template v-slot:footer>
39   - <uni-easyinput v-model="form.deliveryMethod" placeholder="请输入交货方式" :inputBorder="false" />
  28 + <view class="readonly-text">{{ form.deptName }}</view>
40 29 </template>
41 30 </uni-list-item>
42 31 </view>
... ... @@ -47,90 +36,21 @@
47 36 </view>
48 37
49 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 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 43 </template>
70 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 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 51 </template>
87 52 </uni-list-item>
88 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 54 </uni-list>
135 55 </scroll-view>
136 56
... ... @@ -152,44 +72,37 @@
152 72 import { getDetailApi, updateApi } from '@/api/revoke_list.js'
153 73 import Product from './product.vue'
154 74 import SingleSelectSheet from '@/components/single-select/index.vue'
  75 +import FileUpload from '@/components/file-upload/index.vue'
155 76 import { getDicName } from '@/utils/dic.js'
156 77 import { getDicByCodes } from '@/utils/dic'
157 78
158 79 export default {
159 80 name: 'RevokeListModify',
160   - components: { Product, SingleSelectSheet },
  81 + components: { Product, SingleSelectSheet, FileUpload },
161 82 data() {
162 83 return {
163 84 id: '',
164 85 form: {
165   - orderId: '',
166   - purchaseOrderId: '',
  86 + purchaseOrderId: '',
  87 + id: '',
  88 + // 订单基础信息
167 89 orderNo: '',
168   - supplyUnit: '',
169 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 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 102 initPurchaseOrderLineList: [],
191 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 108 onLoad(query) {
... ... @@ -215,7 +128,11 @@ export default {
215 128 next.purchaseOrderId = m.orderId || '';
216 129 next.purchaseOrderLineList = Array.isArray(m.afterChangeSpecList) ? m.afterChangeSpecList.map(x => ({ ...x })) : []
217 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 136 this.refreshStandardName()
220 137 } catch (e) {
221 138 uni.showToast({ title: '加载失败', icon: 'none' })
... ...