修改edi默认值, 公司默认值(调用已屏蔽),太平运费协议号换插件

szh_zidingyibiaoti
lilu 2 years ago
parent f501de0c07
commit 4c8c621154

@ -0,0 +1,200 @@
<template>
<div class="auto-input-content">
<auto-complete
class="auto-input"
size="small"
:allowClear="true"
v-model="value"
optionLabelProp="label"
:dropdown-match-select-width="false"
:defaultActiveFirstOption="false"
:dropdown-style="dropdownStyle"
:backfill="false"
@select="handleSelect"
@change="debounce(handleChange, 0, $event)"
@focus="handleChangeFirst"
@blur="getSelectBlur"
>
<template slot="dataSource">
<a-select-option v-for="(item, index) in dataSourceList" :key="index" :value="index + '-' + item[showLabel[0]]" :label="item[showLabel[0]]">
<div class="contractno-label" v-if="type === 'contractno'">
<div class="title"> {{ item.contractNo }} / {{ item.contractName || '--' }} </div>
<div class="note"><span>{{ item.contractNote || '--' }}</span></div>
</div>
<div class="title" v-else>
<template v-for="(label, lindex) in showLabel">
{{ item[label] }}
<template v-if="lindex != showLabel.length - 1"> / </template>
</template>
</div>
</a-select-option>
</template>
</auto-complete>
</div>
</template>
<script>
import {
getContractno
} from '@/api/modular/main/BookingLedger'
import { AutoComplete } from 'ant-design-vue'
import { mapGetters } from 'vuex'
let timer
export default {
name: '',
components: {
AutoComplete
},
props: {
defaultVal: {
type: String,
default: ''
},
type: {
type: String,
default: ''
},
dropdownStyle: {
type: Object,
default: () => {
return {}
}
},
searchApi: {
type: String,
default: ''
},
searchQuery: {
type: Object,
default: () => {
return {}
}
},
//
showLabel: {
type: Array,
default: () => {
return []
}
}
},
data() {
return {
value: this.defaultVal || '',
dataSourceList: [],
inEdit: false
}
},
computed: {
...mapGetters(['bookingInitData'])
},
watch: {
defaultVal(nval, oval) {
if (this.inEdit) { return false }
this.value = nval
}
},
mounted() {
this.value = this.defaultVal
},
methods: {
debounce(func, wait, ...args) {
if (timer) clearTimeout(timer)
timer = setTimeout(() => {
func.apply(this, args)
}, wait)
},
getFromSelectData(func, ...args) {
return new Promise((resolve, reject) => {
func(...args).then((res) => {
if (res.code === 200) {
resolve(res.data);
} else {
reject(res)
}
})
});
},
emnuCompleteApi (type) {
switch (type) {
case 'getContractno':
return getContractno
}
},
handleSelect (e) {
const num = Number(e.split('-')[0])
const data = this.dataSourceList[num]
this.value = data[this.showLabel[0]]
this.$emit('select', {
type: this.type,
res: data
})
setTimeout(() => {
this.handleChange(this.value)
}, 600)
},
handleChange (e) {
this.inEdit = true
setTimeout(() => {
this.inEdit = false
}, 800)
if (e) {
Object.keys(this.searchQuery).map((item, index) => {
if (['queryItem'].includes(item)) {
this.searchQuery[item] = e
}
})
} else {
Object.keys(this.searchQuery).map((item, index) => {
if (['queryItem'].includes(item)) {
this.searchQuery[item] = ''
}
})
}
this.getFromSelectData(this.emnuCompleteApi(this.searchApi), this.searchQuery).then((data) => {
if (data.rows) {
this.dataSourceList = data.rows
} else {
this.dataSourceList = data
}
})
},
handleChangeFirst (e) {
if (this.value && this.dataSourceList.length !== 0) {
return false
}
if (this.bookingInitData[`${this.type}InitList`].length > 0) {
this.dataSourceList = this.bookingInitData[`${this.type}InitList`]
return false
}
this.handleChange(e)
},
getSelectBlur (e) {
if (this.type === 'contractno') {
this.$emit('select', {
type: this.type,
res: {
contractNo: this.value
}
})
}
}
}
}
</script>
<style lang="less">
.contractno-label{
.title{
height: 28px;
line-height: 28px;
font-size: 14px;
font-weight:600;
color: #666;
}
.note{
height: 22px;
line-height: 22px;
font-size: 12px;
color: #999;
}
}
</style>

