Browse Source

防汛备用电源完成

master_tdsql
xzt 1 year ago
parent
commit
e63bfda22a
  1. 53
      src/api/yg/bydy.js
  2. 53
      src/api/yg/bydyzb.js
  3. 414
      src/views/safetyManage/floodControlManagement/sluice/components/pRTable.vue
  4. 452
      src/views/safetyManage/floodControlManagement/sluice/components/powerList.vue
  5. 230
      src/views/safetyManage/floodControlManagement/sluice/components/powerRecords.vue
  6. 499
      src/views/safetyManage/floodControlManagement/sluice/power.vue
  7. 1
      src/views/safetyManage/floodControlManagement/sluice/preplan.vue

53
src/api/yg/bydy.js

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询水闸备用电源信息列表
export function listBydy(query) {
return request({
url: '/sz/bydy/list',
method: 'post',
data: query
})
}
// 查询水闸备用电源信息详细
export function getBydy(id) {
return request({
url: '/sz/bydy/' + id,
method: 'get'
})
}
// 新增水闸备用电源信息
export function addBydy(data) {
return request({
url: '/sz/bydy',
method: 'post',
data: data
})
}
// 修改水闸备用电源信息
export function updateBydy(data) {
return request({
url: '/sz/bydy',
method: 'put',
data: data
})
}
// 删除水闸备用电源信息
export function delBydy(id) {
return request({
url: '/sz/bydy/' + id,
method: 'delete'
})
}
// 导出水闸备用电源信息
export function exportBydy(query) {
return request({
url: '/sz/bydy/export',
method: 'get',
params: query
})
}

53
src/api/yg/bydyzb.js

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询水闸备用电源主列表
export function listBydyzb(query) {
return request({
url: '/bydyzb/list',
method: 'post',
data: query
})
}
// 查询水闸备用电源主详细
export function getBydyzb(id) {
return request({
url: '/bydyzb/' + id,
method: 'get'
})
}
// 新增水闸备用电源主
export function addBydyzb(data) {
return request({
url: '/bydyzb',
method: 'post',
data: data
})
}
// 修改水闸备用电源主
export function updateBydyzb(data) {
return request({
url: '/bydyzb',
method: 'put',
data: data
})
}
// 删除水闸备用电源主
export function delBydyzb(id) {
return request({
url: '/bydyzb/' + id,
method: 'delete'
})
}
// 导出水闸备用电源主
export function exportBydyzb(query) {
return request({
url: '/bydyzb/export',
method: 'get',
params: query
})
}

414
src/views/safetyManage/floodControlManagement/sluice/components/pRTable.vue

