hi-ucs/front/src/views/detailsAll/components/Developer/DeveloperOwningDepartmentAn...

305 lines
9.0 KiB
Vue
Raw Normal View History

2022-06-20 18:34:31 +08:00
<!--使用方式-->
<template>
2022-07-15 11:03:21 +08:00
<div class="application-deployment-and-security" v-if="true">
2022-06-20 18:34:31 +08:00
<div class="title">
<DetalsTitle
:title="dataFrom.title"
:type="dataFrom.englishTitle"
></DetalsTitle>
</div>
<div class="content">
<div class="content-card">
<div class="left">
<p>{{ dataFrom.linkName }}</p>
<a-tooltip>
<template #title>{{ dataFrom.link }}</template>
<p>{{ dataFrom.link }}</p>
</a-tooltip>
</div>
<div class="right">
<div @click="technical()">技术文档</div>
2022-06-21 11:33:12 +08:00
<div @click="technicaltow()">新手指引</div>
2022-06-20 18:34:31 +08:00
</div>
</div>
<div class="content-card">
<div v-for="(item, index) in dataFrom.content" :key="index">
2022-07-01 19:32:48 +08:00
<div class="card-title">
{{ item.childrenTitle }}
</div>
2022-06-20 18:34:31 +08:00
<div class="card-content">
<div v-for="carditem in item.childrenContent" :key="carditem">
<div>
<span>{{ carditem.attrType }}</span>
<a-tooltip>
<template #title>{{ carditem.attrValue }}</template>
<span>{{ carditem.attrValue }}</span>
</a-tooltip>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import DetalsTitle from '@/views/detailsAll/components/DetalsTitle'
import { ref, defineProps, watch } from 'vue'
import { pinyin } from 'pinyin-pro'
let flag = ref(true)
let dataFrom = ref({
title: '使用方式',
englishTitle: 'USAGE',
linkName: '组件地址',
link: '',
content: [
{
childrenTitle: '归属部门',
childrenContent: [
{
2022-07-06 11:58:13 +08:00
attrType: '归属部门名称',
2022-06-20 18:34:31 +08:00
attrValue: '------',
},
{
2022-07-06 11:58:13 +08:00
attrType: '部门联系人',
2022-06-20 18:34:31 +08:00
attrValue: '------',
},
2022-07-01 19:32:48 +08:00
{
2022-07-06 11:58:13 +08:00
attrType: '联系人电话',
2022-07-01 19:32:48 +08:00
attrValue: '------',
},
2022-06-20 18:34:31 +08:00
],
},
{
childrenTitle: '服务商信息',
childrenContent: [
{
2022-07-06 11:58:13 +08:00
attrType: '服务商名称',
2022-06-20 18:34:31 +08:00
attrValue: '------',
},
{
2022-07-06 11:58:13 +08:00
attrType: '服务商联系人',
2022-06-20 18:34:31 +08:00
attrValue: '------',
},
2022-07-01 19:32:48 +08:00
{
2022-07-06 11:58:13 +08:00
attrType: '联系人电话',
2022-07-01 19:32:48 +08:00
attrValue: '------',
},
2022-06-20 18:34:31 +08:00
],
},
],
})
console.log(dataFrom.value)
//数据初始化
const props = defineProps({
dataList: { type: Object, default: null },
})
if (props.dataList.infoList) {
let obj = props.dataList.infoList.filter(
(item) => item.attrType === '组件地址'
)[0]
2022-07-18 16:29:49 +08:00
dataFrom.value.content[0].childrenContent[1].attrValue =
props.dataList.deptContacts || '--'
dataFrom.value.content[0].childrenContent[2].attrValue =
props.dataList.deptPhone || '--'
dataFrom.value.content[0].childrenContent[0].attrValue =
props.dataList.deptName || '--'
props.dataList.infoList.map((item) => {
if (item.attrType == '组件地址') {
dataFrom.value.link = item.attrValue || '暂无数据'
} else if (item.attrType == '服务商联系人') {
dataFrom.value.content[1].childrenContent[1].attrValue =
item.attrValue || '--'
} else if (item.attrType == '服务商联系电话') {
dataFrom.value.content[1].childrenContent[2].attrValue =
item.attrValue || '--'
} else if (item.attrType == '服务商' || item.attrType == '服务商名') {
dataFrom.value.content[1].childrenContent[0].attrValue =
item.attrValue || '--'
}
})
if (dataFrom.value.link === '') {
dataFrom.value.link = '暂无数据'
2022-06-20 18:34:31 +08:00
}
}
console.log('obj', dataFrom.value)
//技术文档
function technical() {
// 拼接路径
2022-07-01 18:23:43 +08:00
// const type = pinyin(props.dataList.type, {
// pattern: 'initial',
// }).replace(/\s*/g, '')
// // 打开文档
// const id = props.dataList.id
// window.open(window.SITE_CONFIG.frontUrl + type + '/' + id + '.md', '_blank')
2022-06-20 18:34:31 +08:00
// console.log('dataFrom.value.link', dataFrom.value.link)
2022-07-01 18:23:43 +08:00
let obj = props.dataList.infoList.filter(
(item) => item.attrType === '技术文档'
)[0]
console.log('dataFrom.value.link', obj.attrValue)
window.open(
2022-07-14 14:55:49 +08:00
window.SITE_CONFIG.frontUrl +
2022-07-01 18:23:43 +08:00
'hisense_office/onlinePreview?url=' +
btoa(encodeURI(obj.attrValue))
)
2022-06-20 18:34:31 +08:00
}
2022-06-21 11:33:12 +08:00
function technicaltow() {
let obj = props.dataList.infoList.filter(
(item) => item.attrType === '使用手册'
)[0]
console.log('dataFrom.value.link', obj.attrValue)
window.open(
window.SITE_CONFIG.previewUrl +
'hisense_office/onlinePreview?url=' +
btoa(encodeURI(obj.attrValue))
)
}
2022-06-20 18:34:31 +08:00
watch(
() => props.dataList,
(val) => {
if (val) {
let obj = val.infoList.filter((item) => item.attrType === '组件地址')[0]
2022-07-18 16:29:49 +08:00
dataFrom.value.content[0].childrenContent[1].attrValue =
props.dataList.deptContacts || '--'
dataFrom.value.content[0].childrenContent[2].attrValue =
props.dataList.deptPhone || '--'
dataFrom.value.content[0].childrenContent[0].attrValue =
props.dataList.deptName || '--'
props.dataList.infoList.map((item) => {
if (item.attrType == '组件地址') {
dataFrom.value.link = item.attrValue || '暂无数据'
} else if (item.attrType == '服务商联系人') {
dataFrom.value.content[1].childrenContent[1].attrValue =
item.attrValue || '--'
} else if (item.attrType == '服务商联系电话') {
dataFrom.value.content[1].childrenContent[2].attrValue =
item.attrValue || '--'
} else if (item.attrType == '服务商' || item.attrType == '服务商名') {
dataFrom.value.content[1].childrenContent[0].attrValue =
item.attrValue || '--'
}
})
if (dataFrom.value.link === '') {
dataFrom.value.link = '暂无数据'
2022-06-20 18:34:31 +08:00
}
}
}
)
</script>
<style lang="less" scoped>
.application-deployment-and-security {
padding: 0.8rem 0;
display: flex;
flex-direction: column;
align-items: center;
.title {
margin-bottom: 0.3rem;
}
.content {
display: flex;
2022-07-15 16:06:36 +08:00
width: 14rem;
2022-06-20 18:34:31 +08:00
justify-content: space-between;
.content-card {
2022-07-01 19:32:48 +08:00
height: 1.8rem;
2022-07-15 16:06:36 +08:00
width: 6.6rem;
2022-06-20 18:34:31 +08:00
border-radius: 0.2rem;
background: linear-gradient(
to right,
rgba(113, 132, 252, 0.4),
rgba(148, 163, 252, 0.4)
);
padding: 0 0.3rem;
display: flex;
align-items: center;
& > div {
width: 3.1rem;
padding-left: 0.3rem;
}
& > div:first-child {
padding-left: 0;
border-right: 0.01rem solid #b0b9f1;
}
.card-title {
font-size: 0.26rem;
color: #212956;
margin-bottom: 0.2rem;
line-height: 0.26rem;
}
.card-content {
white-space: nowrap;
div {
2022-07-01 19:32:48 +08:00
display: block;
2022-06-20 18:34:31 +08:00
margin-right: 0.2rem;
color: rgba(33, 41, 86, 0.8);
font-size: 0.2rem;
max-width: 2.8rem;
div {
max-width: 2.8rem;
2022-07-19 16:43:49 +08:00
display: flex;
2022-07-15 16:06:36 +08:00
// overflow: hidden;
// text-overflow: ellipsis;
// display: -webkit-box;
// -webkit-box-orient: vertical;
// -webkit-line-clamp: 1;
& > span:last-child {
display: inline-block;
2022-07-18 16:29:49 +08:00
width: 1.49rem;
2022-07-15 16:06:36 +08:00
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
2022-07-19 09:42:41 +08:00
word-break: break-all;
2022-07-15 16:06:36 +08:00
}
2022-06-20 18:34:31 +08:00
}
}
}
}
.content-card:first-child {
position: relative;
.left {
border: 0;
p:first-child {
font-size: 0.26rem;
color: #212956;
margin-bottom: 0.2rem;
line-height: 0.26rem;
}
p:last-child {
font-size: 0.2rem;
color: #212956;
line-height: 0.26rem;
max-width: 4.5rem;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
2022-07-19 09:42:41 +08:00
word-break: break-all;
2022-06-20 18:34:31 +08:00
}
}
.right {
position: absolute;
right: 0.6rem;
top: 50%;
width: 1.28rem;
margin-top: -0.45rem;
cursor: pointer;
& > div {
width: 1.28rem;
height: 0.4rem;
background: #ffffff;
border-radius: 0.2rem;
font-size: 0.2rem;
color: #526aff;
text-align: center;
line-height: 0.4rem;
}
& > div:first-child {
margin-bottom: 0.2rem;
}
}
}
}
}
</style>