bug修改

This commit is contained in:
gaoyuanwei 2022-07-19 14:45:35 +08:00
parent 00af09c4f0
commit bf56ce5eaa
1 changed files with 27 additions and 30 deletions

View File

@ -333,7 +333,7 @@
<!-- 关联组件 --> <!-- 关联组件 -->
<div class="AssociatedApplication"> <div class="AssociatedApplication">
<a-modal <a-modal
v-model:visible="visibleAssociatedApplication" v-model:visible="visibleAssociatedApplicationOther"
:title="titleName" :title="titleName"
@ok="handleOk" @ok="handleOk"
@cancel="handleCancel" @cancel="handleCancel"
@ -341,13 +341,13 @@
> >
<div> <div>
<a-transfer <a-transfer
v-model:target-keys="targetKeys2" v-model:target-keys="targetKeysOther"
v-model:selected-keys="selectedKeys2" v-model:selected-keys="selectedKeysOther"
:data-source="mockData2" :data-source="mockDataOther"
:titles="titles" :titles="titles"
:render="(item) => item.title" :render="(item) => item.title"
@change="handleChange1" @change="handleChangeOther"
@selectChange="handleSelectChange1" @selectChange="handleSelectChangeOther"
/> />
</div> </div>
</a-modal> </a-modal>
@ -652,12 +652,13 @@
} }
// //
const visibleAssociatedApplication = ref(false) const visibleAssociatedApplication = ref(false)
const visibleAssociatedApplicationOther = ref(false)
const mockData = ref([]) const mockData = ref([])
const mockData2 = ref([]) const mockDataOther = ref([])
const titles = ref(['未关联的应用名称', '已关联的应用名称']) const titles = ref(['未关联的应用名称', '已关联的应用名称'])
const titleName = ref('来源应用') const titleName = ref('来源应用')
const targetKeys = ref([]) const targetKeys = ref([])
const targetKeys2 = ref([]) const targetKeysOther = ref([])
// //
// const targetKeysBack = ref([]) // const targetKeysBack = ref([])
@ -704,8 +705,8 @@
const componentsClick = () => { const componentsClick = () => {
titles.value = ['未关联的组件名称', '已关联的组件名称'] titles.value = ['未关联的组件名称', '已关联的组件名称']
titleName.value = '关联组件' titleName.value = '关联组件'
mockData2.value = [] visibleAssociatedApplicationOther.value = true
visibleAssociatedApplication.value = true mockDataOther.value = []
props.dataFrom.infoList.forEach((val) => { props.dataFrom.infoList.forEach((val) => {
if (val.attrType === '关联组件信息' && val.attrValue != '') { if (val.attrType === '关联组件信息' && val.attrValue != '') {
queryResourceRelByKeyId({ queryResourceRelByKeyId({
@ -715,18 +716,18 @@
}).then((res) => { }).then((res) => {
// console.log(res.data.data.notLinked) // console.log(res.data.data.notLinked)
res.data.data.notLinked.forEach((val, index) => { res.data.data.notLinked.forEach((val, index) => {
mockData2.value.push({ mockDataOther.value.push({
key: val.id, key: val.id,
title: val.name, title: val.name,
description: val.id, description: val.id,
}) })
}) })
}) })
targetKeys2.value = [] targetKeysOther.value = []
val.attrValue.split(',').forEach((item) => { val.attrValue.split(',').forEach((item) => {
targetKeys2.value.push(item) targetKeysOther.value.push(item)
}) })
console.log(targetKeys2.value) console.log(targetKeysOther.value)
// console.log('wowowo') // console.log('wowowo')
} else if (val.attrType === '关联组件信息' && val.attrValue == '') { } else if (val.attrType === '关联组件信息' && val.attrValue == '') {
queryResourceRelByKeyId({ queryResourceRelByKeyId({
@ -736,7 +737,7 @@
}).then((res) => { }).then((res) => {
// console.log(res.data.data.notLinked) // console.log(res.data.data.notLinked)
res.data.data.notLinked.forEach((val, index) => { res.data.data.notLinked.forEach((val, index) => {
mockData2.value.push({ mockDataOther.value.push({
key: val.id, key: val.id,
title: val.name, title: val.name,
description: val.id, description: val.id,
@ -747,7 +748,7 @@
}) })
} }
const selectedKeys = ref([]) const selectedKeys = ref([])
const selectedKeys2 = ref([]) const selectedKeysOther = ref([])
const handleChange = (nextTargetKeys, direction, moveKeys) => { const handleChange = (nextTargetKeys, direction, moveKeys) => {
console.log('targetKeys: ', nextTargetKeys) console.log('targetKeys: ', nextTargetKeys)
@ -757,38 +758,34 @@
targetKeys.value = moveKeys.filter((item, index) => index === 0) targetKeys.value = moveKeys.filter((item, index) => index === 0)
} }
} }
const handleChange1 = (nextTargetKeys1, direction1, moveKeys1) => {
console.log('targetKeys: ', nextTargetKeys1)
console.log('direction: ', direction1)
console.log('moveKeys: ', moveKeys1)
}
const handleSelectChange = (sourceSelectedKeys, targetSelectedKeys) => { const handleSelectChange = (sourceSelectedKeys, targetSelectedKeys) => {
console.log('targetSelectedKeys: ', targetSelectedKeys, sourceSelectedKeys) console.log('targetSelectedKeys: ', targetSelectedKeys, sourceSelectedKeys)
console.log('after', sourceSelectedKeys)
} }
const handleSelectChange1 = (sourceSelectedKeys1, targetSelectedKeys1) => { const handleChangeOther = (nextTargetKeys, direction, moveKeys) => {
console.log( console.log('targetKeys: ', nextTargetKeys)
'targetSelectedKeys: ', console.log('direction: ', direction)
targetSelectedKeys1, console.log('moveKeys: ', moveKeys)
sourceSelectedKeys1 }
) const handleSelectChangeOther = (sourceSelectedKeys, targetSelectedKeys) => {
console.log('targetSelectedKeys: ', targetSelectedKeys, sourceSelectedKeys)
} }
const handleOk = (e) => { const handleOk = (e) => {
console.log(e) console.log(e)
visibleAssociatedApplicationOther.value = false
visibleAssociatedApplication.value = false visibleAssociatedApplication.value = false
// console.log('2222222222222', props.refData) // console.log('2222222222222', props.refData)
data.value.list.map((item) => { data.value.list.map((item) => {
if (item.name === '来源应用') { if (item.name === '来源应用') {
item.note1 = targetKeys.value + '' item.note1 = targetKeys.value + ''
} else if (item.name === '关联组件信息') { } else if (item.name === '关联组件信息') {
item.note1 = targetKeys2.value + '' item.note1 = targetKeysOther.value + ''
} }
}) })
} }
const handleCancel = (e) => { const handleCancel = (e) => {
console.log(e) console.log(e)
visibleAssociatedApplicationOther.value = false
visibleAssociatedApplication.value = false visibleAssociatedApplication.value = false
} }