fix: 赋能场景--基础设施--详情

This commit is contained in:
guoyue 2022-08-09 10:34:48 +08:00
parent 635f25cb8d
commit 141378eaee
2 changed files with 62 additions and 63 deletions

View File

@ -62,7 +62,7 @@
组合能力 组合能力
</div> </div>
<InfrastructureModal v-model="dataForm" :dataForm="dataForm" @update="updateDataForm" type="基础设施" <InfrastructureModal v-model="dataForm" :dataForm="dataForm" @update="updateDataForm" type="基础设施"
ref="jcssDom"></InfrastructureModal> :modalType="modalType" ref="jcssDom"></InfrastructureModal>
<combine-ability v-model="dataForm" :dataForm="dataForm" @update="updateDataForm" type="数据资源" ref="sjzyDom" <combine-ability v-model="dataForm" :dataForm="dataForm" @update="updateDataForm" type="数据资源" ref="sjzyDom"
:getDataParams="getListParams['数据资源']"></combine-ability> :getDataParams="getListParams['数据资源']"></combine-ability>
<combine-ability v-model="dataForm" :dataForm="dataForm" @update="updateDataForm" type="组件服务" ref="zjfwDom" <combine-ability v-model="dataForm" :dataForm="dataForm" @update="updateDataForm" type="组件服务" ref="zjfwDom"
@ -269,6 +269,7 @@ export default {
handler(newVal) { handler(newVal) {
this.addOrUpdateVisibleCopy = newVal; this.addOrUpdateVisibleCopy = newVal;
if (this.modalType == 'add' && newVal) { if (this.modalType == 'add' && newVal) {
localStorage.setItem('InfrastructureSearchData', JSON.stringify({}))
this.getDetail(this.dataForm) this.getDetail(this.dataForm)
} }
}, },
@ -361,6 +362,7 @@ export default {
), ),
// //
getDetail(data) { getDetail(data) {
console.log('data---详情--------->', data);
this.dataForm = data; this.dataForm = data;
this.$nextTick(() => { this.$nextTick(() => {
for (const key in this.refsParseArray) { for (const key in this.refsParseArray) {
@ -369,7 +371,7 @@ export default {
let _imgObj = data.fuseAttrList.find(v => v.attrType == '服务图片') || {}; let _imgObj = data.fuseAttrList.find(v => v.attrType == '服务图片') || {};
this.imageUrl = _imgObj.attrValue; this.imageUrl = _imgObj.attrValue;
// // --
Object.keys(this.getListParams).map(k => { Object.keys(this.getListParams).map(k => {
let arr = data.fuseResourceList.filter(v => v.type == k); let arr = data.fuseResourceList.filter(v => v.type == k);
let arr2 = []; let arr2 = [];
@ -391,14 +393,9 @@ export default {
file.type === 'image/jpeg' || file.type === 'image/jpeg' ||
file.type === 'image/jpg' || file.type === 'image/jpg' ||
file.type === 'image/png' file.type === 'image/png'
// const isLt2M = file.size / 1024 / 1024 < 2
if (!isImage) { if (!isImage) {
this.$message.error('上传头像图片只能是 jpg/png 格式!') this.$message.error('上传头像图片只能是 jpg/png 格式!')
} }
// if (!isLt2M) {
// this.$message.error(' 2MB!')
// }
return isImage return isImage
}, },
addUploadRemoveFile(file, fileList) { addUploadRemoveFile(file, fileList) {
@ -410,14 +407,10 @@ export default {
file.type === 'image/jpeg' || file.type === 'image/jpeg' ||
file.type === 'image/jpg' || file.type === 'image/jpg' ||
file.type === 'image/png' file.type === 'image/png'
// const isLt2M = file.size / 1024 / 1024 < 2
if (!isImage) { if (!isImage) {
this.$message.error('上传头像图片只能是 jpg/png 格式!') this.$message.error('上传头像图片只能是 jpg/png 格式!')
} }
// if (!isLt2M) {
// this.$message.error(' 2MB!')
// }
return isImage return isImage
}, },
editUploadRemoveFile(file, fileList) { editUploadRemoveFile(file, fileList) {
@ -429,7 +422,6 @@ export default {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.imageUrl = res.data this.imageUrl = res.data
// this.imageUrl = URL.createObjectURL(file.raw);
}, },
}, },
beforeDestroy() { beforeDestroy() {

View File

@ -2,7 +2,8 @@
<div> <div>
<div class="top flex-row-start"> <div class="top flex-row-start">
<div class="type">{{ type }}</div> <div class="type">{{ type }}</div>
<el-button type="primary" size="small" @click="showModal = true">添加</el-button> <el-button type="primary" size="small" @click="showModal = true">{{ modalType == 'add' ? '添加' : '编辑' }}
</el-button>
</div> </div>
<el-dialog class="modal-box" :visible.sync="showModal" title="请选择" @close="close" :close-on-click-modal="false" <el-dialog class="modal-box" :visible.sync="showModal" title="请选择" @close="close" :close-on-click-modal="false"
:close-on-press-escape="false" :key="showKey" append-to-body> :close-on-press-escape="false" :key="showKey" append-to-body>
@ -34,8 +35,8 @@
</div> </div>
<div class="flex-row-start" style="margin-bottom:10px;align-items: flex-start;"> <div class="flex-row-start" style="margin-bottom:10px;align-items: flex-start;">
<div class="left-text" style="margin-top: 10px;">关键词</div> <div class="left-text" style="margin-top: 10px;">关键词</div>
<el-input style="margin-left:10px;width: 200px;" v-model="cameraName" placeholder="名称" <el-input style="margin-left:10px;width: 200px;" v-model="searchData.cameraName"
clearable> placeholder="名称" clearable>
</el-input> </el-input>
<el-button type="primary" style="margin-left:10px;margin-top:4px" size="small" @click="getData"> <el-button type="primary" style="margin-left:10px;margin-top:4px" size="small" @click="getData">
搜索 搜索
@ -59,8 +60,8 @@
<el-table-column prop="nodeName" label="归属" header-align="center" align="center"> <el-table-column prop="nodeName" label="归属" header-align="center" align="center">
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination style="justify-content: center;display: flex;" :current-page="pageData.page" <el-pagination style="justify-content: center;display: flex;" :current-page="searchData.pageNum"
:page-sizes="[10, 20, 50, 100]" :page-size="pageData.limit" :total="pageData.total" :page-sizes="[10, 20, 50, 100]" :page-size="searchData.pageSize" :total="pageData.total"
layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle" layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle"> @current-change="pageCurrentChangeHandle">
</el-pagination> </el-pagination>
@ -75,7 +76,7 @@
</template> </template>
</el-dialog> </el-dialog>
<DisplayList :displayList="displayList"></DisplayList> <DisplayList :displayList="displayList" showKey="channelName"></DisplayList>
</div> </div>
</template> </template>
@ -98,6 +99,10 @@ export default {
type: String, type: String,
default: "基础设施" default: "基础设施"
}, },
modalType: {
type: String,
default: 'add'
}
}, },
data() { data() {
const getYunList = () => { const getYunList = () => {
@ -109,9 +114,7 @@ export default {
return { return {
showKey: 0, showKey: 0,
showModal: false, showModal: false,
transferData: [], // 穿
selectedArray: [], // id selectedArray: [], // id
allData: [],
displayList: [], // list displayList: [], // list
btnList: ['视频资源', '云资源', '感知资源'], btnList: ['视频资源', '云资源', '感知资源'],
showText: { showText: {
@ -133,23 +136,28 @@ export default {
list: [] list: []
}, },
], ],
activeBtn: '视频资源',
checkList: [],
currentList: [], currentList: [],
dataListLoading: false, dataListLoading: false,
dataList: [], dataList: [],
pageData: { pageData: {
limit: 10,
page: 1,
total: 0, total: 0,
}, },
cameraName: '', cameraName: '',
postData: {},
activeBtn: '视频资源',
checkList: [],
searchData: {
cameraName: '',
pageSize: 10,
pageNum: 1,
parentId: ''
},
dataFormCopy: {}
} }
}, },
watch: { watch: {
async showModal(newVal) { async showModal(newVal) {
if (newVal) { if (newVal) {
await this.getData();
// //
this.$nextTick(() => { this.$nextTick(() => {
this.selectCheckbox() this.selectCheckbox()
@ -160,8 +168,6 @@ export default {
mounted() { mounted() {
// //
this.getVideoBtn() this.getVideoBtn()
//
this.getData()
}, },
methods: { methods: {
selectCheckbox() { selectCheckbox() {
@ -176,24 +182,24 @@ export default {
}) })
if (list.length) { if (list.length) {
list.forEach((row) => { 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) { async getDataInfo(dataForm) {
this.modalType == 'edit'
this.dataFormCopy = dataForm;
await this.getVideoBtn(); await this.getVideoBtn();
await this.getData();
let arr = []; let arr = [];
let attrValue = dataForm.fuseResourceList.filter(v => v.type == this.type); let attrValue = dataForm.fuseResourceList.filter(v => v.type == this.type);
if (attrValue.length > 0) { if (attrValue.length > 0) {
attrValue.map(val => { attrValue.map(val => {
let item = this.dataList.find(v => v.idtCameraChannel == val.resourceId) || {}; let _obj = Object.assign({}, val, val.resource)
let _obj = {
type: val.type,
idtCameraChannel: val.resourceId,
name: item.channelName
};
arr.push(_obj); arr.push(_obj);
}); });
} }
@ -201,28 +207,31 @@ export default {
this.displayList = JSON.parse(JSON.stringify(arr)); this.displayList = JSON.parse(JSON.stringify(arr));
// //
this.selectedArray = arr.map(v => v.idtCameraChannel); this.selectedArray = arr.map(v => v.idtCameraChannel);
}, this.dataList = JSON.parse(JSON.stringify(arr));
handleShowModal() { this.pageData.total = arr.length;
this.showModal = true; //
this.$nextTick(() => {
this.selectCheckbox()
})
}, },
// //
dataListSelectionChangeHandle(data) { dataListSelectionChangeHandle(data) {
this.selectedArray = data; this.selectedArray = data;
}, },
pageCurrentChangeHandle(page) { pageCurrentChangeHandle(pageNum) {
this.pageData.page = page; this.searchData.pageNum = pageNum;
this.getData() this.getData()
}, },
pageSizeChangeHandle(limit) { pageSizeChangeHandle(pageSize) {
this.pageData.limit = limit; this.searchData.pageSize = pageSize;
this.getData() this.getData()
}, },
changeBtn(btn) { changeBtn(btn) {
this.activeBtn = btn; this.activeBtn = btn;
this.currentList = this.tabData.find(v => v.tabName == btn).list || [];
this.checkList = []; this.checkList = [];
this.cameraName = ''; this.searchData.cameraName = '';
this.getData() this.getData()
this.currentList = this.tabData.find(v => v.tabName == btn).list || []
}, },
// //
getVideoBtn() { getVideoBtn() {
@ -234,7 +243,13 @@ export default {
} }
this.tabData[0].list = res.data.data || []; 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 => { }).catch(err => {
reject(err) reject(err)
this.$message.error(err); this.$message.error(err);
@ -255,23 +270,19 @@ export default {
} else { } else {
this.checkList.push(item.labelCode) this.checkList.push(item.labelCode)
} }
console.log('this.checkList------------>', this.checkList); this.$nextTick(() => {
this.getData() this.getData()
})
}, },
// //
getData(parentId = '') { getData() {
this.allData = []; let postData = Object.assign({
let postData = {
parentId: parentId,
cameraName: this.cameraName,
checkStatus: 1, checkStatus: 1,
pageNum: this.pageData.page,
pageSize: this.pageData.limit,
gpsX: '', gpsX: '',
gpsY: '', gpsY: '',
radius: '', radius: '',
labelCodes: this.checkList.join(), labelCodes: this.checkList.join(),
} }, this.searchData);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.$http.get('/api/project/selectByParentIdNew', { params: postData }).then(res => { this.$http.get('/api/project/selectByParentIdNew', { params: postData }).then(res => {
resolve(res) resolve(res)
@ -285,10 +296,9 @@ export default {
this.$message.error(err); this.$message.error(err);
}) })
}) })
}, },
changeParentId(parentId) { changeParentId(parentId) {
console.log('parentId------------>', parentId); this.searchData.parentId = parentId;
this.getData(parentId) this.getData(parentId)
}, },
confirmSubmitHandle() { confirmSubmitHandle() {
@ -305,6 +315,7 @@ export default {
}) })
} }
}) })
this.$emit('update', { this.$emit('update', {
title: this.type, title: this.type,
list: this.selectedArray.map(v => v.idtCameraChannel) list: this.selectedArray.map(v => v.idtCameraChannel)
@ -312,16 +323,12 @@ export default {
}, },
close() { close() {
this.showModal = false; this.showModal = false;
this.cameraName = '' this.searchData.cameraName = ''
this.selectedArray = []; this.selectedArray = [];
this.allData = [];
this.transferData = [];
this.$emit('closeModal'); this.$emit('closeModal');
}, },
clear() { clear() {
this.cameraName = '' this.changeBtn('视频资源')
this.selectedArray = [];
this.getData()
}, },
} }