Commit 1343ba6d by 胡悦

修复bug

1 parent 4a50c96b
...@@ -26,32 +26,33 @@ ...@@ -26,32 +26,33 @@
:formModel="searchForm" :formModel="searchForm"
:formList="userFormList" :formList="userFormList"
> >
<span <span class="inline-b" slot="form-slot">
class="inline-b"
slot="form-slot"
>
<el-button <el-button
type="primary" type="primary"
:size="btn_size" :size="btn_size"
icon="el-icon-search" icon="el-icon-search"
:id="tableParams.btnId" :id="tableParams.btnId"
>搜索</el-button> >搜索</el-button
>
<el-button <el-button
type="primary" type="primary"
:size="btn_size" :size="btn_size"
icon="el-icon-refresh" icon="el-icon-refresh"
@click="refresh" @click="refresh"
>重置</el-button> >重置</el-button
>
</span> </span>
</search-form> </search-form>
<h3>用户管理 <h3>
用户管理
<div class="pull-right"> <div class="pull-right">
<el-button <el-button
type="primary" type="primary"
:size="btn_size" :size="btn_size"
icon="el-icon-plus" icon="el-icon-plus"
@click="btnClick('create')" @click="btnClick('create')"
>新增</el-button> >新增</el-button
>
</div> </div>
</h3> </h3>
<basic-table <basic-table
...@@ -61,27 +62,30 @@ ...@@ -61,27 +62,30 @@
:getListApi="getListApi" :getListApi="getListApi"
:hasNum="false" :hasNum="false"
> >
<span <span slot="status" slot-scope="scope">
slot="status"
slot-scope="scope"
>
<span <span
class="dot" class="dot"
:class="scope.scope.enableStatus ? USERSTATUS[scope.scope.enableStatus].split(',')[1] : ''" :class="
scope.scope.enableStatus
? USERSTATUS[scope.scope.enableStatus].split(',')[1]
: ''
"
></span> ></span>
<span class="statusText">{{ scope.scope.enableStatus ? USERSTATUS[scope.scope.enableStatus].split(',')[0] : '--'}}</span> <span class="statusText">{{
scope.scope.enableStatus
? USERSTATUS[scope.scope.enableStatus].split(",")[0]
: "--"
}}</span>
</span> </span>
<span <span slot="table-button" slot-scope="scope">
slot="table-button"
slot-scope="scope"
>
<el-button <el-button
v-for="(j, idx) in tableParams.tableOption.btnList" v-for="(j, idx) in tableParams.tableOption.btnList"
:key="idx" :key="idx"
:type="j.type || 'text'" :type="j.type || 'text'"
:size="btn_size" :size="btn_size"
@click="btnClick(j.pType, scope.scope)" @click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button> >{{ j.name }}</el-button
>
</span> </span>
</basic-table> </basic-table>
<basic-dialog <basic-dialog
...@@ -96,7 +100,7 @@ ...@@ -96,7 +100,7 @@
:ruleForm="userForm" :ruleForm="userForm"
:rules="userRules" :rules="userRules"
:ruleData="userData" :ruleData="userData"
ref='userForm' ref="userForm"
></rule-form> ></rule-form>
</slot> </slot>
</basic-dialog> </basic-dialog>
...@@ -131,76 +135,93 @@ ...@@ -131,76 +135,93 @@
</template> </template>
<script> <script>
import { getUserList, getSuperUser, addUser, editUser, detailUser, deleteUser, roleList, dictInfo } from 'services/user'; import {
import { getSimpleList, getTreeOrg } from 'services/orginizaManage' getUserList,
getSuperUser,
addUser,
editUser,
detailUser,
deleteUser,
roleList,
dictInfo
} from "services/user";
import { getSimpleList, getTreeOrg } from "services/orginizaManage";
export default { export default {
data() { data() {
return { return {
USERSTATUS: this.$Constants.USER_STATUS, USERSTATUS: this.$Constants.USER_STATUS,
orgName: '', orgName: "",
isExpand: false, isExpand: false,
searchForm: {}, searchForm: {},
userFormList: [ userFormList: [
{ {
type: 'input', type: "input",
inputType: 'text', inputType: "text",
prop: 'searchField', prop: "searchField",
placeholder: '请输入登录名称、用户名称、手机号码、用户ID' placeholder: "请输入登录名称、用户名称、手机号码、用户ID"
}, },
{ {
type: 'select', type: "select",
prop: 'userStatus', prop: "userStatus",
placeholder: '请选择用户状态', placeholder: "请选择用户状态",
options: options: [
[{ {
value: '1', value: "1",
label: '正常' label: "正常"
}, { },
value: '2', {
label: '停用' value: "2",
}] label: "停用"
}
]
} }
], ],
tableParams: { tableParams: {
// mutiSelectName: 'user', // mutiSelectName: 'user',
// mutiSelectUniqueKey: 'id', // mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000), btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list', listName: "list",
tableColumns: [ tableColumns: [
{ {
label: '用户ID', label: "用户ID",
prop: 'id', prop: "id"
}, { },
label: '登录名称', {
prop: 'account', label: "登录名称",
}, { prop: "account"
label: '用户名称', },
prop: 'username', {
}, { label: "用户名称",
label: '部门', prop: "username"
prop: 'departmentName', },
}, { {
label: '手机号', label: "部门",
prop: 'phoneNumber', prop: "departmentName"
}, { },
label: '状态', {
prop: 'enableStatus', label: "手机号",
addHtml: 'status', prop: "phoneNumber"
}, { },
label: '创建时间', {
prop: 'createdDate', label: "状态",
prop: "enableStatus",
addHtml: "status"
},
{
label: "创建时间",
prop: "createdDate"
} }
], ],
tableOption: { tableOption: {
width: 100, width: 100,
btnList: [ btnList: [
{ {
name: '编辑', name: "编辑",
pType: 'edit' pType: "edit"
}, },
{ {
name: '删除', name: "删除",
pType: 'delete' pType: "delete"
} }
] ]
} }
...@@ -209,352 +230,429 @@ export default { ...@@ -209,352 +230,429 @@ export default {
// 折叠菜单数据 // 折叠菜单数据
treedata: [], treedata: [],
// 弹窗数据 // 弹窗数据
userDialogTitle: '新增用户', userDialogTitle: "新增用户",
userVisible: false, userVisible: false,
userForm: { userForm: {
account: '', account: "",
departmentName: '', departmentName: "",
superiorName: '', superiorName: "",
enableStatus: true enableStatus: true
}, },
roleList: [], roleList: [],
userData: [ userData: [
{ label: '登录名称:', prop: 'account', type: 'input', clearable: true, maxlength: 50 }, {
{ label: '部门名称:', prop: 'departmentName', type: 'input', readonly: true, clickFunc: this.selectDepart }, label: "登录名称:",
{ label: '直接上级:', prop: 'superiorName', type: 'input', readonly: true, clickFunc: this.selectSuperior, hidden: true }, prop: "account",
{ label: '用户名称:', prop: 'username', type: 'input', clearable: true, maxlength: 50 }, type: "input",
{ label: '密码:', prop: 'password', type: 'input', inputText: 'password', showPassword: true }, clearable: true,
{ label: '角色:', prop: 'roleId', type: 'select', options: [], key: 'roleName', value: 'roleId', filterable: true }, maxlength: 50
{ label: '邮箱:', prop: 'email', type: 'input' }, },
{ label: '手机:', prop: 'phoneNumber', type: 'input', maxlength: 11 }, {
{ label: '性别:', prop: 'gender', type: 'select', options: [], key: 'dictLabel', value: 'dictValue', visibleFunc: this.genderChange }, label: "部门名称:",
{ label: '状态:', prop: 'enableStatus', type: 'switch' }, prop: "departmentName",
{ label: '岗位:', prop: 'position', type: 'select', options: [], key: 'dictLabel', value: 'dictValue', visibleFunc: this.positionChange } type: "input",
readonly: true,
clickFunc: this.selectDepart
},
{
label: "直接上级:",
prop: "superiorName",
type: "input",
readonly: true,
clickFunc: this.selectSuperior,
hidden: true
},
{
label: "用户名称:",
prop: "username",
type: "input",
clearable: true,
maxlength: 50
},
{
label: "密码:",
prop: "password",
type: "input",
inputText: "password",
showPassword: true
},
{
label: "角色:",
prop: "roleId",
type: "select",
options: [],
key: "roleName",
value: "roleId",
filterable: true
},
{ label: "邮箱:", prop: "email", type: "input" },
{ label: "手机:", prop: "phoneNumber", type: "input", maxlength: 11 },
{
label: "性别:",
prop: "gender",
type: "select",
options: [],
key: "dictLabel",
value: "dictValue",
visibleFunc: this.genderChange
},
{ label: "状态:", prop: "enableStatus", type: "switch" },
{
label: "岗位:",
prop: "position",
type: "select",
options: [],
key: "dictLabel",
value: "dictValue",
visibleFunc: this.positionChange
}
], ],
userRules: { userRules: {
account: [{ required: true, message: '请输入登录名称', trigger: 'blur' }, account: [
{ validator: this.$Common.checkName, trigger: 'blur' }, { required: true, message: "请输入登录名称", trigger: "blur" },
{ min: 5, max: 50, message: '长度在 5 到 50 个字符', trigger: 'blur' }], { validator: this.$Common.checkName, trigger: "blur" },
departmentName: [{ required: true, message: '请选择部门名称', trigger: 'change' }], { min: 5, max: 50, message: "长度在 5 到 50 个字符", trigger: "blur" }
username: [{ required: true, message: '请输入用户名称', trigger: 'blur' }, ],
{ validator: this.$Common.checkName, trigger: 'blur' }, departmentName: [
{ min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur' }], { required: true, message: "请选择部门名称", trigger: "change" }
roleId: [{ required: true, message: '请选择角色', trigger: 'change' }], ],
email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }], username: [
phoneNumber: [{ required: true, message: '请输入手机号', trigger: 'blur' }, { required: true, message: "请输入用户名称", trigger: "blur" },
{ validator: this.$Common.checkRegExpPhoneTel, trigger: 'blur' }], { validator: this.$Common.checkName, trigger: "blur" },
enableStatus: [{ required: true }], { min: 2, max: 50, message: "长度在 2 到 50 个字符", trigger: "blur" }
],
roleId: [{ required: true, message: "请选择角色", trigger: "change" }],
email: [
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"]
}
],
phoneNumber: [
{ required: true, message: "请输入手机号", trigger: "blur" },
{ validator: this.$Common.checkRegExpPhoneTel, trigger: "blur" }
],
enableStatus: [{ required: true }]
}, },
addRule: [{ required: true, message: '请输入密码', trigger: 'blur' }, addRule: [
{ min: 6, max: 50, message: '长度在 6 到 50 个字符', trigger: 'blur' }], { required: true, message: "请输入密码", trigger: "blur" },
{ min: 6, max: 50, message: "长度在 6 到 50 个字符", trigger: "blur" }
],
sexList: [], sexList: [],
positionList: [], positionList: [],
btnLoading: false, btnLoading: false,
// 部门弹窗 // 部门弹窗
filterDialogTitle: '选择组织', filterDialogTitle: "选择组织",
filterVisible: false, filterVisible: false,
filterText: '', filterText: "",
filterTextData: [], filterTextData: [],
isOpen: true isOpen: true
} };
}, },
watch: { watch: {
filterText(val) { filterText(val) {
this.$refs.tree.filter(val) this.$refs.tree.filter(val);
}, },
'$route'(val) { $route(val) {
console.log(val) if (val.path == "/user") {
if (val.path == '/user') this.getTreeOrg() this.init();
}
} }
}, },
mounted() { mounted() {
this.getTreeOrg() this.init();
this.getRoleList()
this.getPosti()
this.getSex()
}, },
methods: { methods: {
init() {
this.getTreeOrg();
this.getRoleList();
this.getPosti();
this.getSex();
},
emptyData(params) { emptyData(params) {
let arr = params let arr = params;
for (let key in arr) { for (let key in arr) {
if (params[key] == null || params[key] == '' || params[key] == []) { if (params[key] == null || params[key] == "" || params[key] == []) {
delete params[key] delete params[key];
} }
} }
return arr return arr;
}, },
// 重置搜索条件 // 重置搜索条件
refresh() { refresh() {
this.searchForm = {} this.searchForm = {};
this.orgName = '' this.orgName = "";
this.getTreeOrg() this.getTreeOrg();
this.$refs.userTable.refreshTable() this.$refs.userTable.refreshTable();
}, },
// 确定,新增用户、编辑用户 // 确定,新增用户、编辑用户
handleConfirm() { handleConfirm() {
console.log(this.userForm) console.log(this.userForm);
this.$refs.userForm.$children[0].validate((valid) => { this.$refs.userForm.$children[0].validate(valid => {
if (valid) { if (valid) {
this.btnLoading = true this.btnLoading = true;
let params = JSON.parse(JSON.stringify(this.userForm)) let params = JSON.parse(JSON.stringify(this.userForm));
params.enableStatus = this.userForm.enableStatus ? 1 : 2 params.enableStatus = this.userForm.enableStatus ? 1 : 2;
delete params.departmentName delete params.departmentName;
delete params.superiorName delete params.superiorName;
delete params.createdDate delete params.createdDate;
delete params.roleName delete params.roleName;
delete params.deptDepth delete params.deptDepth;
this.emptyData(params) this.emptyData(params);
let api = addUser let api = addUser;
if (params.id) api = editUser if (params.id) api = editUser;
api(params).then(res => { api(params).then(res => {
this.btnLoading = false this.btnLoading = false;
if (res.code == '200') { if (res.code == "200") {
this.getTreeOrg() this.getTreeOrg();
this.$refs.userTable.refreshTable() this.$refs.userTable.refreshTable();
this.handleClose() this.handleClose();
this.$message({ this.$message({
type: 'success', type: "success",
message: '操作成功!' message: "操作成功!"
}) });
} else { } else {
this.$message({ this.$message({
type: 'error', type: "error",
message: res.message message: res.message
}) });
} }
}) });
} }
}) });
}, },
// 取消 // 取消
handleClose(row) { handleClose(row) {
if (!this.userVisible && this.$refs.userForm) { if (!this.userVisible && this.$refs.userForm) {
this.$refs.userForm.$children[0].resetFields() this.$refs.userForm.$children[0].resetFields();
} }
this.userVisible = !this.userVisible this.userVisible = !this.userVisible;
}, },
// 组织架构节点 // 组织架构节点
handleNodeClick(data) { handleNodeClick(data) {
this.searchForm.departmentId = data.id this.searchForm.departmentId = data.id;
this.$refs.userTable.refreshTable() this.$refs.userTable.refreshTable();
}, },
// 树节点内容区的渲染 // 树节点内容区的渲染
renderContent(h, { node, data, store }) { renderContent(h, { node, data, store }) {
const text = node.data.userNumber === 0 ? `${node.label}` : `${node.label}(${node.data.userNumber}人)` const text =
return ( node.data.userNumber === 0
<span>{text}</span> ? `${node.label}`
) : `${node.label}(${node.data.userNumber}人)`;
return <span>{text}</span>;
}, },
// 按钮事件 // 按钮事件
btnClick(pType, scope) { btnClick(pType, scope) {
switch (pType) { switch (pType) {
case 'create': case "create":
this.isOpen = true this.isOpen = true;
this.userDialogTitle = '新增用户' this.userDialogTitle = "新增用户";
this.$set(this.userRules, 'password', this.addRule) this.$set(this.userRules, "password", this.addRule);
this.userForm = { this.userForm = {
departmentName: '', departmentName: "",
superiorName: '', superiorName: "",
enableStatus: true enableStatus: true
} };
let gender = '' let gender = "";
if (this.sexList.length > 0) { if (this.sexList.length > 0) {
gender = this.sexList[0].dictValue gender = this.sexList[0].dictValue;
} }
// this.userForm.gender = this.sexList.length > 0 ? this.sexList[0].dictValue + '' : '' // this.userForm.gender = this.sexList.length > 0 ? this.sexList[0].dictValue + '' : ''
this.$set(this.userForm, 'gender', gender) this.$set(this.userForm, "gender", gender);
this.userData.map(item => { this.userData.map(item => {
if (item.prop == 'superiorName') { if (item.prop == "superiorName") {
item.hidden = true item.hidden = true;
} }
}) });
this.handleClose() this.handleClose();
break break;
case 'edit': case "edit":
this.isOpen = false this.isOpen = false;
this.userDialogTitle = '编辑用户' this.userDialogTitle = "编辑用户";
if (this.userRules.password) { if (this.userRules.password) {
this.$set(this.userRules, 'password', null) this.$set(this.userRules, "password", null);
} }
this.editEvent(scope) this.editEvent(scope);
break break;
case 'delete': case "delete":
this.deleteEvent(scope.id) this.deleteEvent(scope.id);
break break;
} }
}, },
// 编辑触发事件 // 编辑触发事件
editEvent(row) { editEvent(row) {
detailUser({ id: row.id }).then(res => { detailUser({ id: row.id }).then(res => {
this.userDialogTitle = '编辑用户' this.userDialogTitle = "编辑用户";
this.userForm = JSON.parse(JSON.stringify(res.data)) this.userForm = JSON.parse(JSON.stringify(res.data));
this.userForm.enableStatus = res.data.enableStatus == 1 ? true : false this.userForm.enableStatus = res.data.enableStatus == 1 ? true : false;
this.userData.map(item => { this.userData.map(item => {
if (item.prop == 'superiorName') { if (item.prop == "superiorName") {
item.hidden = this.userForm.deptDepth == 0 item.hidden = this.userForm.deptDepth == 0;
} else if (item.prop == 'gender') { } else if (item.prop == "gender") {
let flag = false let flag = false;
item.options.map(i => { item.options.map(i => {
if (i.dictValue == this.userForm.gender) flag = true if (i.dictValue == this.userForm.gender) flag = true;
}) });
this.userForm.gender = flag ? this.userForm.gender + '' : '' this.userForm.gender = flag ? this.userForm.gender + "" : "";
} else if (item.prop == 'position') { } else if (item.prop == "position") {
let isFlag = false let isFlag = false;
item.options.map(j => { item.options.map(j => {
if (j.dictValue == this.userForm.position) isFlag = true if (j.dictValue == this.userForm.position) isFlag = true;
}) });
this.userForm.position = isFlag ? this.userForm.position + '' : '' this.userForm.position = isFlag ? this.userForm.position + "" : "";
} }
}) });
this.handleClose(res.data) this.handleClose(res.data);
}) });
}, },
// 删除触发事件 // 删除触发事件
deleteEvent(id) { deleteEvent(id) {
const that = this const that = this;
const tipData = { const tipData = {
that: that, that: that,
tipText: '是否删除当前记录', tipText: "是否删除当前记录",
tipTitle: '提示', tipTitle: "提示",
type: 'error', type: "error",
callBack: () => { callBack: () => {
deleteUser({ id: id }).then(res => { deleteUser({ id: id }).then(res => {
if (res.code == '200') { if (res.code == "200") {
this.$message({ this.$message({
type: 'success', type: "success",
message: '删除成功!' message: "删除成功!"
}) });
this.$refs.userTable.refreshTable() this.$refs.userTable.refreshTable();
} else { } else {
this.$message({ this.$message({
type: 'error', type: "error",
message: res.message message: res.message
}) });
} }
}) });
} }
} };
this.$Common.confirmDialog(tipData) this.$Common.confirmDialog(tipData);
}, },
// 部门弹窗 // 部门弹窗
selectDepart() { selectDepart() {
if (this.isOpen) { if (this.isOpen) {
this.filterText = '' this.filterText = "";
this.filterDialogTitle = '选择组织' this.filterDialogTitle = "选择组织";
this.getSimpleList() this.getSimpleList();
this.closeFilter() this.closeFilter();
} }
}, },
// 上级弹窗 // 上级弹窗
selectSuperior() { selectSuperior() {
this.filterText = '' this.filterText = "";
this.filterDialogTitle = '选择直接上级' this.filterDialogTitle = "选择直接上级";
this.userForm.superiorName = '' this.userForm.superiorName = "";
this.userForm.superiorId = '' this.userForm.superiorId = "";
this.getSuperUser({ departmentId: this.userForm.departmentId }) this.getSuperUser({ departmentId: this.userForm.departmentId });
this.closeFilter() this.closeFilter();
}, },
closeFilter() { closeFilter() {
this.filterVisible = !this.filterVisible this.filterVisible = !this.filterVisible;
}, },
filterConfirm() { filterConfirm() {
if (this.filterDialogTitle == '选择直接上级') { if (this.filterDialogTitle == "选择直接上级") {
if (this.$refs.tree.getCurrentNode().disabled) { if (this.$refs.tree.getCurrentNode().disabled) {
this.$message('该选项不可选择为直接上级') this.$message("该选项不可选择为直接上级");
} else { } else {
this.userForm.superiorId = this.$refs.tree.getCurrentNode().id this.userForm.superiorId = this.$refs.tree.getCurrentNode().id;
this.userForm.superiorName = this.$refs.tree.getCurrentNode().label this.userForm.superiorName = this.$refs.tree.getCurrentNode().label;
this.closeFilter() this.closeFilter();
} }
} else { } else {
this.userForm.departmentId = this.$refs.tree.getCurrentNode().id this.userForm.departmentId = this.$refs.tree.getCurrentNode().id;
this.userForm.departmentName = this.$refs.tree.getCurrentNode().label this.userForm.departmentName = this.$refs.tree.getCurrentNode().label;
this.userData.map(item => { this.userData.map(item => {
if (item.prop == 'superiorName') { if (item.prop == "superiorName") {
item.hidden = this.$refs.tree.getCurrentNode().depth == 0 item.hidden = this.$refs.tree.getCurrentNode().depth == 0;
if (this.$refs.tree.getCurrentNode().depth == 0) { if (this.$refs.tree.getCurrentNode().depth == 0) {
delete this.userForm.superiorId delete this.userForm.superiorId;
delete this.userForm.superiorName delete this.userForm.superiorName;
} }
} }
}) });
this.closeFilter() this.closeFilter();
} }
}, },
filterNode(value, data) { filterNode(value, data) {
if (!value) return true if (!value) return true;
return data.label.indexOf(value) !== -1 return data.label.indexOf(value) !== -1;
}, },
// 获取上级树 // 获取上级树
getSuperUser(params) { getSuperUser(params) {
getSuperUser(params).then(res => { getSuperUser(params).then(res => {
this.filterTextData = res.data this.filterTextData = res.data;
}) });
}, },
// 获取组织树 // 获取组织树
getSimpleList() { getSimpleList() {
getTreeOrg().then(res => { getTreeOrg().then(res => {
this.filterTextData = res.data this.filterTextData = res.data;
}) });
}, },
// 获取组织架构 // 获取组织架构
getTreeOrg(params) { getTreeOrg(params) {
getTreeOrg(params).then(res => { getTreeOrg(params).then(res => {
this.treedata = res.data this.treedata = res.data;
}) });
}, },
// 角色下拉列表 // 角色下拉列表
getRoleList() { getRoleList() {
roleList().then(res => { roleList().then(res => {
this.roleList = res.data this.roleList = res.data;
this.userData[5].options = res.data this.userData[5].options = res.data;
}) });
}, },
// 组织架构搜索 // 组织架构搜索
treeInput(value) { treeInput(value) {
const params = { const params = {
orgName: value orgName: value
} };
this.getTreeOrg(params) this.getTreeOrg(params);
this.isExpand = true this.isExpand = true;
}, },
// 岗位列表 // 岗位列表
getPosti(value) { getPosti(value) {
dictInfo('sys_position').then(res => { dictInfo("sys_position").then(res => {
if (res.data.length > 0) { if (res.data.length > 0) {
this.deleteDict(res.data, 'position', this.positionList) this.deleteDict(res.data, "position", this.positionList);
} }
}) });
}, },
// 获取性别列表 // 获取性别列表
getSex() { getSex() {
dictInfo('sys_user_sex').then(res => { dictInfo("sys_user_sex").then(res => {
if (res.data.length > 0) { if (res.data.length > 0) {
this.deleteDict(res.data, 'gender', this.sexList) this.deleteDict(res.data, "gender", this.sexList);
} }
}) });
}, },
/** /**
* 字典删除处理 * 字典删除处理
* 参数:1.data: 字典数据, Array * 参数:1.data: 字典数据, Array
* 2.name: 字段名, String * 2.name: 字段名, String
* 3.list: 可选择项的数组,Array * 3.list: 可选择项的数组,Array
*/ */
deleteDict(data, name, list) { deleteDict(data, name, list) {
const arr = [] const arr = [];
if (!data[0].typeDeleted) { if (!data[0].typeDeleted) {
// 过滤未删除列表 // 过滤未删除列表
data.map(item => { data.map(item => {
if (!item.deleted) arr.push(item) if (!item.deleted) arr.push(item);
}) });
this.userData.map(item => { this.userData.map(item => {
if (item.prop == name) { if (item.prop == name) {
item.options = arr item.options = arr;
} }
}) });
arr && arr.map(i => { arr &&
if (!i.disabled) list.push(i) arr.map(i => {
}) if (!i.disabled) list.push(i);
});
} }
}, },
/** /**
...@@ -567,34 +665,32 @@ export default { ...@@ -567,34 +665,32 @@ export default {
if (item.prop == name) { if (item.prop == name) {
if (item.options[0].typeDeleted) { if (item.options[0].typeDeleted) {
this.$message({ this.$message({
type: 'error', type: "error",
message: `${label}已删除,请联系管理员解决` message: `${label}已删除,请联系管理员解决`
}) });
} else if (item.options[0].typeDisabled) { } else if (item.options[0].typeDisabled) {
this.$message({ this.$message({
type: 'error', type: "error",
message: `${label}已停用,请联系管理员解决` message: `${label}已停用,请联系管理员解决`
}) });
} }
} }
}) });
}, },
// 性别下拉框出现/隐藏回调 // 性别下拉框出现/隐藏回调
genderChange(e) { genderChange(e) {
if (e) this.disabledDict('gender', '性别') if (e) this.disabledDict("gender", "性别");
}, },
// 岗位下拉框出现/隐藏回调 // 岗位下拉框出现/隐藏回调
positionChange(e) { positionChange(e) {
if (e) this.disabledDict('position', '岗位') if (e) this.disabledDict("position", "岗位");
}, },
selectChange(e) { selectChange(e) {}
}
} }
} };
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">
.el-tree-node > .el-tree-node__children { .el-tree-node > .el-tree-node__children {
overflow: initial !important; overflow: initial !important;
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!