异步组件传值问题

szh-new
lijingjia 3 months ago
parent b56611a4e0
commit 8424ae72ff

@ -186,7 +186,7 @@
const operationArea = defineAsyncComponent(() => import("./modules/operationArea.vue")) const operationArea = defineAsyncComponent(() => import("./modules/operationArea.vue"))
import basicInfo from './modules/basicInfo.vue' import basicInfo from './modules/basicInfo.vue'
import mailingInfo from './modules/mailingInfo.vue' import mailingInfo from './modules/mailingInfo.vue'
import noteInfo from './modules/noteInfo.vue' const noteInfo = defineAsyncComponent(() => import("./modules/noteInfo.vue"))
const cargoInfo = defineAsyncComponent(() => import("./modules/cargoInfo.vue")) const cargoInfo = defineAsyncComponent(() => import("./modules/cargoInfo.vue"))
const goodsTable = defineAsyncComponent(() => import("./modules/goodsTable.vue")) const goodsTable = defineAsyncComponent(() => import("./modules/goodsTable.vue"))
const ediMore = defineAsyncComponent(() => import("./modules/ediMore.vue")) const ediMore = defineAsyncComponent(() => import("./modules/ediMore.vue"))

@ -407,6 +407,7 @@
const source = ref(route.query.source || 'edit') const source = ref(route.query.source || 'edit')
onMounted(() => { onMounted(() => {
const nval = props.details const nval = props.details
console.log(nval)
if (nval.id) { if (nval.id) {
setFieldsValue1({ marks: nval.marks, description: nval.description }) setFieldsValue1({ marks: nval.marks, description: nval.description })
setFieldsValue2(nval) setFieldsValue2(nval)

@ -252,7 +252,7 @@
const route = useRoute() const route = useRoute()
const props = defineProps({ const props = defineProps({
details: { type: Object, default: {} }, details: { type: Object, default: {} },
isLockBooking: { type: Boolean, default: false }, isLockBooking: { type: Boolean, default: false }
}) })
// //
const source = 'edit' const source = 'edit'
@ -1259,7 +1259,6 @@
}, },
]) ])
function init(data, hot) { function init(data, hot) {
console.log(data)
const { ctnInfo } = data const { ctnInfo } = data
if (ctnInfo && ctnInfo.length > 0) { if (ctnInfo && ctnInfo.length > 0) {
totalPkgs.value = 0 totalPkgs.value = 0
@ -1618,32 +1617,17 @@
} }
}) })
watch( watch(
list.value, () => props.details,
(val) => { (val) => {
let a = 0 //
let b = 0 if (val.ctnInfo && val.ctnInfo.length) {
val.forEach((item) => { const hot = hotmain.value.hotInstance
if (item.selected) { init(val, hot)
a += 1
} else {
b += 1
}
})
if (a == 0) {
allCheck.value = false
}
if (b == 0) {
allCheck.value = true
}
if (a != 0 && b != 0) {
someCheck.value = true
} else {
someCheck.value = false
} }
}, },
{ {
deep: true, deep: true,
}, }
) )
// //
const settings = { const settings = {

@ -80,6 +80,7 @@
}) })
} }
}) })
setFieldsValue(props.details)
// if (source.value != 'edit') { // if (source.value != 'edit') {
// noteFormSchema.forEach(item => { // noteFormSchema.forEach(item => {
// item.dynamicDisabled = true // item.dynamicDisabled = true

Loading…
Cancel
Save