Commit 2041e3b4 by jiang'yun

修改

parent 3b65d434
import request from '@/utils/request'
// 查询投票单位列表
export function listTpDept(query) {
return request({
url: '/system/tpDept/list',
method: 'get',
params: query
})
}
// 查询投票单位列表
export function listTpDeptjg(query) {
return request({
url: '/system/tpDept/listjg',
method: 'get',
params: query
})
}
// 查询投票单位详细
export function getTpDept(id) {
return request({
url: '/system/tpDept/' + id,
method: 'get'
})
}
// 新增投票单位
export function addTpDept(data) {
return request({
url: '/system/tpDept',
method: 'post',
data: data
})
}
// 修改投票单位
export function updateTpDept(data) {
return request({
url: '/system/tpDept',
method: 'put',
data: data
})
}
// 删除投票单位
export function delTpDept(id) {
return request({
url: '/system/tpDept/' + id,
method: 'delete'
})
}
import request from '@/utils/request'
// 查询投票信息列表
export function listTpInfo(query) {
return request({
url: '/system/tpInfo/list',
method: 'get',
params: query
})
}
// 查询投票信息列表
export function listTpInfoJg(query) {
return request({
url: '/system/tpInfo/listjg',
method: 'get',
params: query
})
}
// 查询投票信息详细
export function getTpInfo(id) {
return request({
url: '/system/tpInfo/' + id,
method: 'get'
})
}
// 新增投票信息
export function addTpInfo(data) {
return request({
url: '/system/tpInfo',
method: 'post',
data: data
})
}
// 修改投票信息
export function updateTpInfo(data) {
return request({
url: '/system/tpInfo',
method: 'put',
data: data
})
}
// 删除投票信息
export function delTpInfo(id) {
return request({
url: '/system/tpInfo/' + id,
method: 'delete'
})
}
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="所属板块" prop="ssbk">
<el-select v-model="queryParams.ssbk" clearable>
<el-option
v-for="dict in dict.type.tp_ssbk"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="单位名称" prop="dwmc">
<el-input
v-model="queryParams.dwmc"
placeholder="请输入单位名称"
clearable
@keyup.enter.native="handleQuery"
/>
</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-table v-loading="loading" border :data="tpDeptList" @selection-change="handleSelectionChange">
<el-table-column label="所属板块" min-width="180px" align="center" prop="ssbk" />
<el-table-column label="单位名称" min-width="180px" align="center" prop="dwmc" />
<el-table-column label="投票数量" min-width="180px" align="center" prop="sl" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listTpDept,listTpDeptjg, getTpDept, delTpDept, addTpDept, updateTpDept } from "@/api/tp/tpDept";
export default {
name: "TpDept",
dicts: [ 'tp_ssbk'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 投票单位表格数据
tpDeptList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
ssbk: null,
dwmc: null,
yl1: null,
yl2: null,
yl3: null,
yl4: null,
yl5: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询投票单位列表 */
getList() {
this.loading = true;
listTpDeptjg(this.queryParams).then(response => {
this.tpDeptList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
ssbk: null,
dwmc: null,
remark: null,
yl1: null,
yl2: null,
yl3: null,
yl4: null,
yl5: 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
getTpDept(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) {
updateTpDept(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addTpDept(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 delTpDept(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/tpDept/export', {
...this.queryParams
}, `tpDept_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="姓名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入姓名"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="AD账号" prop="ipdz">
<el-input
v-model="queryParams.ipdz"
placeholder="请输入AD账号"
clearable
@keyup.enter.native="handleQuery"
/>
</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-table v-loading="loading" border :data="tpInfoList" @selection-change="handleSelectionChange">
<el-table-column label="姓名" align="center" width="180px" prop="name" />
<el-table-column label="AD账号" align="center" prop="ipdz" width="180px" />
<el-table-column prop="dwmc" label="投票单位" min-width="150px" align="left" >
<template slot-scope="scope">
<el-tooltip popper-class="table-tooltip" :content="scope.row.dwmc" placement="top">
<div class="long_title">
<span>{{scope.row.dwmc}}</span>
</div>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listTpInfo, listTpInfoJg,getTpInfo, delTpInfo, addTpInfo, updateTpInfo } from "@/api/tp/tpInfo";
export default {
name: "TpInfo",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 子表选中数据
checkedTpInfoCb: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 投票信息表格数据
tpInfoList: [],
// 投票信息从表格数据
tpInfoCbList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
sfzh: null,
ipdz: null,
yl1: null,
yl2: null,
yl3: null,
yl4: null,
yl5: null
},
// 表单参数
form: {},
// 表单校验
rules: {
createTime: [
{ required: true, message: "录入时间不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询投票信息列表 */
getList() {
this.loading = true;
listTpInfoJg(this.queryParams).then(response => {
this.tpInfoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
sfzh: null,
ipdz: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
yl1: null,
yl2: null,
yl3: null,
yl4: null,
yl5: null
};
this.tpInfoCbList = [];
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
getTpInfo(id).then(response => {
this.form = response.data;
this.tpInfoCbList = response.data.tpInfoCbList;
this.open = true;
this.title = "修改投票信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.tpInfoCbList = this.tpInfoCbList;
if (this.form.id != null) {
updateTpInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addTpInfo(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 delTpInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 投票信息从序号 */
rowTpInfoCbIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** 投票信息从添加按钮操作 */
handleAddTpInfoCb() {
let obj = {};
obj.ssbk = "";
obj.dwid = "";
obj.dwmc = "";
this.tpInfoCbList.push(obj);
},
/** 投票信息从删除按钮操作 */
handleDeleteTpInfoCb() {
if (this.checkedTpInfoCb.length == 0) {
this.$modal.msgError("请先选择要删除的投票信息从数据");
} else {
const tpInfoCbList = this.tpInfoCbList;
const checkedTpInfoCb = this.checkedTpInfoCb;
this.tpInfoCbList = tpInfoCbList.filter(function(item) {
return checkedTpInfoCb.indexOf(item.index) == -1
});
}
},
/** 复选框选中数据 */
handleTpInfoCbSelectionChange(selection) {
this.checkedTpInfoCb = selection.map(item => item.index)
},
/** 导出按钮操作 */
handleExport() {
this.download('system/tpInfo/export', {
...this.queryParams
}, `tpInfo_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style>
.table-tooltip {
max-width: 500px;
}
.long_title{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment