|
|
|
@ -40,11 +40,8 @@
|
|
|
|
|
ref,
|
|
|
|
|
watch,
|
|
|
|
|
watchEffect,
|
|
|
|
|
computed,
|
|
|
|
|
unref,
|
|
|
|
|
defineComponent,
|
|
|
|
|
onMounted,
|
|
|
|
|
reactive,
|
|
|
|
|
nextTick,
|
|
|
|
|
provide,
|
|
|
|
|
} from 'vue'
|
|
|
|
@ -62,6 +59,8 @@
|
|
|
|
|
// 结算对象下拉数据
|
|
|
|
|
import { GetClientListByCode } from '/@/api/common'
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
|
// 引入字典接口
|
|
|
|
|
import { getDictOption } from '/@/utils/dictUtil'
|
|
|
|
|
const { createMessage } = useMessage()
|
|
|
|
|
defineComponent({
|
|
|
|
|
HotTable,
|
|
|
|
@ -100,12 +99,22 @@
|
|
|
|
|
const feeDict = ref([])
|
|
|
|
|
// 费用标准字典
|
|
|
|
|
const unitDict = ref([])
|
|
|
|
|
getDictOption('fee_unit').then(res => {
|
|
|
|
|
let b = []
|
|
|
|
|
if (props.details.ctnInfo && props.details.ctnInfo.length) {
|
|
|
|
|
const a = props.details.ctnInfo.filter(item => {
|
|
|
|
|
return item.ctn
|
|
|
|
|
})
|
|
|
|
|
b = a.map(item => {
|
|
|
|
|
return { label: item.ctn, value: item.ctn, name: item.ctnCode }
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
unitDict.value = [...b, ...res]
|
|
|
|
|
})
|
|
|
|
|
// 币别字典
|
|
|
|
|
const currencyDict = ref([])
|
|
|
|
|
// 费用对象字典数据
|
|
|
|
|
const companyDict = ref([])
|
|
|
|
|
// 引入字典接口
|
|
|
|
|
import { getDictOption } from '/@/utils/dictUtil'
|
|
|
|
|
// 表格插件
|
|
|
|
|
const hotTb = ref(null)
|
|
|
|
|
// loading
|
|
|
|
@ -237,13 +246,6 @@
|
|
|
|
|
return item.value + '-' + item.name
|
|
|
|
|
})
|
|
|
|
|
process(dict)
|
|
|
|
|
} else {
|
|
|
|
|
const results = await feeUnitDict()
|
|
|
|
|
unitDict.value = results
|
|
|
|
|
const dict = results.map((item) => {
|
|
|
|
|
return item.value + '-' + item.name
|
|
|
|
|
})
|
|
|
|
|
process(dict)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -468,29 +470,63 @@
|
|
|
|
|
// 这里定义了编辑,自动填充和拷贝数据的处理逻辑
|
|
|
|
|
if (source === 'edit' || source === 'Autofill.fill' || source === 'CopyPaste.paste') {
|
|
|
|
|
let dict = {}
|
|
|
|
|
changes.forEach((res) => {
|
|
|
|
|
// 修改费用名称
|
|
|
|
|
if (res[1] === 'feeName') {
|
|
|
|
|
if (changes.length == 1) {
|
|
|
|
|
// 只修改一个操作框来联动行内数据
|
|
|
|
|
if (changes[0][1] === 'feeName') {
|
|
|
|
|
// 修改费用名称联动带出(英文名称、客户类别、结算对象、标准、币别等)
|
|
|
|
|
// 获取当前选中的字典对象数据
|
|
|
|
|
const item = feeDict.value.filter((item) => {
|
|
|
|
|
return changes[0][3].includes(item.name)
|
|
|
|
|
})
|
|
|
|
|
if (item) dict = item[0]
|
|
|
|
|
list.value[res[0]]['feeName'] = changes[0][3].split('-')[1]
|
|
|
|
|
list.value[res[0]]['feeEnName'] = dict['enName']
|
|
|
|
|
list.value[res[0]]['currency'] = dict['defaultCurrency']
|
|
|
|
|
list.value[res[0]]['unitText'] = dict['defaultUnitName']
|
|
|
|
|
list.value[res[0]]['unit'] = dict['defaultUnit']
|
|
|
|
|
list.value[res[0]]['customerTypeText'] = dict['defaultDebitName']
|
|
|
|
|
list.value[res[0]]['customerType'] = dict['defaultDebit']
|
|
|
|
|
list.value[res[0]]['isOpen'] = dict['isOpen']
|
|
|
|
|
list.value[res[0]]['isAdvancedPay'] = dict['isAdvancedPay']
|
|
|
|
|
list.value[res[0]]['isInvoice'] = dict['isInvoice']
|
|
|
|
|
list.value[res[0]]['feeFrt'] = dict['feeFrt']
|
|
|
|
|
list.value[res[0]]['feeCode'] = dict['code']
|
|
|
|
|
list.value[res[0]]['taxRate'] = dict['taxRate']
|
|
|
|
|
list.value[changes[0][0]]['feeName'] = changes[0][3].split('-')[1]
|
|
|
|
|
list.value[changes[0][0]]['feeEnName'] = dict['enName']
|
|
|
|
|
list.value[changes[0][0]]['currency'] = dict['defaultCurrency']
|
|
|
|
|
list.value[changes[0][0]]['customerTypeText'] = dict['defaultDebitName']
|
|
|
|
|
list.value[changes[0][0]]['customerType'] = dict['defaultDebit']
|
|
|
|
|
list.value[changes[0][0]]['isOpen'] = dict['isOpen']
|
|
|
|
|
list.value[changes[0][0]]['isAdvancedPay'] = dict['isAdvancedPay']
|
|
|
|
|
list.value[changes[0][0]]['isInvoice'] = dict['isInvoice']
|
|
|
|
|
list.value[changes[0][0]]['feeFrt'] = dict['feeFrt']
|
|
|
|
|
list.value[changes[0][0]]['feeCode'] = dict['code']
|
|
|
|
|
list.value[changes[0][0]]['taxRate'] = dict['taxRate']
|
|
|
|
|
// 费用代码维护的单位标准是箱型,默认带出集装箱表格第一条数据,否则带出默认标准
|
|
|
|
|
if (dict.defaultUnit == 'XX') {
|
|
|
|
|
if (props?.details?.ctnInfo && props?.details?.ctnInfo?.length) {
|
|
|
|
|
list.value[changes[0][0]]['unitText'] = props.details.ctnInfo[0].ctn
|
|
|
|
|
list.value[changes[0][0]]['unit'] = props.details.ctnInfo[0].ctnCode
|
|
|
|
|
list.value[changes[0][0]]['quantity'] = props.details.ctnInfo[0].ctnNum
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
list.value[changes[0][0]]['unitText'] = dict['defaultUnitName']
|
|
|
|
|
list.value[changes[0][0]]['unit'] = dict['defaultUnit']
|
|
|
|
|
// 联动带出计费标准带出的数量
|
|
|
|
|
const uItem = unitDict.value.filter((item) => {
|
|
|
|
|
return list.value[changes[0][0]]['unitText'].includes(item.name)
|
|
|
|
|
})
|
|
|
|
|
if (uItem) dict = uItem[0]
|
|
|
|
|
if (dict && dict?.value) {
|
|
|
|
|
GetUnitSelectInfo({ code: dict?.value, businessId: props.id, businessType: props.type }).then(res => {
|
|
|
|
|
list.value[changes[0][0]]['quantity'] = res.data.quantity
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 根据客户类别带出相应的费用对象
|
|
|
|
|
getDictOption('djy_cust_prop').then((res) => {
|
|
|
|
|
const item = res.filter((item) => {
|
|
|
|
|
return list.value[changes[0][0]]['customerTypeText'].includes(item.name)
|
|
|
|
|
})
|
|
|
|
|
if (item) dict = item[0]
|
|
|
|
|
if (dict.value) {
|
|
|
|
|
// 调用接口取费用对象
|
|
|
|
|
GetClientSelectInfoByCode({ code: dict?.value, businessId: props.id, businessType: props.type }).then(res => {
|
|
|
|
|
list.value[changes[0][0]]['customerCode'] = res.data.clientId
|
|
|
|
|
list.value[changes[0][0]]['customerName'] = res.data.clientName
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 修改费用英文名称
|
|
|
|
|
if (changes[0][1] === 'feeEnName') {
|
|
|
|
|
}
|
|
|
|
@ -513,11 +549,12 @@
|
|
|
|
|
list.value[changes[0][0]]['customerType'] = dict?.value
|
|
|
|
|
list.value[changes[0][0]]['customerTypeText'] = changes[0][3].split('-')[1]
|
|
|
|
|
// 调用接口取费用对象
|
|
|
|
|
console.log(props.details)
|
|
|
|
|
GetClientSelectInfoByCode({ code: dict?.value, businessId: props.id, businessType: props.type }).then(res => {
|
|
|
|
|
list.value[changes[0][0]]['customerCode'] = res.data.clientId
|
|
|
|
|
list.value[changes[0][0]]['customerName'] = res.data.clientName
|
|
|
|
|
})
|
|
|
|
|
if (dict && dict.value) {
|
|
|
|
|
GetClientSelectInfoByCode({ code: dict?.value, businessId: props.id, businessType: props.type }).then(res => {
|
|
|
|
|
list.value[changes[0][0]]['customerCode'] = res.data.clientId
|
|
|
|
|
list.value[changes[0][0]]['customerName'] = res.data.clientName
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 修改单位
|
|
|
|
@ -700,7 +737,7 @@
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 选择插入
|
|
|
|
|
const selectInsert = (v) => {
|
|
|
|
|
const selectInsert = async (v) => {
|
|
|
|
|
const selectData = JSON.parse(JSON.stringify(list.value))
|
|
|
|
|
// 选择插入
|
|
|
|
|
if (v === 1) {
|
|
|
|
@ -720,6 +757,36 @@
|
|
|
|
|
const res = selectData.filter((item) => {
|
|
|
|
|
return item.selected
|
|
|
|
|
})
|
|
|
|
|
// 费用代码
|
|
|
|
|
const feeList = feeDict.value.length ? feeDict.value : (await GetFeeCodeSelectList())?.data
|
|
|
|
|
res.forEach(data => {
|
|
|
|
|
const item = feeList.filter((item) => {
|
|
|
|
|
return item.name == data.feeName
|
|
|
|
|
})
|
|
|
|
|
// 自动更换客户类别客户类别
|
|
|
|
|
if (item && item.length) {
|
|
|
|
|
// 如果当前所选的这一行数据是应收,则把客户类型和客户换成默认应付的数据
|
|
|
|
|
if (data.customerTypeText == item[0].defaultCreditName) {
|
|
|
|
|
data.customerTypeText = item[0].defaultDebitName
|
|
|
|
|
data.customerType = item[0].defaultDebit
|
|
|
|
|
}
|
|
|
|
|
// 如果当前所选的这一行数据是应付,则把客户类型和客户换成默认应收的数据
|
|
|
|
|
if (data.customerTypeText == item[0].defaultDebitName) {
|
|
|
|
|
data.customerTypeText = item[0].defaultCreditName
|
|
|
|
|
data.customerType = item[0].defaultCredit
|
|
|
|
|
}
|
|
|
|
|
// 调用接口取费用对象
|
|
|
|
|
if (data && data.customerType) {
|
|
|
|
|
GetClientSelectInfoByCode({ code: data.customerType, businessId: props.id, businessType: props.type }).then(res => {
|
|
|
|
|
data.customerCode = res.data.clientId
|
|
|
|
|
data.customerName = res.data.clientName
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
data.customerCode = ''
|
|
|
|
|
data.customerName = ''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
emits('broInsert', res)
|
|
|
|
|
} else {
|
|
|
|
|
// 全部插入
|
|
|
|
@ -734,7 +801,6 @@
|
|
|
|
|
item.feeType = 1
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
console.log(selectData)
|
|
|
|
|
emits('broInsert', selectData)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|