@ -14,13 +14,13 @@
:open="open"
optionLabelProp="label"
:notFoundContent="inLoading ? '加载中...' : '暂无数据'"
v-clickDown="{ clickFun: () => {} , dblclickFun: this.dblclickFun }"
@focus="getSelectFirst"
@blur="getSelectBlur"
@select="selectOption"
@change="(value,option)=> debounce(this.handleChange, 200, option)"
@search="debounce(handleSearch, 300, $event)"
>
<!-- v-clickDown="{ clickFun: () => {} , dblclickFun: this.dblclickFun }" -->
<a-select-option v-for="(item, index) in selectList" :key="index" :value="item[showLabel[0]] + index" :label="item[showLabel[0]]">
<template v-if="type === 'contractno'">
<div class="contractno-label">

@ -310,7 +310,7 @@ const initDetail = {
exRemark4: '',
// == ==
consigneeEdiCode: '',
shipperEdiCode: '',
shipperEdiCode: 'CN218868',
notifyCdoe: '',
salerCode: 'CN087',
salerCodeName: 'GRACE SUN',
@ -333,7 +333,7 @@ const initDetail = {
statuslog: []
}
const bookingEDIExt = {
weiTuoFang: '',
weiTuoFang: '',
ediAttn: '',
ediAttnTel: '',
ediAttnMail: '',
@ -353,7 +353,7 @@ const bookingEDIExt = {
exRemark4: '',
// == ==
consigneeEdiCode: '',
shipperEdiCode: '',
shipperEdiCode: 'CN218868',
notifyCdoe: '',
salerCode: 'CN087',
salerCodeName: 'GRACE SUN',
@ -421,7 +421,9 @@ export default {
inAddSave: false,
hasHbList: false,
detailsLoadOver: false,
inGoodsSave: false
inGoodsSave: false,
ctnDefaultData: {},
defaultData: {}
}
},
computed: {
@ -603,7 +605,7 @@ export default {
setTimeout(() => {
const key = this.$route.fullPath
const detailsChange = !!this.needSavePages[key].details
const detailsChange = this.needSavePages[key] ? !!this.needSavePages[key].details : false
this.checkSaveFun({ type: 'details', hasChange: detailsChange })
const hbListChange = !!this.needSavePages[key].hbList
@ -647,7 +649,7 @@ export default {
setTimeout(() => {
const key = this.$route.fullPath
const detailsChange = !!this.needSavePages[key].details
const detailsChange = this.needSavePages[key] ? !!this.needSavePages[key].details : false
this.checkSaveFun({ type: 'details', hasChange: detailsChange })
const hbListChange = !!this.needSavePages[key].hbList
@ -689,7 +691,7 @@ export default {
setTimeout(() => {
const key = this.$route.fullPath
const detailsChange = !!this.needSavePages[key].details
const detailsChange = this.needSavePages[key] ? !!this.needSavePages[key].details : false
this.checkSaveFun({ type: 'details', hasChange: detailsChange })
const hbListChange = !!this.needSavePages[key].hbList
@ -709,7 +711,7 @@ export default {
setTimeout(() => {
const key = this.$route.fullPath
const detailsChange = !!this.needSavePages[key].details
const detailsChange = this.needSavePages[key] ? !!this.needSavePages[key].details : false
this.checkSaveFun({ type: 'details', hasChange: detailsChange })
const hbListChange = !!this.needSavePages[key].hbList
@ -737,6 +739,7 @@ export default {
this.detailsLoadOver = false
this.bookingDetails.carrierid = this.type
this.bookingDetails.carrier = this.type
// this.getDefaultVal()
setTimeout(() => {
if (Object.keys(this.$refs).includes('sedOrder')) {
this.$refs.sedOrder.init([])
@ -750,6 +753,83 @@ export default {
this.getDjyTenantConfig()
},
getDefaultVal() {
getDjyTenantConfig({
type: 'booking_default_value'
}).then(res => {
const defaultData = JSON.parse(res.data.configJson)
this.defaultData = defaultData
console.log(defaultData)
defaultData.map((item, index) => {
const field = item.field.split('.')
let label = field[1].toLowerCase()
if (field[0] === 'order') {
if (['EPCODE', 'DZREMARK', 'CZREMARK', 'Warehouse'].includes(field[1])) {
label = this.emnuDefaultLabel(field[1])
}
console.log('initData ----', label)
if (Object.keys(initDetail).includes(label)) {
initDetail[label] = item.code
this.bookingDetails[label] = this.bookingDetails[label] ? this.bookingDetails[label] : item.code
}
} else if (field[0] === 'ctn') {
if (['CTNALL', 'CTNNUM', 'CNTRNO', 'SEALNO', 'PKGS', 'KINDPKGS', 'KGS', 'CBM', 'TAREWEIGHT', 'WEIGHTYPE', 'WEIGHKGS'].includes(field[1])) {
this.ctnDefaultData[label] = item.code
this.bookingDetails.ctnInputs.map((citem, cindex) => {
this.bookingDetails.ctnInputs[cindex][label] = citem[label] ? citem[label] : item.code
})
}
} else if (field[0] === 'edi') {
// type 1
const typeArr1 = ['WeiTuoFang', 'SendCode', 'ReceiveCode', 'NotifyCdoe', 'SalerCode', 'MasterBolIndicator', 'EmanifestHbl', 'ConsigneeEdiCode', 'ShipperEdiCode', 'OpEName', 'OpTel', 'OpEmail', 'GoodsName', 'MasterBolIndicatorName', 'SalerCodeName', 'OrderRemark', 'ExRemark1', 'ExRemark2', 'ExRemark3', 'ExRemark4', 'KingTareweight']
// type2 +
const typeArr2 = ['EDIAttn', 'EDIAttnTel', 'EDIAttnMail', 'AMSConsignee', 'AMSNotifyParty']
// type 3
const typeArr3 = ['ACIHBL', 'CKHI', 'CNCM', 'WNCM']
const typeArr4 = ['S0CC0C']
if (typeArr1.includes(field[1])) {
label = field[1].substr(0, 1).toLowerCase() + field[1].substr(1, field[1].length - 1)
} else if (typeArr3.includes(field[1])) {
label = field[1].toLowerCase()
} else if (typeArr2.includes(field[1]) || typeArr4.includes(field[1])) {
label = this.emnuDefaultLabel(field[1])
}
console.log('edi --- ', label)
initDetail.bookingEDIExt[label] = item.code
bookingEDIExt[label] = item.code
this.bookingDetails.bookingEDIExt[label] = this.bookingDetails.bookingEDIExt[label] ? this.bookingDetails.bookingEDIExt[label] : item.code
}
})
}).catch(err => {
console.log(err)
})
},
emnuDefaultLabel (field) {
switch (field) {
case 'EPCODE':
return 'EPCode'
case 'DZREMARK':
return 'dzRemark'
case 'CZREMARK':
return 'czRemark'
case 'Warehouse':
return 'warehouse'
case 'S0CC0C':
return 's0CC0C'
case 'EDIAttn':
return 'ediAttn'
case 'EDIAttnTel':
return 'ediAttnTel'
case 'EDIAttnMail':
return 'ediAttnMail'
case 'AMSConsignee':
return 'amsConsignee'
case 'AMSNotifyParty':
return 'amsNotifyParty'
}
},
getDjyTenantConfig() {
getDjyTenantConfig({
type: 'booking_form_col'
@ -865,17 +945,9 @@ export default {
delete item.id
})
}
if (res.data.hbList && res.data.hbList.length > 0) {
this.Showtabs = true
}
if (!res.data.bookingEDIExt) {
res.data.bookingEDIExt = {
weiTuoFang: '',
ediAttn: '',
ediAttnTel: '',
ediAttnMail: '',
sendCode: ''
}
res.data.bookingEDIExt = bookingEDIExt
}
//
if (res.data.ctnInputs.length > 0) {
@ -896,6 +968,7 @@ export default {
}
if (res.data.hbList.length > 0) {
res.data.hbList.map((item, index) => {
item.bookingEDIExt.shipperEdiCode = item.bookingEDIExt.shipperEdiCode ? item.bookingEDIExt.shipperEdiCode : 'CN218868'
const newBookingEDIExt = { ...JSON.parse(JSON.stringify(bookingEDIExt)), ...item.bookingEDIExt }
item = { ...JSON.parse(JSON.stringify(initDetail)), ...item, ...{ bookingEDIExt: newBookingEDIExt } }
if (item.ctnInputs.length > 0) {
@ -911,15 +984,20 @@ export default {
})
}
res.data.feeself = !!res.data.feeself
res.data.bookingEDIExt.shipperEdiCode = res.data.bookingEDIExt.shipperEdiCode ? res.data.bookingEDIExt.shipperEdiCode : 'CN218868'
const $BookingEDIExt = { ...JSON.parse(JSON.stringify(bookingEDIExt)), ...res.data.bookingEDIExt }
this.$set(this, 'bookingDetails', { ...this.bookingDetails, ...res.data, ...{ bookingEDIExt: $BookingEDIExt } })
this.inPageLoading = false
// this.getDefaultVal()
setTimeout(() => {
// console.log('== 5. - false ==')
this.checkSaveFun({ type: 'details', hasChange: false })
this.detailsLoadOver = true
this.inChildLoading = false
this.$message.success({ content: '加载完成' })
if (res.data.hbList && res.data.hbList.length > 0) {
this.Showtabs = true
}
if (!this.hasHbList && this.bookingDetails.hbList.length > 0) {
this.$refs.sedOrder.init(this.bookingDetails.hbList)
this.hasHbList = true
@ -1278,6 +1356,7 @@ export default {
//
//
changeTab(e) {
console.log('== 切换顶部标签 ==', this.detailsLoadOver, this.inChildLoading)
const _this = this
this.tabActiveKey = e
setTimeout(() => {

@ -156,7 +156,17 @@
>
<div class="copy-box">
<template v-if="details.carrierid == 'PIL'">
<selectView
<autoView
class="copy-input"
type="contractno"
:defaultVal="details.contractno"
:dropdownStyle="{ width: '300px' }"
searchApi="getContractno"
:searchQuery="{ queryItem: '', top: 50 }"
:showLabel="['contractNo']"
@select="getAutoViewRes"
></autoView>
<!-- <selectView
class="copy-input"
type="contractno"
:defaultVal="details.contractno"
@ -165,7 +175,7 @@
:showLabel="['contractNo']"
:openSearch="true"
@change="getSelectViewRes"
></selectView>
></selectView> -->
</template>
<template v-else>
<inputView type="contractno" :parentVal="details.contractno" @getInputChange="inputChange" />
@ -557,15 +567,16 @@ import { XCard } from '@/components'
import inputView from '../components/inputView'
import selectView from '../components/selectView'
import datePickerView from '../components/datePickerView'
import autoView from '../components/autoView'
import {
DjyCustomerdetail,
BookingOrderContactSavebatch,
BookingOrderContactPage,
DjyCustomerContacts
DjyCustomerContacts,
getContractno
} from '@/api/modular/main/BookingLedger'
import VueClipboard from 'vue-clipboard2'
let timer
export default {
name: 'BookingDetail',
@ -573,7 +584,8 @@ export default {
XCard,
inputView,
selectView,
datePickerView
datePickerView,
autoView,
},
props: {
details: {
@ -783,7 +795,7 @@ export default {
// / - end
customerContactsData: [],
ContactType: [],
customerContactsDataList: []
customerContactsDataList: [],
}
},
watch: {
@ -1121,6 +1133,12 @@ export default {
console.log(this.etdWeek)
}
console.log('== 日期修改 ==', type, value, this.details[type])
},
getAutoViewRes ({ type, res }) {
console.log(type, res)
if (type === 'contractno') {
this.details.contractno = res.contractNo || ''
}
}
}
}

@ -302,11 +302,13 @@ const sedDetail = {
exRemark4: '',
// == ==
consigneeEdiCode: '',
shipperEdiCode: '',
shipperEdiCode: 'CN218868',
notifyCdoe: '',
salerCode: '',
salerCode: 'CN087',
salerCodeName: 'GRACE SUN',
emanifestHbl: '',
masterBolIndicator: '',
masterBolIndicator: '3',
masterBolIndicatorName: 'Not Applicable/Straight bl | 无HBL',
s0CC0C: '',
ckhi: '',
cncm: '',
@ -322,6 +324,41 @@ const sedDetail = {
item: [],
statuslog: []
}
const bookingEDIExt = {
weiTuoFang: '',
ediAttn: '',
ediAttnTel: '',
ediAttnMail: '',
sendCode: '',
receiveCode: '',
amsConsignee: '',
amsNotifyParty: '',
opEName: '',
opTel: '',
opEmail: '',
goodsName: '',
orderRemark: '',
kingTareweight: '',
exRemark1: '',
exRemark2: '',
exRemark3: '',
exRemark4: '',
// == ==
consigneeEdiCode: '',
shipperEdiCode: 'CN218868',
notifyCdoe: '',
salerCode: 'CN087',
salerCodeName: 'GRACE SUN',
emanifestHbl: '',
masterBolIndicator: '3',
masterBolIndicatorName: 'Not Applicable/Straight bl | 无HBL',
s0CC0C: '',
ckhi: '',
cncm: '',
wncm: '',
acihbl: ''
}
export default {
name: 'SedOrder',
props: {
@ -445,12 +482,7 @@ export default {
this.editIndex = 0
const $data = JSON.parse(JSON.stringify(this.sedOrderList[0]))
if (!$data.bookingEDIExt) {
$data.bookingEDIExt = {
weiTuoFang: '',
ediAttn: '',
ediAttnTel: '',
ediAttnMail: ''
}
$data.bookingEDIExt = bookingEDIExt
}
this.editDetails = $data
setTimeout(() => {
@ -530,12 +562,7 @@ export default {
data.pid = this.$route.query.id
data.id = 0
if (!data.bookingEDIExt) {
data.bookingEDIExt = {
weiTuoFang: '',
ediAttn: '',
ediAttnTel: '',
ediAttnMail: ''
}
data.bookingEDIExt = bookingEDIExt
}
if (data.ctnInputs.length > 0) {
data.ctnInputs.map((item, index) => {
@ -557,12 +584,7 @@ export default {
if (this.inSave || this.inSecLoad || this.sedOrderList.length === 0) { return false }
const { detail, type } = data
if (!detail.bookingEDIExt) {
detail.bookingEDIExt = {
weiTuoFang: '',
ediAttn: '',
ediAttnTel: '',
ediAttnMail: ''
}
detail.bookingEDIExt = bookingEDIExt
}
if (this.ifCompare(this.sedOrderList[this.editIndex], detail) && !this.inSecLoad && type !== 'save') {
this.sedOrderList[this.editIndex].isNoSave = true
@ -701,12 +723,7 @@ export default {
this.editIndex = index
const data = this.sedOrderList[index]
if (!data.bookingEDIExt) {
data.bookingEDIExt = {
weiTuoFang: '',
ediAttn: '',
ediAttnTel: '',
ediAttnMail: ''
}
data.bookingEDIExt = bookingEDIExt
}
this.editDetails = data
this.inSecLoad = true
@ -722,12 +739,7 @@ export default {
_data.pid = this.$route.query.id
_data.id = 0
if (!_data.bookingEDIExt) {
_data.bookingEDIExt = {
weiTuoFang: '',
ediAttn: '',
ediAttnTel: '',
ediAttnMail: ''
}
_data.bookingEDIExt = bookingEDIExt
}
this.editDetails = _data
this.editIndex = this.sedOrderList.length

@ -602,7 +602,7 @@ export default {
stripe: true,
round: true,
autoResize: true,
align: 'center',
align: 'left',
columnConfig: { resizable: true },
importConfig: {},
exportConfig: {},
@ -729,14 +729,16 @@ export default {
const newData = JSON.parse(JSON.stringify(this.bookingGridOptions))
// N
// if (this.bookingGridOptions.data && this.bookingGridOptions.data.length > 0) {
// const copyArr = JSON.parse(JSON.stringify(this.bookingGridOptions.data))
// const first = copyArr.splice(0, 10)
// const more = this.bookingGridOptions.data.splice(10, this.bookingGridOptions.data.length)
// newData.data = first
// this.gridOptions = { ...this.gridOptions, ...newData }
// setTimeout(() => {
// this.gridOptions.data = [...this.gridOptions.data, ...more]
// }, 1500)
// const copyArr = JSON.parse(JSON.stringify(this.bookingGridOptions.data))
// const first = copyArr.splice(0, 20)
// const more = this.bookingGridOptions.data.splice(20, this.bookingGridOptions.data.length)
// newData.data = first
// this.gridOptions = { ...this.gridOptions, ...newData }
// setTimeout(() => {
// this.gridOptions.data = [...this.gridOptions.data, ...more]
// }, 1500)
// }, 50)
// }
//

Loading…
Cancel
Save