| | |
| | | </el-cascader> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button @click="queryInfo()" |
| | | ><i class="el-icon-search"></i> {{ |
| | | $t('operatManage.ELM.search') |
| | | }}</el-button |
| | | > |
| | | <el-button |
| | | size="small" |
| | | type="primary" |
| | | @click="queryInfo()" |
| | | icon="el-icon-search" |
| | | >{{ $t("operatManage.ELM.search") }} |
| | | </el-button> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button @click="resetInfo('queryForm')" |
| | | ><i class="el-icon-delete"></i> {{ |
| | | $t('operatManage.ELM.reset') |
| | | }}</el-button |
| | | <el-button |
| | | size="small" |
| | | @click="resetInfo('queryForm')" |
| | | icon="el-icon-refresh" |
| | | > |
| | | {{ $t("operatManage.ELM.reset") }} |
| | | </el-button> |
| | | </el-form-item> |
| | | <br /> |
| | | <el-form-item> |
| | | <el-button |
| | | v-if="menuStatus.insert" |
| | | type="success" |
| | | size="small" |
| | | @click="showAddDialog" |
| | | ><i class="el-icon-plus"></i> {{ |
| | | $t('common.append') |
| | | }}</el-button |
| | | icon="el-icon-plus" |
| | | > |
| | | {{ $t("common.append") }} |
| | | </el-button> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button |
| | | v-if="menuStatus.delete" |
| | | type="danger" |
| | | size="small" |
| | | @click="deleteUserInfo" |
| | | ><i class="el-icon-delete"></i> {{ |
| | | $t('common.delete') |
| | | }}</el-button |
| | | icon="el-icon-delete" |
| | | > |
| | | {{ $t("common.delete") }} |
| | | </el-button> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="danger" size="small" @click="editPwd" |
| | | ><i class="el-icon-unlock"></i> 重置密码</el-button |
| | | > |
| | | <el-button |
| | | type="primary" |
| | | size="small" |
| | | @click="editPwd" |
| | | icon="el-icon-unlock" |
| | | >重置密码 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | |
| | | type="warning" |
| | | @click="editInfo(scope.row)" |
| | | size="mini" |
| | | >{{ $t('common.edit') }}</el-button |
| | | >{{ $t("common.edit") }}</el-button |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | |
| | | |
| | | <script> |
| | | var encrypt = new JSEncrypt(); |
| | | import { mapActions } from 'vuex'; |
| | | import MyBread from '../../components/MyBread.vue'; |
| | | import { mapActions } from "vuex"; |
| | | import MyBread from "../../components/MyBread.vue"; |
| | | import { |
| | | queryDepTree, |
| | | queryPageUser, |
| | |
| | | updateUser, |
| | | updatePwd, |
| | | selectByUserid, |
| | | } from '../../api/api'; |
| | | } from "../../api/api"; |
| | | export default { |
| | | //import引入的组件需要注入到对象中才能使用 |
| | | components: { |
| | |
| | | }, |
| | | data() { |
| | | let validName = (rule, value, callback) => { |
| | | if (value === '' || value === null || value === undefined) { |
| | | return callback(new Error('请输入密码')); |
| | | if (value === "" || value === null || value === undefined) { |
| | | return callback(new Error("请输入密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | let validatePass = (rule, value, callback) => { |
| | | if (value === '' || value === undefined) { |
| | | callback(new Error('请再次输入密码')); |
| | | if (value === "" || value === undefined) { |
| | | callback(new Error("请再次输入密码")); |
| | | } else if (value !== this.editForm.pwd) { |
| | | callback(new Error('两次输入密码不一致!')); |
| | | callback(new Error("两次输入密码不一致!")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | let resetPass = (rule, value, callback) => { |
| | | if (value === '' || value === undefined) { |
| | | callback(new Error('请再次输入密码')); |
| | | if (value === "" || value === undefined) { |
| | | callback(new Error("请再次输入密码")); |
| | | } else if (value !== this.pwdForm.newPwd) { |
| | | callback(new Error('两次输入密码不一致!')); |
| | | callback(new Error("两次输入密码不一致!")); |
| | | } else { |
| | | callback(); |
| | | } |
| | |
| | | pageSize: 10, |
| | | pageIndex: 1, |
| | | defaultProps: { |
| | | children: 'children', |
| | | label: 'name', |
| | | children: "children", |
| | | label: "name", |
| | | }, |
| | | queryForm: { |
| | | uname: '', |
| | | uname: "", |
| | | depid: null, |
| | | depName: '', |
| | | depName: "", |
| | | }, |
| | | tableData: [], |
| | | fullscreenLoading: false, |
| | | count: 0, |
| | | formLabelWidth: '100px', |
| | | formLabelWidth: "100px", |
| | | dialogFormVisible: false, |
| | | initialForm: '', |
| | | behavior: '', |
| | | initialForm: "", |
| | | behavior: "", |
| | | multipleSelection: [], |
| | | resetPwd: false, |
| | | editForm: { |
| | | uid: '', |
| | | uname: '', |
| | | oldPwd: '', |
| | | pwd: '', |
| | | checkPass: '', |
| | | uid: "", |
| | | uname: "", |
| | | oldPwd: "", |
| | | pwd: "", |
| | | checkPass: "", |
| | | sex: null, |
| | | natives: '', |
| | | natives: "", |
| | | depid: null, |
| | | idcard: '', |
| | | job: '', |
| | | edu: '', |
| | | addr: '', |
| | | email: '', |
| | | contact: '', |
| | | idcard: "", |
| | | job: "", |
| | | edu: "", |
| | | addr: "", |
| | | email: "", |
| | | contact: "", |
| | | status: null, |
| | | bak: '', |
| | | salt: '', |
| | | bak: "", |
| | | salt: "", |
| | | }, |
| | | pwdForm: { |
| | | adminPwd: '', |
| | | newPwd: '', |
| | | checkPwd: '', |
| | | adminPwd: "", |
| | | newPwd: "", |
| | | checkPwd: "", |
| | | ids: [], |
| | | }, |
| | | treeOptions: [], |
| | | statusOpt: [ |
| | | { |
| | | value: 0, |
| | | label: '正常', |
| | | label: "正常", |
| | | }, |
| | | { |
| | | value: 1, |
| | | label: '禁用', |
| | | label: "禁用", |
| | | }, |
| | | { |
| | | value: 2, |
| | | label: '删除', |
| | | label: "删除", |
| | | }, |
| | | { |
| | | value: 3, |
| | | label: '申请', |
| | | label: "申请", |
| | | }, |
| | | { |
| | | value: 4, |
| | | label: '拒批', |
| | | label: "拒批", |
| | | }, |
| | | ], |
| | | depList: [], |
| | | sexOpt: [ |
| | | { |
| | | value: 0, |
| | | label: '女', |
| | | label: "女", |
| | | }, |
| | | { |
| | | value: 1, |
| | | label: '男', |
| | | label: "男", |
| | | }, |
| | | { |
| | | value: -1, |
| | | label: '未知', |
| | | label: "未知", |
| | | }, |
| | | ], |
| | | rules: { |
| | | uid: [ |
| | | { required: true, validator: validName, trigger: 'blur' }, |
| | | { required: true, validator: validName, trigger: "blur" }, |
| | | { |
| | | trigger: 'blur', |
| | | trigger: "blur", |
| | | validator: (rule, value, callback) => { |
| | | var reg = new RegExp(/^[a-zA-Z0-9_]{0,15}$/); //字符串正则表达式 4到14位(字母,数字,下划线,减号) |
| | | if (!reg.test(value)) { |
| | | callback( |
| | | new Error('账号必须由字母,数字或下划线,长度不得超过16位') |
| | | new Error("账号必须由字母,数字或下划线,长度不得超过16位") |
| | | ); |
| | | } else { |
| | | selectByUserid({ uid: value }).then((res) => { |
| | | if (res.result != null) { |
| | | this.isNewUser = false; |
| | | callback(new Error('账号已存在')); |
| | | callback(new Error("账号已存在")); |
| | | } else { |
| | | this.isNewUser = true; |
| | | callback(); |
| | |
| | | pwd: [ |
| | | { |
| | | required: true, |
| | | message: '请输入密码', |
| | | message: "请输入密码", |
| | | transform: (value) => value, |
| | | trigger: 'blur', |
| | | trigger: "blur", |
| | | }, |
| | | { |
| | | type: 'string', |
| | | message: '请输入不包含空格的字符', |
| | | trigger: 'blur', |
| | | type: "string", |
| | | message: "请输入不包含空格的字符", |
| | | trigger: "blur", |
| | | transform(value) { |
| | | if (value && value.indexOf(' ') === -1) { |
| | | if (value && value.indexOf(" ") === -1) { |
| | | return value; |
| | | } else { |
| | | return false; |
| | |
| | | }, |
| | | }, |
| | | { |
| | | trigger: 'blur', |
| | | trigger: "blur", |
| | | validator: (rule, value, callback) => { |
| | | var regex = new RegExp(''); |
| | | var regex = new RegExp(""); |
| | | var passwordreg = |
| | | /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![a-z0-9]+$)(?![a-z\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![0-9\W!@#$%^&*`~()\\-_+=,.?;<>]+$)[a-zA-Z0-9\W!@#$%^&*`~()\\-_+=,.?;<>]{8,20}$/; |
| | | if (!passwordreg.test(value)) { |
| | | callback( |
| | | new Error('密码必须由数字、字母、特殊字符组合,请输入8-20位') |
| | | new Error("密码必须由数字、字母、特殊字符组合,请输入8-20位") |
| | | ); |
| | | } else { |
| | | callback(); |
| | |
| | | }, |
| | | ], |
| | | checkPass: [ |
| | | { required: true, validator: validatePass, trigger: 'blur' }, |
| | | { required: true, validator: validatePass, trigger: "blur" }, |
| | | ], |
| | | adminPwd: [{ validator: validName, trigger: 'blur' }], |
| | | adminPwd: [{ validator: validName, trigger: "blur" }], |
| | | newPwd: [ |
| | | { |
| | | message: '请输入密码', |
| | | message: "请输入密码", |
| | | transform: (value) => value, |
| | | trigger: 'blur', |
| | | trigger: "blur", |
| | | }, |
| | | { |
| | | type: 'string', |
| | | message: '请输入不包含空格的字符', |
| | | trigger: 'blur', |
| | | type: "string", |
| | | message: "请输入不包含空格的字符", |
| | | trigger: "blur", |
| | | transform(value) { |
| | | if (value && value.indexOf(' ') === -1) { |
| | | if (value && value.indexOf(" ") === -1) { |
| | | return value; |
| | | } else { |
| | | return false; |
| | |
| | | }, |
| | | }, |
| | | { |
| | | trigger: 'blur', |
| | | trigger: "blur", |
| | | validator: (rule, value, callback) => { |
| | | var regex = new RegExp(''); |
| | | var regex = new RegExp(""); |
| | | var passwordreg = |
| | | /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![a-z0-9]+$)(?![a-z\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![0-9\W!@#$%^&*`~()\\-_+=,.?;<>]+$)[a-zA-Z0-9\W!@#$%^&*`~()\\-_+=,.?;<>]{8,20}$/; |
| | | if (!passwordreg.test(value)) { |
| | | callback( |
| | | new Error('密码必须由数字、字母、特殊字符组合,请输入8-20位') |
| | | new Error("密码必须由数字、字母、特殊字符组合,请输入8-20位") |
| | | ); |
| | | } else { |
| | | callback(); |
| | |
| | | }, |
| | | }, |
| | | ], |
| | | checkPwd: [{ validator: resetPass, trigger: 'blur' }], |
| | | checkPwd: [{ validator: resetPass, trigger: "blur" }], |
| | | }, |
| | | }; |
| | | }, |
| | | methods: { |
| | | ...mapActions(['login', 'getpublickey']), |
| | | getUserInfo(params) { |
| | | ...mapActions(["login", "getpublickey"]), |
| | | getUserInfo() { |
| | | queryDepTree() |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | |
| | | return cloneData.filter((father) => { |
| | | // 循环所有项 |
| | | let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据 |
| | | branchArr.length > 0 ? (father.children = branchArr) : ''; // 给父级添加一个children属性,并赋值 |
| | | branchArr.length > 0 ? (father.children = branchArr) : ""; // 给父级添加一个children属性,并赋值 |
| | | return father.pid == 0; // 返回一级菜单 |
| | | }); |
| | | }, |
| | |
| | | //搜索按钮 |
| | | queryInfo() { |
| | | let searchData = { |
| | | uname: this.queryForm.uname, |
| | | uname: this.queryForm.uname.trim(), |
| | | depid: this.queryForm.depid, |
| | | pageIndex: this.pageIndex, |
| | | pageSize: this.pageSize, |
| | |
| | | this.tableData = res.result; |
| | | this.count = res.count; |
| | | } else { |
| | | console.log('查询接口报错'); |
| | | console.log("查询接口报错"); |
| | | this.$notify.error({ |
| | | title: res.code, |
| | | message: res.result, |
| | |
| | | }, |
| | | //新增按钮 |
| | | showAddDialog() { |
| | | this.behavior = '新增用户'; |
| | | this.behavior = "新增用户"; |
| | | this.editForm = {}; |
| | | this.dialogFormVisible = true; |
| | | }, |
| | |
| | | setTimeout(() => { |
| | | this.fullscreenLoading = false; |
| | | if (res.code == 200) { |
| | | this.getUserInfo(1, 10); |
| | | this.getUserInfo(); |
| | | this.$message({ |
| | | message: '添加成功', |
| | | type: 'success', |
| | | message: "添加成功", |
| | | type: "success", |
| | | }); |
| | | this.editForm = {}; |
| | | this.dialogFormVisible = false; |
| | |
| | | }, 500); |
| | | }) |
| | | .catch((res) => { |
| | | alert('修改失败,请重试!'); |
| | | alert("修改失败,请重试!"); |
| | | this.fullscreenLoading = false; |
| | | }); |
| | | } else { |
| | | console.log('error submit!!'); |
| | | console.log("error submit!!"); |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | //多选 |
| | | handleSelectionChange(val) { |
| | | this.multipleSelection = val; |
| | | }, |
| | | //删除按钮 |
| | | deleteUserInfo() { |
| | | this.$confirm('此操作将删除已选中的用户, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | this.$confirm("此操作将删除已选中的用户, 是否继续?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | var std = []; |
| | |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '删除成功!', |
| | | type: "success", |
| | | message: "删除成功!", |
| | | }); |
| | | this.multipleSelection = []; |
| | | this.getUserInfo(1, 10); |
| | | this.getUserInfo(); |
| | | } else { |
| | | this.$message.error('删除失败'); |
| | | this.$message.error("删除失败"); |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | this.$message.error('删除失败'); |
| | | this.$message.error("删除失败"); |
| | | this.multipleSelection = []; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | this.$message('已取消删除'); |
| | | this.$message("已取消删除"); |
| | | }); |
| | | }, |
| | | //重置密码 |
| | |
| | | std.push(this.multipleSelection[i].id); |
| | | } |
| | | if (std.length == 0) { |
| | | alert('请先选择用户'); |
| | | alert("请先选择用户"); |
| | | return; |
| | | } |
| | | this.pwdForm.ids = std; |
| | |
| | | setTimeout(() => { |
| | | this.fullscreenLoading = false; |
| | | if (res.code == 200) { |
| | | this.getUserInfo(1, 10); |
| | | this.getUserInfo(); |
| | | this.$message({ |
| | | message: '修改成功', |
| | | type: 'success', |
| | | message: "修改成功", |
| | | type: "success", |
| | | }); |
| | | this.pwdForm = { |
| | | adminPwd: '', |
| | | newPwd: '', |
| | | checkPwd: '', |
| | | adminPwd: "", |
| | | newPwd: "", |
| | | checkPwd: "", |
| | | ids: [], |
| | | }; |
| | | this.multipleSelection = []; |
| | |
| | | }, 500); |
| | | }) |
| | | .catch((res) => { |
| | | alert('修改失败,请重试!'); |
| | | alert("修改失败,请重试!"); |
| | | this.fullscreenLoading = false; |
| | | }); |
| | | } else { |
| | |
| | | editInfo(row) { |
| | | delete row.updateTime; |
| | | delete row.updateUser; |
| | | row.pwd = ''; |
| | | row.pwd = ""; |
| | | this.initialForm = JSON.stringify(row); |
| | | this.behavior = '修改信息'; |
| | | this.behavior = "修改信息"; |
| | | this.editForm = JSON.parse(JSON.stringify(row)); |
| | | this.dialogFormVisible = true; |
| | | }, |
| | |
| | | }, |
| | | //关闭弹出框 |
| | | handleClose(done) { |
| | | this.$confirm('确认关闭?') |
| | | this.$confirm("确认关闭?") |
| | | .then((_) => { |
| | | this.editForm = { |
| | | uid: '', |
| | | uname: '', |
| | | oldPwd: '', |
| | | pwd: '', |
| | | checkPass: '', |
| | | uid: "", |
| | | uname: "", |
| | | oldPwd: "", |
| | | pwd: "", |
| | | checkPass: "", |
| | | sex: null, |
| | | natives: '', |
| | | natives: "", |
| | | depid: null, |
| | | idcard: '', |
| | | job: '', |
| | | edu: '', |
| | | addr: '', |
| | | email: '', |
| | | contact: '', |
| | | idcard: "", |
| | | job: "", |
| | | edu: "", |
| | | addr: "", |
| | | email: "", |
| | | contact: "", |
| | | status: null, |
| | | bak: '', |
| | | salt: '', |
| | | bak: "", |
| | | salt: "", |
| | | }; |
| | | this.pwdForm = { |
| | | adminPwd: '', |
| | | newPwd: '', |
| | | checkPwd: '', |
| | | adminPwd: "", |
| | | newPwd: "", |
| | | checkPwd: "", |
| | | ids: [], |
| | | }; |
| | | |
| | |
| | | setTimeout(() => { |
| | | this.fullscreenLoading = false; |
| | | if (res.code == 200) { |
| | | this.getUserInfo(1, 10); |
| | | this.getUserInfo(); |
| | | this.$message({ |
| | | message: '修改成功', |
| | | type: 'success', |
| | | message: "修改成功", |
| | | type: "success", |
| | | }); |
| | | this.editForm = {}; |
| | | this.dialogFormVisible = false; |
| | |
| | | }, 500); |
| | | }) |
| | | .catch((res) => { |
| | | alert('修改失败,请重试!'); |
| | | alert("修改失败,请重试!"); |
| | | this.fullscreenLoading = false; |
| | | }); |
| | | } else { |
| | | console.log('error submit!!'); |
| | | console.log("error submit!!"); |
| | | return false; |
| | | } |
| | | }); |
| | |
| | | this.editForm = JSON.parse(this.initialForm); |
| | | }); |
| | | }, |
| | | //多选 |
| | | handleSelectionChange(val) { |
| | | this.multipleSelection = val; |
| | | }, |
| | | |
| | | handleSizeChange(val) { |
| | | // console.log(`每页 ${val} 条`); |
| | | this.pageSize = val; |
| | |
| | | this.queryInfo(); |
| | | }, |
| | | showPermsMenu(res) { |
| | | console.log(res.tag); |
| | | switch (res.tag) { |
| | | case '/delete': |
| | | case "/delete": |
| | | this.menuStatus.delete = true; |
| | | break; |
| | | case '/insert': |
| | | case "/insert": |
| | | this.menuStatus.insert = true; |
| | | break; |
| | | case '/update': |
| | | case "/update": |
| | | this.menuStatus.update = true; |
| | | break; |
| | | } |
| | | }, |
| | | }, |
| | | mounted() { |
| | | this.getUserInfo(1, 10); |
| | | this.getUserInfo(); |
| | | this.getpublickey(); |
| | | }, |
| | | created() { |