Commit 61fa90fb2c98d734d38dc726feac63ed40b19326

Authored by gesilong
2 parents a07513c5 a9831143

Merge branch 'cjerp-2.0' into test_cjerp

@@ -48,3 +48,16 @@ export function getPurchaseDeptApi() { @@ -48,3 +48,16 @@ export function getPurchaseDeptApi() {
48 method: 'get' 48 method: 'get'
49 }) 49 })
50 } 50 }
  51 +export function getRegionApi() {
  52 + return request({
  53 + url: '/system/dept/getRegion',
  54 + method: 'get'
  55 + })
  56 +}
  57 +export function getAllRegionApi(purchaseDepartment) {
  58 + return request({
  59 + url: '/system/dept/getAllRegion',
  60 + method: 'get',
  61 + params: { purchaseDepartment }
  62 + })
  63 +}
@@ -299,9 +299,17 @@ @@ -299,9 +299,17 @@
299 </template> 299 </template>
300 </uni-list-item> 300 </uni-list-item>
301 301
302 - <uni-list-item title="采购处">  
303 - <template v-slot:footer>  
304 - <uni-easyinput v-model="form.purchaseDepartmentName" disabled placeholder="" :inputBorder="false" /> 302 + <uni-list-item class="select-item" :class="form.purchaseDepartment ? 'is-filled' : 'is-empty'" clickable
  303 + @click="openSheet('purchaseDepartment')" :rightText="displayLabel('purchaseDepartmentName')" showArrow>
  304 + <template v-slot:body>
  305 + <view class="item-title"><text>采购处</text></view>
  306 + </template>
  307 + </uni-list-item>
  308 +
  309 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  310 + @click="openSheet('region')" :rightText="displayLabel('region')" showArrow>
  311 + <template v-slot:body>
  312 + <view class="item-title"><text>区域</text></view>
