Commit 278f1615c08fb57307000b7f8447caf1fdd39b77
1 parent
725d1d3f
feat: 加工标准合同:
1.子表 原材料名称 替换词典 2.原材料排号,改为词典,和前面的原材料联动(startsWith判断)
Showing
3 changed files
with
46 additions
and
9 deletions
| ... | ... | @@ -448,6 +448,8 @@ export default { |
| 448 | 448 | const c2 = results && results.APPLICABLE_STANDARD && results.APPLICABLE_STANDARD.data ? results.APPLICABLE_STANDARD.data : [] |
| 449 | 449 | const c3 = results && results.CONTRACT_PRODUCT && results.CONTRACT_PRODUCT.data ? results.CONTRACT_PRODUCT.data : [] |
| 450 | 450 | const c4 = results && results.RAW_TO_PROD_RATIO && results.RAW_TO_PROD_RATIO.data ? results.RAW_TO_PROD_RATIO.data : [] |
| 451 | + const c5 = results && results.RAW_MATERIAL && results.RAW_MATERIAL.data ? results.RAW_MATERIAL.data : [] | |
| 452 | + const c6 = results && results.RAW_MATERIAL_GRADE && results.RAW_MATERIAL_GRADE.data ? results.RAW_MATERIAL_GRADE.data : [] | |
| 451 | 453 | this.specialTermsList = c1.map(it => ({ label: it.name, value: it.code })) |
| 452 | 454 | this.executionStandardList = c2.map(it => ({ label: it.name, value: it.code })) |
| 453 | 455 | this.productList = c3.map(it => ({ label: it.name, value: it.code })) | ... | ... |
| ... | ... | @@ -41,7 +41,7 @@ |
| 41 | 41 | </template> |
| 42 | 42 | </uni-list-item> |
| 43 | 43 | |
| 44 | - <ProductRel mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" :list="productLineList" @change="onProductsChange" :options="productList" /> | |
| 44 | + <ProductRel mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" :list="productLineList" @change="onProductsChange" :options="productList" :rawProductList="rawProductList" :rawProductGradeList="rawProductGradeList" /> | |
| 45 | 45 | |
| 46 | 46 | <uni-list-item title="合计金额(大写)"> |
| 47 | 47 | <template v-slot:footer> |
| ... | ... | @@ -266,6 +266,8 @@ export default { |
| 266 | 266 | productList: [], |
| 267 | 267 | regionOptions: [], |
| 268 | 268 | rawToProdRatioList: [], |
| 269 | + rawProductList: [], | |
| 270 | + rawProductGradeList: [], | |
| 269 | 271 | } |
| 270 | 272 | }, |
| 271 | 273 | onLoad(query) { |
| ... | ... | @@ -383,20 +385,26 @@ export default { |
| 383 | 385 | }, |
| 384 | 386 | async loadExtraOptions() { |
| 385 | 387 | try { |
| 386 | - const results = await getDicByCodes(['CONDITIONS_REQUIRED', 'APPLICABLE_STANDARD', 'CONTRACT_PRODUCT','RAW_TO_PROD_RATIO']) | |
| 388 | + const results = await getDicByCodes(['CONDITIONS_REQUIRED', 'APPLICABLE_STANDARD', 'CONTRACT_PRODUCT','RAW_TO_PROD_RATIO', 'RAW_MATERIAL', 'RAW_MATERIAL_GRADE']) | |
| 387 | 389 | const c1 = results && results.CONDITIONS_REQUIRED && results.CONDITIONS_REQUIRED.data ? results.CONDITIONS_REQUIRED.data : [] |
| 388 | 390 | const c2 = results && results.APPLICABLE_STANDARD && results.APPLICABLE_STANDARD.data ? results.APPLICABLE_STANDARD.data : [] |
| 389 | 391 | const c3 = results && results.CONTRACT_PRODUCT && results.CONTRACT_PRODUCT.data ? results.CONTRACT_PRODUCT.data : [] |
| 390 | 392 | const c4 = results && results.RAW_TO_PROD_RATIO && results.RAW_TO_PROD_RATIO.data ? results.RAW_TO_PROD_RATIO.data : [] |
| 393 | + const c5 = results && results.RAW_MATERIAL && results.RAW_MATERIAL.data ? results.RAW_MATERIAL.data : [] | |
| 394 | + const c6 = results && results.RAW_MATERIAL_GRADE && results.RAW_MATERIAL_GRADE.data ? results.RAW_MATERIAL_GRADE.data : [] | |
| 391 | 395 | this.rawToProdRatioList = c4.map(it => ({ label: it.name, value: it.code })) |
| 392 | 396 | this.specialTermsList = c1.map(it => ({ label: it.name, value: it.code })) |
| 393 | 397 | this.executionStandardList = c2.map(it => ({ label: it.name, value: it.code })) |
| 394 | 398 | this.productList = c3.map(it => ({ label: it.name, value: it.code })) |
| 399 | + this.rawProductList = c5.map(it => ({ label: it.name, value: it.code })) | |
| 400 | + this.rawProductGradeList = c6.map(it => ({ label: it.name, value: it.code })) | |
| 395 | 401 | } catch (e) { |
| 396 | 402 | this.specialTermsList = [] |
| 397 | 403 | this.executionStandardList = [] |
| 398 | 404 | this.productList = [] |
| 399 | 405 | this.rawToProdRatioList = [] |
| 406 | + this.rawProductList = [] | |
| 407 | + this.rawProductGradeList = [] | |
| 400 | 408 | } |
| 401 | 409 | }, |
| 402 | 410 | displayLabel(field) { | ... | ... |
| ... | ... | @@ -21,9 +21,9 @@ |
| 21 | 21 | <view class="item-title"><text>原材料名称</text></view> |
| 22 | 22 | </template> |
| 23 | 23 | </uni-list-item> |
| 24 | - <uni-list-item title="原材料牌号"> | |
| 25 | - <template v-slot:footer> | |
| 26 | - <uni-easyinput v-model="item.rawProductGrade" :inputBorder="false" placeholder="请输入原材料牌号" /> | |
| 24 | + <uni-list-item class="select-item" :class="item.rawProductGradeName ? 'is-filled' : 'is-empty'" clickable @click="openProductGradeSheet(idx)" :rightText="item.rawProductGradeName || '请选择原材料牌号'" showArrow> | |
| 25 | + <template v-slot:body> | |
| 26 | + <view class="item-title"><text>原材料牌号</text></view> | |
| 27 | 27 | </template> |
| 28 | 28 | </uni-list-item> |
| 29 | 29 | <uni-list-item title="行业"> |
| ... | ... | @@ -38,9 +38,9 @@ |
| 38 | 38 | <view class="item-title"><text>原材料名称</text></view> |
| 39 | 39 | </template> |
| 40 | 40 | </uni-list-item> |
| 41 | - <uni-list-item title="原材料牌号"> | |
| 42 | - <template v-slot:footer> | |
| 43 | - <uni-easyinput v-model="item.rawProductGrade" :inputBorder="false" placeholder="请输入原材料牌号" /> | |
| 41 | + <uni-list-item class="select-item" :class="item.rawProductGradeName ? 'is-filled' : 'is-empty'" clickable @click="openProductGradeSheet(idx)" :rightText="item.rawProductGradeName || '请选择原材料牌号'" showArrow> | |
| 42 | + <template v-slot:body> | |
| 43 | + <view class="item-title"><text>原材料牌号</text></view> | |
| 44 | 44 | </template> |
| 45 | 45 | </uni-list-item> |
| 46 | 46 | <uni-list-item title="行业"> |
| ... | ... | @@ -261,6 +261,12 @@ export default { |
| 261 | 261 | value: o.value != null ? o.value : (o.id != null ? o.id : o.code) |
| 262 | 262 | })) |
| 263 | 263 | }, |
| 264 | + rawProductOptions() { | |
| 265 | + return Array.isArray(this.rawProductList) ? this.rawProductList : [] | |
| 266 | + }, | |
| 267 | + rawProductGradeOptions() { | |
| 268 | + return Array.isArray(this.rawProductGradeList) ? this.rawProductGradeList : [] | |
| 269 | + }, | |
| 264 | 270 | minDeliveryDate() { |
| 265 | 271 | const s = this.deliveryDate |
| 266 | 272 | if (!s) return '' |
| ... | ... | @@ -411,11 +417,25 @@ export default { |
| 411 | 417 | return [t, w, l].filter(Boolean).join(' × ') |
| 412 | 418 | }, |
| 413 | 419 | openProductSheet(idx) { |
| 414 | - const opts = this.selectOptions | |
| 420 | + const opts = this.rawProductOptions | |
| 415 | 421 | const current = this.items[idx] && this.items[idx].rawProductId |
| 416 | 422 | const match = opts.find(o => String(o.value) === String(current)) |
| 417 | 423 | this.sheet = { ...this.sheet, visible: true, title: '请选择原材料名称', options: opts, idx, value: match ? match.value : '', mode: 'product' } |
| 418 | 424 | }, |
| 425 | + openProductGradeSheet(idx) { | |
| 426 | + const it = this.items[idx] | |
| 427 | + if (!it || !it.rawProductId) { | |
| 428 | + uni.showToast({ title: '请先选择原材料名称', icon: 'none' }) | |
| 429 | + return | |
| 430 | + } | |
| 431 | + const opts = this.rawProductGradeOptions.filter(o => { | |
| 432 | + const code = o.value | |
| 433 | + return code && it.rawProductId && String(code).startsWith(String(it.rawProductId)) | |
| 434 | + }) | |
| 435 | + const current = it.rawProductGrade | |
| 436 | + const match = opts.find(o => String(o.value) === String(current)) | |
| 437 | + this.sheet = { ...this.sheet, visible: true, title: '请选择原材料牌号', options: opts, idx, value: match ? match.value : '', mode: 'grade' } | |
| 438 | + }, | |
| 419 | 439 | openProductTargetSheet(idx) { |
| 420 | 440 | const opts = this.selectOptions |
| 421 | 441 | const current = this.items[idx] && this.items[idx].productId |
| ... | ... | @@ -436,8 +456,15 @@ export default { |
| 436 | 456 | it.materialProductRatio = value |
| 437 | 457 | it.rawToProdRatioName = label || '' |
| 438 | 458 | } else if (this.sheet.mode === 'product') { |
| 459 | + if (it.rawProductId !== value) { | |
| 460 | + it.rawProductGrade = '' | |
| 461 | + it.rawProductGradeName = '' | |
| 462 | + } | |
| 439 | 463 | it.rawProductId = value |
| 440 | 464 | it.rawProductName = label || '' |
| 465 | + } else if (this.sheet.mode === 'grade') { | |
| 466 | + it.rawProductGrade = value | |
| 467 | + it.rawProductGradeName = label || '' | |
| 441 | 468 | } else if (this.sheet.mode === 'target') { |
| 442 | 469 | it.productId = value |
| 443 | 470 | it.productName = label || '' | ... | ... |