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

更新更新

上级 dfc32284
import request from '@/utils/request'
// 查询调查员列表
export function listInvestigator(query) {
return request({
url: '/backstage/investigator/list',
method: 'get',
params: query
})
}
// 查询调查员详细
export function getInvestigator(userId) {
return request({
url: '/backstage/investigator/' + userId,
method: 'get'
})
}
// 新增调查员
export function addInvestigator(data) {
return request({
url: '/backstage/investigator',
method: 'post',
data: data
})
}
// 修改调查员
export function updateInvestigator(data) {
return request({
url: '/backstage/investigator',
method: 'put',
data: data
})
}
// 删除调查员
export function delInvestigator(userId) {
return request({
url: '/backstage/investigator/' + userId,
method: 'delete'
})
}
export function changeInvestigatorStatus(userId, status) {
const data = {
userId,
status
}
return request({
url: '/backstage/investigator/changeStatus',
method: 'put',
data: data
})
}
// 用户密码重置
export function resetUserPwd(userId, password) {
const data = {
userId,
password
}
return request({
url: '/backstage/investigator/resetPwd',
method: 'put',
data: data
})
}
// 导出调查员
export function exportInvestigator(query) {
return request({
url: '/backstage/investigator/export',
method: 'get',
params: query
})
}
\ No newline at end of file
...@@ -65,31 +65,32 @@ ...@@ -65,31 +65,32 @@
v-hasPermi="['backstage:area:remove']" v-hasPermi="['backstage:area:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <!-- <el-col :span="1.5">-->
<el-button <!-- <el-button-->
type="warning" <!-- type="warning"-->
icon="el-icon-download" <!-- icon="el-icon-download"-->
size="mini" <!-- size="mini"-->
@click="handleExport" <!-- @click="handleExport"-->
v-hasPermi="['backstage:area:export']" <!-- v-hasPermi="['backstage:area:export']"-->
>导出</el-button> <!-- >导出</el-button>-->
</el-col> <!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="areaList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="areaList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" /> <el-table-column label="id" align="center" prop="id" />
<el-table-column label="父id" align="center" prop="parentId" /> <!-- <el-table-column label="父id" align="center" prop="parentId" />-->
<el-table-column label="上级地区名" align="center" prop="parentName" />
<el-table-column label="地区名" align="center" prop="areaName" /> <el-table-column label="地区名" align="center" prop="areaName" />
<el-table-column label="级别" align="center" prop="level" > <el-table-column label="级别" align="center" >
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.payStatus==1"></span> <span v-if="scope.row.level==1"></span>
<span v-if="scope.row.payStatus==2"></span> <span v-if="scope.row.level==2"></span>
<span v-if="scope.row.payStatus==3">县 区</span> <span v-if="scope.row.level==3">县 区</span>
<span v-if="scope.row.payStatus==4">乡镇</span> <span v-if="scope.row.level==4">乡镇</span>
<span v-if="scope.row.payStatus==5">行政村</span> <span v-if="scope.row.level==5">行政村</span>
<span v-if="scope.row.payStatus==6">自然村</span> <span v-if="scope.row.level==6">自然村</span>
</template> </template>
</el-table-column> </el-table-column>
...@@ -146,11 +147,11 @@ ...@@ -146,11 +147,11 @@
<el-option label="自然村" value="6" /> <el-option label="自然村" value="6" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="状态 1正常 0删除"> <!-- <el-form-item label="状态 1正常 0删除">-->
<el-radio-group v-model="form.status"> <!-- <el-radio-group v-model="form.status">-->
<el-radio label="1">请选择字典生成</el-radio> <!-- <el-radio label="1">请选择字典生成</el-radio>-->
</el-radio-group> <!-- </el-radio-group>-->
</el-form-item> <!-- </el-form-item>-->
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="repeatSubmit"> </el-button> <el-button type="primary" @click="submitForm" :disabled="repeatSubmit"> </el-button>
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="90px">
<el-form-item label="调查员名称" prop="nickName" >
<el-input
v-model="queryParams.nickName"
placeholder="请输入调查员名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</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:investigator: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:investigator: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:investigator: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:investigator:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="investigatorList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="用户id" align="center" prop="userId" />
<el-table-column label="调查员账号" align="center" prop="userName" />
<el-table-column label="调查员名称" align="center" prop="nickName" />
<el-table-column label="差错率" align="center" prop="errorRate" />
<el-table-column label="已完成任务数" align="center" prop="completedJobNum" />
<el-table-column label="待上报任务数" align="center" prop="notReportedJobNum" />
<el-table-column label="被打回任务数" align="center" prop="repulseJobNum" />
<el-table-column label="待复查任务数" align="center" prop="notReviewedJobNum" />
<el-table-column label="待审核任务数" align="center" prop="examineJobNum" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建日期" align="center" prop="createTime" />
<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:investigator:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-key"
@click="handleResetPwd(scope.row)"
v-hasPermi="['backstage:investigator:edit']"
>重置</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['backstage:investigator: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-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="调查员名称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入调查员名称" />
</el-form-item>
<el-form-item label="调查员账号" prop="userName">
<el-input v-model="form.userName" placeholder="请输入调查员账号(只允许英文和数字)" @keyup.native="btKeyUpUsername" />
</el-form-item>
<el-form-item v-if="form.userId == undefined" label="密码" prop="password">
<el-input v-model="form.password" placeholder="请输入密码" type="password" show-password/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="repeatSubmit">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listInvestigator,changeInvestigatorStatus, getInvestigator, delInvestigator,resetUserPwd, addInvestigator, updateInvestigator, exportInvestigator } from "@/api/backstage/investigator";
export default {
name: "Investigator",
data() {
return {
// 不可重复提交
repeatSubmit: false,
// 遮罩层
loading: true,
// 选中数组
userIds: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 调查员表格数据
investigatorList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
nickName: null
},
// 表单参数
form: {},
// 表单校验
rules: {
userName: [
{
required: true,
message: "账号不能为空",
trigger: "blur"
},
{
pattern: /^(?![0-9]*$)(?![a-zA-Z]*$)[a-zA-Z0-9]{4,15}$/,
message: "账号必须为4-20位字母和数字组合",
trigger: "blur"
}
],
nickName:[
{
required: true,
message: "名称不能为空",
trigger: "blur"
},
]
}
};
},
created() {
this.getList();
},
methods: {
// 禁止输入特殊字符
// btKeyUpUsername (e) {
// e.target.value = e.target.value.replace(/[`~*~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/g, '').replace(/[\W]/g,'')
// this.form.userName= e.target.value
// },
/** 查询列表 */
getList() {
this.loading = true;
listInvestigator(this.queryParams).then(response => {
this.investigatorList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
userId: null,
openId: null,
nickName: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.userIds = selection.map(item => item.userId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 重置密码按钮操作 */
handleResetPwd(row) {
this.$prompt('请输入"' + row.nickName + '"的新密码', "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消"
}).then(({ value }) => {
resetUserPwd(row.userId, value).then(response => {
this.msgSuccess("修改成功,新密码是:" + value);
});
}).catch(() => {});
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加调查员";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const userId = row.userId || this.userIds
getInvestigator(userId).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.userId != null) {
updateInvestigator(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInvestigator(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
// 状态修改
handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
this.$confirm('确认要"' + text + '""' + row.nickName + '"调查员吗?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return changeInvestigatorStatus(row.userId, row.status);
}).then(() => {
this.msgSuccess(text + "成功");
}).catch(function() {
row.status = row.status === "0" ? "1" : "0";
});
},
/** 删除按钮操作 */
handleDelete(row) {
const userIds = row.userId || this.userIds;
this.$confirm('是否确认删除调查员编号为"' + userIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delInvestigator(userIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有调查员数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportInvestigator(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>
...@@ -2,31 +2,31 @@ ...@@ -2,31 +2,31 @@
<div class="app-container"> <div class="app-container">
<el-row :gutter="20"> <el-row :gutter="20">
<!--部门数据--> <!--部门数据-->
<el-col :span="4" :xs="24"> <!-- <el-col :span="4" :xs="24">-->
<div class="head-container"> <!-- <div class="head-container">-->
<el-input <!-- <el-input-->
v-model="deptName" <!-- v-model="deptName"-->
placeholder="请输入部门名称" <!-- placeholder="请输入部门名称"-->
clearable <!-- clearable-->
size="small" <!-- size="small"-->
prefix-icon="el-icon-search" <!-- prefix-icon="el-icon-search"-->
style="margin-bottom: 20px" <!-- style="margin-bottom: 20px"-->
/> <!-- />-->
</div> <!-- </div>-->
<div class="head-container"> <!-- <div class="head-container">-->
<el-tree <!-- <el-tree-->
:data="deptOptions" <!-- :data="deptOptions"-->
:props="defaultProps" <!-- :props="defaultProps"-->
:expand-on-click-node="false" <!-- :expand-on-click-node="false"-->
:filter-node-method="filterNode" <!-- :filter-node-method="filterNode"-->
ref="tree" <!-- ref="tree"-->
default-expand-all <!-- default-expand-all-->
@node-click="handleNodeClick" <!-- @node-click="handleNodeClick"-->
/> <!-- />-->
</div> <!-- </div>-->
</el-col> <!-- </el-col>-->
<!--用户数据--> <!--用户数据-->
<el-col :span="20" :xs="24"> <el-col :span="24">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="用户名称" prop="userName"> <el-form-item label="用户名称" prop="userName">
<el-input <el-input
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论