Commit b7053a1512c63163182ae9177efc37e2e83fdb1f
Merge branch 'cjerp-contract-1.0' of http://gitlab.qgutech.com/zhuyuanliang/erp-…
…mobile into test_cjerp
Showing
19 changed files
with
1183 additions
and
151 deletions
| @@ -86,3 +86,12 @@ export function uploadWarrantyCertificate(params) { | @@ -86,3 +86,12 @@ export function uploadWarrantyCertificate(params) { | ||
| 86 | contentType: ContentTypeEnum.JSON | 86 | contentType: ContentTypeEnum.JSON |
| 87 | }) | 87 | }) |
| 88 | } | 88 | } |
| 89 | + | ||
| 90 | +// 根据ID获取历史生产工艺 | ||
| 91 | +export function getHistoryProductionProcessApi(id) { | ||
| 92 | + return request({ | ||
| 93 | + url: `${baseUrl}/getHistoryProductionProcess`, | ||
| 94 | + method: 'get', | ||
| 95 | + params: { id } | ||
| 96 | + }) | ||
| 97 | +} |
| @@ -230,7 +230,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | @@ -230,7 +230,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 230 | import RelateSelectSheet from '@/components/relate-select/index.vue' | 230 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 231 | import ProductRel from './productRel.vue' | 231 | import ProductRel from './productRel.vue' |
| 232 | import CitySelector from '@/components/city-selector/index.vue' | 232 | import CitySelector from '@/components/city-selector/index.vue' |
| 233 | -import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements,getDeptApi } from '@/api/contract' | 233 | +import { getRetailCodeApi, createContractApi, getCustomerRemarks, getCustomerSpecificQualityRequirements, getDeptApi, getContractApi } from '@/api/contract' |
| 234 | import { getDicByCodes } from '@/utils/dic' | 234 | import { getDicByCodes } from '@/utils/dic' |
| 235 | import { formatCurrencyToChinese } from '@/utils/common' | 235 | import { formatCurrencyToChinese } from '@/utils/common' |
| 236 | import { workshopQueryApi } from '@/api/devManage' | 236 | import { workshopQueryApi } from '@/api/devManage' |
| @@ -242,6 +242,8 @@ export default { | @@ -242,6 +242,8 @@ export default { | ||
| 242 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, | 242 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, |
| 243 | data() { | 243 | data() { |
| 244 | return { | 244 | return { |
| 245 | + copyId: '', | ||
| 246 | + operateType: 'ADD', | ||
| 245 | form: { | 247 | form: { |
| 246 | code: '', | 248 | code: '', |
| 247 | supplier: '', | 249 | supplier: '', |
| @@ -296,13 +298,22 @@ export default { | @@ -296,13 +298,22 @@ export default { | ||
| 296 | regionOptions: [], | 298 | regionOptions: [], |
| 297 | } | 299 | } |
| 298 | }, | 300 | }, |
| 301 | + onLoad(query) { | ||
| 302 | + const copyId = (query && query.copyId) ? String(query.copyId) : '' | ||
| 303 | + this.copyId = copyId | ||
| 304 | + this.operateType = copyId ? 'COPY' : 'ADD' | ||
| 305 | + uni.setNavigationBarTitle({ | ||
| 306 | + title: copyId ? '复制外贸标准合同' : '新增外贸标准合同' | ||
| 307 | + }) | ||
| 308 | + }, | ||
| 299 | created() { | 309 | created() { |
| 300 | this.loadSuppliers() | 310 | this.loadSuppliers() |
| 301 | this.loadExtraOptions() | 311 | this.loadExtraOptions() |
| 302 | this.initCode() | 312 | this.initCode() |
| 303 | this.getDept() | 313 | this.getDept() |
| 304 | this.loadRegionOptions() | 314 | this.loadRegionOptions() |
| 305 | - this.form.orderDate = this.formatDate(new Date()) | 315 | + if (!this.copyId) this.form.orderDate = this.formatDate(new Date()) |
| 316 | + if (this.copyId) this.loadCopyDetail(this.copyId) | ||
| 306 | this.$nextTick(() => { | 317 | this.$nextTick(() => { |
| 307 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { | 318 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { |
| 308 | this.initDestinationLabel() | 319 | this.initDestinationLabel() |
| @@ -351,6 +362,83 @@ export default { | @@ -351,6 +362,83 @@ export default { | ||
| 351 | }, | 362 | }, |
| 352 | }, | 363 | }, |
| 353 | methods: { | 364 | methods: { |
| 365 | + async loadCopyDetail(id) { | ||
| 366 | + const rid = (id !== undefined && id !== null) ? String(id) : '' | ||
| 367 | + if (!rid) return | ||
| 368 | + try { | ||
| 369 | + const res = await getContractApi(rid) | ||
| 370 | + const data = res && res.data ? res.data : {} | ||
| 371 | + const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') | ||
| 372 | + const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') | ||
| 373 | + const m = { ...data, includesPackagingFeeName, includesTransportFeeName } | ||
| 374 | + | ||
| 375 | + const code = this.form.code | ||
| 376 | + this.form = { | ||
| 377 | + ...this.form, | ||
| 378 | + supplier: m.supplier || '', | ||
| 379 | + supplierName: m.supplierName || '', | ||
| 380 | + buyer: m.buyer || (m.customer && m.customer.id) || '', | ||
| 381 | + buyerName: m.buyerName || (m.customer && m.customer.name) || '', | ||
| 382 | + stockUpCompanyId: m.stockUpCompanyId || '', | ||
| 383 | + stockUpCompanyName: m.stockUpCompanyName || '', | ||
| 384 | + deptName: m.deptName || this.form.deptName, | ||
| 385 | + deptId: m.deptId || this.form.deptId, | ||
| 386 | + region: m.region || '', | ||
| 387 | + regionName: m.regionName || '', | ||
| 388 | + orderDate: m.orderDate || this.form.orderDate, | ||
| 389 | + deliveryDate: m.deliveryDate || '', | ||
| 390 | + designatedConsignee: m.designatedConsignee || '', | ||
| 391 | + specialTerms: m.specialTerms || '', | ||
| 392 | + specialTermsName: m.specialTermsName || '', | ||
| 393 | + executionStandard: m.executionStandard || '', | ||
| 394 | + executionStandardName: m.executionStandardName || '', | ||
| 395 | + executionStandardRemarks: m.executionStandardRemarks || '', | ||
| 396 | + includesPackagingFee: !!m.includesPackagingFee, | ||
| 397 | + includesPackagingFeeName, | ||
| 398 | + includesTransportFee: !!m.includesTransportFee, | ||
| 399 | + includesTransportFeeName, | ||
| 400 | + unit: m.unit || this.form.unit, | ||
| 401 | + totalAmountCapital: m.totalAmountCapital || '', | ||
| 402 | + depositInfo: m.depositInfo || '', | ||
| 403 | + packagingRequirements: m.packagingRequirements || '', | ||
| 404 | + paymentTerms: m.paymentTerms || '', | ||
| 405 | + transportMode: m.transportMode || '', | ||
| 406 | + destinationId: (m.provinceId && m.cityId && m.districtId) ? [m.provinceId, m.cityId, m.districtId] : (Array.isArray(m.destinationId) ? m.destinationId : []), | ||
| 407 | + destinationLabel: (m.provinceName && m.cityName && m.districtName) ? `${m.provinceName} / ${m.cityName} / ${m.districtName}` : (m.destinationLabel || ''), | ||
| 408 | + specialInstructions: m.specialInstructions || '', | ||
| 409 | + remarks: m.remarks || '', | ||
| 410 | + pieceWeightHead: m.pieceWeightHead || '', | ||
| 411 | + surface: m.surface || '', | ||
| 412 | + tolerance: m.tolerance || '', | ||
| 413 | + performance: m.performance || '', | ||
| 414 | + component: m.component || '', | ||
| 415 | + packaging: m.packaging || '', | ||
| 416 | + workshopId: m.workshopId || '', | ||
| 417 | + workshopIdName: m.workshopName || m.workshopIdName || '', | ||
| 418 | + code, | ||
| 419 | + } | ||
| 420 | + | ||
| 421 | + const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : [] | ||
| 422 | + await this.$nextTick() | ||
| 423 | + const comp = this.$refs.productRel | ||
| 424 | + if (comp && typeof comp.defaultItem === 'function') { | ||
| 425 | + const nextItems = (lines.length ? lines : [{}]).map(x => ({ | ||
| 426 | + ...comp.defaultItem(), | ||
| 427 | + ...x, | ||
| 428 | + sampleOrder: !!x.sampleOrder, | ||
| 429 | + collapsed: true | ||
| 430 | + })) | ||
| 431 | + if (!lines.length && nextItems[0]) nextItems[0].collapsed = false | ||
| 432 | + comp.items = nextItems | ||
| 433 | + if (typeof comp.recalculateAll === 'function') comp.recalculateAll() | ||
| 434 | + if (typeof comp.emitChange === 'function') comp.emitChange() | ||
| 435 | + } else { | ||
| 436 | + this.onProductsChange(lines) | ||
| 437 | + } | ||
| 438 | + } catch (e) { | ||
| 439 | + uni.showToast({ title: '复制失败,请稍后重试', icon: 'none' }) | ||
| 440 | + } | ||
| 441 | + }, | ||
| 354 | async loadRegionOptions() { | 442 | async loadRegionOptions() { |
| 355 | try { | 443 | try { |
| 356 | const res = await getArea() | 444 | const res = await getArea() |
| @@ -554,8 +642,9 @@ export default { | @@ -554,8 +642,9 @@ export default { | ||
| 554 | }, | 642 | }, |
| 555 | async onSubmit() { | 643 | async onSubmit() { |
| 556 | if (!this.validateRequired()) return | 644 | if (!this.validateRequired()) return |
| 645 | + const isCopy = !!this.copyId | ||
| 557 | const confirmRes = await new Promise(resolve => { | 646 | const confirmRes = await new Promise(resolve => { |
| 558 | - uni.showModal({ title: '提示', content: '确定新增外贸标准合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) | 647 | + uni.showModal({ title: '提示', content: isCopy ? '确定复制外贸标准合同吗?' : '确定新增外贸标准合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) |
| 559 | }) | 648 | }) |
| 560 | if (!(confirmRes && confirmRes.confirm)) return | 649 | if (!(confirmRes && confirmRes.confirm)) return |
| 561 | const clean = (obj) => { | 650 | const clean = (obj) => { |
| @@ -575,6 +664,7 @@ export default { | @@ -575,6 +664,7 @@ export default { | ||
| 575 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; | 664 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; |
| 576 | const payload = clean({ | 665 | const payload = clean({ |
| 577 | ...formForSubmit, | 666 | ...formForSubmit, |
| 667 | + operateType: isCopy ? 'COPY' : 'ADD', | ||
| 578 | destination, | 668 | destination, |
| 579 | type: 'INTL_STD_CONTRACT', | 669 | type: 'INTL_STD_CONTRACT', |
| 580 | totalQuantity: this.totalQuantity, | 670 | totalQuantity: this.totalQuantity, |
| @@ -586,10 +676,10 @@ export default { | @@ -586,10 +676,10 @@ export default { | ||
| 586 | 676 | ||
| 587 | try { | 677 | try { |
| 588 | await createContractApi(payload) | 678 | await createContractApi(payload) |
| 589 | - uni.showToast({ title: '新增成功', icon: 'none' }) | 679 | + uni.showToast({ title: isCopy ? '复制成功' : '新增成功', icon: 'none' }) |
| 590 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_foreign_std/index' }) }, 400) | 680 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_foreign_std/index' }) }, 400) |
| 591 | } catch (e) { | 681 | } catch (e) { |
| 592 | - uni.showToast({ title: e.msg ||'提交失败', icon: 'none' }) | 682 | + uni.showToast({ title: e.msg || (isCopy ? '复制失败' : '提交失败'), icon: 'none' }) |
| 593 | } | 683 | } |
| 594 | }, | 684 | }, |
| 595 | validateRequired() { | 685 | validateRequired() { |
| @@ -219,6 +219,12 @@ export default { | @@ -219,6 +219,12 @@ export default { | ||
| 219 | visible: true, | 219 | visible: true, |
| 220 | event: 'auditDetail' | 220 | event: 'auditDetail' |
| 221 | }, | 221 | }, |
| 222 | + { | ||
| 223 | + text: '复制', | ||
| 224 | + visible: true, | ||
| 225 | + variant: 'outline', | ||
| 226 | + event: 'copy' | ||
| 227 | + }, | ||
| 222 | ], | 228 | ], |
| 223 | } | 229 | } |
| 224 | }, | 230 | }, |
| @@ -234,6 +240,7 @@ export default { | @@ -234,6 +240,7 @@ export default { | ||
| 234 | { ...this.buttons[3], visible: (s === 'STANDARD' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:upload-seal')) }, | 240 | { ...this.buttons[3], visible: (s === 'STANDARD' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:upload-seal')) }, |
| 235 | { ...this.buttons[5], visible: (s === 'STANDARD' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:review')) }, | 241 | { ...this.buttons[5], visible: (s === 'STANDARD' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:review')) }, |
| 236 | { ...this.buttons[4], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:approve')) }, | 242 | { ...this.buttons[4], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:approve')) }, |
| 243 | + { ...this.buttons[6], visible: (s !== 'DELETED' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:copy')) }, | ||
| 237 | ] | 244 | ] |
| 238 | } | 245 | } |
| 239 | }, | 246 | }, |
| @@ -363,10 +370,21 @@ export default { | @@ -363,10 +370,21 @@ export default { | ||
| 363 | if (e === 'uploadSeal') return this.uploadContract(this.detail.id || '', 'seal') | 370 | if (e === 'uploadSeal') return this.uploadContract(this.detail.id || '', 'seal') |
| 364 | if (e === 'audit') return this.onAudit(btn && btn.params) | 371 | if (e === 'audit') return this.onAudit(btn && btn.params) |
| 365 | if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params) | 372 | if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params) |
| 373 | + if (e === 'copy') return this.onCopy(btn && btn.params) | ||
| 366 | }, | 374 | }, |
| 367 | getBusinessId() { | 375 | getBusinessId() { |
| 368 | return (this.detail && (this.detail.id || this.detail.code)) || '' | 376 | return (this.detail && (this.detail.id || this.detail.code)) || '' |
| 369 | }, | 377 | }, |
| 378 | + onCopy() { | ||
| 379 | + const id = this.getBusinessId() | ||
| 380 | + if (!id) { | ||
| 381 | + uni.showToast({ title: '未获取到合同ID,无法复制', icon: 'none' }) | ||
| 382 | + return | ||
| 383 | + } | ||
| 384 | + uni.navigateTo({ | ||
| 385 | + url: '/pages/contract_foreign_std/add?copyId=' + encodeURIComponent(id) | ||
| 386 | + }) | ||
| 387 | + }, | ||
| 370 | onAudit() { | 388 | onAudit() { |
| 371 | const CACHE_KEY = 'sourceBusinessId' | 389 | const CACHE_KEY = 'sourceBusinessId' |
| 372 | uni.setStorageSync(CACHE_KEY, this.getBusinessId()) | 390 | uni.setStorageSync(CACHE_KEY, this.getBusinessId()) |
| @@ -566,4 +584,4 @@ export default { | @@ -566,4 +584,4 @@ export default { | ||
| 566 | .upload-row { | 584 | .upload-row { |
| 567 | margin-top: 20rpx; | 585 | margin-top: 20rpx; |
| 568 | } | 586 | } |
| 569 | -</style> | ||
| 587 | +</style> |
| @@ -233,7 +233,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | @@ -233,7 +233,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 233 | import RelateSelectSheet from '@/components/relate-select/index.vue' | 233 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 234 | import ProductRel from './productRel.vue' | 234 | import ProductRel from './productRel.vue' |
| 235 | import CitySelector from '@/components/city-selector/index.vue' | 235 | import CitySelector from '@/components/city-selector/index.vue' |
| 236 | -import { getRetailCodeApi, createContractApi, getCustomerSpecificQualityRequirements,getCustomerRemarks, getDeptApi } from '@/api/contract' | 236 | +import { getRetailCodeApi, createContractApi, getCustomerSpecificQualityRequirements, getCustomerRemarks, getDeptApi, getContractApi } from '@/api/contract' |
| 237 | import { getDicByCodes } from '@/utils/dic' | 237 | import { getDicByCodes } from '@/utils/dic' |
| 238 | import { formatCurrencyToChinese } from '@/utils/common' | 238 | import { formatCurrencyToChinese } from '@/utils/common' |
| 239 | import { workshopQueryApi } from '@/api/devManage' | 239 | import { workshopQueryApi } from '@/api/devManage' |
| @@ -244,6 +244,8 @@ export default { | @@ -244,6 +244,8 @@ export default { | ||
| 244 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, | 244 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, |
| 245 | data() { | 245 | data() { |
| 246 | return { | 246 | return { |
| 247 | + copyId: '', | ||
| 248 | + operateType: 'ADD', | ||
| 247 | form: { | 249 | form: { |
| 248 | code: '', | 250 | code: '', |
| 249 | supplier: '', | 251 | supplier: '', |
| @@ -298,13 +300,22 @@ export default { | @@ -298,13 +300,22 @@ export default { | ||
| 298 | regionOptions: [], | 300 | regionOptions: [], |
| 299 | } | 301 | } |
| 300 | }, | 302 | }, |
| 303 | + onLoad(query) { | ||
| 304 | + const copyId = (query && query.copyId) ? String(query.copyId) : '' | ||
| 305 | + this.copyId = copyId | ||
| 306 | + this.operateType = copyId ? 'COPY' : 'ADD' | ||
| 307 | + uni.setNavigationBarTitle({ | ||
| 308 | + title: copyId ? '复制外贸库存合同' : '新增外贸库存合同' | ||
| 309 | + }) | ||
| 310 | + }, | ||
| 301 | created() { | 311 | created() { |
| 302 | this.loadSuppliers() | 312 | this.loadSuppliers() |
| 303 | this.loadExtraOptions() | 313 | this.loadExtraOptions() |
| 304 | this.initCode() | 314 | this.initCode() |
| 305 | this.getDept() | 315 | this.getDept() |
| 306 | this.loadRegionOptions() | 316 | this.loadRegionOptions() |
| 307 | - this.form.orderDate = this.formatDate(new Date()) | 317 | + if (!this.copyId) this.form.orderDate = this.formatDate(new Date()) |
| 318 | + if (this.copyId) this.loadCopyDetail(this.copyId) | ||
| 308 | this.$nextTick(() => { | 319 | this.$nextTick(() => { |
| 309 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { | 320 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { |
| 310 | this.initDestinationLabel() | 321 | this.initDestinationLabel() |
| @@ -353,6 +364,82 @@ export default { | @@ -353,6 +364,82 @@ export default { | ||
| 353 | }, | 364 | }, |
| 354 | }, | 365 | }, |
| 355 | methods: { | 366 | methods: { |
| 367 | + async loadCopyDetail(id) { | ||
| 368 | + const rid = (id !== undefined && id !== null) ? String(id) : '' | ||
| 369 | + if (!rid) return | ||
| 370 | + try { | ||
| 371 | + const res = await getContractApi(rid) | ||
| 372 | + const data = res && res.data ? res.data : {} | ||
| 373 | + const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') | ||
| 374 | + const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') | ||
| 375 | + const m = { ...data, includesPackagingFeeName, includesTransportFeeName } | ||
| 376 | + | ||
| 377 | + const code = this.form.code | ||
| 378 | + this.form = { | ||
| 379 | + ...this.form, | ||
| 380 | + supplier: m.supplier || '', | ||
| 381 | + supplierName: m.supplierName || '', | ||
| 382 | + buyer: m.buyer || (m.customer && m.customer.id) || '', | ||
| 383 | + buyerName: m.buyerName || (m.customer && m.customer.name) || '', | ||
| 384 | + stockUpCompanyId: m.stockUpCompanyId || '', | ||
| 385 | + stockUpCompanyName: m.stockUpCompanyName || '', | ||
| 386 | + deptName: m.deptName || this.form.deptName, | ||
| 387 | + deptId: m.deptId || this.form.deptId, | ||
| 388 | + region: m.region || '', | ||
| 389 | + regionName: m.regionName || '', | ||
| 390 | + orderDate: m.orderDate || this.form.orderDate, | ||
| 391 | + deliveryDate: m.deliveryDate || '', | ||
| 392 | + designatedConsignee: m.designatedConsignee || '', | ||
| 393 | + specialTerms: m.specialTerms || '', | ||
| 394 | + specialTermsName: m.specialTermsName || '', | ||
| 395 | + executionStandard: m.executionStandard || '', | ||
| 396 | + executionStandardName: m.executionStandardName || '', | ||
| 397 | + executionStandardRemarks: m.executionStandardRemarks || '', | ||
| 398 | + includesPackagingFee: !!m.includesPackagingFee, | ||
| 399 | + includesPackagingFeeName, | ||
| 400 | + includesTransportFee: !!m.includesTransportFee, | ||
| 401 | + includesTransportFeeName, | ||
| 402 | + unit: m.unit || this.form.unit, | ||
| 403 | + totalAmountCapital: m.totalAmountCapital || '', | ||
| 404 | + depositInfo: m.depositInfo || '', | ||
| 405 | + packagingRequirements: m.packagingRequirements || '', | ||
| 406 | + paymentTerms: m.paymentTerms || '', | ||
| 407 | + transportMode: m.transportMode || '', | ||
| 408 | + destinationId: (m.provinceId && m.cityId && m.districtId) ? [m.provinceId, m.cityId, m.districtId] : (Array.isArray(m.destinationId) ? m.destinationId : []), | ||
| 409 | + destinationLabel: (m.provinceName && m.cityName && m.districtName) ? `${m.provinceName} / ${m.cityName} / ${m.districtName}` : (m.destinationLabel || ''), | ||
| 410 | + specialInstructions: m.specialInstructions || '', | ||
| 411 | + remarks: m.remarks || '', | ||
| 412 | + packaging: m.packaging || '', | ||
| 413 | + performance: m.performance || '', | ||
| 414 | + pieceWeightHead: m.pieceWeightHead || '', | ||
| 415 | + surface: m.surface || '', | ||
| 416 | + tolerance: m.tolerance || '', | ||
| 417 | + workshopId: m.workshopId || '', | ||
| 418 | + workshopIdName: m.workshopName || m.workshopIdName || '', | ||
| 419 | + code, | ||
| 420 | + } | ||
| 421 | + | ||
| 422 | + const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : [] | ||
| 423 | + await this.$nextTick() | ||
| 424 | + const comp = this.$refs.productRel | ||
| 425 | + if (comp && typeof comp.defaultItem === 'function') { | ||
| 426 | + const nextItems = (lines.length ? lines : [{}]).map(x => ({ | ||
| 427 | + ...comp.defaultItem(), | ||
| 428 | + ...x, | ||
| 429 | + sampleOrder: !!x.sampleOrder, | ||
| 430 | + collapsed: true | ||
| 431 | + })) | ||
| 432 | + if (!lines.length && nextItems[0]) nextItems[0].collapsed = false | ||
| 433 | + comp.items = nextItems | ||
| 434 | + if (typeof comp.recalculateAll === 'function') comp.recalculateAll() | ||
| 435 | + if (typeof comp.emitChange === 'function') comp.emitChange() | ||
| 436 | + } else { | ||
| 437 | + this.onProductsChange(lines) | ||
| 438 | + } | ||
| 439 | + } catch (e) { | ||
| 440 | + uni.showToast({ title: '复制失败,请稍后重试', icon: 'none' }) | ||
| 441 | + } | ||
| 442 | + }, | ||
| 356 | async loadRegionOptions() { | 443 | async loadRegionOptions() { |
| 357 | try { | 444 | try { |
| 358 | const res = await getArea() | 445 | const res = await getArea() |
| @@ -558,8 +645,9 @@ export default { | @@ -558,8 +645,9 @@ export default { | ||
| 558 | }, | 645 | }, |
| 559 | async onSubmit() { | 646 | async onSubmit() { |
| 560 | if (!this.validateRequired()) return | 647 | if (!this.validateRequired()) return |
| 648 | + const isCopy = !!this.copyId | ||
| 561 | const confirmRes = await new Promise(resolve => { | 649 | const confirmRes = await new Promise(resolve => { |
| 562 | - uni.showModal({ title: '提示', content: '确定新增外贸库存合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) | 650 | + uni.showModal({ title: '提示', content: isCopy ? '确定复制外贸库存合同吗?' : '确定新增外贸库存合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) |
| 563 | }) | 651 | }) |
| 564 | if (!(confirmRes && confirmRes.confirm)) return | 652 | if (!(confirmRes && confirmRes.confirm)) return |
| 565 | const clean = (obj) => { | 653 | const clean = (obj) => { |
| @@ -579,6 +667,7 @@ export default { | @@ -579,6 +667,7 @@ export default { | ||
| 579 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; | 667 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; |
| 580 | const payload = clean({ | 668 | const payload = clean({ |
| 581 | ...formForSubmit, | 669 | ...formForSubmit, |
| 670 | + operateType: isCopy ? 'COPY' : 'ADD', | ||
| 582 | destination, | 671 | destination, |
| 583 | type: 'INTL_INVENTORY_AGMT', | 672 | type: 'INTL_INVENTORY_AGMT', |
| 584 | totalQuantity: this.totalQuantity, | 673 | totalQuantity: this.totalQuantity, |
| @@ -590,10 +679,10 @@ export default { | @@ -590,10 +679,10 @@ export default { | ||
| 590 | 679 | ||
| 591 | try { | 680 | try { |
| 592 | await createContractApi(payload) | 681 | await createContractApi(payload) |
| 593 | - uni.showToast({ title: '新增成功', icon: 'none' }) | 682 | + uni.showToast({ title: isCopy ? '复制成功' : '新增成功', icon: 'none' }) |
| 594 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_foreign_stock/index' }) }, 400) | 683 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_foreign_stock/index' }) }, 400) |
| 595 | } catch (e) { | 684 | } catch (e) { |
| 596 | - uni.showToast({ title: e.msg ||'提交失败', icon: 'none' }) | 685 | + uni.showToast({ title: e.msg || (isCopy ? '复制失败' : '提交失败'), icon: 'none' }) |
| 597 | } | 686 | } |
| 598 | }, | 687 | }, |
| 599 | validateRequired() { | 688 | validateRequired() { |
| @@ -279,6 +279,12 @@ export default { | @@ -279,6 +279,12 @@ export default { | ||
| 279 | variant: 'outline', | 279 | variant: 'outline', |
| 280 | event: 'uploadSeal' | 280 | event: 'uploadSeal' |
| 281 | }, | 281 | }, |
| 282 | + { | ||
| 283 | + text: '复制', | ||
| 284 | + visible: true, | ||
| 285 | + variant: 'outline', | ||
| 286 | + event: 'copy' | ||
| 287 | + }, | ||
| 282 | ], | 288 | ], |
| 283 | } | 289 | } |
| 284 | }, | 290 | }, |
| @@ -304,6 +310,7 @@ export default { | @@ -304,6 +310,7 @@ export default { | ||
| 304 | { ...this.buttons[6], visible: (s === 'FORMAL' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-inventory-contract:approve')) }, | 310 | { ...this.buttons[6], visible: (s === 'FORMAL' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-inventory-contract:approve')) }, |
| 305 | { ...this.buttons[7], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-inventory-contract:approve')) }, | 311 | { ...this.buttons[7], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-inventory-contract:approve')) }, |
| 306 | { ...this.buttons[8], visible: (s === 'STANDARD' && f && a === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-inventory-contract:standard-approve')) }, | 312 | { ...this.buttons[8], visible: (s === 'STANDARD' && f && a === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-inventory-contract:standard-approve')) }, |
| 313 | + { ...this.buttons[13], visible: (s !== 'DELETED' && this.$auth.hasPermi('contract-manage:foreign-trade-inventory-contract:copy')) }, | ||
| 307 | ] | 314 | ] |
| 308 | } | 315 | } |
| 309 | }, | 316 | }, |
| @@ -451,8 +458,22 @@ export default { | @@ -451,8 +458,22 @@ export default { | ||
| 451 | if (e === 'auditDetail2') return this.onAuditDetail(this.detail.parentId || '', 'FORMAL_CONTRACT') | 458 | if (e === 'auditDetail2') return this.onAuditDetail(this.detail.parentId || '', 'FORMAL_CONTRACT') |
| 452 | if (e === 'auditDetail3') return this.onAuditDetail(this.detail.id || '', 'STANDARD_CONTRACT') | 459 | if (e === 'auditDetail3') return this.onAuditDetail(this.detail.id || '', 'STANDARD_CONTRACT') |
| 453 | if (e === 'uploadSeal') return this.uploadContract(this.detail.id || '', 'seal') | 460 | if (e === 'uploadSeal') return this.uploadContract(this.detail.id || '', 'seal') |
| 461 | + if (e === 'copy') return this.onCopy(btn && btn.params) | ||
| 454 | 462 | ||
| 455 | }, | 463 | }, |
| 464 | + getBusinessId() { | ||
| 465 | + return (this.detail && (this.detail.id || this.detail.code)) || '' | ||
| 466 | + }, | ||
| 467 | + onCopy() { | ||
| 468 | + const id = this.getBusinessId() | ||
| 469 | + if (!id) { | ||
| 470 | + uni.showToast({ title: '未获取到合同ID,无法复制', icon: 'none' }) | ||
| 471 | + return | ||
| 472 | + } | ||
| 473 | + uni.navigateTo({ | ||
| 474 | + url: '/pages/contract_foreign_stock/add?copyId=' + encodeURIComponent(id) | ||
| 475 | + }) | ||
| 476 | + }, | ||
| 456 | onAudit(id, type) { | 477 | onAudit(id, type) { |
| 457 | const CACHE_KEY = 'sourceBusinessId' | 478 | const CACHE_KEY = 'sourceBusinessId' |
| 458 | const TYPE = 'contractType' | 479 | const TYPE = 'contractType' |
| @@ -655,4 +676,4 @@ export default { | @@ -655,4 +676,4 @@ export default { | ||
| 655 | .upload-row { | 676 | .upload-row { |
| 656 | margin-top: 20rpx; | 677 | margin-top: 20rpx; |
| 657 | } | 678 | } |
| 658 | -</style> | ||
| 679 | +</style> |
| @@ -231,7 +231,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | @@ -231,7 +231,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 231 | import RelateSelectSheet from '@/components/relate-select/index.vue' | 231 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 232 | import ProductRel from './productRel.vue' | 232 | import ProductRel from './productRel.vue' |
| 233 | import CitySelector from '@/components/city-selector/index.vue' | 233 | import CitySelector from '@/components/city-selector/index.vue' |
| 234 | -import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements, getDeptApi } from '@/api/contract' | 234 | +import { getRetailCodeApi, createContractApi, getCustomerRemarks, getCustomerSpecificQualityRequirements, getDeptApi, getContractApi } from '@/api/contract' |
| 235 | import { getDicByCodes } from '@/utils/dic' | 235 | import { getDicByCodes } from '@/utils/dic' |
| 236 | import { formatCurrencyToChinese } from '@/utils/common' | 236 | import { formatCurrencyToChinese } from '@/utils/common' |
| 237 | import { workshopQueryApi } from '@/api/devManage' | 237 | import { workshopQueryApi } from '@/api/devManage' |
| @@ -242,6 +242,8 @@ export default { | @@ -242,6 +242,8 @@ export default { | ||
| 242 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, | 242 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, |
| 243 | data() { | 243 | data() { |
| 244 | return { | 244 | return { |
| 245 | + copyId: '', | ||
| 246 | + operateType: 'ADD', | ||
| 245 | form: { | 247 | form: { |
| 246 | code: '', | 248 | code: '', |
| 247 | supplier: '', | 249 | supplier: '', |
| @@ -296,13 +298,22 @@ export default { | @@ -296,13 +298,22 @@ export default { | ||
| 296 | regionOptions: [], | 298 | regionOptions: [], |
| 297 | } | 299 | } |
| 298 | }, | 300 | }, |
| 301 | + onLoad(query) { | ||
| 302 | + const copyId = (query && query.copyId) ? String(query.copyId) : '' | ||
| 303 | + this.copyId = copyId | ||
| 304 | + this.operateType = copyId ? 'COPY' : 'ADD' | ||
| 305 | + uni.setNavigationBarTitle({ | ||
| 306 | + title: copyId ? '复制外贸未锁规合同' : '新增外贸未锁规合同' | ||
| 307 | + }) | ||
| 308 | + }, | ||
| 299 | created() { | 309 | created() { |
| 300 | this.loadSuppliers() | 310 | this.loadSuppliers() |
| 301 | this.loadExtraOptions() | 311 | this.loadExtraOptions() |
| 302 | this.initCode() | 312 | this.initCode() |
| 303 | this.getDept() | 313 | this.getDept() |
| 304 | this.loadRegionOptions() | 314 | this.loadRegionOptions() |
| 305 | - this.form.orderDate = this.formatDate(new Date()) | 315 | + if (!this.copyId) this.form.orderDate = this.formatDate(new Date()) |
| 316 | + if (this.copyId) this.loadCopyDetail(this.copyId) | ||
| 306 | this.$nextTick(() => { | 317 | this.$nextTick(() => { |
| 307 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { | 318 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { |
| 308 | this.initDestinationLabel() | 319 | this.initDestinationLabel() |
| @@ -350,6 +361,83 @@ export default { | @@ -350,6 +361,83 @@ export default { | ||
| 350 | }, | 361 | }, |
| 351 | }, | 362 | }, |
| 352 | methods: { | 363 | methods: { |
| 364 | + async loadCopyDetail(id) { | ||
| 365 | + const rid = (id !== undefined && id !== null) ? String(id) : '' | ||
| 366 | + if (!rid) return | ||
| 367 | + try { | ||
| 368 | + const res = await getContractApi(rid) | ||
| 369 | + const data = res && res.data ? res.data : {} | ||
| 370 | + const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') | ||
| 371 | + const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') | ||
| 372 | + const m = { ...data, includesPackagingFeeName, includesTransportFeeName } | ||
| 373 | + | ||
| 374 | + const code = this.form.code | ||
| 375 | + this.form = { | ||
| 376 | + ...this.form, | ||
| 377 | + supplier: m.supplier || '', | ||
| 378 | + supplierName: m.supplierName || '', | ||
| 379 | + buyer: m.buyer || (m.customer && m.customer.id) || '', | ||
| 380 | + buyerName: m.buyerName || (m.customer && m.customer.name) || '', | ||
| 381 | + stockUpCompanyId: m.stockUpCompanyId || '', | ||
| 382 | + stockUpCompanyName: m.stockUpCompanyName || '', | ||
| 383 | + deptName: m.deptName || this.form.deptName, | ||
| 384 | + deptId: m.deptId || this.form.deptId, | ||
| 385 | + region: m.region || '', | ||
| 386 | + regionName: m.regionName || '', | ||
| 387 | + orderDate: m.orderDate || this.form.orderDate, | ||
| 388 | + deliveryDate: m.deliveryDate || '', | ||
| 389 | + designatedConsignee: m.designatedConsignee || '', | ||
| 390 | + specialTerms: m.specialTerms || '', | ||
| 391 | + specialTermsName: m.specialTermsName || '', | ||
| 392 | + executionStandard: m.executionStandard || '', | ||
| 393 | + executionStandardName: m.executionStandardName || '', | ||
| 394 | + executionStandardRemarks: m.executionStandardRemarks || '', | ||
| 395 | + includesPackagingFee: !!m.includesPackagingFee, | ||
| 396 | + includesPackagingFeeName, | ||
| 397 | + includesTransportFee: !!m.includesTransportFee, | ||
| 398 | + includesTransportFeeName, | ||
| 399 | + unit: m.unit || this.form.unit, | ||
| 400 | + totalAmountCapital: m.totalAmountCapital || '', | ||
| 401 | + depositInfo: m.depositInfo || '', | ||
| 402 | + packagingRequirements: m.packagingRequirements || '', | ||
| 403 | + paymentTerms: m.paymentTerms || '', | ||
| 404 | + transportMode: m.transportMode || '', | ||
| 405 | + destinationId: (m.provinceId && m.cityId && m.districtId) ? [m.provinceId, m.cityId, m.districtId] : (Array.isArray(m.destinationId) ? m.destinationId : []), | ||
| 406 | + destinationLabel: (m.provinceName && m.cityName && m.districtName) ? `${m.provinceName} / ${m.cityName} / ${m.districtName}` : (m.destinationLabel || ''), | ||
| 407 | + specialInstructions: m.specialInstructions || '', | ||
| 408 | + remarks: m.remarks || '', | ||
| 409 | + pieceWeightHead: m.pieceWeightHead || '', | ||
| 410 | + surface: m.surface || '', | ||
| 411 | + tolerance: m.tolerance || '', | ||
| 412 | + performance: m.performance || '', | ||
| 413 | + component: m.component || '', | ||
| 414 | + packaging: m.packaging || '', | ||
| 415 | + workshopId: m.workshopId || '', | ||
| 416 | + workshopIdName: m.workshopName || m.workshopIdName || '', | ||
| 417 | + code, | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : [] | ||
| 421 | + await this.$nextTick() | ||
| 422 | + const comp = this.$refs.productRel | ||
| 423 | + if (comp && typeof comp.defaultItem === 'function') { | ||
| 424 | + const nextItems = (lines.length ? lines : [{}]).map(x => ({ | ||
| 425 | + ...comp.defaultItem(), | ||
| 426 | + ...x, | ||
| 427 | + sampleOrder: !!x.sampleOrder, | ||
| 428 | + collapsed: true | ||
| 429 | + })) | ||
| 430 | + if (!lines.length && nextItems[0]) nextItems[0].collapsed = false | ||
| 431 | + comp.items = nextItems | ||
| 432 | + if (typeof comp.recalculateAll === 'function') comp.recalculateAll() | ||
| 433 | + if (typeof comp.emitChange === 'function') comp.emitChange() | ||
| 434 | + } else { | ||
| 435 | + this.onProductsChange(lines) | ||
| 436 | + } | ||
| 437 | + } catch (e) { | ||
| 438 | + uni.showToast({ title: '复制失败,请稍后重试', icon: 'none' }) | ||
| 439 | + } | ||
| 440 | + }, | ||
| 353 | async loadRegionOptions() { | 441 | async loadRegionOptions() { |
| 354 | try { | 442 | try { |
| 355 | const res = await getArea() | 443 | const res = await getArea() |
| @@ -556,8 +644,9 @@ export default { | @@ -556,8 +644,9 @@ export default { | ||
| 556 | async onSubmit() { | 644 | async onSubmit() { |
| 557 | if (this.$refs.productRel && !this.$refs.productRel.validate()) return | 645 | if (this.$refs.productRel && !this.$refs.productRel.validate()) return |
| 558 | if (!this.validateRequired()) return | 646 | if (!this.validateRequired()) return |
| 647 | + const isCopy = !!this.copyId | ||
| 559 | const confirmRes = await new Promise(resolve => { | 648 | const confirmRes = await new Promise(resolve => { |
| 560 | - uni.showModal({ title: '提示', content: '确定新增外贸未锁规合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) | 649 | + uni.showModal({ title: '提示', content: isCopy ? '确定复制外贸未锁规合同吗?' : '确定新增外贸未锁规合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) |
| 561 | }) | 650 | }) |
| 562 | if (!(confirmRes && confirmRes.confirm)) return | 651 | if (!(confirmRes && confirmRes.confirm)) return |
| 563 | const clean = (obj) => { | 652 | const clean = (obj) => { |
| @@ -577,6 +666,7 @@ export default { | @@ -577,6 +666,7 @@ export default { | ||
| 577 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; | 666 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; |
| 578 | const payload = clean({ | 667 | const payload = clean({ |
| 579 | ...formForSubmit, | 668 | ...formForSubmit, |
| 669 | + operateType: isCopy ? 'COPY' : 'ADD', | ||
| 580 | destination, | 670 | destination, |
| 581 | type: 'INTL_OPEN_SPEC_AGMT', | 671 | type: 'INTL_OPEN_SPEC_AGMT', |
| 582 | totalQuantity: this.totalQuantity, | 672 | totalQuantity: this.totalQuantity, |
| @@ -588,10 +678,10 @@ export default { | @@ -588,10 +678,10 @@ export default { | ||
| 588 | 678 | ||
| 589 | try { | 679 | try { |
| 590 | await createContractApi(payload) | 680 | await createContractApi(payload) |
| 591 | - uni.showToast({ title: '新增成功', icon: 'none' }) | 681 | + uni.showToast({ title: isCopy ? '复制成功' : '新增成功', icon: 'none' }) |
| 592 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_foreign_unplan/index' }) }, 400) | 682 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_foreign_unplan/index' }) }, 400) |
| 593 | } catch (e) { | 683 | } catch (e) { |
| 594 | - uni.showToast({ title: e.msg ||'新增失败', icon: 'none' }) | 684 | + uni.showToast({ title: e.msg || (isCopy ? '复制失败' : '新增失败'), icon: 'none' }) |
| 595 | } | 685 | } |
| 596 | }, | 686 | }, |
| 597 | validateRequired() { | 687 | validateRequired() { |
| @@ -285,6 +285,12 @@ export default { | @@ -285,6 +285,12 @@ export default { | ||
| 285 | variant: 'outline', | 285 | variant: 'outline', |
| 286 | event: 'uploadSeal' | 286 | event: 'uploadSeal' |
| 287 | }, | 287 | }, |
| 288 | + { | ||
| 289 | + text: '复制', | ||
| 290 | + visible: true, | ||
| 291 | + variant: 'outline', | ||
| 292 | + event: 'copy' | ||
| 293 | + }, | ||
| 288 | ], | 294 | ], |
| 289 | } | 295 | } |
| 290 | }, | 296 | }, |
| @@ -311,6 +317,7 @@ export default { | @@ -311,6 +317,7 @@ export default { | ||
| 311 | { ...this.buttons[7], visible: (s === 'FORMAL' && e && a === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-unlocked-contract:approve')) }, //审核正式合同 | 317 | { ...this.buttons[7], visible: (s === 'FORMAL' && e && a === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-unlocked-contract:approve')) }, //审核正式合同 |
| 312 | { ...this.buttons[8], visible: (s === 'STANDARD' && e && a === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-unlocked-contract:approve')) }, //审核正式合同 | 318 | { ...this.buttons[8], visible: (s === 'STANDARD' && e && a === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-unlocked-contract:approve')) }, //审核正式合同 |
| 313 | { ...this.buttons[9], visible: (s === 'STANDARD' && f && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-unlocked-contract:standard-approve')) }, //审核标准合同 | 319 | { ...this.buttons[9], visible: (s === 'STANDARD' && f && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:foreign-trade-unlocked-contract:standard-approve')) }, //审核标准合同 |
| 320 | + { ...this.buttons[14], visible: (s !== 'DELETED' && this.$auth.hasPermi('contract-manage:foreign-trade-unlocked-contract:copy')) }, | ||
| 314 | ] | 321 | ] |
| 315 | } | 322 | } |
| 316 | }, | 323 | }, |
| @@ -466,6 +473,20 @@ export default { | @@ -466,6 +473,20 @@ export default { | ||
| 466 | if (e === 'auditDetail2') return this.onAuditDetail(this.detail.parentId || '', 'FORMAL_CONTRACT') | 473 | if (e === 'auditDetail2') return this.onAuditDetail(this.detail.parentId || '', 'FORMAL_CONTRACT') |
| 467 | if (e === 'auditDetail3') return this.onAuditDetail(this.detail.id || '', 'STANDARD_CONTRACT') | 474 | if (e === 'auditDetail3') return this.onAuditDetail(this.detail.id || '', 'STANDARD_CONTRACT') |
| 468 | if (e === 'uploadSeal') return this.uploadContract(this.detail.id || '', 'seal') | 475 | if (e === 'uploadSeal') return this.uploadContract(this.detail.id || '', 'seal') |
| 476 | + if (e === 'copy') return this.onCopy(btn && btn.params) | ||
| 477 | + }, | ||
| 478 | + getBusinessId() { | ||
| 479 | + return (this.detail && (this.detail.id || this.detail.code)) || '' | ||
| 480 | + }, | ||
| 481 | + onCopy() { | ||
| 482 | + const id = this.getBusinessId() | ||
| 483 | + if (!id) { | ||
| 484 | + uni.showToast({ title: '未获取到合同ID,无法复制', icon: 'none' }) | ||
| 485 | + return | ||
| 486 | + } | ||
| 487 | + uni.navigateTo({ | ||
| 488 | + url: '/pages/contract_foreign_unplan/add?copyId=' + encodeURIComponent(id) | ||
| 489 | + }) | ||
| 469 | }, | 490 | }, |
| 470 | onAudit(id, type) { | 491 | onAudit(id, type) { |
| 471 | const CACHE_KEY = 'sourceBusinessId' | 492 | const CACHE_KEY = 'sourceBusinessId' |
| @@ -667,4 +688,4 @@ export default { | @@ -667,4 +688,4 @@ export default { | ||
| 667 | .upload-row { | 688 | .upload-row { |
| 668 | margin-top: 20rpx; | 689 | margin-top: 20rpx; |
| 669 | } | 690 | } |
| 670 | -</style> | ||
| 691 | +</style> |
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | <view class="page"> | 2 | <view class="page"> |
| 3 | <scroll-view class="scroll" scroll-y> | 3 | <scroll-view class="scroll" scroll-y> |
| 4 | <view class="lock-page"> | 4 | <view class="lock-page"> |
| 5 | - <view class="block" v-for="(item, idx) in items" :key="idx"> | 5 | + <view class="block" v-for="(item, idx) in items" :key="item.raw && (item.raw.id || item.raw.lineId || item.raw.productId) || ('row-' + idx)"> |
| 6 | <view class="block-header"> | 6 | <view class="block-header"> |
| 7 | <uni-data-checkbox multiple mode="default" :localdata="[{ text: '锁规', value: 'LOCKED' }]" | 7 | <uni-data-checkbox multiple mode="default" :localdata="[{ text: '锁规', value: 'LOCKED' }]" |
| 8 | :modelValue="item.locked ? ['LOCKED'] : []" @change="onLockChange(idx, $event)" /> | 8 | :modelValue="item.locked ? ['LOCKED'] : []" @change="onLockChange(idx, $event)" /> |
| @@ -14,73 +14,79 @@ | @@ -14,73 +14,79 @@ | ||
| 14 | </view> | 14 | </view> |
| 15 | 15 | ||
| 16 | <uni-list v-show="item.collapsed"> | 16 | <uni-list v-show="item.collapsed"> |
| 17 | - <uni-list-item title="产品名称"> | ||
| 18 | - <template v-slot:footer> | ||
| 19 | - <uni-easyinput v-model="item.productName" placeholder="请输入产品名称" :clearable="false" | ||
| 20 | - disabled /> | 17 | + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow> |
| 18 | + <template v-slot:body> | ||
| 19 | + <view class="item-title"><text>产品名称</text></view> | ||
| 21 | </template> | 20 | </template> |
| 22 | </uni-list-item> | 21 | </uni-list-item> |
| 23 | <uni-list-item title="行业"> | 22 | <uni-list-item title="行业"> |
| 24 | <template v-slot:footer> | 23 | <template v-slot:footer> |
| 25 | - <uni-easyinput v-model="item.industry" placeholder="请输入行业" :clearable="false" | ||
| 26 | - disabled /> | 24 | + <uni-easyinput v-model="item.industry" placeholder="请输入行业" /> |
| 27 | </template> | 25 | </template> |
| 28 | </uni-list-item> | 26 | </uni-list-item> |
| 29 | <uni-list-item title="牌号"> | 27 | <uni-list-item title="牌号"> |
| 30 | <template v-slot:footer> | 28 | <template v-slot:footer> |
| 31 | - <uni-easyinput v-model="item.brand" placeholder="请输入牌号" :clearable="false" disabled /> | 29 | + <uni-easyinput v-model="item.brand" placeholder="请输入牌号" /> |
| 32 | </template> | 30 | </template> |
| 33 | </uni-list-item> | 31 | </uni-list-item> |
| 34 | <uni-list-item title="品质"> | 32 | <uni-list-item title="品质"> |
| 35 | <template v-slot:footer> | 33 | <template v-slot:footer> |
| 36 | - <uni-easyinput v-model="item.quality" placeholder="请输入品质" :clearable="false" disabled /> | 34 | + <uni-easyinput v-model="item.quality" placeholder="请输入品质" /> |
| 35 | + </template> | ||
| 36 | + </uni-list-item> | ||
| 37 | + <uni-list-item title="厚度(mm)"> | ||
| 38 | + <template v-slot:footer> | ||
| 39 | + <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 9)" /> | ||
| 40 | + </template> | ||
| 41 | + </uni-list-item> | ||
| 42 | + <uni-list-item title="厚度公差上限(mm)"> | ||
| 43 | + <template v-slot:footer> | ||
| 44 | + <uni-easyinput type="digit" v-model="item.thicknessTolPos" :inputBorder="false" placeholder="请输入厚度公差上限" @input="onNumberInput(idx, 'thicknessTolPos')" @blur="onNumberBlur(idx, 'thicknessTolPos', 9)" /> | ||
| 45 | + </template> | ||
| 46 | + </uni-list-item> | ||
| 47 | + <uni-list-item title="厚度公差下限(mm)"> | ||
| 48 | + <template v-slot:footer> | ||
| 49 | + <uni-easyinput type="digit" v-model="item.thicknessTolNeg" :inputBorder="false" placeholder="请输入厚度公差下限" @input="onNumberInput(idx, 'thicknessTolNeg')" @blur="onNumberBlur(idx, 'thicknessTolNeg', 9)" /> | ||
| 50 | + </template> | ||
| 51 | + </uni-list-item> | ||
| 52 | + <uni-list-item title="宽度(mm)"> | ||
| 53 | + <template v-slot:footer> | ||
| 54 | + <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 9)" /> | ||
| 55 | + </template> | ||
| 56 | + </uni-list-item> | ||
| 57 | + <uni-list-item title="宽度公差上限(mm)"> | ||
| 58 | + <template v-slot:footer> | ||
| 59 | + <uni-easyinput type="digit" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差上限" @input="onNumberInput(idx, 'widthTolPos')" @blur="onNumberBlur(idx, 'widthTolPos', 9)" /> | ||
| 60 | + </template> | ||
| 61 | + </uni-list-item> | ||
| 62 | + <uni-list-item title="宽度公差下限(mm)"> | ||
| 63 | + <template v-slot:footer> | ||
| 64 | + <uni-easyinput type="digit" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNumberInput(idx, 'widthTolNeg')" @blur="onNumberBlur(idx, 'widthTolNeg', 9)" /> | ||
| 65 | + </template> | ||
| 66 | + </uni-list-item> | ||
| 67 | + <uni-list-item title="长度(mm)"> | ||
| 68 | + <template v-slot:footer> | ||
| 69 | + <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 9)" /> | ||
| 70 | + </template> | ||
| 71 | + </uni-list-item> | ||
| 72 | + <uni-list-item title="长度公差上限(mm)"> | ||
| 73 | + <template v-slot:footer> | ||
| 74 | + <uni-easyinput type="digit" v-model="item.lengthTolPos" :inputBorder="false" placeholder="请输入长度公差上限" @input="onNumberInput(idx, 'lengthTolPos')" @blur="onNumberBlur(idx, 'lengthTolPos', 9)" /> | ||
| 37 | </template> | 75 | </template> |
| 38 | </uni-list-item> | 76 | </uni-list-item> |
| 39 | - <uni-list-item title="规格(mm)"> | 77 | + <uni-list-item title="长度公差下限(mm)"> |
| 40 | <template v-slot:footer> | 78 | <template v-slot:footer> |
| 41 | - <view class="value value-spec"> | ||
| 42 | - <view v-if="item.thickness" class="value-spec_val">{{ item.thickness }}</view> | ||
| 43 | - <view v-if="item.thickness" class="value-spec_box"> | ||
| 44 | - <view v-if="item.thicknessTolPos" class="value-spec_box_1">{{ | ||
| 45 | - item.thicknessTolPos > 0 ? '+' + item.thicknessTolPos : item.thicknessTolPos | ||
| 46 | - }} | ||
| 47 | - </view> | ||
| 48 | - <view v-if="item.thicknessTolNeg" class="value-spec_box_2">{{ | ||
| 49 | - item.thicknessTolNeg > 0 ? '+' + item.thicknessTolNeg : item.thicknessTolNeg | ||
| 50 | - }} | ||
| 51 | - </view> | ||
| 52 | - </view> | ||
| 53 | - <view v-if="item.width" class="value-spec_val p12">*</view> | ||
| 54 | - <view v-if="item.width" class="value-spec_val">{{ item.width }}</view> | ||
| 55 | - <view v-if="item.width" class="value-spec_box"> | ||
| 56 | - <view v-if="item.widthTolPos" class="value-spec_box_1">{{ item.widthTolPos > 0 ? | ||
| 57 | - '+' + item.widthTolPos : item.widthTolPos }} | ||
| 58 | - </view> | ||
| 59 | - <view v-if="item.widthTolNeg" class="value-spec_box_2">{{ item.widthTolNeg > 0 ? | ||
| 60 | - '+' + item.widthTolNeg : item.widthTolNeg }} | ||
| 61 | - </view> | ||
| 62 | - </view> | ||
| 63 | - <view v-if="item.length" class="value-spec_val p12">*</view> | ||
| 64 | - <view v-if="item.length" class="value-spec_val">{{ item.length }}</view> | ||
| 65 | - <view v-if="item.length" class="value-spec_box"> | ||
| 66 | - <view v-if="item.lengthTolPos" class="value-spec_box_1">{{ item.lengthTolPos > 0 | ||
| 67 | - ? '+' + item.lengthTolPos : item.lengthTolPos }} | ||
| 68 | - </view> | ||
| 69 | - <view v-if="item.lengthTolNeg" class="value-spec_box_2">{{ item.lengthTolNeg > 0 | ||
| 70 | - ? '+' + item.lengthTolNeg : item.lengthTolNeg }} | ||
| 71 | - </view> | ||
| 72 | - </view> | ||
| 73 | - </view> | 79 | + <uni-easyinput type="digit" v-model="item.lengthTolNeg" :inputBorder="false" placeholder="请输入长度公差下限" @input="onNumberInput(idx, 'lengthTolNeg')" @blur="onNumberBlur(idx, 'lengthTolNeg', 9)" /> |
| 74 | </template> | 80 | </template> |
| 75 | </uni-list-item> | 81 | </uni-list-item> |
| 76 | <uni-list-item title="物料编码"> | 82 | <uni-list-item title="物料编码"> |
| 77 | <template v-slot:footer> | 83 | <template v-slot:footer> |
| 78 | - <uni-easyinput v-model="item.materialCode" placeholder="请输入物料编码" :clearable="false" disabled /> | 84 | + <uni-easyinput v-model="item.materialCode" placeholder="请输入物料编码" /> |
| 79 | </template> | 85 | </template> |
| 80 | </uni-list-item> | 86 | </uni-list-item> |
| 81 | <uni-list-item title="状态"> | 87 | <uni-list-item title="状态"> |
| 82 | <template v-slot:footer> | 88 | <template v-slot:footer> |
| 83 | - <uni-easyinput v-model="item.status" placeholder="请输入状态" :clearable="false" disabled /> | 89 | + <uni-easyinput v-model="item.status" placeholder="请输入状态" /> |
| 84 | </template> | 90 | </template> |
| 85 | </uni-list-item> | 91 | </uni-list-item> |
| 86 | <uni-list-item title="数量"> | 92 | <uni-list-item title="数量"> |
| @@ -104,33 +110,30 @@ | @@ -104,33 +110,30 @@ | ||
| 104 | </uni-list-item> --> | 110 | </uni-list-item> --> |
| 105 | <uni-list-item title="总金额"> | 111 | <uni-list-item title="总金额"> |
| 106 | <template v-slot:footer> | 112 | <template v-slot:footer> |
| 107 | - <uni-easyinput v-model="item.totalAmount" type="number" :inputBorder="false" disabled | ||
| 108 | - placeholder="" /> | 113 | + <uni-easyinput v-model="item.totalAmount" type="number" :inputBorder="false" disabled placeholder="" /> |
| 109 | </template> | 114 | </template> |
| 110 | </uni-list-item> | 115 | </uni-list-item> |
| 111 | <uni-list-item title="发货日期"> | 116 | <uni-list-item title="发货日期"> |
| 112 | <template v-slot:footer> | 117 | <template v-slot:footer> |
| 113 | - <uni-easyinput v-model="item.deliveryDate" :inputBorder="false" disabled /> | 118 | + <uni-easyinput v-model="item.deliveryDate" :inputBorder="false" /> |
| 114 | </template> | 119 | </template> |
| 115 | </uni-list-item> | 120 | </uni-list-item> |
| 116 | </uni-list> | 121 | </uni-list> |
| 117 | 122 | ||
| 118 | <uni-list v-show="!item.collapsed"> | 123 | <uni-list v-show="!item.collapsed"> |
| 119 | - <uni-list-item title="产品名称"> | ||
| 120 | - <template v-slot:footer> | ||
| 121 | - <uni-easyinput v-model="item.productName" placeholder="请输入产品名称" :clearable="false" | ||
| 122 | - disabled /> | 124 | + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow> |
| 125 | + <template v-slot:body> | ||
| 126 | + <view class="item-title"><text>产品名称</text></view> | ||
| 123 | </template> | 127 | </template> |
| 124 | </uni-list-item> | 128 | </uni-list-item> |
| 125 | <uni-list-item title="行业"> | 129 | <uni-list-item title="行业"> |
| 126 | <template v-slot:footer> | 130 | <template v-slot:footer> |
| 127 | - <uni-easyinput v-model="item.industry" placeholder="请输入行业" :clearable="false" | ||
| 128 | - disabled /> | 131 | + <uni-easyinput v-model="item.industry" placeholder="请输入行业" /> |
| 129 | </template> | 132 | </template> |
| 130 | </uni-list-item> | 133 | </uni-list-item> |
| 131 | <uni-list-item title="牌号"> | 134 | <uni-list-item title="牌号"> |
| 132 | <template v-slot:footer> | 135 | <template v-slot:footer> |
| 133 | - <uni-easyinput v-model="item.brand" placeholder="请输入牌号" :clearable="false" disabled /> | 136 | + <uni-easyinput v-model="item.brand" placeholder="请输入牌号" /> |
| 134 | </template> | 137 | </template> |
| 135 | </uni-list-item> | 138 | </uni-list-item> |
| 136 | 139 | ||
| @@ -170,24 +173,36 @@ | @@ -170,24 +173,36 @@ | ||
| 170 | </view> | 173 | </view> |
| 171 | </view> | 174 | </view> |
| 172 | </scroll-view> | 175 | </scroll-view> |
| 173 | - | 176 | + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> |
| 174 | </view> | 177 | </view> |
| 175 | </template> | 178 | </template> |
| 176 | 179 | ||
| 177 | <script> | 180 | <script> |
| 178 | import { getContractApi, specificationLock } from '@/api/contract' | 181 | import { getContractApi, specificationLock } from '@/api/contract' |
| 182 | +import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 183 | +import { getDicByCodes } from '@/utils/dic' | ||
| 179 | import { formatCurrencyToChinese } from '@/utils/common' | 184 | import { formatCurrencyToChinese } from '@/utils/common' |
| 180 | 185 | ||
| 181 | export default { | 186 | export default { |
| 182 | name: 'ContractUnplanLock', | 187 | name: 'ContractUnplanLock', |
| 188 | + components: { SingleSelectSheet }, | ||
| 183 | data() { | 189 | data() { |
| 184 | return { | 190 | return { |
| 185 | id: '', | 191 | id: '', |
| 186 | items: [], | 192 | items: [], |
| 187 | planQty: 30, | 193 | planQty: 30, |
| 194 | + sheet: { visible: false, title: '请选择', options: [], idx: -1, value: '', mode: '' }, | ||
| 195 | + options: [], | ||
| 188 | } | 196 | } |
| 189 | }, | 197 | }, |
| 190 | computed: { | 198 | computed: { |
| 199 | + selectOptions() { | ||
| 200 | + const list = Array.isArray(this.options) ? this.options : [] | ||
| 201 | + return list.map(o => ({ | ||
| 202 | + label: o.label != null ? o.label : (o.text != null ? o.text : (o.name != null ? o.name : '')), | ||
| 203 | + value: o.value != null ? o.value : (o.id != null ? o.id : o.productId) | ||
| 204 | + })) | ||
| 205 | + }, | ||
| 191 | totalQuantity() { | 206 | totalQuantity() { |
| 192 | const qty = this.items.filter(it => it.locked).reduce((p, c) => p + this.toNumber(c.quantity), 0) | 207 | const qty = this.items.filter(it => it.locked).reduce((p, c) => p + this.toNumber(c.quantity), 0) |
| 193 | return this.round(qty, 2) | 208 | return this.round(qty, 2) |
| @@ -219,8 +234,40 @@ export default { | @@ -219,8 +234,40 @@ export default { | ||
| 219 | const id = options && options.id ? options.id : '' | 234 | const id = options && options.id ? options.id : '' |
| 220 | this.id = id | 235 | this.id = id |
| 221 | this.loadDetail() | 236 | this.loadDetail() |
| 237 | + this.loadProductOptions() | ||
| 222 | }, | 238 | }, |
| 223 | methods: { | 239 | methods: { |
| 240 | + onNonNegativeInput(idx, field) { | ||
| 241 | + const it = this.items[idx] | ||
| 242 | + if (!it) return | ||
| 243 | + const raw = it[field] | ||
| 244 | + it[field] = String(raw || '').replace(/[^0-9.]/g, '') | ||
| 245 | + this.$set(this.items, idx, it) | ||
| 246 | + }, | ||
| 247 | + onNumberInput(idx, field) { | ||
| 248 | + const it = this.items[idx] | ||
| 249 | + if (!it) return | ||
| 250 | + const raw = it[field] | ||
| 251 | + it[field] = String(raw || '').replace(/[^0-9.\-]/g, '') | ||
| 252 | + this.$set(this.items, idx, it) | ||
| 253 | + }, | ||
| 254 | + onNonNegativeBlur(idx, field, digits) { | ||
| 255 | + const it = this.items[idx] | ||
| 256 | + if (!it) return | ||
| 257 | + const num = Math.max(0, this.toNumber(it[field])) | ||
| 258 | + const rounded = this.round(num, digits) | ||
| 259 | + it[field] = rounded | ||
| 260 | + this.$set(this.items, idx, it) | ||
| 261 | + }, | ||
| 262 | + async loadProductOptions() { | ||
| 263 | + try { | ||
| 264 | + const results = await getDicByCodes(['CONTRACT_PRODUCT']) | ||
| 265 | + const c3 = results && results.CONTRACT_PRODUCT && results.CONTRACT_PRODUCT.data ? results.CONTRACT_PRODUCT.data : [] | ||
| 266 | + this.options = c3.map(it => ({ label: it.name, value: it.code })) | ||
| 267 | + } catch (e) { | ||
| 268 | + this.options = [] | ||
| 269 | + } | ||
| 270 | + }, | ||
| 224 | onLockChange(idx, e) { | 271 | onLockChange(idx, e) { |
| 225 | const it = this.items[idx] | 272 | const it = this.items[idx] |
| 226 | if (!it) return | 273 | if (!it) return |
| @@ -238,6 +285,7 @@ export default { | @@ -238,6 +285,7 @@ export default { | ||
| 238 | locked: false, | 285 | locked: false, |
| 239 | collapsed: true, | 286 | collapsed: true, |
| 240 | raw: v, | 287 | raw: v, |
| 288 | + productId: v.productId || v.rawProductId || '', | ||
| 241 | productName: v.rawProductName || v.productName || '', | 289 | productName: v.rawProductName || v.productName || '', |
| 242 | industry: v.industry || '', | 290 | industry: v.industry || '', |
| 243 | brand: v.rawProductGrade || v.brand || '', | 291 | brand: v.rawProductGrade || v.brand || '', |
| @@ -272,6 +320,31 @@ export default { | @@ -272,6 +320,31 @@ export default { | ||
| 272 | it.collapsed = !it.collapsed | 320 | it.collapsed = !it.collapsed |
| 273 | this.$set(this.items, idx, it) | 321 | this.$set(this.items, idx, it) |
| 274 | }, | 322 | }, |
| 323 | + openProductSheet(idx, mode = 'product') { | ||
| 324 | + let opts = [] | ||
| 325 | + let title = '' | ||
| 326 | + let value = '' | ||
| 327 | + const item = this.items[idx] | ||
| 328 | + if (mode === 'product') { | ||
| 329 | + opts = this.selectOptions | ||
| 330 | + const current = item && item.productId | ||
| 331 | + const match = opts.find(o => o.value === current) | ||
| 332 | + value = match ? match.value : '' | ||
| 333 | + title = '请选择产品' | ||
| 334 | + } | ||
| 335 | + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode } | ||
| 336 | + }, | ||
| 337 | + onProductConfirm({ value, label }) { | ||
| 338 | + const { idx, mode } = this.sheet | ||
| 339 | + const it = this.items[idx] | ||
| 340 | + if (!it) { this.sheet.visible = false; return } | ||
| 341 | + if (mode === 'product') { | ||
| 342 | + it.productId = value | ||
| 343 | + it.productName = label || '' | ||
| 344 | + } | ||
| 345 | + this.$set(this.items, idx, it) | ||
| 346 | + this.sheet.visible = false | ||
| 347 | + }, | ||
| 275 | onImmediateChange(idx) { | 348 | onImmediateChange(idx) { |
| 276 | this.$nextTick(() => this.recalculate(idx)) | 349 | this.$nextTick(() => this.recalculate(idx)) |
| 277 | }, | 350 | }, |
| @@ -349,6 +422,26 @@ export default { | @@ -349,6 +422,26 @@ export default { | ||
| 349 | raw.unitPrice = price | 422 | raw.unitPrice = price |
| 350 | raw.totalAmount = total | 423 | raw.totalAmount = total |
| 351 | // raw.amountExcludingTax = excl | 424 | // raw.amountExcludingTax = excl |
| 425 | + raw.productId = it.productId || raw.productId | ||
| 426 | + raw.productName = it.productName | ||
| 427 | + if (Object.prototype.hasOwnProperty.call(raw, 'rawProductId')) raw.rawProductId = it.productId || raw.rawProductId | ||
| 428 | + if (Object.prototype.hasOwnProperty.call(raw, 'rawProductName')) raw.rawProductName = it.productName | ||
| 429 | + raw.industry = it.industry | ||
| 430 | + raw.quality = it.quality | ||
| 431 | + raw.brand = it.brand | ||
| 432 | + if (Object.prototype.hasOwnProperty.call(raw, 'rawProductGrade')) raw.rawProductGrade = it.brand | ||
| 433 | + raw.thickness = it.thickness | ||
| 434 | + raw.thicknessTolPos = it.thicknessTolPos | ||
| 435 | + raw.thicknessTolNeg = it.thicknessTolNeg | ||
| 436 | + raw.width = it.width | ||
| 437 | + raw.widthTolPos = it.widthTolPos | ||
| 438 | + raw.widthTolNeg = it.widthTolNeg | ||
| 439 | + raw.length = it.length | ||
| 440 | + raw.lengthTolPos = it.lengthTolPos | ||
| 441 | + raw.lengthTolNeg = it.lengthTolNeg | ||
| 442 | + raw.materialCode = it.materialCode | ||
| 443 | + raw.status = it.status | ||
| 444 | + raw.deliveryDate = it.deliveryDate | ||
| 352 | return raw | 445 | return raw |
| 353 | }) | 446 | }) |
| 354 | if (!selected.length) { | 447 | if (!selected.length) { |
| @@ -785,4 +878,4 @@ export default { | @@ -785,4 +878,4 @@ export default { | ||
| 785 | height: 60rpx; | 878 | height: 60rpx; |
| 786 | align-items: center; | 879 | align-items: center; |
| 787 | } | 880 | } |
| 788 | -</style> | ||
| 881 | +</style> |
| @@ -231,7 +231,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | @@ -231,7 +231,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 231 | import RelateSelectSheet from '@/components/relate-select/index.vue' | 231 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 232 | import ProductRel from './productRel.vue' | 232 | import ProductRel from './productRel.vue' |
| 233 | import CitySelector from '@/components/city-selector/index.vue' | 233 | import CitySelector from '@/components/city-selector/index.vue' |
| 234 | -import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements, getDeptApi } from '@/api/contract' | 234 | +import { getRetailCodeApi, createContractApi, getCustomerRemarks, getCustomerSpecificQualityRequirements, getDeptApi, getContractApi } from '@/api/contract' |
| 235 | import { getDicByCodes } from '@/utils/dic' | 235 | import { getDicByCodes } from '@/utils/dic' |
| 236 | import { formatCurrencyToChinese } from '@/utils/common' | 236 | import { formatCurrencyToChinese } from '@/utils/common' |
| 237 | import { workshopQueryApi } from '@/api/devManage' | 237 | import { workshopQueryApi } from '@/api/devManage' |
| @@ -242,6 +242,8 @@ export default { | @@ -242,6 +242,8 @@ export default { | ||
| 242 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, | 242 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, |
| 243 | data() { | 243 | data() { |
| 244 | return { | 244 | return { |
| 245 | + copyId: '', | ||
| 246 | + operateType: 'ADD', | ||
| 245 | form: { | 247 | form: { |
| 246 | code: '', | 248 | code: '', |
| 247 | supplier: '', | 249 | supplier: '', |
| @@ -299,13 +301,22 @@ export default { | @@ -299,13 +301,22 @@ export default { | ||
| 299 | rawProductGradeList: [], | 301 | rawProductGradeList: [], |
| 300 | } | 302 | } |
| 301 | }, | 303 | }, |
| 304 | + onLoad(query) { | ||
| 305 | + const copyId = (query && query.copyId) ? String(query.copyId) : '' | ||
| 306 | + this.copyId = copyId | ||
| 307 | + this.operateType = copyId ? 'COPY' : 'ADD' | ||
| 308 | + uni.setNavigationBarTitle({ | ||
| 309 | + title: copyId ? '复制加工标准合同' : '新增加工标准合同' | ||
| 310 | + }) | ||
| 311 | + }, | ||
| 302 | created() { | 312 | created() { |
| 303 | this.loadSuppliers() | 313 | this.loadSuppliers() |
| 304 | this.loadExtraOptions() | 314 | this.loadExtraOptions() |
| 305 | this.initCode() | 315 | this.initCode() |
| 306 | this.getDept() | 316 | this.getDept() |
| 307 | this.loadRegionOptions() | 317 | this.loadRegionOptions() |
| 308 | - this.form.orderDate = this.formatDate(new Date()) | 318 | + if (!this.copyId) this.form.orderDate = this.formatDate(new Date()) |
| 319 | + if (this.copyId) this.loadCopyDetail(this.copyId) | ||
| 309 | this.$nextTick(() => { | 320 | this.$nextTick(() => { |
| 310 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { | 321 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { |
| 311 | this.initDestinationLabel() | 322 | this.initDestinationLabel() |
| @@ -353,6 +364,83 @@ export default { | @@ -353,6 +364,83 @@ export default { | ||
| 353 | }, | 364 | }, |
| 354 | }, | 365 | }, |
| 355 | methods: { | 366 | methods: { |
| 367 | + async loadCopyDetail(id) { | ||
| 368 | + const rid = (id !== undefined && id !== null) ? String(id) : '' | ||
| 369 | + if (!rid) return | ||
| 370 | + try { | ||
| 371 | + const res = await getContractApi(rid) | ||
| 372 | + const data = res && res.data ? res.data : {} | ||
| 373 | + const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') | ||
| 374 | + const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') | ||
| 375 | + const m = { ...data, includesPackagingFeeName, includesTransportFeeName } | ||
| 376 | + | ||
| 377 | + const code = this.form.code | ||
| 378 | + this.form = { | ||
| 379 | + ...this.form, | ||
| 380 | + supplier: m.supplier || '', | ||
| 381 | + supplierName: m.supplierName || '', | ||
| 382 | + buyer: m.buyer || (m.customer && m.customer.id) || '', | ||
| 383 | + buyerName: m.buyerName || (m.customer && m.customer.name) || '', | ||
| 384 | + stockUpCompanyId: m.stockUpCompanyId || '', | ||
| 385 | + stockUpCompanyName: m.stockUpCompanyName || '', | ||
| 386 | + orderDate: m.orderDate || this.form.orderDate, | ||
| 387 | + deliveryDate: m.deliveryDate || '', | ||
| 388 | + designatedConsignee: m.designatedConsignee || '', | ||
| 389 | + specialTerms: m.specialTerms || '', | ||
| 390 | + specialTermsName: m.specialTermsName || '', | ||
| 391 | + executionStandard: m.executionStandard || '', | ||
| 392 | + executionStandardName: m.executionStandardName || '', | ||
| 393 | + executionStandardRemarks: m.executionStandardRemarks || '', | ||
| 394 | + includesPackagingFee: !!m.includesPackagingFee, | ||
| 395 | + includesPackagingFeeName, | ||
| 396 | + includesTransportFee: !!m.includesTransportFee, | ||
| 397 | + includesTransportFeeName, | ||
| 398 | + unit: m.unit || this.form.unit, | ||
| 399 | + totalAmountCapital: m.totalAmountCapital || '', | ||
| 400 | + depositInfo: m.depositInfo || '', | ||
| 401 | + packagingRequirements: m.packagingRequirements || '', | ||
| 402 | + paymentTerms: m.paymentTerms || '', | ||
| 403 | + transportMode: m.transportMode || '', | ||
| 404 | + destinationId: (m.provinceId && m.cityId && m.districtId) ? [m.provinceId, m.cityId, m.districtId] : (Array.isArray(m.destinationId) ? m.destinationId : []), | ||
| 405 | + destinationLabel: (m.provinceName && m.cityName && m.districtName) ? `${m.provinceName} / ${m.cityName} / ${m.districtName}` : (m.destinationLabel || ''), | ||
| 406 | + specialInstructions: m.specialInstructions || '', | ||
| 407 | + remarks: m.remarks || '', | ||
| 408 | + pieceWeightHead: m.pieceWeightHead || '', | ||
| 409 | + surface: m.surface || '', | ||
| 410 | + tolerance: m.tolerance || '', | ||
| 411 | + performance: m.performance || '', | ||
| 412 | + component: m.component || '', | ||
| 413 | + packaging: m.packaging || '', | ||
| 414 | + workshopId: m.workshopId || '', | ||
| 415 | + workshopIdName: m.workshopName || m.workshopIdName || '', | ||
| 416 | + region: m.region || '', | ||
| 417 | + regionName: m.regionName || '', | ||
| 418 | + deptName: m.deptName || this.form.deptName, | ||
| 419 | + deptId: m.deptId || this.form.deptId, | ||
| 420 | + code, | ||
| 421 | + } | ||
| 422 | + | ||
| 423 | + const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : [] | ||
| 424 | + await this.$nextTick() | ||
| 425 | + const comp = this.$refs.productRel | ||
| 426 | + if (comp && typeof comp.defaultItem === 'function') { | ||
| 427 | + const nextItems = (lines.length ? lines : [{}]).map(x => ({ | ||
| 428 | + ...comp.defaultItem(), | ||
| 429 | + ...x, | ||
| 430 | + sampleOrder: !!x.sampleOrder, | ||
| 431 | + collapsed: true | ||
| 432 | + })) | ||
| 433 | + if (!lines.length && nextItems[0]) nextItems[0].collapsed = false | ||
| 434 | + comp.items = nextItems | ||
| 435 | + if (typeof comp.recalculateAll === 'function') comp.recalculateAll() | ||
| 436 | + if (typeof comp.emitChange === 'function') comp.emitChange() | ||
| 437 | + } else { | ||
| 438 | + this.onProductsChange(lines) | ||
| 439 | + } | ||
| 440 | + } catch (e) { | ||
| 441 | + uni.showToast({ title: '复制失败,请稍后重试', icon: 'none' }) | ||
| 442 | + } | ||
| 443 | + }, | ||
| 356 | async loadRegionOptions() { | 444 | async loadRegionOptions() { |
| 357 | try { | 445 | try { |
| 358 | const res = await getArea() | 446 | const res = await getArea() |
| @@ -567,8 +655,9 @@ export default { | @@ -567,8 +655,9 @@ export default { | ||
| 567 | }, | 655 | }, |
| 568 | async onSubmit() { | 656 | async onSubmit() { |
| 569 | if (!this.validateRequired()) return | 657 | if (!this.validateRequired()) return |
| 658 | + const isCopy = !!this.copyId | ||
| 570 | const confirmRes = await new Promise(resolve => { | 659 | const confirmRes = await new Promise(resolve => { |
| 571 | - uni.showModal({ title: '提示', content: '确定新增加工标准合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) | 660 | + uni.showModal({ title: '提示', content: isCopy ? '确定复制加工标准合同吗?' : '确定新增加工标准合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) |
| 572 | }) | 661 | }) |
| 573 | if (!(confirmRes && confirmRes.confirm)) return | 662 | if (!(confirmRes && confirmRes.confirm)) return |
| 574 | const clean = (obj) => { | 663 | const clean = (obj) => { |
| @@ -588,6 +677,7 @@ export default { | @@ -588,6 +677,7 @@ export default { | ||
| 588 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; | 677 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; |
| 589 | const payload = clean({ | 678 | const payload = clean({ |
| 590 | ...formForSubmit, | 679 | ...formForSubmit, |
| 680 | + operateType: isCopy ? 'COPY' : 'ADD', | ||
| 591 | destination, | 681 | destination, |
| 592 | type: 'PROCESS_STD_AGMT', | 682 | type: 'PROCESS_STD_AGMT', |
| 593 | totalQuantity: this.totalQuantity, | 683 | totalQuantity: this.totalQuantity, |
| @@ -601,10 +691,10 @@ export default { | @@ -601,10 +691,10 @@ export default { | ||
| 601 | 691 | ||
| 602 | try { | 692 | try { |
| 603 | await createContractApi(payload) | 693 | await createContractApi(payload) |
| 604 | - uni.showToast({ title: '新增成功', icon: 'none' }) | 694 | + uni.showToast({ title: isCopy ? '复制成功' : '新增成功', icon: 'none' }) |
| 605 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_process/index' }) }, 400) | 695 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_process/index' }) }, 400) |
| 606 | } catch (e) { | 696 | } catch (e) { |
| 607 | - uni.showToast({ title: e.msg ||'新增失败', icon: 'none' }) | 697 | + uni.showToast({ title: e.msg || (isCopy ? '复制失败' : '新增失败'), icon: 'none' }) |
| 608 | } | 698 | } |
| 609 | }, | 699 | }, |
| 610 | validateRequired() { | 700 | validateRequired() { |
| @@ -210,6 +210,12 @@ export default { | @@ -210,6 +210,12 @@ export default { | ||
| 210 | visible: true, | 210 | visible: true, |
| 211 | event: 'auditDetail' | 211 | event: 'auditDetail' |
| 212 | }, | 212 | }, |
| 213 | + { | ||
| 214 | + text: '复制', | ||
| 215 | + visible: true, | ||
| 216 | + variant: 'outline', | ||
| 217 | + event: 'copy' | ||
| 218 | + }, | ||
| 213 | ], | 219 | ], |
| 214 | } | 220 | } |
| 215 | }, | 221 | }, |
| @@ -224,6 +230,7 @@ export default { | @@ -224,6 +230,7 @@ export default { | ||
| 224 | { ...this.buttons[2], visible: (s !== 'DELETED' && t !== 'AUDIT' && t !== 'PASS' && this.$auth.hasPermi('contract-manage:processed-standard-contract:upload')) }, | 230 | { ...this.buttons[2], visible: (s !== 'DELETED' && t !== 'AUDIT' && t !== 'PASS' && this.$auth.hasPermi('contract-manage:processed-standard-contract:upload')) }, |
| 225 | { ...this.buttons[4], visible: (s === 'STANDARD' && this.$auth.hasPermi('contract-manage:processed-standard-contract:review')) }, | 231 | { ...this.buttons[4], visible: (s === 'STANDARD' && this.$auth.hasPermi('contract-manage:processed-standard-contract:review')) }, |
| 226 | { ...this.buttons[3], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:processed-standard-contract:approve')) }, | 232 | { ...this.buttons[3], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:processed-standard-contract:approve')) }, |
| 233 | + { ...this.buttons[5], visible: (s !== 'DELETED' && this.$auth.hasPermi('contract-manage:processed-standard-contract:copy')) }, | ||
| 227 | ] | 234 | ] |
| 228 | } | 235 | } |
| 229 | }, | 236 | }, |
| @@ -346,6 +353,20 @@ export default { | @@ -346,6 +353,20 @@ export default { | ||
| 346 | if (e === 'upload') return this.uploadContract(this.detail.id || '') | 353 | if (e === 'upload') return this.uploadContract(this.detail.id || '') |
| 347 | if (e === 'audit') return this.onAudit(this.detail.id || '', 'PROCESS_STD_AGMT') | 354 | if (e === 'audit') return this.onAudit(this.detail.id || '', 'PROCESS_STD_AGMT') |
| 348 | if (e === 'auditDetail') return this.onAuditDetail(this.detail.id || '', 'PROCESS_STD_AGMT') | 355 | if (e === 'auditDetail') return this.onAuditDetail(this.detail.id || '', 'PROCESS_STD_AGMT') |
| 356 | + if (e === 'copy') return this.onCopy(btn && btn.params) | ||
| 357 | + }, | ||
| 358 | + getBusinessId() { | ||
| 359 | + return (this.detail && (this.detail.id || this.detail.code)) || '' | ||
| 360 | + }, | ||
| 361 | + onCopy() { | ||
| 362 | + const id = this.getBusinessId() | ||
| 363 | + if (!id) { | ||
| 364 | + uni.showToast({ title: '未获取到合同ID,无法复制', icon: 'none' }) | ||
| 365 | + return | ||
| 366 | + } | ||
| 367 | + uni.navigateTo({ | ||
| 368 | + url: '/pages/contract_process/add?copyId=' + encodeURIComponent(id) | ||
| 369 | + }) | ||
| 349 | }, | 370 | }, |
| 350 | onAudit(id, type) { | 371 | onAudit(id, type) { |
| 351 | const CACHE_KEY = 'sourceBusinessId' | 372 | const CACHE_KEY = 'sourceBusinessId' |
| @@ -533,4 +554,4 @@ export default { | @@ -533,4 +554,4 @@ export default { | ||
| 533 | .upload-row { | 554 | .upload-row { |
| 534 | margin-top: 20rpx; | 555 | margin-top: 20rpx; |
| 535 | } | 556 | } |
| 536 | -</style> | ||
| 557 | +</style> |
| @@ -227,7 +227,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | @@ -227,7 +227,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 227 | import RelateSelectSheet from '@/components/relate-select/index.vue' | 227 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 228 | import ProductRel from './productRel.vue' | 228 | import ProductRel from './productRel.vue' |
| 229 | import CitySelector from '@/components/city-selector/index.vue' | 229 | import CitySelector from '@/components/city-selector/index.vue' |
| 230 | -import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements, getDeptApi } from '@/api/contract' | 230 | +import { getRetailCodeApi, createContractApi, getCustomerRemarks, getCustomerSpecificQualityRequirements, getDeptApi, getContractApi } from '@/api/contract' |
| 231 | import { getDicByCodes } from '@/utils/dic' | 231 | import { getDicByCodes } from '@/utils/dic' |
| 232 | import { formatCurrencyToChinese } from '@/utils/common' | 232 | import { formatCurrencyToChinese } from '@/utils/common' |
| 233 | import { workshopQueryApi } from '@/api/devManage' | 233 | import { workshopQueryApi } from '@/api/devManage' |
| @@ -238,6 +238,8 @@ export default { | @@ -238,6 +238,8 @@ export default { | ||
| 238 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, | 238 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, |
| 239 | data() { | 239 | data() { |
| 240 | return { | 240 | return { |
| 241 | + copyId: '', | ||
| 242 | + operateType: 'ADD', | ||
| 241 | form: { | 243 | form: { |
| 242 | code: '', | 244 | code: '', |
| 243 | supplier: '', | 245 | supplier: '', |
| @@ -292,13 +294,22 @@ export default { | @@ -292,13 +294,22 @@ export default { | ||
| 292 | regionOptions: [], | 294 | regionOptions: [], |
| 293 | } | 295 | } |
| 294 | }, | 296 | }, |
| 297 | + onLoad(query) { | ||
| 298 | + const copyId = (query && query.copyId) ? String(query.copyId) : '' | ||
| 299 | + this.copyId = copyId | ||
| 300 | + this.operateType = copyId ? 'COPY' : 'ADD' | ||
| 301 | + uni.setNavigationBarTitle({ | ||
| 302 | + title: copyId ? '复制经销标准合同' : '新增经销标准合同' | ||
| 303 | + }) | ||
| 304 | + }, | ||
| 295 | created() { | 305 | created() { |
| 296 | this.loadSuppliers() | 306 | this.loadSuppliers() |
| 297 | this.loadExtraOptions() | 307 | this.loadExtraOptions() |
| 298 | this.initCode() | 308 | this.initCode() |
| 299 | this.getDept() | 309 | this.getDept() |
| 300 | this.loadRegionOptions() | 310 | this.loadRegionOptions() |
| 301 | - this.form.orderDate = this.formatDate(new Date()) | 311 | + if (!this.copyId) this.form.orderDate = this.formatDate(new Date()) |
| 312 | + if (this.copyId) this.loadCopyDetail(this.copyId) | ||
| 302 | this.$nextTick(() => { | 313 | this.$nextTick(() => { |
| 303 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { | 314 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { |
| 304 | this.initDestinationLabel() | 315 | this.initDestinationLabel() |
| @@ -347,6 +358,83 @@ export default { | @@ -347,6 +358,83 @@ export default { | ||
| 347 | }, | 358 | }, |
| 348 | }, | 359 | }, |
| 349 | methods: { | 360 | methods: { |
| 361 | + async loadCopyDetail(id) { | ||
| 362 | + const rid = (id !== undefined && id !== null) ? String(id) : '' | ||
| 363 | + if (!rid) return | ||
| 364 | + try { | ||
| 365 | + const res = await getContractApi(rid) | ||
| 366 | + const data = res && res.data ? res.data : {} | ||
| 367 | + const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') | ||
| 368 | + const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') | ||
| 369 | + const m = { ...data, includesPackagingFeeName, includesTransportFeeName } | ||
| 370 | + | ||
| 371 | + const code = this.form.code | ||
| 372 | + this.form = { | ||
| 373 | + ...this.form, | ||
| 374 | + supplier: m.supplier || '', | ||
| 375 | + supplierName: m.supplierName || '', | ||
| 376 | + buyer: m.buyer || (m.customer && m.customer.id) || '', | ||
| 377 | + buyerName: m.buyerName || (m.customer && m.customer.name) || '', | ||
| 378 | + orderDate: m.orderDate || this.form.orderDate, | ||
| 379 | + deliveryDate: m.deliveryDate || '', | ||
| 380 | + designatedConsignee: m.designatedConsignee || '', | ||
| 381 | + specialTerms: m.specialTerms || '', | ||
| 382 | + specialTermsName: m.specialTermsName || '', | ||
| 383 | + executionStandard: m.executionStandard || '', | ||
| 384 | + executionStandardName: m.executionStandardName || '', | ||
| 385 | + executionStandardRemarks: m.executionStandardRemarks || '', | ||
| 386 | + includesPackagingFee: !!m.includesPackagingFee, | ||
| 387 | + includesPackagingFeeName, | ||
| 388 | + includesTransportFee: !!m.includesTransportFee, | ||
| 389 | + includesTransportFeeName, | ||
| 390 | + unit: m.unit || this.form.unit, | ||
| 391 | + totalAmountCapital: m.totalAmountCapital || '', | ||
| 392 | + depositInfo: m.depositInfo || '', | ||
| 393 | + packagingRequirements: m.packagingRequirements || '', | ||
| 394 | + paymentTerms: m.paymentTerms || '', | ||
| 395 | + transportMode: m.transportMode || '', | ||
| 396 | + destinationId: (m.provinceId && m.cityId && m.districtId) ? [m.provinceId, m.cityId, m.districtId] : (Array.isArray(m.destinationId) ? m.destinationId : []), | ||
| 397 | + destinationLabel: (m.provinceName && m.cityName && m.districtName) ? `${m.provinceName} / ${m.cityName} / ${m.districtName}` : (m.destinationLabel || ''), | ||
| 398 | + specialInstructions: m.specialInstructions || '', | ||
| 399 | + remarks: m.remarks || '', | ||
| 400 | + pieceWeightHead: m.pieceWeightHead || '', | ||
| 401 | + surface: m.surface || '', | ||
| 402 | + tolerance: m.tolerance || '', | ||
| 403 | + performance: m.performance || '', | ||
| 404 | + component: m.component || '', | ||
| 405 | + packaging: m.packaging || '', | ||
| 406 | + workshopId: m.workshopId || '', | ||
| 407 | + workshopIdName: m.workshopName || m.workshopIdName || '', | ||
| 408 | + stockUpCompanyId: m.stockUpCompanyId || '', | ||
| 409 | + stockUpCompanyName: m.stockUpCompanyName || '', | ||
| 410 | + region: m.region || '', | ||
| 411 | + regionName: m.regionName || '', | ||
| 412 | + deptName: m.deptName || this.form.deptName, | ||
| 413 | + deptId: m.deptId || this.form.deptId, | ||
| 414 | + code, | ||
| 415 | + } | ||
| 416 | + | ||
| 417 | + const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : [] | ||
| 418 | + await this.$nextTick() | ||
| 419 | + const comp = this.$refs.productRel | ||
| 420 | + if (comp && typeof comp.defaultItem === 'function') { | ||
| 421 | + const nextItems = (lines.length ? lines : [{}]).map(x => ({ | ||
| 422 | + ...comp.defaultItem(), | ||
| 423 | + ...x, | ||
| 424 | + sampleOrder: !!x.sampleOrder, | ||
| 425 | + collapsed: true | ||
| 426 | + })) | ||
| 427 | + if (!lines.length && nextItems[0]) nextItems[0].collapsed = false | ||
| 428 | + comp.items = nextItems | ||
| 429 | + if (typeof comp.recalculateAll === 'function') comp.recalculateAll() | ||
| 430 | + if (typeof comp.emitChange === 'function') comp.emitChange() | ||
| 431 | + } else { | ||
| 432 | + this.onProductsChange(lines) | ||
| 433 | + } | ||
| 434 | + } catch (e) { | ||
| 435 | + uni.showToast({ title: '复制失败,请稍后重试', icon: 'none' }) | ||
| 436 | + } | ||
| 437 | + }, | ||
| 350 | async loadRegionOptions() { | 438 | async loadRegionOptions() { |
| 351 | try { | 439 | try { |
| 352 | const res = await getArea() | 440 | const res = await getArea() |
| @@ -552,8 +640,9 @@ export default { | @@ -552,8 +640,9 @@ export default { | ||
| 552 | }, | 640 | }, |
| 553 | async onSubmit() { | 641 | async onSubmit() { |
| 554 | if (!this.validateRequired()) return | 642 | if (!this.validateRequired()) return |
| 643 | + const isCopy = !!this.copyId | ||
| 555 | const confirmRes = await new Promise(resolve => { | 644 | const confirmRes = await new Promise(resolve => { |
| 556 | - uni.showModal({ title: '提示', content: '确定新增经销标准合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) | 645 | + uni.showModal({ title: '提示', content: isCopy ? '确定复制经销标准合同吗?' : '确定新增经销标准合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) |
| 557 | }) | 646 | }) |
| 558 | if (!(confirmRes && confirmRes.confirm)) return | 647 | if (!(confirmRes && confirmRes.confirm)) return |
| 559 | const clean = (obj) => { | 648 | const clean = (obj) => { |
| @@ -573,6 +662,7 @@ export default { | @@ -573,6 +662,7 @@ export default { | ||
| 573 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; | 662 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; |
| 574 | const payload = clean({ | 663 | const payload = clean({ |
| 575 | ...formForSubmit, | 664 | ...formForSubmit, |
| 665 | + operateType: this.copyId ? 'COPY' : 'ADD', | ||
| 576 | destination, | 666 | destination, |
| 577 | type: 'DISTRIB_STD', | 667 | type: 'DISTRIB_STD', |
| 578 | totalQuantity: this.totalQuantity, | 668 | totalQuantity: this.totalQuantity, |
| @@ -584,10 +674,10 @@ export default { | @@ -584,10 +674,10 @@ export default { | ||
| 584 | 674 | ||
| 585 | try { | 675 | try { |
| 586 | await createContractApi(payload) | 676 | await createContractApi(payload) |
| 587 | - uni.showToast({ title: '新增成功', icon: 'none' }) | 677 | + uni.showToast({ title: isCopy ? '复制成功' : '新增成功', icon: 'none' }) |
| 588 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_retail/index' }) }, 400) | 678 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_retail/index' }) }, 400) |
| 589 | } catch (e) { | 679 | } catch (e) { |
| 590 | - uni.showToast({ title: e.msg ||'新增失败', icon: 'none' }) | 680 | + uni.showToast({ title: e.msg || (isCopy ? '复制失败' : '新增失败'), icon: 'none' }) |
| 591 | } | 681 | } |
| 592 | }, | 682 | }, |
| 593 | validateRequired() { | 683 | validateRequired() { |
| @@ -209,6 +209,12 @@ export default { | @@ -209,6 +209,12 @@ export default { | ||
| 209 | visible: true, | 209 | visible: true, |
| 210 | event: 'auditDetail' | 210 | event: 'auditDetail' |
| 211 | }, | 211 | }, |
| 212 | + { | ||
| 213 | + text: '复制', | ||
| 214 | + visible: true, | ||
| 215 | + variant: 'outline', | ||
| 216 | + event: 'copy' | ||
| 217 | + } | ||
| 212 | ], | 218 | ], |
| 213 | statusStyle: statusStyle, | 219 | statusStyle: statusStyle, |
| 214 | dicOptions: { AUDIT_STATUS: [] } | 220 | dicOptions: { AUDIT_STATUS: [] } |
| @@ -225,6 +231,7 @@ export default { | @@ -225,6 +231,7 @@ export default { | ||
| 225 | { ...this.buttons[2], visible: (s !== 'DELETED' && t !== 'AUDIT' && t !== 'PASS' && this.$auth.hasPermi('contract-manage:distribution-standard-contract:upload')) }, | 231 | { ...this.buttons[2], visible: (s !== 'DELETED' && t !== 'AUDIT' && t !== 'PASS' && this.$auth.hasPermi('contract-manage:distribution-standard-contract:upload')) }, |
| 226 | { ...this.buttons[4], visible: (s === 'STANDARD' && this.$auth.hasPermi('contract-manage:distribution-standard-contract:review')) }, | 232 | { ...this.buttons[4], visible: (s === 'STANDARD' && this.$auth.hasPermi('contract-manage:distribution-standard-contract:review')) }, |
| 227 | { ...this.buttons[3], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-standard-contract:approve')) }, | 233 | { ...this.buttons[3], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-standard-contract:approve')) }, |
| 234 | + { ...this.buttons[5], visible: (s !== 'DELETED' && this.$auth.hasPermi('contract-manage:distribution-standard-contract:copy')) }, | ||
| 228 | ] | 235 | ] |
| 229 | } | 236 | } |
| 230 | }, | 237 | }, |
| @@ -363,10 +370,21 @@ export default { | @@ -363,10 +370,21 @@ export default { | ||
| 363 | if (e === 'upload') return this.onUpload(btn && btn.params) | 370 | if (e === 'upload') return this.onUpload(btn && btn.params) |
| 364 | if (e === 'audit') return this.onAudit(btn && btn.params) | 371 | if (e === 'audit') return this.onAudit(btn && btn.params) |
| 365 | if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params) | 372 | if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params) |
| 373 | + if (e === 'copy') return this.onCopy(btn && btn.params) | ||
| 366 | }, | 374 | }, |
| 367 | getBusinessId() { | 375 | getBusinessId() { |
| 368 | return (this.detail && (this.detail.id || this.detail.code)) || '' | 376 | return (this.detail && (this.detail.id || this.detail.code)) || '' |
| 369 | }, | 377 | }, |
| 378 | + onCopy() { | ||
| 379 | + const id = this.getBusinessId() | ||
| 380 | + if (!id) { | ||
| 381 | + uni.showToast({ title: '未获取到合同ID,无法复制', icon: 'none' }) | ||
| 382 | + return | ||
| 383 | + } | ||
| 384 | + uni.navigateTo({ | ||
| 385 | + url: '/pages/contract_retail/add?copyId=' + encodeURIComponent(id) | ||
| 386 | + }) | ||
| 387 | + }, | ||
| 370 | onAudit() { | 388 | onAudit() { |
| 371 | const CACHE_KEY = 'sourceBusinessId' | 389 | const CACHE_KEY = 'sourceBusinessId' |
| 372 | uni.setStorageSync(CACHE_KEY, this.getBusinessId()) | 390 | uni.setStorageSync(CACHE_KEY, this.getBusinessId()) |
| @@ -225,7 +225,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | @@ -225,7 +225,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 225 | import RelateSelectSheet from '@/components/relate-select/index.vue' | 225 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 226 | import ProductRel from './productRel.vue' | 226 | import ProductRel from './productRel.vue' |
| 227 | import CitySelector from '@/components/city-selector/index.vue' | 227 | import CitySelector from '@/components/city-selector/index.vue' |
| 228 | -import { getRetailCodeApi, createContractApi,getCustomerRemarks,getCustomerSpecificQualityRequirements, getDeptApi } from '@/api/contract' | 228 | +import { getRetailCodeApi, createContractApi,getCustomerRemarks,getCustomerSpecificQualityRequirements, getDeptApi,getContractApi } from '@/api/contract' |
| 229 | import { getDicByCodes } from '@/utils/dic' | 229 | import { getDicByCodes } from '@/utils/dic' |
| 230 | import { formatCurrencyToChinese } from '@/utils/common' | 230 | import { formatCurrencyToChinese } from '@/utils/common' |
| 231 | import { workshopQueryApi } from '@/api/devManage' | 231 | import { workshopQueryApi } from '@/api/devManage' |
| @@ -236,6 +236,8 @@ export default { | @@ -236,6 +236,8 @@ export default { | ||
| 236 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, | 236 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, |
| 237 | data() { | 237 | data() { |
| 238 | return { | 238 | return { |
| 239 | + copyId: '', | ||
| 240 | + operateType: 'ADD', | ||
| 239 | form: { | 241 | form: { |
| 240 | code: '', | 242 | code: '', |
| 241 | supplier: '', | 243 | supplier: '', |
| @@ -290,13 +292,22 @@ export default { | @@ -290,13 +292,22 @@ export default { | ||
| 290 | regionOptions: [], | 292 | regionOptions: [], |
| 291 | } | 293 | } |
| 292 | }, | 294 | }, |
| 295 | + onLoad(query) { | ||
| 296 | + const copyId = (query && query.copyId) ? String(query.copyId) : '' | ||
| 297 | + this.copyId = copyId | ||
| 298 | + this.operateType = copyId ? 'COPY' : 'ADD' | ||
| 299 | + uni.setNavigationBarTitle({ | ||
| 300 | + title: copyId ? '复制经销库存合同' : '新增经销库存合同' | ||
| 301 | + }) | ||
| 302 | + }, | ||
| 293 | created() { | 303 | created() { |
| 294 | this.loadSuppliers() | 304 | this.loadSuppliers() |
| 295 | this.loadExtraOptions() | 305 | this.loadExtraOptions() |
| 296 | this.initCode() | 306 | this.initCode() |
| 297 | this.getDept() | 307 | this.getDept() |
| 298 | this.loadRegionOptions() | 308 | this.loadRegionOptions() |
| 299 | - this.form.orderDate = this.formatDate(new Date()) | 309 | + if (!this.copyId) this.form.orderDate = this.formatDate(new Date()) |
| 310 | + if (this.copyId) this.loadCopyDetail(this.copyId) | ||
| 300 | this.$nextTick(() => { | 311 | this.$nextTick(() => { |
| 301 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { | 312 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { |
| 302 | this.initDestinationLabel() | 313 | this.initDestinationLabel() |
| @@ -344,6 +355,83 @@ export default { | @@ -344,6 +355,83 @@ export default { | ||
| 344 | }, | 355 | }, |
| 345 | }, | 356 | }, |
| 346 | methods: { | 357 | methods: { |
| 358 | + async loadCopyDetail(id) { | ||
| 359 | + const rid = (id !== undefined && id !== null) ? String(id) : '' | ||
| 360 | + if (!rid) return | ||
| 361 | + try { | ||
| 362 | + const res = await getContractApi(rid) | ||
| 363 | + const data = res && res.data ? res.data : {} | ||
| 364 | + const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') | ||
| 365 | + const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') | ||
| 366 | + const m = { ...data, includesPackagingFeeName, includesTransportFeeName } | ||
| 367 | + | ||
| 368 | + const code = this.form.code | ||
| 369 | + this.form = { | ||
| 370 | + ...this.form, | ||
| 371 | + supplier: m.supplier || '', | ||
| 372 | + supplierName: m.supplierName || '', | ||
| 373 | + buyer: m.buyer || (m.customer && m.customer.id) || '', | ||
| 374 | + buyerName: m.buyerName || (m.customer && m.customer.name) || '', | ||
| 375 | + orderDate: m.orderDate || this.form.orderDate, | ||
| 376 | + deliveryDate: m.deliveryDate || '', | ||
| 377 | + designatedConsignee: m.designatedConsignee || '', | ||
| 378 | + specialTerms: m.specialTerms || '', | ||
| 379 | + specialTermsName: m.specialTermsName || '', | ||
| 380 | + executionStandard: m.executionStandard || '', | ||
| 381 | + executionStandardName: m.executionStandardName || '', | ||
| 382 | + executionStandardRemarks: m.executionStandardRemarks || '', | ||
| 383 | + includesPackagingFee: !!m.includesPackagingFee, | ||
| 384 | + includesPackagingFeeName, | ||
| 385 | + includesTransportFee: !!m.includesTransportFee, | ||
| 386 | + includesTransportFeeName, | ||
| 387 | + unit: m.unit || this.form.unit, | ||
| 388 | + totalAmountCapital: m.totalAmountCapital || '', | ||
| 389 | + depositInfo: m.depositInfo || '', | ||
| 390 | + packagingRequirements: m.packagingRequirements || '', | ||
| 391 | + paymentTerms: m.paymentTerms || '', | ||
| 392 | + transportMode: m.transportMode || '', | ||
| 393 | + destinationId: (m.provinceId && m.cityId && m.districtId) ? [m.provinceId, m.cityId, m.districtId] : (Array.isArray(m.destinationId) ? m.destinationId : []), | ||
| 394 | + destinationLabel: (m.provinceName && m.cityName && m.districtName) ? `${m.provinceName} / ${m.cityName} / ${m.districtName}` : (m.destinationLabel || ''), | ||
| 395 | + specialInstructions: m.specialInstructions || '', | ||
| 396 | + remarks: m.remarks || '', | ||
| 397 | + pieceWeightHead: m.pieceWeightHead || '', | ||
| 398 | + surface: m.surface || '', | ||
| 399 | + tolerance: m.tolerance || '', | ||
| 400 | + performance: m.performance || '', | ||
| 401 | + component: m.component || '', | ||
| 402 | + packaging: m.packaging || '', | ||
| 403 | + workshopId: m.workshopId || '', | ||
| 404 | + workshopIdName: m.workshopName || m.workshopIdName || '', | ||
| 405 | + stockUpCompanyId: m.stockUpCompanyId || '', | ||
| 406 | + stockUpCompanyName: m.stockUpCompanyName || '', | ||
| 407 | + region: m.region || '', | ||
| 408 | + regionName: m.regionName || '', | ||
| 409 | + deptName: m.deptName || this.form.deptName, | ||
| 410 | + deptId: m.deptId || this.form.deptId, | ||
| 411 | + code, | ||
| 412 | + } | ||
| 413 | + | ||
| 414 | + const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : [] | ||
| 415 | + await this.$nextTick() | ||
| 416 | + const comp = this.$refs.productRel | ||
| 417 | + if (comp && typeof comp.defaultItem === 'function') { | ||
| 418 | + const nextItems = (lines.length ? lines : [{}]).map(x => ({ | ||
| 419 | + ...comp.defaultItem(), | ||
| 420 | + ...x, | ||
| 421 | + sampleOrder: !!x.sampleOrder, | ||
| 422 | + collapsed: true | ||
| 423 | + })) | ||
| 424 | + if (!lines.length && nextItems[0]) nextItems[0].collapsed = false | ||
| 425 | + comp.items = nextItems | ||
| 426 | + if (typeof comp.recalculateAll === 'function') comp.recalculateAll() | ||
| 427 | + if (typeof comp.emitChange === 'function') comp.emitChange() | ||
| 428 | + } else { | ||
| 429 | + this.onProductsChange(lines) | ||
| 430 | + } | ||
| 431 | + } catch (e) { | ||
| 432 | + uni.showToast({ title: '复制失败,请稍后重试', icon: 'none' }) | ||
| 433 | + } | ||
| 434 | + }, | ||
| 347 | async loadRegionOptions() { | 435 | async loadRegionOptions() { |
| 348 | try { | 436 | try { |
| 349 | const res = await getArea() | 437 | const res = await getArea() |
| @@ -549,8 +637,9 @@ export default { | @@ -549,8 +637,9 @@ export default { | ||
| 549 | }, | 637 | }, |
| 550 | async onSubmit() { | 638 | async onSubmit() { |
| 551 | if (!this.validateRequired()) return | 639 | if (!this.validateRequired()) return |
| 640 | + const isCopy = !!this.copyId | ||
| 552 | const confirmRes = await new Promise(resolve => { | 641 | const confirmRes = await new Promise(resolve => { |
| 553 | - uni.showModal({ title: '提示', content: '确定新增经销库存合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) | 642 | + uni.showModal({ title: '提示', content: isCopy ? '确定复制经销库存合同吗?' : '确定新增经销库存合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) |
| 554 | }) | 643 | }) |
| 555 | if (!(confirmRes && confirmRes.confirm)) return | 644 | if (!(confirmRes && confirmRes.confirm)) return |
| 556 | const clean = (obj) => { | 645 | const clean = (obj) => { |
| @@ -570,6 +659,7 @@ export default { | @@ -570,6 +659,7 @@ export default { | ||
| 570 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; | 659 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; |
| 571 | const payload = clean({ | 660 | const payload = clean({ |
| 572 | ...formForSubmit, | 661 | ...formForSubmit, |
| 662 | + operateType: this.copyId ? 'COPY' : 'ADD', | ||
| 573 | destination, | 663 | destination, |
| 574 | type: 'DIST_STOCK_CONTRACT', | 664 | type: 'DIST_STOCK_CONTRACT', |
| 575 | totalQuantity: this.totalQuantity, | 665 | totalQuantity: this.totalQuantity, |
| @@ -581,10 +671,10 @@ export default { | @@ -581,10 +671,10 @@ export default { | ||
| 581 | 671 | ||
| 582 | try { | 672 | try { |
| 583 | await createContractApi(payload) | 673 | await createContractApi(payload) |
| 584 | - uni.showToast({ title: '新增成功', icon: 'none' }) | 674 | + uni.showToast({ title: isCopy ? '复制成功' : '新增成功', icon: 'none' }) |
| 585 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_stock/index' }) }, 400) | 675 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_stock/index' }) }, 400) |
| 586 | } catch (e) { | 676 | } catch (e) { |
| 587 | - uni.showToast({ title: e.msg ||'新增失败', icon: 'none' }) | 677 | + uni.showToast({ title: e.msg || (isCopy ? '复制失败' : '新增失败'), icon: 'none' }) |
| 588 | } | 678 | } |
| 589 | }, | 679 | }, |
| 590 | validateRequired() { | 680 | validateRequired() { |
| @@ -266,6 +266,12 @@ export default { | @@ -266,6 +266,12 @@ export default { | ||
| 266 | visible: true, | 266 | visible: true, |
| 267 | event: 'auditDetail3' | 267 | event: 'auditDetail3' |
| 268 | }, | 268 | }, |
| 269 | + { | ||
| 270 | + text: '复制', | ||
| 271 | + visible: true, | ||
| 272 | + variant: 'outline', | ||
| 273 | + event: 'copy' | ||
| 274 | + } | ||
| 269 | ], | 275 | ], |
| 270 | uploadId: '', | 276 | uploadId: '', |
| 271 | uploadType: 'formal', | 277 | uploadType: 'formal', |
| @@ -292,6 +298,7 @@ export default { | @@ -292,6 +298,7 @@ export default { | ||
| 292 | { ...this.buttons[6], visible: (s === 'FORMAL' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:approve')) }, | 298 | { ...this.buttons[6], visible: (s === 'FORMAL' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:approve')) }, |
| 293 | { ...this.buttons[7], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:approve')) }, | 299 | { ...this.buttons[7], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:approve')) }, |
| 294 | { ...this.buttons[8], visible: (s === 'STANDARD' && f && a === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:standard-approve')) }, | 300 | { ...this.buttons[8], visible: (s === 'STANDARD' && f && a === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:standard-approve')) }, |
| 301 | + { ...this.buttons[12], visible: (s !== 'DELETED' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:copy')) }, | ||
| 295 | ] | 302 | ] |
| 296 | } | 303 | } |
| 297 | }, | 304 | }, |
| @@ -426,6 +433,7 @@ export default { | @@ -426,6 +433,7 @@ export default { | ||
| 426 | if (e === 'auditDetail1') return this.onAuditDetail(this.detail.id || '', 'FORMAL_CONTRACT') | 433 | if (e === 'auditDetail1') return this.onAuditDetail(this.detail.id || '', 'FORMAL_CONTRACT') |
| 427 | if (e === 'auditDetail2') return this.onAuditDetail(this.detail.parentId || '', 'FORMAL_CONTRACT') | 434 | if (e === 'auditDetail2') return this.onAuditDetail(this.detail.parentId || '', 'FORMAL_CONTRACT') |
| 428 | if (e === 'auditDetail3') return this.onAuditDetail(this.detail.id || '', 'STANDARD_CONTRACT') | 435 | if (e === 'auditDetail3') return this.onAuditDetail(this.detail.id || '', 'STANDARD_CONTRACT') |
| 436 | + if (e === 'copy') return this.onCopy(this.detail) | ||
| 429 | }, | 437 | }, |
| 430 | onAudit(id, type) { | 438 | onAudit(id, type) { |
| 431 | const CACHE_KEY = 'sourceBusinessId' | 439 | const CACHE_KEY = 'sourceBusinessId' |
| @@ -434,6 +442,11 @@ export default { | @@ -434,6 +442,11 @@ export default { | ||
| 434 | uni.setStorageSync(CACHE_KEY, id) | 442 | uni.setStorageSync(CACHE_KEY, id) |
| 435 | uni.navigateTo({ url: '/pages/flow/audit' }) | 443 | uni.navigateTo({ url: '/pages/flow/audit' }) |
| 436 | }, | 444 | }, |
| 445 | + onCopy(params) { | ||
| 446 | + uni.navigateTo({ | ||
| 447 | + url: '/pages/contract_stock/add?copyId=' + encodeURIComponent(params.id) || '' | ||
| 448 | + }) | ||
| 449 | + }, | ||
| 437 | onAuditDetail(id, type) { | 450 | onAuditDetail(id, type) { |
| 438 | const CACHE_KEY = 'sourceBusinessId' | 451 | const CACHE_KEY = 'sourceBusinessId' |
| 439 | const TYPE = 'contractType' | 452 | const TYPE = 'contractType' |
| @@ -227,7 +227,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | @@ -227,7 +227,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 227 | import RelateSelectSheet from '@/components/relate-select/index.vue' | 227 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 228 | import ProductRel from './productRel.vue' | 228 | import ProductRel from './productRel.vue' |
| 229 | import CitySelector from '@/components/city-selector/index.vue' | 229 | import CitySelector from '@/components/city-selector/index.vue' |
| 230 | -import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements, getDeptApi } from '@/api/contract' | 230 | +import { getRetailCodeApi, createContractApi, getCustomerRemarks, getCustomerSpecificQualityRequirements, getDeptApi, getContractApi } from '@/api/contract' |
| 231 | import { getDicByCodes } from '@/utils/dic' | 231 | import { getDicByCodes } from '@/utils/dic' |
| 232 | import { formatCurrencyToChinese } from '@/utils/common' | 232 | import { formatCurrencyToChinese } from '@/utils/common' |
| 233 | import { workshopQueryApi } from '@/api/devManage' | 233 | import { workshopQueryApi } from '@/api/devManage' |
| @@ -238,6 +238,8 @@ export default { | @@ -238,6 +238,8 @@ export default { | ||
| 238 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, | 238 | components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, |
| 239 | data() { | 239 | data() { |
| 240 | return { | 240 | return { |
| 241 | + copyId: '', | ||
| 242 | + operateType: 'ADD', | ||
| 241 | form: { | 243 | form: { |
| 242 | code: '', | 244 | code: '', |
| 243 | supplier: '', | 245 | supplier: '', |
| @@ -292,13 +294,22 @@ export default { | @@ -292,13 +294,22 @@ export default { | ||
| 292 | regionOptions: [], | 294 | regionOptions: [], |
| 293 | } | 295 | } |
| 294 | }, | 296 | }, |
| 297 | + onLoad(query) { | ||
| 298 | + const copyId = (query && query.copyId) ? String(query.copyId) : '' | ||
| 299 | + this.copyId = copyId | ||
| 300 | + this.operateType = copyId ? 'COPY' : 'ADD' | ||
| 301 | + uni.setNavigationBarTitle({ | ||
| 302 | + title: copyId ? '复制经销未锁规合同' : '新增经销未锁规合同' | ||
| 303 | + }) | ||
| 304 | + }, | ||
| 295 | created() { | 305 | created() { |
| 296 | this.loadSuppliers() | 306 | this.loadSuppliers() |
| 297 | this.loadExtraOptions() | 307 | this.loadExtraOptions() |
| 298 | this.initCode() | 308 | this.initCode() |
| 299 | this.getDept() | 309 | this.getDept() |
| 300 | this.loadRegionOptions() | 310 | this.loadRegionOptions() |
| 301 | - this.form.orderDate = this.formatDate(new Date()) | 311 | + if (!this.copyId) this.form.orderDate = this.formatDate(new Date()) |
| 312 | + if (this.copyId) this.loadCopyDetail(this.copyId) | ||
| 302 | this.$nextTick(() => { | 313 | this.$nextTick(() => { |
| 303 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { | 314 | if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { |
| 304 | this.initDestinationLabel() | 315 | this.initDestinationLabel() |
| @@ -348,6 +359,83 @@ export default { | @@ -348,6 +359,83 @@ export default { | ||
| 348 | }, | 359 | }, |
| 349 | }, | 360 | }, |
| 350 | methods: { | 361 | methods: { |
| 362 | + async loadCopyDetail(id) { | ||
| 363 | + const rid = (id !== undefined && id !== null) ? String(id) : '' | ||
| 364 | + if (!rid) return | ||
| 365 | + try { | ||
| 366 | + const res = await getContractApi(rid) | ||
| 367 | + const data = res && res.data ? res.data : {} | ||
| 368 | + const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') | ||
| 369 | + const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') | ||
| 370 | + const m = { ...data, includesPackagingFeeName, includesTransportFeeName } | ||
| 371 | + | ||
| 372 | + const code = this.form.code | ||
| 373 | + this.form = { | ||
| 374 | + ...this.form, | ||
| 375 | + supplier: m.supplier || '', | ||
| 376 | + supplierName: m.supplierName || '', | ||
| 377 | + buyer: m.buyer || (m.customer && m.customer.id) || '', | ||
| 378 | + buyerName: m.buyerName || (m.customer && m.customer.name) || '', | ||
| 379 | + stockUpCompanyId: m.stockUpCompanyId || '', | ||
| 380 | + stockUpCompanyName: m.stockUpCompanyName || '', | ||
| 381 | + deptName: m.deptName || this.form.deptName, | ||
| 382 | + deptId: m.deptId || this.form.deptId, | ||
| 383 | + region: m.region || '', | ||
| 384 | + regionName: m.regionName || '', | ||
| 385 | + orderDate: m.orderDate || this.form.orderDate, | ||
| 386 | + deliveryDate: m.deliveryDate || '', | ||
| 387 | + designatedConsignee: m.designatedConsignee || '', | ||
| 388 | + specialTerms: m.specialTerms || '', | ||
| 389 | + specialTermsName: m.specialTermsName || '', | ||
| 390 | + executionStandard: m.executionStandard || '', | ||
| 391 | + executionStandardName: m.executionStandardName || '', | ||
| 392 | + executionStandardRemarks: m.executionStandardRemarks || '', | ||
| 393 | + includesPackagingFee: !!m.includesPackagingFee, | ||
| 394 | + includesPackagingFeeName, | ||
| 395 | + includesTransportFee: !!m.includesTransportFee, | ||
| 396 | + includesTransportFeeName, | ||
| 397 | + unit: m.unit || this.form.unit, | ||
| 398 | + totalAmountCapital: m.totalAmountCapital || '', | ||
| 399 | + depositInfo: m.depositInfo || '', | ||
| 400 | + packagingRequirements: m.packagingRequirements || '', | ||
| 401 | + paymentTerms: m.paymentTerms || '', | ||
| 402 | + transportMode: m.transportMode || '', | ||
| 403 | + destinationId: (m.provinceId && m.cityId && m.districtId) ? [m.provinceId, m.cityId, m.districtId] : (Array.isArray(m.destinationId) ? m.destinationId : []), | ||
| 404 | + destinationLabel: (m.provinceName && m.cityName && m.districtName) ? `${m.provinceName} / ${m.cityName} / ${m.districtName}` : (m.destinationLabel || ''), | ||
| 405 | + specialInstructions: m.specialInstructions || '', | ||
| 406 | + remarks: m.remarks || '', | ||
| 407 | + pieceWeightHead: m.pieceWeightHead || '', | ||
| 408 | + surface: m.surface || '', | ||
| 409 | + tolerance: m.tolerance || '', | ||
| 410 | + performance: m.performance || '', | ||
| 411 | + component: m.component || '', | ||
| 412 | + packaging: m.packaging || '', | ||
| 413 | + workshopId: m.workshopId || '', | ||
| 414 | + workshopIdName: m.workshopName || m.workshopIdName || '', | ||
| 415 | + code, | ||
| 416 | + } | ||
| 417 | + | ||
| 418 | + const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : [] | ||
| 419 | + await this.$nextTick() | ||
| 420 | + const comp = this.$refs.productRel | ||
| 421 | + if (comp && typeof comp.defaultItem === 'function') { | ||
| 422 | + const nextItems = (lines.length ? lines : [{}]).map(x => ({ | ||
| 423 | + ...comp.defaultItem(), | ||
| 424 | + ...x, | ||
| 425 | + sampleOrder: !!x.sampleOrder, | ||
| 426 | + collapsed: true | ||
| 427 | + })) | ||
| 428 | + if (!lines.length && nextItems[0]) nextItems[0].collapsed = false | ||
| 429 | + comp.items = nextItems | ||
| 430 | + if (typeof comp.recalculateAll === 'function') comp.recalculateAll() | ||
| 431 | + if (typeof comp.emitChange === 'function') comp.emitChange() | ||
| 432 | + } else { | ||
| 433 | + this.onProductsChange(lines) | ||
| 434 | + } | ||
| 435 | + } catch (e) { | ||
| 436 | + uni.showToast({ title: '复制失败,请稍后重试', icon: 'none' }) | ||
| 437 | + } | ||
| 438 | + }, | ||
| 351 | async loadRegionOptions() { | 439 | async loadRegionOptions() { |
| 352 | try { | 440 | try { |
| 353 | const res = await getArea() | 441 | const res = await getArea() |
| @@ -553,8 +641,9 @@ export default { | @@ -553,8 +641,9 @@ export default { | ||
| 553 | }, | 641 | }, |
| 554 | async onSubmit() { | 642 | async onSubmit() { |
| 555 | if (!this.validateRequired()) return | 643 | if (!this.validateRequired()) return |
| 644 | + const isCopy = !!this.copyId | ||
| 556 | const confirmRes = await new Promise(resolve => { | 645 | const confirmRes = await new Promise(resolve => { |
| 557 | - uni.showModal({ title: '提示', content: '确定新增经销未锁规合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) | 646 | + uni.showModal({ title: '提示', content: isCopy ? '确定复制经销未锁规合同吗?' : '确定新增经销未锁规合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) |
| 558 | }) | 647 | }) |
| 559 | if (!(confirmRes && confirmRes.confirm)) return | 648 | if (!(confirmRes && confirmRes.confirm)) return |
| 560 | const clean = (obj) => { | 649 | const clean = (obj) => { |
| @@ -574,6 +663,7 @@ export default { | @@ -574,6 +663,7 @@ export default { | ||
| 574 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; | 663 | const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''; |
| 575 | const payload = clean({ | 664 | const payload = clean({ |
| 576 | ...formForSubmit, | 665 | ...formForSubmit, |
| 666 | + operateType: isCopy ? 'COPY' : 'ADD', | ||
| 577 | destination, | 667 | destination, |
| 578 | type: 'DRAFT_DIST_AGMT', | 668 | type: 'DRAFT_DIST_AGMT', |
| 579 | totalQuantity: this.totalQuantity, | 669 | totalQuantity: this.totalQuantity, |
| @@ -585,10 +675,10 @@ export default { | @@ -585,10 +675,10 @@ export default { | ||
| 585 | 675 | ||
| 586 | try { | 676 | try { |
| 587 | await createContractApi(payload) | 677 | await createContractApi(payload) |
| 588 | - uni.showToast({ title: '新增成功', icon: 'none' }) | 678 | + uni.showToast({ title: isCopy ? '复制成功' : '新增成功', icon: 'none' }) |
| 589 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_unplan/index' }) }, 400) | 679 | setTimeout(() => { uni.redirectTo({ url: '/pages/contract_unplan/index' }) }, 400) |
| 590 | } catch (e) { | 680 | } catch (e) { |
| 591 | - uni.showToast({ title: e.msg ||'新增失败', icon: 'none' }) | 681 | + uni.showToast({ title: e.msg || (isCopy ? '复制失败' : '新增失败'), icon: 'none' }) |
| 592 | } | 682 | } |
| 593 | }, | 683 | }, |
| 594 | validateRequired() { | 684 | validateRequired() { |
| @@ -271,6 +271,12 @@ export default { | @@ -271,6 +271,12 @@ export default { | ||
| 271 | visible: true, | 271 | visible: true, |
| 272 | event: 'auditDetail3' | 272 | event: 'auditDetail3' |
| 273 | }, | 273 | }, |
| 274 | + { | ||
| 275 | + text: '复制', | ||
| 276 | + visible: true, | ||
| 277 | + variant: 'outline', | ||
| 278 | + event: 'copy' | ||
| 279 | + }, | ||
| 274 | ], | 280 | ], |
| 275 | } | 281 | } |
| 276 | }, | 282 | }, |
| @@ -296,6 +302,7 @@ export default { | @@ -296,6 +302,7 @@ export default { | ||
| 296 | { ...this.buttons[7], visible: (s === 'FORMAL' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-unlocked-contract:approve')) }, | 302 | { ...this.buttons[7], visible: (s === 'FORMAL' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-unlocked-contract:approve')) }, |
| 297 | { ...this.buttons[8], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-unlocked-contract:approve')) }, | 303 | { ...this.buttons[8], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-unlocked-contract:approve')) }, |
| 298 | { ...this.buttons[9], visible: (s === 'STANDARD' && f && a === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-unlocked-contract:standard-approve')) }, | 304 | { ...this.buttons[9], visible: (s === 'STANDARD' && f && a === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-unlocked-contract:standard-approve')) }, |
| 305 | + { ...this.buttons[13], visible: (s !== 'DELETED' && this.$auth.hasPermi('contract-manage:distribution-unlocked-contract:copy')) }, | ||
| 299 | ] | 306 | ] |
| 300 | } | 307 | } |
| 301 | }, | 308 | }, |
| @@ -445,6 +452,20 @@ export default { | @@ -445,6 +452,20 @@ export default { | ||
| 445 | if (e === 'auditDetail1') return this.onAuditDetail(this.detail.id || '', 'FORMAL_CONTRACT') | 452 | if (e === 'auditDetail1') return this.onAuditDetail(this.detail.id || '', 'FORMAL_CONTRACT') |
| 446 | if (e === 'auditDetail2') return this.onAuditDetail(this.detail.parentId || '', 'FORMAL_CONTRACT') | 453 | if (e === 'auditDetail2') return this.onAuditDetail(this.detail.parentId || '', 'FORMAL_CONTRACT') |
| 447 | if (e === 'auditDetail3') return this.onAuditDetail(this.detail.id || '', 'STANDARD_CONTRACT') | 454 | if (e === 'auditDetail3') return this.onAuditDetail(this.detail.id || '', 'STANDARD_CONTRACT') |
| 455 | + if (e === 'copy') return this.onCopy(btn && btn.params) | ||
| 456 | + }, | ||
| 457 | + getBusinessId() { | ||
| 458 | + return (this.detail && (this.detail.id || this.detail.code)) || '' | ||
| 459 | + }, | ||
| 460 | + onCopy() { | ||
| 461 | + const id = this.getBusinessId() | ||
| 462 | + if (!id) { | ||
| 463 | + uni.showToast({ title: '未获取到合同ID,无法复制', icon: 'none' }) | ||
| 464 | + return | ||
| 465 | + } | ||
| 466 | + uni.navigateTo({ | ||
| 467 | + url: '/pages/contract_unplan/add?copyId=' + encodeURIComponent(id) | ||
| 468 | + }) | ||
| 448 | }, | 469 | }, |
| 449 | onAudit(id, type) { | 470 | onAudit(id, type) { |
| 450 | const CACHE_KEY = 'sourceBusinessId' | 471 | const CACHE_KEY = 'sourceBusinessId' |
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | <view class="page"> | 2 | <view class="page"> |
| 3 | <scroll-view class="scroll" scroll-y> | 3 | <scroll-view class="scroll" scroll-y> |
| 4 | <view class="lock-page"> | 4 | <view class="lock-page"> |
| 5 | - <view class="block" v-for="(item, idx) in items" :key="idx"> | 5 | + <view class="block" v-for="(item, idx) in items" :key="item.raw && (item.raw.id || item.raw.lineId || item.raw.productId) || ('row-' + idx)"> |
| 6 | <view class="block-header"> | 6 | <view class="block-header"> |
| 7 | <uni-data-checkbox | 7 | <uni-data-checkbox |
| 8 | multiple | 8 | multiple |
| @@ -19,63 +19,79 @@ | @@ -19,63 +19,79 @@ | ||
| 19 | </view> | 19 | </view> |
| 20 | 20 | ||
| 21 | <uni-list v-show="item.collapsed"> | 21 | <uni-list v-show="item.collapsed"> |
| 22 | - <uni-list-item title="产品名称"> | ||
| 23 | - <template v-slot:footer> | ||
| 24 | - <uni-easyinput v-model="item.productName" placeholder="请输入产品名称" :clearable="false" disabled /> | 22 | + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow> |
| 23 | + <template v-slot:body> | ||
| 24 | + <view class="item-title"><text>产品名称</text></view> | ||
| 25 | </template> | 25 | </template> |
| 26 | </uni-list-item> | 26 | </uni-list-item> |
| 27 | <uni-list-item title="行业"> | 27 | <uni-list-item title="行业"> |
| 28 | <template v-slot:footer> | 28 | <template v-slot:footer> |
| 29 | - <uni-easyinput v-model="item.industry" placeholder="请输入行业" :clearable="false" disabled /> | 29 | + <uni-easyinput v-model="item.industry" placeholder="请输入行业" /> |
| 30 | </template> | 30 | </template> |
| 31 | </uni-list-item> | 31 | </uni-list-item> |
| 32 | <uni-list-item title="牌号"> | 32 | <uni-list-item title="牌号"> |
| 33 | <template v-slot:footer> | 33 | <template v-slot:footer> |
| 34 | - <uni-easyinput v-model="item.brand" placeholder="请输入牌号" :clearable="false" disabled /> | 34 | + <uni-easyinput v-model="item.brand" placeholder="请输入牌号" /> |
| 35 | </template> | 35 | </template> |
| 36 | </uni-list-item> | 36 | </uni-list-item> |
| 37 | <uni-list-item title="品质"> | 37 | <uni-list-item title="品质"> |
| 38 | <template v-slot:footer> | 38 | <template v-slot:footer> |
| 39 | - <uni-easyinput v-model="item.quality" placeholder="请输入品质" :clearable="false" disabled /> | 39 | + <uni-easyinput v-model="item.quality" placeholder="请输入品质" /> |
| 40 | </template> | 40 | </template> |
| 41 | </uni-list-item> | 41 | </uni-list-item> |
| 42 | - <uni-list-item title="规格(mm)"> | 42 | + <uni-list-item title="厚度(mm)"> |
| 43 | <template v-slot:footer> | 43 | <template v-slot:footer> |
| 44 | - <view class="value value-spec"> | ||
| 45 | - <view v-if="item.thickness" class="value-spec_val">{{ item.thickness }}</view> | ||
| 46 | - <view v-if="item.thickness" class="value-spec_box"> | ||
| 47 | - <view v-if="item.thicknessTolPos" class="value-spec_box_1">{{ item.thicknessTolPos > 0 ? '+' + item.thicknessTolPos : item.thicknessTolPos }} | ||
| 48 | - </view> | ||
| 49 | - <view v-if="item.thicknessTolNeg" class="value-spec_box_2">{{ item.thicknessTolNeg > 0 ? '+' + item.thicknessTolNeg : item.thicknessTolNeg }} | ||
| 50 | - </view> | ||
| 51 | - </view> | ||
| 52 | - <view v-if="item.width" class="value-spec_val p12">*</view> | ||
| 53 | - <view v-if="item.width" class="value-spec_val">{{ item.width }}</view> | ||
| 54 | - <view v-if="item.width" class="value-spec_box"> | ||
| 55 | - <view v-if="item.widthTolPos" class="value-spec_box_1">{{ item.widthTolPos > 0 ? '+' + item.widthTolPos : item.widthTolPos }} | ||
| 56 | - </view> | ||
| 57 | - <view v-if="item.widthTolNeg" class="value-spec_box_2">{{ item.widthTolNeg > 0 ? '+' + item.widthTolNeg : item.widthTolNeg }} | ||
| 58 | - </view> | ||
| 59 | - </view> | ||
| 60 | - <view v-if="item.length" class="value-spec_val p12">*</view> | ||
| 61 | - <view v-if="item.length" class="value-spec_val">{{ item.length }}</view> | ||
| 62 | - <view v-if="item.length" class="value-spec_box"> | ||
| 63 | - <view v-if="item.lengthTolPos" class="value-spec_box_1">{{ item.lengthTolPos > 0 ? '+' + item.lengthTolPos : item.lengthTolPos }} | ||
| 64 | - </view> | ||
| 65 | - <view v-if="item.lengthTolNeg" class="value-spec_box_2">{{ item.lengthTolNeg > 0 ? '+' + item.lengthTolNeg : item.lengthTolNeg }} | ||
| 66 | - </view> | ||
| 67 | - </view> | ||
| 68 | - </view> | 44 | + <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 9)" /> |
| 45 | + </template> | ||
| 46 | + </uni-list-item> | ||
| 47 | + <uni-list-item title="厚度公差上限(mm)"> | ||
| 48 | + <template v-slot:footer> | ||
| 49 | + <uni-easyinput type="digit" v-model="item.thicknessTolPos" :inputBorder="false" placeholder="请输入厚度公差上限" @input="onNumberInput(idx, 'thicknessTolPos')" @blur="onNumberBlur(idx, 'thicknessTolPos', 9)" /> | ||
| 50 | + </template> | ||
| 51 | + </uni-list-item> | ||
| 52 | + <uni-list-item title="厚度公差下限(mm)"> | ||
| 53 | + <template v-slot:footer> | ||
| 54 | + <uni-easyinput type="digit" v-model="item.thicknessTolNeg" :inputBorder="false" placeholder="请输入厚度公差下限" @input="onNumberInput(idx, 'thicknessTolNeg')" @blur="onNumberBlur(idx, 'thicknessTolNeg', 9)" /> | ||
| 55 | + </template> | ||
| 56 | + </uni-list-item> | ||
| 57 | + <uni-list-item title="宽度(mm)"> | ||
| 58 | + <template v-slot:footer> | ||
| 59 | + <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 9)" /> | ||
| 60 | + </template> | ||
| 61 | + </uni-list-item> | ||
| 62 | + <uni-list-item title="宽度公差上限(mm)"> | ||
| 63 | + <template v-slot:footer> | ||
| 64 | + <uni-easyinput type="digit" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差上限" @input="onNumberInput(idx, 'widthTolPos')" @blur="onNumberBlur(idx, 'widthTolPos', 9)" /> | ||
| 65 | + </template> | ||
| 66 | + </uni-list-item> | ||
| 67 | + <uni-list-item title="宽度公差下限(mm)"> | ||
| 68 | + <template v-slot:footer> | ||
| 69 | + <uni-easyinput type="digit" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNumberInput(idx, 'widthTolNeg')" @blur="onNumberBlur(idx, 'widthTolNeg', 9)" /> | ||
| 70 | + </template> | ||
| 71 | + </uni-list-item> | ||
| 72 | + <uni-list-item title="长度(mm)"> | ||
| 73 | + <template v-slot:footer> | ||
| 74 | + <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 9)" /> | ||
| 75 | + </template> | ||
| 76 | + </uni-list-item> | ||
| 77 | + <uni-list-item title="长度公差上限(mm)"> | ||
| 78 | + <template v-slot:footer> | ||
| 79 | + <uni-easyinput type="digit" v-model="item.lengthTolPos" :inputBorder="false" placeholder="请输入长度公差上限" @input="onNumberInput(idx, 'lengthTolPos')" @blur="onNumberBlur(idx, 'lengthTolPos', 9)" /> | ||
| 80 | + </template> | ||
| 81 | + </uni-list-item> | ||
| 82 | + <uni-list-item title="长度公差下限(mm)"> | ||
| 83 | + <template v-slot:footer> | ||
| 84 | + <uni-easyinput type="digit" v-model="item.lengthTolNeg" :inputBorder="false" placeholder="请输入长度公差下限" @input="onNumberInput(idx, 'lengthTolNeg')" @blur="onNumberBlur(idx, 'lengthTolNeg', 9)" /> | ||
| 69 | </template> | 85 | </template> |
| 70 | </uni-list-item> | 86 | </uni-list-item> |
| 71 | <uni-list-item title="物料编码"> | 87 | <uni-list-item title="物料编码"> |
| 72 | <template v-slot:footer> | 88 | <template v-slot:footer> |
| 73 | - <uni-easyinput v-model="item.materialCode" placeholder="请输入物料编码" :clearable="false" disabled /> | 89 | + <uni-easyinput v-model="item.materialCode" placeholder="请输入物料编码" /> |
| 74 | </template> | 90 | </template> |
| 75 | </uni-list-item> | 91 | </uni-list-item> |
| 76 | <uni-list-item title="状态"> | 92 | <uni-list-item title="状态"> |
| 77 | <template v-slot:footer> | 93 | <template v-slot:footer> |
| 78 | - <uni-easyinput v-model="item.status" placeholder="请输入状态" :clearable="false" disabled /> | 94 | + <uni-easyinput v-model="item.status" placeholder="请输入状态" /> |
| 79 | </template> | 95 | </template> |
| 80 | </uni-list-item> | 96 | </uni-list-item> |
| 81 | <uni-list-item title="数量"> | 97 | <uni-list-item title="数量"> |
| @@ -100,25 +116,25 @@ | @@ -100,25 +116,25 @@ | ||
| 100 | </uni-list-item> | 116 | </uni-list-item> |
| 101 | <uni-list-item title="发货日期"> | 117 | <uni-list-item title="发货日期"> |
| 102 | <template v-slot:footer> | 118 | <template v-slot:footer> |
| 103 | - <uni-easyinput v-model="item.deliveryDate" :inputBorder="false" disabled /> | 119 | + <uni-easyinput v-model="item.deliveryDate" :inputBorder="false" /> |
| 104 | </template> | 120 | </template> |
| 105 | </uni-list-item> | 121 | </uni-list-item> |
| 106 | </uni-list> | 122 | </uni-list> |
| 107 | 123 | ||
| 108 | <uni-list v-show="!item.collapsed"> | 124 | <uni-list v-show="!item.collapsed"> |
| 109 | - <uni-list-item title="产品名称"> | ||
| 110 | - <template v-slot:footer> | ||
| 111 | - <uni-easyinput v-model="item.productName" placeholder="请输入产品名称" :clearable="false" disabled /> | 125 | + <uni-list-item class="select-item" :class="item.productName ? 'is-filled' : 'is-empty'" clickable @click="openProductSheet(idx, 'product')" :rightText="item.productName || '请选择产品名称'" showArrow> |
| 126 | + <template v-slot:body> | ||
| 127 | + <view class="item-title"><text>产品名称</text></view> | ||
| 112 | </template> | 128 | </template> |
| 113 | </uni-list-item> | 129 | </uni-list-item> |
| 114 | <uni-list-item title="行业"> | 130 | <uni-list-item title="行业"> |
| 115 | <template v-slot:footer> | 131 | <template v-slot:footer> |
| 116 | - <uni-easyinput v-model="item.industry" placeholder="请输入行业" :clearable="false" disabled /> | 132 | + <uni-easyinput v-model="item.industry" placeholder="请输入行业" /> |
| 117 | </template> | 133 | </template> |
| 118 | </uni-list-item> | 134 | </uni-list-item> |
| 119 | <uni-list-item title="牌号"> | 135 | <uni-list-item title="牌号"> |
| 120 | <template v-slot:footer> | 136 | <template v-slot:footer> |
| 121 | - <uni-easyinput v-model="item.brand" placeholder="请输入牌号" :clearable="false" disabled /> | 137 | + <uni-easyinput v-model="item.brand" placeholder="请输入牌号" /> |
| 122 | </template> | 138 | </template> |
| 123 | </uni-list-item> | 139 | </uni-list-item> |
| 124 | </uni-list> | 140 | </uni-list> |
| @@ -157,24 +173,52 @@ | @@ -157,24 +173,52 @@ | ||
| 157 | </view> | 173 | </view> |
| 158 | </view> | 174 | </view> |
| 159 | </scroll-view> | 175 | </scroll-view> |
| 160 | - | 176 | + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value" @confirm="onProductConfirm" /> |
| 161 | </view> | 177 | </view> |
| 162 | </template> | 178 | </template> |
| 163 | 179 | ||
| 164 | <script> | 180 | <script> |
| 165 | import { getContractApi, specificationLock } from '@/api/contract' | 181 | import { getContractApi, specificationLock } from '@/api/contract' |
| 182 | +import SingleSelectSheet from '@/components/single-select/index.vue' | ||
| 166 | import { formatCurrencyToChinese } from '@/utils/common' | 183 | import { formatCurrencyToChinese } from '@/utils/common' |
| 184 | +import { getDicByCodes } from '@/utils/dic' | ||
| 167 | 185 | ||
| 168 | export default { | 186 | export default { |
| 169 | name: 'ContractUnplanLock', | 187 | name: 'ContractUnplanLock', |
| 188 | + components: { SingleSelectSheet }, | ||
| 170 | data() { | 189 | data() { |
| 171 | return { | 190 | return { |
| 172 | id: '', | 191 | id: '', |
| 173 | items: [], | 192 | items: [], |
| 174 | planQty: 30, | 193 | planQty: 30, |
| 194 | + sheet: { visible: false, title: '请选择', options: [], idx: -1, value: '', mode: '' }, | ||
| 195 | + options: [], | ||
| 175 | } | 196 | } |
| 176 | }, | 197 | }, |
| 177 | computed: { | 198 | computed: { |
| 199 | + selectOptions() { | ||
| 200 | + const list = Array.isArray(this.options) ? this.options : [] | ||
| 201 | + if (list.length > 0) { | ||
| 202 | + return list.map(o => ({ | ||
| 203 | + label: o.label != null ? o.label : (o.text != null ? o.text : (o.name != null ? o.name : '')), | ||
| 204 | + value: o.value != null ? o.value : (o.id != null ? o.id : o.productId) | ||
| 205 | + })) | ||
| 206 | + } | ||
| 207 | + const uniq = {} | ||
| 208 | + const opts = [] | ||
| 209 | + for (let i = 0; i < this.items.length; i++) { | ||
| 210 | + const it = this.items[i] | ||
| 211 | + const id = it.productId || (it.raw && it.raw.productId) | ||
| 212 | + const name = it.productName || (it.raw && (it.raw.productName || it.raw.rawProductName)) | ||
| 213 | + if (!name) continue | ||
| 214 | + const key = String(id || name) | ||
| 215 | + if (uniq[key]) continue | ||
| 216 | + uniq[key] = true | ||
| 217 | + opts.push({ label: name, value: id || name }) | ||
| 218 | + } | ||
| 219 | + return opts | ||
| 220 | + }, | ||
| 221 | + | ||
| 178 | totalQuantity() { | 222 | totalQuantity() { |
| 179 | const qty = this.items.filter(it => it.locked).reduce((p, c) => p + this.toNumber(c.quantity), 0) | 223 | const qty = this.items.filter(it => it.locked).reduce((p, c) => p + this.toNumber(c.quantity), 0) |
| 180 | return this.round(qty, 2) | 224 | return this.round(qty, 2) |
| @@ -206,8 +250,40 @@ export default { | @@ -206,8 +250,40 @@ export default { | ||
| 206 | const id = options && options.id ? options.id : '' | 250 | const id = options && options.id ? options.id : '' |
| 207 | this.id = id | 251 | this.id = id |
| 208 | this.loadDetail() | 252 | this.loadDetail() |
| 253 | + this.loadProductOptions() | ||
| 209 | }, | 254 | }, |
| 210 | methods: { | 255 | methods: { |
| 256 | + async loadProductOptions() { | ||
| 257 | + try { | ||
| 258 | + const results = await getDicByCodes(['CONTRACT_PRODUCT']) | ||
| 259 | + const c3 = results && results.CONTRACT_PRODUCT && results.CONTRACT_PRODUCT.data ? results.CONTRACT_PRODUCT.data : [] | ||
| 260 | + this.options = c3.map(it => ({ label: it.name, value: it.code })) | ||
| 261 | + } catch (e) { | ||
| 262 | + this.options = [] | ||
| 263 | + } | ||
| 264 | + }, | ||
| 265 | + onNonNegativeInput(idx, field) { | ||
| 266 | + const it = this.items[idx] | ||
| 267 | + if (!it) return | ||
| 268 | + const raw = it[field] | ||
| 269 | + it[field] = String(raw || '').replace(/[^0-9.]/g, '') | ||
| 270 | + this.$set(this.items, idx, it) | ||
| 271 | + }, | ||
| 272 | + onNumberInput(idx, field) { | ||
| 273 | + const it = this.items[idx] | ||
| 274 | + if (!it) return | ||
| 275 | + const raw = it[field] | ||
| 276 | + it[field] = String(raw || '').replace(/[^0-9.\-]/g, '') | ||
| 277 | + this.$set(this.items, idx, it) | ||
| 278 | + }, | ||
| 279 | + onNonNegativeBlur(idx, field, digits) { | ||
| 280 | + const it = this.items[idx] | ||
| 281 | + if (!it) return | ||
| 282 | + const num = Math.max(0, this.toNumber(it[field])) | ||
| 283 | + const rounded = this.round(num, digits) | ||
| 284 | + it[field] = rounded | ||
| 285 | + this.$set(this.items, idx, it) | ||
| 286 | + }, | ||
| 211 | onLockChange(idx, e) { | 287 | onLockChange(idx, e) { |
| 212 | const it = this.items[idx] | 288 | const it = this.items[idx] |
| 213 | if (!it) return | 289 | if (!it) return |
| @@ -225,6 +301,7 @@ export default { | @@ -225,6 +301,7 @@ export default { | ||
| 225 | locked: false, | 301 | locked: false, |
| 226 | collapsed: true, | 302 | collapsed: true, |
| 227 | raw: v, | 303 | raw: v, |
| 304 | + productId: v.productId || v.rawProductId || '', | ||
| 228 | productName: v.rawProductName || v.productName || '', | 305 | productName: v.rawProductName || v.productName || '', |
| 229 | industry: v.industry || '', | 306 | industry: v.industry || '', |
| 230 | brand: v.rawProductGrade || v.brand || '', | 307 | brand: v.rawProductGrade || v.brand || '', |
| @@ -262,6 +339,31 @@ export default { | @@ -262,6 +339,31 @@ export default { | ||
| 262 | onImmediateChange(idx) { | 339 | onImmediateChange(idx) { |
| 263 | this.$nextTick(() => this.recalculate(idx)) | 340 | this.$nextTick(() => this.recalculate(idx)) |
| 264 | }, | 341 | }, |
| 342 | + openProductSheet(idx, mode = 'product') { | ||
| 343 | + let opts = [] | ||
| 344 | + let title = '' | ||
| 345 | + let value = '' | ||
| 346 | + const item = this.items[idx] | ||
| 347 | + if (mode === 'product') { | ||
| 348 | + opts = this.selectOptions | ||
| 349 | + const current = item && item.productId | ||
| 350 | + const match = opts.find(o => o.value === current) | ||
| 351 | + value = match ? match.value : '' | ||
| 352 | + title = '请选择产品' | ||
| 353 | + } | ||
| 354 | + this.sheet = { ...this.sheet, visible: true, title, options: opts, idx, value, mode } | ||
| 355 | + }, | ||
| 356 | + onProductConfirm({ value, label }) { | ||
| 357 | + const { idx, mode } = this.sheet | ||
| 358 | + const it = this.items[idx] | ||
| 359 | + if (!it) { this.sheet.visible = false; return } | ||
| 360 | + if (mode === 'product') { | ||
| 361 | + it.productId = value | ||
| 362 | + it.productName = label || '' | ||
| 363 | + } | ||
| 364 | + this.$set(this.items, idx, it) | ||
| 365 | + this.sheet.visible = false | ||
| 366 | + }, | ||
| 265 | onNumberBlur(idx, field, digits) { | 367 | onNumberBlur(idx, field, digits) { |
| 266 | const it = this.items[idx] | 368 | const it = this.items[idx] |
| 267 | if (!it) return | 369 | if (!it) return |
| @@ -336,6 +438,26 @@ export default { | @@ -336,6 +438,26 @@ export default { | ||
| 336 | raw.unitPrice = price | 438 | raw.unitPrice = price |
| 337 | raw.totalAmount = total | 439 | raw.totalAmount = total |
| 338 | raw.amountExcludingTax = excl | 440 | raw.amountExcludingTax = excl |
| 441 | + raw.productId = it.productId || raw.productId | ||
| 442 | + raw.productName = it.productName | ||
| 443 | + if (Object.prototype.hasOwnProperty.call(raw, 'rawProductId')) raw.rawProductId = it.productId || raw.rawProductId | ||
| 444 | + if (Object.prototype.hasOwnProperty.call(raw, 'rawProductName')) raw.rawProductName = it.productName | ||
| 445 | + raw.industry = it.industry | ||
| 446 | + raw.quality = it.quality | ||
| 447 | + raw.brand = it.brand | ||
| 448 | + if (Object.prototype.hasOwnProperty.call(raw, 'rawProductGrade')) raw.rawProductGrade = it.brand | ||
| 449 | + raw.thickness = it.thickness | ||
| 450 | + raw.thicknessTolPos = it.thicknessTolPos | ||
| 451 | + raw.thicknessTolNeg = it.thicknessTolNeg | ||
| 452 | + raw.width = it.width | ||
| 453 | + raw.widthTolPos = it.widthTolPos | ||
| 454 | + raw.widthTolNeg = it.widthTolNeg | ||
| 455 | + raw.length = it.length | ||
| 456 | + raw.lengthTolPos = it.lengthTolPos | ||
| 457 | + raw.lengthTolNeg = it.lengthTolNeg | ||
| 458 | + raw.materialCode = it.materialCode | ||
| 459 | + raw.status = it.status | ||
| 460 | + raw.deliveryDate = it.deliveryDate | ||
| 339 | return raw | 461 | return raw |
| 340 | }) | 462 | }) |
| 341 | if (!selected.length) { | 463 | if (!selected.length) { |
| @@ -767,4 +889,4 @@ export default { | @@ -767,4 +889,4 @@ export default { | ||
| 767 | height: 60rpx; | 889 | height: 60rpx; |
| 768 | align-items: center; | 890 | align-items: center; |
| 769 | } | 891 | } |
| 770 | -</style> | ||
| 892 | +</style> |
| @@ -159,6 +159,7 @@ export default { | @@ -159,6 +159,7 @@ export default { | ||
| 159 | businessFileList: [], | 159 | businessFileList: [], |
| 160 | shareholderFileList: [], | 160 | shareholderFileList: [], |
| 161 | customerInfo: { businessFileList: [], shareholderFileList: [], annualTotalSales: '', mainIndustry: '', annualMaterialOverview: '' }, | 161 | customerInfo: { businessFileList: [], shareholderFileList: [], annualTotalSales: '', mainIndustry: '', annualMaterialOverview: '' }, |
| 162 | + customerInfoOpened: false, | ||
| 162 | companyReview: { companySettlementPeriod: '', companyMaterialSupplyPlan: '', companySuggestedCategory: '', companySuggestedCategoryName: '', companyCreditLimit: '' }, | 163 | companyReview: { companySettlementPeriod: '', companyMaterialSupplyPlan: '', companySuggestedCategory: '', companySuggestedCategoryName: '', companyCreditLimit: '' }, |
| 163 | categoryOptions: [], | 164 | categoryOptions: [], |
| 164 | sheet: { visible: false, title: '请选择', options: [], value: '', field: '' }, | 165 | sheet: { visible: false, title: '请选择', options: [], value: '', field: '' }, |
| @@ -298,6 +299,14 @@ export default { | @@ -298,6 +299,14 @@ export default { | ||
| 298 | getPayload() { | 299 | getPayload() { |
| 299 | const ref = this.$refs.basicRef | 300 | const ref = this.$refs.basicRef |
| 300 | const vals = ref && typeof ref.getFormValues === 'function' ? ref.getFormValues() : {} | 301 | const vals = ref && typeof ref.getFormValues === 'function' ? ref.getFormValues() : {} |
| 302 | + if (this.auditCtx && this.auditCtx.bizFlag === 'CUSTOMER_CREDIT_EDIT') { | ||
| 303 | + if (Array.isArray(vals && vals.businessFileInfoList)) { | ||
| 304 | + vals.businessFileList = vals.businessFileInfoList || [] | ||
| 305 | + } | ||
| 306 | + if (Array.isArray(vals && vals.shareholderFileInfoList)) { | ||
| 307 | + vals.shareholderFileList = vals.shareholderFileInfoList || [] | ||
| 308 | + } | ||
| 309 | + } | ||
| 301 | return { | 310 | return { |
| 302 | ...vals, | 311 | ...vals, |
| 303 | } | 312 | } |
| @@ -374,7 +383,6 @@ export default { | @@ -374,7 +383,6 @@ export default { | ||
| 374 | })).filter(it => it.id) | 383 | })).filter(it => it.id) |
| 375 | } | 384 | } |
| 376 | const vals = this.getPayload() || {} | 385 | const vals = this.getPayload() || {} |
| 377 | - console.log(vals,'12312321') | ||
| 378 | if (this.customerInfo.annualTotalSales === '' && vals.annualTotalSales !== undefined && vals.annualTotalSales !== null) { | 386 | if (this.customerInfo.annualTotalSales === '' && vals.annualTotalSales !== undefined && vals.annualTotalSales !== null) { |
| 379 | this.customerInfo.annualTotalSales = vals.annualTotalSales | 387 | this.customerInfo.annualTotalSales = vals.annualTotalSales |
| 380 | } | 388 | } |
| @@ -384,14 +392,15 @@ export default { | @@ -384,14 +392,15 @@ export default { | ||
| 384 | if (this.customerInfo.annualMaterialOverview === '' && vals.annualMaterialOverview !== undefined && vals.annualMaterialOverview !== null) { | 392 | if (this.customerInfo.annualMaterialOverview === '' && vals.annualMaterialOverview !== undefined && vals.annualMaterialOverview !== null) { |
| 385 | this.customerInfo.annualMaterialOverview = vals.annualMaterialOverview | 393 | this.customerInfo.annualMaterialOverview = vals.annualMaterialOverview |
| 386 | } | 394 | } |
| 387 | - const b = (this.customerInfo && this.customerInfo.businessFileList && this.customerInfo.businessFileList.length > 0) | ||
| 388 | - ? this.customerInfo.businessFileList | ||
| 389 | - : (vals.businessFileList || []) | ||
| 390 | - const s = (this.customerInfo && this.customerInfo.shareholderFileList && this.customerInfo.shareholderFileList.length > 0) | ||
| 391 | - ? this.customerInfo.shareholderFileList | ||
| 392 | - : (vals.shareholderFileList || []) | 395 | + const b = this.customerInfoOpened |
| 396 | + ? (this.customerInfo.businessFileList || []) | ||
| 397 | + : ((vals.businessFileList || vals.businessFileInfoList || [])) | ||
| 398 | + const s = this.customerInfoOpened | ||
| 399 | + ? (this.customerInfo.shareholderFileList || []) | ||
| 400 | + : ((vals.shareholderFileList || vals.shareholderFileInfoList || [])) | ||
| 393 | this.businessFileList = toListModel(b) | 401 | this.businessFileList = toListModel(b) |
| 394 | this.shareholderFileList = toListModel(s) | 402 | this.shareholderFileList = toListModel(s) |
| 403 | + this.customerInfoOpened = true | ||
| 395 | this.$refs.customerInfoPopup && this.$refs.customerInfoPopup.open() | 404 | this.$refs.customerInfoPopup && this.$refs.customerInfoPopup.open() |
| 396 | } else if (this.extraBtnText === '公司评审') { | 405 | } else if (this.extraBtnText === '公司评审') { |
| 397 | this.$refs.companyReviewPopup && this.$refs.companyReviewPopup.open() | 406 | this.$refs.companyReviewPopup && this.$refs.companyReviewPopup.open() |
| @@ -456,10 +465,19 @@ export default { | @@ -456,10 +465,19 @@ export default { | ||
| 456 | if (this.auditCtx.bizFlag === 'CUSTOMER_CREDIT_EDIT') { | 465 | if (this.auditCtx.bizFlag === 'CUSTOMER_CREDIT_EDIT') { |
| 457 | // 运作科档案员审核(yzkday) --客户信息数据 | 466 | // 运作科档案员审核(yzkday) --客户信息数据 |
| 458 | if (this.roleCodes.includes('yzkday')) { | 467 | if (this.roleCodes.includes('yzkday')) { |
| 459 | - _data = { | ||
| 460 | - ..._data, | ||
| 461 | - ...this.customerInfo | 468 | + const savedBusiness = Array.isArray(this.customerInfo && this.customerInfo.businessFileList) ? this.customerInfo.businessFileList : [] |
| 469 | + const savedShareholder = Array.isArray(this.customerInfo && this.customerInfo.shareholderFileList) ? this.customerInfo.shareholderFileList : [] | ||
| 470 | + const currentBusiness = Array.isArray(_data.businessFileList) ? _data.businessFileList : (Array.isArray(_data.businessFileInfoList) ? _data.businessFileInfoList : []) | ||
| 471 | + const currentShareholder = Array.isArray(_data.shareholderFileList) ? _data.shareholderFileList : (Array.isArray(_data.shareholderFileInfoList) ? _data.shareholderFileInfoList : []) | ||
| 472 | + const merged = { ..._data } | ||
| 473 | + if (this.customerInfoOpened) { | ||
| 474 | + if (this.customerInfo.annualTotalSales != null) merged.annualTotalSales = this.customerInfo.annualTotalSales | ||
| 475 | + if (this.customerInfo.mainIndustry != null) merged.mainIndustry = this.customerInfo.mainIndustry | ||
| 476 | + if (this.customerInfo.annualMaterialOverview != null) merged.annualMaterialOverview = this.customerInfo.annualMaterialOverview | ||
| 462 | } | 477 | } |
| 478 | + merged.businessFileList = this.customerInfoOpened ? savedBusiness : (savedBusiness.length > 0 ? savedBusiness : currentBusiness) | ||
| 479 | + merged.shareholderFileList = this.customerInfoOpened ? savedShareholder : (savedShareholder.length > 0 ? savedShareholder : currentShareholder) | ||
| 480 | + _data = merged | ||
| 463 | } | 481 | } |
| 464 | // 运作科主管审核(yzkzg) --公司评审数据 | 482 | // 运作科主管审核(yzkzg) --公司评审数据 |
| 465 | if (this.roleCodes.includes('yzkzg')) { | 483 | if (this.roleCodes.includes('yzkzg')) { |
| @@ -474,7 +492,10 @@ export default { | @@ -474,7 +492,10 @@ export default { | ||
| 474 | message: this.message, | 492 | message: this.message, |
| 475 | taskId: this.auditCtx.taskId | 493 | taskId: this.auditCtx.taskId |
| 476 | } | 494 | } |
| 477 | - console.log('审核__confirmApprove', payload) | 495 | + if (this.auditCtx && this.auditCtx.bizFlag === 'CUSTOMER_CREDIT_EDIT') { |
| 496 | + delete payload.variables.businessFileInfoList | ||
| 497 | + delete payload.variables.shareholderFileInfoList | ||
| 498 | + } | ||
| 478 | if (this.approveType === 'PASS') { | 499 | if (this.approveType === 'PASS') { |
| 479 | approvePassApi(payload).then(res => { | 500 | approvePassApi(payload).then(res => { |
| 480 | console.log('审核__approvePass', res) | 501 | console.log('审核__approvePass', res) |
| @@ -237,7 +237,7 @@ | @@ -237,7 +237,7 @@ | ||
| 237 | </template> | 237 | </template> |
| 238 | 238 | ||
| 239 | <script> | 239 | <script> |
| 240 | -import { getDetailApi, updateApi } from '@/api/order_list.js' | 240 | +import { getDetailApi, updateApi, getHistoryProductionProcessApi } from '@/api/order_list.js' |
| 241 | import Product from './product.vue' | 241 | import Product from './product.vue' |
| 242 | import SingleSelectSheet from '@/components/single-select/index.vue' | 242 | import SingleSelectSheet from '@/components/single-select/index.vue' |
| 243 | import { getDicName } from '@/utils/dic.js' | 243 | import { getDicName } from '@/utils/dic.js' |
| @@ -284,6 +284,8 @@ export default { | @@ -284,6 +284,8 @@ export default { | ||
| 284 | dicOptions: { SUPPLIER: [], APPLICABLE_STANDARD: [] }, | 284 | dicOptions: { SUPPLIER: [], APPLICABLE_STANDARD: [] }, |
| 285 | sheet: { visible: false, title: '请选择', options: [], value: '', field: '' }, | 285 | sheet: { visible: false, title: '请选择', options: [], value: '', field: '' }, |
| 286 | isReadonly: false, | 286 | isReadonly: false, |
| 287 | + historyProductionProcessLoaded: false, | ||
| 288 | + historyProductionProcessLoading: false, | ||
| 287 | } | 289 | } |
| 288 | }, | 290 | }, |
| 289 | computed: { | 291 | computed: { |
| @@ -338,10 +340,33 @@ export default { | @@ -338,10 +340,33 @@ export default { | ||
| 338 | this.form = next; | 340 | this.form = next; |
| 339 | this.initPurchaseOrderLineList = next.purchaseOrderLineList || []; | 341 | this.initPurchaseOrderLineList = next.purchaseOrderLineList || []; |
| 340 | this.refreshStandardName() | 342 | this.refreshStandardName() |
| 343 | + this.fillHistoryProductionProcessIfNeeded() | ||
| 341 | } catch (e) { | 344 | } catch (e) { |
| 342 | uni.showToast({ title: '加载失败', icon: 'none' }) | 345 | uni.showToast({ title: '加载失败', icon: 'none' }) |
| 343 | } | 346 | } |
| 344 | }, | 347 | }, |
| 348 | + async fillHistoryProductionProcessIfNeeded() { | ||
| 349 | + const m = this.form || {} | ||
| 350 | + const id = m.id || m.code || '' | ||
| 351 | + if (!id) return | ||
| 352 | + if (!m.showProductionProcess) return | ||
| 353 | + if (String(m.productionProcess || '').trim()) return | ||
| 354 | + if (this.historyProductionProcessLoaded || this.historyProductionProcessLoading) return | ||
| 355 | + this.historyProductionProcessLoading = true | ||
| 356 | + try { | ||
| 357 | + const res = await getHistoryProductionProcessApi(id) | ||
| 358 | + const data = res && res.data ? res.data : {} | ||
| 359 | + const text = (data && (data.productionProcess || data.historyProductionProcess || data.value)) ? String(data.productionProcess || data.historyProductionProcess || data.value) : '' | ||
| 360 | + if (!String(this.form.productionProcess || '').trim() && text.trim()) { | ||
| 361 | + this.form.productionProcess = text | ||
| 362 | + } | ||
| 363 | + this.historyProductionProcessLoaded = true | ||
| 364 | + } catch (e) { | ||
| 365 | + this.historyProductionProcessLoaded = true | ||
| 366 | + } finally { | ||
| 367 | + this.historyProductionProcessLoading = false | ||
| 368 | + } | ||
| 369 | + }, | ||
| 345 | refreshStandardName() { | 370 | refreshStandardName() { |
| 346 | const est = (this.dicOptions.APPLICABLE_STANDARD || []).find(o => String(o.code) === String(this.form.executionStandard)) | 371 | const est = (this.dicOptions.APPLICABLE_STANDARD || []).find(o => String(o.code) === String(this.form.executionStandard)) |
| 347 | this.form.executionStandardName = est ? (est.name || '') : (this.form.executionStandardName || '') | 372 | this.form.executionStandardName = est ? (est.name || '') : (this.form.executionStandardName || '') |