diff --git a/components/panel/formSlot.vue b/components/panel/formSlot.vue index 7a23ba7..fbcde31 100644 --- a/components/panel/formSlot.vue +++ b/components/panel/formSlot.vue @@ -93,7 +93,7 @@ -
+
@@ -169,10 +169,20 @@
{{ item.value || "-" }}
-
-
{{ item.value }}
-
+
+
{{ item.value }}
+ +
+
{{ item.value || item.placeholder }}
+ +
+ +
+
{{ item.value || item.placeholder }}
+ +
+
@@ -245,6 +255,75 @@ + +
+
选择部门
+
+
+
+
+
+
+ {{ dept.teamName }} +
+
+ +
+
+
+
+
+
+ + +
+ +
+
+
+
+
+ + +
+
选择角色
+
+
+
+
+
+
+ {{ role.roleName }} +
+
+ +
+
+
+
+
+
+ + +
+ +
+
+
+
+
@@ -288,6 +367,20 @@ export default { }, zhengceList: [], chooseImg: { chooseImgShow: false, type: "" }, // 选择上传图片类型的弹窗显示 + deptModal: { + isShow: false, + }, + deptColumns: [], // 级联列:[[{id,teamName,childs}], [...]] + selectedDeptIds: [], // 选中的部门id集合 + selectedDeptNames: [], // 选中的部门名称集合 + currentDeptItem: null, // 当前编辑的表单项 + roleModal: { + isShow: false, + }, + roleList: [], // 角色列表 + selectedRoleIds: [], // 选中的角色id集合 + selectedRoleNames: [], // 选中的角色名称集合 + currentRoleItem: null, // 当前编辑的角色表单项 }; }, props: { @@ -307,6 +400,18 @@ export default { type: Number, default: 0, }, + deptList: { + type: Array, + default: () => { + return []; + }, + }, + roleList: { + type: Array, + default: () => { + return []; + }, + }, }, created() { this.localBaseImg = this.G.store().localBaseImg; @@ -353,6 +458,8 @@ export default { } if ($item.tip == "slot-weChat") { this.$emit("changeWeChat", e, $item); + } else if ($item.tip == "slot-title") { + this.$emit("changeTitle", e, $item); } else { this.$emit("changeName", e, $item); } @@ -697,12 +804,108 @@ export default { handleResult(e) { this.$emit("clickResult", e); }, + // 判断部门是否选中 + isDeptSelected(id) { + return this.selectedDeptIds.indexOf(id) > -1; + }, + // 打开部门选择弹窗 + openDeptPicker(item) { + this.currentDeptItem = item; + // 初始化列并递归展开所有层级 + this.deptColumns = this.buildAllDeptColumns(this.deptList || []); + if (item.deptIds && item.deptIds.length) { + this.selectedDeptIds = [].concat(item.deptIds); + this.selectedDeptNames = [].concat(item.deptNames || []); + } else { + this.selectedDeptIds = []; + this.selectedDeptNames = []; + } + this.deptModal.isShow = true; + }, + // 递归构建全部层级列 + buildAllDeptColumns(list) { + if (!list || list.length === 0) return []; + let columns = [list]; + // 找到所有有子级的节点,合并子级作为下一列 + let nextColumn = []; + list.forEach(item => { + if (item.childs && item.childs.length > 0) { + nextColumn = nextColumn.concat(item.childs); + } + }); + if (nextColumn.length > 0) { + columns = columns.concat(this.buildAllDeptColumns(nextColumn)); + } + return columns; + }, + // 点击部门项:切换选中 + 展开下一级 + handleDeptClick(dept, colIndex) { + let idx = this.selectedDeptIds.indexOf(dept.id); + if (idx > -1) { + this.selectedDeptIds.splice(idx, 1); + this.selectedDeptNames.splice(idx, 1); + } else { + this.selectedDeptIds.push(dept.id); + this.selectedDeptNames.push(dept.teamName); + } + }, + // 提交部门选择 + submitDept() { + let ids = this.selectedDeptIds.join(","); + let names = this.selectedDeptNames.join(";"); + this.deptModal.isShow = false; + this.$emit("changeAgencyTeam", { + ids: ids, + names: names, + idList: [].concat(this.selectedDeptIds), + nameList: [].concat(this.selectedDeptNames), + }); + }, handleMobile(e, $item, $index) { this.$emit("changeMobile", e, $item); }, handleMianshi(e, $item, $index) { this.$emit("changeTime", e); }, + // 判断角色是否选中 + isRoleSelected(id) { + return this.selectedRoleIds.indexOf(id) > -1; + }, + // 打开角色选择弹窗 + openRolePicker(item) { + this.currentRoleItem = item; + if (item.roleIds && item.roleIds.length) { + this.selectedRoleIds = [].concat(item.roleIds); + this.selectedRoleNames = [].concat(item.roleNames || []); + } else { + this.selectedRoleIds = []; + this.selectedRoleNames = []; + } + this.roleModal.isShow = true; + }, + // 点击角色项:切换选中 + handleRoleClick(role) { + let idx = this.selectedRoleIds.indexOf(role.id); + if (idx > -1) { + this.selectedRoleIds.splice(idx, 1); + this.selectedRoleNames.splice(idx, 1); + } else { + this.selectedRoleIds.push(role.id); + this.selectedRoleNames.push(role.roleName); + } + }, + // 提交角色选择 + submitRole() { + let ids = this.selectedRoleIds.join(","); + let names = this.selectedRoleNames.join(";"); + this.roleModal.isShow = false; + this.$emit("changeAgencyRole", { + ids: ids, + names: names, + idList: [].concat(this.selectedRoleIds), + nameList: [].concat(this.selectedRoleNames), + }); + }, }, }; @@ -778,4 +981,39 @@ export default { padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom); } +.dept-picker-wrap { + background-color: #fff; + height: 980rpx; + display: flex; + flex-direction: column; +} +.dept-columns-scroll { + white-space: nowrap; + overflow-x: auto; + -webkit-overflow-scrolling: touch; + flex: 1; + width: 100%; + padding-bottom: calc(constant(safe-area-inset-bottom) + 80rpx); + padding-bottom: calc(env(safe-area-inset-bottom) + 80rpx); +} +.dept-columns { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + height: 100%; + width: max-content; + min-width: 100%; +} +.dept-column { + width: 30vw; + min-width: 30vw; + max-width: 30vw; + height: 100%; + border-right: 1px solid #ddd; + box-sizing: border-box; + flex-shrink: 0; + flex-grow: 0; + overflow-y: auto; + -webkit-overflow-scrolling: touch; +} diff --git a/root/merchantManagement/addOrUpdataMember.vue b/root/merchantManagement/addOrUpdataMember.vue index 09a352c..ba1a37c 100644 --- a/root/merchantManagement/addOrUpdataMember.vue +++ b/root/merchantManagement/addOrUpdataMember.vue @@ -2,6 +2,7 @@
@@ -44,6 +89,8 @@ export default { data() { return { memberInfo: {}, + deptList: [], + roleList: [], }; }, onShow() {}, @@ -53,6 +100,7 @@ export default { if (options.info) { console.log("options.info", options.info); this.memberInfo = JSON.parse(options.info); + this.initMemberDept(); uni.setNavigationBarTitle({ title: "修改成员信息", }); @@ -61,12 +109,49 @@ export default { title: "添加成员", }); } + this.getDeptList(); + this.getRoleList(); }, created() { console.log(123123); }, methods: { + getDeptList() { + let that = this; + this.G.Post('/yishoudan/agency/team/list', {}, (res) => { + that.deptList = res.list || []; + }); + }, + initMemberDept() { + let info = this.memberInfo; + if (info.agencyTeamIds) { + info.agencyTeamIdList = info.agencyTeamIds.split(",").map((id) => Number(id)); + } else { + info.agencyTeamIdList = []; + } + if (info.agencyTeamName) { + info.agencyTeamNameList = info.agencyTeamName.split(";"); + } else { + info.agencyTeamNameList = []; + } + if (info.agencyRoleIds) { + info.agencyRoleIdList = info.agencyRoleIds.split(",").map((id) => Number(id)); + } else { + info.agencyRoleIdList = []; + } + if (info.agencyRoleName) { + info.agencyRoleNameList = info.agencyRoleName.split(";"); + } else { + info.agencyRoleNameList = []; + } + }, + getRoleList() { + let that = this; + this.G.Get('/yishoudan/agency/role/list', {}, (res) => { + that.roleList = res.list || []; + }); + }, getMemberList() { let that = this; this.G.Get(this.api.order_peopleList, {}, (res) => { @@ -103,6 +188,13 @@ export default { }); return false; } + if (!this.memberInfo.agencyRoleIds) { + uni.showToast({ + title: "请选择角色", + icon: "none", + }); + return false; + } let url = "order_addMember"; if (this.memberInfo.id) { // 判断是否是编辑成员 @@ -175,6 +267,24 @@ export default { console.log("e", e); this.memberInfo.tel = e; }, + changeTitle(e) { + console.log("e", e); + this.memberInfo.title = e; + }, + changeAgencyTeam(res) { + console.log("res", res); + this.memberInfo.agencyTeamIds = res.ids; + this.memberInfo.agencyTeamName = res.names; + this.memberInfo.agencyTeamIdList = res.idList; + this.memberInfo.agencyTeamNameList = res.nameList; + }, + changeAgencyRole(res) { + console.log("roleRes", res); + this.memberInfo.agencyRoleIds = res.ids; + this.memberInfo.agencyRoleName = res.names; + this.memberInfo.agencyRoleIdList = res.idList; + this.memberInfo.agencyRoleNameList = res.nameList; + }, }, };