From 141378eaeeefcffee85c28019fe60480fee42000 Mon Sep 17 00:00:00 2001 From: guoyue Date: Tue, 9 Aug 2022 10:34:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B5=8B=E8=83=BD=E5=9C=BA=E6=99=AF--?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E8=AE=BE=E6=96=BD--=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assignedScene/add-update-scene.vue | 16 +-- .../components/infrastructure-modal.vue | 109 ++++++++++-------- 2 files changed, 62 insertions(+), 63 deletions(-) diff --git a/back/src/views/modules/ability/assignedScene/add-update-scene.vue b/back/src/views/modules/ability/assignedScene/add-update-scene.vue index dc03578c..beb88688 100644 --- a/back/src/views/modules/ability/assignedScene/add-update-scene.vue +++ b/back/src/views/modules/ability/assignedScene/add-update-scene.vue @@ -62,7 +62,7 @@ 组合能力 + :modalType="modalType" ref="jcssDom"> ', data); this.dataForm = data; this.$nextTick(() => { for (const key in this.refsParseArray) { @@ -369,7 +371,7 @@ export default { let _imgObj = data.fuseAttrList.find(v => v.attrType == '服务图片') || {}; this.imageUrl = _imgObj.attrValue; - // 组合能力 + // 组合能力--特殊处理 Object.keys(this.getListParams).map(k => { let arr = data.fuseResourceList.filter(v => v.type == k); let arr2 = []; @@ -391,14 +393,9 @@ export default { file.type === 'image/jpeg' || file.type === 'image/jpg' || file.type === 'image/png' - // const isLt2M = file.size / 1024 / 1024 < 2 - if (!isImage) { this.$message.error('上传头像图片只能是 jpg/png 格式!') } - // if (!isLt2M) { - // this.$message.error('上传头像图片大小不能超过 2MB!') - // } return isImage }, addUploadRemoveFile(file, fileList) { @@ -410,14 +407,10 @@ export default { file.type === 'image/jpeg' || file.type === 'image/jpg' || file.type === 'image/png' - // const isLt2M = file.size / 1024 / 1024 < 2 if (!isImage) { this.$message.error('上传头像图片只能是 jpg/png 格式!') } - // if (!isLt2M) { - // this.$message.error('上传头像图片大小不能超过 2MB!') - // } return isImage }, editUploadRemoveFile(file, fileList) { @@ -429,7 +422,6 @@ export default { return this.$message.error(res.msg) } this.imageUrl = res.data - // this.imageUrl = URL.createObjectURL(file.raw); }, }, beforeDestroy() { diff --git a/back/src/views/modules/ability/assignedScene/components/infrastructure-modal.vue b/back/src/views/modules/ability/assignedScene/components/infrastructure-modal.vue index 6c78daa0..67a7163a 100644 --- a/back/src/views/modules/ability/assignedScene/components/infrastructure-modal.vue +++ b/back/src/views/modules/ability/assignedScene/components/infrastructure-modal.vue @@ -2,7 +2,8 @@
{{ type }}
- 添加 + {{ modalType == 'add' ? '添加' : '编辑' }} +
@@ -34,8 +35,8 @@
关键词
- + 搜索 @@ -59,8 +60,8 @@ - @@ -75,7 +76,7 @@ - +
@@ -98,6 +99,10 @@ export default { type: String, default: "基础设施" }, + modalType: { + type: String, + default: 'add' + } }, data() { const getYunList = () => { @@ -109,9 +114,7 @@ export default { return { showKey: 0, showModal: false, - transferData: [], // 穿梭框所有数据 selectedArray: [], // 已选择的数据id - allData: [], displayList: [], // 用于展示的list btnList: ['视频资源', '云资源', '感知资源'], showText: { @@ -133,23 +136,28 @@ export default { list: [] }, ], - activeBtn: '视频资源', - checkList: [], currentList: [], dataListLoading: false, dataList: [], pageData: { - limit: 10, - page: 1, total: 0, }, cameraName: '', + postData: {}, + activeBtn: '视频资源', + checkList: [], + searchData: { + cameraName: '', + pageSize: 10, + pageNum: 1, + parentId: '' + }, + dataFormCopy: {} } }, watch: { async showModal(newVal) { if (newVal) { - await this.getData(); // 默认选中复选框 this.$nextTick(() => { this.selectCheckbox() @@ -160,8 +168,6 @@ export default { mounted() { // 获取视频资源 this.getVideoBtn() - // 获取列表 - this.getData() }, methods: { selectCheckbox() { @@ -176,24 +182,24 @@ export default { }) if (list.length) { list.forEach((row) => { - this.$refs.dataTable.toggleRowSelection(row, true) + this.$refs.dataTable && this.$refs.dataTable.toggleRowSelection(row, true) }) } } }, + showAction() { + this.showModal = true; + }, + // 详情 async getDataInfo(dataForm) { + this.modalType == 'edit' + this.dataFormCopy = dataForm; await this.getVideoBtn(); - await this.getData(); let arr = []; let attrValue = dataForm.fuseResourceList.filter(v => v.type == this.type); if (attrValue.length > 0) { attrValue.map(val => { - let item = this.dataList.find(v => v.idtCameraChannel == val.resourceId) || {}; - let _obj = { - type: val.type, - idtCameraChannel: val.resourceId, - name: item.channelName - }; + let _obj = Object.assign({}, val, val.resource) arr.push(_obj); }); } @@ -201,28 +207,31 @@ export default { this.displayList = JSON.parse(JSON.stringify(arr)); // 已选中 this.selectedArray = arr.map(v => v.idtCameraChannel); - }, - handleShowModal() { - this.showModal = true; + this.dataList = JSON.parse(JSON.stringify(arr)); + this.pageData.total = arr.length; + // 默认选中复选框 + this.$nextTick(() => { + this.selectCheckbox() + }) }, // 点击复选框 dataListSelectionChangeHandle(data) { this.selectedArray = data; }, - pageCurrentChangeHandle(page) { - this.pageData.page = page; + pageCurrentChangeHandle(pageNum) { + this.searchData.pageNum = pageNum; this.getData() }, - pageSizeChangeHandle(limit) { - this.pageData.limit = limit; + pageSizeChangeHandle(pageSize) { + this.searchData.pageSize = pageSize; this.getData() }, changeBtn(btn) { this.activeBtn = btn; + this.currentList = this.tabData.find(v => v.tabName == btn).list || []; this.checkList = []; - this.cameraName = ''; + this.searchData.cameraName = ''; this.getData() - this.currentList = this.tabData.find(v => v.tabName == btn).list || [] }, // 获取视频标签列表 getVideoBtn() { @@ -234,7 +243,13 @@ export default { } this.tabData[0].list = res.data.data || []; - this.changeBtn(this.activeBtn) + this.$nextTick(() => { + this.currentList = this.tabData.find(v => v.tabName == this.activeBtn).list || []; + if (this.modalType == 'add') { + // 获取列表 + this.getData() + } + }) }).catch(err => { reject(err) this.$message.error(err); @@ -255,23 +270,19 @@ export default { } else { this.checkList.push(item.labelCode) } - console.log('this.checkList------------>', this.checkList); - this.getData() + this.$nextTick(() => { + this.getData() + }) }, // 获取列表 - getData(parentId = '') { - this.allData = []; - let postData = { - parentId: parentId, - cameraName: this.cameraName, + getData() { + let postData = Object.assign({ checkStatus: 1, - pageNum: this.pageData.page, - pageSize: this.pageData.limit, gpsX: '', gpsY: '', radius: '', labelCodes: this.checkList.join(), - } + }, this.searchData); return new Promise((resolve, reject) => { this.$http.get('/api/project/selectByParentIdNew', { params: postData }).then(res => { resolve(res) @@ -285,10 +296,9 @@ export default { this.$message.error(err); }) }) - }, changeParentId(parentId) { - console.log('parentId------------>', parentId); + this.searchData.parentId = parentId; this.getData(parentId) }, confirmSubmitHandle() { @@ -305,6 +315,7 @@ export default { }) } }) + this.$emit('update', { title: this.type, list: this.selectedArray.map(v => v.idtCameraChannel) @@ -312,16 +323,12 @@ export default { }, close() { this.showModal = false; - this.cameraName = '' + this.searchData.cameraName = '' this.selectedArray = []; - this.allData = []; - this.transferData = []; this.$emit('closeModal'); }, clear() { - this.cameraName = '' - this.selectedArray = []; - this.getData() + this.changeBtn('视频资源') }, }