|
@@ -33,8 +33,8 @@
|
|
|
<el-col :span="8">
|
|
|
<span class="demonstration">{{values.originEquipment}}</span>
|
|
|
<el-cascader
|
|
|
- :options="newOptions"
|
|
|
:key="isResouceShow"
|
|
|
+ :options="list"
|
|
|
v-model="ops"
|
|
|
:props="props"
|
|
|
@change="sourceOptions"
|
|
@@ -44,11 +44,13 @@
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<span class="demonstration">{{values.endEquipment}}</span>
|
|
|
- <!-- v-model="filterOps"
|
|
|
- -->
|
|
|
+ <!-- v-model="filterOps"-->
|
|
|
<el-cascader
|
|
|
- :options="disOptions"
|
|
|
+ :options="list"
|
|
|
+ v-model="filterOps"
|
|
|
+ :key="isResouceShow"
|
|
|
:props="props"
|
|
|
+ @change="endOptions"
|
|
|
collapse-tags
|
|
|
clearable
|
|
|
/>
|
|
@@ -115,7 +117,6 @@
|
|
|
<i class="iconfont icon-doc-line"/>
|
|
|
{{values.currentNum}} 0
|
|
|
</p>
|
|
|
- <!-- <a href="/api/datacenter/graphic/template-downloads">-->
|
|
|
<a :href="downloadProject('excel')">
|
|
|
<el-button
|
|
|
type="primary"
|
|
@@ -197,7 +198,7 @@
|
|
|
name: "RelationMaintain",
|
|
|
props: ['values', 'isComputed', 'source', 'TableVisibleMoreLoading', 'ManualMaintenance'],
|
|
|
created() {
|
|
|
-
|
|
|
+ this.showCascader()
|
|
|
},
|
|
|
mounted() {
|
|
|
},
|
|
@@ -236,18 +237,19 @@
|
|
|
idArr: [],//存储所有选择的id
|
|
|
secondary: [],//单独存储二级数据
|
|
|
list: [],//获取后台数据,重新组合,添加唯一标识和源端标识
|
|
|
- isResouceShow: 0,
|
|
|
- result: [],//最终传给后台的数据
|
|
|
- ops: [],//第一个选择器model
|
|
|
+ resultOrigin: [],//最终传给后台的源端数据
|
|
|
+ resultEnd: [],//最终传给后台的末端数据
|
|
|
+ ops: [],
|
|
|
filterOps: [],//为清空第二个选择器
|
|
|
+ isResouceShow: 0,
|
|
|
}
|
|
|
},
|
|
|
- computed:{
|
|
|
+ computed: {
|
|
|
...mapGetters('layout', ['projectId']),
|
|
|
headers() {
|
|
|
return {
|
|
|
'ProjectId': this.projectId,
|
|
|
- 'Comming': 'adm' ,
|
|
|
+ 'Comming': 'adm',
|
|
|
'Account': storage.get("user_name")
|
|
|
}
|
|
|
},
|
|
@@ -255,32 +257,13 @@
|
|
|
return {
|
|
|
relType: this.ManualMaintenance.RelationType || '',
|
|
|
zoneType: this.ManualMaintenance.ZoneType || '',
|
|
|
- projectId:this.projectId
|
|
|
+ projectId: this.projectId
|
|
|
}
|
|
|
},
|
|
|
- newOptions() {
|
|
|
- ++this.isResouceShow
|
|
|
- let allList = []
|
|
|
- this.deepCopy(this.source).forEach(item => allList.push(...item.Items))
|
|
|
- this.list = allList.map((item, index) => {
|
|
|
- item = {
|
|
|
- ...item,
|
|
|
- lId: index
|
|
|
- }
|
|
|
- item.Items.map(i => {
|
|
|
- i.lId = i.Id + i.BlockId //添加唯一标识
|
|
|
- i.Source = true //判断源末端
|
|
|
- return i
|
|
|
- })
|
|
|
- return item
|
|
|
- })
|
|
|
- this.ops = this.list
|
|
|
- return this.list
|
|
|
- },
|
|
|
// 末端数据添加disabled
|
|
|
disOptions() {
|
|
|
- let arr = this.deepCopy(this.list).map(item => {
|
|
|
- item.Items.map(i => {
|
|
|
+ let arr = this.list.length && this.deepCopy(this.list).map(item => {
|
|
|
+ item.Items.length && item.Items.map(i => {
|
|
|
if (this.idArr.includes(i.lId)) {
|
|
|
i.disabled = true
|
|
|
}
|
|
@@ -290,13 +273,51 @@
|
|
|
})
|
|
|
this.filterOps = arr
|
|
|
return arr
|
|
|
- }
|
|
|
-
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
deepCopy(obj) {
|
|
|
return JSON.parse(JSON.stringify(obj))
|
|
|
},
|
|
|
+ showCascader() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ ++this.isResouceShow
|
|
|
+ let allList = []
|
|
|
+ this.deepCopy(this.source).forEach(item => allList.push(...item.Items))
|
|
|
+ this.list = allList.map((item, index) => {
|
|
|
+ item = {
|
|
|
+ ...item,
|
|
|
+ lId: index
|
|
|
+ }
|
|
|
+ item.Items.map(i => {
|
|
|
+ i.lId = i.Id + i.BlockId //添加唯一标识
|
|
|
+ // i.Source = true //判断源末端
|
|
|
+ return i
|
|
|
+ })
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ this.deepCopy(this.list).forEach(k => {
|
|
|
+ k.Items.forEach(j => {
|
|
|
+ if (j.isSource != null && j.isSource === true) {
|
|
|
+ this.ops.push([k.lId, j.lId])
|
|
|
+ }
|
|
|
+ if (j.isSource != null && j.isSource === false) {
|
|
|
+ this.filterOps.push([k.lId, j.lId])
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ //末端
|
|
|
+ // this.filterOps = this.deepCopy(this.list).map(item => {
|
|
|
+ // item.Items.length && item.Items.map(i => {
|
|
|
+ // if (this.idArr.includes(i.lId)) {
|
|
|
+ // i.disabled = true
|
|
|
+ // }
|
|
|
+ // return i
|
|
|
+ // })
|
|
|
+ // return item
|
|
|
+ // })
|
|
|
+ })
|
|
|
+ },
|
|
|
downloadProject(str) {
|
|
|
let relType = this.ManualMaintenance.RelationType ? `?relType=${this.ManualMaintenance.RelationType}` : ''
|
|
|
let zoneType = this.ManualMaintenance.ZoneType ? `&zoneType=${this.ManualMaintenance.ZoneType}` : ''
|
|
@@ -315,14 +336,12 @@
|
|
|
success(event, file, fileList) {
|
|
|
this.dialogManualOption = true
|
|
|
this.dialogProcess = true
|
|
|
- console.log(event,file, fileList,' file success')
|
|
|
+ console.log(event, file, fileList, ' file success')
|
|
|
|
|
|
},
|
|
|
error(event, file, fileList) {
|
|
|
this.dialogManualOption = true
|
|
|
this.dialogProcess = true
|
|
|
- console.log(event,file, fileList)
|
|
|
-
|
|
|
},
|
|
|
errBack() {
|
|
|
this.dialogProcess = false
|
|
@@ -335,43 +354,68 @@
|
|
|
this.$emit('template')
|
|
|
},
|
|
|
promptly() {
|
|
|
- if(this.isComputed.IsAutomatic && !this.isComputed.IsSource) { //需要自动计算并且不需要配置云末端
|
|
|
+ if (this.isComputed.IsAutomatic && !this.isComputed.IsSource) { //需要自动计算并且不需要配置云末端
|
|
|
console.log(this.isComputed.RelationType, 'this.isComputed.RelationType')
|
|
|
this.$emit('RelationType', this.isComputed.RelationType, this.isComputed.ZoneType)
|
|
|
-
|
|
|
}
|
|
|
this.dialogTableVisible = false
|
|
|
},
|
|
|
sourceOptions(val) {
|
|
|
- //把所有id组装到一个数组
|
|
|
+ this.ops = val
|
|
|
this.idArr = val.map(item => item[1])
|
|
|
- //提取后台二级数据
|
|
|
+ //二级数据
|
|
|
this.secondary = []
|
|
|
this.deepCopy(this.list).forEach(item => this.secondary.push(...item.Items))
|
|
|
- //最终过滤
|
|
|
+ //last filter
|
|
|
let filterList = this.secondary.filter(item => this.idArr.includes(item.lId))
|
|
|
- //组合成接口需要的数据格式
|
|
|
+ //接口需要的数据格式
|
|
|
let result = []
|
|
|
filterList.forEach(item => {
|
|
|
- let {BlockId, BuildingId, Domain, Id, MepSystemType, ProjectId, Source, SourceId, Type, Statistics} = item
|
|
|
+ let {BlockId, BuildingId, Domain, Id, MepSystemType, ProjectId, Type, Statistics} = item
|
|
|
result.push({
|
|
|
BlockId,
|
|
|
BuildingId,
|
|
|
Domain,
|
|
|
- Id,
|
|
|
+ // Id,
|
|
|
MepSystemType,
|
|
|
ProjectId,
|
|
|
- Source,
|
|
|
- SourceId,
|
|
|
+ Source: true,
|
|
|
+ SourceId: Id,
|
|
|
SourceType: Type,
|
|
|
Statistics
|
|
|
})
|
|
|
})
|
|
|
- this.result = result
|
|
|
-
|
|
|
+ this.resultOrigin = result
|
|
|
+ },
|
|
|
+ endOptions(val) {
|
|
|
+ this.idArr = val.map(item => item[1])
|
|
|
+ //二级数据
|
|
|
+ this.secondary = []
|
|
|
+ this.deepCopy(this.list).forEach(item => this.secondary.push(...item.Items))
|
|
|
+ //last filter
|
|
|
+ let filterList = this.secondary.filter(item => this.idArr.includes(item.lId))
|
|
|
+ console.log(filterList, 'filterList-end')
|
|
|
+ //接口需要的数据格式
|
|
|
+ let result = []
|
|
|
+ filterList.forEach(item => {
|
|
|
+ let {BlockId, BuildingId, Domain, Id, MepSystemType, ProjectId, Type, Statistics} = item
|
|
|
+ result.push({
|
|
|
+ BlockId,
|
|
|
+ BuildingId,
|
|
|
+ Domain,
|
|
|
+ // Id,
|
|
|
+ MepSystemType,
|
|
|
+ ProjectId,
|
|
|
+ Source: false,
|
|
|
+ SourceId: Id,
|
|
|
+ SourceType: Type,
|
|
|
+ Statistics
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.resultEnd = result
|
|
|
},
|
|
|
computedUpdate() {
|
|
|
- if (!this.result.length) {
|
|
|
+ if (!this.resultOrigin.length && !this.ops.length) {
|
|
|
this.$message({
|
|
|
showClose: true,
|
|
|
message: '请选择源端设备类',
|
|
@@ -379,7 +423,10 @@
|
|
|
});
|
|
|
return false
|
|
|
} else {
|
|
|
- this.$emit('openComputed', this.result)
|
|
|
+ if (this.resultOrigin.length || this.resultEnd.length) {
|
|
|
+ this.resultOrigin.push(...this.resultEnd)
|
|
|
+ this.$emit('openComputed', this.resultOrigin)
|
|
|
+ }
|
|
|
this.dialogTableVisibleMore = false
|
|
|
|
|
|
}
|