hi-ucs/front/src/views/capacityOnTheShelf/components/PutOnTheShelf.vue

1279 lines
37 KiB
Vue
Raw Normal View History

2022-06-19 10:22:39 +08:00
<!--
* @Author: hisense.liangjunhua
* @Date: 2022-06-17 14:11:08
2022-07-18 14:43:24 +08:00
* @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-19 18:51:52
2022-06-19 10:22:39 +08:00
* @Description: 上架
-->
<template>
<div class="put-on-the-shelf">
<div v-for="title in props.refData.children" :key="title.id">
<div class="top">
<div></div>
<div>{{ title.name }}</div>
<div></div>
</div>
<template v-if="title.isConfigure">
<div class="bottom">
2022-07-19 15:06:26 +08:00
<!-- <div class="items" v-if="data[title.name].length > 0">
2022-07-12 15:58:57 +08:00
<div
class="item"
v-for="(val, index) in data[title.name]"
:key="'key1' + val.name + index"
>
2022-06-19 10:22:39 +08:00
<p>
<span>{{ title.name }}-{{ index + 1 }}</span>
<span></span>
</p>
2022-07-12 15:58:57 +08:00
<p
v-for="attr in props.configure.filter(
(item, index2) => item.name === title.name
)[0].list"
:key="'key2' + attr.name + index2"
>
2022-06-19 10:22:39 +08:00
<span>{{ attr.name }}</span>
<span v-if="attr.type === 'image'">
<a-image :width="85" :height="60" :src="val.img" />
</span>
<span v-else>{{ val[attr.field] + (attr.company || '') }}</span>
</p>
<div class="del">
<i class="delImg" @click="del(title.name, index)"></i>
<div @click="del(title.name, index)">删除</div>
</div>
</div>
2022-07-19 15:06:26 +08:00
</div> -->
<div
v-for="(val, index) in data[title.name]"
:key="'key1' + val.name + index"
>
<div
style="
font-size: 0.18rem;
font-weight: 600;
display: flex;
justify-content: flex-start;
"
>
<span>{{ title.name }}-{{ index + 1 }}</span>
<a-popconfirm
:title="'是否删除该条' + title.name + '?'"
ok-text="是"
cancel-text="否"
@confirm="del(title.name, index)"
>
<div class="del">
<i class="delImg"></i>
<div>删除</div>
</div>
</a-popconfirm>
</div>
<div
class="form"
v-for="attr in props.configure.filter(
(item, index2) => item.name === title.name
)[0].list"
:key="'key2' + attr.name + index2"
>
<span>{{ attr.name }}</span>
<a-input
disabled
v-model:value="val[attr.field]"
:maxlength="24"
:placeholder="'请填写' + attr.name + ',不超过24个字符'"
v-if="attr.type == 'input'"
/>
<template v-if="attr.type == 'input2'">
<a-input
disabled
v-model:value="val[attr.field]"
:placeholder="'请填写' + attr.name"
/>
</template>
<a-textarea
disabled
v-model:value="val[attr.field]"
:showCount="true"
:maxlength="200"
:placeholder="'请填写' + attr.name"
v-else-if="attr.type == 'textArea'"
/>
<!-- <a-radio-group
v-model:value="val[attr.field]"
:options="val.options"
@change="radioChange"
v-else-if="attr.type == 'radio'"
/> -->
<div v-else-if="attr.type == 'radio'">
{{ val[attr.field] + (attr.company || '') }}
</div>
<span v-else-if="attr.type === 'image'">
<a-image :width="85" :height="60" :src="val.img" />
</span>
<!-- <upload
:key="showKey"
type="图片"
btnName="上传图片"
:maxCount="1"
:data="val"
:list="[]"
tip="支持图片类型大小不超过100M"
v-else-if="val.type == 'image'"
></upload> -->
</div>
</div>
<!-- <div class="add" @click="add(title.name)">
添加更多{{ title.name }}
</div> -->
<div style="font-size: 0.18rem; font-weight: 600">
<span>{{ title.name }}-{{ data[title.name].length + 1 }}</span>
2022-06-19 10:22:39 +08:00
</div>
2022-07-12 15:58:57 +08:00
<div
class="form"
v-for="(val, index) in props.configure.filter(
(item) => item.name === title.name
)[0].list"
:key="'key3' + val.name + index"
>
2022-06-19 10:22:39 +08:00
<span>{{ val.name }}</span>
2022-07-12 15:58:57 +08:00
<a-input
v-model:value="val.note1"
:maxlength="24"
:placeholder="'请填写' + val.name + ',不超过24个字符'"
v-if="val.type == 'input'"
/>
2022-07-15 11:49:14 +08:00
<template v-if="val.type == 'input2'">
<a-input
v-model:value="val.note1"
:placeholder="'请填写' + val.name"
/>
<span style="width: 0.5rem; padding-left: 0.1rem">
{{
numType == '一次性买断'
? '元'
: numType == '按调用次数'
? '元/次'
: numType == '按并发路数'
? '元/路'
: numType == '按年计费'
? '元/年'
: ''
}}
</span>
</template>
2022-07-12 15:58:57 +08:00
<a-textarea
v-model:value="val.note1"
:showCount="true"
:maxlength="200"
:placeholder="'请填写' + val.name"
v-else-if="val.type == 'textArea'"
/>
<a-input-number
v-model:value="val.note1"
:min="0"
:max="9999"
:step="0.01"
string-mode
:placeholder="'请填写' + val.name"
v-else-if="val.type == 'number'"
/>
<a-radio-group
v-model:value="val.note1"
:options="val.options"
2022-07-15 11:49:14 +08:00
@change="radioChange"
2022-07-12 15:58:57 +08:00
v-else-if="val.type == 'radio'"
/>
<upload
:key="showKey"
type="图片"
btnName="上传图片"
:maxCount="1"
:data="val"
:list="[]"
tip="支持图片类型大小不超过100M"
v-else-if="val.type == 'image'"
></upload>
2022-06-19 10:22:39 +08:00
</div>
<div class="submit">
2022-07-16 14:27:58 +08:00
<a-button type="primary" @click="add(title.name)">
2022-07-19 15:06:26 +08:00
添加更多{{ title.name }}
2022-07-16 14:27:58 +08:00
</a-button>
2022-06-19 10:22:39 +08:00
</div>
</div>
</template>
<template v-else>
<div class="bottom">
2022-07-15 17:22:48 +08:00
<div
class="form"
v-for="item in title.children"
:key="item.id"
v-show="
!(
(showType == '调用接口' && item.name == '平台地址') ||
(showType == '调用接口' && item.name == 'SDK安装包') ||
(showType == '平台对接' && item.name == 'SDK安装包') ||
(showType == '平台对接' && item.name == '接口请求方式') ||
(showType == '平台对接' && item.name == '服务接口') ||
(showType == 'SDK' && item.name == '平台地址') ||
(showType == 'SDK' && item.name == '接口请求方式') ||
(showType == 'SDK' && item.name == '服务接口')
)
"
>
2022-06-19 10:22:39 +08:00
<span>{{ item.name }}</span>
2022-07-12 15:58:57 +08:00
<a-input
2022-07-19 10:25:10 +08:00
v-if="item.type == 'input' && item.name.indexOf('名称') == -1"
2022-07-12 15:58:57 +08:00
v-model:value="item.note1"
:placeholder="'请输入' + item.name"
/>
2022-07-19 10:25:10 +08:00
<a-input
v-else-if="
item.type == 'input' && item.name.indexOf('名称') != -1
"
:maxLength="50"
v-model:value="item.note1"
:placeholder="'请输入' + item.name + '不超过50个字符'"
/>
2022-07-12 15:58:57 +08:00
<a-radio-group
v-else-if="item.type == 'radio'"
v-model:value="item.note1"
:options="item.options"
/>
<a-input
2022-07-15 11:14:48 +08:00
v-else-if="item.type == 'AbilityType'"
2022-07-12 15:58:57 +08:00
v-model:value="item.note1"
:placeholder="'请输入' + item.name"
:disabled="true"
/>
<a-input
2022-07-15 11:07:08 +08:00
v-else-if="item.type == 'ComponentType'"
2022-07-12 15:58:57 +08:00
v-model:value="item.note1"
:placeholder="'请输入' + item.name"
:disabled="true"
/>
<a-textarea
v-else-if="item.type == 'textArea'"
v-model:value="item.note1"
:showCount="true"
:maxlength="200"
:placeholder="'请输入' + item.name"
/>
<upload
v-else-if="item.type == 'image'"
type="图片"
btnName="上传图片"
:maxCount="1"
:data="item"
:list="props.imgList"
tip="支持图片类型大小不超过100M"
></upload>
<upload
v-else-if="item.type == 'file' && item.name !== '使用手册'"
type="文件"
btnName="上传附件"
:maxCount="1"
:data="item"
:list="props.fileList"
tip="支持文件类型大小不超过100M"
></upload>
2022-07-12 16:54:35 +08:00
<upload
2022-07-12 15:58:57 +08:00
v-else-if="item.name == '使用手册'"
2022-07-12 16:54:35 +08:00
type="文件"
btnName="上传附件"
:maxCount="1"
:data="item"
:busType="2"
:list="props.fileList2"
tip="支持文件类型大小不超过100M"
></upload>
2022-07-15 17:22:48 +08:00
<upload
v-else-if="item.type == 'package'"
type="压缩包"
btnName="上传安装包"
:maxCount="1"
:data="item"
:list="props.packageList"
tip="支持.zip类型"
></upload>
2022-07-12 16:54:35 +08:00
<div
2022-07-12 17:13:03 +08:00
class="Technical-text"
2022-07-12 16:54:35 +08:00
v-else-if="item.type == 'richText'"
2022-07-12 15:58:57 +08:00
@click="showTextFunction()"
>
2022-07-12 17:13:03 +08:00
编辑富文本
2022-07-14 14:55:49 +08:00
<div
2022-07-14 18:43:32 +08:00
v-if="showText"
2022-07-14 14:55:49 +08:00
class="fuwenbenbianjiqi"
style="position: absolute; z-index: 10000"
>
<VueTemplateDemo :dataFrom="props.dataFrom"></VueTemplateDemo>
</div>
2022-07-12 15:58:57 +08:00
</div>
<upload
v-else-if="item.type == 'video'"
type="视频"
btnName="上传视频"
:maxCount="1"
:data="item"
:list="props.videoList"
tip="支持视频类型大小不超过100M"
></upload>
2022-07-19 17:14:42 +08:00
<!-- <a-button
2022-07-15 11:07:08 +08:00
v-else-if="item.type == 'AssociatedApplication'"
@click="sourceClick"
>
2022-07-01 17:58:25 +08:00
请选择来源应用
2022-07-19 17:14:42 +08:00
</a-button> -->
<a-select
v-else-if="item.type == 'select' && item.name == '来源应用'"
style="width: 2.4rem"
v-model:value="item.note1"
show-search
placeholder="请输入关键字"
:options="item.options"
:filter-option="applicationsOption"
@focus="applicationsFocus"
@blur="applicationsBlur"
@change="applicationsChange"
></a-select>
2022-07-12 15:58:57 +08:00
<a-button
2022-07-15 11:07:08 +08:00
v-else-if="item.type == 'AssociatedComponents'"
2022-07-12 15:58:57 +08:00
@click="componentsClick"
>
2022-07-05 10:11:50 +08:00
请选择关联组件
</a-button>
2022-07-15 17:22:48 +08:00
<a-select
v-else-if="item.type == 'select' && item.name == '使用方式'"
2022-07-19 15:06:26 +08:00
style="width: 2.4rem"
2022-07-15 17:22:48 +08:00
v-model:value="item.note1"
:placeholder="'请选择' + item.name"
@change="showTypeClick"
>
<a-select-option
v-for="(itemSelect, indexSelect) in item.options"
:key="indexSelect"
:value="itemSelect.dictLabel"
>
{{ itemSelect.dictLabel }}
</a-select-option>
</a-select>
2022-07-12 15:58:57 +08:00
<a-select
2022-07-15 17:40:32 +08:00
v-else-if="item.type == 'select' && item.name !== '归属部门'"
2022-07-19 15:06:26 +08:00
style="width: 2.4rem"
2022-07-12 15:58:57 +08:00
v-model:value="item.note1"
:placeholder="'请选择' + item.name"
>
<a-select-option
v-for="(itemSelect, indexSelect) in item.options"
:key="indexSelect"
:value="itemSelect.dictLabel"
>
2022-06-19 10:22:39 +08:00
{{ itemSelect.dictLabel }}
</a-select-option>
</a-select>
<a-select
v-else-if="item.name === '归属部门'"
2022-07-19 15:06:26 +08:00
style="width: 2.4rem"
v-model:value="item.note1"
show-search
placeholder="请输入关键字"
:options="item.options"
:filter-option="filterOption"
@focus="handleFocus"
@blur="handleBlur"
@change="handleChange2"
></a-select>
2022-07-12 15:58:57 +08:00
<div
v-else-if="item.type == 'checkBox'"
class="application-Area"
id="application-Area"
:key="showKey"
>
<div
v-for="(itemson, indexson) in item.options"
:key="indexson"
class="application-Area-son"
@click="ApplicationArea(item, itemson)"
:class="
2022-06-19 10:22:39 +08:00
item.note2.indexOf(itemson.dictLabel) != -1
? 'application-Area-down'
: ''
2022-07-12 15:58:57 +08:00
"
>
2022-06-19 10:22:39 +08:00
{{ itemson.dictLabel }}
</div>
</div>
</div>
2022-07-19 14:05:47 +08:00
<!-- 来源应用 -->
2022-07-04 17:15:45 +08:00
<div class="AssociatedApplication">
2022-07-12 15:58:57 +08:00
<a-modal
v-model:visible="visibleAssociatedApplication"
:title="titleName"
@ok="handleOk"
@cancel="handleCancel"
2022-07-19 15:06:26 +08:00
style="width: 9.6rem"
2022-07-12 15:58:57 +08:00
>
2022-07-04 17:15:45 +08:00
<div>
2022-07-12 15:58:57 +08:00
<a-transfer
v-model:target-keys="targetKeys"
v-model:selected-keys="selectedKeys"
:data-source="mockData"
:titles="titles"
:render="(item) => item.title"
@change="handleChange"
@selectChange="handleSelectChange"
/>
2022-07-04 17:15:45 +08:00
</div>
</a-modal>
</div>
2022-07-19 14:05:47 +08:00
<!-- 关联组件 -->
<div class="AssociatedApplication">
<a-modal
2022-07-19 14:45:35 +08:00
v-model:visible="visibleAssociatedApplicationOther"
2022-07-19 14:05:47 +08:00
:title="titleName"
@ok="handleOk"
@cancel="handleCancel"
style="width: 960px"
>
<div>
<a-transfer
2022-07-19 14:45:35 +08:00
v-model:target-keys="targetKeysOther"
v-model:selected-keys="selectedKeysOther"
:data-source="mockDataOther"
2022-07-19 14:05:47 +08:00
:titles="titles"
:render="(item) => item.title"
2022-07-19 14:45:35 +08:00
@change="handleChangeOther"
@selectChange="handleSelectChangeOther"
2022-07-19 14:05:47 +08:00
/>
</div>
</a-modal>
</div>
2022-06-19 10:22:39 +08:00
</div>
</template>
</div>
</div>
</template>
<script setup>
2022-07-19 18:51:21 +08:00
import {
ref,
defineProps,
watch,
onMounted,
defineExpose,
defineEmits,
} from 'vue'
2022-07-12 15:58:57 +08:00
import mybus from '@/myplugins/mybus'
import upload from '@/views/components/upload'
import { message } from 'ant-design-vue'
import { getUserInfo, getDeptAll } from '@/api/user'
2022-07-25 11:34:30 +08:00
import VueTemplateDemo from '@/views/personalCenter/VueTemplateDemo.vue'
2022-07-12 15:58:57 +08:00
import {
getCategoryTreePage,
queryApplicationRelByResourceId,
queryResourceRelByKeyId,
filesUpload,
} from '@/api/personalCenter'
import { useRouter } from 'vue-router'
const router = useRouter()
const abilityToType = router.currentRoute.value.query.abilityToType
const componentTypeValue = router.currentRoute.value.query.componentTypeValue
const props = defineProps({
// 展示数据
refData: { type: Object, default: null },
// 表单数据
dataFrom: { type: Array, default: null },
// 文件回显
fileList: { type: Array, default: null },
fileList2: { type: Array, default: null },
2022-07-15 17:22:48 +08:00
// 压缩包回显
packageList: { type: Array, default: null },
2022-07-12 15:58:57 +08:00
// 图片回显
imgList: { type: Array, default: null },
// 视频回显
videoList: { type: Array, default: null },
// 外部字段
externalField: { type: Array, default: null },
// 多条的配置
configure: { type: Array, default: null },
// [{
// name:'计费标准信息',
// list:[
// {
// name:'计费方式',
// type:'radio',
// field:'type',
// options:
// {
// name:'一次性买断',
// value:'1'
// },
// {
// name:'按调用次数',
// value:'2'
// },
// {
// name:'按并发路数',
// value:'3'
// },
// {
// name:'按年计费',
// value:'4'
// }
// ],
// note1:''
// },
// {
// name:'计费标准',
// field:'price',
// type:'number',
// company:'元',
// note1: ''
// },
// {
// name:'计费标准描述',
// field:'desc',
// type:'textArea',
// note1:''
// }
// ]
// }]
})
2022-07-19 18:51:21 +08:00
const emit = defineEmits(['next', 'back', 'submit'])
2022-07-12 15:58:57 +08:00
// console.log('props==========>', props)
2022-07-15 16:30:13 +08:00
const changeAdd = () => {
console.log('子组件方法触发~')
}
2022-07-12 15:58:57 +08:00
const data = ref({
list: [],
})
const showKey = ref(0)
2022-07-15 11:51:40 +08:00
const numType = ref('一次性买断')
2022-07-15 11:49:14 +08:00
const radioChange = (e) => {
numType.value = e.target.value
}
2022-07-12 15:58:57 +08:00
props.refData.children.map((item) => {
if (item.name == '基本信息') {
item.children.map((val) => {
if (val.name == '能力类型') {
val.note1 = abilityToType
}
if (val.name == '组件类型') {
val.note1 = componentTypeValue
2022-07-01 20:13:39 +08:00
}
})
}
2022-06-19 10:22:39 +08:00
if (
props.configure &&
2022-07-12 15:58:57 +08:00
props.configure.filter((val) => val.name === item.name).length > 0
2022-06-19 10:22:39 +08:00
) {
2022-07-12 15:58:57 +08:00
item.isConfigure = true
data.value[item.name] = []
} else {
item.isConfigure = false
2022-06-19 10:22:39 +08:00
}
})
2022-07-12 15:58:57 +08:00
let arr = props.refData.children.filter((item) => {
if (props.configure) {
if (!item.isConfigure) {
return item
}
} else {
return item
2022-06-19 10:22:39 +08:00
}
})
2022-07-12 15:58:57 +08:00
data.value.list = []
// 获取字典数据
arr.forEach((val) => {
val.children.forEach((item) => {
if (item.isLinkToDic === 'true' && item.linkValue) {
getCategoryTreePage({
page: 1,
limit: 20,
dictTypeId: item.linkValue,
deFlage: 0,
}).then((res) => {
if (item.type === 'radio') {
item.options = res.data.data.list.map((radio) => radio.dictLabel)
} else if (item.type === 'select' || item.type === 'checkBox') {
if (item.type === 'checkBox') {
if (!item.note2) {
item.note2 = []
}
}
item.options = res.data.data.list
}
data.value.list.push(item)
})
} else if (item.name === '归属部门') {
getDeptAll().then((res) => {
const dataList = []
res.data.data.forEach((element) => {
dataList.push({
value: element.id,
label: element.name,
})
})
item.options = dataList
if (!item.note1) {
getUserInfo().then(({ data: res1 }) => {
console.log(res1.data)
item.note1 = res1.data.deptId
2022-07-19 15:54:23 +08:00
item.note2 = item.options.filter(
(val) => val.value == item.note1
)[0]
console.log('默认部门=========>', item, res1.data)
data.value.list.push(item)
})
}
})
} else if (item.name === '部门联系人') {
if (!item.note1) {
getUserInfo().then(({ data: res1 }) => {
console.log(res1.data)
item.note1 = res1.data.realName || ''
})
2022-07-19 15:54:23 +08:00
data.value.list.push(item)
}
} else if (item.name === '部门联系人电话') {
if (!item.note1) {
getUserInfo().then(({ data: res1 }) => {
console.log(res1.data)
item.note1 = res1.data.mobile || ''
})
2022-07-19 15:54:23 +08:00
data.value.list.push(item)
}
2022-07-19 17:14:42 +08:00
} else if (item.name === '来源应用') {
queryApplicationRelByResourceId({
referenceId: 0,
}).then((res) => {
const dataList = []
res.data.data.notLinked.forEach((element) => {
dataList.push({
value: element.id,
label: element.name,
})
})
item.options = dataList
2022-07-19 17:44:39 +08:00
data.value.list.push(item)
2022-07-19 17:14:42 +08:00
})
2022-07-12 15:58:57 +08:00
} else {
data.value.list.push(item)
}
})
})
if (props.dataFrom) {
// console.log(props.dataFrom, data.value.list)
props.dataFrom.infoList.forEach((item) => {
if (
props.configure &&
props.configure.filter((val) => val.name === item.attrType).length > 0
) {
data.value[item.attrType] = JSON.parse(item.attrValue)
} else if (item.attrType === '应用领域') {
props.refData.children.forEach((val) => {
val.children.forEach((child) => {
if (child.name === item.attrType) {
// 通过;分割成数组
child.note2 = item.attrValue.split(';')
showKey.value++
// console.log('应用领域', item, item.attrValue.split(';'), child)
}
})
})
// item.note1 = item.attrValue.split(';')
}
})
}
//显示富文本
let showText = ref(false)
const showTextFunction = () => {
showText.value = true
}
mybus.on('showTextFunctionEmit', (show) => {
console.log('ssdcsd')
showText.value = show
})
mybus.off('func')
2022-07-19 18:51:21 +08:00
const add = (title, addFlag, type) => {
2022-07-12 15:58:57 +08:00
console.log(title, 'title')
let list = props.configure.filter((item) => item.name === title)[0].list
let flag = true
2022-07-04 17:15:45 +08:00
list.forEach((item) => {
2022-07-12 15:58:57 +08:00
// console.log(item)
if (item.type !== 'number' && !item.note1.length > 0) {
flag = false
} else if (item.type === 'number' && !item.note1 > 0) {
flag = false
}
2022-06-19 10:22:39 +08:00
})
2022-07-12 15:58:57 +08:00
if (flag) {
let obj = {}
2022-07-18 14:43:24 +08:00
let sfFlag = false
2022-07-12 15:58:57 +08:00
list.forEach((item) => {
2022-07-15 11:49:14 +08:00
if (item.type === 'input2') {
2022-07-18 14:43:24 +08:00
sfFlag = data.value[title].filter(
(val) => val.type === numType.value
)[0]
if (sfFlag) {
message.warning('已添加过该类型!')
return
}
2022-07-15 11:49:14 +08:00
obj[item.field] =
item.note1 +
(numType.value == '一次性买断'
? '元'
: numType.value == '按调用次数'
? '元/次'
: numType.value == '按并发路数'
? '元/路'
: numType.value == '按年计费'
? '元/年'
: '')
} else {
obj[item.field] = item.note1
}
2022-07-12 15:58:57 +08:00
})
2022-07-18 14:43:24 +08:00
if (!sfFlag) {
data.value[title].push(obj)
}
2022-07-12 15:58:57 +08:00
// console.log(data.value[title])
mybus.emit('chageDataFrom', {
attrType: title,
attrValue: JSON.stringify(data.value[title]),
delFlag: 0,
})
list.forEach((item) => {
item.note1 = ''
showKey.value++
})
2022-07-19 18:51:21 +08:00
if (addFlag) {
if (type == '上一步') {
emit('back')
} else if (type == '下一步') {
emit('next')
} else if (type == '提交') {
emit('submit')
}
}
2022-07-12 15:58:57 +08:00
} else {
2022-07-19 18:51:21 +08:00
if (!addFlag) {
message.warning('请填写完整')
} else {
list.forEach((item) => {
item.note1 = ''
showKey.value++
})
if (type == '上一步') {
emit('back')
} else if (type == '下一步') {
emit('next')
} else if (type == '提交') {
emit('submit')
}
}
2022-07-12 15:58:57 +08:00
}
}
const del = (title, index) => {
data.value[title].splice(index, 1)
2022-07-04 17:15:45 +08:00
mybus.emit('chageDataFrom', {
attrType: title,
attrValue: JSON.stringify(data.value[title]),
delFlag: 0,
2022-06-19 10:22:39 +08:00
})
2022-07-04 17:15:45 +08:00
}
2022-07-12 15:58:57 +08:00
const ApplicationArea = (item, itemson) => {
2022-07-13 18:15:13 +08:00
console.log('点击=========》', item, itemson)
2022-07-12 15:58:57 +08:00
// console.log(item, itemson)
if (item.note2.indexOf(itemson.dictLabel) === -1) {
item.note2.push(itemson.dictLabel)
} else {
item.note2.splice(item.note2.indexOf(itemson.dictLabel), 1)
}
mybus.emit('chageDataFrom', {
attrType: item.name,
attrValue: item.note2.join(';'),
delFlag: 0,
})
2022-07-04 17:15:45 +08:00
}
2022-07-12 15:58:57 +08:00
// 来源应用
const visibleAssociatedApplication = ref(false)
2022-07-19 14:45:35 +08:00
const visibleAssociatedApplicationOther = ref(false)
2022-07-12 15:58:57 +08:00
const mockData = ref([])
2022-07-19 14:45:35 +08:00
const mockDataOther = ref([])
2022-07-12 15:58:57 +08:00
const titles = ref(['未关联的应用名称', '已关联的应用名称'])
2022-07-18 15:45:40 +08:00
const titleName = ref('来源应用')
2022-07-16 15:25:49 +08:00
const targetKeys = ref([])
2022-07-19 14:45:35 +08:00
const targetKeysOther = ref([])
2022-07-16 15:25:49 +08:00
// 上一步关联数据
2022-07-19 14:05:47 +08:00
// const targetKeysBack = ref([])
2022-07-19 17:14:42 +08:00
// 来源应用-back
2022-07-12 15:58:57 +08:00
const sourceClick = () => {
2022-07-15 19:23:37 +08:00
mockData.value = []
2022-07-12 15:58:57 +08:00
visibleAssociatedApplication.value = true
2022-07-16 15:25:49 +08:00
props.dataFrom.infoList.forEach((val) => {
if (val.attrType === '来源应用' && val.attrValue != '') {
queryApplicationRelByResourceId({
referenceId: 0,
}).then((res) => {
// console.log(res.data.data.notLinked)
res.data.data.notLinked.forEach((val, index) => {
mockData.value.push({
key: val.id,
title: val.name,
description: val.id,
})
})
2022-07-12 15:58:57 +08:00
})
2022-07-16 15:25:49 +08:00
targetKeys.value = []
val.attrValue.split(',').forEach((item) => {
targetKeys.value.push(item)
})
console.log(targetKeys.value)
// console.log('wowowo')
} else if (val.attrType === '来源应用' && val.attrValue == '') {
queryApplicationRelByResourceId({
referenceId: 0,
}).then((res) => {
// console.log(res.data.data.notLinked)
res.data.data.notLinked.forEach((val, index) => {
mockData.value.push({
key: val.id,
title: val.name,
description: val.id,
})
})
})
}
2022-07-04 17:15:45 +08:00
})
2022-07-12 15:58:57 +08:00
}
// 关联组件
const componentsClick = () => {
titles.value = ['未关联的组件名称', '已关联的组件名称']
titleName.value = '关联组件'
2022-07-19 14:45:35 +08:00
visibleAssociatedApplicationOther.value = true
mockDataOther.value = []
2022-07-16 15:25:49 +08:00
props.dataFrom.infoList.forEach((val) => {
if (val.attrType === '关联组件信息' && val.attrValue != '') {
queryResourceRelByKeyId({
keyId: 0,
type: '组件服务',
referenceName: '',
}).then((res) => {
// console.log(res.data.data.notLinked)
res.data.data.notLinked.forEach((val, index) => {
2022-07-19 14:45:35 +08:00
mockDataOther.value.push({
2022-07-16 15:25:49 +08:00
key: val.id,
title: val.name,
description: val.id,
})
})
2022-07-12 15:58:57 +08:00
})
2022-07-19 14:45:35 +08:00
targetKeysOther.value = []
2022-07-16 15:25:49 +08:00
val.attrValue.split(',').forEach((item) => {
2022-07-19 14:45:35 +08:00
targetKeysOther.value.push(item)
2022-07-16 15:25:49 +08:00
})
2022-07-19 14:45:35 +08:00
console.log(targetKeysOther.value)
2022-07-16 15:25:49 +08:00
// console.log('wowowo')
} else if (val.attrType === '关联组件信息' && val.attrValue == '') {
queryResourceRelByKeyId({
keyId: 0,
type: '组件服务',
referenceName: '',
}).then((res) => {
// console.log(res.data.data.notLinked)
res.data.data.notLinked.forEach((val, index) => {
2022-07-19 14:45:35 +08:00
mockDataOther.value.push({
2022-07-16 15:25:49 +08:00
key: val.id,
title: val.name,
description: val.id,
})
})
})
}
2022-07-05 10:11:50 +08:00
})
2022-07-12 15:58:57 +08:00
}
const selectedKeys = ref([])
2022-07-19 14:45:35 +08:00
const selectedKeysOther = ref([])
2022-07-12 15:58:57 +08:00
const handleChange = (nextTargetKeys, direction, moveKeys) => {
console.log('targetKeys: ', nextTargetKeys)
console.log('direction: ', direction)
console.log('moveKeys: ', moveKeys)
2022-07-18 16:03:06 +08:00
if (direction === 'right') {
targetKeys.value = moveKeys.filter((item, index) => index === 0)
}
2022-07-12 15:58:57 +08:00
}
const handleSelectChange = (sourceSelectedKeys, targetSelectedKeys) => {
2022-07-16 15:25:49 +08:00
console.log('targetSelectedKeys: ', targetSelectedKeys, sourceSelectedKeys)
2022-07-12 15:58:57 +08:00
}
2022-07-19 14:45:35 +08:00
const handleChangeOther = (nextTargetKeys, direction, moveKeys) => {
console.log('targetKeys: ', nextTargetKeys)
console.log('direction: ', direction)
console.log('moveKeys: ', moveKeys)
}
const handleSelectChangeOther = (sourceSelectedKeys, targetSelectedKeys) => {
console.log('targetSelectedKeys: ', targetSelectedKeys, sourceSelectedKeys)
2022-07-12 15:58:57 +08:00
}
const handleOk = (e) => {
console.log(e)
2022-07-19 14:45:35 +08:00
visibleAssociatedApplicationOther.value = false
2022-07-12 15:58:57 +08:00
visibleAssociatedApplication.value = false
// console.log('2222222222222', props.refData)
data.value.list.map((item) => {
2022-07-19 14:05:47 +08:00
if (item.name === '来源应用') {
2022-07-12 15:58:57 +08:00
item.note1 = targetKeys.value + ''
2022-07-19 14:05:47 +08:00
} else if (item.name === '关联组件信息') {
2022-07-19 14:45:35 +08:00
item.note1 = targetKeysOther.value + ''
2022-07-12 15:58:57 +08:00
}
})
}
const handleCancel = (e) => {
console.log(e)
2022-07-19 14:45:35 +08:00
visibleAssociatedApplicationOther.value = false
2022-07-12 15:58:57 +08:00
visibleAssociatedApplication.value = false
}
2022-07-15 17:22:48 +08:00
const showType = ref('')
const showTypeClick = (e) => {
showType.value = e
console.log(e, 'showType', showType.value)
}
showTypeClick('调用接口')
2022-07-12 15:58:57 +08:00
watch(data.value.list, (newProps, oldProps) => {
// console.log(newProps, oldProps)
newProps.forEach((val) => {
// console.log('数据发生改变==========>', val)
if (
props.configure &&
props.configure.filter((item) => item.name === val.name).length > 0
) {
2022-06-19 10:22:39 +08:00
mybus.emit('chageDataFrom', {
attrType: val.name,
attrValue: val.note1,
delFlag: 0,
})
2022-07-12 15:58:57 +08:00
} else if (
props.externalField &&
props.externalField.indexOf(val.name) > -1
) {
2022-07-19 15:54:23 +08:00
let note2 = {} //储存归属部门的名字
if (val.options) {
note2 = val.options.filter((item) => item.value == val.note1)[0]
}
2022-07-12 15:58:57 +08:00
mybus.emit('chageDataFromDwon', {
attrType: val.name,
attrValue: val.note1,
delFlag: 0,
2022-07-19 15:54:23 +08:00
attrValueTwo: note2,
2022-07-12 15:58:57 +08:00
})
} else {
2022-07-13 18:15:13 +08:00
if (val.name !== '应用领域' && val.name !== '发布端') {
2022-07-12 15:58:57 +08:00
mybus.emit('chageDataFrom', {
attrType: val.name,
attrValue: val.note1,
delFlag: 0,
})
}
2022-06-19 10:22:39 +08:00
}
2022-07-12 15:58:57 +08:00
})
2022-06-19 10:22:39 +08:00
})
const handleChange2 = (value) => {
console.log(`selected ${value}`)
}
2022-07-19 17:14:42 +08:00
const applicationsChange = (value) => {
data.value.list.map((item) => {
if (item.name === '来源应用') {
item.note1 = value
2022-07-19 17:17:19 +08:00
}
2022-07-19 17:14:42 +08:00
})
console.log(`selected ${value}`)
}
const handleBlur = () => {
console.log('blur')
}
2022-07-19 17:14:42 +08:00
const applicationsBlur = () => {
console.log('blur')
}
const handleFocus = () => {
console.log('focus')
}
2022-07-19 17:14:42 +08:00
const applicationsFocus = () => {
console.log('focus')
}
const filterOption = (input, option) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
2022-07-19 18:51:21 +08:00
defineExpose({
add,
})
2022-07-19 17:14:42 +08:00
const applicationsOption = (input, option) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
2022-06-19 10:22:39 +08:00
</script>
2022-07-14 18:43:32 +08:00
<style></style>
2022-06-19 10:22:39 +08:00
<style lang="less" scoped>
2022-07-16 15:25:49 +08:00
.put-on-the-shelf {
2022-07-19 15:06:26 +08:00
height: 6.8rem;
2022-07-16 15:25:49 +08:00
overflow: scroll;
display: flex;
flex-direction: column;
align-items: center;
2022-07-19 15:06:26 +08:00
padding: 0.5rem 1rem 0.25rem;
2022-07-16 15:25:49 +08:00
.Technical-text {
2022-07-19 15:06:26 +08:00
height: 0.3rem;
width: 1rem;
border: 0.01rem solid #bbd3ef;
border-radius: 0.06rem;
2022-07-16 15:25:49 +08:00
background: #edf4fc;
color: #0087ff;
2022-07-19 15:06:26 +08:00
font-size: 0.14rem;
2022-07-16 15:25:49 +08:00
text-align: center;
2022-07-19 15:06:26 +08:00
line-height: 0.3rem;
2022-07-16 15:25:49 +08:00
}
.Technical-text:hover {
cursor: pointer;
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
& > div {
width: 100%;
2022-07-19 15:06:26 +08:00
margin-top: 0.6rem;
2022-07-15 17:40:32 +08:00
2022-07-16 15:25:49 +08:00
.top {
color: #333333;
2022-07-19 15:06:26 +08:00
font-size: 0.22rem;
2022-07-16 15:25:49 +08:00
display: flex;
justify-content: center;
align-items: center;
2022-07-19 15:06:26 +08:00
margin-bottom: 0.25rem;
2022-07-16 15:25:49 +08:00
div:first-child,
div:last-child {
2022-07-19 15:06:26 +08:00
width: 2.45rem;
height: 0.01rem;
2022-07-16 15:25:49 +08:00
background: #f0f0f0;
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
div:nth-child(2) {
2022-07-19 15:06:26 +08:00
margin: 0 0.3rem;
2022-07-16 15:25:49 +08:00
}
2022-07-15 19:23:37 +08:00
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
.bottom {
2022-07-19 15:06:26 +08:00
margin-top: 0.25rem;
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
.items {
background: #fafafa;
2022-07-19 15:06:26 +08:00
padding: 0.1rem;
2022-07-12 15:58:57 +08:00
2022-07-16 15:25:49 +08:00
p {
display: flex;
justify-content: space-between;
2022-07-15 17:40:32 +08:00
2022-07-16 15:25:49 +08:00
span:nth-of-type(1) {
2022-07-19 15:06:26 +08:00
width: 2rem;
2022-07-16 15:25:49 +08:00
}
span:nth-of-type(2) {
width: 100%;
font-weight: 600;
}
2022-06-19 10:22:39 +08:00
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
p:nth-of-type(1) > span:nth-of-type(1) {
2022-07-19 15:06:26 +08:00
font-size: 0.18rem;
2022-06-19 10:22:39 +08:00
font-weight: 600;
}
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
.add {
2022-07-19 15:06:26 +08:00
cursor: pointer;
margin-top: 0.1rem;
font-size: 0.16rem;
2022-07-16 15:25:49 +08:00
color: #007efb;
2022-06-19 10:22:39 +08:00
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
.form {
2022-07-19 15:06:26 +08:00
margin-top: 0.2rem;
2022-06-19 10:22:39 +08:00
display: flex;
2022-07-16 15:25:49 +08:00
justify-content: flex-start;
2022-07-15 11:49:14 +08:00
align-items: center;
2022-07-12 15:58:57 +08:00
2022-07-16 15:25:49 +08:00
span:first-child {
2022-07-19 15:06:26 +08:00
width: 1.2rem;
2022-06-19 10:22:39 +08:00
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
:deep(.ant-input-textarea) {
2022-07-19 15:06:26 +08:00
width: 5.2rem;
2022-06-19 10:22:39 +08:00
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
:deep(.ant-radio-group) {
2022-07-19 15:06:26 +08:00
width: 5.2rem;
2022-07-16 15:25:49 +08:00
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
:deep(.ant-input-number) {
2022-07-19 15:06:26 +08:00
width: 2rem;
2022-07-16 15:25:49 +08:00
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
:deep(.ant-input) {
resize: none;
2022-07-19 15:06:26 +08:00
width: 5.2rem;
2022-07-16 15:25:49 +08:00
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
.ant-btn {
2022-07-19 15:06:26 +08:00
width: 1.6rem;
height: 0.32rem;
2022-07-16 15:25:49 +08:00
text-align: center;
background: #edf4fc;
color: #0087ff;
2022-07-19 15:06:26 +08:00
border: 0.01rem solid #bbd3ef;
border-radius: 0.06rem;
2022-07-16 15:25:49 +08:00
}
2022-07-04 17:15:45 +08:00
}
2022-07-16 15:25:49 +08:00
.submit {
2022-07-19 15:06:26 +08:00
margin-top: 0.4rem;
2022-07-16 15:25:49 +08:00
display: flex;
justify-content: flex-end;
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
.ant-btn {
2022-07-19 15:06:26 +08:00
width: 1.8rem;
height: 0.3rem;
2022-07-16 15:25:49 +08:00
text-align: center;
background: #d9ebff;
color: #0087ff;
2022-07-19 15:06:26 +08:00
border: 0.01rem solid #0087ff;
border-radius: 0.06rem;
2022-07-16 15:25:49 +08:00
}
2022-07-04 17:15:45 +08:00
}
2022-07-16 15:25:49 +08:00
}
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
& > div:nth-of-type(1) {
margin-top: 0;
}
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
.application-Area {
2022-07-19 15:06:26 +08:00
width: 5.2rem;
2022-07-16 15:25:49 +08:00
display: grid;
2022-07-19 15:06:26 +08:00
margin-top: -0.05rem;
2022-07-16 15:25:49 +08:00
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
.application-Area-son {
cursor: pointer;
2022-07-19 15:06:26 +08:00
font-size: 0.14rem;
width: 0.9rem;
height: 0.26rem;
border-radius: 0.13rem;
2022-07-16 15:25:49 +08:00
color: #333333;
background: #f5f5f5;
2022-07-19 15:06:26 +08:00
border: 0.01rem #cccccc solid;
2022-07-16 15:25:49 +08:00
display: flex;
justify-content: center;
align-items: center;
2022-07-19 15:06:26 +08:00
margin-top: 0.1rem;
2022-07-16 15:25:49 +08:00
font-weight: 500;
}
.application-Area-down {
background: #0087ff;
color: #fff;
2022-06-19 10:22:39 +08:00
}
}
2022-07-04 17:15:45 +08:00
2022-07-16 15:25:49 +08:00
:deep(.ant-image-img) {
width: 100%;
height: 100%;
object-fit: contain;
2022-07-12 15:58:57 +08:00
}
2022-07-15 17:22:48 +08:00
2022-07-16 15:25:49 +08:00
:deep(.ant-modal) {
2022-07-19 15:06:26 +08:00
width: 9.6rem;
2022-07-16 15:25:49 +08:00
}
2022-07-15 17:22:48 +08:00
2022-07-16 15:25:49 +08:00
:deep(.ant-transfer-list) {
width: 39.5%;
2022-07-19 15:06:26 +08:00
height: 5.2rem;
2022-07-16 15:25:49 +08:00
}
:deep(.ant-transfer-operation) {
flex-direction: row-reverse;
2022-07-19 15:06:26 +08:00
margin: 0 0.3rem;
2022-07-16 15:25:49 +08:00
}
:deep(.ant-btn) {
2022-07-19 15:06:26 +08:00
width: 0.56rem;
height: 0.4rem;
border-radius: 0.04rem;
2022-07-16 15:25:49 +08:00
}
:deep(.ant-btn:first-child) {
2022-07-19 15:06:26 +08:00
margin-left: 0.04rem;
2022-07-16 15:25:49 +08:00
}
:deep(.ant-modal-footer) {
border: 0;
}
:deep(.ant-modal-header) {
border: 0;
}
:deep(.ant-modal-title) {
2022-07-19 15:06:26 +08:00
line-height: 0.24rem;
font-size: 0.18rem;
2022-07-16 15:25:49 +08:00
color: #303133;
}
:deep(.ant-transfer-list-header) {
background: #f5f7fa;
}
:deep(.ant-transfer-list-header-selected) {
2022-07-04 17:15:45 +08:00
display: flex;
2022-07-16 15:25:49 +08:00
width: 90%;
flex-direction: row-reverse;
justify-content: space-between;
2022-07-04 17:15:45 +08:00
align-items: center;
2022-07-16 15:25:49 +08:00
}
:deep(.ant-transfer-list-header-title) {
2022-07-19 15:06:26 +08:00
font-size: 0.16rem;
2022-07-16 15:25:49 +08:00
color: #303133;
font-weight: 400;
text-align: left;
}
2022-07-16 15:04:25 +08:00
:deep(.ant-transfer-list-header .ant-checkbox-wrapper) {
display: none !important;
}
2022-07-18 11:24:57 +08:00
:deep(.ant-upload-list-item-name) {
2022-07-19 15:06:26 +08:00
width: 1rem;
}
.del {
display: flex;
justify-content: flex-start;
align-items: center;
font-size: 0.14rem;
margin-left: 0.2rem;
.delImg {
cursor: pointer;
display: inline-block;
width: 0.16rem;
height: 0.18rem;
background: url(~@/assets/home/sf_del.png) no-repeat;
margin-right: 0.05rem;
}
div {
cursor: pointer;
}
2022-07-18 11:24:57 +08:00
}
2022-06-19 10:22:39 +08:00
</style>