Merge branch 'hi-ucs-dev' of http://15.2.21.221:3000/wuhongjian/hi-ucs into hi-ucs-dev

This commit is contained in:
a0049873 2022-07-19 15:06:32 +08:00
commit 8ec4b585b6
1 changed files with 48 additions and 13 deletions

View File

@ -392,6 +392,7 @@
</div> </div>
</div> </div>
</div> </div>
<!-- 来源应用 -->
<div class="AssociatedApplication"> <div class="AssociatedApplication">
<a-modal <a-modal
v-model:visible="visibleAssociatedApplication" v-model:visible="visibleAssociatedApplication"
@ -413,6 +414,28 @@
</div> </div>
</a-modal> </a-modal>
</div> </div>
<!-- 关联组件 -->
<div class="AssociatedApplication">
<a-modal
v-model:visible="visibleAssociatedApplicationOther"
:title="titleName"
@ok="handleOk"
@cancel="handleCancel"
style="width: 960px"
>
<div>
<a-transfer
v-model:target-keys="targetKeysOther"
v-model:selected-keys="selectedKeysOther"
:data-source="mockDataOther"
:titles="titles"
:render="(item) => item.title"
@change="handleChangeOther"
@selectChange="handleSelectChangeOther"
/>
</div>
</a-modal>
</div>
</div> </div>
</template> </template>
</div> </div>
@ -712,12 +735,15 @@
} }
// //
const visibleAssociatedApplication = ref(false) const visibleAssociatedApplication = ref(false)
const visibleAssociatedApplicationOther = ref(false)
const mockData = ref([]) const mockData = ref([])
const mockDataOther = ref([])
const titles = ref(['未关联的应用名称', '已关联的应用名称']) const titles = ref(['未关联的应用名称', '已关联的应用名称'])
const titleName = ref('来源应用') const titleName = ref('来源应用')
const targetKeys = ref([]) const targetKeys = ref([])
const targetKeysOther = ref([])
// //
const targetKeysBack = ref([]) // const targetKeysBack = ref([])
const sourceClick = () => { const sourceClick = () => {
mockData.value = [] mockData.value = []
@ -762,8 +788,8 @@
const componentsClick = () => { const componentsClick = () => {
titles.value = ['未关联的组件名称', '已关联的组件名称'] titles.value = ['未关联的组件名称', '已关联的组件名称']
titleName.value = '关联组件' titleName.value = '关联组件'
mockData.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({
@ -773,18 +799,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) => {
mockData.value.push({ mockDataOther.value.push({
key: val.id, key: val.id,
title: val.name, title: val.name,
description: val.id, description: val.id,
}) })
}) })
}) })
targetKeys.value = [] targetKeysOther.value = []
val.attrValue.split(',').forEach((item) => { val.attrValue.split(',').forEach((item) => {
targetKeys.value.push(item) targetKeysOther.value.push(item)
}) })
console.log(targetKeys.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({
@ -794,7 +820,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) => {
mockData.value.push({ mockDataOther.value.push({
key: val.id, key: val.id,
title: val.name, title: val.name,
description: val.id, description: val.id,
@ -805,6 +831,7 @@
}) })
} }
const selectedKeys = ref([]) const selectedKeys = ref([])
const selectedKeysOther = ref([])
const handleChange = (nextTargetKeys, direction, moveKeys) => { const handleChange = (nextTargetKeys, direction, moveKeys) => {
console.log('targetKeys: ', nextTargetKeys) console.log('targetKeys: ', nextTargetKeys)
@ -814,26 +841,34 @@
targetKeys.value = moveKeys.filter((item, index) => index === 0) targetKeys.value = moveKeys.filter((item, index) => index === 0)
} }
} }
const handleSelectChange = (sourceSelectedKeys, targetSelectedKeys) => { const handleSelectChange = (sourceSelectedKeys, targetSelectedKeys) => {
console.log('targetSelectedKeys: ', targetSelectedKeys, sourceSelectedKeys) console.log('targetSelectedKeys: ', targetSelectedKeys, sourceSelectedKeys)
// }
selectedKeys.value = [sourceSelectedKeys[sourceSelectedKeys.length - 1]] const handleChangeOther = (nextTargetKeys, direction, moveKeys) => {
console.log('after', sourceSelectedKeys) console.log('targetKeys: ', nextTargetKeys)
console.log('direction: ', direction)
console.log('moveKeys: ', moveKeys)
}
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 === '来源应用' || item.name === '关联组件信息') { if (item.name === '来源应用') {
item.note1 = targetKeys.value + '' item.note1 = targetKeys.value + ''
} else if (item.name === '关联组件信息') {
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
} }