|
@@ -14,9 +14,11 @@
|
|
|
<div class="content">
|
|
|
<div v-loading="loading" class="table">
|
|
|
<template v-if="systemType.length > 0">
|
|
|
- <admMultiTable @handleCurrentEdit="handleCurrentEdit"
|
|
|
- :currentHeader="currentHeader"
|
|
|
- :headersStage="headersStage" :tableData="tableData"/>
|
|
|
+ <admMultiTable
|
|
|
+ @handleCurrentEdit="handleCurrentEdit"
|
|
|
+ :currentHeader="currentHeader"
|
|
|
+ :headersStage="headersStage"
|
|
|
+ :tableData="tableData"/>
|
|
|
<Pagination
|
|
|
:paginationList="paginationList"
|
|
|
@handleCurrentChange="handleCurrentChange"
|
|
@@ -32,7 +34,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 添加/编辑 系统-->
|
|
|
- <el-dialog :title=" systemMsg" :visible.sync="dialogVisible" @close="close">
|
|
|
+ <el-dialog :title="systemMsg" :visible.sync="dialogVisible" @close="close">
|
|
|
<template v-if="next">
|
|
|
<div class="align" style="height: 400px">
|
|
|
<span class="text">系统类别</span>
|
|
@@ -58,9 +60,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { Component, Vue } from "vue-property-decorator";
|
|
|
+import { Component, Vue, Watch } from "vue-property-decorator";
|
|
|
import { AdmMultiTable, AdmSearch, baseDataForm, Pagination, Statistics } from "../components/index";
|
|
|
-import { dictQuery, queryCountSystem, querySystem } from "@/api/datacenter";
|
|
|
+import { createSystem, dictQuery, queryCountSystem, querySystem, updateSystem } from "@/api/datacenter";
|
|
|
import tools from "@/utils/maintain";
|
|
|
import { UserModule } from "@/store/modules/user";
|
|
|
import { allSystem, BeatchQueryParam } from "@/api/equipComponent";
|
|
@@ -159,7 +161,7 @@ export default class extends Vue {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- if (param.data.length) {
|
|
|
+ if (param.data.length >0 ) {
|
|
|
BeatchQueryParam(param).then((res) => {
|
|
|
this.tableData = data.map((item) => {
|
|
|
res.data.map((child) => {
|
|
@@ -177,7 +179,10 @@ export default class extends Vue {
|
|
|
} else {
|
|
|
this.all.map((head) => {
|
|
|
if (head.code == child.infoCode) {
|
|
|
- tools.setDataForKey(item, head.path, child.error);
|
|
|
+ tools.setDataForKey(item, head.path, child.error ? child.value
|
|
|
+ ? "表号功能号格式错误"
|
|
|
+ : "表号功能号不存在"
|
|
|
+ : "暂未采集到实时数据");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -208,23 +213,31 @@ export default class extends Vue {
|
|
|
|
|
|
// 添加设备
|
|
|
addDevice() {
|
|
|
+ this.systemMsg = '添加系统'
|
|
|
+ this.currRowContent = {}
|
|
|
this.dialogVisible = true;
|
|
|
}
|
|
|
|
|
|
//下一步事件
|
|
|
async handleNext() {
|
|
|
- if (this.systemVal[1] || this.systemType[1]) {
|
|
|
+ if (this.systemVal[1]) {
|
|
|
this.next = false
|
|
|
let param = {
|
|
|
- type: this.systemVal[1] || this.systemType[1],
|
|
|
+ type: this.systemVal[1],
|
|
|
orders: "sort asc, name desc",
|
|
|
};
|
|
|
|
|
|
await dictQuery(param).then(res => {
|
|
|
let { basicInfos, dictStages } = this.informationArrangement(res.content)
|
|
|
// 添加系统分类
|
|
|
- dictStages = dictStages.map((item) => {
|
|
|
+ let pic = [], base = []
|
|
|
+ dictStages.map((item) => {
|
|
|
item = { ...item, classification: this.systemLabel };
|
|
|
+ if (item.dataType == 'ATTACHMENT') {
|
|
|
+ pic.push(item)
|
|
|
+ } else {
|
|
|
+ base.push(item)
|
|
|
+ }
|
|
|
return item;
|
|
|
});
|
|
|
this.systemHeaders = {
|
|
@@ -234,7 +247,7 @@ export default class extends Vue {
|
|
|
},
|
|
|
dictStages: {
|
|
|
name: "运维阶段",
|
|
|
- data: dictStages,
|
|
|
+ data: pic.length > 0 ? [...base, ...pic] : [...base],
|
|
|
},
|
|
|
};
|
|
|
})
|
|
@@ -245,12 +258,18 @@ export default class extends Vue {
|
|
|
|
|
|
// close
|
|
|
close() {
|
|
|
+ if (this.systemType) {
|
|
|
+ this.systemVal = this.systemType
|
|
|
+ } else {
|
|
|
+ this.systemVal = ''
|
|
|
+ }
|
|
|
this.next = true;
|
|
|
}
|
|
|
|
|
|
// 编辑当前行
|
|
|
handleCurrentEdit(val) {
|
|
|
this.next = false
|
|
|
+ this.systemMsg = '编辑系统'
|
|
|
this.currRowContent = val
|
|
|
this.handleNext()
|
|
|
this.dialogVisible = true
|
|
@@ -275,7 +294,7 @@ export default class extends Vue {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private changeSystemList() {
|
|
|
+ changeSystemList() {
|
|
|
if (this.systemType[1]) {
|
|
|
let systemLabel = this.$refs["floorCascader"].getCheckedNodes()[0].pathLabels;
|
|
|
this.systemLabel = systemLabel[1];
|
|
@@ -288,7 +307,7 @@ export default class extends Vue {
|
|
|
filters: this.systemType[1] ? `classCode='${ this.systemType[1] }'` : undefined,
|
|
|
pageNumber: this.paginationList.page,
|
|
|
pageSize: this.paginationList.size,
|
|
|
- orders: "createTime desc, id asc",
|
|
|
+ orders: "createTime asc, id asc",
|
|
|
projectId: this.projectId,
|
|
|
};
|
|
|
if (this.inputSearch != "") {
|
|
@@ -309,8 +328,6 @@ export default class extends Vue {
|
|
|
this.loading = false;
|
|
|
// 类型下信息点,重组数据
|
|
|
let { basicInfos, dictStages } = this.informationArrangement(res[0].content)
|
|
|
-
|
|
|
-
|
|
|
this.headersStage = {
|
|
|
basicInfos: {
|
|
|
name: "基础信息台账",
|
|
@@ -350,10 +367,39 @@ export default class extends Vue {
|
|
|
}
|
|
|
|
|
|
// 添加/编辑 事件处理
|
|
|
- handleDataForm() {
|
|
|
- console.log(this.$refs.baseDataForm.form)
|
|
|
+ async handleDataForm() {
|
|
|
+ let from = tools.formatData(this.$refs.baseDataForm.form)
|
|
|
+ //编辑
|
|
|
+ if (Object.keys(this.currRowContent).length > 0) {
|
|
|
+ let param = {
|
|
|
+ content: [from]
|
|
|
+ }
|
|
|
+ updateSystem(param).then(res => {
|
|
|
+ res.result == 'success' && this.$message.success('更新成功')
|
|
|
+ this.dialogVisible = false
|
|
|
+ setTimeout(() => this.changeSystemList())
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ //添加
|
|
|
+ from = {
|
|
|
+ ...from,
|
|
|
+ classCode: this.systemVal[1]
|
|
|
+ }
|
|
|
+ let param = {
|
|
|
+ content: [from]
|
|
|
+ }
|
|
|
+ createSystem(param).then(res => {
|
|
|
+ res.result == 'success' && this.$message.success('添加成功')
|
|
|
+ this.dialogVisible = false
|
|
|
+ this.changeSystemList()
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ @Watch("systemType", { immediate: true, deep: true })
|
|
|
+ handleDeviceMsg() {
|
|
|
+ this.systemVal = this.systemType
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|