关联组件

This commit is contained in:
gaoyuanwei 2022-07-05 10:11:50 +08:00
parent 92ae5c3088
commit 4c85700094
2 changed files with 41 additions and 5 deletions

View File

@ -223,3 +223,11 @@ export function queryApplicationRelByResourceId(params) {
params, params,
}) })
} }
//
export function queryResourceRelByKeyId(params) {
return request({
url: '/dataResourceRel/queryResourceRelByKeyId',
method: 'get',
params,
})
}

View File

@ -79,6 +79,9 @@
<a-button v-else-if="item.type == 'dialog'" @click="sourceClick"> <a-button v-else-if="item.type == 'dialog'" @click="sourceClick">
请选择来源应用 请选择来源应用
</a-button> </a-button>
<a-button v-else-if="item.type == 'dialog2'" @click="componentsClick">
请选择关联组件
</a-button>
<a-select v-else-if="item.type == 'select'" style="width: 240px" v-model:value="item.note1" <a-select v-else-if="item.type == 'select'" style="width: 240px" v-model:value="item.note1"
:placeholder="'请选择' + item.name"> :placeholder="'请选择' + item.name">
<a-select-option v-for="(itemSelect, indexSelect) in item.options" :key="indexSelect" <a-select-option v-for="(itemSelect, indexSelect) in item.options" :key="indexSelect"
@ -98,12 +101,12 @@
</div> </div>
</div> </div>
<div class="AssociatedApplication"> <div class="AssociatedApplication">
<a-modal v-model:visible="visibleAssociatedApplication" title="关联应用" @ok="handleOk" @cancel="handleCancel" <a-modal v-model:visible="visibleAssociatedApplication" :title="titleName" @ok="handleOk"
style="width: 960px"> @cancel="handleCancel" style="width: 960px">
<div> <div>
<a-transfer v-model:target-keys="targetKeys" v-model:selected-keys="selectedKeys" <a-transfer v-model:target-keys="targetKeys" v-model:selected-keys="selectedKeys"
:data-source="mockData" :titles="['未关联的应用名称', '已关联的应用名称']" :render="(item) => item.title" :data-source="mockData" :titles="titles" :render="(item) => item.title" @change="handleChange"
@change="handleChange" @selectChange="handleSelectChange" /> @selectChange="handleSelectChange" />
</div> </div>
</a-modal> </a-modal>
</div> </div>
@ -120,6 +123,7 @@ import { message } from 'ant-design-vue'
import { import {
getCategoryTreePage, getCategoryTreePage,
queryApplicationRelByResourceId, queryApplicationRelByResourceId,
queryResourceRelByKeyId,
} from '@/api/personalCenter' } from '@/api/personalCenter'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
@ -327,6 +331,8 @@ const ApplicationArea = (item, itemson) => {
// //
const visibleAssociatedApplication = ref(false) const visibleAssociatedApplication = ref(false)
const mockData = ref([]) const mockData = ref([])
const titles = ref(['未关联的应用名称', '已关联的应用名称'])
const titleName = ref('关联应用')
const sourceClick = () => { const sourceClick = () => {
visibleAssociatedApplication.value = true visibleAssociatedApplication.value = true
@ -344,6 +350,28 @@ const sourceClick = () => {
}) })
}) })
} }
//
const componentsClick = () => {
titles.value = ['未关联的组件名称', '已关联的组件名称']
titleName.value = '关联组件'
visibleAssociatedApplication.value = true
queryResourceRelByKeyId({
keyId: 0,
type: '组件服务',
referenceName: '',
}).then((res) => {
// console.log(res.data.data.notLinked)
res.data.data.notLinked.forEach((val, index) => {
// console.log(val, index)
mockData.value.push({
key: val.id,
title: val.name,
description: val.id,
})
})
})
}
const targetKeys = ref([]) const targetKeys = ref([])
const selectedKeys = ref([]) const selectedKeys = ref([])
@ -362,7 +390,7 @@ const handleOk = (e) => {
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.name === '关联组件信息') {
item.note1 = targetKeys.value + '' item.note1 = targetKeys.value + ''
} }
}) })