添加功能

master
fanluyan 1 year ago
parent f2863c5283
commit cfa6f732f1

@ -311,7 +311,7 @@ export function sblxListAllApi(data) {
//新增
export function modevtypeAddApi(data) {
return request({
url: "/nsensor/add",
url: "/modevtype/add",
method: "post",
data,
});
@ -320,7 +320,7 @@ export function modevtypeAddApi(data) {
//修改更新
export function modevtypeUpdateApi(data) {
return request({
url: "/nsensor/update",
url: "/modevtype/update",
method: "post",
data,
});
@ -328,7 +328,7 @@ export function modevtypeUpdateApi(data) {
//删除
export function modevtypeDeleteApi(data) {
return request({
url: "/nsensor/delete",
url: "/modevtype/delete",
method: "post",
params: data,
headers: {
@ -570,3 +570,36 @@ export function batchUpdateApi(data) {
data,
});
}
//属性相关接口
//新增
export function modevtypepointAddApi(data) {
return request({
url: "/modevtypepoint/add",
method: "post",
data,
});
}
//列表/modevtypepoint/listAll
export function modevtypepointListApi(data) {
return request({
url: "/modevtypepoint/listAll",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
// //删除
export function modevtypepointDeleteApi(data) {
return request({
url: "/modevtypepoint/delete",
method: "post",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}

@ -136,16 +136,23 @@
:data="tableData"
border
stripe
style="width: 100%"
height="calc(100% - 40px)"
>
<!-- <el-table-column type="index" width="50"> </el-table-column> -->
<el-table-column prop="acquisitionTime" label="采集时间">
<el-table-column
prop="acquisitionTime"
label="采集时间"
width="148"
>
</el-table-column>
<el-table-column
min-width="120"
v-for="(column, index) in columns"
:key="index"
:label="column.fieldDesc + '' + column.unit + ''"
:label="
column.fieldDesc +
(column.unit == null ? '' : '(' + column.unit + ')')
"
:prop="column.field"
></el-table-column>
</el-table>
@ -337,7 +344,9 @@ export default {
this.currentId = data.id;
this.page = 1;
this.pageSize = 20;
this.handleSearch();
// this.handleSearch();
//
this.getAllTimeTable();
},
changestartdate(val) {
console.log(val);
@ -366,6 +375,37 @@ export default {
this.formdata.endtime = val;
}
},
getAllTimeTable() {
getDetailApi({
id: this.currentId,
pageNum: this.page,
pageSize: this.pageSize,
})
.then((res) => {
console.log(res);
if (res.success) {
console.log(res.data.content[0].acquisitionTime);
this.formdata.endtime = res.data.content[0].acquisitionTime;
const thirtyDaysAgo = new Date(this.formdata.endtime);
this.$set(
this.formdata,
"starttime",
new Date(thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30))
);
this.handleSearch();
} else {
this.tableData = [];
this.$message({
showClose: true,
message: res.errorMsg,
type: "error",
});
}
})
.catch((err) => {
console.log(err); //
});
},
//
handleSearch() {
//

@ -40,10 +40,10 @@ export default {
name: "设备类型管理",
path: "/equipment/sblx",
},
// {
// name: "",
// path: "/equipment/modevtype",
// },
{
name: "监测设备类型管理",
path: "/equipment/modevtype",
},
{
name: "监测设备管理",
path: "/equipment/monitoring",

@ -23,17 +23,16 @@
<el-form-item label="相位:" prop="phase">
<el-input v-model="formInfo.phase"></el-input>
</el-form-item>
<el-form-item label="选择表名:">
<el-select v-model="formInfo.tableName" @change="changetablename">
<el-form-item label="devId" prop="devId">
<el-input v-model="formInfo.devId"></el-input>
</el-form-item>
<el-form-item label="选择类型:">
<el-select v-model="formInfo.typeId" @change="changetypeId">
<el-option
v-for="item in tableOptions"
:key="item.name"
:label="item.name"
:value="item.name"
>
{{ item.name
}}<span v-if="item.comment != '' && item.comment != null"
>({{ item.comment }})</span
:key="item.id"
:label="item.mc"
:value="item.id"
>
</el-option>
</el-select>
@ -50,7 +49,11 @@
</div>
</template>
<script>
import { modevAddApi, modevUpdateApi, tableListApi } from "@/utils/api/index";
import {
modevAddApi,
modevUpdateApi,
modevtypeListAllApi,
} from "@/utils/api/index";
export default {
props: ["title"],
data() {
@ -60,11 +63,13 @@ export default {
zsbName: "",
name: "",
phase: "",
tableName: "",
typeId: "",
devId: "",
sensorCode: "",
},
rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
devId: [{ required: true, message: "请输入devId", trigger: "blur" }],
},
tableOptions: [],
zsbInfo: "",
@ -129,20 +134,20 @@ export default {
}
});
},
changetablename(val) {
changetypeId(val) {
console.log(val);
this.formInfo.tableName = val;
this.formInfo.typeId = val;
},
//
getTableListAll() {
tableListApi()
modevtypeListAllApi()
.then((res) => {
console.log(res);
this.tableOptions = res.data;
console.log(this.title);
if (this.title == "添加监测设备") {
console.log(this.formInfo);
this.formInfo.tableName = this.tableOptions[0].name;
this.formInfo.typeId = this.tableOptions[0].id;
}
})
.catch((err) => {

@ -28,14 +28,15 @@
<el-table-column prop="zsbname" label="主设备"> </el-table-column> -->
<el-table-column prop="id" label="ID" width="50"> </el-table-column>
<el-table-column prop="zsbName" label="主设备名称"> </el-table-column>
<el-table-column prop="devId" label="devId"> </el-table-column>
<el-table-column prop="name" label="名称"> </el-table-column>
<el-table-column prop="phase" label="相位"></el-table-column>
<el-table-column prop="tableName" label="表名"> </el-table-column>
<el-table-column prop="typeName" label="类型"> </el-table-column>
<el-table-column
prop="sensorCode"
label="传感器代码"
></el-table-column>
<el-table-column label="操作" class-name="editClass">
<el-table-column label="操作" class-name="editClass" width="260px">
<template slot-scope="scope">
<el-link
type="primary"
@ -44,6 +45,7 @@
icon="el-icon-document"
>编辑</el-link
>
<el-link
type="danger"
@click="handleDeleteClick(scope.row)"
@ -62,6 +64,7 @@
<script>
import { modevDeleteApi, monitoringListAllApi } from "@/utils/api/index";
import addjcsbDialog from "./components/addjcsbDialog";
export default {
components: {
addjcsbDialog,

@ -18,7 +18,11 @@
<el-input v-model="formInfo.mc"></el-input>
</el-form-item>
<el-form-item label="选择表名:">
<el-select v-model="formInfo.tablename" @change="changetablename">
<el-select
v-model="formInfo.tablename"
filterable
@change="changetablename"
>
<el-option
v-for="item in tableOptions"
:key="item.name"

@ -0,0 +1,266 @@
<template>
<div class="attributeList">
<el-dialog
class="attributesDialogBox"
title="属性配置"
:visible.sync="attributeshow"
width="620px"
:close-on-click-modal="false"
>
<div class="attBox" v-loading="attLoading">
<el-button
class="addAtt"
type="primary"
icon="el-icon-plus"
@click="handleAddAttClick"
>添加属性</el-button
>
<el-table
:data="attributesData"
stripe
border
style="width: 100%"
height="404px"
>
<el-table-column prop="field" label="字段名" width="180">
</el-table-column>
<el-table-column prop="fieldDesc" label="字段描述" width="180">
</el-table-column>
<el-table-column prop="unit" label="单位"> </el-table-column>
<el-table-column label="操作" class-name="editClass">
<template slot-scope="scope">
<el-link
type="danger"
@click="handleDeleteClick(scope.row)"
size="small"
icon="el-icon-delete"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</div>
<el-dialog
width="450px"
title="新增"
:visible.sync="innerVisible"
append-to-body
class="attaddDialog"
>
<el-form
label-position="left"
ref="formInfo"
label-width="104px"
:rules="rules"
:model="formInfo"
>
<el-form-item label="属性名:">
<el-select v-model="formInfo.name" @change="changeName">
<el-option
v-for="item in attOptions"
:key="item.name"
:label="item.name"
:value="item.name"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="属性描述:" prop="comment">
<el-input v-model="formInfo.comment"></el-input>
</el-form-item>
<!-- <el-form-item label="类型:">
<el-select v-model="formInfo.typeVal" @change="changeName">
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item> -->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="innerVisible = false"> </el-button>
<el-button type="primary" @click="submitAddForm()"> </el-button>
</div>
</el-dialog>
<div slot="footer" class="dialog-footer">
<!-- <el-button @click="hide"> </el-button> -->
<el-button type="primary" @click="submitForm()"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
modevtypepointAddApi,
modevtypepointListApi,
modevtypepointDeleteApi,
colListApi,
} from "@/utils/api/index";
export default {
props: ["title"],
data() {
return {
rowData: "",
attributeshow: false,
innerVisible: false,
attLoading: false,
attributesData: [],
attOptions: [],
typeOptions: [
{
value: 1,
label: "遥信",
},
{
value: 2,
label: "遥测",
},
],
formInfo: {
name: "",
comment: "",
//typeVal: 2,
},
rules: {},
};
},
created() {},
mounted() {},
watch: {},
methods: {
changeName(val) {
console.log(val);
this.formInfo.name = val;
console.log(this.attOptions.find((item) => item.name === val));
this.formInfo.comment = this.attOptions.find(
(item) => item.name === val
).comment;
},
display(val) {
//
this.rowData = val;
console.log(this.rowData);
this.attributeshow = true;
this.getListAll();
},
getListAll() {
this.attLoading = true;
modevtypepointListApi({
modevtypeId: this.rowData.id,
})
.then((res) => {
console.log(res);
this.attributesData = res.data;
this.attLoading = false;
})
.catch((err) => {
console.log(err); //
});
},
//
handleAddAttClick() {
this.innerVisible = true;
this.getcolList();
},
//colList
getcolList() {
colListApi({
tableName: this.rowData.tablename,
})
.then((res) => {
console.log(res);
this.attOptions = res.data;
this.formInfo.name = res.data[0].name;
this.formInfo.comment = res.data[0].comment;
})
.catch((err) => {
console.log(err); //
});
},
//
submitAddForm() {
console.log(this.formInfo);
modevtypepointAddApi({
modevtypeId: this.rowData.id,
field: this.formInfo.name,
fieldDesc: this.formInfo.comment,
//type: this.formInfo.typeVal,
})
.then((res) => {
console.log(res);
if (res.success) {
this.innerVisible = false;
this.getListAll();
} else {
this.$message({
duration: 1500,
showClose: true,
type: "error",
message: res.errorMsg,
});
}
})
.catch((err) => {
console.log(err); //
});
},
//
handleDeleteClick(val) {
console.log(val);
this.$confirm("确定要删除记录吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
modevtypepointDeleteApi({ id: val.id }).then((res) => {
if (res.success) {
this.$message({
duration: 1500,
showClose: true,
type: "success",
message: "删除成功",
});
this.getListAll(); //
} else {
this.$message({
duration: 1500,
showClose: true,
type: "error",
message: res.errorMsg,
});
}
});
})
.catch(() => {});
},
submitForm() {
this.attributeshow = false;
},
hide() {
this.attributeshow = false;
},
},
};
</script>
<style lang="less">
.attributeList {
.attributesDialogBox {
.attBox {
.addAtt {
margin-bottom: 16px;
}
}
}
}
.attaddDialog {
.el-select {
width: 306px;
}
}
</style>

@ -29,6 +29,13 @@
icon="el-icon-document"
>编辑</el-link
>
<el-link
type="primary"
@click="handleAttributeClick(scope.row)"
size="small"
icon="el-icon-document"
>属性配置</el-link
>
<el-link
type="danger"
@click="handleDeleteClick(scope.row)"
@ -45,14 +52,17 @@
ref="modevtypeAddRef"
:title="title"
></addmodevtypeDialog>
<attributeList ref="attRef"></attributeList>
</div>
</template>
<script>
import { modevtypeDeleteApi, modevtypeListAllApi } from "@/utils/api/index";
import addmodevtypeDialog from "./components/addmodevtypeDialog";
import attributeList from "./components/attributeList";
export default {
components: {
addmodevtypeDialog,
attributeList,
},
data() {
return {
@ -67,6 +77,10 @@ export default {
},
watch: {},
methods: {
//
handleAttributeClick(val) {
this.$refs.attRef.display(val);
},
//
getmodevtypeAllList() {
this.modevtypeLoading = true;

@ -1,9 +1,9 @@
<template>
<div class="monitoringAddBox">
<div class="jcsbAddBox">
<el-dialog
class="monitoringAddDialogBox"
class="jcsbAddDialogBox"
:title="title"
:visible.sync="monitoringDialogshow"
:visible.sync="jcsbDialogshow"
width="520px"
:close-on-click-modal="false"
>
@ -11,8 +11,8 @@
label-position="left"
ref="formInfo"
label-width="104px"
:model="formInfo"
:rules="rules"
:model="formInfo"
>
<el-form-item label="主设备名称:" prop="zsbName">
<el-input v-model="formInfo.zsbName"></el-input>
@ -23,17 +23,16 @@
<el-form-item label="相位:" prop="phase">
<el-input v-model="formInfo.phase"></el-input>
</el-form-item>
<el-form-item label="选择表名:">
<el-select v-model="formInfo.tablename" @change="changetablename">
<el-form-item label="devId" prop="devId">
<el-input v-model="formInfo.devId"></el-input>
</el-form-item>
<el-form-item label="选择类型:">
<el-select v-model="formInfo.typeId" @change="changetypeId">
<el-option
v-for="item in tableOptions"
:key="item.name"
:label="item.name"
:value="item.name"
>
{{ item.name
}}<span v-if="item.comment != '' && item.comment != null"
>({{ item.comment }})</span
:key="item.id"
:label="item.mc"
:value="item.id"
>
</el-option>
</el-select>
@ -51,45 +50,53 @@
</template>
<script>
import {
monitoringAddApi,
monitoringUpdateApi,
tableListApi,
modevAddApi,
modevUpdateApi,
modevtypeListAllApi,
} from "@/utils/api/index";
export default {
props: ["title"],
data() {
return {
monitoringDialogshow: false,
formInfo: "",
jcsbDialogshow: false,
formInfo: {
zsbName: "",
name: "",
phase: "",
typeId: "",
devId: "",
sensorCode: "",
},
rules: {
mc: [{ required: true, message: "请输入名称", trigger: "blur" }],
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
devId: [{ required: true, message: "请输入devId", trigger: "blur" }],
},
tableOptions: [],
zsbInfo: "",
};
},
created() {},
mounted() {},
mounted() {
this.$nextTick(() => {
this.zsbInfo = JSON.parse(localStorage.getItem("zsbInfo"));
console.log(this.zsbInfo);
this.formInfo.zsbName = this.zsbInfo.mc;
});
},
watch: {},
methods: {
//
getdataform(val) {
console.log(val);
if (val == null) {
this.formInfo = {
mc: "",
coordinate: "",
voltagegrade: "",
note: "",
};
} else {
this.formInfo = JSON.parse(JSON.stringify(val));
}
},
submitForm() {
this.$refs.formInfo.validate((valid) => {
if (valid) {
if (this.title == "添加监测设备") {
console.log(this.formInfo);
monitoringAddApi(this.formInfo)
this.$set(this.formInfo, "zsbId", this.zsbInfo.id);
modevAddApi(this.formInfo)
.then((res) => {
if (res.success) {
this.$message({
@ -100,18 +107,13 @@ export default {
});
this.hide();
this.$parent.getmonitoringAllList(); //
} else {
this.$message({
duration: 1500,
showClose: true,
message: res.errorMsg,
type: "error",
});
}
})
.catch((err) => {});
} else {
monitoringUpdateApi(this.formInfo)
this.$set(this.formInfo, "zsbId", this.zsbInfo.id);
console.log(this.formInfo);
modevUpdateApi(this.formInfo)
.then((res) => {
if (res.success) {
this.$message({
@ -122,13 +124,6 @@ export default {
});
this.hide();
this.$parent.getmonitoringAllList(); //
} else {
this.$message({
duration: 1500,
showClose: true,
message: res.errorMsg,
type: "error",
});
}
})
.catch((err) => {});
@ -139,38 +134,43 @@ export default {
}
});
},
changetypeId(val) {
console.log(val);
this.formInfo.typeId = val;
},
//
getTableListAll() {
modevtypeListAllApi()
.then((res) => {
console.log(res);
this.tableOptions = res.data;
console.log(this.title);
if (this.title == "添加监测设备") {
console.log(this.formInfo);
this.formInfo.typeId = this.tableOptions[0].id;
}
})
.catch((err) => {
console.log(err); //
});
},
display() {
this.monitoringDialogshow = true;
// if (this.title == "") {
// this.formInfo.mc = "";
// this.formInfo.coordinate = "";
// this.formInfo.voltagegrade = "";
// this.formInfo.scale = "";
// this.formInfo.note = "";
// }
this.jcsbDialogshow = true;
this.getTableListAll();
},
hide() {
//this.$refs.formInfo.resetFields(); //
this.monitoringDialogshow = false;
this.jcsbDialogshow = false;
this.$refs.formInfo.resetFields(); //
},
},
};
</script>
<style lang="less">
.monitoringAddBox {
.monitoringAddDialogBox {
.el-input-number--small {
width: 374px;
.el-input__inner {
text-align: left;
}
}
.jcsbAddBox {
.jcsbAddDialogBox {
.el-select {
width: 374px;
}
.el-input-number.is-controls-right[class*="small"] [class*="decrease"],
.el-input-number.is-controls-right[class*="small"] [class*="increase"] {
display: none;
width: 376px;
}
}
}

@ -54,28 +54,30 @@
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column prop="id" label="ID" width="50"> </el-table-column>
<!-- <el-table-column prop="id" label="ID" width="50"> </el-table-column> -->
<el-table-column prop="zsbName" label="主设备名称"> </el-table-column>
<el-table-column prop="devId" label="devId"> </el-table-column>
<el-table-column prop="name" label="名称"> </el-table-column>
<el-table-column
prop="phase"
label="相位"
width="50"
></el-table-column>
<el-table-column prop="tableName" label="表名" width="160">
<el-table-column prop="typeName" label="类型" width="160">
</el-table-column>
<el-table-column prop="sensorCode" label="传感器代码" width="160">
</el-table-column>
<el-table-column label="操作" width="90" class-name="editClass">
<el-table-column label="操作" width="260" class-name="editClass">
<template slot-scope="scope">
<!-- <el-link
<el-link
type="primary"
@click="handleEditClick(scope.row)"
size="small"
icon="el-icon-document"
>编辑</el-link
> -->
>
<el-link
type="danger"
@click="handleDeleteClick(scope.row)"
@ -100,25 +102,28 @@
</div>
</div>
<bindingDialog ref="bindingRef"></bindingDialog>
<!-- <addmonitoringDialog
<addmonitoringDialog
ref="monitoringAddRef"
:title="title"
></addmonitoringDialog> -->
></addmonitoringDialog>
</div>
</template>
<script>
import { monitoringListApi, modevDeleteApi } from "@/utils/api/index";
import bindingDialog from "./components/bindingDialog";
import addmonitoringDialog from "./components/addmonitoringDialog";
export default {
components: {
bindingDialog,
addmonitoringDialog,
},
data() {
return {
fileList: [], //
reportData: {},
multipleSelection: [],
title: "",
monitoringLoading: false,
monitoringTableData: [],
page: 1, //
@ -151,7 +156,7 @@ export default {
type: "success",
});
this.$refs.upload.clearFiles();
//this.$refs.upload.clearFiles();
this.getmonitoringAllList(); //iedName
} else {
this.$message({
@ -186,6 +191,14 @@ export default {
//console.log(this.multipleSelection);
this.$refs.bindingRef.display(this.multipleSelection);
},
//
handleEditClick(val) {
console.log(val);
this.title = "编辑";
this.$refs.monitoringAddRef.display();
this.$refs.monitoringAddRef.getdataform(val);
},
//
handleDeleteClick(data) {
this.$confirm("确定要删除记录吗?", "提示", {

@ -414,8 +414,8 @@ export default {
display: flex;
height: 100%;
.leftTree {
min-width: 220px;
max-width: 220px;
min-width: 380px;
max-width: 380px;
height: 100%;
overflow: auto;
//border: 1px solid #fff;

Loading…
Cancel
Save