台账管理
parent
8071152134
commit
7293f890f8
@ -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>
|
Loading…
Reference in New Issue