提交 ed8d4fe7 authored 作者: 谢廷雅's avatar 谢廷雅

区间值页面

上级 39e7ab51
import request from '@/utils/request'
// 查询地图区间设置列表
export function listInterval(query) {
return request({
url: '/backstage/interval/list',
method: 'get',
params: query
})
}
// 查询地图区间设置详细
export function getInterval(id) {
export function getIntervalInfoByPointType(pointType) {
return request({
url: '/backstage/interval/' + id,
url: '/backstage/interval/' + pointType,
method: 'get'
})
}
// 新增地图区间设置
export function addInterval(data) {
return request({
url: '/backstage/interval',
method: 'post',
data: data
})
}
// 修改地图区间设置
export function updateInterval(data) {
export function updateIntervalByPointType(data) {
return request({
url: '/backstage/interval',
method: 'put',
data: data
})
}
// 删除地图区间设置
export function delInterval(id) {
return request({
url: '/backstage/interval/' + id,
method: 'delete'
})
}
// 导出地图区间设置
export function exportInterval(query) {
return request({
url: '/backstage/interval/export',
method: 'get',
params: query
})
}
\ No newline at end of file
<template>
<div class="app-container">
<!-- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">-->
<!-- <el-form-item label="第一个区间值,XX以上的值也填此处" prop="firstNo">-->
<!-- <el-input-->
<!-- v-model="queryParams.firstNo"-->
<!-- placeholder="请输入第一个区间值,XX以上的值也填此处"-->
<!-- clearable-->
<!-- size="small"-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="第二个区间值" prop="lastNo">-->
<!-- <el-input-->
<!-- v-model="queryParams.lastNo"-->
<!-- placeholder="请输入第二个区间值"-->
<!-- clearable-->
<!-- size="small"-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="类型" prop="type">-->
<!-- <el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small">-->
<!-- <el-option label="请选择字典生成" value="" />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="统计点类型" prop="statisticsPointType">-->
<!-- <el-select v-model="queryParams.statisticsPointType" placeholder="请选择统计点类型" clearable size="small">-->
<!-- <el-option label="请选择字典生成" value="" />-->
<!-- </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="['backstage:interval: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="['backstage:interval: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="['backstage:interval:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['backstage:interval:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
<!-- </el-row>-->
<!-- <el-table v-loading="loading" :data="intervalList" @selection-change="handleSelectionChange">-->
<!-- <el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="自增id" align="center" prop="id" />-->
<!-- <el-table-column label="第一个区间值,XX以上的值也填此处" align="center" prop="firstNo" />-->
<!-- <el-table-column label="第二个区间值" align="center" prop="lastNo" />-->
<!-- <el-table-column label="类型" align="center" prop="type" />-->
<!-- <el-table-column label="统计点类型" align="center" prop="statisticsPointType" />-->
<!-- <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="['backstage:interval:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['backstage:interval: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="500px" append-to-body>
</el-dialog>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="第一个区间值,XX以上的值也填此处" prop="firstNo">
<el-input v-model="form.firstNo" placeholder="请输入第一个区间值,XX以上的值也填此处" />
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="统计点类型" prop="statisticsPointType">
<el-select v-model="form.statisticsPointType" placeholder="请选择统计点类型" @change="getIntervalInfo">
<el-option label="省级" value="1" />
<el-option label="市级" value="2" />
<el-option label="县级" value="3" />
<el-option label="乡级" value="4" />
<el-option label="村级" value="5" />
<el-option label="自然村" value="6" />
</el-select>
</el-form-item>
<el-form-item label="第一个区间值" prop="firstNo">
<el-input type="number" v-model="form.firstNo" placeholder="请输入第一个区间值,XX以上的值只需填第一个区间值" />
<!-- <p style="color: red"> 注:XX以上的值只需填第一个区间值</p>-->
</el-form-item>
<el-form-item label="第二个区间值" prop="lastNo">
<el-input v-model="form.lastNo" placeholder="请输入第二个区间值" />
<el-input type="number" v-model="form.lastNo" placeholder="请输入第二个区间值" />
</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="statisticsPointType">
<el-select v-model="form.statisticsPointType" placeholder="请选择统计点类型">
<el-option label="请选择字典生成" value="" />
<el-option label="区间值" value="1" />
<el-option label="XX以上" value="0" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="repeatSubmit">确 定</el-button>
......@@ -145,7 +44,7 @@
</template>
<script>
import { listInterval, getInterval, delInterval, addInterval, updateInterval, exportInterval } from "@/api/backstage/interval";
import { getIntervalInfoByPointType, updateIntervalByPointType } from "@/api/backstage/interval";
export default {
name: "Interval",
......@@ -157,33 +56,45 @@ export default {
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 地图区间设置表格数据
intervalList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
firstNo: null,
lastNo: null,
type: null,
statisticsPointType: null,
},
// 表单参数
form: {},
form: {
id: null,
firstNo: null,
lastNo: null,
type: null,
statisticsPointType: null,
createTime: null,
updateTime: null
},
// 表单校验
rules: {
statisticsPointType:[
{
required: true,
message: "统计点类型不能为空",
trigger: "blur"
},
],
firstNo:[
{
required: true,
message: "第一个区间值不能为空",
trigger: "blur"
},
],
type:[
{
required: true,
message: "类型不能为空",
trigger: "blur"
},
]
}
};
},
......@@ -191,15 +102,23 @@ export default {
this.getList();
},
methods: {
/** 查询地图区间设置列表 */
getList() {
this.loading = true;
listInterval(this.queryParams).then(response => {
this.intervalList = response.rows;
this.total = response.total;
this.loading = false;
});
},
getIntervalInfo() {
getIntervalInfoByPointType(this.form.statisticsPointType).then(response => {
this.form = response.data;
});
},
// /** 查询地图区间设置列表 */
// getList() {
// this.loading = true;
// listInterval(this.queryParams).then(response => {
// this.intervalList = response.rows;
// this.total = response.total;
// this.loading = false;
// });
// },
// 取消按钮
cancel() {
this.open = false;
......@@ -218,89 +137,52 @@ export default {
};
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
getInterval(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改地图区间设置";
});
},
/** 提交按钮 */
submitForm() {
this.repeatSubmit=true
setTimeout(()=>{
this.repeatSubmit = false //点击一次时隔两秒后才能再次点击
},2000)
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInterval(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInterval(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
var lastNo=Number(this.form.lastNo)
var firstNo=Number(this.form.firstNo)
//区间值
if(this.form.type == 1){
if (lastNo==null) {
console.log( "1111")
this.msgError("第二区间值为空!请输入第二区间值")
}else if(lastNo<=firstNo){
console.log( "2222")
this.msgError("第二区间值必须大于第一区间值")
}
else {
console.log( "3333")
this.$refs["form"].validate(valid => {
if (valid) {
updateIntervalByPointType(this.form).then(response => {
this.msgSuccess("修改成功");
});
}
});
}
//xx以上
}else if(this.form.type == 0){
if(lastNo>0){
console.log( "44444")
this.msgError("第二区间值x需为空!")
}else {
console.log( "5555")
this.$refs["form"].validate(valid => {
if (valid) {
updateIntervalByPointType(this.form).then(response => {
this.msgSuccess("修改成功");
});
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除地图区间设置编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delInterval(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有地图区间设置数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportInterval(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论