diff --git a/front/public/static/config/location.js b/front/public/static/config/location.js index 688a983f..b63b09da 100644 --- a/front/public/static/config/location.js +++ b/front/public/static/config/location.js @@ -2,7 +2,7 @@ * @Author: hisense.wuhongjian * @Date: 2020-07-07 16:03:23 * @LastEditors: hisense.liangjunhua - * @LastEditTime: 2022-06-27 14:22:56 + * @LastEditTime: 2022-06-30 11:05:52 * @Description: 数据资源参数配置 */ const newLocation = 'qingdao' @@ -14,6 +14,8 @@ const whoShow = {} const launchedDataNumObject = {} // 导航数据 const navListManagement = {} +// 基础设施 +const infrastructure = {} // 区市站点数据 const mapTestNum = {} // 底部数据 @@ -21,6 +23,8 @@ const footerDataList = {} // qingdao if (newLocation === 'qingdao') { whoShow.itShowQingDao = true + infrastructure.deptName = '青岛市大数据发展管理局' + infrastructure.deptId = '1067246875800000066' navListManagement.navList = [ { name: '共享门户', key: 'home' }, { name: '能力集市', key: 'DetailsPageconetent' }, diff --git a/front/src/views/home/AbilityToApplyFor.vue b/front/src/views/home/AbilityToApplyFor.vue index ec68b65f..af0309ac 100644 --- a/front/src/views/home/AbilityToApplyFor.vue +++ b/front/src/views/home/AbilityToApplyFor.vue @@ -16,7 +16,17 @@ {{ val.resourceName }} {{ val.type }} -
已选 - {{ allClick.length }} + {{ selectedRowKeys.length }} 个
@@ -86,7 +86,9 @@ @change="handleTableChange" :row-selection="{ selectedRowKeys: selectedRowKeys, - onChange: onSelectChange, + // onChange: onSelectChange, + onSelect: onSelectChange, + onSelectAll: onSelectAll, }" > @@ -115,6 +117,7 @@ import VideoSurveillance from '@/views/home/videoSurveillance' import { getCategoryTreePage } from '@/api/personalCenter' import { dataType } from 'element-plus/es/components/table-v2/src/common' + import { useRouter } from 'vue-router' import { ref, reactive, onMounted } from 'vue' import { getCameraByParentId, @@ -124,6 +127,7 @@ import { sgcInsert } from '@/api/home' import { message } from 'ant-design-vue' import mybus from '@/myplugins/mybus' + const router = useRouter() const options = reactive({ width: '700px', //播放器宽度 height: '400px', //播放器高度 @@ -189,6 +193,7 @@ }) }) const selectedList = ref([]) + const selectedRowKeys = ref([]) const tabList = ref([ { title: '设施类型', @@ -317,8 +322,35 @@ getCamera() } // 一键申请 + const dept = reactive({}) + // eslint-disable-next-line no-undef + if (infrastructure) { + // eslint-disable-next-line no-undef + dept.deptId = infrastructure.deptId + // eslint-disable-next-line no-undef + dept.deptName = infrastructure.deptName + } const apply = () => { - console.log('一键申请') + console.log('一键申请', selectedList.value) + let arr = [ + { + arr: [ + { + description: '', + note1: JSON.stringify(selectedList.value), + resourceId: '1522550195055828996', + resourceName: '摄像头列表', + type: '基础设施', + }, + ], + deptId: dept.deptId, + deptName: dept.deptName, + }, + ] + localStorage.setItem('applyList', JSON.stringify(arr)) + router.push({ + path: '/apply', + }) } // 添加至购物车 const addShopCar = () => { @@ -367,11 +399,43 @@ }, ]) const allClick = ref([]) - const onSelectChange = (selectedRowKeys, selectedRows) => { - console.log('hahhahah', selectedRowKeys, selectedRows) - selectedList.value = selectedRows + const onSelectChange = (record, selected, selectedRows, nativeEvent) => { + console.log('hahhahah', record, selected, selectedRows, nativeEvent) + if (selected) { + selectedList.value.push(record) + selectedRowKeys.value.push(record.channelCode) + } else { + selectedList.value = selectedList.value.filter( + (item) => item.idtCameraChannel !== record.idtCameraChannel + ) + selectedRowKeys.value.splice( + selectedRowKeys.value.indexOf(record.channelCode), + 1 + ) + } + console.log('已选中======================>', selectedList.value) + // selectedList.value = selectedRows // allClick.value = selectedRowKeys } + const onSelectAll = (selected, selectedRows, changeRows) => { + if (selected) { + changeRows.map((val) => { + selectedList.value.push(val) + selectedRowKeys.value.push(val.channelCode) + }) + } else { + changeRows.map((val) => { + selectedList.value = selectedList.value.filter( + (item) => item.idtCameraChannel !== val.idtCameraChannel + ) + selectedRowKeys.value.splice( + selectedRowKeys.value.indexOf(val.channelCode), + 1 + ) + }) + } + console.log('heiheiheiehiehei', selected, selectedRows, changeRows) + } const handleTableChange = (val) => { pagination.value.current = val.current pagination.value.pageSize = val.pageSize diff --git a/front/src/views/personalCenter/components/PurchaseVehicle.vue b/front/src/views/personalCenter/components/PurchaseVehicle.vue index 0b313667..f7496e40 100644 --- a/front/src/views/personalCenter/components/PurchaseVehicle.vue +++ b/front/src/views/personalCenter/components/PurchaseVehicle.vue @@ -4,7 +4,7 @@已选: {{ checkedListAbility.length || 0 }} @@ -108,9 +108,7 @@ > @@ -241,7 +239,7 @@ list.value.forEach((val) => { if (checkedList.value.indexOf(val.deptId) !== -1) { if (val.delFlag == 0) { - scArr.push({ resourceId: val.resourceId }) + scArr.push({ id: val.id }) } } }) @@ -267,9 +265,9 @@ } if (val.children.length > 0) { val.children.map((item) => { - if (checkedListAbility.value.indexOf(item.resourceId) == -1) { - checkedListAbility.value.push(item.resourceId) - val.checkedList.push(item.resourceId) + if (checkedListAbility.value.indexOf(item.id) == -1) { + checkedListAbility.value.push(item.id) + val.checkedList.push(item.id) checkNum.value++ } item.checked = true @@ -301,13 +299,13 @@ if (val.children.length > 0) { val.children.map((item) => { // console.log('child=============>', checkedListAbility.value, item) - if (checkedListAbility.value.indexOf(item.resourceId) > -1) { + if (checkedListAbility.value.indexOf(item.id) > -1) { item.checked = false checkedListAbility.value.splice( - checkedListAbility.value.indexOf(item.resourceId), + checkedListAbility.value.indexOf(item.id), 1 ) - val.checkedList.splice(val.checkedList.indexOf(item.resourceId), 1) + val.checkedList.splice(val.checkedList.indexOf(item.id), 1) } }) } @@ -347,8 +345,8 @@ if (val.children.length > 0) { val.children.map((item) => { item.checked = true - checkedListAbility.value.push(item.resourceId) - val.checkedList.push(item.resourceId) + checkedListAbility.value.push(item.id) + val.checkedList.push(item.id) }) } arr.push(val.deptId) @@ -446,23 +444,23 @@ item.checkAll == true || checkedList.value.indexOf(item.deptId) > -1 ) { - if (checkedListAbility.value.indexOf(val.resourceId) == -1) { - checkedListAbility.value.push(val.resourceId) - item.checkedList.push(val.resourceId) + if (checkedListAbility.value.indexOf(val.id) == -1) { + checkedListAbility.value.push(val.id) + item.checkedList.push(val.id) } val.checked = true checkNum.value++ - } else if (checkedListAbility.value.indexOf(val.resourceId) == -1) { + } else if (checkedListAbility.value.indexOf(val.id) == -1) { val.checked = false } } else { // console.log( // '第二次加载++++++++++++++', // checkedListAbility.value, - // val.resourceId + // val.id // ) if ( - checkedListAbility.value.indexOf(val.resourceId) > -1 || + checkedListAbility.value.indexOf(val.id) > -1 || (item.load < Number(item.pageNum) && checkedListAll.value.indexOf(item.deptId) > -1) ) { @@ -515,9 +513,9 @@ if (item.checked) { if (item.children.length > 0) { item.children.map((val) => { - if (checkedListAbility.value.indexOf(val.resourceId) == -1) { - checkedListAbility.value.push(val.resourceId) - item.checkedList.push(val.resourceId) + if (checkedListAbility.value.indexOf(val.id) == -1) { + checkedListAbility.value.push(val.id) + item.checkedList.push(val.id) } val.checked = true }) @@ -535,12 +533,12 @@ } else { if (item.children.length > 0) { item.children.map((val) => { - if (checkedListAbility.value.indexOf(val.resourceId) > -1) { + if (checkedListAbility.value.indexOf(val.id) > -1) { checkedListAbility.value.splice( - checkedListAbility.value.indexOf(val.resourceId), + checkedListAbility.value.indexOf(val.id), 1 ) - item.checkedList.splice(item.checkedList.indexOf(val.resourceId), 1) + item.checkedList.splice(item.checkedList.indexOf(val.id), 1) val.checked = false } }) @@ -579,7 +577,7 @@ } else { let all = true item.children.map((child) => { - if (checkedListAbility.value.indexOf(child.resourceId) == -1) { + if (checkedListAbility.value.indexOf(child.id) == -1) { all = false } }) @@ -596,17 +594,17 @@ item.checked = !item.checked if (item.checked) { checkNum.value++ - if (checkedListAbility.value.indexOf(item.resourceId) == -1) { - checkedListAbility.value.push(item.resourceId) - val.checkedList.push(item.resourceId) + if (checkedListAbility.value.indexOf(item.id) == -1) { + checkedListAbility.value.push(item.id) + val.checkedList.push(item.id) } } else { checkNum.value-- checkedListAbility.value.splice( - checkedListAbility.value.indexOf(item.resourceId), + checkedListAbility.value.indexOf(item.id), 1 ) - val.checkedList.splice(val.checkedList.indexOf(item.resourceId), 1) + val.checkedList.splice(val.checkedList.indexOf(item.id), 1) } // console.log('判断是否全选===============>', val, checkedListAll.value) if (val.checkedList.length == val.count) { @@ -681,7 +679,7 @@ let arr = [] list.value.map((val) => { val.arr = val.children.filter( - (item) => checkedListAbility.value.indexOf(item.resourceId) > -1 + (item) => checkedListAbility.value.indexOf(item.id) > -1 ) }) arr = list.value.filter((val) => val.arr.length !== 0)