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,6 +448,8 @@ export default { | ||
| 448 | const c2 = results && results.APPLICABLE_STANDARD && results.APPLICABLE_STANDARD.data ? results.APPLICABLE_STANDARD.data : [] | 448 | const c2 = results && results.APPLICABLE_STANDARD && results.APPLICABLE_STANDARD.data ? results.APPLICABLE_STANDARD.data : [] |
| 449 | const c3 = results && results.CONTRACT_PRODUCT && results.CONTRACT_PRODUCT.data ? results.CONTRACT_PRODUCT.data : [] | 449 | const c3 = results && results.CONTRACT_PRODUCT && results.CONTRACT_PRODUCT.data ? results.CONTRACT_PRODUCT.data : [] |
| 450 | const c4 = results && results.RAW_TO_PROD_RATIO && results.RAW_TO_PROD_RATIO.data ? results.RAW_TO_PROD_RATIO.data : [] | 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 | this.specialTermsList = c1.map(it => ({ label: it.name, value: it.code })) | 453 | this.specialTermsList = c1.map(it => ({ label: it.name, value: it.code })) |
| 452 | this.executionStandardList = c2.map(it => ({ label: it.name, value: it.code })) | 454 | this.executionStandardList = c2.map(it => ({ label: it.name, value: it.code })) |
| 453 | this.productList = c3.map(it => ({ label: it.name, value: it.code })) | 455 | this.productList = c3.map(it => ({ label: it.name, value: it.code })) |
| @@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
| 41 | </template> | 41 | </template> |
| 42 | </uni-list-item> | 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 | <uni-list-item title="合计金额(大写)"> | 46 | <uni-list-item title="合计金额(大写)"> |
| 47 | <template v-slot:footer> | 47 | <template v-slot:footer> |
| @@ -266,6 +266,8 @@ export default { | @@ -266,6 +266,8 @@ export default { | ||
| 266 | productList: [], | 266 | productList: [], |
| 267 | regionOptions: [], | 267 | regionOptions: [], |
| 268 | rawToProdRatioList: [], | 268 | rawToProdRatioList: [], |
| 269 | + rawProductList: [], | ||
| 270 | + rawProductGradeList: [], | ||
| 269 | } | 271 | } |
| 270 | }, | 272 | }, |
| 271 | onLoad(query) { | 273 | onLoad(query) { |
| @@ -383,20 +385,26 @@ export default { | @@ -383,20 +385,26 @@ export default { | ||
| 383 | }, | 385 | }, |
| 384 | async loadExtraOptions() { | 386 | async loadExtraOptions() { |
| 385 | try { | 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 | const c1 = results && results.CONDITIONS_REQUIRED && results.CONDITIONS_REQUIRED.data ? results.CONDITIONS_REQUIRED.data : [] | 389 | const c1 = results && results.CONDITIONS_REQUIRED && results.CONDITIONS_REQUIRED.data ? results.CONDITIONS_REQUIRED.data : [] |
| 388 | const c2 = results && results.APPLICABLE_STANDARD && results.APPLICABLE_STANDARD.data ? results.APPLICABLE_STANDARD.data : [] | 390 | const c2 = results && results.APPLICABLE_STANDARD && results.APPLICABLE_STANDARD.data ? results.APPLICABLE_STANDARD.data : [] |
| 389 | const c3 = results && results.CONTRACT_PRODUCT && results.CONTRACT_PRODUCT.data ? results.CONTRACT_PRODUCT.data : [] | 391 | const c3 = results && results.CONTRACT_PRODUCT && results.CONTRACT_PRODUCT.data ? results.CONTRACT_PRODUCT.data : [] |
| 390 | const c4 = results && results.RAW_TO_PROD_RATIO && results.RAW_TO_PROD_RATIO.data ? results.RAW_TO_PROD_RATIO.data : [] | 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 | this.rawToProdRatioList = c4.map(it => ({ label: it.name, value: it.code })) | 395 | this.rawToProdRatioList = c4.map(it => ({ label: it.name, value: it.code })) |
| 392 | this.specialTermsList = c1.map(it => ({ label: it.name, value: it.code })) | 396 | this.specialTermsList = c1.map(it => ({ label: it.name, value: it.code })) |
| 393 | this.executionStandardList = c2.map(it => ({ label: it.name, value: it.code })) | 397 | this.executionStandardList = c2.map(it => ({ label: it.name, value: it.code })) |
| 394 | this.productList = c3.map(it => ({ label: it.name, value: it.code })) | 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 | } catch (e) { | 401 | } catch (e) { |
| 396 | this.specialTermsList = [] | 402 | this.specialTermsList = [] |
| 397 | this.executionStandardList = [] | 403 | this.executionStandardList = [] |
| 398 | this.productList = [] | 404 | this.productList = [] |
| 399 | this.rawToProdRatioList = [] | 405 | this.rawToProdRatioList = [] |
| 406 | + this.rawProductList = [] | ||
| 407 | + this.rawProductGradeList = [] | ||
| 400 | } | 408 | } |
| 401 | }, | 409 | }, |
| 402 | displayLabel(field) { | 410 | displayLabel(field) { |
| @@ -21,9 +21,9 @@ | @@ -21,9 +21,9 @@ | ||
| 21 | <view class="item-title"><text>原材料名称</text></view> | 21 | <view class="item-title"><text>原材料名称</text></view> |
| 22 | </template> | 22 | </template> |
| 23 | </uni-list-item> | 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 | </template> | 27 | </template> |
| 28 | </uni-list-item> | 28 | </uni-list-item> |
| 29 | <uni-list-item title="行业"> | 29 | <uni-list-item title="行业"> |
| @@ -38,9 +38,9 @@ | @@ -38,9 +38,9 @@ | ||
| 38 | <view class="item-title"><text>原材料名称</text></view> | 38 | <view class="item-title"><text>原材料名称</text></view> |
| 39 | </template> | 39 | </template> |
| 40 | </uni-list-item> | 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 | </template> | 44 | </template> |
| 45 | </uni-list-item> | 45 | </uni-list-item> |
| 46 | <uni-list-item title="行业"> | 46 | <uni-list-item title="行业"> |
| @@ -261,6 +261,12 @@ export default { | @@ -261,6 +261,12 @@ export default { | ||
| 261 | value: o.value != null ? o.value : (o.id != null ? o.id : o.code) | 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 | minDeliveryDate() { | 270 | minDeliveryDate() { |
| 265 | const s = this.deliveryDate | 271 | const s = this.deliveryDate |
| 266 | if (!s) return '' | 272 | if (!s) return '' |
| @@ -411,11 +417,25 @@ export default { | @@ -411,11 +417,25 @@ export default { | ||
| 411 | return [t, w, l].filter(Boolean).join(' × ') | 417 | return [t, w, l].filter(Boolean).join(' × ') |
| 412 | }, | 418 | }, |
| 413 | openProductSheet(idx) { | 419 | openProductSheet(idx) { |
| 414 | - const opts = this.selectOptions | 420 | + const opts = this.rawProductOptions |
| 415 | const current = this.items[idx] && this.items[idx].rawProductId | 421 | const current = this.items[idx] && this.items[idx].rawProductId |
| 416 | const match = opts.find(o => String(o.value) === String(current)) | 422 | const match = opts.find(o => String(o.value) === String(current)) |
| 417 | this.sheet = { ...this.sheet, visible: true, title: '请选择原材料名称', options: opts, idx, value: match ? match.value : '', mode: 'product' } | 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 | openProductTargetSheet(idx) { | 439 | openProductTargetSheet(idx) { |
| 420 | const opts = this.selectOptions | 440 | const opts = this.selectOptions |
| 421 | const current = this.items[idx] && this.items[idx].productId | 441 | const current = this.items[idx] && this.items[idx].productId |
| @@ -436,8 +456,15 @@ export default { | @@ -436,8 +456,15 @@ export default { | ||
| 436 | it.materialProductRatio = value | 456 | it.materialProductRatio = value |
| 437 | it.rawToProdRatioName = label || '' | 457 | it.rawToProdRatioName = label || '' |
| 438 | } else if (this.sheet.mode === 'product') { | 458 | } else if (this.sheet.mode === 'product') { |
| 459 | + if (it.rawProductId !== value) { | ||
| 460 | + it.rawProductGrade = '' | ||
| 461 | + it.rawProductGradeName = '' | ||
| 462 | + } | ||
| 439 | it.rawProductId = value | 463 | it.rawProductId = value |
| 440 | it.rawProductName = label || '' | 464 | it.rawProductName = label || '' |
| 465 | + } else if (this.sheet.mode === 'grade') { | ||
| 466 | + it.rawProductGrade = value | ||
| 467 | + it.rawProductGradeName = label || '' | ||
| 441 | } else if (this.sheet.mode === 'target') { | 468 | } else if (this.sheet.mode === 'target') { |
| 442 | it.productId = value | 469 | it.productId = value |
| 443 | it.productName = label || '' | 470 | it.productName = label || '' |