Commit b8304794 by linjinhong

Merge branch 'fix_Logistics_method' into dev

parents 3beab62e 839c7b79
......@@ -79,6 +79,10 @@ export default defineComponent({
type: Boolean,
default: false,
},
valueKey: {
type: String,
default: 'id',
},
},
emits: ['update:modelValue'],
setup(props, { emit }) {
......@@ -94,9 +98,17 @@ export default defineComponent({
() => props.modelValue,
(newVal) => {
if (props.isRadio) {
selectedRadioList.value = newVal as string | number
allWayLists.value = props.companyList.flatMap(
(company) => company.wayList,
) as IwayList[]
console.log('waysName', waysName.value)
if (props.valueKey === 'id') {
selectedRadioList.value = newVal as string | number
} else {
selectedRadioList.value =
allWayLists.value.find((el: IwayList) => newVal === el.name)
?.id || ''
}
} else {
selectedList.value = newVal as (string | number)[]
}
......@@ -114,9 +126,7 @@ export default defineComponent({
() => selectedRadioList.value,
],
(newVal) => {
// console.log(90, newVal)
if (props.isRadio) {
emit('update:modelValue', newVal[2])
companyList.value = newVal[1] as ICompanyList[]
allWayLists.value = props.companyList.flatMap(
(company) => company.wayList,
......@@ -125,6 +135,11 @@ export default defineComponent({
waysName.value =
allWayLists.value.find((el: IwayList) => newVal[2] === el.id)
?.name || ''
if (props.valueKey === 'id') {
emit('update:modelValue', newVal[2])
} else {
emit('update:modelValue', waysName.value)
}
} else {
emit('update:modelValue', newVal[0])
allList.value = newVal[1] as IAllList[]
......
......@@ -198,7 +198,6 @@ watch(
) => {
// 检查旧值项是否符合条件
if (
Array.isArray(oldItem.showPlatform) &&
oldItem.showPlatform.length === 1 &&
oldItem.showPlatform[0] === 'TIKTOK' &&
oldItem.logisticsName
......@@ -469,6 +468,7 @@ const formConfig = computed<IFormConfig[]>(() => [
v-model={item.logisticsName as string | number}
isRadio={true}
companyList={tiktokCarriers.value as ICompanyList[]}
valueKey="name"
></LogisticsWaySelect>
</el-form-item>
) : (
......@@ -574,16 +574,7 @@ const tableConfig = ref<TableColumn[]>([
</span>
<span>
<span>{'物流名称:'}</span>
{el.platform === 'TIKTOK' ? (
<span class="logistics-name">
{tiktokCarriers.value
?.flatMap((company) => company.wayList)
?.find((item) => el.logisticsName === item.id)?.name ||
el.logisticsName}
</span>
) : (
<span class="logistics-name">{el.logisticsName}</span>
)}
<span class="logistics-name">{el.logisticsName}</span>
</span>
</div>
)),
......@@ -896,8 +887,6 @@ async function getAllList() {
if (index == 0) {
warehouseList.value = item.value.data || []
} else if (index == 1) {
console.log(758, item.value.data)
ruleNameList.value = (item.value.data as never[]) || []
} else if (index == 2) {
platformList.value = (item.value.data as never[]) || []
......@@ -910,8 +899,6 @@ async function getAllList() {
}
},
)
console.log(545, res)
} catch (error) {
console.log(error)
}
......@@ -943,7 +930,6 @@ async function getTiktokCarriers() {
})
})
tiktokCarriers.value = result
console.log(893, tiktokCarriers.value)
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment