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.
 
 
 

658 lines
18 KiB

<template>
<div>
<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>
<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.cv.value"
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="dikeCode">
<el-select
v-model="queryParams.data.dikeCode"
placeholder="请选择关联堤防"
style="width: 100%"
@change="handleQuery"
>
<el-option
v-for="dict in dikeNameOptions"
:key="dict.id"
:label="dict.dikeName"
:value="dict.dikeCode"
></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="物资名称" prop="materialName">
<el-input
v-model="queryParams.data.materialName"
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="personName" label-width="84px">
<el-input
v-model="queryParams.data.personName"
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>
<!-- <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="['df:fxwz: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="['df:fxwz: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="['df:fxwz:remove']"
>删除</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="fxwzList"
@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="dikeName"
min-width="120"
/>
<!-- <el-table-column
label="关联堤防"
align="center"
prop="dikeCode"
:formatter="dikeCodeFormat"
min-width="120"
/> -->
<el-table-column
label="物资名称"
align="center"
prop="materialName"
min-width="120"
/>
<!-- <el-table-column
label="堤防名称"
align="center"
prop="dikeName"
min-width="120"
/> -->
<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"
sortable
prop="materialNumber"
min-width="120"
/>
<el-table-column
label="采购时间"
align="center"
sortable
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="materialType"
:formatter="materialTypeFormat"
min-width="120"
/>
<el-table-column
label="保质期"
align="center"
sortable
prop="shelfLife"
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="['df:fxwz:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['df:fxwz: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"
>
<el-form ref="form" :model="form" :rules="rules" label-width="96px">
<el-form-item label="关联堤防" prop="dikeCode">
<linkDike :form="form" v-if="open" />
<!-- <el-select
v-model="form.dikeCode"
placeholder="请选择关联堤防"
style="width: 100%"
>
<el-option
v-for="dict in dikeNameOptions"
:key="dict.id"
:label="dict.dikeName"
:value="dict.dikeCode"
></el-option>
</el-select> -->
</el-form-item>
<el-form-item label="物资名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入物资名称" />
</el-form-item>
<!-- <el-form-item label="堤防名称" prop="dikeName">
<el-input v-model="form.dikeName" placeholder="请输入堤防名称" />
</el-form-item> -->
<el-form-item label="负责人名称" prop="personName">
<el-input v-model="form.personName" placeholder="请输入负责人名称" />
</el-form-item>
<el-form-item label="负责人电话" prop="personPhone">
<el-input v-model="form.personPhone" placeholder="请输入负责人电话" />
</el-form-item>
<el-form-item label="负责人职务" prop="personLevel">
<el-input v-model="form.personLevel" placeholder="请输入负责人职务" />
</el-form-item>
<el-form-item label="物资数量" prop="materialNumber">
<el-input
v-model="form.materialNumber"
placeholder="请输入物资数量"
/>
</el-form-item>
<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-form-item label="物资种类" prop="materialType">
<el-select
v-model="form.materialType"
placeholder="请选择物资种类"
style="width: 100%"
>
<el-option
v-for="dict in materialTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="保质期" prop="shelfLife">
<el-input v-model="form.shelfLife" placeholder="请输入保质期" />
</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 {
listFxwz,
getFxwz,
delFxwz,
addFxwz,
updateFxwz,
exportFxwz,
} from "@/api/yg/dike/fxwz";
import { listJbxx, getJbxx } from "@/api/yg/dike/jbxx";
import linkDike from "@/components/linkNameSelect/linkDike.vue";
export default {
name: "Fxwz",
components: {
linkDike,
},
data() {
return {
// 面包屑,路由信息
routeList: [
{
path: "/dike/safetyManage/floodControlManagement/supplies",
routeName: "防汛物资管理",
},
],
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 堤防防汛物资表格数据
fxwzList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 物资种类字典
materialTypeOptions: [],
// 堤防项目
dikeNameOptions: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
ids: null,
data: {
dikeCode: null,
materialName: null,
dikeName: null,
personName: null,
personPhone: null,
personLevel: null,
materialNumber: null,
procurementTime: null,
materialType: null,
createUid: null,
updateUid: null,
owerDept: null,
relation: null,
},
cv: {
type: "like",
name: "dikeName",
value: null,
},
// 排序方式
params: {
// 按哪个字段排序
orderBy: "create_time",
// desc降序,升序asc
sortBy: "desc",
},
},
// 表单参数
form: {},
// 表单校验
rules: {
dikeCode: [
{ required: true, message: "请选择关联堤防", trigger: "blur" },
],
materialName: [
{ required: true, message: "请输入物资名称", trigger: "blur" },
],
personName: [
{ required: true, message: "请输入负责人名称", trigger: "blur" },
],
personPhone: [
{
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",
},
],
materialNumber: [
{
pattern: /^[1-9]\d*$/,
message: "请输入正整数,不包含0",
trigger: "blur",
},
],
},
};
},
created() {
this.getList();
listJbxx({ data: {} }).then((res) => {
// console.log(111, res);
this.dikeNameOptions = res.records;
});
this.getDicts("types_materials").then((response) => {
this.materialTypeOptions = response.data;
});
},
methods: {
/** 查询堤防防汛物资列表 */
getList() {
this.loading = true;
listFxwz(this.queryParams).then((response) => {
this.fxwzList = response.records;
this.total = response.total;
this.loading = false;
});
},
dikeCodeFormat(row) {
const dikeCode = row.dikeCode;
let data = this.dikeNameOptions.find((res) => res.dikeCode == dikeCode);
if (data) return data.dikeName;
},
// 物资种类字典翻译
materialTypeFormat(row, column) {
return this.selectDictLabel(this.materialTypeOptions, row.materialType);
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
dikeCode: null,
materialName: null,
dikeName: null,
personName: null,
personPhone: null,
personLevel: null,
materialNumber: null,
procurementTime: null,
materialType: 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,
dikeCode: null,
materialName: null,
dikeName: null,
personName: null,
personPhone: null,
personLevel: null,
materialNumber: null,
procurementTime: null,
materialType: null,
createUid: null,
updateUid: null,
createTime: null,
updateTime: null,
owerDept: null,
remark: null,
relation: null,
},
cv: {
type: "like",
name: "dikeName",
value: 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.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;
getFxwz(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) {
updateFxwz(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addFxwz(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 delFxwz(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {});
} else {
this.$message.warning("请选择要删除的数据!!");
}
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
let message = "是否确认导出所有的数据项?";
if (this.ids) {
message = "是否确认导出选中的数据项?";
queryParams.ids = this.ids;
}
this.$confirm(message, "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return exportFxwz(queryParams);
})
.then((response) => {
this.downloadFile(response, true, response.msg);
// this.download(response.msg);
})
.catch(function () {});
},
},
};
</script>
<style lang="scss" scoped>
@import "@/assets/css/dialog.scss";
</style>