|
@@ -2,7 +2,8 @@
|
|
|
<div class="adm-device">
|
|
|
<statistics :statistics-msg="statisticsMsg"/>
|
|
|
<div class="operation">
|
|
|
- <el-cascader :options="list" clearable v-model="deviceType" :props="optionProps" @change="changeLinshi"
|
|
|
+ <el-cascader :options="list" clearable v-model="deviceType" :props="optionProps"
|
|
|
+ @change="handleChangeDevice"
|
|
|
class="adm-select"></el-cascader>
|
|
|
<admSearch @SearchValue="SearchValue"/>
|
|
|
<el-button type="default" @click="addDevice" class="adm-btn">添加设备</el-button>
|
|
@@ -13,7 +14,6 @@
|
|
|
<el-tab-pane v-for="(item,index) in paneMsg" :key="index" :label="item" :name="index.toString()"/>
|
|
|
</el-tabs>
|
|
|
<div class="table" v-loading="loading">
|
|
|
-<!-- <template v-if="deviceType">-->
|
|
|
<template v-if="deviceType.length > 0">
|
|
|
<admMultiTable :currentHeader="currentHeader" :tableData="tableData" :headersStage="headersStage"/>
|
|
|
<Pagination v-if="tableData.length > 0" :paginationList="paginationList"
|
|
@@ -36,7 +36,7 @@
|
|
|
<template v-if="next">
|
|
|
<div class="align" style="height: 400px">
|
|
|
<span class="text ">设备类别</span>
|
|
|
- <el-cascader :options="list" clearable v-model="deviceVal" @change="changeLinshi"
|
|
|
+ <el-cascader :options="list" clearable v-model="deviceVal"
|
|
|
:props="optionProps"
|
|
|
class="adm-select"></el-cascader>
|
|
|
|
|
@@ -57,7 +57,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
-import { Component, Vue } from "vue-property-decorator";
|
|
|
+import { Component, Vue, Watch } from "vue-property-decorator";
|
|
|
import { AdmMultiTable, AdmSearch, dataForm, Pagination, Statistics } from '../components/index'
|
|
|
import { allDevice, BeatchQueryParam, dictInfo } from "@/api/equipComponent";
|
|
|
import { queryCount, queryEquip } from "@/api/datacenter";
|
|
@@ -70,6 +70,7 @@ import tools from "@/utils/maintain"
|
|
|
components: { Statistics, AdmSearch, AdmMultiTable, Pagination, dataForm }
|
|
|
})
|
|
|
export default class extends Vue {
|
|
|
+
|
|
|
optionProps = {
|
|
|
value: 'code',
|
|
|
label: 'name',
|
|
@@ -101,30 +102,30 @@ export default class extends Vue {
|
|
|
// 下拉数据
|
|
|
list = []
|
|
|
// 弹窗开关
|
|
|
- private dialogVisible = false
|
|
|
+ dialogVisible = false
|
|
|
// tabs数据
|
|
|
- private paneMsg = ['设计阶段维护', '施工阶段维护', '运维阶段维护']
|
|
|
+ paneMsg = ['设计阶段维护', '施工阶段维护', '运维阶段维护']
|
|
|
// 当前tabs值
|
|
|
- private activeName = ""
|
|
|
+ activeName = ""
|
|
|
// 分页
|
|
|
- private paginationList = {
|
|
|
+ paginationList = {
|
|
|
page: 1,
|
|
|
size: 50,
|
|
|
sizes: [10, 30, 50, 100, 150, 200],
|
|
|
total: 0
|
|
|
}
|
|
|
// 下一步
|
|
|
- private next = true
|
|
|
+ next = true
|
|
|
// 弹窗 title
|
|
|
- private deviceMsg = '添加设备'
|
|
|
+ deviceMsg = '添加设备'
|
|
|
// 默认当前阶段
|
|
|
- private currentHeader = this.paneMsg[0]
|
|
|
+ currentHeader = this.paneMsg[0]
|
|
|
// 主体数据
|
|
|
- private tableData = []
|
|
|
+ tableData = []
|
|
|
codeToDataSource = {}
|
|
|
-
|
|
|
+ dataFormList = {}
|
|
|
// 项目id
|
|
|
- private get projectId(): string {
|
|
|
+ get projectId(): string {
|
|
|
return UserModule.projectId
|
|
|
}
|
|
|
|
|
@@ -149,9 +150,7 @@ export default class extends Vue {
|
|
|
}
|
|
|
|
|
|
|
|
|
- // todo 临时假数据函数
|
|
|
- private changeLinshi(val) {
|
|
|
- console.log(this.deviceType, this.deviceType[1])
|
|
|
+ handleChangeDevice() {
|
|
|
if (this.deviceType[1]) {
|
|
|
this.loading = true
|
|
|
let param = {
|
|
@@ -189,56 +188,28 @@ export default class extends Vue {
|
|
|
this.headerInformation = {}
|
|
|
}
|
|
|
}
|
|
|
- private handleFilter(val) {
|
|
|
- console.log(this.deviceType)
|
|
|
- if (this.deviceType) {
|
|
|
- this.loading = true
|
|
|
+
|
|
|
+ async handleNext() {
|
|
|
+ if (this.deviceVal[1]) {
|
|
|
+ this.next = false
|
|
|
let param = {
|
|
|
- category: this.deviceType
|
|
|
- }
|
|
|
- let param2 = {
|
|
|
- filters: this.deviceType ? `classCode='${ this.deviceType }'` : undefined,
|
|
|
- pageNumber: this.paginationList.page,
|
|
|
- pageSize: this.paginationList.size,
|
|
|
- orders: "createTime desc, id asc",
|
|
|
- projectId: this.projectId
|
|
|
+ category: this.deviceVal[1]
|
|
|
}
|
|
|
- if (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 => {
|
|
|
- dictInfo(param).then(res => {
|
|
|
- resolve(res)
|
|
|
- })
|
|
|
- })
|
|
|
- let promise2 = new Promise(resolve => {
|
|
|
- queryEquip(param2).then(res => {
|
|
|
- resolve(res)
|
|
|
- })
|
|
|
- })
|
|
|
- Promise.all([promise, promise2]).then(res => {
|
|
|
- this.loading = false
|
|
|
- // 类型下信息点,默认设计阶段
|
|
|
- this.headerInformation = res[0] // 获取表头
|
|
|
- this.tableData = res[1].content // 主体数据
|
|
|
- this.headerStage()
|
|
|
- this.paginationList.total = res[1].total
|
|
|
+ await dictInfo(param).then(res => {
|
|
|
+ this.dataFormList = res
|
|
|
+
|
|
|
})
|
|
|
} else {
|
|
|
- this.headerInformation = {}
|
|
|
+ this.dataFormList = {}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
headerStage() {
|
|
|
- let header = []
|
|
|
+ let header: [] = []
|
|
|
if (Object.keys(this.headerInformation).length > 0) {
|
|
|
this.headerInformation.dictStages.forEach(item => {
|
|
|
if (this.currentHeader == item.name) {
|
|
|
item.infos && item.infos.forEach(val => header.push(val))
|
|
|
- // item.infos && item.infos.forEach(val => {
|
|
|
- // val.name = val.unit ? `${ val.name }(${ val.unit })` : val.name
|
|
|
- // header.push(val)
|
|
|
- // })
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -333,32 +304,22 @@ export default class extends Vue {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- //设备类筛选
|
|
|
- selectValue(val: string) {
|
|
|
- console.log(val, 3)
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
// 搜索
|
|
|
SearchValue(val: string) {
|
|
|
this.inputSearch = val
|
|
|
- // this.handleFilter(this.deviceType)
|
|
|
- this.changeLinshi(this.deviceType[1])
|
|
|
+ this.handleChangeDevice(this.deviceType[1])
|
|
|
}
|
|
|
|
|
|
// 当前分页
|
|
|
handleCurrentChange(val: number) {
|
|
|
console.log(val)
|
|
|
this.paginationList.page = val
|
|
|
- // this.handleFilter(this.deviceType)
|
|
|
- this.changeLinshi(this.deviceType[1])
|
|
|
+ this.handleChangeDevice(this.deviceType[1])
|
|
|
}
|
|
|
|
|
|
handleSizeChange(val: number) {
|
|
|
this.paginationList.size = val
|
|
|
- // this.handleFilter(this.deviceType)
|
|
|
- this.changeLinshi(this.deviceType[1])
|
|
|
+ this.handleChangeDevice(this.deviceType[1])
|
|
|
}
|
|
|
|
|
|
// 添加设备
|
|
@@ -366,12 +327,6 @@ export default class extends Vue {
|
|
|
this.dialogVisible = true
|
|
|
}
|
|
|
|
|
|
- //下一步事件
|
|
|
- handleNext() {
|
|
|
- if (this.deviceVal) {
|
|
|
- this.next = false
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
// 维护位置
|
|
|
handlePosition() {
|
|
@@ -381,8 +336,18 @@ export default class extends Vue {
|
|
|
// close
|
|
|
close() {
|
|
|
this.next = true
|
|
|
+ if (this.deviceType) {
|
|
|
+ this.deviceVal = this.deviceType
|
|
|
+ } else {
|
|
|
+ this.deviceVal = ''
|
|
|
+ }
|
|
|
this.displayLocation = false
|
|
|
}
|
|
|
+
|
|
|
+ @Watch("deviceType", { immediate: true, deep: true })
|
|
|
+ handleDeviceMsg() {
|
|
|
+ this.deviceVal = this.deviceType
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|