@ -0,0 +1,414 @@
<template>
<div>
<div class="listTitle">
<span>{{ recordsType }}</span>
<span class="addBtn" @click="handleAdd">
<i class="el-icon-plus"></i>
添加
</span>
</div>
<el-table v-loading="loading" :data="tableList">
<el-table-column
label="序号"
type="index"
width="50"
align="center"
fixed
/>
<!-- <el-table-column
label="电源id"
align="center"
prop="powerId"
min-width="120"
/>
<el-table-column
label="类型"
align="center"
prop="type"
min-width="120"
/> -->
<el-table-column
label="负责人名称"
align="center"
prop="personName"
min-width="120"
/>
<el-table-column
label="描述"
align="center"
prop="describe"
min-width="120"
/>
<el-table-column
label="试运行日期"
align="center"
prop="time"
min-width="120"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.time, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
width="180"
fixed="right"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['syxjl:syxjl:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['syxjl:syxjl:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改水闸备用电源试运行记录对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="800px"
append-to-body
:close-on-click-modal="false"
>
<el-form ref="form" :model="form" :rules="rules" label-width="96px">
<!-- <el-form-item label="电源id" prop="powerId">
<el-input v-model="form.powerId" placeholder="请输入电源id" />
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="form.type" placeholder="请选择类型">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item> -->
<el-form-item label="负责人名称" prop="personName">
<el-input v-model="form.personName" placeholder="请输入负责人名称" />
</el-form-item>
<el-form-item label="试运行日期" prop="time">
<el-date-picker
clearable
size="small"
style="width: 100%"
v-model="form.time"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择试运行日期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="描述" prop="describe">
<el-input
v-model="form.describe"
placeholder="请输入描述"
type="textarea"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listSyxjl,
getSyxjl,
delSyxjl,
addSyxjl,
updateSyxjl,
exportSyxjl,
} from "@/api/yg/syxjl";
export default {
name: "Syxjl",
props: ["activeName", "powerId"],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
syxjlList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
ids: null,
data: {
powerId: null,
type: null,
personName: null,
describe: null,
time: null,
createUid: null,
updateUid: null,
owerDept: null,
relation: null,
},
//
params: {
//
orderBy: "create_time",
// descasc
sortBy: "desc",
},
},
//
form: {},
//
rules: {},
};
},
computed: {
recordsType() {
if (this.activeName === "daily") {
return "日常";
} else if (this.activeName === "beforeFlood") {
return "汛前";
} else if (this.activeName === "afterFlood") {
return "汛后";
}
},
tableList() {
let list = [];
if (this.activeName === "daily") {
list = this.syxjlList.filter((res) => res.type == "0");
return list;
} else if (this.activeName === "beforeFlood") {
list = this.syxjlList.filter((res) => res.type == "1");
return list;
} else if (this.activeName === "afterFlood") {
list = this.syxjlList.filter((res) => res.type == "2");
return list;
}
},
recordsTypeCode() {
if (this.activeName === "daily") {
return "0";
} else if (this.activeName === "beforeFlood") {
return "1";
} else if (this.activeName === "afterFlood") {
return "2";
}
},
},
created() {
this.getList();
},
methods: {
/** 查询水闸备用电源试运行记录列表 */
getList() {
this.loading = true;
this.queryParams.data.powerId = this.powerId;
// this.queryParams.data.type = this.recordsTypeCode;
listSyxjl(this.queryParams).then((response) => {
this.syxjlList = response.records;
// this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
powerId: null,
type: null,
personName: null,
describe: null,
time: null,
createUid: null,
updateUid: null,
createTime: null,
updateTime: null,
owerDept: null,
remark: null,
relation: null,
};
this.resetForm("form");
},
//
resetQueryForm() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
data: {
id: null,
powerId: null,
type: null,
personName: null,
describe: null,
time: null,
createUid: null,
updateUid: null,
createTime: null,
updateTime: null,
owerDept: null,
remark: null,
relation: null,
},
//
params: {
//
orderBy: "create_time",
// descasc
sortBy: "desc",
},
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetQueryForm();
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加水闸备用电源试运行记录";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getSyxjl(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改水闸备用电源试运行记录";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateSyxjl(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
this.form.powerId = this.powerId;
this.form.type = this.recordsTypeCode;
addSyxjl(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
if (ids) {
this.$confirm("是否删除选中的数据?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return delSyxjl(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {});
} else {
this.$message.warning("请选择要删除的数据!!");
}
},
},
};
</script>
<style lang="scss" scoped>
@import "@/assets/css/dialog.scss";
::v-deep {
.el-dialog {
margin-top: 30vh !important;
}
}
.listTitle {
font-size: 14px;
padding-left: 10px;
padding-right: 30px;
margin: 20px 0;
border-left: 2px solid #36b29e;
display: flex;
justify-content: space-between;
span:nth-child(1) {
font-weight: bold;
}
.addBtn {
color: #36b29e;
cursor: pointer;
}
.addBtn:hover {
color: #31a08e;
}
}
.listTitle:nth-child(1) {
margin-top: 0;
}
</style>

452
src/views/safetyManage/floodControlManagement/sluice/components/powerList.vue

@ -0,0 +1,452 @@
<template>
<div style="padding: 10px">
<div class="listTitle">
<span>备用电源信息</span>
<span class="addBtn" @click="handleAdd">
<i class="el-icon-plus"></i>
添加
</span>
</div>
<el-table v-loading="loading" :data="bydyList">
<el-table-column
label="序号"
type="index"
width="50"
align="center"
fixed
/>
<el-table-column
label="备用电源名称"
align="center"
prop="backupPowerName"
min-width="120"
/>
<el-table-column
label="电源功率"
align="center"
prop="powerSupplyPower"
min-width="120"
/>
<el-table-column
label="采购时间"
align="center"
prop="procurementTime"
min-width="120"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.procurementTime, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column
label="负责人名称"
align="center"
prop="personName"
min-width="120"
/>
<el-table-column
label="负责人电话"
align="center"
prop="personPhone"
min-width="120"
/>
<el-table-column
label="负责人职务"
align="center"
prop="personLevel"
min-width="120"
/>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
width="180"
fixed="right"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['sz:bydy:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['sz:bydy:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改水闸备用电源信息对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="800px"
append-to-body
:close-on-click-modal="false"
>
<el-row :gutter="15">
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-col :span="12">
<el-form-item label="备用电源名称" prop="backupPowerName">
<el-input
v-model="form.backupPowerName"
placeholder="请输入备用电源名称"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="电源功率" prop="powerSupplyPower">
<el-input
v-model="form.powerSupplyPower"
placeholder="请输入电源功率"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="采购时间" prop="procurementTime">
<el-date-picker
clearable
size="small"
style="width: 100%"
v-model="form.procurementTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择采购时间"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="负责人名称" prop="personName">
<el-input
v-model="form.personName"
placeholder="请输入负责人名称"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="负责人电话" prop="personPhone">
<el-input
v-model="form.personPhone"
placeholder="请输入负责人电话"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="负责人职务" prop="personLevel">
<el-input
v-model="form.personLevel"
placeholder="请输入负责人职务"
/>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listBydy,
getBydy,
delBydy,
addBydy,
updateBydy,
exportBydy,
} from "@/api/yg/bydy";
export default {
name: "Bydy",
props: ["prowerTypeId"],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
bydyList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
ids: null,
data: {
bydyzbId: null,
wagaId: null,
backupPowerName: null,
wagaName: null,
powerSupplyPower: null,
procurementTime: null,
personName: null,
personPhone: null,
personLevel: null,
createUid: null,
updateUid: null,
owerDept: null,
relation: null,
},
//
params: {
//
orderBy: "create_time",
// descasc
sortBy: "desc",
},
},
//
form: {},
//
rules: {
backupPowerName: [
{ required: true, message: "请输入备用电源名称", trigger: "blur" },
],
powerSupplyPower: [
{ required: true, message: "请输入电源功率", trigger: "blur" },
{
pattern:
/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
message: "请输入数字,可保留两位小数",
trigger: "blur",
},
],
procurementTime: [
{ required: true, message: "选择采购时间", trigger: "blur" },
],
personName: [
{ required: true, message: "请输入负责人名称", trigger: "blur" },
],
personPhone: [
{ required: true, message: "请输入负责人电话", trigger: "blur" },
{
pattern:
/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/,
message: "手机号格式不正确",
trigger: "blur",
},
],
personLevel: [
{ required: true, message: "请输入负责人职务", trigger: "blur" },
],
},
};
},
created() {
this.getList();
},
methods: {
/** 查询水闸备用电源信息列表 */
getList() {
this.loading = true;
this.queryParams.data.bydyzbId = this.prowerTypeId;
listBydy(this.queryParams).then((response) => {
this.bydyList = response.records;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
wagaId: null,
backupPowerName: null,
wagaName: null,
powerSupplyPower: null,
procurementTime: null,
personName: null,
personPhone: null,
personLevel: null,
createUid: null,
updateUid: null,
createTime: null,
updateTime: null,
owerDept: null,
remark: null,
relation: null,
};
this.resetForm("form");
},
//
resetQueryForm() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
data: {
id: null,
wagaId: null,
backupPowerName: null,
wagaName: null,
powerSupplyPower: null,
procurementTime: null,
personName: null,
personPhone: null,
personLevel: null,
createUid: null,
updateUid: null,
createTime: null,
updateTime: null,
owerDept: null,
remark: null,
relation: null,
},
//
params: {
//
orderBy: "create_time",
// descasc
sortBy: "desc",
},
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetQueryForm();
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加水闸备用电源信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getBydy(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改水闸备用电源信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateBydy(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
this.form.bydyzbId = this.prowerTypeId;
addBydy(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
if (ids) {
this.$confirm("是否删除选中的数据?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return delBydy(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {});
} else {
this.$message.warning("请选择要删除的数据!!");
}
},
},
};
</script>
<style lang="scss" scoped>
@import "@/assets/css/dialog.scss";
::v-deep {
.el-dialog {
margin-top: 25vh !important;
}
}
.listTitle {
font-size: 14px;
padding-left: 10px;
padding-right: 30px;
margin: 20px 0;
border-left: 2px solid #36b29e;
display: flex;
justify-content: space-between;
span:nth-child(1) {
font-weight: bold;
}
.addBtn {
color: #36b29e;
cursor: pointer;
}
.addBtn:hover {
color: #31a08e;
}
}
.listTitle:nth-child(1) {
margin-top: 0;
}
</style>

230
src/views/safetyManage/floodControlManagement/sluice/components/powerRecords.vue

@ -0,0 +1,230 @@
<template>
<div style="padding: 10px">
<div class="listTitle">
<span>试运行记录</span>
<!-- <span class="addBtn" @click="viewRun">
<i class="el-icon-plus"></i>
添加
</span> -->
</div>
<el-table v-loading="listLoading" :data="bydyList">
<el-table-column
label="序号"
type="index"
width="50"
align="center"
fixed
/>
<el-table-column
label="备用电源名称"
align="center"
prop="backupPowerName"
min-width="120"
/>
<el-table-column
label="电源功率"
align="center"
prop="powerSupplyPower"
min-width="120"
/>
<el-table-column
label="采购时间"
align="center"
prop="procurementTime"
min-width="120"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.procurementTime, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column
label="负责人名称"
align="center"
prop="personName"
min-width="120"
/>
<el-table-column
label="负责人电话"
align="center"
prop="personPhone"
min-width="120"
/>
<el-table-column
label="负责人职务"
align="center"
prop="personLevel"
min-width="120"
/>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
width="180"
fixed="right"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="viewRun(scope.row)"
v-hasPermi="['sz:bydy:viewRun']"
>新增试运行记录</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="listTotal > 0"
:total="listTotal"
:page.sync="listQueryParams.pageNum"
:limit.sync="listQueryParams.pageSize"
@pagination="getParentList"
/>
<!-- 管理试运行 -->
<el-dialog
:title="title"
:visible.sync="open"
width="1000px"
append-to-body
:close-on-click-modal="false"
>
<el-tabs v-model="activeName" style="margin-bottom: 20px" v-if="open">
<el-tab-pane label="日常" name="daily" :lazy="true">
<pRTable :activeName="activeName" :powerId="powerId" />
</el-tab-pane>
<el-tab-pane label="汛前" name="beforeFlood" :lazy="true">
<pRTable :activeName="activeName" :powerId="powerId" />
</el-tab-pane>
<el-tab-pane label="汛后" name="afterFlood" :lazy="true">
<pRTable :activeName="activeName" :powerId="powerId" />
</el-tab-pane>
</el-tabs>
<!-- <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div> -->
</el-dialog>
</div>
</template>
<script>
import {
listBydy,
getBydy,
delBydy,
addBydy,
updateBydy,
exportBydy,
} from "@/api/yg/bydy";
import pRTable from "./pRTable.vue";
export default {
name: "Bydy_show",
props: ["prowerTypeId"],
components: {
pRTable,
},
data() {
return {
//
listLoading: true,
//
listTotal: 0,
//
bydyList: [],
//
listQueryParams: {
pageNum: 1,
pageSize: 10,
ids: null,
data: {
bydyzbId: null,
wagaId: null,
backupPowerName: null,
wagaName: null,
powerSupplyPower: null,
procurementTime: null,
personName: null,
personPhone: null,
personLevel: null,
createUid: null,
updateUid: null,
owerDept: null,
relation: null,
},
//
params: {
//
orderBy: "create_time",
// descasc
sortBy: "desc",
},
},
//
title: "",
detailTitle: "",
open: false,
detailOpen: false,
activeName: "daily",
powerId: "",
};
},
created() {
this.getParentList();
},
methods: {
viewRun(row) {
this.title = "试运行记录管理";
this.open = true;
this.powerId = row.id;
},
/** 查询水闸备用电源种类列表 */
getParentList() {
this.listLoading = true;
this.listQueryParams.data.bydyzbId = this.prowerTypeId;
listBydy(this.listQueryParams).then((response) => {
this.bydyList = response.records;
this.listTotal = response.total;
this.listLoading = false;
});
},
},
};
</script>
<style lang="scss" scoped>
@import "@/assets/css/dialog.scss";
::v-deep {
.el-dialog {
margin-top: 25vh !important;
height: 500px;
}
}
.listTitle {
font-size: 14px;
padding-left: 10px;
padding-right: 30px;
margin: 20px 0;
border-left: 2px solid #36b29e;
display: flex;
justify-content: space-between;
span:nth-child(1) {
font-weight: bold;
}
.addBtn {
color: #36b29e;
cursor: pointer;
}
.addBtn:hover {
color: #31a08e;
}
}
.listTitle:nth-child(1) {
margin-top: 0;
}
</style>

499
src/views/safetyManage/floodControlManagement/sluice/power.vue

@ -1,3 +1,500 @@
<template>
<div>电源</div>
<div class="">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="关联水闸" prop="wagaId">
<el-select
v-model="queryParams.data.wagaId"
placeholder="请选择关联水闸"
style="width: 100%"
@change="handleQuery"
>
<el-option
v-for="dict in wagaNameOptions"
:key="dict.id"
:label="dict.wagaName"
:value="dict.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="备用电源种类" prop="powerType" label-width="96px">
<el-select
v-model="queryParams.data.powerType"
placeholder="请选择备用电源种类"
clearable
size="small"
>
<el-option
v-for="dict in powerTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<!-- <el-button
type="cyan"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
> -->
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">
重置
</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['bydyzb:bydyzb:add']"
>新增电源种类</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['bydyzb:bydyzb:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['bydyzb:bydyzb:remove']"
>删除</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="bydyzbList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" fixed />
<el-table-column
label="序号"
type="index"
width="50"
align="center"
fixed
/>
<el-table-column
label="关联水闸"
align="center"
prop="wagaId"
:formatter="wageIdFormat"
min-width="120"
/>
<el-table-column
label="备用电源数量(字段未有)"
align="center"
prop="powerNumber"
min-width="120"
/>
<el-table-column
label="备用电源种类"
align="center"
prop="powerType"
:formatter="powerTypeFormat"
min-width="120"
/>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
width="210"
fixed="right"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['bydyzb:bydyzb:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="addPowerList(scope.row)"
v-hasPermi="['bydyzb:bydyzb:addPowerList']"
>新增电源</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['bydyzb:bydyzb:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改备用电源种类 -->
<el-dialog
:title="title"
:visible.sync="open"
width="800px"
append-to-body
:close-on-click-modal="false"
>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="关联水闸" prop="wagaId">
<!-- <el-input v-model="form.wagaId" placeholder="请输入水闸id" /> -->
<el-select
v-model="form.wagaId"
placeholder="请选择关联水闸"
style="width: 100%"
>
<el-option
v-for="dict in wagaNameOptions"
:key="dict.id"
:label="dict.wagaName"
:value="dict.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="备用电源种类" prop="powerType">
<el-select
v-model="form.powerType"
placeholder="请选择备用电源种类"
style="width: 100%"
>
<el-option
v-for="dict in powerTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 备用电源 -->
<el-dialog
:title="addTitle"
:visible.sync="addOpen"
width="1200px"
append-to-body
:close-on-click-modal="false"
@close="close"
>
<el-tabs v-model="activeName" style="margin-bottom: 20px" v-if="addOpen">
<el-tab-pane label="备用电源信息" name="powerList" :lazy="true">
<powerList ref="powerList" :prowerTypeId="prowerTypeId" />
</el-tab-pane>
<el-tab-pane label="试运行记录" name="powerRecords" :lazy="true">
<powerRecords :prowerTypeId="prowerTypeId" />
</el-tab-pane>
</el-tabs>
</el-dialog>
</div>
</template>
<script>
import {
listBydyzb,
getBydyzb,
delBydyzb,
addBydyzb,
updateBydyzb,
exportBydyzb,
} from "@/api/yg/bydyzb";
import { listJbxx, getJbxx } from "@/api/yg/jbxx";
import powerList from "./components/powerList.vue";
import powerRecords from "./components/powerRecords.vue";
export default {
name: "Bydyzb",
components: {
powerList,
powerRecords,
},
data() {
return {
activeName: "powerList",
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
bydyzbList: [],
//
title: "",
addTitle: "",
//
open: false,
addOpen: false,
//
powerTypeOptions: [],
//
wagaNameOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
ids: null,
data: {
wagaId: null,
powerType: null,
powerModel: null,
wagaName: null,
createUid: null,
updateUid: null,
owerDept: null,
relation: null,
},
//
params: {
//
orderBy: "create_time",
// descasc
sortBy: "desc",
},
},
//
form: {},
//
rules: {
wagaId: [
{ required: true, message: "请选择关联水闸", trigger: "blur" },
],
powerType: [
{ required: true, message: "请选择备用电源种类", trigger: "blur" },
],
},
prowerTypeId: "",
};
},
created() {
this.getList();
listJbxx({}).then((res) => {
this.wagaNameOptions = res.records;
});
this.getDicts("type_of_power").then((response) => {
this.powerTypeOptions = response.data;
});
},
methods: {
close() {
this.activeName = "powerList";
},
addPowerList(row) {
this.prowerTypeId = row.id;
this.addTitle = "管理备用电源信息";
this.addOpen = true;
},
/** 查询水闸备用电源主列表 */
getList() {
this.loading = true;
listBydyzb(this.queryParams).then((response) => {
this.bydyzbList = response.records;
this.total = response.total;
this.loading = false;
});
},
wageIdFormat(row) {
const id = row.wagaId;
let data = this.wagaNameOptions.find((res) => res.id == id);
if (data) return data.wagaName;
},
//
powerTypeFormat(row, column) {
return this.selectDictLabel(this.powerTypeOptions, row.powerType);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
wagaId: null,
powerType: null,
powerModel: null,
wagaName: null,
createUid: null,
updateUid: null,
createTime: null,
updateTime: null,
owerDept: null,
remark: null,
relation: null,
};
this.resetForm("form");
},
//
resetQueryForm() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
data: {
id: null,
wagaId: null,
powerType: null,
powerModel: null,
wagaName: null,
createUid: null,
updateUid: null,
createTime: null,
updateTime: null,
owerDept: null,
remark: null,
relation: null,
},
//
params: {
//
orderBy: "create_time",
// descasc
sortBy: "desc",
},
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetQueryForm();
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加水闸备用电源主";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getBydyzb(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改水闸备用电源主";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateBydyzb(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addBydyzb(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
if (ids) {
this.$confirm("是否删除选中的数据?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return delBydyzb(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {});
} else {
this.$message.warning("请选择要删除的数据!!");
}
},
},
};
</script>
<style lang="scss" scoped>
@import "@/assets/css/dialog.scss";
::v-deep {
// .el-dialog {
// margin-top: 2vh !important;
// }
.el-tabs__content {
height: 500px;
overflow: auto;
}
}
</style>

1
src/views/safetyManage/floodControlManagement/sluice/preplan.vue

@ -498,6 +498,7 @@ export default {
this.form = response.data;
if (this.form.photo) {
this.fileList = JSON.parse(this.form.photo);
console.log(11111, this.fileList);
}
this.open = true;
this.title = "修改水闸预案";

Loading…
Cancel
Save