Showing
1 changed file
with
121 additions
and
32 deletions
| @@ -3,40 +3,36 @@ | @@ -3,40 +3,36 @@ | ||
| 3 | <scroll-view class="scroll" scroll-y> | 3 | <scroll-view class="scroll" scroll-y> |
| 4 | <uni-list> | 4 | <uni-list> |
| 5 | <view class="section"> | 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 | <template v-slot:footer> | 7 | <template v-slot:footer> |
| 14 | - <view class="readonly-text">{{ form.code }}</view> | 8 | + <view class="readonly-text">{{ form.orderingUnitName }}</view> |
| 15 | </template> | 9 | </template> |
| 16 | </uni-list-item> | 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 | </template> | 15 | </template> |
| 21 | </uni-list-item> | 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 | </template> | 21 | </template> |
| 26 | </uni-list-item> | 22 | </uni-list-item> |
| 27 | - <uni-list-item title="区域"> | 23 | + <uni-list-item title="生产厂"> |
| 28 | <template v-slot:footer> | 24 | <template v-slot:footer> |
| 29 | - <view class="readonly-text">{{ form.regionName }}</view> | 25 | + <view class="readonly-text">{{ form.workshopName }}</view> |
| 30 | </template> | 26 | </template> |
| 31 | </uni-list-item> | 27 | </uni-list-item> |
| 32 | - <uni-list-item title="购货单位"> | 28 | + <uni-list-item title="所属品种"> |
| 33 | <template v-slot:footer> | 29 | <template v-slot:footer> |
| 34 | - <view class="readonly-text">{{ form.customerName }}</view> | 30 | + <view class="readonly-text">{{ form.belongingBreed }}</view> |
| 35 | </template> | 31 | </template> |
| 36 | </uni-list-item> | 32 | </uni-list-item> |
| 37 | - <uni-list-item title="原计划发货日期"> | 33 | + <uni-list-item title="原供货同行"> |
| 38 | <template v-slot:footer> | 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 | </template> | 36 | </template> |
| 41 | </uni-list-item> | 37 | </uni-list-item> |
| 42 | </view> | 38 | </view> |
| @@ -47,20 +43,43 @@ | @@ -47,20 +43,43 @@ | ||
| 47 | <Product mode="add" :list="initPurchaseOrderLineList" @change="purchaseOrderLineListChange" | 43 | <Product mode="add" :list="initPurchaseOrderLineList" @change="purchaseOrderLineListChange" |
| 48 | :orderDate="form.orderDate" /> | 44 | :orderDate="form.orderDate" /> |
| 49 | </view> | 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 | <view class="footer"> | 77 | <view class="footer"> |
| 51 | <view class="view-total"> | 78 | <view class="view-total"> |
| 52 | <view class="head">合计</view> | 79 | <view class="head">合计</view> |
| 53 | <view class="row"> | 80 | <view class="row"> |
| 54 | <view class="row2"> | 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 | </view> | 83 | </view> |
| 65 | </view> | 84 | </view> |
| 66 | </view> | 85 | </view> |
| @@ -68,16 +87,22 @@ | @@ -68,16 +87,22 @@ | ||
| 68 | </view> | 87 | </view> |
| 69 | </uni-list> | 88 | </uni-list> |
| 70 | </scroll-view> | 89 | </scroll-view> |
| 90 | + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" | ||
| 91 | + @confirm="onSheetConfirm" /> | ||
| 71 | </view> | 92 | </view> |
| 72 | </template> | 93 | </template> |
| 73 | 94 | ||
| 74 | <script> | 95 | <script> |
| 75 | -import { updateApi, getDetailApi } from '@/api/replenishment_order.js' | 96 | +import { updateApi, getDetailApi } from '@/api/confirmation_form.js' |
| 76 | import Product from './product.vue' | 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 | export default { | 103 | export default { |
| 79 | - name: 'ReplenishmentOrderModify', | ||
| 80 | - components: { Product }, | 104 | + name: 'ConfirmationFormModify', |
| 105 | + components: { Product, SingleSelectSheet }, | ||
| 81 | data() { | 106 | data() { |
| 82 | return { | 107 | return { |
| 83 | form: { | 108 | form: { |
| @@ -102,12 +127,20 @@ export default { | @@ -102,12 +127,20 @@ export default { | ||
| 102 | }, | 127 | }, |
| 103 | initPurchaseOrderLineList: [], | 128 | initPurchaseOrderLineList: [], |
| 104 | maxDeliveryDate: new Date().toISOString().substring(0, 10), | 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 | onLoad(query) { | 139 | onLoad(query) { |
| 108 | const id = (query && (query.id || query.code)) || '' | 140 | const id = (query && (query.id || query.code)) || '' |
| 109 | if (id) { | 141 | if (id) { |
| 110 | this.loadDetail(id) | 142 | this.loadDetail(id) |
| 143 | + this.loadAllDicData() | ||
| 111 | } | 144 | } |
| 112 | }, | 145 | }, |
| 113 | methods: { | 146 | methods: { |
| @@ -118,6 +151,8 @@ export default { | @@ -118,6 +151,8 @@ export default { | ||
| 118 | const next = { ...this.form, ...m } | 151 | const next = { ...this.form, ...m } |
| 119 | // 确保ID存在 | 152 | // 确保ID存在 |
| 120 | next.id = m.id || id | 153 | next.id = m.id || id |
| 154 | + next.sampleQuantityRegulationName = m.sampleQuantityRegulation === true ? '是' : '否' | ||
| 155 | + next.specificationQuantityRegulationName = m.specificationQuantityRegulation === true ? '是' : '否' | ||
| 121 | // 映射列表 | 156 | // 映射列表 |
| 122 | // 注意:详情返回的是 replenishmentOrderLineList,需要赋值给 initPurchaseOrderLineList 以便 Product 组件初始化 | 157 | // 注意:详情返回的是 replenishmentOrderLineList,需要赋值给 initPurchaseOrderLineList 以便 Product 组件初始化 |
| 123 | // 且需要处理字段兼容性,确保 Product 组件能正确显示和编辑 | 158 | // 且需要处理字段兼容性,确保 Product 组件能正确显示和编辑 |
| @@ -137,6 +172,28 @@ export default { | @@ -137,6 +172,28 @@ export default { | ||
| 137 | uni.showToast({ title: '加载失败', icon: 'none' }) | 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 | validateRequired() { | 197 | validateRequired() { |
| 141 | const checks = [ | 198 | const checks = [ |
| 142 | { key: 'purchaseOrderName', label: '订单编号' } | 199 | { key: 'purchaseOrderName', label: '订单编号' } |
| @@ -239,6 +296,38 @@ export default { | @@ -239,6 +296,38 @@ export default { | ||
| 239 | this.form.purchaseOrderLineList = list | 296 | this.form.purchaseOrderLineList = list |
| 240 | this.calculateSummary(list) | 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 | </script> | 333 | </script> |