You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1246 lines
36 KiB
1246 lines
36 KiB
<template>
|
|
<div class="app-container">
|
|
<!-- 面包屑 -->
|
|
<el-breadcrumb separator="/" style="margin-bottom: 20px">
|
|
<el-breadcrumb-item
|
|
v-for="(item, index) in routeList"
|
|
:key="item + index"
|
|
:to="{ path: item.path }"
|
|
>
|
|
{{ item.routeName }}
|
|
</el-breadcrumb-item>
|
|
</el-breadcrumb>
|
|
<div class="mainCon">
|
|
<div class="list">
|
|
<el-form
|
|
:model="queryParams"
|
|
ref="queryForm"
|
|
:inline="true"
|
|
v-show="showSearch"
|
|
label-width="68px"
|
|
>
|
|
<el-form-item label="堤防名称" prop="dikeName">
|
|
<el-input
|
|
v-model="queryParams.data.dikeName"
|
|
placeholder="请输入标志名称"
|
|
clearable
|
|
size="small"
|
|
@keyup.enter.native="handleQuery"
|
|
>
|
|
<el-button
|
|
type="primary"
|
|
slot="append"
|
|
icon="el-icon-search"
|
|
size="small"
|
|
@click="handleQuery"
|
|
></el-button>
|
|
</el-input>
|
|
</el-form-item>
|
|
<!-- <el-form-item label="标志名称" prop="markName">
|
|
<el-input
|
|
v-model="queryParams.data.markName"
|
|
placeholder="请输入标志名称"
|
|
clearable
|
|
size="small"
|
|
@keyup.enter.native="handleQuery"
|
|
>
|
|
<el-button
|
|
type="primary"
|
|
slot="append"
|
|
icon="el-icon-search"
|
|
size="small"
|
|
@click="handleQuery"
|
|
></el-button>
|
|
</el-input>
|
|
</el-form-item> -->
|
|
<!-- <el-form-item label="标牌类型" prop="type">
|
|
<el-select
|
|
v-model="queryParams.data.type"
|
|
placeholder="请选择标牌类型"
|
|
clearable
|
|
size="small"
|
|
@change="handleQuery"
|
|
>
|
|
<el-option
|
|
v-for="dict in typeOptions"
|
|
:key="dict.dictValue"
|
|
:label="dict.dictLabel"
|
|
:value="dict.dictValue"
|
|
/>
|
|
</el-select>
|
|
</el-form-item> -->
|
|
<el-form-item label="行政区划" prop="adcd">
|
|
<el-cascader
|
|
v-model="queryParams.data.adcd"
|
|
:props="areasOptionProps"
|
|
placeholder="请选择行政区划"
|
|
clearable
|
|
size="small"
|
|
@change="handleQuery"
|
|
>
|
|
</el-cascader>
|
|
</el-form-item>
|
|
<!-- <el-form-item label="标识类型" prop="markType">
|
|
<el-select
|
|
v-model="queryParams.data.markType"
|
|
placeholder="请选择标识类型"
|
|
clearable
|
|
size="small"
|
|
>
|
|
<el-option
|
|
v-for="dict in markTypeOptions"
|
|
: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="['yg:dikeMark: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="['yg:dikeMark: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="['yg:dikeMark:remove']"
|
|
>删除</el-button
|
|
>
|
|
</el-col>
|
|
<right-toolbar
|
|
:showSearch.sync="showSearch"
|
|
@queryTable="getList"
|
|
></right-toolbar>
|
|
</el-row>
|
|
|
|
<el-table
|
|
v-loading="loading"
|
|
:data="dikeMarkList"
|
|
@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="markName"
|
|
min-width="120"
|
|
/> -->
|
|
<el-table-column
|
|
label="堤防名称"
|
|
align="center"
|
|
prop="dikeName"
|
|
min-width="120"
|
|
/>
|
|
<el-table-column
|
|
label="行政区划"
|
|
align="center"
|
|
prop="adcd"
|
|
:formatter="formatAdcd"
|
|
min-width="120"
|
|
/>
|
|
<el-table-column
|
|
label="堤防公告类"
|
|
align="center"
|
|
prop="oneType"
|
|
min-width="120"
|
|
/>
|
|
<el-table-column
|
|
label="堤防警告类"
|
|
align="center"
|
|
prop="twoType"
|
|
min-width="120"
|
|
/>
|
|
<el-table-column
|
|
label="堤防指引类"
|
|
align="center"
|
|
prop="threeType"
|
|
min-width="120"
|
|
/>
|
|
<el-table-column
|
|
label="堤防名称类"
|
|
align="center"
|
|
prop="fourType"
|
|
min-width="120"
|
|
/>
|
|
|
|
<!-- <el-table-column
|
|
label="标识位置"
|
|
align="center"
|
|
prop="markLocation"
|
|
min-width="120"
|
|
/>
|
|
<el-table-column
|
|
label="标牌类型"
|
|
align="center"
|
|
prop="type"
|
|
:formatter="typeFormat"
|
|
min-width="120"
|
|
/>
|
|
<el-table-column
|
|
label="标识类型"
|
|
align="center"
|
|
prop="markType"
|
|
:formatter="markTypeFormat"
|
|
min-width="120"
|
|
/>
|
|
<el-table-column
|
|
label="上传图片"
|
|
align="center"
|
|
prop="photo"
|
|
min-width="120"
|
|
/>
|
|
<el-table-column
|
|
label="标牌编号"
|
|
align="center"
|
|
prop="markCode"
|
|
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="['yg:dikeMark:edit']"
|
|
>修改</el-button
|
|
>
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-delete"
|
|
@click="handleDelete(scope.row)"
|
|
v-hasPermi="['yg:dikeMark: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="1200px"
|
|
append-to-body
|
|
:close-on-click-modal="false"
|
|
v-if="open"
|
|
>
|
|
<!-- 四个标牌类型,提交时都赋值 -->
|
|
<el-row>
|
|
<el-form
|
|
ref="comForm"
|
|
:model="comForm"
|
|
:rules="comRule"
|
|
label-width="80px"
|
|
>
|
|
<el-col :span="12">
|
|
<el-form-item label="堤防名称" prop="dikeCode">
|
|
<linkDike :form="comForm" v-if="open" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-form>
|
|
</el-row>
|
|
|
|
<div class="biaopai-wrap">
|
|
<div class="tabs">
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
<el-tab-pane
|
|
v-for="item in tabsOpt"
|
|
:key="item.type"
|
|
:label="`${item.label}(${getCounterLen(item.type)})`"
|
|
:name="item.name"
|
|
></el-tab-pane>
|
|
</el-tabs>
|
|
</div>
|
|
<div class="form-wrap">
|
|
<markForm
|
|
ref="markForm"
|
|
:status="isEdit"
|
|
:formName="getTabsOpt.name"
|
|
:rules="rules"
|
|
:markTypeOptions="getTabsOpt.markTypeOptions"
|
|
:isFirst="true"
|
|
:addForm="addForm1"
|
|
:type="getTabsOpt.type"
|
|
:editItem="editItem"
|
|
:rowIsEdit="rowIsEdit"
|
|
:comForm="comForm"
|
|
@delForm="delForm"
|
|
/>
|
|
</div>
|
|
<div class="table-wrap">
|
|
<el-table
|
|
:data="
|
|
getDialogTabelData.filter(
|
|
(data) =>
|
|
!search ||
|
|
data.markName.toLowerCase().includes(search.toLowerCase())
|
|
)
|
|
"
|
|
border
|
|
style="width: 100%"
|
|
height="290"
|
|
>
|
|
<el-table-column prop="markName" label="标志名称" width="250">
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="markLocation"
|
|
label="标识位置"
|
|
width="200"
|
|
>
|
|
</el-table-column>
|
|
<el-table-column prop="markType" label="标识类型">
|
|
<template slot-scope="scope">
|
|
{{ formatType(scope.row) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="photo" label="图片文件">
|
|
<template slot-scope="scope">
|
|
{{ JSON.parse(scope.row.photo).length ? "已上传" : "" }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="操作"
|
|
align="center"
|
|
class-name="small-padding fixed-width"
|
|
width="220"
|
|
fixed="right"
|
|
>
|
|
<template slot="header" slot-scope="scope">
|
|
<el-input
|
|
v-model="search"
|
|
size="mini"
|
|
placeholder="输入标志名称搜索"
|
|
clearable
|
|
/>
|
|
</template>
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-edit"
|
|
@click="
|
|
handleDialogUpdate(
|
|
scope.row,
|
|
scope.column,
|
|
scope.$index
|
|
)
|
|
"
|
|
>修改</el-button
|
|
>
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-delete"
|
|
@click="
|
|
handleDialogDelete(
|
|
scope.row,
|
|
scope.column,
|
|
scope.$index
|
|
)
|
|
"
|
|
>删除</el-button
|
|
>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="submitForm1">确 定</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
listDikeMark,
|
|
getDikeMark,
|
|
delDikeMark,
|
|
delDikeMarkAll,
|
|
addDikeMark,
|
|
updateDikeMark,
|
|
exportDikeMark,
|
|
} from "@/api/yg/dikeMark";
|
|
import { listDikeInfo } from "@/api/yg/dikeInfo";
|
|
import markForm from "./components/markForm.vue";
|
|
import { regionData, codeToText, TextToCode } from "element-china-area-data";
|
|
import linkDike from "@/components/linkNameSelect/linkDike.vue";
|
|
// import Vue from "vue";
|
|
import { cascaderLazyLoad } from "@/utils/elUtils";
|
|
|
|
export default {
|
|
name: "DikeMark",
|
|
components: {
|
|
markForm,
|
|
linkDike,
|
|
},
|
|
data() {
|
|
return {
|
|
// 面包屑,路由信息
|
|
routeList: [
|
|
{
|
|
path: "/dike/engineeringCondition/identificationPlate",
|
|
routeName: "堤防标识标牌管理",
|
|
},
|
|
],
|
|
areasOptionProps: {
|
|
emitPath: false,
|
|
checkStrictly: true, //选择任意一级
|
|
expandTrigger: "hover",
|
|
lazy: true,
|
|
lazyLoad: cascaderLazyLoad,
|
|
},
|
|
areasOptions: [],
|
|
isFirst: true,
|
|
// 遮罩层
|
|
loading: true,
|
|
// 选中数组
|
|
ids: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 总条数
|
|
total: 0,
|
|
// 水闸标识标牌表格数据
|
|
dikeMarkList: [],
|
|
// 弹出层标题
|
|
title: "",
|
|
// 是否显示弹出层
|
|
open: false,
|
|
// 标牌类型字典
|
|
typeOptions: [],
|
|
// 标识类型字典
|
|
markTypeOptions1: [],
|
|
markTypeOptions2: [],
|
|
markTypeOptions3: [],
|
|
markTypeOptions4: [],
|
|
// 查询参数
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
ids: null,
|
|
data: {
|
|
dikeName: null,
|
|
markName: null,
|
|
type: null,
|
|
markType: null,
|
|
},
|
|
// 排序方式
|
|
params: {
|
|
// 按哪个字段排序
|
|
orderBy: "create_time",
|
|
// desc降序,升序asc
|
|
sortBy: "desc",
|
|
},
|
|
},
|
|
// 表单参数
|
|
form: {},
|
|
comForm: {
|
|
dikeName: null,
|
|
dikeCode: null,
|
|
adcd: null,
|
|
},
|
|
noticeForm: {},
|
|
warnForm: {},
|
|
nameForm: {},
|
|
guideForm: {},
|
|
|
|
// 表单校验
|
|
comRule: {
|
|
dikeCode: [
|
|
{ required: true, message: "请选择堤防名称", trigger: "change" },
|
|
],
|
|
},
|
|
rules: {
|
|
markName: [
|
|
{ required: true, message: "请输入标志名称", trigger: "blur" },
|
|
],
|
|
},
|
|
dikeNameOptions: [],
|
|
isEdit: false,
|
|
counter0: [],
|
|
counter1: [],
|
|
counter2: [],
|
|
counter3: [],
|
|
delIdList: [],
|
|
activeName: "noticeForm",
|
|
editItem: {},
|
|
editIndex: null,
|
|
rowIsEdit: false,
|
|
search: "",
|
|
};
|
|
},
|
|
computed: {
|
|
tabsOpt() {
|
|
return [
|
|
{
|
|
label: "堤防公告类",
|
|
name: "noticeForm",
|
|
type: 0,
|
|
markTypeOptions: this.markTypeOptions1,
|
|
},
|
|
{
|
|
label: "堤防警告类",
|
|
name: "warnForm",
|
|
type: 1,
|
|
markTypeOptions: this.markTypeOptions2,
|
|
},
|
|
{
|
|
label: "堤防指引类",
|
|
name: "guideForm",
|
|
type: 2,
|
|
markTypeOptions: this.markTypeOptions3,
|
|
},
|
|
{
|
|
label: "堤防名称类",
|
|
name: "nameForm",
|
|
type: 3,
|
|
markTypeOptions: this.markTypeOptions4,
|
|
},
|
|
];
|
|
},
|
|
getTabsOpt() {
|
|
return this.tabsOpt.filter((item) => {
|
|
return item.name === this.activeName;
|
|
})[0];
|
|
},
|
|
getDialogTabelData() {
|
|
return this[`counter${this.getTabsOpt.type}`];
|
|
// switch (this.activeName) {
|
|
// case "noticeForm":
|
|
// return this.counter0;
|
|
// case "noticeForm":
|
|
// return this.counter0;
|
|
// case "noticeForm":
|
|
// return this.counter0;
|
|
// case "noticeForm":
|
|
// return this.counter0;
|
|
// }
|
|
},
|
|
},
|
|
created() {
|
|
this.getList();
|
|
this.getDicts("breastplate_type").then((response) => {
|
|
this.typeOptions = response.data;
|
|
});
|
|
this.getDicts("sluice_notice_mark").then((response) => {
|
|
this.markTypeOptions1 = response.data;
|
|
});
|
|
this.getDicts("sluice_warn_mark").then((response) => {
|
|
this.markTypeOptions2 = response.data;
|
|
});
|
|
this.getDicts("guide_identification").then((response) => {
|
|
this.markTypeOptions3 = response.data;
|
|
});
|
|
this.getDicts("name_identification").then((response) => {
|
|
this.markTypeOptions4 = response.data;
|
|
});
|
|
listDikeInfo({ data: { exprDate: null } }).then((response) => {
|
|
console.log("dikeNameOptions", response);
|
|
this.dikeNameOptions = response.records;
|
|
});
|
|
},
|
|
// mounted() {
|
|
// this.counter1[0] = this.noticeForm;
|
|
// },
|
|
methods: {
|
|
formatType(row) {
|
|
console.log("row", row);
|
|
|
|
let { type, markType } = row;
|
|
if (markType) {
|
|
const markTypeOptions = "markTypeOptions" + (parseInt(type) + 1);
|
|
return this[markTypeOptions].filter((item) => {
|
|
return item.dictValue == markType;
|
|
})[0].dictLabel;
|
|
} else {
|
|
return "--";
|
|
}
|
|
},
|
|
handleDialogUpdate(row, col, index) {
|
|
console.log("row", row, col, index);
|
|
this.rowIsEdit = true;
|
|
this.editIndex = index;
|
|
this.editItem = JSON.parse(JSON.stringify(row));
|
|
},
|
|
handleDialogDelete(row, col, index) {
|
|
let { type } = row;
|
|
const counterType = "counter" + type;
|
|
this.$confirm("是否删除选中的数据?", "警告", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
})
|
|
.then(() => {
|
|
console.log("删除", row, index);
|
|
this[counterType].splice(index, 1);
|
|
})
|
|
.catch(function () {});
|
|
},
|
|
getCounterLen(type) {
|
|
const counterType = "counter" + type;
|
|
return this[counterType].length;
|
|
},
|
|
handleClick() {
|
|
this.search = "";
|
|
this.rowIsEdit=false
|
|
this.$refs.markForm.resetForm();
|
|
},
|
|
formatAdcd(row) {
|
|
if (row.adcd) {
|
|
let provinceCode = row.adcd.slice(0, 2);
|
|
let cityCode = row.adcd.slice(2, 4);
|
|
let areaCode = row.adcd.slice(4, 6);
|
|
if (areaCode != "00") {
|
|
return (
|
|
codeToText[provinceCode] +
|
|
"-" +
|
|
codeToText[provinceCode + cityCode] +
|
|
"-" +
|
|
codeToText[provinceCode + cityCode + areaCode]
|
|
);
|
|
} else if (cityCode != "00") {
|
|
return (
|
|
codeToText[provinceCode] + "-" + codeToText[provinceCode + cityCode]
|
|
);
|
|
} else {
|
|
return codeToText[provinceCode];
|
|
}
|
|
}
|
|
},
|
|
addForm1(rowData) {
|
|
console.log("rowData", rowData);
|
|
let { type, formData } = rowData;
|
|
const counterType = "counter" + type;
|
|
console.log(formData);
|
|
|
|
if (this.rowIsEdit) {
|
|
this[counterType].splice(this.editIndex, 1, formData);
|
|
this.rowIsEdit = false;
|
|
} else {
|
|
this[counterType].push(formData);
|
|
}
|
|
},
|
|
addForm(index, type, formName) {
|
|
console.log("index和type", index, type);
|
|
const counterType = "counter" + type;
|
|
// console.log(44444, this.$refs.noticePart.$refs["noticeForm0"]);
|
|
// 重新赋值每种标牌首项
|
|
if (this[counterType].length == 1) {
|
|
console.log(this.$refs, this.$refs[formName + "0"][0]);
|
|
this[counterType][0] = this.$refs[formName + "0"][0].form;
|
|
}
|
|
// 先增加节点
|
|
this[counterType].push({});
|
|
// 再改变其存储的值
|
|
this.$nextTick(() => {
|
|
this[counterType][this[counterType].length - 1] =
|
|
this.$refs[formName + (index + 1)][0].form;
|
|
console.log(
|
|
66666,
|
|
this[counterType],
|
|
this.$refs[formName + (index + 1)][0].form
|
|
);
|
|
// 增加标识时,将其表单赋值水闸名称以及水闸编码
|
|
// if (this.comForm.dikeName) {
|
|
// this[counterType][this[counterType].length - 1].dikeName =
|
|
// this.comForm.dikeName;
|
|
// this[counterType][this[counterType].length - 1].dikeCode =
|
|
// this.comForm.dikeCode;
|
|
// }
|
|
// 赋值标牌类型
|
|
// this[counterType][this[counterType].length - 1].type = type;
|
|
});
|
|
|
|
// if (this.counter0.length == 1) {
|
|
// console.log(this.$refs);
|
|
// this.counter0[0] = this.$refs["noticeForm0"][0].form;
|
|
// }
|
|
// // 先增加节点
|
|
// this.counter0.push({});
|
|
// // 再改变其存储的值
|
|
// this.$nextTick(() => {
|
|
// this.counter0[this.counter0.length - 1] =
|
|
// this.$refs["noticeForm" + index][0].form;
|
|
// console.log(66666, this.counter0);
|
|
// // 增加标识时,将其表单赋值水闸名称以及水闸编码
|
|
// if (this.comForm.dikeName) {
|
|
// this.counter0[this.counter0.length - 1].dikeName =
|
|
// this.comForm.dikeName;
|
|
// this.counter0[this.counter0.length - 1].dikeCode =
|
|
// this.comForm.dikeCode;
|
|
// }
|
|
// // 赋值标牌类型
|
|
// this.counter0[this.counter0.length - 1].type = "0";
|
|
// });
|
|
|
|
// console.log(6666666666666, this.$refs[ele]);
|
|
// const markForm = Vue.extend(markForm);
|
|
// // var child = ` <markForm
|
|
// // :formName="'noticeForm2'"
|
|
// // :form="form"
|
|
// // :rules="rules"
|
|
// // :markTypeOptions="markTypeOptions1"
|
|
// // :addForm="addForm"
|
|
// // />`;
|
|
// const child = new markForm({
|
|
// propsData: {
|
|
// // 组件内所需的参数
|
|
// formName: "noticeForm2",
|
|
// form: this.form,
|
|
// rules: this.rules,
|
|
// markTypeOptions: this.markTypeOptions1,
|
|
// addForm: this.addForm,
|
|
// },
|
|
// });
|
|
// child.$mount();
|
|
// // this.$refs[ele].insertAdjacentHTML("beforeend", child); //插入元素内部的最后一个子节点之后
|
|
// this.$refs[ele].appendChild(child.$el); //插入元素内部的最后一个子节点之后
|
|
},
|
|
chooseEmbankmenName(data) {
|
|
// dikeCode
|
|
this.comForm.dikeCode = data.dikeCode;
|
|
this.comForm.adcd = data.adcd;
|
|
// console.log(33333, this.comForm);
|
|
// // 将第一个表单和后面新增的表单赋值,水闸编码和水闸名称
|
|
// this.$refs["noticeForm0"][0].form.dikeName = data.dikeName;
|
|
// this.$refs["noticeForm0"][0].form.dikeCode = data.dikeCode;
|
|
// // this.$refs["noticeForm0"][0].form.type = "0";
|
|
// this.counter0.forEach((item) => {
|
|
// item.dikeName = data.dikeName;
|
|
// item.dikeCode = data.dikeCode;
|
|
// });
|
|
// // this.noticeForm.dikeName = data.dikeName;
|
|
// this.warnForm.dikeName = data.dikeName;
|
|
// this.nameForm.dikeName = data.dikeName;
|
|
// this.guideForm.dikeName = data.dikeName;
|
|
|
|
// // this.noticeForm.dikeCode = data.dikeCode;
|
|
// this.warnForm.dikeCode = data.dikeCode;
|
|
// this.nameForm.dikeCode = data.dikeCode;
|
|
// this.guideForm.dikeCode = data.dikeCode;
|
|
},
|
|
/** 查询水闸标识标牌列表 */
|
|
getList() {
|
|
this.loading = true;
|
|
listDikeMark(this.queryParams).then((response) => {
|
|
this.dikeMarkList = response.records;
|
|
this.total = response.total;
|
|
this.loading = false;
|
|
});
|
|
},
|
|
// 标牌类型字典翻译
|
|
typeFormat(row, column) {
|
|
return this.selectDictLabel(this.typeOptions, row.type);
|
|
},
|
|
// 标识类型字典翻译
|
|
markTypeFormat(row, column) {
|
|
return this.selectDictLabel(this.markTypeOptions, row.markType);
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.rowIsEdit=false
|
|
this.open = false;
|
|
this.reset();
|
|
},
|
|
// 表单重置
|
|
reset() {
|
|
this.delIdList = [];
|
|
this.counter0 = [];
|
|
this.counter1 = [];
|
|
this.counter2 = [];
|
|
this.counter3 = [];
|
|
this.comForm = {
|
|
dikeName: null,
|
|
dikeCode: null,
|
|
adcd: null,
|
|
};
|
|
this.noticeForm = {
|
|
id: null,
|
|
adcd: null,
|
|
dikeCode: null,
|
|
markName: null,
|
|
dikeName: null,
|
|
markLocation: null,
|
|
type: "0",
|
|
markType: null,
|
|
photo: null,
|
|
markCode: null,
|
|
proNo: null,
|
|
proCode: null,
|
|
createUid: null,
|
|
updateUid: null,
|
|
createTime: null,
|
|
updateTime: null,
|
|
owerDept: null,
|
|
remark: null,
|
|
};
|
|
this.warnForm = {
|
|
id: null,
|
|
adcd: null,
|
|
dikeCode: null,
|
|
markName: null,
|
|
dikeName: null,
|
|
markLocation: null,
|
|
type: "1",
|
|
markType: null,
|
|
photo: null,
|
|
markCode: null,
|
|
proNo: null,
|
|
proCode: null,
|
|
createUid: null,
|
|
updateUid: null,
|
|
createTime: null,
|
|
updateTime: null,
|
|
owerDept: null,
|
|
remark: null,
|
|
};
|
|
this.guideForm = {
|
|
id: null,
|
|
adcd: null,
|
|
dikeCode: null,
|
|
markName: null,
|
|
dikeName: null,
|
|
markLocation: null,
|
|
type: "2",
|
|
markType: null,
|
|
photo: null,
|
|
markCode: null,
|
|
proNo: null,
|
|
proCode: null,
|
|
createUid: null,
|
|
updateUid: null,
|
|
createTime: null,
|
|
updateTime: null,
|
|
owerDept: null,
|
|
remark: null,
|
|
};
|
|
this.nameForm = {
|
|
id: null,
|
|
adcd: null,
|
|
dikeCode: null,
|
|
markName: null,
|
|
dikeName: null,
|
|
markLocation: null,
|
|
type: "3",
|
|
markType: null,
|
|
photo: null,
|
|
markCode: null,
|
|
proNo: null,
|
|
proCode: null,
|
|
createUid: null,
|
|
updateUid: null,
|
|
createTime: null,
|
|
updateTime: null,
|
|
owerDept: null,
|
|
remark: null,
|
|
};
|
|
this.resetForm("comForm");
|
|
this.resetForm("noticeForm");
|
|
this.resetForm("warnForm");
|
|
this.resetForm("guideForm");
|
|
this.resetForm("nameForm");
|
|
},
|
|
// 查询表单重置
|
|
resetQueryForm() {
|
|
this.queryParams = {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
data: {
|
|
id: null,
|
|
markName: null,
|
|
suliceId: null,
|
|
markLocation: null,
|
|
type: null,
|
|
markType: null,
|
|
photo: null,
|
|
markCode: null,
|
|
proNo: null,
|
|
proCode: null,
|
|
createUid: null,
|
|
updateUid: null,
|
|
createTime: null,
|
|
updateTime: null,
|
|
owerDept: null,
|
|
remark: null,
|
|
},
|
|
params: {
|
|
// 按哪个字段排序
|
|
orderBy: "create_time",
|
|
// desc降序,升序asc
|
|
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.dikeCode);
|
|
this.single = selection.length !== 1;
|
|
this.multiple = !selection.length;
|
|
},
|
|
/** 新增按钮操作 */
|
|
handleAdd() {
|
|
this.reset();
|
|
this.isEdit = false;
|
|
this.open = true;
|
|
this.title = "添加堤防标识标牌";
|
|
},
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
this.reset();
|
|
this.isEdit = true;
|
|
console.log(77777, row);
|
|
const dikeCode = row.dikeCode;
|
|
getDikeMark(dikeCode).then((response) => {
|
|
// this.form = response.data;
|
|
console.log("回显的数据", response);
|
|
this.comForm.dikeName = response.data[0].dikeName;
|
|
this.comForm.dikeCode = response.data[0].dikeCode;
|
|
this.comForm.adcd = response.data[0].adcd;
|
|
console.log("this.comForm", this.comForm);
|
|
this.counter0 = response.data.filter((item) => item.type == 0);
|
|
if (this.counter0.length == 0) this.counter0 = [];
|
|
this.counter1 = response.data.filter((item) => item.type == 1);
|
|
if (this.counter1.length == 0) this.counter1 = [];
|
|
this.counter2 = response.data.filter((item) => item.type == 2);
|
|
if (this.counter2.length == 0) this.counter2 = [];
|
|
this.counter3 = response.data.filter((item) => item.type == 3);
|
|
if (this.counter3.length == 0) this.counter3 = [];
|
|
console.log("回显的数据时的counter0", this.counter0);
|
|
console.log("回显的数据时的counter1", this.counter1);
|
|
console.log("回显的数据时的counter2", this.counter2);
|
|
console.log("回显的数据时的counter3", this.counter3);
|
|
this.open = true;
|
|
this.title = "修改堤防标识标牌";
|
|
});
|
|
},
|
|
/** 提交按钮 */
|
|
submitForm1() {
|
|
let isAllTrue =
|
|
this.counter0.length ||
|
|
this.counter1.length ||
|
|
this.counter2.length ||
|
|
this.counter3.length
|
|
? true
|
|
: false;
|
|
|
|
this.$refs["comForm"].validate((valid0) => {
|
|
if (valid0) {
|
|
if (!isAllTrue) {
|
|
this.msgError("堤防标识标牌列表数据为空");
|
|
return;
|
|
}
|
|
this.counter0.forEach((item) => {
|
|
if (item) {
|
|
item = { ...item, ...this.comForm };
|
|
}
|
|
});
|
|
this.counter1.forEach((item) => {
|
|
if (item) {
|
|
item = { ...item, ...this.comForm };
|
|
}
|
|
});
|
|
this.counter2.forEach((item) => {
|
|
if (item) {
|
|
item = { ...item, ...this.comForm };
|
|
}
|
|
});
|
|
this.counter3.forEach((item) => {
|
|
if (item) {
|
|
item = { ...item, ...this.comForm };
|
|
}
|
|
});
|
|
|
|
if (this.isEdit) {
|
|
updateDikeMark([
|
|
...this.counter0,
|
|
...this.counter1,
|
|
...this.counter2,
|
|
...this.counter3,
|
|
]).then((response) => {
|
|
if (response.code === 200) {
|
|
this.msgSuccess("修改成功");
|
|
this.open = false;
|
|
this.getList();
|
|
}
|
|
});
|
|
if (this.delIdList.length > 0) delDikeMark(this.delIdList);
|
|
} else {
|
|
addDikeMark([
|
|
...this.counter0,
|
|
...this.counter1,
|
|
...this.counter2,
|
|
...this.counter3,
|
|
]).then((response) => {
|
|
if (response.code === 200) {
|
|
this.msgSuccess("新增成功");
|
|
this.open = false;
|
|
this.getList();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
this.rowIsEdit=false
|
|
},
|
|
submitForm() {
|
|
// console.log(1111111111, this.$refs.noticeForm0[0].$refs.form);
|
|
// 表单校验
|
|
// 且运算
|
|
let isAllTrue = true;
|
|
// 或预算
|
|
// let isAllTrue = false;
|
|
this.counter0.forEach((item, index) => {
|
|
this.counter0[index].photo = JSON.stringify(
|
|
this.$refs["noticeForm" + index][0].fileList
|
|
);
|
|
this.$refs["noticeForm" + index][0].validateForm();
|
|
isAllTrue = isAllTrue && this.$refs["noticeForm" + index][0].valid;
|
|
});
|
|
this.counter1.forEach((item, index) => {
|
|
this.counter1[index].photo = JSON.stringify(
|
|
this.$refs["warnForm" + index][0].fileList
|
|
);
|
|
this.$refs["warnForm" + index][0].validateForm();
|
|
isAllTrue = isAllTrue && this.$refs["warnForm" + index][0].valid;
|
|
});
|
|
this.counter2.forEach((item, index) => {
|
|
this.counter2[index].photo = JSON.stringify(
|
|
this.$refs["guideForm" + index][0].fileList
|
|
);
|
|
this.$refs["guideForm" + index][0].validateForm();
|
|
isAllTrue = isAllTrue && this.$refs["guideForm" + index][0].valid;
|
|
});
|
|
this.counter3.forEach((item, index) => {
|
|
this.counter3[index].photo = JSON.stringify(
|
|
this.$refs["nameForm" + index][0].fileList
|
|
);
|
|
this.$refs["nameForm" + index][0].validateForm();
|
|
isAllTrue = isAllTrue && this.$refs["nameForm" + index][0].valid;
|
|
});
|
|
console.log("全部表单是否通过校验", isAllTrue);
|
|
this.$refs["comForm"].validate((valid0) => {
|
|
// this.$refs["noticeForm"].validate((valid1) => {
|
|
// this.$refs["warnForm"].validate((valid2) => {
|
|
// this.$refs["guideForm"].validate((valid3) => {
|
|
// this.$refs["nameForm"].validate((valid4) => {
|
|
// if (valid0 && valid1 && valid2 && valid3 && valid4) {
|
|
if (valid0 && isAllTrue) {
|
|
console.log(6666);
|
|
const C0 =
|
|
this.counter0.length > 1
|
|
? this.counter0
|
|
: this.$refs["noticeForm0"][0].form.markName
|
|
? [this.$refs["noticeForm0"][0].form]
|
|
: [];
|
|
const C1 =
|
|
this.counter1.length > 1
|
|
? this.counter1
|
|
: this.$refs["warnForm0"][0].form.markName
|
|
? [this.$refs["warnForm0"][0].form]
|
|
: [];
|
|
const C2 =
|
|
this.counter2.length > 1
|
|
? this.counter2
|
|
: this.$refs["guideForm0"][0].form.markName
|
|
? [this.$refs["guideForm0"][0].form]
|
|
: [];
|
|
const C3 =
|
|
this.counter3.length > 1
|
|
? this.counter3
|
|
: this.$refs["nameForm0"][0].form.markName
|
|
? [this.$refs["nameForm0"][0].form]
|
|
: [];
|
|
|
|
// console.log("C0C0", C0, C1);
|
|
if (this.isEdit) {
|
|
updateDikeMark([
|
|
...C0,
|
|
...C1,
|
|
...C2,
|
|
...C3,
|
|
// this.noticeForm,
|
|
// this.warnForm,
|
|
// this.guideForm,
|
|
// this.nameForm,
|
|
]).then((response) => {
|
|
if (response.code === 200) {
|
|
this.msgSuccess("修改成功");
|
|
this.open = false;
|
|
this.getList();
|
|
}
|
|
});
|
|
if (this.delIdList.length > 0) delDikeMark(this.delIdList);
|
|
} else {
|
|
addDikeMark([
|
|
...C0,
|
|
...C1,
|
|
...C2,
|
|
...C3,
|
|
// this.noticeForm,
|
|
// this.warnForm,
|
|
// this.guideForm,
|
|
// this.nameForm,
|
|
]).then((response) => {
|
|
if (response.code === 200) {
|
|
this.msgSuccess("新增成功");
|
|
this.open = false;
|
|
this.getList();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
// });
|
|
// });
|
|
// });
|
|
// });
|
|
});
|
|
},
|
|
/** 删除按钮操作 */
|
|
handleDelete(row) {
|
|
const ids = row.dikeCode || this.ids;
|
|
if (ids) {
|
|
this.$confirm("是否删除选中的数据?", "警告", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
})
|
|
.then(function () {
|
|
return delDikeMarkAll(ids);
|
|
})
|
|
.then(() => {
|
|
this.getList();
|
|
this.msgSuccess("删除成功");
|
|
})
|
|
.catch(function () {});
|
|
} else {
|
|
this.$message.warning("请选择要删除的数据!!");
|
|
}
|
|
},
|
|
// 弹出框每一个小表单的减号 删除
|
|
delForm(itemId, type, index) {
|
|
console.log(111, itemId, type, index);
|
|
this["counter" + type].splice(index, 1);
|
|
// console.log("counter" + type, this["counter" + type]);
|
|
if (itemId) this.delIdList.push(itemId);
|
|
console.log(222, this.delIdList);
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
@import "@/assets/css/dialog.scss";
|
|
|
|
::v-deep .el-dialog {
|
|
margin-top: 2vh !important;
|
|
}
|
|
|
|
.mainCon {
|
|
display: flex;
|
|
overflow-x: auto;
|
|
|
|
.list {
|
|
min-height: 800px;
|
|
min-width: 800px;
|
|
flex: 2;
|
|
}
|
|
}
|
|
.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;
|
|
color: #36b29e;
|
|
}
|
|
.addBtn {
|
|
color: #36b29e;
|
|
cursor: pointer;
|
|
}
|
|
.addBtn:hover {
|
|
color: #31a08e;
|
|
}
|
|
}
|
|
</style>
|
|
|