|
@@ -0,0 +1,473 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form-item label="储罐名称" prop="name">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.name"
|
|
|
+ placeholder="请输入储罐名称"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属企业" prop="enterpriseId">
|
|
|
+ <el-select v-model="queryParams.enterpriseId" placeholder="请选择所属企业">
|
|
|
+ <el-option
|
|
|
+ v-for="data in enterpriseList"
|
|
|
+ :key="data.id"
|
|
|
+ :label="data.enterpriseName"
|
|
|
+ :value="data.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" 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"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAdd"
|
|
|
+ v-hasPermi="['Housingconstruction:storagetank:add']"
|
|
|
+ >新增
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ plain
|
|
|
+ icon="el-icon-edit"
|
|
|
+ size="mini"
|
|
|
+ :disabled="single"
|
|
|
+ @click="handleUpdate"
|
|
|
+ v-hasPermi="['Housingconstruction:storagetank:edit']"
|
|
|
+ >修改
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ icon="el-icon-delete"
|
|
|
+ size="mini"
|
|
|
+ :disabled="multiple"
|
|
|
+ @click="handleDelete"
|
|
|
+ v-hasPermi="['Housingconstruction:storagetank:remove']"
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ plain
|
|
|
+ icon="el-icon-download"
|
|
|
+ size="mini"
|
|
|
+ @click="handleExport"
|
|
|
+ v-hasPermi="['Housingconstruction:storagetank:export']"
|
|
|
+ >导出
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="storagetankList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
|
+ <el-table-column label="储罐名称" align="center" prop="name"/>
|
|
|
+ <el-table-column label="所属企业" align="center" prop="enterpriseName"/>
|
|
|
+ <!-- 存储量列 -->
|
|
|
+ <el-table-column
|
|
|
+ label="存储量"
|
|
|
+ align="center"
|
|
|
+ prop="storageCapacity"
|
|
|
+ :formatter="formatStorageCapacity"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 液体液位上限列 -->
|
|
|
+ <el-table-column
|
|
|
+ label="液体液位上限"
|
|
|
+ align="center"
|
|
|
+ prop="levelCeiling"
|
|
|
+ :formatter="formatLevelCeiling"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 液体液位下限列 -->
|
|
|
+ <el-table-column
|
|
|
+ label="液体液位下限"
|
|
|
+ align="center"
|
|
|
+ prop="levelFloor"
|
|
|
+ :formatter="formatLevelFloor"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 温度列 -->
|
|
|
+ <el-table-column
|
|
|
+ label="温度"
|
|
|
+ align="center"
|
|
|
+ prop="heat"
|
|
|
+ :formatter="formatHeat"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 内部气压列 -->
|
|
|
+ <el-table-column
|
|
|
+ label="内部气压"
|
|
|
+ align="center"
|
|
|
+ prop="pressure"
|
|
|
+ :formatter="formatPressure"
|
|
|
+ />
|
|
|
+ <el-table-column label="周边可燃性气体泄漏" align="center" prop="gasLeak"/>
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['Housingconstruction:storagetank:edit']"
|
|
|
+ >修改
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ v-hasPermi="['Housingconstruction:storagetank: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="1000px" append-to-body class="form-style">
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="150px">
|
|
|
+ <el-row :gutter="24">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="所属企业" prop="enterpriseId">
|
|
|
+ <el-select v-model="form.enterpriseId" placeholder="请选择所属企业" @change="handleEnterpriseChange">
|
|
|
+ <el-option
|
|
|
+ v-for="data in enterpriseList"
|
|
|
+ :key="data.id"
|
|
|
+ :label="data.enterpriseName"
|
|
|
+ :value="data.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="储罐名称" prop="name">
|
|
|
+ <el-input v-model="form.name" placeholder="请输入储罐名称"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="24">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="存储量" prop="storageCapacity">
|
|
|
+ <el-input v-model="form.storageCapacity" placeholder="请输入存储量(单位为: t)"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="温度" prop="heat">
|
|
|
+ <el-input v-model="form.heat" placeholder="请输入温度(单位为: ℃)"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="24">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="液体液位上限" prop="levelCeiling">
|
|
|
+ <el-input v-model="form.levelCeiling" placeholder="请输入液体液位上限(单位为: L)"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="液体液位下限" prop="levelFloor">
|
|
|
+ <el-input v-model="form.levelFloor" placeholder="请输入液体液位下限(单位为: L)"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="24">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="内部气压" prop="pressure">
|
|
|
+ <el-input v-model="form.pressure" placeholder="请输入内部气压(单位为: Pa)"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="周边可燃性气体泄漏" prop="gasLeak">
|
|
|
+ <el-input v-model="form.gasLeak" placeholder="请输入周边可燃性气体泄漏"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="24">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="所属部门" prop="deptId">
|
|
|
+ <treeselect v-model="form.deptId" :options="deptOptions" multiple:false :show-count="true"
|
|
|
+ placeholder="请选择部门" @select="hx" :noResultsText="'空'" :noOptionsText="'空'"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </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 {
|
|
|
+ addStoragetank,
|
|
|
+ delStoragetank,
|
|
|
+ getStoragetank,
|
|
|
+ listStoragetank,
|
|
|
+ updateStoragetank
|
|
|
+} from "@/api/data/housingconstruction/storagetank";
|
|
|
+import {getListAll} from "@/api/data/housingconstruction/enterprise";
|
|
|
+import Treeselect from "@riophae/vue-treeselect";
|
|
|
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
+import {treeselect} from "@/api/system/dept";
|
|
|
+import deptselector from "@/views/components/deptselector.vue";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "Storagetank",
|
|
|
+ components: {deptselector, Treeselect},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 储罐存储数据表格数据
|
|
|
+ storagetankList: [],
|
|
|
+ //企业信息列表
|
|
|
+ enterpriseList: [],
|
|
|
+ // 部门树选项
|
|
|
+ deptOptions: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ name: null,
|
|
|
+ enterpriseId: null,
|
|
|
+ enterpriseName: null,
|
|
|
+ storageCapacity: null,
|
|
|
+ levelCeiling: null,
|
|
|
+ levelFloor: null,
|
|
|
+ heat: null,
|
|
|
+ pressure: null,
|
|
|
+ gasLeak: null
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ enterpriseId: [
|
|
|
+ {required: true, message: "所属企业不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ name: [
|
|
|
+ {required: true, message: "储罐名称不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ storageCapacity: [
|
|
|
+ {required: true, message: "存储量不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ levelCeiling: [
|
|
|
+ {required: true, message: "液体液位上限不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ levelFloor: [
|
|
|
+ {required: true, message: "液体液位下限不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ heat: [
|
|
|
+ {required: true, message: "温度不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ pressure: [
|
|
|
+ {required: true, message: "内部气压不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ gasLeak: [
|
|
|
+ {required: true, message: "周边可燃性气体泄漏不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ this.getTreeselect();
|
|
|
+ this.getEnterpriseList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleEnterpriseChange(newId) {
|
|
|
+ const selectedEnterprise = this.enterpriseList.find(item => item.id === newId);
|
|
|
+ if (selectedEnterprise) {
|
|
|
+ this.form.enterpriseName = selectedEnterprise.enterpriseName;
|
|
|
+ } else {
|
|
|
+ this.form.enterpriseName = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 查询部门下拉树结构 */
|
|
|
+ getTreeselect() {
|
|
|
+ treeselect().then(response => {
|
|
|
+ this.deptOptions = response.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ hx(node) {
|
|
|
+ this.form.dataDeptId = node.id
|
|
|
+ this.form.deptId = node.id
|
|
|
+ this.form.deptName = node.label
|
|
|
+ this.$refs.form.validateField("deptId")
|
|
|
+ },
|
|
|
+ getEnterpriseName(id) {
|
|
|
+ const enterprise = this.enterpriseList.find(e => e.id === id);
|
|
|
+ return enterprise ? enterprise.enterpriseName : '未知企业';
|
|
|
+ },
|
|
|
+ getEnterpriseList(){
|
|
|
+ getListAll().then(res=>{
|
|
|
+ this.enterpriseList = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 查询储罐存储数据列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listStoragetank(this.queryParams).then(response => {
|
|
|
+ this.storagetankList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ id: null,
|
|
|
+ createBy: null,
|
|
|
+ createName: null,
|
|
|
+ createTime: null,
|
|
|
+ updateBy: null,
|
|
|
+ updateName: null,
|
|
|
+ updateTime: null,
|
|
|
+ deptId: null,
|
|
|
+ deptName: null,
|
|
|
+ name: null,
|
|
|
+ enterpriseId: null,
|
|
|
+ enterpriseName: null,
|
|
|
+ storageCapacity: null,
|
|
|
+ levelCeiling: null,
|
|
|
+ levelFloor: null,
|
|
|
+ heat: null,
|
|
|
+ pressure: null,
|
|
|
+ gasLeak: null
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ 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
|
|
|
+ getStoragetank(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) {
|
|
|
+ updateStoragetank(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addStoragetank(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const ids = row.id || this.ids;
|
|
|
+ this.$modal.confirm('是否确认删除储罐存储数据编号为"' + ids + '"的数据项?').then(function () {
|
|
|
+ return delStoragetank(ids);
|
|
|
+ }).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ }).catch(() => {
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ this.download('system/storagetank/export', {
|
|
|
+ ...this.queryParams
|
|
|
+ }, `storagetank_${new Date().getTime()}.xlsx`)
|
|
|
+ },
|
|
|
+ formatStorageCapacity(cellValue) {
|
|
|
+ return `${cellValue.storageCapacity} t`;
|
|
|
+ },
|
|
|
+ formatLevelCeiling(cellValue) {
|
|
|
+ return `${cellValue.levelCeiling} L`;
|
|
|
+ },
|
|
|
+ formatLevelFloor(cellValue) {
|
|
|
+ return `${cellValue.levelFloor} L`;
|
|
|
+ },
|
|
|
+ formatHeat(cellValue) {
|
|
|
+ return `${cellValue.heat} ℃`;
|
|
|
+ },
|
|
|
+ formatPressure(cellValue) {
|
|
|
+ return `${cellValue.pressure} Pa`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|