|
@@ -1,19 +1,19 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<el-row :gutter="20">
|
|
|
- <!--用户数据1-->
|
|
|
+ <!--用户数据-->
|
|
|
<el-col :xs="24">
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
|
|
|
- <el-form-item label="专业" prop="majorName">
|
|
|
+ <el-form-item label="专业名称" prop="majorName">
|
|
|
<el-input
|
|
|
- v-model="queryParams.userName"
|
|
|
- placeholder="请输入专业"
|
|
|
+ v-model="queryParams.majorName"
|
|
|
+ placeholder="请输入专业名称"
|
|
|
clearable
|
|
|
style="width: 240px"
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
+
|
|
|
<el-form-item label="创建时间">
|
|
|
<el-date-picker
|
|
|
v-model="dateRange"
|
|
@@ -39,7 +39,7 @@
|
|
|
icon="el-icon-plus"
|
|
|
size="mini"
|
|
|
@click="handleAdd"
|
|
|
- v-hasPermi="['system:user:add']"
|
|
|
+ v-hasPermi="['sim:major:add']"
|
|
|
>新增</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
@@ -50,7 +50,7 @@
|
|
|
size="mini"
|
|
|
:disabled="single"
|
|
|
@click="handleUpdate"
|
|
|
- v-hasPermi="['system:user:edit']"
|
|
|
+ v-hasPermi="['sim:major:edit']"
|
|
|
>修改</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
@@ -61,7 +61,7 @@
|
|
|
size="mini"
|
|
|
:disabled="multiple"
|
|
|
@click="handleDelete"
|
|
|
- v-hasPermi="['system:user:remove']"
|
|
|
+ v-hasPermi="['sim:major:remove']"
|
|
|
>删除</el-button>
|
|
|
</el-col>
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
|
@@ -69,9 +69,9 @@
|
|
|
|
|
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="50" align="center" />
|
|
|
- <el-table-column label="编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
|
|
|
- <el-table-column label="专业名称" align="center" key="nickName" prop="nickName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
|
|
- <el-table-column label="备注" align="center" prop="remark" width="160" />
|
|
|
+ <el-table-column label="编号" align="center" key="majorId" prop="majorId" v-if="columns[0].visible" />
|
|
|
+ <el-table-column label="专业名称" align="center" key="majorName" prop="majorName" v-if="columns[1].visible" />
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" width="160" v-if="columns[2].visible"/>
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[3].visible" width="160">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
@@ -89,14 +89,14 @@
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
- v-hasPermi="['system:user:edit']"
|
|
|
+ v-hasPermi="['sim:major:edit']"
|
|
|
>修改</el-button>
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-delete"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
- v-hasPermi="['system:user:remove']"
|
|
|
+ v-hasPermi="['sim:major:remove']"
|
|
|
>删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -117,8 +117,8 @@
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item label="专业名称" prop="nickName">
|
|
|
- <el-input v-model="form.nickName" placeholder="请输入专业名称" maxlength="30" />
|
|
|
+ <el-form-item label="专业名称" prop="majorName">
|
|
|
+ <el-input v-model="form.majorName" placeholder="请输入专业名称" maxlength="30" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -135,21 +135,15 @@
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
-
|
|
|
-
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user";
|
|
|
-import { getToken } from "@/utils/auth";
|
|
|
-import Treeselect from "@riophae/vue-treeselect";
|
|
|
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
-
|
|
|
+import { listMajor, getMajor, delMajor, addMajor, updateMajor, resetUserPwd } from "@/api/sim/major";
|
|
|
export default {
|
|
|
- name: "User",
|
|
|
+ name: "Major",
|
|
|
dicts: ['sys_normal_disable', 'sys_user_sex'],
|
|
|
- components: { Treeselect },
|
|
|
+ // components: { Treeselect },
|
|
|
data() {
|
|
|
return {
|
|
|
// 遮罩层
|
|
@@ -170,45 +164,19 @@ export default {
|
|
|
title: "",
|
|
|
// 是否显示弹出层
|
|
|
open: false,
|
|
|
- // 部门名称
|
|
|
- deptName: undefined,
|
|
|
- // 默认密码
|
|
|
- initPassword: undefined,
|
|
|
// 日期范围
|
|
|
dateRange: [],
|
|
|
- // 岗位选项
|
|
|
- postOptions: [],
|
|
|
- // 角色选项
|
|
|
- roleOptions: [],
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
defaultProps: {
|
|
|
children: "children",
|
|
|
label: "label"
|
|
|
},
|
|
|
- // 用户导入参数
|
|
|
- upload: {
|
|
|
- // 是否显示弹出层(用户导入)
|
|
|
- open: false,
|
|
|
- // 弹出层标题(用户导入)
|
|
|
- title: "",
|
|
|
- // 是否禁用上传
|
|
|
- isUploading: false,
|
|
|
- // 是否更新已经存在的用户数据
|
|
|
- updateSupport: 0,
|
|
|
- // 设置上传的请求头部
|
|
|
- headers: { Authorization: "Bearer " + getToken() },
|
|
|
- // 上传的地址
|
|
|
- url: process.env.VUE_APP_BASE_API + "/system/user/importData"
|
|
|
- },
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
- userName: undefined,
|
|
|
- phonenumber: undefined,
|
|
|
- status: undefined,
|
|
|
- deptId: undefined
|
|
|
+ majorName: undefined,
|
|
|
},
|
|
|
// 列信息
|
|
|
columns: [
|
|
@@ -219,53 +187,25 @@ export default {
|
|
|
],
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
- userName: [
|
|
|
- { required: true, message: "用户名称不能为空", trigger: "blur" },
|
|
|
- { min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' }
|
|
|
- ],
|
|
|
- nickName: [
|
|
|
- { required: true, message: "用户昵称不能为空", trigger: "blur" }
|
|
|
+ majorName: [
|
|
|
+ { required: true, message: "专业名称不能为空", trigger: "blur" },
|
|
|
],
|
|
|
- password: [
|
|
|
- { required: true, message: "用户密码不能为空", trigger: "blur" },
|
|
|
- { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' },
|
|
|
- { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
|
|
- ],
|
|
|
- email: [
|
|
|
- {
|
|
|
- type: "email",
|
|
|
- message: "请输入正确的邮箱地址",
|
|
|
- trigger: ["blur", "change"]
|
|
|
- }
|
|
|
- ],
|
|
|
- phonenumber: [
|
|
|
- {
|
|
|
- pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
|
|
- message: "请输入正确的手机号码",
|
|
|
- trigger: "blur"
|
|
|
- }
|
|
|
- ]
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
- // 根据名称筛选部门树
|
|
|
- deptName(val) {
|
|
|
- this.$refs.tree.filter(val);
|
|
|
- }
|
|
|
},
|
|
|
created() {
|
|
|
this.getList();
|
|
|
- // this.getDeptTree();
|
|
|
- this.getConfigKey("sys.user.initPassword").then(response => {
|
|
|
- this.initPassword = response.msg;
|
|
|
- });
|
|
|
+ // this.getConfigKey("sys.user.initPassword").then(response => {
|
|
|
+ // this.initPassword = response.msg;
|
|
|
+ // });
|
|
|
},
|
|
|
methods: {
|
|
|
/** 查询用户列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
- listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
|
|
+ listMajor(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
|
|
this.userList = response.rows;
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|
|
@@ -281,7 +221,7 @@ export default {
|
|
|
handleStatusChange(row) {
|
|
|
let text = row.status === "0" ? "启用" : "停用";
|
|
|
this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() {
|
|
|
- return changeUserStatus(row.userId, row.status);
|
|
|
+ return changeUserStatus(row.majorId, row.status);
|
|
|
}).then(() => {
|
|
|
this.$modal.msgSuccess(text + "成功");
|
|
|
}).catch(function() {
|
|
@@ -296,18 +236,9 @@ export default {
|
|
|
// 表单重置
|
|
|
reset() {
|
|
|
this.form = {
|
|
|
- userId: undefined,
|
|
|
- deptId: undefined,
|
|
|
- userName: undefined,
|
|
|
- nickName: undefined,
|
|
|
- password: undefined,
|
|
|
- phonenumber: undefined,
|
|
|
- email: undefined,
|
|
|
- sex: undefined,
|
|
|
- status: "0",
|
|
|
+ majorId: undefined,
|
|
|
+ majorName: undefined,
|
|
|
remark: undefined,
|
|
|
- postIds: [],
|
|
|
- roleIds: []
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
},
|
|
@@ -325,7 +256,7 @@ export default {
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.userId);
|
|
|
+ this.ids = selection.map(item => item.majorId);
|
|
|
this.single = selection.length != 1;
|
|
|
this.multiple = !selection.length;
|
|
|
},
|
|
@@ -345,65 +276,41 @@ export default {
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
|
this.reset();
|
|
|
- getUser().then(response => {
|
|
|
- this.postOptions = response.posts;
|
|
|
- this.roleOptions = response.roles;
|
|
|
+ // getMajor().then(response => {
|
|
|
+ // this.postOptions = response.posts;
|
|
|
+ // this.roleOptions = response.roles;
|
|
|
this.open = true;
|
|
|
- this.title = "添加用户";
|
|
|
- this.form.password = this.initPassword;
|
|
|
- });
|
|
|
+ this.title = "添加专业";
|
|
|
+ // this.form.password = this.initPassword;
|
|
|
+ // });
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
this.reset();
|
|
|
- const userId = row.userId || this.ids;
|
|
|
- getUser(userId).then(response => {
|
|
|
+ const majorId = row.majorId || this.ids;
|
|
|
+ getMajor(majorId).then(response => {
|
|
|
this.form = response.data;
|
|
|
- this.postOptions = response.posts;
|
|
|
- this.roleOptions = response.roles;
|
|
|
- this.$set(this.form, "postIds", response.postIds);
|
|
|
- this.$set(this.form, "roleIds", response.roleIds);
|
|
|
+ // this.postOptions = response.posts;
|
|
|
+ // this.roleOptions = response.roles;
|
|
|
+ // this.$set(this.form, "postIds", response.postIds);
|
|
|
+ // this.$set(this.form, "roleIds", response.roleIds);
|
|
|
this.open = true;
|
|
|
- this.title = "修改用户";
|
|
|
- this.form.password = "";
|
|
|
+ this.title = "修改专业";
|
|
|
+ // this.form.password = "";
|
|
|
});
|
|
|
},
|
|
|
- /** 重置密码按钮操作 */
|
|
|
- handleResetPwd(row) {
|
|
|
- this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- closeOnClickModal: false,
|
|
|
- inputPattern: /^.{5,20}$/,
|
|
|
- inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
|
|
- inputValidator: (value) => {
|
|
|
- if (/<|>|"|'|\||\\/.test(value)) {
|
|
|
- return "不能包含非法字符:< > \" ' \\\ |"
|
|
|
- }
|
|
|
- },
|
|
|
- }).then(({ value }) => {
|
|
|
- resetUserPwd(row.userId, value).then(response => {
|
|
|
- this.$modal.msgSuccess("修改成功,新密码是:" + value);
|
|
|
- });
|
|
|
- }).catch(() => {});
|
|
|
- },
|
|
|
- /** 分配角色操作 */
|
|
|
- handleAuthRole: function(row) {
|
|
|
- const userId = row.userId;
|
|
|
- this.$router.push("/system/user-auth/role/" + userId);
|
|
|
- },
|
|
|
/** 提交按钮 */
|
|
|
submitForm: function() {
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
- if (this.form.userId != undefined) {
|
|
|
- updateUser(this.form).then(response => {
|
|
|
+ if (this.form.majorId != undefined) {
|
|
|
+ updateMajor(this.form).then(response => {
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
});
|
|
|
} else {
|
|
|
- addUser(this.form).then(response => {
|
|
|
+ addMajor(this.form).then(response => {
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
@@ -414,46 +321,14 @@ export default {
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
- const userIds = row.userId || this.ids;
|
|
|
- this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() {
|
|
|
- return delUser(userIds);
|
|
|
+ const majorIds = row.userId || this.ids;
|
|
|
+ this.$modal.confirm('是否确认删除编号为"' + majorIds + '"的数据项?').then(function() {
|
|
|
+ return delMajor(majorIds);
|
|
|
}).then(() => {
|
|
|
this.getList();
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
}).catch(() => {});
|
|
|
},
|
|
|
- /** 导出按钮操作 */
|
|
|
- handleExport() {
|
|
|
- this.download('system/user/export', {
|
|
|
- ...this.queryParams
|
|
|
- }, `user_${new Date().getTime()}.xlsx`)
|
|
|
- },
|
|
|
- /** 导入按钮操作 */
|
|
|
- handleImport() {
|
|
|
- this.upload.title = "用户导入";
|
|
|
- this.upload.open = true;
|
|
|
- },
|
|
|
- /** 下载模板操作 */
|
|
|
- importTemplate() {
|
|
|
- this.download('system/user/importTemplate', {
|
|
|
- }, `user_template_${new Date().getTime()}.xlsx`)
|
|
|
- },
|
|
|
- // 文件上传中处理
|
|
|
- handleFileUploadProgress(event, file, fileList) {
|
|
|
- this.upload.isUploading = true;
|
|
|
- },
|
|
|
- // 文件上传成功处理
|
|
|
- handleFileSuccess(response, file, fileList) {
|
|
|
- this.upload.open = false;
|
|
|
- this.upload.isUploading = false;
|
|
|
- this.$refs.upload.clearFiles();
|
|
|
- this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
|
|
- this.getList();
|
|
|
- },
|
|
|
- // 提交上传文件
|
|
|
- submitFileForm() {
|
|
|
- this.$refs.upload.submit();
|
|
|
- }
|
|
|
}
|
|
|
};
|
|
|
-</script>
|
|
|
+</script>
|