Showing
1 changed file
with
121 additions
and
32 deletions
| ... | ... | @@ -3,40 +3,36 @@ |
| 3 | 3 | <scroll-view class="scroll" scroll-y> |
| 4 | 4 | <uni-list> |
| 5 | 5 | <view class="section"> |
| 6 | - <!-- 编辑模式下,订单编号通常不允许修改,或者作为只读显示,但为了保持与新增页UI一致,这里保留结构但设为不可点击 --> | |
| 7 | - <uni-list-item class="select-item is-filled" :rightText="form.purchaseOrderName || ''"> | |
| 8 | - <template v-slot:body> | |
| 9 | - <view class="item-title"><text class="required">*</text><text>订单编号</text></view> | |
| 10 | - </template> | |
| 11 | - </uni-list-item> | |
| 12 | - <uni-list-item title="补货单编号"> | |
| 6 | + <uni-list-item title="订货单位"> | |
| 13 | 7 | <template v-slot:footer> |
| 14 | - <view class="readonly-text">{{ form.code }}</view> | |
| 8 | + <view class="readonly-text">{{ form.orderingUnitName }}</view> | |
| 15 | 9 | </template> |
| 16 | 10 | </uni-list-item> |
| 17 | - <uni-list-item title="分厂"> | |
| 18 | - <template v-slot:footer> | |
| 19 | - <view class="readonly-text">{{ form.workshopName }}</view> | |
| 11 | + <uni-list-item class="select-item" :class="form.sampleTypeName ? 'is-filled' : 'is-empty'" clickable | |
| 12 | + @click="openSheet('sampleType')" :rightText="form.sampleTypeName || '请选择'" showArrow> | |
| 13 | + <template v-slot:body> | |
| 14 | + <view class="item-title"><text>试样种类</text></view> | |
| 20 | 15 | </template> |
| 21 | 16 | </uni-list-item> |
| 22 | - <uni-list-item title="办事处"> | |
| 23 | - <template v-slot:footer> | |
| 24 | - <view class="readonly-text">{{ form.deptName }}</view> | |
| 17 | + <uni-list-item class="select-item" :class="form.customerTypeName ? 'is-filled' : 'is-empty'" clickable | |
| 18 | + @click="openSheet('customerType')" :rightText="form.customerTypeName || '请选择'" showArrow> | |
| 19 | + <template v-slot:body> | |
| 20 | + <view class="item-title"><text>客户类型</text></view> | |
| 25 | 21 | </template> |
| 26 | 22 | </uni-list-item> |
| 27 | - <uni-list-item title="区域"> | |
| 23 | + <uni-list-item title="生产厂"> | |
| 28 | 24 | <template v-slot:footer> |
| 29 | - <view class="readonly-text">{{ form.regionName }}</view> | |
| 25 | + <view class="readonly-text">{{ form.workshopName }}</view> | |
| 30 | 26 | </template> |
| 31 | 27 | </uni-list-item> |
| 32 | - <uni-list-item title="购货单位"> | |
| 28 | + <uni-list-item title="所属品种"> | |
| 33 | 29 | <template v-slot:footer> |
| 34 | - <view class="readonly-text">{{ form.customerName }}</view> | |
| 30 | + <view class="readonly-text">{{ form.belongingBreed }}</view> | |
| 35 | 31 | </template> |
| 36 | 32 | </uni-list-item> |
| 37 | - <uni-list-item title="原计划发货日期"> | |
| 33 | + <uni-list-item title="原供货同行"> | |
| 38 | 34 | <template v-slot:footer> |
| 39 | - <uni-datetime-picker type="date" v-model="form.originPlanShipDate" :end="maxDeliveryDate" /> | |
| 35 | + <uni-easyinput v-model="form.originalSupplierPeer" placeholder="请输入原供货同行" :inputBorder="false" /> | |
| 40 | 36 | </template> |
| 41 | 37 | </uni-list-item> |
| 42 | 38 | </view> |
| ... | ... | @@ -47,20 +43,43 @@ |
| 47 | 43 | <Product mode="add" :list="initPurchaseOrderLineList" @change="purchaseOrderLineListChange" |
| 48 | 44 | :orderDate="form.orderDate" /> |
| 49 | 45 | </view> |
| 46 | + | |
| 47 | + <view class="section"> | |
| 48 | + | |
| 49 | + <uni-list-item class="select-item" :class="form.sampleQuantityRegulationName ? 'is-filled' : 'is-empty'" clickable | |
| 50 | + @click="openSheet('sampleQuantityRegulation')" :rightText="form.sampleQuantityRegulationName || '请选择'" showArrow> | |
| 51 | + <template v-slot:body> | |
| 52 | + <view class="item-title"><text>本次试样数量是否超规定</text></view> | |
| 53 | + </template> | |
| 54 | + </uni-list-item> | |
| 55 | + | |
| 56 | + <uni-list-item class="select-item" :class="form.specificationQuantityRegulationName ? 'is-filled' : 'is-empty'" clickable | |
| 57 | + @click="openSheet('specificationQuantityRegulation')" :rightText="form.specificationQuantityRegulationName || '请选择'" showArrow> | |
| 58 | + <template v-slot:body> | |
| 59 | + <view class="item-title"><text>试样规格个数是否超规定</text></view> | |
| 60 | + </template> | |
| 61 | + </uni-list-item> | |
| 62 | + | |
| 63 | + <uni-list-item title="试样次数"> | |
| 64 | + <template v-slot:footer> | |
| 65 | + <uni-easyinput type="textarea" v-model="form.sampleFrequency" placeholder="请输入试样次数" :inputBorder="false" /> | |
| 66 | + </template> | |
| 67 | + </uni-list-item> | |
| 68 | + | |
| 69 | + <uni-list-item title="前期不合格描述"> | |
| 70 | + <template v-slot:footer> | |
| 71 | + <uni-easyinput type="textarea" v-model="form.earlyNonconformityDescription" placeholder="请输入前期不合格描述" :inputBorder="false" /> | |
| 72 | + </template> | |
| 73 | + </uni-list-item> | |
| 74 | + | |
| 75 | + </view> | |
| 76 | + | |
| 50 | 77 | <view class="footer"> |
| 51 | 78 | <view class="view-total"> |
| 52 | 79 | <view class="head">合计</view> |
| 53 | 80 | <view class="row"> |
| 54 | 81 | <view class="row2"> |
| 55 | - <text class="label">需发</text><text class="value">{{ form.totalQuantity }}</text> | |
| 56 | - </view> | |
| 57 | - <view class="row2"> | |
| 58 | - <text class="label">实发</text><text class="value">{{ form.totalShippedQuantity }}</text> | |
| 59 | - </view> | |
| 60 | - </view> | |
| 61 | - <view class="row"> | |
| 62 | - <view class="row2"> | |
| 63 | - <text class="label">需求补货</text><text class="value">{{ form.totalSupplementaryQuantity }}</text> | |
| 82 | + <text class="label">数量</text><text class="value">{{ form.totalQuantity }}</text> | |
| 64 | 83 | </view> |
| 65 | 84 | </view> |
| 66 | 85 | </view> |
| ... | ... | @@ -68,16 +87,22 @@ |
| 68 | 87 | </view> |
| 69 | 88 | </uni-list> |
| 70 | 89 | </scroll-view> |
| 90 | + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" | |
| 91 | + @confirm="onSheetConfirm" /> | |
| 71 | 92 | </view> |
| 72 | 93 | </template> |
| 73 | 94 | |
| 74 | 95 | <script> |
| 75 | -import { updateApi, getDetailApi } from '@/api/replenishment_order.js' | |
| 96 | +import { updateApi, getDetailApi } from '@/api/confirmation_form.js' | |
| 76 | 97 | import Product from './product.vue' |
| 98 | +import SingleSelectSheet from '@/components/single-select/index.vue' | |
| 99 | +import { | |
| 100 | + getDicByCodes | |
| 101 | +} from '@/utils/dic' | |
| 77 | 102 | |
| 78 | 103 | export default { |
| 79 | - name: 'ReplenishmentOrderModify', | |
| 80 | - components: { Product }, | |
| 104 | + name: 'ConfirmationFormModify', | |
| 105 | + components: { Product, SingleSelectSheet }, | |
| 81 | 106 | data() { |
| 82 | 107 | return { |
| 83 | 108 | form: { |
| ... | ... | @@ -102,12 +127,20 @@ export default { |
| 102 | 127 | }, |
| 103 | 128 | initPurchaseOrderLineList: [], |
| 104 | 129 | maxDeliveryDate: new Date().toISOString().substring(0, 10), |
| 130 | + sheet: { visible: false, title: '请选择', options: [], value: '', field: '' }, | |
| 131 | + dicOptions: { | |
| 132 | + ENTERPRISE_TYPE: [], // 客户类型 | |
| 133 | + SAMPLE_TYPE: [], // 试样种类 | |
| 134 | + }, | |
| 135 | + enterpriseTypeLocal: [], // 客户类型 | |
| 136 | + sampleTypeLocal: [], // 试样种类 | |
| 105 | 137 | } |
| 106 | 138 | }, |
| 107 | 139 | onLoad(query) { |
| 108 | 140 | const id = (query && (query.id || query.code)) || '' |
| 109 | 141 | if (id) { |
| 110 | 142 | this.loadDetail(id) |
| 143 | + this.loadAllDicData() | |
| 111 | 144 | } |
| 112 | 145 | }, |
| 113 | 146 | methods: { |
| ... | ... | @@ -118,6 +151,8 @@ export default { |
| 118 | 151 | const next = { ...this.form, ...m } |
| 119 | 152 | // 确保ID存在 |
| 120 | 153 | next.id = m.id || id |
| 154 | + next.sampleQuantityRegulationName = m.sampleQuantityRegulation === true ? '是' : '否' | |
| 155 | + next.specificationQuantityRegulationName = m.specificationQuantityRegulation === true ? '是' : '否' | |
| 121 | 156 | // 映射列表 |
| 122 | 157 | // 注意:详情返回的是 replenishmentOrderLineList,需要赋值给 initPurchaseOrderLineList 以便 Product 组件初始化 |
| 123 | 158 | // 且需要处理字段兼容性,确保 Product 组件能正确显示和编辑 |
| ... | ... | @@ -137,6 +172,28 @@ export default { |
| 137 | 172 | uni.showToast({ title: '加载失败', icon: 'none' }) |
| 138 | 173 | } |
| 139 | 174 | }, |
| 175 | + loadAllDicData() { | |
| 176 | + const dicCodes = ['ENTERPRISE_TYPE', 'SAMPLE_TYPE'] | |
| 177 | + return getDicByCodes(dicCodes).then(results => { | |
| 178 | + this.dicOptions.ENTERPRISE_TYPE = results.ENTERPRISE_TYPE.data || [] | |
| 179 | + this.dicOptions.SAMPLE_TYPE = results.SAMPLE_TYPE.data || [] | |
| 180 | + this.enterpriseTypeLocal = (this.dicOptions.ENTERPRISE_TYPE || []).map(it => ({ | |
| 181 | + value: it.code, | |
| 182 | + label: it.name | |
| 183 | + })) | |
| 184 | + this.sampleTypeLocal = (this.dicOptions.SAMPLE_TYPE || []).map(it => ({ | |
| 185 | + value: it.code, | |
| 186 | + label: it.name | |
| 187 | + })) | |
| 188 | + }).catch(() => { | |
| 189 | + this.dicOptions = { | |
| 190 | + ENTERPRISE_TYPE: [], // 客户类型 | |
| 191 | + SAMPLE_TYPE: [], // 试样种类 | |
| 192 | + } | |
| 193 | + this.enterpriseTypeLocal = [] | |
| 194 | + this.sampleTypeLocal = [] | |
| 195 | + }) | |
| 196 | + }, | |
| 140 | 197 | validateRequired() { |
| 141 | 198 | const checks = [ |
| 142 | 199 | { key: 'purchaseOrderName', label: '订单编号' } |
| ... | ... | @@ -239,6 +296,38 @@ export default { |
| 239 | 296 | this.form.purchaseOrderLineList = list |
| 240 | 297 | this.calculateSummary(list) |
| 241 | 298 | }, |
| 299 | + openSheet(field) { | |
| 300 | + let options = [] | |
| 301 | + let title = '' | |
| 302 | + let value = '' | |
| 303 | + | |
| 304 | + if (field === 'sampleType') { | |
| 305 | + title = '试样种类' | |
| 306 | + options = this.sampleTypeLocal | |
| 307 | + value = this.form.sampleType | |
| 308 | + } else if (field === 'customerType') { | |
| 309 | + title = '客户类型' | |
| 310 | + options = this.enterpriseTypeLocal | |
| 311 | + value = this.form.customerType | |
| 312 | + } else if (field === 'sampleQuantityRegulation') { | |
| 313 | + title = '本次试样数量是否超规定' | |
| 314 | + options = [{ value: true, label: '是' }, { value: false, label: '否' }] | |
| 315 | + value = this.form.sampleQuantityRegulation | |
| 316 | + } else if (field === 'specificationQuantityRegulation') { | |
| 317 | + title = '试样规格个数是否超规定' | |
| 318 | + options = [{ value: true, label: '是' }, { value: false, label: '否' }] | |
| 319 | + value = this.form.specificationQuantityRegulation | |
| 320 | + } | |
| 321 | + | |
| 322 | + const match = options.find(o => String(o.value) === String(value)) | |
| 323 | + this.sheet = { ...this.sheet, visible: true, title, options, field, value: match ? match.value : '' } | |
| 324 | + }, | |
| 325 | + onSheetConfirm({ value, label }) { | |
| 326 | + const field = this.sheet.field | |
| 327 | + this.form[field] = value | |
| 328 | + this.form[field + 'Name'] = label | |
| 329 | + this.sheet.visible = false | |
| 330 | + }, | |
| 242 | 331 | } |
| 243 | 332 | } |
| 244 | 333 | </script> | ... | ... |