Showing
2 changed files
with
22 additions
and
3 deletions
| @@ -16,7 +16,8 @@ | @@ -16,7 +16,8 @@ | ||
| 16 | </uni-list-item> | 16 | </uni-list-item> |
| 17 | <uni-list-item title="订货单位"> | 17 | <uni-list-item title="订货单位"> |
| 18 | <template v-slot:footer> | 18 | <template v-slot:footer> |
| 19 | - <view class="readonly-text">{{ form.orderingUnitName }}</view> | 19 | + <uni-easyinput v-if="orderingUnitEditable" v-model="form.orderingUnitName" placeholder="请输入订货单位" :inputBorder="false" /> |
| 20 | + <view v-else class="readonly-text">{{ form.orderingUnitName }}</view> | ||
| 20 | </template> | 21 | </template> |
| 21 | </uni-list-item> | 22 | </uni-list-item> |
| 22 | <uni-list-item title="订货日期"> | 23 | <uni-list-item title="订货日期"> |
| @@ -164,6 +165,7 @@ export default { | @@ -164,6 +165,7 @@ export default { | ||
| 164 | components: { Product, SingleSelectSheet, RelateSelectSheet }, | 165 | components: { Product, SingleSelectSheet, RelateSelectSheet }, |
| 165 | data() { | 166 | data() { |
| 166 | return { | 167 | return { |
| 168 | + orderingUnitEditable: false, | ||
| 167 | form: { | 169 | form: { |
| 168 | orderNo: '', | 170 | orderNo: '', |
| 169 | orderId: '', | 171 | orderId: '', |
| @@ -283,12 +285,14 @@ export default { | @@ -283,12 +285,14 @@ export default { | ||
| 283 | const _fieldKey = this.relate.fieldKey | 285 | const _fieldKey = this.relate.fieldKey |
| 284 | const first = (items && items.length > 0) ? items[0] : null | 286 | const first = (items && items.length > 0) ? items[0] : null |
| 285 | if (_fieldKey === 'orderNo') { | 287 | if (_fieldKey === 'orderNo') { |
| 288 | + this.orderingUnitEditable = false | ||
| 286 | const id = first && (first.id || first.code) | 289 | const id = first && (first.id || first.code) |
| 287 | if (id) { | 290 | if (id) { |
| 288 | try { | 291 | try { |
| 289 | const res = await loadOrderApi([id]) | 292 | const res = await loadOrderApi([id]) |
| 290 | const data = res && res.data ? res.data : null | 293 | const data = res && res.data ? res.data : null |
| 291 | const item = Array.isArray(data) ? (data[0] || {}) : (data || {}) | 294 | const item = Array.isArray(data) ? (data[0] || {}) : (data || {}) |
| 295 | + this.orderingUnitEditable = String(item.status || '') === 'ISSUED' | ||
| 292 | const next = { ...this.form, ...item } | 296 | const next = { ...this.form, ...item } |
| 293 | next.orderNo = next.orderNo || ((first && (first.orderNo || first.code)) || ''); | 297 | next.orderNo = next.orderNo || ((first && (first.orderNo || first.code)) || ''); |
| 294 | next.orderId = next.id || ''; | 298 | next.orderId = next.id || ''; |
| @@ -15,7 +15,8 @@ | @@ -15,7 +15,8 @@ | ||
| 15 | </uni-list-item> | 15 | </uni-list-item> |
| 16 | <uni-list-item title="订货单位"> | 16 | <uni-list-item title="订货单位"> |
| 17 | <template v-slot:footer> | 17 | <template v-slot:footer> |
| 18 | - <view class="readonly-text">{{ form.orderingUnitName }}</view> | 18 | + <uni-easyinput v-if="orderingUnitEditable" v-model="form.orderingUnitName" placeholder="请输入订货单位" :inputBorder="false" /> |
| 19 | + <view v-else class="readonly-text">{{ form.orderingUnitName }}</view> | ||
| 19 | </template> | 20 | </template> |
| 20 | </uni-list-item> | 21 | </uni-list-item> |
| 21 | <uni-list-item title="订货日期"> | 22 | <uni-list-item title="订货日期"> |
| @@ -148,7 +149,7 @@ | @@ -148,7 +149,7 @@ | ||
| 148 | </template> | 149 | </template> |
| 149 | 150 | ||
| 150 | <script> | 151 | <script> |
| 151 | -import { getDetailApi, updateApi } from '@/api/change_list.js' | 152 | +import { getDetailApi, loadOrderApi, updateApi } from '@/api/change_list.js' |
| 152 | import Product from './product.vue' | 153 | import Product from './product.vue' |
| 153 | import SingleSelectSheet from '@/components/single-select/index.vue' | 154 | import SingleSelectSheet from '@/components/single-select/index.vue' |
| 154 | import { getDicName } from '@/utils/dic.js' | 155 | import { getDicName } from '@/utils/dic.js' |
| @@ -160,6 +161,7 @@ export default { | @@ -160,6 +161,7 @@ export default { | ||
| 160 | data() { | 161 | data() { |
| 161 | return { | 162 | return { |
| 162 | id: '', | 163 | id: '', |
| 164 | + orderingUnitEditable: false, | ||
| 163 | form: { | 165 | form: { |
| 164 | orderId: '', | 166 | orderId: '', |
| 165 | purchaseOrderId: '', | 167 | purchaseOrderId: '', |
| @@ -219,6 +221,19 @@ export default { | @@ -219,6 +221,19 @@ export default { | ||
| 219 | })) : [] | 221 | })) : [] |
| 220 | this.form = next; | 222 | this.form = next; |
| 221 | this.initPurchaseOrderLineList = next.purchaseOrderLineList || []; | 223 | this.initPurchaseOrderLineList = next.purchaseOrderLineList || []; |
| 224 | + const oid = next.purchaseOrderId || next.orderId || '' | ||
| 225 | + if (oid) { | ||
| 226 | + try { | ||
| 227 | + const r = await loadOrderApi([oid]) | ||
| 228 | + const data = r && r.data ? r.data : null | ||
| 229 | + const item = Array.isArray(data) ? (data[0] || {}) : (data || {}) | ||
| 230 | + this.orderingUnitEditable = String(item.status || '') === 'ISSUED' | ||
| 231 | + } catch (e) { | ||
| 232 | + this.orderingUnitEditable = false | ||
| 233 | + } | ||
| 234 | + } else { | ||
| 235 | + this.orderingUnitEditable = false | ||
| 236 | + } | ||
| 222 | this.refreshStandardName() | 237 | this.refreshStandardName() |
| 223 | } catch (e) { | 238 | } catch (e) { |
| 224 | uni.showToast({ title: '加载失败', icon: 'none' }) | 239 | uni.showToast({ title: '加载失败', icon: 'none' }) |