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

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">
{{
val.description ||
(val.note1 &&
JSON.parse(val.note1)[0].channelName +
((val.note1 || '') &&
( JSON.parse(val.note1)[0].channelName || '--') +
'等' +
JSON.parse(val.note1).length +
'个摄像头') ||

View File

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

View File

@ -588,10 +588,38 @@ export default {
}
// --
//
const handleAKeyApplication = (item ) => {
let _applyList = []
; (item.fuseResourceList || []).map((v) => {
let _applyList = [];
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 || {}
console.log('resource------------>', resource);
let obj = {
arr: [
{
@ -608,13 +636,40 @@ export default {
}
_applyList.push(obj)
})
_applyList = jcss.concat(_applyList)
localStorage.setItem('applyList', JSON.stringify(_applyList))
router.push({
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) => {
console.log('typeObj------------>', typeObj)
if (!typeObj) {

View File

@ -23,13 +23,14 @@
<div class="desc">描述{{ detailInfoObj.description || '--' }}</div>
</div>
<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>
<form-outlined />
</template>
申请使用
</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>
<form-outlined />
</template>
@ -67,6 +68,7 @@ import packageAbilityList from '@/views/home/components/packageAbilityList.vue'
import { message } from 'ant-design-vue'
import { getIntegrationDetail } from '@/api/home'
import HomeHeader from '@/views/home/components/header'
import { scInsert, scDel } from '@/api/personalCenter'
const router = useRouter()
const id = router.currentRoute.value.query.id
@ -102,6 +104,8 @@ const getIntegrationServicesDeatil = (id) => {
return message.error(res.data.msg)
}
detailInfoObj.value = res.data.data || {}
console.log('detailInfoObj------------>', detailInfoObj);
let fuseResourceList = detailInfoObj.value.fuseResourceList || []
abilityList.value.map(v => {
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)
@ -239,4 +341,5 @@ getIntegrationServicesDeatil(id)
.list-box {
padding: 0.4rem;
}
</style>