2022-11-21 10:51:54 +08:00
|
|
|
|
<!--
|
|
|
|
|
* @Author: Light
|
|
|
|
|
* @Date: 2022-11-18 11:53:43
|
|
|
|
|
* @LastEditors: Light
|
2022-11-22 10:57:30 +08:00
|
|
|
|
* @LastEditTime: 2022-11-22 10:54:46
|
2022-11-21 10:51:54 +08:00
|
|
|
|
* @Description: 告诉大家这是什么
|
|
|
|
|
-->
|
|
|
|
|
<template>
|
|
|
|
|
<div class="infrastructureApplication">
|
|
|
|
|
<div class="top">
|
|
|
|
|
<a-list size="small" bordered :data-source="dataList.toBeApplied">
|
|
|
|
|
<template #renderItem="{ item }">
|
|
|
|
|
<a-list-item>
|
|
|
|
|
<div class="name">
|
|
|
|
|
<a-tooltip>
|
|
|
|
|
<template #title>{{ item.channelName }}</template>
|
|
|
|
|
{{ item.channelName }}
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
</div>
|
2022-11-21 18:46:38 +08:00
|
|
|
|
<a-popconfirm
|
|
|
|
|
:title="'是否移出' + item.channelName + '?'"
|
|
|
|
|
ok-text="是"
|
|
|
|
|
cancel-text="否"
|
|
|
|
|
@confirm="delWillApplyCamera(item.id)"
|
|
|
|
|
>
|
|
|
|
|
<a-button type="link" danger>移出</a-button>
|
|
|
|
|
</a-popconfirm>
|
2022-11-21 10:51:54 +08:00
|
|
|
|
</a-list-item>
|
|
|
|
|
</template>
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="title">待申请列表</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #footer>
|
2022-11-21 18:46:38 +08:00
|
|
|
|
<a-button type="primary" @click="apply">一键申请</a-button>
|
2022-11-21 10:51:54 +08:00
|
|
|
|
</template>
|
|
|
|
|
</a-list>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="bottom">
|
2022-11-21 18:46:38 +08:00
|
|
|
|
<a-list size="small" bordered :data-source="dataList.requested">
|
2022-11-21 10:51:54 +08:00
|
|
|
|
<template #renderItem="{ item }">
|
|
|
|
|
<a-list-item>
|
|
|
|
|
<div class="name">
|
|
|
|
|
<a-tooltip>
|
2022-11-21 18:46:38 +08:00
|
|
|
|
<template #title>{{ item.cameraInfo.channelName }}</template>
|
|
|
|
|
{{ item.cameraInfo.channelName }}
|
2022-11-21 10:51:54 +08:00
|
|
|
|
</a-tooltip>
|
|
|
|
|
</div>
|
2022-11-21 18:46:38 +08:00
|
|
|
|
<a-popconfirm
|
|
|
|
|
v-if="item.approveStatus == '通过'"
|
|
|
|
|
:title="'是否删除' + item.cameraInfo.channelName + '?'"
|
|
|
|
|
ok-text="是"
|
|
|
|
|
cancel-text="否"
|
|
|
|
|
@confirm="deleteApply(item)"
|
|
|
|
|
>
|
|
|
|
|
<a-button type="link" danger>删除</a-button>
|
|
|
|
|
</a-popconfirm>
|
|
|
|
|
<a-button v-else type="link" danger @click="deleteApply(item)">
|
|
|
|
|
删除
|
|
|
|
|
</a-button>
|
2022-11-21 10:51:54 +08:00
|
|
|
|
</a-list-item>
|
|
|
|
|
</template>
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="title">已申请列表</div>
|
|
|
|
|
</template>
|
|
|
|
|
</a-list>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-11-21 18:46:38 +08:00
|
|
|
|
<a-modal
|
|
|
|
|
:width="800"
|
|
|
|
|
v-model:visible="visible"
|
|
|
|
|
title="删除申请"
|
|
|
|
|
@ok="handleOk"
|
|
|
|
|
@cancel="clear"
|
|
|
|
|
>
|
|
|
|
|
<p>本次申请的摄像头包含以下{{ showArr.length }}个摄像头,是否删除申请?</p>
|
|
|
|
|
<a-table :columns="columns" :data-source="showArr">
|
|
|
|
|
<template #bodyCell="{ column, text }">
|
|
|
|
|
<template v-if="column.dataIndex === 'name'">
|
|
|
|
|
<a>{{ text }}</a>
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
</a-table>
|
|
|
|
|
</a-modal>
|
2022-11-21 10:51:54 +08:00
|
|
|
|
</template>
|
|
|
|
|
<script setup>
|
|
|
|
|
import {
|
|
|
|
|
willApplyCameraSelect,
|
|
|
|
|
willApplyCameraBatchInsert,
|
|
|
|
|
willApplyCameraBatchDelete,
|
2022-11-21 18:46:38 +08:00
|
|
|
|
getApplyCameraListXha,
|
|
|
|
|
delApplyCamera,
|
2022-11-21 10:51:54 +08:00
|
|
|
|
} from '@/api/home'
|
2022-11-21 18:46:38 +08:00
|
|
|
|
import { endProcess } from '@/api/personalCenter.js'
|
2022-11-21 10:51:54 +08:00
|
|
|
|
import { onBeforeUnmount, reactive, ref } from 'vue'
|
|
|
|
|
import { message } from 'ant-design-vue'
|
|
|
|
|
import mybus from '@/myplugins/mybus'
|
2022-11-21 18:46:38 +08:00
|
|
|
|
import { useRouter } from 'vue-router'
|
2022-11-21 10:51:54 +08:00
|
|
|
|
const dataList = reactive({ toBeApplied: [], requested: [] })
|
|
|
|
|
// 待办
|
|
|
|
|
const addWacFlag = ref(true)
|
|
|
|
|
const delWacFlag = ref(true)
|
2022-11-21 18:46:38 +08:00
|
|
|
|
const delApply = ref(true)
|
|
|
|
|
const visible = ref(false)
|
|
|
|
|
const instanceId = ref('')
|
|
|
|
|
const showArr = ref({})
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
|
|
|
|
title: '名称',
|
|
|
|
|
dataIndex: 'channelName',
|
|
|
|
|
key: 'channelName',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '地址',
|
|
|
|
|
dataIndex: 'managementUnitName',
|
|
|
|
|
key: 'managementUnitName',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '类型',
|
|
|
|
|
dataIndex: 'cameraPointTypeName',
|
|
|
|
|
key: 'cameraPointTypeName',
|
|
|
|
|
ellipsis: true,
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
const router = useRouter()
|
2022-11-21 10:51:54 +08:00
|
|
|
|
const delWillApplyCamera = (id) => {
|
|
|
|
|
console.log('删除===>', id)
|
|
|
|
|
if (delWacFlag.value) {
|
|
|
|
|
delWacFlag.value = false
|
|
|
|
|
willApplyCameraBatchDelete([id]).then((res) => {
|
|
|
|
|
if (res.data.code == 0) {
|
|
|
|
|
message.success('移出成功')
|
|
|
|
|
} else {
|
|
|
|
|
message.warning('移出失败')
|
|
|
|
|
}
|
|
|
|
|
init()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-11-21 18:46:38 +08:00
|
|
|
|
const apply = () => {
|
|
|
|
|
let obj = {
|
|
|
|
|
arr: [
|
|
|
|
|
{
|
|
|
|
|
checked: true,
|
|
|
|
|
delFlag: 0,
|
|
|
|
|
id: '1593084734789996545',
|
|
|
|
|
idtCameraChannel: '790582098133127168',
|
|
|
|
|
loading: false,
|
|
|
|
|
note1: '',
|
|
|
|
|
resourceId: '1522550195055828996',
|
|
|
|
|
resourceName: '摄像头列表',
|
|
|
|
|
type: '基础设施',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
deptName: '西海岸新区工业和信息化局',
|
|
|
|
|
deptId: '732560225344761856',
|
|
|
|
|
}
|
|
|
|
|
dataList.toBeApplied.map((val) => {
|
|
|
|
|
val.type = '基础设施'
|
|
|
|
|
val.delFlag = 0
|
|
|
|
|
val.resourceId = val.channelId
|
|
|
|
|
val.resourceName = val.channelName
|
|
|
|
|
// obj.arr.push(val)
|
|
|
|
|
})
|
|
|
|
|
obj.arr[0].note1 = JSON.stringify(dataList.toBeApplied)
|
|
|
|
|
if (obj.arr.length > 0) {
|
|
|
|
|
console.log('一键申请===================>', obj)
|
|
|
|
|
localStorage.setItem('applyList', JSON.stringify([obj]))
|
|
|
|
|
router.push({
|
|
|
|
|
path: '/apply',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 删除已申请
|
|
|
|
|
const deleteApply = (item) => {
|
|
|
|
|
console.log('删除========>', item)
|
|
|
|
|
if (delApply.value) {
|
|
|
|
|
delApply.value = false
|
|
|
|
|
switch (item.approveStatus) {
|
|
|
|
|
case '审核中':
|
|
|
|
|
visible.value = true
|
|
|
|
|
instanceId.value = item.instanceId
|
|
|
|
|
showArr.value = []
|
|
|
|
|
dataList.requested.map((val) => {
|
|
|
|
|
if (val.instanceId == item.instanceId) {
|
|
|
|
|
showArr.value.push(val.cameraInfo)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
break
|
|
|
|
|
case '通过':
|
|
|
|
|
delApplyCamera([item.id]).then((res) => {
|
|
|
|
|
if (res.data.code == 0) {
|
|
|
|
|
message.success('删除成功')
|
|
|
|
|
} else {
|
|
|
|
|
message.warning('删除失败')
|
|
|
|
|
}
|
|
|
|
|
initApply()
|
|
|
|
|
})
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const handleOk = () => {
|
|
|
|
|
endProcess({ instanceId: instanceId.value }).then((res) => {
|
|
|
|
|
if (res.data.code == 0) {
|
|
|
|
|
message.success('删除成功')
|
|
|
|
|
} else {
|
|
|
|
|
message.warning('删除失败')
|
|
|
|
|
}
|
|
|
|
|
initApply()
|
|
|
|
|
visible.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const clear = () => {
|
|
|
|
|
instanceId.value = ''
|
|
|
|
|
showArr.value = []
|
|
|
|
|
visible.value = false
|
|
|
|
|
delApply.value = true
|
|
|
|
|
}
|
2022-11-21 10:51:54 +08:00
|
|
|
|
const init = () => {
|
|
|
|
|
willApplyCameraSelect().then((res) => {
|
|
|
|
|
if (res.data.code == 0) {
|
|
|
|
|
dataList.toBeApplied = res.data.data
|
|
|
|
|
delWacFlag.value = true
|
|
|
|
|
addWacFlag.value = true
|
|
|
|
|
} else {
|
|
|
|
|
message.warning('查询失败')
|
|
|
|
|
dataList.toBeApplied = []
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-11-21 18:46:38 +08:00
|
|
|
|
const initApply = () => {
|
|
|
|
|
getApplyCameraListXha().then((res) => {
|
|
|
|
|
if (res.data.code == 0) {
|
|
|
|
|
res.data.data.map((val) => {
|
|
|
|
|
val.cameraInfo = JSON.parse(val.cameraInfo)
|
|
|
|
|
})
|
|
|
|
|
dataList.requested = res.data.data
|
|
|
|
|
delApply.value = true
|
|
|
|
|
} else {
|
|
|
|
|
message.warning('查询失败')
|
|
|
|
|
dataList.requested = []
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-11-21 10:51:54 +08:00
|
|
|
|
init()
|
2022-11-21 18:46:38 +08:00
|
|
|
|
initApply()
|
2022-11-21 10:51:54 +08:00
|
|
|
|
mybus.on('selectCamera', (obj) => {
|
|
|
|
|
// 判断最多10条
|
2022-11-21 18:46:38 +08:00
|
|
|
|
if (dataList.toBeApplied.length + dataList.requested.length >= 10) {
|
2022-11-21 10:51:54 +08:00
|
|
|
|
message.warning('最多只能申请10个摄像头!')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// 判断是否已操作
|
|
|
|
|
let addFlag = true
|
|
|
|
|
dataList.toBeApplied.map((val) => {
|
|
|
|
|
if (addFlag && val.channelId == obj.channelId) {
|
|
|
|
|
addFlag = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
dataList.requested.map((val) => {
|
2022-11-22 10:57:30 +08:00
|
|
|
|
console.log('111', val, addFlag)
|
|
|
|
|
if (addFlag && val.cameraInfo.channelId == obj.channelId) {
|
2022-11-21 10:51:54 +08:00
|
|
|
|
addFlag = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (addWacFlag.value) {
|
|
|
|
|
if (addFlag) {
|
|
|
|
|
addWacFlag.value = false
|
|
|
|
|
willApplyCameraBatchInsert([obj]).then((res) => {
|
|
|
|
|
if (res.data.code == 0) {
|
|
|
|
|
message.success('移入成功')
|
|
|
|
|
} else {
|
|
|
|
|
message.warning('移入失败')
|
|
|
|
|
}
|
|
|
|
|
init()
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
message.warning('已申请该摄像头!')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
|
mybus.off('selectCamera')
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.infrastructureApplication {
|
|
|
|
|
background: #fff;
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 50%;
|
|
|
|
|
right: 0.16rem;
|
|
|
|
|
margin-top: -3.5rem;
|
|
|
|
|
.bottom {
|
|
|
|
|
margin-top: 32px;
|
|
|
|
|
}
|
|
|
|
|
.title {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
.name {
|
|
|
|
|
width: 150px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
-webkit-line-clamp: 1;
|
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
|
word-break: break-all;
|
|
|
|
|
}
|
|
|
|
|
:deep(.ant-list-footer) {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
}
|
|
|
|
|
:deep(.ant-list-items) {
|
2022-11-21 18:46:38 +08:00
|
|
|
|
width: 2.5rem;
|
2022-11-21 10:51:54 +08:00
|
|
|
|
height: 2.45rem;
|
|
|
|
|
overflow-y: scroll;
|
|
|
|
|
}
|
|
|
|
|
:deep(.ant-spin-nested-loading) {
|
2022-11-21 18:46:38 +08:00
|
|
|
|
width: 2.5rem;
|
2022-11-21 10:51:54 +08:00
|
|
|
|
height: 2.45rem;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|