链接/二维码失效日期:2022-11-11
+链接/二维码失效时间:{{ expireTime }}
城市合伙人 邀请链接
加盟商、合作伙伴可以通过这个链接加入 城市合伙人计划
城市合伙人 邀请二维码
@@ -138,19 +140,6 @@ export default { } } } - const workNumberPass = (rule, value, callback) => { - if (value === '') { - callback(new Error('请输入工号')) - } else { - const pattern = /^[A-Za-z0-9]*$/ - if(pattern.test(value)){ - this.worknumberChange() - callback() - }else{ - callback(new Error('请输入正确工号格式')) - } - } - } const phonePass = (rule, value, callback) => { if (value) { const pattern = /^1[3456789]\d{9}$/ @@ -178,9 +167,9 @@ export default { } } return { + token: sessionStorage.getItem('token'), orgList: [], orgListDia: [], - studentType: 1, //类型:必填一个(1.所有员工 2.未加入班级员工) orgVisible: false, // 员工组织架对话框 typeForm: { id: '', @@ -197,17 +186,11 @@ export default { treeResolve: [], isDetail: false, keyWord: '', - roleList: [], form: { - accountId: '', userName: '', phone: '', - roleList: [], - uniqueIdentification: '', - workNumber: '', email: '', - account: '', - staffArchitectureId: [] + account: '' }, orgRules: { partnerClassificationName: [ @@ -221,12 +204,6 @@ export default { userName: [ { required: true, message: "请输入姓名", trigger: "blur" } ], - workNumber: [ - { required: true,validator: workNumberPass, trigger: 'blur' } - ], - roleList: [ - { required: true, message: "请选择授权角色", trigger: "change" } - ], phone: [ { validator: phonePass, trigger: 'blur' } ], @@ -241,12 +218,6 @@ export default { multipleSelection: [], parnerVisible: false, - accountReapeat: false, - originAccount: '', - workNumberReapeat: false, - originWorkNumber: '', - phoneRepeat: false, - emailRepeat: false, casProps: { multiple: true, checkStrictly: true, @@ -254,15 +225,9 @@ export default { value: 'id', isLeaf: 'leaf' }, - - importVisible: false, - uploadList: [], - uploadFaild: false, - exportCode: '', - headers: { - token: util.local.get(Setting.tokenKey) - }, - disableds:false, + link: '', + expireTime: '', + curTeamId: '', submiting: false // 新增编辑防抖标识 }; }, @@ -292,20 +257,6 @@ export default { } handleLeaf(list) this.orgList = list - this.handleOrgId(list) - this.getList() - }, - // 每个层级加上父级id的集合 - handleOrgId(list, ids) { - list.forEach(e => { - e.ids = ids ? [...ids, e.id] : [e.id] - e.children && this.handleOrgId(e.children, e.ids) - }) - }, - // 组织类别筛选回调 - changeType() { - this.$refs.orgTree.setCurrentKey(null) - this.initData() }, // 添加部门 addOrg(node, data) { @@ -321,7 +272,7 @@ export default { // 编辑部门 editOrg(node, data) { const list = JSON.parse(JSON.stringify(this.orgList)) - this.handleOrg(list, data.id, 0) + this.handleOrg(list) this.orgListDia = list this.typeForm = { id: data.id, @@ -333,25 +284,20 @@ export default { this.cascaderValue = ids }, // 处理更换部门的禁选 - handleOrg(list, id, disabled) { - list.forEach(e => { - // 如果是已经找到了要禁选的层级,则直接改变disabled,并递归 - if (disabled) { + handleOrg(list) { + for (const i in list) { + const e = list[i] + // 如果是团队,则禁选 + if (e.isTeam) { e.disabled = true - e.children && this.handleOrg(e.children, id, 1) } else { - if (e.id === id) { - e.disabled = true - e.children && this.handleOrg(e.children, id, 1) - } else { - e.children && this.handleOrg(e.children, id, 0) - } + this.handleOrg(e.children) } - }) + } }, // 删除部门 delOrg(node, data) { - this.$confirm("确定要删除吗?", "提示", { + this.$confirm(data.isTeam ? '确定删除城市合伙人' : '确定要删除吗?', "提示", { type: "warning" }).then(() => { this.$post(`${this.api.deleteParner}?id=${data.id}`).then(res => { @@ -387,11 +333,31 @@ export default { } }); }, + // 获得点击层级里的第一个城市合伙人id + getTeamId(list) { + for (const i in list) { + const e = list[i] + if (e.isTeam) { + this.curTeamId = e.id + break + } else { + this.getTeamId(e.children) + } + } + }, // 点击树节点查询列表数据 handleNodeClick(data) { + this.curTeamId = '' + if (data.isTeam) { + this.curTeamId = data.id + } else { + this.getTeamId(data.children) + } + if (this.curTeamId) { + this.$refs.orgTree.setCurrentKey(this.curTeamId) + this.getList() + } this.$refs.table.clearSelection() - this.studentType = null - this.getList() }, // 关闭组织新增编辑弹框 closeOrg() { @@ -402,13 +368,13 @@ export default { // 员工列表 getList() { this.$post(this.api.partnerAccountList, { - partnerClassificationId: this.$refs.orgTree.getCurrentKey() || '', + partnerClassificationId: this.curTeamId, keyWord: this.keyWord, pageNum: this.page, pageSize: this.pageSize }).then(res => { - this.listData = res.page.records - this.total = res.page.total + this.listData = res.page.records + this.total = res.page.total }).catch(err => {}) }, // 切换页码 @@ -426,11 +392,24 @@ export default { }, // 添加 add() { - this.parnerVisible = true + const { orgList } = this + if (orgList.length) { + const token = this.token + // 获取邀请码 + this.$post(`${this.api.generateInvitationCode}?token=${token}`).then(({ expireTime, invitationCode }) => { + const date = new Date(Date.now() + expireTime) + this.expireTime = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getMinutes()}` + this.parnerVisible = true + const cur = this.$refs.orgTree.getCurrentKey() + this.link = `${location.origin}${Setting.isDev || Setting.isPro ? '' : 'nakadai'}/#/join?token=${encodeURI(window.btoa(token))}&id=${cur ? cur: this.orgList[0].id}&invitationCode=${invitationCode}` + }).catch(res => {}) + } else { + util.errorMsg('请添加分类!') + } }, // 复制链接 copy(e) { - clipboard('测试地址', e, '文件路径已复制!') + clipboard(this.link, e, '链接已复制!') } } };