| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px"> |
| | | <el-form |
| | | class="opo-query-form" :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px"> |
| | | |
| | | <el-form-item label="账号类别" prop="usertype"> |
| | | <el-select v-model="queryParams.usertype" placeholder="请选择账号类别" clearable size="small"> |
| | |
| | | |
| | | <el-table v-loading="loading" :data="externalpersonList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="账号类别" align="center" prop="usertype"> |
| | | <el-table-column label="账号类别" align="center" prop="usertype" width="220"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.sys_UserType" :value="scope.row.usertype" /> |
| | | <dict-tag v-for="t in splitUserType(scope.row.usertype)" :key="t" |
| | | :options="dict.type.sys_UserType" :value="t" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="账号编号" align="center" prop="userno" /> |
| | |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="12"><el-form-item label="账号类别" prop="usertype"> |
| | | <el-select v-model="form.usertype" placeholder="请选择账号类别"> |
| | | <el-select v-model="form.usertype" multiple collapse-tags placeholder="请选择账号类别(可多选)"> |
| | | <el-option v-for="dict in dict.type.sys_UserType" :key="dict.value" :label="dict.label" |
| | | :value="dict.value"></el-option> |
| | | </el-select> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row v-if="form.usertype != 'org'"> |
| | | <el-row v-if="!isUnitForm"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="身份证号" prop="idcardno"> |
| | | <el-input v-model="form.idcardno" placeholder="请输入身份证号" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row v-if="form.usertype != 'org'"><el-col :span="12"> |
| | | <el-row v-if="!isUnitForm"><el-col :span="12"> |
| | | <el-form-item label="性别" prop="sex"> |
| | | <el-select v-model="form.sex" placeholder="请选择性别"> |
| | | <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label" |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row v-if="form.usertype != 'org'"> |
| | | <el-row v-if="!isUnitForm"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="所在单位" prop="unitname"> |
| | | <el-select v-model="form.unitno" placeholder="所在单位" clearable filterable allow-create style="width: 100%"> |
| | |
| | | { required: true, message: "请输入账户名称", trigger: "blur" } |
| | | ], |
| | | idcardno: [ |
| | | { required: true, message: "请输入身份证号码", trigger: "blur" } |
| | | { |
| | | //账号类别为"单位机构"时无需身份证号 |
| | | validator: (rule, value, callback) => { |
| | | if (this.hasUserType(this.form.usertype, "org")) { |
| | | return callback(); |
| | | } |
| | | if (!value || !String(value).trim()) { |
| | | return callback(new Error("请输入身份证号码")); |
| | | } |
| | | return callback(); |
| | | }, |
| | | trigger: "blur" |
| | | } |
| | | ], |
| | | bankcardno: [ |
| | | { required: true, message: "请输入银行账号", trigger: "blur" } |
| | |
| | | ] |
| | | }, |
| | | }; |
| | | }, |
| | | computed: { |
| | | /** 表单是否选择了"单位机构"(账号类别为多值,含 org 即为单位) */ |
| | | isUnitForm() { |
| | | return this.hasUserType(this.form.usertype, "org"); |
| | | } |
| | | }, |
| | | created() { |
| | | this.getUserProfile(); |
| | |
| | | const managerList = ["admin", "048", "047"]; |
| | | this.ismanager = managerList.includes(res.data.userName); |
| | | }); |
| | | }, |
| | | |
| | | /** 人员类型(多值,逗号分隔)转数组 */ |
| | | splitUserType(usertype) { |
| | | if (!usertype) { |
| | | return []; |
| | | } |
| | | if (Array.isArray(usertype)) { |
| | | return usertype; |
| | | } |
| | | return String(usertype) |
| | | .split(",") |
| | | .map(t => t.trim()) |
| | | .filter(t => t); |
| | | }, |
| | | /** 人员类型数组转逗号分隔字符串 */ |
| | | joinUserType(usertype) { |
| | | return Array.isArray(usertype) ? usertype.join(",") : usertype; |
| | | }, |
| | | /** 人员类型是否包含指定类型(如 org = 单位机构) */ |
| | | hasUserType(usertype, code) { |
| | | return this.splitUserType(usertype).indexOf(code) > -1; |
| | | }, |
| | | |
| | | /** 查询单位、人员账号列表 */ |
| | |
| | | userno: null, |
| | | username: null, |
| | | userstatus: 0, |
| | | usertype: null, |
| | | usertype: [], |
| | | personnelunitno: null, |
| | | delFlag: null, |
| | | createBy: null, |
| | |
| | | const id = row.id || this.ids; |
| | | getExternalperson(id).then(response => { |
| | | this.form = response.data; |
| | | //账号类别为多值(逗号分隔),表单用数组回显 |
| | | this.form.usertype = this.splitUserType(response.data.usertype); |
| | | this.open = true; |
| | | this.title = "人员/单位账号信息修改"; |
| | | }); |
| | |
| | | if (res.organizationid == this.form.unitno) |
| | | this.form.unitname = res.organizationname; |
| | | }); |
| | | //账号类别为多值:提交前转回逗号分隔的字符串 |
| | | this.form.usertype = this.joinUserType(this.form.usertype); |
| | | console.log(this.form); |
| | | if (this.form.id != null) { |
| | | updateExternalperson(this.form).then(response => { |
| | |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | //检查身份证唯一 |
| | | getInfoByIDCardNo(this.form.idcardno).then(res => { |
| | | if (res.data.length > 1) { |
| | | this.$modal.msgWarning("身份证号信息已被登记,请检查身份证号!" |
| | | ); |
| | | return; |
| | | } |
| | | |
| | | //保存信息 |
| | | //保存信息(单位账号没有身份证号,跳过身份证查重) |
| | | const saveNew = () => { |
| | | getOnlyCode(this.seqnoParams).then(res => { |
| | | this.form.userno = res.data.currentvalue; |
| | | |
| | |
| | | this.getList(); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | if (!this.form.idcardno || !String(this.form.idcardno).trim()) { |
| | | saveNew(); |
| | | return; |
| | | } |
| | | |
| | | //检查身份证唯一 |
| | | getInfoByIDCardNo(this.form.idcardno).then(res => { |
| | | if (res.data.length > 1) { |
| | | this.$modal.msgWarning("身份证号信息已被登记,请检查身份证号!" |
| | | ); |
| | | return; |
| | | } |
| | | saveNew(); |
| | | }); |
| | | } |
| | | } |