融合服务,一键申请--基础设施更改

This commit is contained in:
guoyue 2022-08-01 16:16:16 +08:00
parent 1d5a81d091
commit 1ccd81cd66
4 changed files with 799 additions and 715 deletions

View File

@ -49,8 +49,8 @@
<div class="description"> <div class="description">
{{ {{
val.description || val.description ||
(val.note1 && ((val.note1 || '') &&
JSON.parse(val.note1)[0].channelName + ( JSON.parse(val.note1)[0].channelName || '--') +
'等' + '等' +
JSON.parse(val.note1).length + JSON.parse(val.note1).length +
'个摄像头') || '个摄像头') ||

View File

@ -11,150 +11,61 @@
</div> </div>
<div class="form-container"> <div class="form-container">
<div v-if="applySuccess"> <div v-if="applySuccess">
<a-form <a-form ref="formRef" :model="formName" name="basic" :label-col="{ style: { width: '106px' } }"
ref="formRef" :wrapper-col="{ style: { width: '230px' } }" labelAlign="left" autocomplete="off">
:model="formName"
name="basic"
:label-col="{ style: { width: '106px' } }"
:wrapper-col="{ style: { width: '230px' } }"
labelAlign="left"
autocomplete="off"
>
<div class="base-info"> <div class="base-info">
<a-form-item <a-form-item label="申请标题" name="title" :rules="[{ required: true, message: '请输入申请标题' }]">
label="申请标题" <a-input placeholder="请输入能力申请标题" v-model:value="formName.title" />
name="title"
:rules="[{ required: true, message: '请输入申请标题' }]"
>
<a-input
placeholder="请输入能力申请标题"
v-model:value="formName.title"
/>
</a-form-item> </a-form-item>
</div> </div>
<div class="base-info"> <div class="base-info">
<a-form-item <a-form-item label="申请人信息" name="user" :rules="[{ required: true, message: '请输入申请人' }]">
label="申请人信息" <a-input placeholder="请输入申请人" v-model:value="formName.user" disabled />
name="user"
:rules="[{ required: true, message: '请输入申请人' }]"
>
<a-input
placeholder="请输入申请人"
v-model:value="formName.user"
disabled
/>
</a-form-item> </a-form-item>
<a-form-item <a-form-item style="margin: 0 22px" label="电话" name="phone" :rules="[
style="margin: 0 22px"
label="电话"
name="phone"
:rules="[
{ {
required: true, required: true,
pattern: /^1[3456789]\d{9}$/, pattern: /^1[3456789]\d{9}$/,
message: '请输入正确的电话号码', message: '请输入正确的电话号码',
}, },
]" ]">
> <a-input placeholder="请输入申请人电话" v-model:value="formName.phone" />
<a-input
placeholder="请输入申请人电话"
v-model:value="formName.phone"
/>
</a-form-item> </a-form-item>
<a-form-item <a-form-item label="单位" name="unit" :rules="[{ required: true, message: '请输入单位' }]">
label="单位" <a-input placeholder="请输入单位" v-model:value="formName.unit" disabled />
name="unit"
:rules="[{ required: true, message: '请输入单位' }]"
>
<a-input
placeholder="请输入单位"
v-model:value="formName.unit"
disabled
/>
</a-form-item> </a-form-item>
</div> </div>
<div class="base-info" v-if="flag"> <div class="base-info" v-if="flag">
<a-form-item <a-form-item label="应用系统" name="applicationSystem" :rules="[{ required: true, message: '请选择应用系统' }]">
label="应用系统" <a-select v-model:value="formName.applicationSystem" show-search placeholder="请输入关键字"
name="applicationSystem" style="width: 200px" :options="systemOptions" @focus="handleFocus" @blur="handleBlur"
:rules="[{ required: true, message: '请选择应用系统' }]" @change="systemHandleChange" @search="systemHandleSearch"></a-select>
>
<a-select
v-model:value="formName.applicationSystem"
show-search
placeholder="请输入关键字"
style="width: 200px"
:options="systemOptions"
@focus="handleFocus"
@blur="handleBlur"
@change="systemHandleChange"
@search="systemHandleSearch"
></a-select>
</a-form-item> </a-form-item>
<a-form-item <a-form-item class="applicationScene" label="应用领域" name="applicationScene"
class="applicationScene" :rules="[{ required: true, message: '请选择应用领域' }]" style="width: 6.93rem">
label="应用领域" <a-select v-model:value="formName.applicationScene" :options="applicationSceneOpthion" mode="tags"
name="applicationScene" :size="size" placeholder="请选择应用领域" :filterOption="false" :searchValue="false"
:rules="[{ required: true, message: '请选择应用领域' }]" style="width: 5.87rem"></a-select>
style="width: 6.93rem"
>
<a-select
v-model:value="formName.applicationScene"
:options="applicationSceneOpthion"
mode="tags"
:size="size"
placeholder="请选择应用领域"
:filterOption="false"
:searchValue="false"
style="width: 5.87rem"
></a-select>
</a-form-item> </a-form-item>
</div> </div>
<div> <div>
<a-form-item <a-form-item label="应用背景" name="applicationBackground"
label="应用背景" :rules="[{ required: true, message: '请输入应用背景' }]">
name="applicationBackground" <a-textarea placeholder="请输入应用背景" v-model:value="formName.applicationBackground" :rows="4" />
:rules="[{ required: true, message: '请输入应用背景' }]"
>
<a-textarea
placeholder="请输入应用背景"
v-model:value="formName.applicationBackground"
:rows="4"
/>
</a-form-item> </a-form-item>
</div> </div>
<div> <div>
<a-form-item <a-form-item label="期望效果" name="effectWish" :rules="[{ required: true, message: '请输入期望效果' }]">
label="期望效果" <a-textarea placeholder="请输入期望效果" v-model:value="formName.effectWish" :rows="4" />
name="effectWish"
:rules="[{ required: true, message: '请输入期望效果' }]"
>
<a-textarea
placeholder="请输入期望效果"
v-model:value="formName.effectWish"
:rows="4"
/>
</a-form-item> </a-form-item>
</div> </div>
<a-form-item <a-form-item style="color: #666; font-size: 16px" label="申请单附件" name="applyDoc">
style="color: #666; font-size: 16px" <a-upload v-model:file-list="fileList" name="file" :action="`${baseURL}/upload`" :headers="headers"
label="申请单附件" @change="handleChange" :before-upload="beforeUpload" :maxCount="1">
name="applyDoc" <a-button style="
>
<a-upload
v-model:file-list="fileList"
name="file"
:action="`${baseURL}/upload`"
:headers="headers"
@change="handleChange"
:before-upload="beforeUpload"
:maxCount="1"
>
<a-button
style="
width: 100px; width: 100px;
height: 30px; height: 30px;
margin-right: 10px; margin-right: 10px;
@ -165,8 +76,7 @@
border: 1px solid #bbd3ef; border: 1px solid #bbd3ef;
padding: 0; padding: 0;
text-align: center; text-align: center;
" ">
>
<upload-outlined></upload-outlined> <upload-outlined></upload-outlined>
文件上传 文件上传
</a-button> </a-button>
@ -181,8 +91,7 @@
</a-form-item> </a-form-item>
<div class="bottom-btn"> <div class="bottom-btn">
<a-button <a-button style="
style="
width: 80px; width: 80px;
height: 38px; height: 38px;
margin-right: 20px; margin-right: 20px;
@ -193,15 +102,10 @@
border: none; border: none;
padding: 0; padding: 0;
text-align: center; text-align: center;
" " type="primary" html-type="cancle" @click="resetFields()">
type="primary"
html-type="cancle"
@click="resetFields()"
>
退出申请 退出申请
</a-button> </a-button>
<a-button <a-button style="
style="
width: 80px; width: 80px;
height: 38px; height: 38px;
background: #0087ff; background: #0087ff;
@ -211,11 +115,7 @@
border: none; border: none;
padding: 0; padding: 0;
text-align: center; text-align: center;
" " type="primary" html-type="submit" @click="processStartHandle()">
type="primary"
html-type="submit"
@click="processStartHandle()"
>
提交申请 提交申请
</a-button> </a-button>
</div> </div>
@ -275,6 +175,8 @@
const disabled = ref(false) const disabled = ref(false)
const flag = ref(false) const flag = ref(false)
const list = ref(JSON.parse(localStorage.getItem('applyList'))) const list = ref(JSON.parse(localStorage.getItem('applyList')))
console.log('router.currentRoute.value.query------------>', router.currentRoute.value.query);
const applyAll = router.currentRoute.value.query.applyAll const applyAll = router.currentRoute.value.query.applyAll
const num = ref(0) const num = ref(0)
if (!applyAll) { if (!applyAll) {
@ -297,26 +199,36 @@
} }
}) })
} }
console.log( console.log('list.value------------>', list.value);
'list',
list.value
// list.value[0].children.filter(
// (val) => val.id == list.value[0].checkedList[0]
// )[0].resourceName
)
const baseURL = window.SITE_CONFIG.apiURL const baseURL = window.SITE_CONFIG.apiURL
let record = ref('1') let record = ref('1')
const text = ref('') const text = ref('')
let _title = ''
if (list.value[0]) {
if (applyAll) {
_title = '全部应用资源申请'
} else {
if (list.value[0].children) {
let _children = list.value[0].children || []
let _checkedList = _children.filter((val) => val.id == list.value[0].checkedList[0]) || []
_title = (_checkedList[0].resourceName || '').concat(num.value > 1 ? '等能力申请' + num.value + '个' : '能力申请')
} else {
_title = (list.value[0].arr && list.value[0].arr[0].resourceName || '').concat('能力申请')
}
}
}
const formName = reactive({ const formName = reactive({
title: applyAll title: _title,
? '全部应用资源申请' // title: applyAll
: list.value[0].children // ? ''
? list.value[0].children // : list.value[0] && list.value[0].children
.filter((val) => val.id == list.value[0].checkedList[0])[0] // ? list.value[0] && list.value[0].children
.resourceName.concat( // .filter((val) => val.id == list.value[0] && list.value[0].checkedList[0])[0]
num.value > 1 ? '等能力申请' + num.value + '个' : '能力申请' // .resourceName.concat(
) // num.value > 1 ? '' + num.value + '' : ''
: list.value[0].arr[0].resourceName.concat('能力申请'), // // )
// : list.value[0] && list.value[0].arr[0].resourceName.concat(''), //
applicationSystem: '', // applicationSystem: '', //
// applicationSystem: [], // // applicationSystem: [], //
applicationScene: [], // applicationScene: [], //
@ -760,6 +672,7 @@
margin: 0.8rem auto 0; margin: 0.8rem auto 0;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
aside { aside {
width: 282px; width: 282px;
height: 96%; height: 96%;
@ -767,6 +680,7 @@
background-color: #fff; background-color: #fff;
margin: 1% 0 3%; margin: 1% 0 3%;
} }
article { article {
width: 1090px; width: 1090px;
height: 99%; height: 99%;
@ -774,8 +688,10 @@
background-color: #fff; background-color: #fff;
margin: 1% auto; margin: 1% auto;
} }
.form-container { .form-container {
padding: 20px 20px 30px 20px; padding: 20px 20px 30px 20px;
.title { .title {
font-size: 20px; font-size: 20px;
color: #000; color: #000;
@ -783,19 +699,23 @@
margin-bottom: 20px; margin-bottom: 20px;
} }
} }
.base-info { .base-info {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
:deep(.ant-form-item-label) { :deep(.ant-form-item-label) {
label { label {
color: #666; color: #666;
font-size: 16px; font-size: 16px;
&::after { &::after {
content: ''; content: '';
} }
} }
} }
:deep(.ant-form-item-required) { :deep(.ant-form-item-required) {
&::before { &::before {
font-size: 8px; font-size: 8px;
@ -807,29 +727,35 @@
border: 1px solid #e0e0e0; border: 1px solid #e0e0e0;
border-radius: 6px; border-radius: 6px;
} }
.success { .success {
div { div {
width: 100px; width: 100px;
margin: 80px auto 40px; margin: 80px auto 40px;
} }
text-align: center; text-align: center;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
color: #000; color: #000;
} }
} }
.applicationScene { .applicationScene {
:deep(.ant-select-selector) { :deep(.ant-select-selector) {
overflow-x: scroll; overflow-x: scroll;
} }
:deep(.ant-select-selection-overflow) { :deep(.ant-select-selection-overflow) {
flex-wrap: nowrap; flex-wrap: nowrap;
} }
} }
textarea { textarea {
resize: none; resize: none;
font-size: 14px; font-size: 14px;
} }
.bottom-btn { .bottom-btn {
display: flex; display: flex;
justify-content: center; justify-content: center;

View File

@ -588,10 +588,38 @@ export default {
} }
// -- // --
//
const handleAKeyApplication = (item ) => { const handleAKeyApplication = (item ) => {
let _applyList = [] let _applyList = [];
; (item.fuseResourceList || []).map((v) => { let fuseResourceList = item.fuseResourceList || []
let jcssArray = fuseResourceList.filter(v => v.type === '基础设施')
let otherArray = fuseResourceList.filter(v => v.type !== '基础设施')
jcssArray = jcssArray.map(v => {
v = Object.assign(v, v.resource)
return v
})
let jcss = [
{
arr: [
{
description: '',
note1: JSON.stringify(jcssArray),
resourceId: '1522550195055828996',
resourceName: '摄像头列表',
type: '基础设施',
},
],
deptId: '',
deptName: '',
},
]
if (infrastructure) {
jcss[0].deptId = infrastructure.deptId
jcss[0].deptName = infrastructure.deptName
}
otherArray.map((v) => {
let resource = v.resource || {} let resource = v.resource || {}
console.log('resource------------>', resource);
let obj = { let obj = {
arr: [ arr: [
{ {
@ -608,13 +636,40 @@ export default {
} }
_applyList.push(obj) _applyList.push(obj)
}) })
_applyList = jcss.concat(_applyList)
localStorage.setItem('applyList', JSON.stringify(_applyList)) localStorage.setItem('applyList', JSON.stringify(_applyList))
router.push({ router.push({
path: '/apply', path: '/apply',
}) })
} }
// const handleAKeyApplication = (item) => {
// let _applyList = []
// ; (item.fuseResourceList || []).map((v) => {
// let resource = v.resource || {}
// let obj = {
// arr: [
// {
// delFlag: resource.delFlag,
// description: resource.description,
// resourceId: resource.id,
// resourceName: resource.name,
// time: resource.createDate,
// type: resource.type,
// },
// ],
// deptId: resource.deptId,
// deptName: resource.deptName,
// }
// _applyList.push(obj)
// })
// localStorage.setItem('applyList', JSON.stringify(_applyList))
// router.push({
// path: '/apply',
// })
// }
mybus.on('chongzhi', (typeObj) => { mybus.on('chongzhi', (typeObj) => {
console.log('typeObj------------>', typeObj) console.log('typeObj------------>', typeObj)
if (!typeObj) { if (!typeObj) {

View File

@ -23,13 +23,14 @@
<div class="desc">描述{{ detailInfoObj.description || '--' }}</div> <div class="desc">描述{{ detailInfoObj.description || '--' }}</div>
</div> </div>
<div class="btn-box"> <div class="btn-box">
<a-button size="big" class="btn-text" type="primary" @click="toView()"> <a-button size="big" class="btn-text" type="primary" @click="handleAKeyApplication()">
<template #icon> <template #icon>
<form-outlined /> <form-outlined />
</template> </template>
申请使用 申请使用
</a-button> </a-button>
<a-button size="big" class="btn-text" type="primary" @click="toView()"> <a-button size="big" class="btn-text" :type="detailInfoObj.isCollect == 'true' ? 'primary' : ''"
@click="addCollect()">
<template #icon> <template #icon>
<form-outlined /> <form-outlined />
</template> </template>
@ -67,6 +68,7 @@ import packageAbilityList from '@/views/home/components/packageAbilityList.vue'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { getIntegrationDetail } from '@/api/home' import { getIntegrationDetail } from '@/api/home'
import HomeHeader from '@/views/home/components/header' import HomeHeader from '@/views/home/components/header'
import { scInsert, scDel } from '@/api/personalCenter'
const router = useRouter() const router = useRouter()
const id = router.currentRoute.value.query.id const id = router.currentRoute.value.query.id
@ -102,6 +104,8 @@ const getIntegrationServicesDeatil = (id) => {
return message.error(res.data.msg) return message.error(res.data.msg)
} }
detailInfoObj.value = res.data.data || {} detailInfoObj.value = res.data.data || {}
console.log('detailInfoObj------------>', detailInfoObj);
let fuseResourceList = detailInfoObj.value.fuseResourceList || [] let fuseResourceList = detailInfoObj.value.fuseResourceList || []
abilityList.value.map(v => { abilityList.value.map(v => {
let list = fuseResourceList.filter(x => x.type == v.name) || []; let list = fuseResourceList.filter(x => x.type == v.name) || [];
@ -116,6 +120,104 @@ const getIntegrationServicesDeatil = (id) => {
} }
) )
} }
//
const handleAKeyApplication = () => {
let _applyList = [];
let fuseResourceList = detailInfoObj.value.fuseResourceList || []
let jcssArray = fuseResourceList.filter(v => v.type === '基础设施')
let otherArray = fuseResourceList.filter(v => v.type !== '基础设施')
jcssArray = jcssArray.map(v => {
v = Object.assign(v, v.resource)
return v
})
let jcss = [
{
arr: [
{
description: '',
note1: JSON.stringify(jcssArray),
resourceId: '1522550195055828996',
resourceName: '摄像头列表',
type: '基础设施',
},
],
deptId: '',
deptName: '',
},
]
if (infrastructure) {
jcss[0].deptId = infrastructure.deptId
jcss[0].deptName = infrastructure.deptName
}
otherArray.map((v) => {
let resource = v.resource || {}
console.log('resource------------>', resource);
let obj = {
arr: [
{
delFlag: resource.delFlag,
description: resource.description,
resourceId: resource.id,
resourceName: resource.name,
time: resource.createDate,
type: resource.type,
},
],
deptId: resource.deptId,
deptName: resource.deptName,
}
_applyList.push(obj)
})
_applyList = jcss.concat(_applyList)
localStorage.setItem('applyList', JSON.stringify(_applyList))
router.push({
path: '/apply',
})
}
const dataPosting = ref(true)
const addCollect = () => {
if (dataPosting.value && detailInfoObj.value.id) {
dataPosting.value = false
if (detailInfoObj.value.isCollect == 'true') {
scDel([detailInfoObj.value.id]).then((res) => {
if (res.data.msg === 'success') {
message.success('取消成功')
detailInfoObj.value.isCollect = 'false'
detailInfoObj.value.collectCount--
dataPosting.value = true
console.log('收藏2===============>', res.data, dataPosting.value)
getIntegrationServicesDeatil(id)
}
})
.catch(err => {
console.log('err------------>', err);
message.success(err)
})
} else {
scInsert([
{
resourceId: detailInfoObj.value.id,
},
]).then((res) => {
if (res.data.msg === 'success') {
message.success('添加收藏成功!')
detailInfoObj.value.isCollect = 'true'
detailInfoObj.value.collectCount++
dataPosting.value = true
console.log('收藏2===============>', res.data, dataPosting.value)
getIntegrationServicesDeatil(id)
}
})
.catch(err => {
console.log('err------------>', err);
message.success(err)
})
}
}
}
getIntegrationServicesDeatil(id) getIntegrationServicesDeatil(id)
@ -239,4 +341,5 @@ getIntegrationServicesDeatil(id)
.list-box { .list-box {
padding: 0.4rem; padding: 0.4rem;
} }
</style> </style>