305 </template> 313 </template>
306 </uni-list-item> 314 </uni-list-item>
307 315
@@ -343,7 +351,7 @@ import FileUpload from '@/components/file-upload/index.vue' @@ -343,7 +351,7 @@ import FileUpload from '@/components/file-upload/index.vue'
343 import SingleSelectSheet from '@/components/single-select/index.vue' 351 import SingleSelectSheet from '@/components/single-select/index.vue'
344 import MultiSelectSheet from '@/components/multi-select/index.vue' 352 import MultiSelectSheet from '@/components/multi-select/index.vue'
345 import { getDicByCodes, getDicName } from '@/utils/dic.js' 353 import { getDicByCodes, getDicName } from '@/utils/dic.js'
346 -import { domesticCustomerCreditSaveApi, getPurchaseDeptApi } from '@/api/procure-manage/domesticCustomerCredit.js' 354 +import { domesticCustomerCreditSaveApi, getPurchaseDeptApi, getAllRegionApi, getRegionApi } from '@/api/procure-manage/domesticCustomerCredit.js'
347 355
348 export default { 356 export default {
349 name: 'DomesticTradeAdd', 357 name: 'DomesticTradeAdd',
@@ -369,6 +377,8 @@ export default { @@ -369,6 +377,8 @@ export default {
369 operationMethodOptions: [], 377 operationMethodOptions: [],
370 developNewOptions: [], 378 developNewOptions: [],
371 purchaseSourceOptions: [], 379 purchaseSourceOptions: [],
  380 + regionOptions: [],
  381 + purchaseDeptOptions: [],
372 form: { 382 form: {
373 unitName: '', 383 unitName: '',
374 customerShortName: '', 384 customerShortName: '',
@@ -419,16 +429,14 @@ export default { @@ -419,16 +429,14 @@ export default {
419 investigatorName: '', 429 investigatorName: '',
420 purchaseDepartment: '', 430 purchaseDepartment: '',
421 purchaseDepartmentName: '', 431 purchaseDepartmentName: '',
  432 + region: '',
  433 + regionName: '',
422 reviewValidUntil: '' 434 reviewValidUntil: ''
423 } 435 }
424 } 436 }
425 }, 437 },
426 created() { 438 created() {
427 - this.loadDicData()  
428 - this.loadPurchaseDeptOptions()  
429 - const u = (this.$store && this.$store.state && this.$store.state.user) ? this.$store.state.user : {}  
430 - this.form.investigatorId = u && u.id ? String(u.id) : ''  
431 - this.form.investigatorName = u && u.name ? String(u.name) : '' 439 + this.initPage()
432 }, 440 },
433 computed: { 441 computed: {
434 showCompanyNatureOther() { 442 showCompanyNatureOther() {
@@ -437,6 +445,14 @@ export default { @@ -437,6 +445,14 @@ export default {
437 } 445 }
438 }, 446 },
439 methods: { 447 methods: {
  448 + async initPage() {
  449 + const u = (this.$store && this.$store.state && this.$store.state.user) ? this.$store.state.user : {}
  450 + this.form.investigatorId = u && u.id ? String(u.id) : ''
  451 + this.form.investigatorName = u && u.name ? String(u.name) : ''
  452 + await this.loadDicData()
  453 + await this.loadPurchaseDeptList()
  454 + await this.loadRegionOptions()
  455 + },
440 async loadDicData() { 456 async loadDicData() {
441 try { 457 try {
442 const results = await getDicByCodes(['COMPANY_NATURE', 'DEVELOP_NEW', 'OPERATION_METHOD', 'PURCHASE_SOURCE']) 458 const results = await getDicByCodes(['COMPANY_NATURE', 'DEVELOP_NEW', 'OPERATION_METHOD', 'PURCHASE_SOURCE'])
@@ -447,6 +463,7 @@ export default { @@ -447,6 +463,7 @@ export default {
447 PURCHASE_SOURCE: (results.PURCHASE_SOURCE && results.PURCHASE_SOURCE.data) || [] 463 PURCHASE_SOURCE: (results.PURCHASE_SOURCE && results.PURCHASE_SOURCE.data) || []
448 } 464 }
449 this.dicOptions = next 465 this.dicOptions = next
  466 + console.log(next,'next')
450 this.companyNatureOptions = this.dicToSheetOptions(next.COMPANY_NATURE) 467 this.companyNatureOptions = this.dicToSheetOptions(next.COMPANY_NATURE)
451 this.developNewOptions = this.dicToSheetOptions(next.DEVELOP_NEW) 468 this.developNewOptions = this.dicToSheetOptions(next.DEVELOP_NEW)
452 this.operationMethodOptions = this.dicToSheetOptions(next.OPERATION_METHOD) 469 this.operationMethodOptions = this.dicToSheetOptions(next.OPERATION_METHOD)
@@ -461,20 +478,102 @@ export default { @@ -461,20 +478,102 @@ export default {
461 uni.showToast({ title: '字典加载失败', icon: 'none' }) 478 uni.showToast({ title: '字典加载失败', icon: 'none' })
462 } 479 }
463 }, 480 },
464 - async loadPurchaseDeptOptions() { 481 + dicToSheetOptions(items) {
  482 + const list = Array.isArray(items) ? items : []
  483 + return list.map(it => ({ label: it && it.name != null ? String(it.name) : '', value: it && it.code != null ? String(it.code) : '' })).filter(it => it.value)
  484 + },
  485 + async loadPurchaseDeptList() {
465 try { 486 try {
466 const res = await getPurchaseDeptApi() 487 const res = await getPurchaseDeptApi()
467 - const data = (res && res.data) ? res.data : {}  
468 - this.form.purchaseDepartment = data && data.id != null ? String(data.id) : ''  
469 - this.form.purchaseDepartmentName = data && data.name != null ? String(data.name) : '' 488 + const raw = res && res.data != null ? res.data : []
  489 + this.purchaseDeptOptions = this.normalizeRegionOptions(raw)
470 } catch (e) { 490 } catch (e) {
471 - this.form.purchaseDepartment = ''  
472 - this.form.purchaseDepartmentName = '' 491 + this.purchaseDeptOptions = []
473 } 492 }
474 }, 493 },
475 - dicToSheetOptions(items) {  
476 - const list = Array.isArray(items) ? items : []  
477 - return list.map(it => ({ label: it && it.name != null ? String(it.name) : '', value: it && it.code != null ? String(it.code) : '' })).filter(it => it.value) 494 + normalizeRegionOptions(raw) {
  495 + const list = Array.isArray(raw)
  496 + ? raw
  497 + : (Array.isArray(raw && raw.data) ? raw.data : (Array.isArray(raw && raw.rows) ? raw.rows : []))
  498 + return list.map(it => {
  499 + const id = it && (it.id != null ? it.id : (it.value != null ? it.value : (it.regionId != null ? it.regionId : '')))
  500 + const name = it && (it.name != null ? it.name : (it.label != null ? it.label : (it.regionName != null ? it.regionName : '')))
  501 + return { label: name != null ? String(name) : '', value: id != null ? String(id) : '' }
  502 + }).filter(it => it.value)
  503 + },
  504 + getOptionLabel(options, value) {
  505 + const v = value != null ? String(value) : ''
  506 + if (!v) return ''
  507 + const match = (options || []).find(o => String(o.value) === v)
  508 + return match ? String(match.label || '') : ''
  509 + },
  510 + syncRegionWithOptions() {
  511 + const label = this.getOptionLabel(this.regionOptions, this.form.region)
  512 + if (!label) {
  513 + this.form.region = ''
  514 + this.form.regionName = ''
  515 + return
  516 + }
  517 + this.form.regionName = label
  518 + },
  519 + async loadRegionOptions() {
  520 + let defaultRegionId = ''
  521 + let defaultRegionName = ''
  522 + try {
  523 + const regionRes = await getRegionApi()
  524 + const regionData = (regionRes && regionRes.data != null) ? regionRes.data : null
  525 + const parsed = regionData ? this.parseRegionIdAndName(regionData) : { id: '', name: '' }
  526 + if (parsed.id) {
  527 + defaultRegionId = parsed.id
  528 + defaultRegionName = parsed.name
  529 + }
  530 + } catch (e) {
  531 + // fall through to getAllRegionApi
  532 + }
  533 + const purchaseDepartment = this.form.purchaseDepartment ? String(this.form.purchaseDepartment) : ''
  534 + if (!purchaseDepartment) {
  535 + if (defaultRegionId) {
  536 + this.regionOptions = [{ label: defaultRegionName || String(defaultRegionId), value: defaultRegionId }]
  537 + this.form.region = defaultRegionId
  538 + this.form.regionName = defaultRegionName || String(defaultRegionId)
  539 + } else {
  540 + this.regionOptions = []
  541 + this.form.region = ''
  542 + this.form.regionName = ''
  543 + }
  544 + return
  545 + }
  546 + try {
  547 + const res = await getAllRegionApi(purchaseDepartment)
  548 + const raw = res && res.data != null ? res.data : []
  549 + this.regionOptions = this.normalizeRegionOptions(raw)
  550 + if (defaultRegionId) {
  551 + const label = this.getOptionLabel(this.regionOptions, defaultRegionId)
  552 + if (label) {
  553 + this.form.region = defaultRegionId
  554 + this.form.regionName = label
  555 + } else {
  556 + // 默认区域不在完整列表中,仍保留为选中项
  557 + this.regionOptions.push({ label: defaultRegionName || String(defaultRegionId), value: defaultRegionId })
  558 + this.form.region = defaultRegionId
  559 + this.form.regionName = defaultRegionName || String(defaultRegionId)
  560 + }
  561 + } else {
  562 + this.syncRegionWithOptions()
  563 + }
  564 + } catch (e) {
  565 + this.regionOptions = []
  566 + this.form.region = ''
  567 + this.form.regionName = ''
  568 + }
  569 + },
  570 + parseRegionIdAndName(raw) {
  571 + if (!raw) return { id: '', name: '' }
  572 + if (Array.isArray(raw)) return this.parseRegionIdAndName(raw[0])
  573 + if (typeof raw === 'string' || typeof raw === 'number') return { id: String(raw), name: '' }
  574 + const id = raw.id != null ? raw.id : (raw.value != null ? raw.value : (raw.regionId != null ? raw.regionId : ''))
  575 + const name = raw.name != null ? raw.name : (raw.label != null ? raw.label : (raw.regionName != null ? raw.regionName : ''))
  576 + return { id: id != null ? String(id) : '', name: name != null ? String(name) : '' }
478 }, 577 },
479 labelsOfOptions(options, csv) { 578 labelsOfOptions(options, csv) {
480 const v = csv == null ? '' : String(csv) 579 const v = csv == null ? '' : String(csv)
@@ -491,7 +590,9 @@ export default { @@ -491,7 +590,9 @@ export default {
491 displayLabel(field) { 590 displayLabel(field) {
492 const m = this.form || {} 591 const m = this.form || {}
493 const map = { 592 const map = {
  593 + purchaseDepartmentName: '请选择采购处',
494 companyNatureName: '请选择公司性质', 594 companyNatureName: '请选择公司性质',
  595 + region: '请选择区域',
495 purchaseSource: '请选择', 596 purchaseSource: '请选择',
496 operationMode: '请选择', 597 operationMode: '请选择',
497 isNewDevelopment: '请选择', 598 isNewDevelopment: '请选择',
@@ -520,6 +621,14 @@ export default { @@ -520,6 +621,14 @@ export default {
520 const v = m.isNewDevelopment 621 const v = m.isNewDevelopment
521 return v ? getDicName('DEVELOP_NEW', String(v), this.dicOptions.DEVELOP_NEW) : map[field] 622 return v ? getDicName('DEVELOP_NEW', String(v), this.dicOptions.DEVELOP_NEW) : map[field]
522 } 623 }
  624 + if (field === 'region') {
  625 + const v = m.region
  626 + if (!v) return map[field]
  627 + return this.getOptionLabel(this.regionOptions, v) || map[field]
  628 + }
  629 + if (field === 'purchaseDepartmentName') {
  630 + return this.getOptionLabel(this.purchaseDeptOptions, m.purchaseDepartment) || map[field]
  631 + }
523 const v = m[field] 632 const v = m[field]
524 if (v === true) return '是' 633 if (v === true) return '是'
525 if (v === false) return '否' 634 if (v === false) return '否'
@@ -527,6 +636,8 @@ export default { @@ -527,6 +636,8 @@ export default {
527 }, 636 },
528 openSheet(field) { 637 openSheet(field) {
529 const map = { 638 const map = {
  639 + region: { title: '区域', options: this.regionOptions },
  640 + purchaseDepartment: { title: '采购处', options: this.purchaseDeptOptions },
530 purchaseSource: { title: '收购来源', options: this.purchaseSourceOptions }, 641 purchaseSource: { title: '收购来源', options: this.purchaseSourceOptions },
531 operationMode: { title: '操作方式', options: this.operationMethodOptions }, 642 operationMode: { title: '操作方式', options: this.operationMethodOptions },
532 isNewDevelopment: { title: '是否新开发', options: this.developNewOptions }, 643 isNewDevelopment: { title: '是否新开发', options: this.developNewOptions },
@@ -567,6 +678,14 @@ export default { @@ -567,6 +678,14 @@ export default {
567 const field = this.sheet.field 678 const field = this.sheet.field
568 if (!field) return 679 if (!field) return
569 this.form[field] = value 680 this.form[field] = value
  681 + if (field === 'region') this.form.regionName = label != null ? String(label) : this.getOptionLabel(this.regionOptions, value)
  682 + if (field === 'purchaseDepartment') {
  683 + this.form.purchaseDepartmentName = label != null ? String(label) : this.getOptionLabel(this.purchaseDeptOptions, value)
  684 + console.log(value,'value')
  685 + console.log(this.purchaseDeptOptions,'purchaseDeptOptions')
  686 + console.log(this.form.purchaseDepartmentName ,'purchasthis.form.purchaseDepartmentName eDeptOptions')
  687 + this.loadRegionOptions()
  688 + }
570 this.sheet.visible = false 689 this.sheet.visible = false
571 }, 690 },
572 onMultiSheetConfirm({ value, label }) { 691 onMultiSheetConfirm({ value, label }) {
@@ -649,6 +768,9 @@ export default { @@ -649,6 +768,9 @@ export default {
649 { key: 'reviewValidUntil', label: '评审有效期' }, 768 { key: 'reviewValidUntil', label: '评审有效期' },
650 { key: 'investigatorId', label: '资信调查人ID' } 769 { key: 'investigatorId', label: '资信调查人ID' }
651 ] 770 ]
  771 + if (Array.isArray(this.regionOptions) && this.regionOptions.length) {
  772 + requiredTextFields.push({ key: 'region', label: '区域' })
  773 + }
652 for (let i = 0; i < requiredTextFields.length; i++) { 774 for (let i = 0; i < requiredTextFields.length; i++) {
653 const f = requiredTextFields[i] 775 const f = requiredTextFields[i]
654 const v = this.form && this.form[f.key] 776 const v = this.form && this.form[f.key]
@@ -707,6 +829,7 @@ export default { @@ -707,6 +829,7 @@ export default {
707 delete payload.companyNatureName 829 delete payload.companyNatureName
708 delete payload.investigatorName 830 delete payload.investigatorName
709 delete payload.purchaseDepartmentName 831 delete payload.purchaseDepartmentName
  832 + delete payload.regionName
710 payload.registeredCapital = Number(payload.registeredCapital) 833 payload.registeredCapital = Number(payload.registeredCapital)
711 const files = (Array.isArray(this.attachmentFiles) ? this.attachmentFiles : []).filter(it => it && it.id) 834 const files = (Array.isArray(this.attachmentFiles) ? this.attachmentFiles : []).filter(it => it && it.id)
712 payload.attachmentFileIds = files.map(it => String(it.id || '')).filter(Boolean).join(',') 835 payload.attachmentFileIds = files.map(it => String(it.id || '')).filter(Boolean).join(',')
@@ -722,7 +845,7 @@ export default { @@ -722,7 +845,7 @@ export default {
722 await domesticCustomerCreditSaveApi(payload) 845 await domesticCustomerCreditSaveApi(payload)
723 uni.showToast({ title: '提交成功', icon: 'success' }) 846 uni.showToast({ title: '提交成功', icon: 'success' })
724 try { uni.setStorageSync('DOMESTIC_TRADE_LIST_NEED_REFRESH', '1') } catch (e) {} 847 try { uni.setStorageSync('DOMESTIC_TRADE_LIST_NEED_REFRESH', '1') } catch (e) {}
725 - setTimeout(() => { uni.navigateBack() }, 300) 848 + setTimeout(() => { uni.redirectTo({ url: '/pages/domestic_trade/index' }) }, 300)
726 } catch (e) { 849 } catch (e) {
727 uni.showToast({ title: (e && e.msg) || '提交失败', icon: 'none' }) 850 uni.showToast({ title: (e && e.msg) || '提交失败', icon: 'none' })
728 } finally { 851 } finally {
@@ -75,6 +75,7 @@ @@ -75,6 +75,7 @@
75 <view class="section"> 75 <view class="section">
76 <view class="row"><text class="label">资信调查人</text><text class="value">{{ safeText(form.investigatorName) }}</text></view> 76 <view class="row"><text class="label">资信调查人</text><text class="value">{{ safeText(form.investigatorName) }}</text></view>
77 <view class="row"><text class="label">采购处</text><text class="value">{{ safeText(purchaseDepartmentName) }}</text></view> 77 <view class="row"><text class="label">采购处</text><text class="value">{{ safeText(purchaseDepartmentName) }}</text></view>
  78 + <view class="row"><text class="label">区域</text><text class="value">{{ safeText(regionName) }}</text></view>
78 <view class="row"><text class="label">评审有效期</text><text class="value">{{ safeText(form.reviewValidUntil) }}</text></view> 79 <view class="row"><text class="label">评审有效期</text><text class="value">{{ safeText(form.reviewValidUntil) }}</text></view>
79 <view class="row"> 80 <view class="row">
80 <text class="label">附件</text> 81 <text class="label">附件</text>
@@ -96,8 +97,7 @@ @@ -96,8 +97,7 @@
96 import { downloadFile } from '@/utils/downloadFile.js' 97 import { downloadFile } from '@/utils/downloadFile.js'
97 import DetailButtons from '@/components/detail-buttons/index.vue' 98 import DetailButtons from '@/components/detail-buttons/index.vue'
98 import { getDicByCodes, getDicName } from '@/utils/dic.js' 99 import { getDicByCodes, getDicName } from '@/utils/dic.js'
99 -import { domesticCustomerCreditCancelApi, domesticCustomerCreditGetApi } from '@/api/procure-manage/domesticCustomerCredit.js'  
100 -import { getPurchaseDeptApi } from '@/api/procure-manage/domesticCustomerCredit.js' 100 +import { domesticCustomerCreditCancelApi, domesticCustomerCreditGetApi, getPurchaseDeptApi, getAllRegionApi } from '@/api/procure-manage/domesticCustomerCredit.js'
101 101
102 export default { 102 export default {
103 name: 'DomesticTradeDetail', 103 name: 'DomesticTradeDetail',
@@ -116,6 +116,7 @@ export default { @@ -116,6 +116,7 @@ export default {
116 PURCHASE_SOURCE: [] 116 PURCHASE_SOURCE: []
117 }, 117 },
118 purchaseDept: null, 118 purchaseDept: null,
  119 + regionOptions: [],
119 buttons: [{ 120 buttons: [{
120 text: '审核详情', 121 text: '审核详情',
121 visible: true, 122 visible: true,
@@ -131,7 +132,14 @@ export default { @@ -131,7 +132,14 @@ export default {
131 visible: true, 132 visible: true,
132 variant: 'outline', 133 variant: 'outline',
133 event: 'edit', 134 event: 'edit',
134 - },{ 135 + },
  136 + // {
  137 + // text: '申请变更',
  138 + // visible: true,
  139 + // variant: 'outline',
  140 + // event: 'changeApply',
  141 + // },
  142 + {
135 text: '取消', 143 text: '取消',
136 visible: true, 144 visible: true,
137 variant: 'outline', 145 variant: 'outline',
@@ -142,11 +150,14 @@ export default { @@ -142,11 +150,14 @@ export default {
142 computed: { 150 computed: {
143 displayButtons() { 151 displayButtons() {
144 const s = this.form && this.form.status || false 152 const s = this.form && this.form.status || false
  153 + const d = this.form && this.form.showExamineDetail || false
  154 + const e = this.form && this.form.showExamine || false
145 return [ 155 return [
146 - { ...this.buttons[0], visible: s && this.$auth.hasPermi('procure-manage:domestic-trade:review') },  
147 - { ...this.buttons[1], visible: s === 'AUDIT' && this.$auth.hasPermi('procure-manage:domestic-trade:approve') },  
148 - { ...this.buttons[2], visible: this.$auth.hasPermi('procure-manage:domestic-trade:modify') },  
149 - { ...this.buttons[3], visible: this.$auth.hasPermi('procure-manage:domestic-trade:cancel') }, 156 + { ...this.buttons[0], visible: d && this.$auth.hasPermi('procure-manage:domestic-trade:review') },
  157 + { ...this.buttons[1], visible: s === 'AUDIT' && e && this.$auth.hasPermi('procure-manage:domestic-trade:approve') },
  158 + { ...this.buttons[2], visible: s === 'REFUSE' && this.$auth.hasPermi('procure-manage:domestic-trade:modify') },
  159 + // { ...this.buttons[3], visible: s === 'PASS' && this.$auth.hasPermi('procure-manage:domestic-trade:change') },
  160 + { ...this.buttons[3], visible: s === 'REFUSE' && this.$auth.hasPermi('procure-manage:domestic-trade:cancel') },
150 ] 161 ]
151 }, 162 },
152 companyNatureOptions() { 163 companyNatureOptions() {
@@ -187,6 +198,14 @@ export default { @@ -187,6 +198,14 @@ export default {
187 if (this.purchaseDept && this.purchaseDept.name != null) return String(this.purchaseDept.name) 198 if (this.purchaseDept && this.purchaseDept.name != null) return String(this.purchaseDept.name)
188 const v = this.form && this.form.purchaseDepartmentName != null ? String(this.form.purchaseDepartmentName) : '' 199 const v = this.form && this.form.purchaseDepartmentName != null ? String(this.form.purchaseDepartmentName) : ''
189 return v || '-' 200 return v || '-'
  201 + },
  202 + regionName() {
  203 + const name = this.safeText(this.form && this.form.regionName)
  204 + if (name) return name
  205 + const id = this.form && this.form.region != null ? String(this.form.region) : ''
  206 + const labelFromOptions = this.getOptionLabel(this.regionOptions, id)
  207 + if (labelFromOptions) return labelFromOptions
  208 + return id || '-'
190 } 209 }
191 }, 210 },
192 created() { 211 created() {
@@ -218,8 +237,45 @@ export default { @@ -218,8 +237,45 @@ export default {
218 const res = await getPurchaseDeptApi() 237 const res = await getPurchaseDeptApi()
219 const data = (res && res.data) ? res.data : {} 238 const data = (res && res.data) ? res.data : {}
220 this.purchaseDept = (data && typeof data === 'object') ? data : null 239 this.purchaseDept = (data && typeof data === 'object') ? data : null
  240 + await this.loadRegionOptions()
221 } catch (e) { 241 } catch (e) {
222 this.purchaseDept = null 242 this.purchaseDept = null
  243 + this.regionOptions = []
  244 + }
  245 + },
  246 + normalizeRegionOptions(raw) {
  247 + const list = Array.isArray(raw)
  248 + ? raw
  249 + : (Array.isArray(raw && raw.data) ? raw.data : (Array.isArray(raw && raw.rows) ? raw.rows : []))
  250 + return list.map(it => {
  251 + const id = it && (it.id != null ? it.id : (it.value != null ? it.value : (it.regionId != null ? it.regionId : '')))
  252 + const name = it && (it.name != null ? it.name : (it.label != null ? it.label : (it.regionName != null ? it.regionName : '')))
  253 + return { label: name != null ? String(name) : '', value: id != null ? String(id) : '' }
  254 + }).filter(it => it.value)
  255 + },
  256 + getOptionLabel(options, value) {
  257 + const v = value != null ? String(value) : ''
  258 + if (!v) return ''
  259 + const match = (options || []).find(o => String(o.value) === v)
  260 + return match ? String(match.label || '') : ''
  261 + },
  262 + getPurchaseDepartmentId() {
  263 + if (this.purchaseDept && this.purchaseDept.id != null) return String(this.purchaseDept.id)
  264 + const v = this.form && this.form.purchaseDepartment != null ? String(this.form.purchaseDepartment) : ''
  265 + return v || ''
  266 + },
  267 + async loadRegionOptions() {
  268 + const purchaseDepartment = this.getPurchaseDepartmentId()
  269 + if (!purchaseDepartment) {
  270 + this.regionOptions = []
  271 + return
  272 + }
  273 + try {
  274 + const res = await getAllRegionApi(purchaseDepartment)
  275 + const raw = res && res.data != null ? res.data : []
  276 + this.regionOptions = this.normalizeRegionOptions(raw)
  277 + } catch (e) {
  278 + this.regionOptions = []
223 } 279 }
224 }, 280 },
225 dicToSheetOptions(items) { 281 dicToSheetOptions(items) {
@@ -231,6 +287,7 @@ export default { @@ -231,6 +287,7 @@ export default {
231 if (typeof btn.onClick === 'function') return btn.onClick(this.form, btn.params) 287 if (typeof btn.onClick === 'function') return btn.onClick(this.form, btn.params)
232 const e = btn.event || '' 288 const e = btn.event || ''
233 if (e === 'edit') return this.onEdit(btn && btn.params) 289 if (e === 'edit') return this.onEdit(btn && btn.params)
  290 + if (e === 'changeApply') return this.onChangeApply(btn && btn.params)
234 if (e === 'audit') return this.onAudit(btn && btn.params) 291 if (e === 'audit') return this.onAudit(btn && btn.params)
235 if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params) 292 if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params)
236 if (e === 'cancel') return this.onCancel(btn && btn.params) 293 if (e === 'cancel') return this.onCancel(btn && btn.params)
@@ -238,6 +295,9 @@ export default { @@ -238,6 +295,9 @@ export default {
238 onEdit(params) { 295 onEdit(params) {
239 uni.navigateTo({ url: '/pages/domestic_trade/modify?id=' + this.id }) 296 uni.navigateTo({ url: '/pages/domestic_trade/modify?id=' + this.id })
240 }, 297 },
  298 + onChangeApply(params) {
  299 + uni.navigateTo({ url: '/pages/domestic_trade/change?id=' + this.id })
  300 + },
241 onAudit(params) { 301 onAudit(params) {
242 const id = this.id || (this.form && this.form.id) || '' 302 const id = this.id || (this.form && this.form.id) || ''
243 if (!id) return 303 if (!id) return
@@ -308,8 +368,10 @@ export default { @@ -308,8 +368,10 @@ export default {
308 data.investigatorName = u && u.name ? String(u.name) : '' 368 data.investigatorName = u && u.name ? String(u.name) : ''
309 } 369 }
310 this.form = data 370 this.form = data
  371 + await this.loadRegionOptions()
311 } catch (e) { 372 } catch (e) {
312 this.form = {} 373 this.form = {}
  374 + this.regionOptions = []
313 uni.showToast({ title: '详情加载失败', icon: 'none' }) 375 uni.showToast({ title: '详情加载失败', icon: 'none' })
314 } finally { 376 } finally {
315 this.loading = false 377 this.loading = false
@@ -73,6 +73,7 @@ @@ -73,6 +73,7 @@
73 <view class="section"> 73 <view class="section">
74 <view class="row"><text class="label">资信调查人</text><text class="value">{{ safeText(form.investigatorName) }}</text></view> 74 <view class="row"><text class="label">资信调查人</text><text class="value">{{ safeText(form.investigatorName) }}</text></view>
75 <view class="row"><text class="label">采购处</text><text class="value">{{ safeText(purchaseDepartmentName) }}</text></view> 75 <view class="row"><text class="label">采购处</text><text class="value">{{ safeText(purchaseDepartmentName) }}</text></view>
  76 + <view class="row"><text class="label">区域</text><text class="value">{{ safeText(regionName) }}</text></view>
76 <view class="row"><text class="label">评审有效期</text><text class="value">{{ safeText(form.reviewValidUntil) }}</text></view> 77 <view class="row"><text class="label">评审有效期</text><text class="value">{{ safeText(form.reviewValidUntil) }}</text></view>
77 <view class="row"> 78 <view class="row">
78 <text class="label">附件</text> 79 <text class="label">附件</text>
@@ -91,7 +92,7 @@ @@ -91,7 +92,7 @@
91 <script> 92 <script>
92 import { downloadFile } from '@/utils/downloadFile.js' 93 import { downloadFile } from '@/utils/downloadFile.js'
93 import { getDicByCodes, getDicName } from '@/utils/dic.js' 94 import { getDicByCodes, getDicName } from '@/utils/dic.js'
94 -import { domesticCustomerCreditGetExamineByIdApi, getPurchaseDeptApi } from '@/api/procure-manage/domesticCustomerCredit.js' 95 +import { domesticCustomerCreditGetExamineByIdApi, getPurchaseDeptApi, getAllRegionApi } from '@/api/procure-manage/domesticCustomerCredit.js'
95 96
96 export default { 97 export default {
97 name: 'DomesticCustomerCreditViewer', 98 name: 'DomesticCustomerCreditViewer',
@@ -105,7 +106,8 @@ export default { @@ -105,7 +106,8 @@ export default {
105 OPERATION_METHOD: [], 106 OPERATION_METHOD: [],
106 PURCHASE_SOURCE: [] 107 PURCHASE_SOURCE: []
107 }, 108 },
108 - purchaseDept: null 109 + purchaseDept: null,
  110 + regionOptions: []
109 } 111 }
110 }, 112 },
111 computed: { 113 computed: {
@@ -143,6 +145,14 @@ export default { @@ -143,6 +145,14 @@ export default {
143 if (this.purchaseDept && this.purchaseDept.name != null) return String(this.purchaseDept.name) 145 if (this.purchaseDept && this.purchaseDept.name != null) return String(this.purchaseDept.name)
144 const v = this.form && this.form.purchaseDepartmentName != null ? String(this.form.purchaseDepartmentName) : '' 146 const v = this.form && this.form.purchaseDepartmentName != null ? String(this.form.purchaseDepartmentName) : ''
145 return v || '-' 147 return v || '-'
  148 + },
  149 + regionName() {
  150 + const name = this.safeText(this.form && this.form.regionName)
  151 + if (name) return name
  152 + const id = this.form && this.form.region != null ? String(this.form.region) : ''
  153 + const labelFromOptions = this.getOptionLabel(this.regionOptions, id)
  154 + if (labelFromOptions) return labelFromOptions
  155 + return id || '-'
146 } 156 }
147 }, 157 },
148 created() { 158 created() {
@@ -177,8 +187,45 @@ export default { @@ -177,8 +187,45 @@ export default {
177 const res = await getPurchaseDeptApi() 187 const res = await getPurchaseDeptApi()
178 const data = (res && res.data) ? res.data : {} 188 const data = (res && res.data) ? res.data : {}
179 this.purchaseDept = (data && typeof data === 'object') ? data : null 189 this.purchaseDept = (data && typeof data === 'object') ? data : null
  190 + await this.loadRegionOptions()
180 } catch (e) { 191 } catch (e) {
181 this.purchaseDept = null 192 this.purchaseDept = null
  193 + this.regionOptions = []
  194 + }
  195 + },
  196 + normalizeRegionOptions(raw) {
  197 + const list = Array.isArray(raw)
  198 + ? raw
  199 + : (Array.isArray(raw && raw.data) ? raw.data : (Array.isArray(raw && raw.rows) ? raw.rows : []))
  200 + return list.map(it => {
  201 + const id = it && (it.id != null ? it.id : (it.value != null ? it.value : (it.regionId != null ? it.regionId : '')))
  202 + const name = it && (it.name != null ? it.name : (it.label != null ? it.label : (it.regionName != null ? it.regionName : '')))
  203 + return { label: name != null ? String(name) : '', value: id != null ? String(id) : '' }
  204 + }).filter(it => it.value)
  205 + },
  206 + getOptionLabel(options, value) {
  207 + const v = value != null ? String(value) : ''
  208 + if (!v) return ''
  209 + const match = (options || []).find(o => String(o.value) === v)
  210 + return match ? String(match.label || '') : ''
  211 + },
  212 + getPurchaseDepartmentId() {
  213 + if (this.purchaseDept && this.purchaseDept.id != null) return String(this.purchaseDept.id)
  214 + const v = this.form && this.form.purchaseDepartment != null ? String(this.form.purchaseDepartment) : ''
  215 + return v || ''
  216 + },
  217 + async loadRegionOptions() {
  218 + const purchaseDepartment = this.getPurchaseDepartmentId()
  219 + if (!purchaseDepartment) {
  220 + this.regionOptions = []
  221 + return
  222 + }
  223 + try {
  224 + const res = await getAllRegionApi(purchaseDepartment)
  225 + const raw = res && res.data != null ? res.data : []
  226 + this.regionOptions = this.normalizeRegionOptions(raw)
  227 + } catch (e) {
  228 + this.regionOptions = []
182 } 229 }
183 }, 230 },
184 dicToSheetOptions(items) { 231 dicToSheetOptions(items) {
@@ -210,8 +257,10 @@ export default { @@ -210,8 +257,10 @@ export default {
210 try { 257 try {
211 const res = await domesticCustomerCreditGetExamineByIdApi(id) 258 const res = await domesticCustomerCreditGetExamineByIdApi(id)
212 this.form = (res && res.data) ? res.data : {} 259 this.form = (res && res.data) ? res.data : {}
  260 + await this.loadRegionOptions()
213 } catch (e) { 261 } catch (e) {
214 this.form = {} 262 this.form = {}
  263 + this.regionOptions = []
215 } 264 }
216 }, 265 },
217 onDownload(item) { 266 onDownload(item) {
@@ -299,9 +299,17 @@ @@ -299,9 +299,17 @@
299 </template> 299 </template>
300 </uni-list-item> 300 </uni-list-item>
301 301
302 - <uni-list-item title="采购处">  
303 - <template v-slot:footer>  
304 - <uni-easyinput v-model="form.purchaseDepartmentName" disabled placeholder="" :inputBorder="false" /> 302 + <uni-list-item class="select-item" :class="form.purchaseDepartment ? 'is-filled' : 'is-empty'" clickable
  303 + @click="openSheet('purchaseDepartment')" :rightText="displayLabel('purchaseDepartmentName')" showArrow>
  304 + <template v-slot:body>
  305 + <view class="item-title"><text>采购处</text></view>
  306 + </template>
  307 + </uni-list-item>
  308 +
  309 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  310 + @click="openSheet('region')" :rightText="displayLabel('region')" showArrow>
  311 + <template v-slot:body>
  312 + <view class="item-title"><text>区域</text></view>
305 </template> 313 </template>
306 </uni-list-item> 314 </uni-list-item>
307 315
@@ -343,7 +351,7 @@ import FileUpload from '@/components/file-upload/index.vue' @@ -343,7 +351,7 @@ import FileUpload from '@/components/file-upload/index.vue'
343 import SingleSelectSheet from '@/components/single-select/index.vue' 351 import SingleSelectSheet from '@/components/single-select/index.vue'
344 import MultiSelectSheet from '@/components/multi-select/index.vue' 352 import MultiSelectSheet from '@/components/multi-select/index.vue'
345 import { getDicByCodes, getDicName } from '@/utils/dic.js' 353 import { getDicByCodes, getDicName } from '@/utils/dic.js'
346 -import { domesticCustomerCreditGetApi, domesticCustomerCreditSaveApi, getPurchaseDeptApi } from '@/api/procure-manage/domesticCustomerCredit.js' 354 +import { domesticCustomerCreditGetApi, domesticCustomerCreditSaveApi, getPurchaseDeptApi, getAllRegionApi, getRegionApi } from '@/api/procure-manage/domesticCustomerCredit.js'
347 355
348 export default { 356 export default {
349 name: 'DomesticTradeModify', 357 name: 'DomesticTradeModify',
@@ -371,7 +379,8 @@ export default { @@ -371,7 +379,8 @@ export default {
371 operationMethodOptions: [], 379 operationMethodOptions: [],
372 developNewOptions: [], 380 developNewOptions: [],
373 purchaseSourceOptions: [], 381 purchaseSourceOptions: [],
374 - purchaseDept: null, 382 + regionOptions: [],
  383 + purchaseDeptOptions: [],
375 form: { 384 form: {
376 id: '', 385 id: '',
377 unitName: '', 386 unitName: '',
@@ -423,6 +432,8 @@ export default { @@ -423,6 +432,8 @@ export default {
423 investigatorName: '', 432 investigatorName: '',
424 purchaseDepartment: '', 433 purchaseDepartment: '',
425 purchaseDepartmentName: '', 434 purchaseDepartmentName: '',
  435 + region: '',
  436 + regionName: '',
426 reviewValidUntil: '' 437 reviewValidUntil: ''
427 } 438 }
428 } 439 }
@@ -437,7 +448,8 @@ export default { @@ -437,7 +448,8 @@ export default {
437 const id = (query && (query.id || query.code)) ? String(query.id || query.code) : '' 448 const id = (query && (query.id || query.code)) ? String(query.id || query.code) : ''
438 this.id = id 449 this.id = id
439 await this.loadDicData() 450 await this.loadDicData()
440 - await this.loadPurchaseDeptOptions() 451 + await this.loadPurchaseDeptList()
  452 + await this.loadRegionOptions()
441 await this.loadDetail() 453 await this.loadDetail()
442 }, 454 },
443 methods: { 455 methods: {
@@ -468,23 +480,111 @@ export default { @@ -468,23 +480,111 @@ export default {
468 const list = Array.isArray(items) ? items : [] 480 const list = Array.isArray(items) ? items : []
469 return list.map(it => ({ label: it && it.name != null ? String(it.name) : '', value: it && it.code != null ? String(it.code) : '' })).filter(it => it.value) 481 return list.map(it => ({ label: it && it.name != null ? String(it.name) : '', value: it && it.code != null ? String(it.code) : '' })).filter(it => it.value)
470 }, 482 },
471 - async loadPurchaseDeptOptions() { 483 + async loadPurchaseDeptList() {
472 try { 484 try {
473 const res = await getPurchaseDeptApi() 485 const res = await getPurchaseDeptApi()
474 - const data = (res && res.data) ? res.data : {}  
475 - this.purchaseDept = (data && typeof data === 'object') ? data : null  
476 - this.form.purchaseDepartment = data && data.id != null ? String(data.id) : ''  
477 - this.form.purchaseDepartmentName = data && data.name != null ? String(data.name) : '' 486 + const raw = res && res.data != null ? res.data : []
  487 + this.purchaseDeptOptions = this.normalizeRegionOptions(raw)
  488 + } catch (e) {
  489 + this.purchaseDeptOptions = []
  490 + }
  491 + },
  492 + normalizeRegionOptions(raw) {
  493 + const list = Array.isArray(raw)
  494 + ? raw
  495 + : (Array.isArray(raw && raw.data) ? raw.data : (Array.isArray(raw && raw.rows) ? raw.rows : []))
  496 + return list.map(it => {
  497 + const id = it && (it.id != null ? it.id : (it.value != null ? it.value : (it.regionId != null ? it.regionId : '')))
  498 + const name = it && (it.name != null ? it.name : (it.label != null ? it.label : (it.regionName != null ? it.regionName : '')))
  499 + return { label: name != null ? String(name) : '', value: id != null ? String(id) : '' }
  500 + }).filter(it => it.value)
  501 + },
  502 + getOptionLabel(options, value) {
  503 + const v = value != null ? String(value) : ''
  504 + if (!v) return ''
  505 + const match = (options || []).find(o => String(o.value) === v)
  506 + return match ? String(match.label || '') : ''
  507 + },
  508 + syncRegionWithOptions() {
  509 + const label = this.getOptionLabel(this.regionOptions, this.form.region)
  510 + if (!label) {
  511 + this.form.region = ''
  512 + this.form.regionName = ''
  513 + return
  514 + }
  515 + this.form.regionName = label
  516 + },
  517 + async loadRegionOptions() {
  518 + let defaultRegionId = ''
  519 + let defaultRegionName = ''
  520 + try {
  521 + const regionRes = await getRegionApi()
  522 + const regionData = (regionRes && regionRes.data != null) ? regionRes.data : null
  523 + const parsed = regionData ? this.parseRegionIdAndName(regionData) : { id: '', name: '' }
  524 + if (parsed.id) {
  525 + defaultRegionId = parsed.id
  526 + defaultRegionName = parsed.name
  527 + }
  528 + } catch (e) {
  529 + // fall through to getAllRegionApi
  530 + }
  531 + const purchaseDepartment = this.form.purchaseDepartment ? String(this.form.purchaseDepartment) : ''
  532 + if (!purchaseDepartment) {
  533 + if (defaultRegionId) {
  534 + this.regionOptions = [{ label: defaultRegionName || String(defaultRegionId), value: defaultRegionId }]
  535 + if (!this.form.region) {
  536 + this.form.region = defaultRegionId
  537 + this.form.regionName = defaultRegionName || String(defaultRegionId)
  538 + }
  539 + } else {
  540 + this.regionOptions = []
  541 + this.form.region = ''
  542 + this.form.regionName = ''
  543 + }
  544 + return
  545 + }
  546 + try {
  547 + const res = await getAllRegionApi(purchaseDepartment)
  548 + const raw = res && res.data != null ? res.data : []
  549 + this.regionOptions = this.normalizeRegionOptions(raw)
  550 + if (defaultRegionId) {
  551 + const label = this.getOptionLabel(this.regionOptions, defaultRegionId)
  552 + if (label) {
  553 + if (!this.form.region) {
  554 + this.form.region = defaultRegionId
  555 + this.form.regionName = label
  556 + }
  557 + } else {
  558 + // 默认区域不在完整列表中,仍保留为选中项
  559 + this.regionOptions.push({ label: defaultRegionName || String(defaultRegionId), value: defaultRegionId })
  560 + if (!this.form.region) {
  561 + this.form.region = defaultRegionId
  562 + this.form.regionName = defaultRegionName || String(defaultRegionId)
  563 + }
  564 + }
  565 + } else {
  566 + this.syncRegionWithOptions()
  567 + }
478 } catch (e) { 568 } catch (e) {
479 - this.purchaseDept = null  
480 - this.form.purchaseDepartment = ''  
481 - this.form.purchaseDepartmentName = '' 569 + this.regionOptions = []
  570 + this.form.region = ''
  571 + this.form.regionName = ''
482 } 572 }
483 }, 573 },
  574 + parseRegionIdAndName(raw) {
  575 + if (!raw) return { id: '', name: '' }
  576 + if (Array.isArray(raw)) return this.parseRegionIdAndName(raw[0])
  577 + if (typeof raw === 'string' || typeof raw === 'number') return { id: String(raw), name: '' }
  578 + const id = raw.id != null ? raw.id : (raw.value != null ? raw.value : (raw.regionId != null ? raw.regionId : ''))
  579 + const name = raw.name != null ? raw.name : (raw.label != null ? raw.label : (raw.regionName != null ? raw.regionName : ''))
  580 + return { id: id != null ? String(id) : '', name: name != null ? String(name) : '' }
  581 + },
484 displayLabel(field) { 582 displayLabel(field) {
485 const m = this.form 583 const m = this.form
486 const map = { 584 const map = {
  585 + purchaseDepartmentName: '请选择采购处',
487 companyNatureName: '请选择公司性质', 586 companyNatureName: '请选择公司性质',
  587 + region: '请选择区域',
488 purchaseSource: '请选择', 588 purchaseSource: '请选择',
489 operationMode: '请选择', 589 operationMode: '请选择',
490 isNewDevelopment: '请选择', 590 isNewDevelopment: '请选择',
@@ -513,6 +613,14 @@ export default { @@ -513,6 +613,14 @@ export default {
513 const v = m.isNewDevelopment 613 const v = m.isNewDevelopment
514 return v ? getDicName('DEVELOP_NEW', String(v), this.dicOptions.DEVELOP_NEW) : map[field] 614 return v ? getDicName('DEVELOP_NEW', String(v), this.dicOptions.DEVELOP_NEW) : map[field]
515 } 615 }
  616 + if (field === 'region') {
  617 + const v = m.region
  618 + if (!v) return map[field]
  619 + return this.getOptionLabel(this.regionOptions, v) || map[field]
  620 + }
  621 + if (field === 'purchaseDepartmentName') {
  622 + return this.getOptionLabel(this.purchaseDeptOptions, m.purchaseDepartment) || map[field]
  623 + }
516 const v = m[field] 624 const v = m[field]
517 if (v === true) return '是' 625 if (v === true) return '是'
518 if (v === false) return '否' 626 if (v === false) return '否'
@@ -520,6 +628,8 @@ export default { @@ -520,6 +628,8 @@ export default {
520 }, 628 },
521 openSheet(field) { 629 openSheet(field) {
522 const map = { 630 const map = {
  631 + region: { title: '区域', options: this.regionOptions },
  632 + purchaseDepartment: { title: '采购处', options: this.purchaseDeptOptions },
523 purchaseSource: { title: '收购来源', options: this.purchaseSourceOptions }, 633 purchaseSource: { title: '收购来源', options: this.purchaseSourceOptions },
524 operationMode: { title: '操作方式', options: this.operationMethodOptions }, 634 operationMode: { title: '操作方式', options: this.operationMethodOptions },
525 isNewDevelopment: { title: '是否新开发', options: this.developNewOptions }, 635 isNewDevelopment: { title: '是否新开发', options: this.developNewOptions },
@@ -556,10 +666,15 @@ export default { @@ -556,10 +666,15 @@ export default {
556 value: this.form.companyNature || '' 666 value: this.form.companyNature || ''
557 } 667 }
558 }, 668 },
559 - onSheetConfirm({ value }) { 669 + onSheetConfirm({ value, label }) {
560 const field = this.sheet.field 670 const field = this.sheet.field
561 if (!field) return 671 if (!field) return
562 this.form[field] = value 672 this.form[field] = value
  673 + if (field === 'region') this.form.regionName = label != null ? String(label) : this.getOptionLabel(this.regionOptions, value)
  674 + if (field === 'purchaseDepartment') {
  675 + this.form.purchaseDepartmentName = label != null ? String(label) : this.getOptionLabel(this.purchaseDeptOptions, value)
  676 + this.loadRegionOptions()
  677 + }
563 this.sheet.visible = false 678 this.sheet.visible = false
564 }, 679 },
565 onMultiSheetConfirm({ value }) { 680 onMultiSheetConfirm({ value }) {
@@ -642,6 +757,9 @@ export default { @@ -642,6 +757,9 @@ export default {
642 { key: 'reviewValidUntil', label: '评审有效期' }, 757 { key: 'reviewValidUntil', label: '评审有效期' },
643 { key: 'investigatorId', label: '资信调查人ID' } 758 { key: 'investigatorId', label: '资信调查人ID' }
644 ] 759 ]
  760 + if (Array.isArray(this.regionOptions) && this.regionOptions.length) {
  761 + requiredTextFields.push({ key: 'region', label: '区域' })
  762 + }
645 for (let i = 0; i < requiredTextFields.length; i++) { 763 for (let i = 0; i < requiredTextFields.length; i++) {
646 const f = requiredTextFields[i] 764 const f = requiredTextFields[i]
647 const v = this.form && this.form[f.key] 765 const v = this.form && this.form[f.key]
@@ -700,6 +818,7 @@ export default { @@ -700,6 +818,7 @@ export default {
700 delete payload.companyNatureName 818 delete payload.companyNatureName
701 delete payload.investigatorName 819 delete payload.investigatorName
702 delete payload.purchaseDepartmentName 820 delete payload.purchaseDepartmentName
  821 + delete payload.regionName
703 payload.registeredCapital = Number(payload.registeredCapital) 822 payload.registeredCapital = Number(payload.registeredCapital)
704 const files = (Array.isArray(this.attachmentFiles) ? this.attachmentFiles : []).filter(it => it && it.id) 823 const files = (Array.isArray(this.attachmentFiles) ? this.attachmentFiles : []).filter(it => it && it.id)
705 payload.attachmentFileIds = files.map(it => String(it.id || '')).filter(Boolean).join(',') 824 payload.attachmentFileIds = files.map(it => String(it.id || '')).filter(Boolean).join(',')
@@ -714,7 +833,7 @@ export default { @@ -714,7 +833,7 @@ export default {
714 try { 833 try {
715 await domesticCustomerCreditSaveApi(payload) 834 await domesticCustomerCreditSaveApi(payload)
716 uni.showToast({ title: '保存成功', icon: 'success' }) 835 uni.showToast({ title: '保存成功', icon: 'success' })
717 - setTimeout(() => { uni.navigateBack() }, 300) 836 + setTimeout(() => { uni.redirectTo({ url: '/pages/domestic_trade/index' }) }, 300)
718 } catch (e) { 837 } catch (e) {
719 uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' }) 838 uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' })
720 } finally { 839 } finally {
@@ -727,15 +846,12 @@ export default { @@ -727,15 +846,12 @@ export default {
727 const res = await domesticCustomerCreditGetApi(this.id) 846 const res = await domesticCustomerCreditGetApi(this.id)
728 const data = res && res.data ? res.data : {} 847 const data = res && res.data ? res.data : {}
729 const next = { ...this.form, ...(data || {}) } 848 const next = { ...this.form, ...(data || {}) }
730 - if (this.purchaseDept && this.purchaseDept.id != null) {  
731 - next.purchaseDepartment = String(this.purchaseDept.id)  
732 - next.purchaseDepartmentName = this.purchaseDept.name != null ? String(this.purchaseDept.name) : ''  
733 - }  
734 next.id = next.id || this.id || '' 849 next.id = next.id || this.id || ''
735 const u = (this.$store && this.$store.state && this.$store.state.user) ? this.$store.state.user : {} 850 const u = (this.$store && this.$store.state && this.$store.state.user) ? this.$store.state.user : {}
736 if (!next.investigatorId) next.investigatorId = u && u.id ? String(u.id) : '' 851 if (!next.investigatorId) next.investigatorId = u && u.id ? String(u.id) : ''
737 if (!next.investigatorName) next.investigatorName = u && u.name ? String(u.name) : '' 852 if (!next.investigatorName) next.investigatorName = u && u.name ? String(u.name) : ''
738 this.form = next 853 this.form = next
  854 + this.syncRegionWithOptions()
739 this.form.companyNatureName = this.labelsOf(this.companyNatureOptions, this.form.companyNature) 855 this.form.companyNatureName = this.labelsOf(this.companyNatureOptions, this.form.companyNature)
740 this.attachmentFiles = this.normalizeAttachmentFiles(data || next) 856 this.attachmentFiles = this.normalizeAttachmentFiles(data || next)
741 } catch (e) { 857 } catch (e) {
@@ -469,7 +469,7 @@ export default { @@ -469,7 +469,7 @@ export default {
469 await foreignTradeCreditSaveApi(payload) 469 await foreignTradeCreditSaveApi(payload)
470 uni.showToast({ title: '提交成功', icon: 'success' }) 470 uni.showToast({ title: '提交成功', icon: 'success' })
471 try { uni.setStorageSync('FOREIGN_TRADE_LIST_NEED_REFRESH', '1') } catch (e) {} 471 try { uni.setStorageSync('FOREIGN_TRADE_LIST_NEED_REFRESH', '1') } catch (e) {}
472 - setTimeout(() => { uni.navigateBack() }, 300) 472 + setTimeout(() => { uni.redirectTo({ url: '/pages/foreign_trade/index' }) }, 300)
473 } catch (e) { 473 } catch (e) {
474 uni.showToast({ title: (e && e.msg) || '提交失败', icon: 'none' }) 474 uni.showToast({ title: (e && e.msg) || '提交失败', icon: 'none' })
475 } finally { 475 } finally {
@@ -491,7 +491,7 @@ export default { @@ -491,7 +491,7 @@ export default {
491 await foreignTradeCreditSaveApi(payload) 491 await foreignTradeCreditSaveApi(payload)
492 uni.showToast({ title: '保存成功', icon: 'success' }) 492 uni.showToast({ title: '保存成功', icon: 'success' })
493 try { uni.setStorageSync('FOREIGN_TRADE_LIST_NEED_REFRESH', '1') } catch (e) {} 493 try { uni.setStorageSync('FOREIGN_TRADE_LIST_NEED_REFRESH', '1') } catch (e) {}
494 - setTimeout(() => { uni.navigateBack() }, 300) 494 + setTimeout(() => { uni.redirectTo({ url: '/pages/foreign_trade/index' }) }, 300)
495 } catch (e) { 495 } catch (e) {
496 uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' }) 496 uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' })
497 } finally { 497 } finally {
@@ -145,13 +145,13 @@ export default { @@ -145,13 +145,13 @@ export default {
145 { 145 {
146 title: '采购管理', 146 title: '采购管理',
147 items: [{ 147 items: [{
148 - text: '内贸客户资信', 148 + text: '内贸客户资信管理',
149 icon: '/static/images/index/order_list.png', 149 icon: '/static/images/index/order_list.png',
150 link: '/pages/domestic_trade/index', 150 link: '/pages/domestic_trade/index',
151 name: 'DomesticTrade' 151 name: 'DomesticTrade'
152 }, 152 },
153 { 153 {
154 - text: '外客户资信', 154 + text: '外贸客户资信管理',
155 icon: '/static/images/index/order_list.png', 155 icon: '/static/images/index/order_list.png',
156 link: '/pages/foreign_trade/index', 156 link: '/pages/foreign_trade/index',
157 name: 'ForeignTrade' 157 name: 'ForeignTrade'