| | |
| | | <template> |
| | | <div class="logLog_box"> |
| | | <div class="userInfo_box"> |
| | | <My-bread |
| | | :list="[ |
| | | `${$t('userManage.userManage')}`, |
| | |
| | | ></My-bread> |
| | | <el-divider /> |
| | | <div class="inquire"> |
| | | <el-form ref="ruleForm" :model="form" :inline="true"> |
| | | <el-form-item :label="$t('operatManage.ELM.username')" prop="name"> |
| | | <el-input |
| | | v-model="form.name" |
| | | :placeholder="$t('operatManage.ELM.usernameInfo')" |
| | | /> |
| | | <el-form ref="queryForm" :model="queryForm" :inline="true"> |
| | | <el-form-item prop="uname" :label="$t('userManage.userInfoObj.uname')"> |
| | | <el-input v-model="queryForm.uname" /> |
| | | </el-form-item> |
| | | <!-- <el-form-item |
| | | :label="$t('userManage.userInfoObj.userStatus')" |
| | | prop="userStatus" |
| | | > |
| | | <el-select |
| | | v-model="form.userStatus" |
| | | :placeholder="$t('userManage.userInfoObj.userStatus')" |
| | | > |
| | | <el-option :label="$t('userManage.userInfoObj.all')" value="all" /> |
| | | <el-option |
| | | :label="$t('userManage.userInfoObj.normal')" |
| | | value="normal" |
| | | /> |
| | | <el-option |
| | | :label="$t('userManage.userInfoObj.disable')" |
| | | value="disable" |
| | | /> |
| | | <el-option |
| | | :label="$t('userManage.userInfoObj.delete')" |
| | | value="delete" |
| | | /> |
| | | <el-option |
| | | :label="$t('userManage.userInfoObj.apply')" |
| | | value="apply" |
| | | /> |
| | | <el-option |
| | | :label="$t('userManage.userInfoObj.rejection')" |
| | | value="rejection" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | <el-form-item |
| | | prop="depid" |
| | | :label="$t('userManage.userInfoObj.depName')" |
| | | prop="depName" |
| | | > |
| | | <el-input |
| | | v-model="form.depName" |
| | | :placeholder="$t('common.pleaseInput')" |
| | | /> |
| | | <el-cascader |
| | | v-model="queryForm.depid" |
| | | :options="treeOptions" |
| | | filterable |
| | | @change="handleChange" |
| | | :show-all-levels="false" |
| | | :props="{ |
| | | label: 'name', |
| | | value: 'id', |
| | | children: 'children', |
| | | checkStrictly: true, |
| | | emitPath: false, |
| | | }" |
| | | > |
| | | </el-cascader> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <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 |
| | | size="small" |
| | | @click="resetInfo('queryForm')" |
| | | icon="el-icon-refresh" |
| | | >{{ $t("operatManage.ELM.reset") }}</el-button |
| | | > |
| | | </el-form-item> |
| | | <br /> |
| | | <el-form-item> |
| | | <el-button type="success" size="small" @click="showAddDialog" |
| | | ><i class="el-icon-plus"></i> {{ |
| | | $t("common.append") |
| | | }}</el-button |
| | | > |
| | | </el-form-item> |
| | | <el-form-item style="margin-left: 60%"> |
| | | <el-button @click="onSubmit" size="mini" |
| | | ><i class="el-icon-search"></i> {{ |
| | | $t("operatManage.ELM.search") |
| | | }}</el-button |
| | | <el-button |
| | | type="success" |
| | | size="small" |
| | | @click="showAddDialog" |
| | | icon="el-icon-plus" |
| | | >{{ $t("common.append") }}</el-button |
| | | > |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button @click="resetForm('ruleForm')" size="mini" |
| | | ><i class="el-icon-delete"></i> {{ |
| | | $t("operatManage.ELM.reset") |
| | | }}</el-button |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | | @click="deleteUserInfo" |
| | | icon="el-icon-delete" |
| | | >{{ $t("common.delete") }}</el-button |
| | | > |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button |
| | | type="primary" |
| | | size="small" |
| | | @click="editPwd" |
| | | icon="el-icon-unlock" |
| | | >重置密码</el-button |
| | | > |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | stripe |
| | | border |
| | | style="width: 100%" |
| | | max-height="99%" |
| | | height="99%" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column |
| | | align="center" |
| | | type="index" |
| | | :label="$t('common.index')" |
| | | width="70px" |
| | | fixed |
| | | /> |
| | | |
| | | <el-table-column |
| | | align="center" |
| | | prop="uname" |
| | | width="150px" |
| | | :label="$t('userManage.userInfoObj.uname')" |
| | | fixed |
| | | /> |
| | | <el-table-column |
| | | align="center" |
| | | prop="pwd" |
| | | :label="$t('userManage.userInfoObj.pwd')" |
| | | prop="uid" |
| | | width="150px" |
| | | :label="$t('userManage.userInfoObj.uid')" |
| | | /> |
| | | |
| | | <el-table-column |
| | | align="center" |
| | | prop="sex" |
| | | width="80px" |
| | | :label="$t('userManage.userInfoObj.sex')" |
| | | > |
| | | <template slot-scope="scope"> |
| | |
| | | <el-table-column |
| | | align="center" |
| | | prop="natives" |
| | | width="100px" |
| | | :label="$t('userManage.userInfoObj.natives')" |
| | | /> |
| | | <el-table-column |
| | | align="center" |
| | | prop="depName" |
| | | width="200px" |
| | | :label="$t('userManage.userInfoObj.depName')" |
| | | /> |
| | | <el-table-column |
| | | align="center" |
| | | prop="idcard" |
| | | width="200px" |
| | | :label="$t('userManage.userInfoObj.idcard')" |
| | | /><el-table-column |
| | | align="center" |
| | | prop="job" |
| | | width="200px" |
| | | :label="$t('userManage.userInfoObj.job')" |
| | | /> |
| | | <el-table-column |
| | | align="center" |
| | | prop="edu" |
| | | width="200px" |
| | | :label="$t('userManage.userInfoObj.edu')" |
| | | /> |
| | | <el-table-column |
| | | align="center" |
| | | prop="addr" |
| | | width="200px" |
| | | :label="$t('userManage.userInfoObj.addr')" |
| | | /> |
| | | <el-table-column |
| | | align="center" |
| | | prop="email" |
| | | width="200px" |
| | | :label="$t('userManage.userInfoObj.email')" |
| | | /> |
| | | <el-table-column |
| | | align="center" |
| | | prop="contact" |
| | | width="200px" |
| | | :label="$t('userManage.userInfoObj.contact')" |
| | | /> |
| | | |
| | |
| | | <el-table-column |
| | | align="center" |
| | | prop="bak" |
| | | width="200px" |
| | | :label="$t('userManage.userInfoObj.bak')" |
| | | /> |
| | | <el-table-column :label="$t('common.operate')" fixed="right"> |
| | | <template #default> |
| | | <el-table-column |
| | | :label="$t('common.operate')" |
| | | width="80px" |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <!-- <el-button type="primary" size="small">修改</el-button> --> |
| | | |
| | | <el-button type="warning" size="mini">{{ |
| | | $t("common.edit") |
| | | }}</el-button> |
| | | <el-button type="danger" size="mini">{{ |
| | | $t("common.delete") |
| | | }}</el-button> |
| | | <el-button |
| | | type="warning" |
| | | @click="editInfo(scope.row)" |
| | | size="mini" |
| | | >{{ $t("common.edit") }}</el-button |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div style="margin-top: 40px" class="pagination_box"> |
| | | <div style="margin-top: 25px" class="pagination_box"> |
| | | <el-pagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="currentPage" |
| | | :page-sizes="[10, 20, 30, 40]" |
| | | :page-size="10" |
| | | :page-sizes="[1, 2, 5, 10]" |
| | | :page-size="pageSize" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="1" |
| | | :total="count" |
| | | > |
| | | </el-pagination> |
| | | </div> |
| | | </div> |
| | | <el-dialog |
| | | width="910px" |
| | | top="15vh" |
| | | :title="behavior" |
| | | :visible.sync="dialogFormVisible" |
| | | :before-close="handleClose" |
| | | > |
| | | <el-form |
| | | :model="editForm" |
| | | ref="editForm" |
| | | :rules="rules" |
| | | style="display: flex" |
| | | > |
| | | <div> |
| | | <el-form-item |
| | | prop="uid" |
| | | label="登录账号" |
| | | v-if="behavior == '新增用户'" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input v-model="editForm.uid" autocomplete="off"></el-input> |
| | | <div class="isNewUser" v-if="isNewUser"> |
| | | <img src="../../assets/img/success.png" /> |
| | | 账号可用 |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="behavior == '修改信息'" |
| | | label="登录账号" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input |
| | | v-model="editForm.uid" |
| | | autocomplete="off" |
| | | disabled |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="behavior == '修改信息'" |
| | | prop="oldPwd" |
| | | label="原密码" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input |
| | | type="password" |
| | | v-model="editForm.oldPwd" |
| | | autocomplete="off" |
| | | show-password |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="pwd" label="密码" :label-width="formLabelWidth"> |
| | | <el-input |
| | | type="password" |
| | | v-model="editForm.pwd" |
| | | autocomplete="off" |
| | | show-password |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item |
| | | prop="checkPass" |
| | | label="确认密码" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input |
| | | type="password" |
| | | show-password |
| | | v-model="editForm.checkPass" |
| | | autocomplete="off" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item |
| | | prop="uname" |
| | | label="用户名称" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input v-model="editForm.uname" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="sex" label="性别" :label-width="formLabelWidth"> |
| | | <el-select v-model="editForm.sex" clearable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in sexOpt" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | prop="natives" |
| | | label="籍贯" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input v-model="editForm.natives" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item |
| | | prop="depid" |
| | | :label-width="formLabelWidth" |
| | | :label="$t('userManage.userInfoObj.depName')" |
| | | > |
| | | <el-cascader |
| | | v-model="editForm.depid" |
| | | :options="treeOptions" |
| | | filterable |
| | | clearable |
| | | @change="editChange" |
| | | :show-all-levels="false" |
| | | :props="{ |
| | | label: 'name', |
| | | value: 'id', |
| | | children: 'children', |
| | | checkStrictly: true, |
| | | emitPath: false, |
| | | }" |
| | | > |
| | | </el-cascader> |
| | | </el-form-item> |
| | | <el-form-item |
| | | prop="idcard" |
| | | label="证件号" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input v-model="editForm.idcard" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div style="width: 45%"> |
| | | <el-form-item prop="job" label="工作" :label-width="formLabelWidth"> |
| | | <el-input v-model="editForm.job" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="edu" label="教育" :label-width="formLabelWidth"> |
| | | <el-input v-model="editForm.edu" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="addr" label="地址" :label-width="formLabelWidth"> |
| | | <el-input v-model="editForm.addr" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item |
| | | prop="email" |
| | | label="电子邮件" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input v-model="editForm.email" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item |
| | | prop="contact" |
| | | label="联系方式" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input v-model="editForm.contact" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item |
| | | prop="status" |
| | | label="状态" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-select v-model="editForm.status" clearable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in statusOpt" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item prop="bak" label="备注" :label-width="formLabelWidth"> |
| | | <el-input v-model="editForm.bak" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </el-form> |
| | | <div v-if="behavior == '修改信息'" slot="footer" class="dialog-footer"> |
| | | <el-button size="medium" @click="cancelEdit()">重置</el-button> |
| | | <el-button |
| | | size="medium" |
| | | type="primary" |
| | | @click="sendEdit('editForm')" |
| | | v-loading.fullscreen.lock="fullscreenLoading" |
| | | >提交</el-button |
| | | > |
| | | </div> |
| | | <div v-else slot="footer" class="dialog-footer"> |
| | | <el-button size="medium" @click="cancelAdd('editForm')">重置</el-button> |
| | | <el-button |
| | | size="medium" |
| | | type="primary" |
| | | @click="sendAdd('editForm')" |
| | | v-loading.fullscreen.lock="fullscreenLoading" |
| | | >提交</el-button |
| | | > |
| | | </div> |
| | | </el-dialog> |
| | | <el-dialog |
| | | width="520px" |
| | | top="30vh" |
| | | title="批量重置密码" |
| | | :visible.sync="resetPwd" |
| | | :before-close="handleClose" |
| | | > |
| | | <el-form :model="pwdForm" ref="pwdForm" :rules="rules"> |
| | | <el-form-item prop="adminPwd" label="管理员密码" label-width="140px"> |
| | | <el-input |
| | | type="password" |
| | | v-model="pwdForm.adminPwd" |
| | | autocomplete="off" |
| | | show-password |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="newPwd" label="新密码" label-width="140px"> |
| | | <el-input |
| | | type="password" |
| | | v-model="pwdForm.newPwd" |
| | | autocomplete="off" |
| | | show-password |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="checkPwd" label="确认密码" label-width="140px"> |
| | | <el-input |
| | | type="password" |
| | | v-model="pwdForm.checkPwd" |
| | | autocomplete="off" |
| | | show-password |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button size="medium" @click="cancelReset - 'pwdForm'" |
| | | >重置</el-button |
| | | > |
| | | <el-button |
| | | size="medium" |
| | | type="primary" |
| | | @click="sendReset('pwdForm')" |
| | | v-loading.fullscreen.lock="fullscreenLoading" |
| | | >提交</el-button |
| | | > |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | var encrypt = new JSEncrypt(); |
| | | import { mapActions } from "vuex"; |
| | | import MyBread from "../../components/MyBread.vue"; |
| | | import { queryPageUser } from "../../api/api"; |
| | | import { |
| | | queryDepTree, |
| | | queryPageUser, |
| | | insertUser, |
| | | deleteUser, |
| | | updateUser, |
| | | updatePwd, |
| | | selectByUserid, |
| | | } from "../../api/api"; |
| | | export default { |
| | | //import引入的组件需要注入到对象中才能使用 |
| | | components: { |
| | |
| | | }, |
| | | data() { |
| | | let validName = (rule, value, callback) => { |
| | | if (value === "") { |
| | | 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("请再次输入密码")); |
| | | } else if (value !== this.editForm.pwd) { |
| | | callback(new Error("两次输入密码不一致!")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | let resetPass = (rule, value, callback) => { |
| | | if (value === "" || value === undefined) { |
| | | callback(new Error("请再次输入密码")); |
| | | } else if (value !== this.pwdForm.newPwd) { |
| | | callback(new Error("两次输入密码不一致!")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | isNewUser: false, |
| | | currentPage: 1, |
| | | form: { |
| | | username: "", |
| | | userStatus: "all", |
| | | requestIp: "", |
| | | pageSize: 10, |
| | | pageIndex: 1, |
| | | defaultProps: { |
| | | children: "children", |
| | | label: "name", |
| | | }, |
| | | queryForm: { |
| | | uname: "", |
| | | depid: null, |
| | | depName: "", |
| | | }, |
| | | tableData: [], |
| | | fullscreenLoading: false, |
| | | itemdetail: {}, |
| | | formLabelWidth: "170px", |
| | | count: 0, |
| | | formLabelWidth: "100px", |
| | | dialogFormVisible: false, |
| | | ruleForm: { |
| | | level: null, |
| | | orderNum: null, |
| | | pid: null, |
| | | name: "", |
| | | descr: "", |
| | | initialForm: "", |
| | | behavior: "", |
| | | multipleSelection: [], |
| | | resetPwd: false, |
| | | editForm: { |
| | | uid: "", |
| | | uname: "", |
| | | oldPwd: "", |
| | | pwd: "", |
| | | checkPass: "", |
| | | sex: null, |
| | | natives: "", |
| | | depid: null, |
| | | idcard: "", |
| | | job: "", |
| | | edu: "", |
| | | addr: "", |
| | | email: "", |
| | | contact: "", |
| | | status: null, |
| | | bak: "", |
| | | salt: "", |
| | | }, |
| | | pwdForm: { |
| | | adminPwd: "", |
| | | newPwd: "", |
| | | checkPwd: "", |
| | | ids: [], |
| | | }, |
| | | treeOptions: [], |
| | | statusOpt: [ |
| | | { |
| | | value: 0, |
| | | label: "正常", |
| | | }, |
| | | { |
| | | value: 1, |
| | | label: "禁用", |
| | | }, |
| | | { |
| | | value: 2, |
| | | label: "删除", |
| | | }, |
| | | { |
| | | value: 3, |
| | | label: "申请", |
| | | }, |
| | | { |
| | | value: 4, |
| | | label: "拒批", |
| | | }, |
| | | ], |
| | | depList: [], |
| | | sexOpt: [ |
| | | { |
| | | value: 0, |
| | | label: "女", |
| | | }, |
| | | { |
| | | value: 1, |
| | | label: "男", |
| | | }, |
| | | { |
| | | value: -1, |
| | | label: "未知", |
| | | }, |
| | | ], |
| | | rules: { |
| | | name: [{ validator: validName, trigger: "blur" }], |
| | | uid: [ |
| | | { required: true, validator: validName, 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位") |
| | | ); |
| | | } else { |
| | | selectByUserid({ uid: value }).then((res) => { |
| | | if (res.result != null) { |
| | | this.isNewUser = false; |
| | | callback(new Error("账号已存在")); |
| | | } else { |
| | | this.isNewUser = true; |
| | | callback(); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | }, |
| | | ], |
| | | pwd: [ |
| | | { |
| | | required: true, |
| | | message: "请输入密码", |
| | | transform: (value) => value, |
| | | trigger: "blur", |
| | | }, |
| | | { |
| | | type: "string", |
| | | message: "请输入不包含空格的字符", |
| | | trigger: "blur", |
| | | transform(value) { |
| | | if (value && value.indexOf(" ") === -1) { |
| | | return value; |
| | | } else { |
| | | return false; |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | trigger: "blur", |
| | | validator: (rule, value, callback) => { |
| | | 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位") |
| | | ); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, |
| | | }, |
| | | ], |
| | | checkPass: [ |
| | | { required: true, validator: validatePass, trigger: "blur" }, |
| | | ], |
| | | adminPwd: [{ validator: validName, trigger: "blur" }], |
| | | newPwd: [ |
| | | { |
| | | message: "请输入密码", |
| | | transform: (value) => value, |
| | | trigger: "blur", |
| | | }, |
| | | { |
| | | type: "string", |
| | | message: "请输入不包含空格的字符", |
| | | trigger: "blur", |
| | | transform(value) { |
| | | if (value && value.indexOf(" ") === -1) { |
| | | return value; |
| | | } else { |
| | | return false; |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | trigger: "blur", |
| | | validator: (rule, value, callback) => { |
| | | 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位") |
| | | ); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, |
| | | }, |
| | | ], |
| | | checkPwd: [{ validator: resetPass, trigger: "blur" }], |
| | | }, |
| | | }; |
| | | }, |
| | | methods: { |
| | | getUserInfo(params) { |
| | | // queryMaxId().then((res) => { |
| | | // this.id = res.data; |
| | | // }); |
| | | ...mapActions(["login", "getpublickey"]), |
| | | getUserInfo() { |
| | | queryDepTree() |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | | this.depList = this.treeData(res.result); |
| | | this.treeOptions = this.treeData(res.result); |
| | | } else { |
| | | this.$notify.error({ |
| | | title: res.code, |
| | | message: res.result, |
| | | }); |
| | | } |
| | | }) |
| | | .catch((res) => {}); |
| | | |
| | | queryPageUser({ |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | }).then((res) => { |
| | | }) |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | | this.tableData = res.result; |
| | | this.count = res.count; |
| | | } else { |
| | | this.$notify.error({ |
| | | title: res.code, |
| | | message: res.result, |
| | | }); |
| | | } |
| | | }) |
| | | .catch((res) => {}); |
| | | }, |
| | | treeData(source) { |
| | | let cloneData = JSON.parse(JSON.stringify(source)); // 对源数据深度克隆 |
| | | return cloneData.filter((father) => { |
| | | // 循环所有项 |
| | | let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据 |
| | | branchArr.length > 0 ? (father.children = branchArr) : ""; // 给父级添加一个children属性,并赋值 |
| | | return father.pid == 0; // 返回一级菜单 |
| | | }); |
| | | }, |
| | | //查询选择单位 |
| | | handleChange(value) { |
| | | this.queryForm.depid = value; |
| | | }, |
| | | //搜索按钮 |
| | | queryInfo() { |
| | | let searchData = { |
| | | uname: this.queryForm.uname.trim(), |
| | | depid: this.queryForm.depid, |
| | | pageIndex: this.pageIndex, |
| | | pageSize: this.pageSize, |
| | | }; |
| | | queryPageUser(searchData).then((res) => { |
| | | if (res.code == 200) { |
| | | this.tableData = res.result; |
| | | this.count = res.count; |
| | | } else { |
| | | console.log("接口报错"); |
| | | console.log("查询接口报错"); |
| | | this.$notify.error({ |
| | | title: res.code, |
| | | message: res.result, |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | // getUserInfo() { |
| | | // //获取目录树最大ID,新建节点使用 |
| | | // // queryMaxId().then((res) => { |
| | | // // this.id = res.data; |
| | | // // }); |
| | | // queryDepTree().then((res) => { |
| | | // if (res.status == 200) { |
| | | // this.depList = this.treeData(res.data.result); |
| | | // this.oriData = res.data.result; |
| | | // this.newData = res.data.result; |
| | | // } else { |
| | | // console.log("接口报错"); |
| | | // } |
| | | // }); |
| | | // }, |
| | | |
| | | handleSizeChange(val) { |
| | | console.log(`每页 ${val} 条`); |
| | | }, |
| | | handleCurrentChange(val) { |
| | | console.log(`当前页: ${val}`); |
| | | }, |
| | | onSubmit() { |
| | | console.log("submit!"); |
| | | }, |
| | | resetForm(formName) { |
| | | //重置按钮 |
| | | resetInfo(formName) { |
| | | this.$refs[formName].resetFields(); |
| | | }, |
| | | //新增按钮 |
| | | showAddDialog() { |
| | | this.dialogTableVisible = true; |
| | | this.behavior = "新增用户"; |
| | | this.editForm = {}; |
| | | this.dialogFormVisible = true; |
| | | }, |
| | | cancelAdd(formName) { |
| | | this.editForm = {}; |
| | | this.isNewUser = false; |
| | | this.$refs[formName].resetFields(); |
| | | }, |
| | | sendAdd(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | // console.log(this.$store.state.key); |
| | | encrypt.setPublicKey(this.$store.state.key); |
| | | this.editForm.uid = encrypt.encrypt(this.editForm.uid); |
| | | this.editForm.pwd = encrypt.encrypt(this.editForm.pwd); |
| | | this.fullscreenLoading = true; |
| | | delete this.editForm.checkPass; |
| | | delete this.editForm.oldPwd; |
| | | insertUser(this.editForm) |
| | | .then((res) => { |
| | | setTimeout(() => { |
| | | this.fullscreenLoading = false; |
| | | if (res.code == 200) { |
| | | this.getUserInfo(); |
| | | this.$message({ |
| | | message: "添加成功", |
| | | type: "success", |
| | | }); |
| | | this.editForm = {}; |
| | | this.dialogFormVisible = false; |
| | | } |
| | | }, 500); |
| | | }) |
| | | .catch((res) => { |
| | | alert("修改失败,请重试!"); |
| | | this.fullscreenLoading = false; |
| | | }); |
| | | } else { |
| | | console.log("error submit!!"); |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | //多选 |
| | | handleSelectionChange(val) { |
| | | this.multipleSelection = val; |
| | | }, |
| | | //删除按钮 |
| | | deleteUserInfo() { |
| | | this.$confirm("此操作将删除已选中的用户, 是否继续?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | var std = []; |
| | | for (var i in this.multipleSelection) { |
| | | std.push(this.multipleSelection[i].id); |
| | | } |
| | | deleteUser({ ids: std.toString() }) |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "删除成功!", |
| | | }); |
| | | this.multipleSelection = []; |
| | | this.getUserInfo(); |
| | | } else { |
| | | this.$message.error("删除失败"); |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | this.$message.error("删除失败"); |
| | | this.multipleSelection = []; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | this.$message("已取消删除"); |
| | | }); |
| | | }, |
| | | //重置密码 |
| | | editPwd() { |
| | | var std = []; |
| | | for (var i in this.multipleSelection) { |
| | | std.push(this.multipleSelection[i].id); |
| | | } |
| | | if (std.length == 0) { |
| | | alert("请先选择用户"); |
| | | return; |
| | | } |
| | | this.pwdForm.ids = std; |
| | | this.resetPwd = true; |
| | | }, |
| | | cancelReset(formName) { |
| | | this.$refs[formName].resetFields(); |
| | | this.pwdForm.ids = []; |
| | | }, |
| | | sendReset(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | encrypt.setPublicKey(this.$store.state.key); |
| | | var data = { |
| | | adminPwd: encrypt.encrypt(this.pwdForm.adminPwd), |
| | | newPwd: encrypt.encrypt(this.pwdForm.newPwd), |
| | | ids: this.pwdForm.ids, |
| | | }; |
| | | this.fullscreenLoading = true; |
| | | updatePwd(data) |
| | | .then((res) => { |
| | | setTimeout(() => { |
| | | this.fullscreenLoading = false; |
| | | if (res.code == 200) { |
| | | this.getUserInfo(); |
| | | this.$message({ |
| | | message: "修改成功", |
| | | type: "success", |
| | | }); |
| | | this.pwdForm = { |
| | | adminPwd: "", |
| | | newPwd: "", |
| | | checkPwd: "", |
| | | ids: [], |
| | | }; |
| | | this.multipleSelection = []; |
| | | this.resetPwd = false; |
| | | } |
| | | }, 500); |
| | | }) |
| | | .catch((res) => { |
| | | alert("修改失败,请重试!"); |
| | | this.fullscreenLoading = false; |
| | | }); |
| | | } else { |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | //编辑按钮 |
| | | editInfo(row) { |
| | | delete row.updateTime; |
| | | delete row.updateUser; |
| | | row.pwd = ""; |
| | | this.initialForm = JSON.stringify(row); |
| | | this.behavior = "修改信息"; |
| | | this.editForm = JSON.parse(JSON.stringify(row)); |
| | | this.dialogFormVisible = true; |
| | | }, |
| | | //编辑选择单位 |
| | | editChange(value) { |
| | | this.editForm.depid = value; |
| | | }, |
| | | //关闭弹出框 |
| | | handleClose(done) { |
| | | this.$confirm("确认关闭?") |
| | | .then((_) => { |
| | | this.editForm = { |
| | | uid: "", |
| | | uname: "", |
| | | oldPwd: "", |
| | | pwd: "", |
| | | checkPass: "", |
| | | sex: null, |
| | | natives: "", |
| | | depid: null, |
| | | idcard: "", |
| | | job: "", |
| | | edu: "", |
| | | addr: "", |
| | | email: "", |
| | | contact: "", |
| | | status: null, |
| | | bak: "", |
| | | salt: "", |
| | | }; |
| | | this.pwdForm = { |
| | | adminPwd: "", |
| | | newPwd: "", |
| | | checkPwd: "", |
| | | ids: [], |
| | | }; |
| | | |
| | | done(); |
| | | }) |
| | | .catch((_) => {}); |
| | | }, |
| | | //提交编辑 |
| | | sendEdit(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | encrypt.setPublicKey(this.$store.state.key); |
| | | this.editForm.uid = encrypt.encrypt(this.editForm.uid); |
| | | this.editForm.salt = encrypt.encrypt(this.editForm.pwd); |
| | | this.editForm.pwd = encrypt.encrypt(this.editForm.oldPwd); |
| | | this.fullscreenLoading = true; |
| | | delete this.editForm.checkPass; |
| | | delete this.editForm.oldPwd; |
| | | updateUser(this.editForm) |
| | | .then((res) => { |
| | | setTimeout(() => { |
| | | this.fullscreenLoading = false; |
| | | if (res.code == 200) { |
| | | this.getUserInfo(); |
| | | this.$message({ |
| | | message: "修改成功", |
| | | type: "success", |
| | | }); |
| | | this.editForm = {}; |
| | | this.dialogFormVisible = false; |
| | | } |
| | | }, 500); |
| | | }) |
| | | .catch((res) => { |
| | | alert("修改失败,请重试!"); |
| | | this.fullscreenLoading = false; |
| | | }); |
| | | } else { |
| | | console.log("error submit!!"); |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | cancelEdit() { |
| | | this.$nextTick(() => { |
| | | this.editForm = JSON.parse(this.initialForm); |
| | | }); |
| | | }, |
| | | |
| | | handleSizeChange(val) { |
| | | // console.log(`每页 ${val} 条`); |
| | | this.pageSize = val; |
| | | this.queryInfo(); |
| | | }, |
| | | handleCurrentChange(val) { |
| | | // console.log(`当前页: ${val}`); |
| | | this.pageIndex = val; |
| | | this.currentPage = val; |
| | | this.queryInfo(); |
| | | }, |
| | | }, |
| | | mounted() { |
| | | this.getUserInfo(1, 10); |
| | | this.getUserInfo(); |
| | | this.getpublickey(); |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | </style> |
| | | <style lang="less" scoped> |
| | | //@import url(); 引入公共css类 |
| | | .logLog_box { |
| | | .userInfo_box { |
| | | background: rgb(240, 242, 245); |
| | | border-radius: 10px; |
| | | height: 100%; |
| | |
| | | width: 300px; |
| | | } |
| | | .inquire { |
| | | position: relative; |
| | | height: 110px; |
| | | overflow: auto; |
| | | padding: 8px; |
| | |
| | | } |
| | | } |
| | | .table_box { |
| | | height: 65%; |
| | | height: 70%; |
| | | padding: 10px; |
| | | background: #fff; |
| | | border-radius: 5px; |
| | | border: 1px solid rgb(202, 201, 204); |
| | | } |
| | | .text-center { |
| | | text-align: center; |
| | | .el-dialog { |
| | | .el-form-item { |
| | | margin-bottom: 20px; |
| | | // width: 48%; |
| | | /deep/.el-form-item__error { |
| | | width: 300px; |
| | | } |
| | | .isNewUser { |
| | | display: inline-block; |
| | | width: 75px; |
| | | margin-left: 5px; |
| | | img { |
| | | width: 1em; |
| | | } |
| | | } |
| | | .el-cascader, |
| | | .el-select { |
| | | width: 300px; |
| | | } |
| | | } |
| | | } |
| | | .select { |
| | | width: 300px; |
| | | /deep/ .el-dialog__body { |
| | | padding: 10px 0 0 0; |
| | | } |
| | | } |
| | | /deep/ .el-card__header { |
| | | padding: 10px 10px !important; |
| | | } |
| | | /deep/ .el-dialog { |
| | | margin-top: 2vh !important; |
| | | } |
| | | /deep/ .el-dialog__wrapper { |
| | | overflow: hidden !important; |
| | | } |
| | | </style> |