|
@@ -15,7 +15,9 @@
|
|
</el-tabs>
|
|
</el-tabs>
|
|
<div class="table" v-loading="loading">
|
|
<div class="table" v-loading="loading">
|
|
<template v-if="deviceType.length > 0">
|
|
<template v-if="deviceType.length > 0">
|
|
- <admMultiTable :currentHeader="currentHeader" @handleCurrentEdit="handleCurrentEdit"
|
|
|
|
|
|
+ <admMultiTable :currentHeader="currentHeader"
|
|
|
|
+ @handleCurrentEdit="handleCurrentEdit"
|
|
|
|
+
|
|
:tableData="tableData" :headersStage="headersStage"/>
|
|
:tableData="tableData" :headersStage="headersStage"/>
|
|
<Pagination v-if="tableData.length > 0" :paginationList="paginationList"
|
|
<Pagination v-if="tableData.length > 0" :paginationList="paginationList"
|
|
@handleCurrentChange="handleCurrentChange"
|
|
@handleCurrentChange="handleCurrentChange"
|
|
@@ -49,20 +51,19 @@
|
|
<el-cascader :options="list" clearable v-model="deviceVal"
|
|
<el-cascader :options="list" clearable v-model="deviceVal"
|
|
:props="optionProps"
|
|
:props="optionProps"
|
|
class="adm-select"></el-cascader>
|
|
class="adm-select"></el-cascader>
|
|
-
|
|
|
|
</div>
|
|
</div>
|
|
<el-button type="primary" class="fr" @click="handleNext">下一步</el-button>
|
|
<el-button type="primary" class="fr" @click="handleNext">下一步</el-button>
|
|
</template>
|
|
</template>
|
|
<template v-else-if="displayLocation && deviceVal">
|
|
<template v-else-if="displayLocation && deviceVal">
|
|
- <div class="dialog-button">
|
|
|
|
- <el-button type="primary">保存</el-button>
|
|
|
|
- <el-button type="default">取消</el-button>
|
|
|
|
- <el-button type="default">重置</el-button>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <deviceGraph ref="deviceGraph" :equip="curEquip" @goBack="goBack"/>
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button type="primary" @click="saveLocation">确定</el-button>
|
|
|
|
+ <el-button type="default" @click="resetLocation">重置</el-button>
|
|
|
|
+ </span>
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
<div>
|
|
<div>
|
|
- <dataForm :deviceHeaders="deviceHeaders" ref="dataForm" :currRowContent="currRowContent"/>
|
|
|
|
|
|
+ <dataForm :deviceHeaders="deviceHeaders" ref="dataForm"/>
|
|
</div>
|
|
</div>
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="handleDataForm">确 定</el-button>
|
|
<el-button type="primary" @click="handleDataForm">确 定</el-button>
|
|
@@ -71,17 +72,15 @@
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
- <template v-if="maintain == '维护'">
|
|
|
|
- <div class="dialog-button">
|
|
|
|
- <el-button type="primary">保存</el-button>
|
|
|
|
- <el-button type="default">取消</el-button>
|
|
|
|
- <el-button type="default">重置</el-button>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <template v-if="displayLocation && deviceVal">
|
|
|
|
+ <deviceGraph ref="deviceGraph" :equip="curEquip" @goBack="goBack"/>
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button type="primary" @click="saveLocation">确定</el-button>
|
|
|
|
+ <el-button type="default" @click="resetLocation">重置</el-button>
|
|
|
|
+ </span>
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
-
|
|
|
|
- <dataForm :deviceHeaders="deviceHeaders" ref="dataForm" :currRowContent="currRowContent"/>
|
|
|
|
-
|
|
|
|
|
|
+ <dataForm :deviceHeaders="deviceHeaders" ref="dataForm" :currRowContent="currRowContent"/>
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="handleDataForm">确 定</el-button>
|
|
<el-button type="primary" @click="handleDataForm">确 定</el-button>
|
|
<el-button @click="handlePosition">维护位置</el-button>
|
|
<el-button @click="handlePosition">维护位置</el-button>
|
|
@@ -98,14 +97,15 @@
|
|
import { Component, Vue, Watch } from "vue-property-decorator";
|
|
import { Component, Vue, Watch } from "vue-property-decorator";
|
|
import { AdmMultiTable, AdmSearch, dataForm, Pagination, Statistics } from '../components/index'
|
|
import { AdmMultiTable, AdmSearch, dataForm, Pagination, Statistics } from '../components/index'
|
|
import { allDevice, BeatchQueryParam, dictInfo } from "@/api/equipComponent";
|
|
import { allDevice, BeatchQueryParam, dictInfo } from "@/api/equipComponent";
|
|
-import { queryCount, queryEquip } from "@/api/datacenter";
|
|
|
|
|
|
+import { createEquip, queryCount, queryEquip, updateEquip } from "@/api/datacenter";
|
|
import { UserModule } from "@/store/modules/user";
|
|
import { UserModule } from "@/store/modules/user";
|
|
|
|
+import deviceGraph from "./components/deviceGraph.vue"
|
|
import tools from "@/utils/maintain"
|
|
import tools from "@/utils/maintain"
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
name: 'adm-device',
|
|
name: 'adm-device',
|
|
- components: { Statistics, AdmSearch, AdmMultiTable, Pagination, dataForm }
|
|
|
|
|
|
+ components: { Statistics, AdmSearch, AdmMultiTable, Pagination, dataForm, deviceGraph }
|
|
})
|
|
})
|
|
export default class extends Vue {
|
|
export default class extends Vue {
|
|
|
|
|
|
@@ -142,9 +142,9 @@ export default class extends Vue {
|
|
// 弹窗开关
|
|
// 弹窗开关
|
|
dialogVisible = false
|
|
dialogVisible = false
|
|
// tabs数据
|
|
// tabs数据
|
|
- paneMsg = ['设计阶段维护', '施工阶段维护', '运维阶段维护']
|
|
|
|
|
|
+ paneMsg = []
|
|
// 当前tabs值
|
|
// 当前tabs值
|
|
- activeName = ""
|
|
|
|
|
|
+ activeName = 0
|
|
// 分页
|
|
// 分页
|
|
paginationList = {
|
|
paginationList = {
|
|
page: 1,
|
|
page: 1,
|
|
@@ -157,7 +157,7 @@ export default class extends Vue {
|
|
// 弹窗 title
|
|
// 弹窗 title
|
|
deviceMsg = '添加设备'
|
|
deviceMsg = '添加设备'
|
|
// 默认当前阶段
|
|
// 默认当前阶段
|
|
- currentHeader = this.paneMsg[0]
|
|
|
|
|
|
+ currentHeader = ''
|
|
// 主体数据
|
|
// 主体数据
|
|
tableData = []
|
|
tableData = []
|
|
codeToDataSource = {}
|
|
codeToDataSource = {}
|
|
@@ -168,6 +168,8 @@ export default class extends Vue {
|
|
status = '添加'
|
|
status = '添加'
|
|
// 维护位置开关
|
|
// 维护位置开关
|
|
maintain = ''
|
|
maintain = ''
|
|
|
|
+ // 传到维护位置的设备信息
|
|
|
|
+ curEquip = {}
|
|
|
|
|
|
// 项目id
|
|
// 项目id
|
|
get projectId(): string {
|
|
get projectId(): string {
|
|
@@ -194,7 +196,6 @@ export default class extends Vue {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
handleChangeDevice() {
|
|
handleChangeDevice() {
|
|
if (this.deviceType[1]) {
|
|
if (this.deviceType[1]) {
|
|
this.loading = true
|
|
this.loading = true
|
|
@@ -212,12 +213,12 @@ export default class extends Vue {
|
|
param2.filters += `;codeName contain '${ this.inputSearch }' or systemCategory contain '${ this.inputSearch }' or bimTypeId contain '${ this.inputSearch }' or localId contain '${ this.inputSearch }'`
|
|
param2.filters += `;codeName contain '${ this.inputSearch }' or systemCategory contain '${ this.inputSearch }' or bimTypeId contain '${ this.inputSearch }' or localId contain '${ this.inputSearch }'`
|
|
}
|
|
}
|
|
let promise = new Promise(resolve => {
|
|
let promise = new Promise(resolve => {
|
|
- dictInfo(param).then(res => {
|
|
|
|
|
|
+ dictInfo(param).then((res: []) => {
|
|
resolve(res)
|
|
resolve(res)
|
|
})
|
|
})
|
|
})
|
|
})
|
|
let promise2 = new Promise(resolve => {
|
|
let promise2 = new Promise(resolve => {
|
|
- queryEquip(param2).then(res => {
|
|
|
|
|
|
+ queryEquip(param2).then((res: []) => {
|
|
resolve(res)
|
|
resolve(res)
|
|
})
|
|
})
|
|
})
|
|
})
|
|
@@ -226,6 +227,8 @@ export default class extends Vue {
|
|
// 类型下信息点,默认设计阶段
|
|
// 类型下信息点,默认设计阶段
|
|
this.headerInformation = res[0] // 获取表头
|
|
this.headerInformation = res[0] // 获取表头
|
|
this.tableData = res[1].content // 主体数据
|
|
this.tableData = res[1].content // 主体数据
|
|
|
|
+ this.paneMsg = res[0].dictStages.map(i => i.name)
|
|
|
|
+ this.currentHeader = this.paneMsg[this.activeName]
|
|
this.headerStage()
|
|
this.headerStage()
|
|
this.paginationList.total = res[1].total
|
|
this.paginationList.total = res[1].total
|
|
})
|
|
})
|
|
@@ -249,11 +252,17 @@ export default class extends Vue {
|
|
}
|
|
}
|
|
|
|
|
|
headerStage() {
|
|
headerStage() {
|
|
- let header: [] = []
|
|
|
|
|
|
+ let pic = [], base = []
|
|
if (Object.keys(this.headerInformation).length > 0) {
|
|
if (Object.keys(this.headerInformation).length > 0) {
|
|
this.headerInformation.dictStages.forEach(item => {
|
|
this.headerInformation.dictStages.forEach(item => {
|
|
if (this.currentHeader == item.name) {
|
|
if (this.currentHeader == item.name) {
|
|
- item.infos && item.infos.forEach(val => header.push(val))
|
|
|
|
|
|
+ item.infos && item.infos.forEach(val => {
|
|
|
|
+ if (val.dataType == 'ATTACHMENT') {
|
|
|
|
+ pic.push(val)
|
|
|
|
+ } else {
|
|
|
|
+ base.push(val)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -264,11 +273,11 @@ export default class extends Vue {
|
|
},
|
|
},
|
|
dictStages: {
|
|
dictStages: {
|
|
name: this.currentHeader,
|
|
name: this.currentHeader,
|
|
- data: header
|
|
|
|
|
|
+ data: pic.length > 0 ? [...base, ...pic] : [...base]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 信息点集合
|
|
// 信息点集合
|
|
- this.all = [...this.headerInformation.basicInfos, ...header]
|
|
|
|
|
|
+ this.all = [...this.headersStage.basicInfos.data, ...this.headersStage.dictStages.data]
|
|
this.codeToDataSource = {}
|
|
this.codeToDataSource = {}
|
|
this.all.forEach(item => {
|
|
this.all.forEach(item => {
|
|
if (item.dataSource) {
|
|
if (item.dataSource) {
|
|
@@ -328,7 +337,10 @@ export default class extends Vue {
|
|
tools.setDataForKey(
|
|
tools.setDataForKey(
|
|
item,
|
|
item,
|
|
head.path,
|
|
head.path,
|
|
- child.error
|
|
|
|
|
|
+ child.error ? child.value
|
|
|
|
+ ? "表号功能号格式错误"
|
|
|
|
+ : "表号功能号不存在"
|
|
|
|
+ : "暂未采集到实时数据"
|
|
);
|
|
);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -370,21 +382,39 @@ export default class extends Vue {
|
|
addDevice() {
|
|
addDevice() {
|
|
this.status = '添加'
|
|
this.status = '添加'
|
|
this.dialogVisible = true
|
|
this.dialogVisible = true
|
|
|
|
+ this.currRowContent = {}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
// 维护位置
|
|
// 维护位置
|
|
handlePosition() {
|
|
handlePosition() {
|
|
|
|
+ this.$refs.dataForm.submitForm(this.handlePositionSave)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ handlePositionSave() {
|
|
|
|
+ this.curEquip = tools.formatData(this.$refs.dataForm.form)
|
|
this.displayLocation = true
|
|
this.displayLocation = true
|
|
}
|
|
}
|
|
|
|
|
|
// 添加 事件处理
|
|
// 添加 事件处理
|
|
handleDataForm() {
|
|
handleDataForm() {
|
|
- console.log(this.$refs.dataForm.form)
|
|
|
|
|
|
+ this.$refs.dataForm.submitForm(this.handleDataFormSave)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ handleDataFormSave() {
|
|
|
|
+ const eq = tools.formatData(this.$refs.dataForm.form);
|
|
|
|
+ if (eq.id) {
|
|
|
|
+ //更新
|
|
|
|
+ this.handleUpdateEquip(eq);
|
|
|
|
+ } else {
|
|
|
|
+ eq.classCode = this.deviceVal[1]
|
|
|
|
+ // 创建
|
|
|
|
+ this.handleCreateEquip(eq);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// 编辑当前行
|
|
// 编辑当前行
|
|
- handleCurrentEdit(val) {
|
|
|
|
|
|
+ handleCurrentEdit(val: object) {
|
|
this.status = '编辑'
|
|
this.status = '编辑'
|
|
this.currRowContent = val
|
|
this.currRowContent = val
|
|
this.handleNext()
|
|
this.handleNext()
|
|
@@ -402,6 +432,76 @@ export default class extends Vue {
|
|
this.displayLocation = false
|
|
this.displayLocation = false
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 取消
|
|
|
|
+ cancelLocation() {
|
|
|
|
+ // @ts-ignore
|
|
|
|
+ this.$refs.deviceGraph.cancelLocation()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 保存
|
|
|
|
+ saveLocation() {
|
|
|
|
+ // @ts-ignore
|
|
|
|
+ const data = this.$refs.deviceGraph.getLocation()
|
|
|
|
+ if (data) {
|
|
|
|
+ this.curEquip.bimLocation = `${ data.x },${ data.y },${ data.z }`;
|
|
|
|
+ this.curEquip.buildingId = data.buildingId;
|
|
|
|
+ this.curEquip.floorId = data.floorId;
|
|
|
|
+ }
|
|
|
|
+ if (this.curEquip.id) {
|
|
|
|
+ //更新
|
|
|
|
+ this.handleUpdateEquip(this.curEquip);
|
|
|
|
+ } else {
|
|
|
|
+ this.curEquip.classCode = this.deviceVal[1]
|
|
|
|
+ // 创建
|
|
|
|
+ this.handleCreateEquip(this.curEquip);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 更新设备
|
|
|
|
+ handleUpdateEquip(obj) {
|
|
|
|
+ let pa;
|
|
|
|
+ if (Array.isArray(obj)) {
|
|
|
|
+ pa = { content: obj }
|
|
|
|
+ } else {
|
|
|
|
+ pa = { content: [obj] }
|
|
|
|
+ }
|
|
|
|
+ updateEquip(pa).then(res => {
|
|
|
|
+ if (res.result == 'success') {
|
|
|
|
+ this.$message.success('更新成功');
|
|
|
|
+ this.dialogVisible = false;
|
|
|
|
+ this.handleChangeDevice()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 创建设备
|
|
|
|
+ handleCreateEquip(obj: any) {
|
|
|
|
+ let pa;
|
|
|
|
+ if (Array.isArray(obj)) {
|
|
|
|
+ pa = { content: obj }
|
|
|
|
+ } else {
|
|
|
|
+ pa = { content: [obj] }
|
|
|
|
+ }
|
|
|
|
+ createEquip(pa).then(res => {
|
|
|
|
+ if (res.result == 'success') {
|
|
|
|
+ this.$message.success('创建成功');
|
|
|
|
+ this.dialogVisible = false;
|
|
|
|
+ this.handleChangeDevice()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 重置
|
|
|
|
+ resetLocation() {
|
|
|
|
+ // @ts-ignore
|
|
|
|
+ this.$refs.deviceGraph.resetLocation()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 返回
|
|
|
|
+ goBack() {
|
|
|
|
+ this.displayLocation = false
|
|
|
|
+ }
|
|
|
|
+
|
|
@Watch("deviceType", { immediate: true, deep: true })
|
|
@Watch("deviceType", { immediate: true, deep: true })
|
|
handleDeviceMsg() {
|
|
handleDeviceMsg() {
|
|
this.deviceVal = this.deviceType
|
|
this.deviceVal = this.deviceType
|
|
@@ -544,7 +644,8 @@ $border: 1px solid #E1E7EA;
|
|
|
|
|
|
.el-dialog {
|
|
.el-dialog {
|
|
.el-dialog__body {
|
|
.el-dialog__body {
|
|
- max-height: 500px !important;
|
|
|
|
|
|
+ padding: 20px;
|
|
|
|
+ max-height: 643px !important;
|
|
min-height: 100px;
|
|
min-height: 100px;
|
|
overflow-y: auto;
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
overflow-x: hidden;
|