台账管理

master
fanluyan 1 year ago
parent 8071152134
commit 7293f890f8

@ -71,6 +71,14 @@ const routes = [
title: "主设备",
},
},
{
path: "/equipment/jcsb",
component: () => import("../views/equipment/jcsb/index.vue"),
name: "jcsb",
meta: {
title: "监测设备",
},
},
{
path: "/equipment/modevtype",
component: () => import("../views/equipment/modevtype/index.vue"),

@ -308,3 +308,44 @@ export function modevtypeListAllApi(data) {
},
});
}
//监测设备相关接口
//新增
export function modevAddApi(data) {
return request({
url: "/modev/add",
method: "post",
data,
});
}
//修改更新
export function modevUpdateApi(data) {
return request({
url: "/modev/update",
method: "post",
data,
});
}
//删除
export function modevDeleteApi(data) {
return request({
url: "/modev/delete",
method: "post",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//查询全部
export function modevListAllApi(data) {
return request({
url: "/modev/listAll",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}

@ -56,7 +56,6 @@ export default {
//
getdataform(val) {
console.log(val);
this.formInfo = JSON.parse(JSON.stringify(val));
},
submitForm() {
@ -102,6 +101,13 @@ export default {
},
display() {
this.bdzDialogshow = true;
if (this.title == "添加电站") {
this.formInfo.mc = "";
this.formInfo.coordinate = "";
this.formInfo.voltagegrade = "";
this.formInfo.scale = "";
this.formInfo.note = "";
}
},
hide() {
this.bdzDialogshow = false;

@ -1,7 +1,7 @@
<template>
<div class="bdzBox">
<div class="reportHead">
<h3>电站管理</h3>
<h3>电站管理</h3>
</div>
<div class="page-body">
<el-button type="primary" icon="el-icon-plus" @click="handleAddClick"

@ -25,7 +25,7 @@ export default {
activeIndex: 0,
navlist: [
{
name: "电站管理",
name: "电站管理",
path: "/equipment/bdz",
},
{

@ -0,0 +1,155 @@
<template>
<div class="jcsbAddBox">
<el-dialog
class="jcsbAddDialogBox"
:title="title"
:visible.sync="jcsbDialogshow"
width="520px"
>
<el-form
label-position="left"
ref="formInfo"
label-width="104px"
:rules="rules"
:model="formInfo"
>
<el-form-item label="设备名称:" prop="name">
<el-input v-model="formInfo.name"></el-input>
</el-form-item>
<el-form-item label="设备类型:">
<el-select v-model="formInfo.modevtid">
<el-option
v-for="item in modevtypeOptions"
:key="item.id"
:label="item.mc"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-form>
<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 {
modevAddApi,
modevUpdateApi,
modevtypeListAllApi,
} from "@/utils/api/index";
export default {
props: ["title"],
data() {
return {
jcsbDialogshow: false,
formInfo: {
name: "",
modevtid: "",
},
rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
},
modevtypeOptions: [],
zsbInfo: "",
};
},
created() {},
mounted() {
this.$nextTick(() => {
this.zsbInfo = JSON.parse(localStorage.getItem("zsbInfo"));
console.log(this.zsbInfo);
});
},
watch: {},
methods: {
//
getdataform(val) {
console.log(val);
this.formInfo = JSON.parse(JSON.stringify(val));
},
submitForm() {
this.$refs.formInfo.validate((valid) => {
if (valid) {
if (this.title == "添加监测设备") {
console.log(this.formInfo);
this.$set(this.formInfo, "zsbid", this.zsbInfo.id);
modevAddApi(this.formInfo)
.then((res) => {
if (res.success) {
this.$message({
duration: 1500,
showClose: true,
message: "添加成功",
type: "success",
});
this.hide();
this.$parent.getjcsbAllList(); //
}
})
.catch((err) => {});
} else {
this.$set(this.formInfo, "zsbid", this.zsbInfo.id);
console.log(this.formInfo);
modevUpdateApi(this.formInfo)
.then((res) => {
if (res.success) {
this.$message({
duration: 1500,
showClose: true,
message: "修改成功",
type: "success",
});
this.hide();
this.$parent.getjcsbAllList(); //
}
})
.catch((err) => {});
}
} else {
console.log("error submit!!");
return false;
}
});
},
//
getmodevtypeListAll() {
modevtypeListAllApi()
.then((res) => {
console.log(res);
this.modevtypeOptions = res.data;
console.log(this.title);
if (this.title == "添加监测设备") {
console.log(this.formInfo);
this.formInfo.modevtid = this.modevtypeOptions[0].id;
this.formInfo.name = "";
}
})
.catch((err) => {
console.log(err); //
});
},
display() {
this.jcsbDialogshow = true;
this.getmodevtypeListAll();
},
hide() {
this.jcsbDialogshow = false;
this.$refs.formInfo.resetFields(); //
},
},
};
</script>
<style lang="less">
.jcsbAddBox {
.jcsbAddDialogBox {
.el-select {
width: 376px;
}
}
}
</style>

@ -0,0 +1,169 @@
<template>
<div class="jcsbBox">
<div class="reportHead">
<!-- <h3>监测设备管理</h3> -->
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/equipment/zsb' }"
>主设备管理</el-breadcrumb-item
>
<el-breadcrumb-item>监测设备管理</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="page-body">
<el-button type="primary" icon="el-icon-plus" @click="handleAddClick"
>添加监测设备</el-button
>
<div class="jcsbTableBox">
<el-table
v-loading="jcsbLoading"
:data="jcsbTableData"
stripe
border
style="width: 100%"
height="calc(100% - 0px)"
>
<el-table-column prop="id" label="ID"> </el-table-column>
<el-table-column prop="name" label="名称"> </el-table-column>
<el-table-column prop="modevtname" label="类型"> </el-table-column>
<el-table-column prop="zsbname" label="主设备"> </el-table-column>
<el-table-column label="操作" width="200" class-name="editClass">
<template slot-scope="scope">
<el-link
type="primary"
@click="handleEditClick(scope.row)"
size="small"
icon="el-icon-document"
>编辑</el-link
>
<el-link
type="danger"
@click="handleDeleteClick(scope.row)"
size="small"
icon="el-icon-delete"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</div>
</div>
<addjcsbDialog ref="jcsbAddRef" :title="title"></addjcsbDialog>
</div>
</template>
<script>
import { modevDeleteApi, modevListAllApi } from "@/utils/api/index";
import addjcsbDialog from "./components/addjcsbDialog";
export default {
components: {
addjcsbDialog,
},
data() {
return {
jcsbLoading: false,
jcsbTableData: [],
title: "",
zsbInfo: "",
};
},
created() {},
mounted() {
this.$nextTick(() => {
this.zsbInfo = JSON.parse(localStorage.getItem("zsbInfo"));
this.getjcsbAllList();
});
},
watch: {},
methods: {
//
getjcsbAllList() {
this.jcsbLoading = true;
modevListAllApi({ zsbid: this.zsbInfo.id })
.then((res) => {
console.log(res);
this.jcsbTableData = res.data;
this.jcsbLoading = false;
})
.catch((err) => {
console.log(err); //
});
},
//
handleAddClick() {
this.title = "添加监测设备";
this.$refs.jcsbAddRef.display();
//this.$refs.jcsbAddRef.getdataform(null);
},
//
handleEditClick(data) {
this.title = "编辑";
this.$refs.jcsbAddRef.display();
this.$refs.jcsbAddRef.getdataform(data);
},
//
handleDeleteClick(data) {
this.$confirm("确定要删除记录吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
modevDeleteApi({ id: data.id }).then((res) => {
if (res.success) {
this.$message({
duration: 1500,
showClose: true,
type: "success",
message: "删除成功",
});
this.getjcsbAllList(); //
} else {
this.$message.error(res.data);
}
});
})
.catch(() => {});
},
},
};
</script>
<style lang="less">
.jcsbBox {
width: 100%;
height: 100%;
.reportHead {
font-size: 14px;
color: #fff;
font-weight: normal;
height: 40px;
line-height: 40px;
.el-breadcrumb {
span {
font-size: 14px;
color: #fff;
font-weight: normal;
}
.el-breadcrumb__inner.is-link:hover {
color: #337ab7;
}
.el-breadcrumb__item:last-child .el-breadcrumb__inner {
color: #999;
}
.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover {
color: #999;
cursor: default;
}
}
}
.page-body {
width: calc(100% - 24px);
height: calc(100% - 74px);
padding: 12px;
background: #eee;
.jcsbTableBox {
margin-top: 8px;
height: calc(100% - 38px);
box-shadow: 1px 0 10px 1px rgba(0, 0, 0, 0.3);
}
}
}
</style>

@ -45,7 +45,9 @@ export default {
data() {
return {
modevtypeDialogshow: false,
formInfo: {},
formInfo: {
mc: "",
},
rules: {
mc: [{ required: true, message: "请输入名称", trigger: "blur" }],
},
@ -122,6 +124,11 @@ export default {
.then((res) => {
console.log(res);
this.tableOptions = res.data;
if (this.title == "添加监测类型") {
console.log(this.formInfo);
this.formInfo.tablename = this.tableOptions[0];
this.formInfo.mc = "";
}
})
.catch((err) => {
console.log(err); //

@ -111,6 +111,7 @@ export default {
if (this.title == "添加区域") {
console.log(this.formInfo);
this.formInfo.bdzid = this.bdzOptions[0].id;
this.formInfo.mc = "";
}
})
.catch((err) => {

@ -90,6 +90,9 @@ export default {
},
display() {
this.sblxDialogshow = true;
if (this.title == "添加设备类型") {
this.formInfo.mc = "";
}
},
hide() {
this.sblxDialogshow = false;

@ -21,8 +21,14 @@
<el-table-column prop="lxName" label="设备类型"> </el-table-column>
<el-table-column prop="jgName" label="所属间隔"> </el-table-column>
<el-table-column prop="mc" label="设备名称"> </el-table-column>
<el-table-column label="操作" width="200" class-name="editClass">
<el-table-column label="操作" width="260" class-name="editClass">
<template slot-scope="scope">
<el-link
type="primary"
@click="handlejcsbClick(scope.row)"
size="small"
>监测设备</el-link
>
<el-link
type="primary"
@click="handleEditClick(scope.row)"
@ -114,6 +120,14 @@ export default {
})
.catch(() => {});
},
//
handlejcsbClick(data) {
console.log(data);
console.log("带参数跳转");
this.$router.push({ name: "jcsb" }).then(() => {
localStorage.setItem("zsbInfo", JSON.stringify(data));
});
},
},
};
</script>

Loading…
Cancel
Save