协同宣发
This commit is contained in:
		| @@ -245,7 +245,7 @@ | |||||||
|       li.active + li { |       li.active + li { | ||||||
|         border-left: 1px solid #D0D4DC; |         border-left: 1px solid #D0D4DC; | ||||||
|       } |       } | ||||||
|     }  |     } | ||||||
|  |  | ||||||
|     .newPagination { |     .newPagination { | ||||||
|       width: 100%; |       width: 100%; | ||||||
|   | |||||||
| @@ -1,66 +1,45 @@ | |||||||
| <template> | <template> | ||||||
|   <ai-detail> |   <ai-detail class="AppAnnounceDetail"> | ||||||
|     <template slot="title"> |     <template slot="title"> | ||||||
|       <ai-title :title="id ? '编辑成员' : '添加成员'" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> |       <ai-title :title="id ? '编辑居民群发' : '添加居民群发'" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> | ||||||
|       </ai-title> |       </ai-title> | ||||||
|     </template> |     </template> | ||||||
|     <template slot="content"> |     <template slot="content"> | ||||||
|       <el-form ref="form" :model="form" label-width="110px" label-position="right"> |       <div class="AppAnnounceDetail-container"> | ||||||
|       <ai-card title="个人信息"> |         <el-form ref="form" class="left" :model="form" label-width="110px" label-position="right"> | ||||||
|         <template #content> |           <ai-card title="基本信息"> | ||||||
|           <div class="ai-form"> |             <template #content> | ||||||
|             <el-form-item label="姓名" prop="name" :rules="[{ required: true, message: '请输入姓名', trigger: 'blur' }]"> |               <div class="ai-form"> | ||||||
|               <el-input size="small" placeholder="请输入姓名" v-model="form.name"></el-input> |                 <el-form-item label="姓名" prop="name" :rules="[{ required: true, message: '请输入姓名', trigger: 'blur' }]"> | ||||||
|             </el-form-item> |                   <el-input size="small" placeholder="请输入姓名" v-model="form.name"></el-input> | ||||||
|             <el-form-item label="账号" prop="id" :rules="[{ required: true, message: '请输入账号', trigger: 'blur' }]"> |                 </el-form-item> | ||||||
|               <el-input size="small" :disabled="!!id" placeholder="成员唯一标识,设定以后不支持修改" v-model="form.id"></el-input> |                 <el-form-item label="账号" prop="id" :rules="[{ required: true, message: '请输入账号', trigger: 'blur' }]"> | ||||||
|             </el-form-item> |                   <el-input size="small" :disabled="!!id" placeholder="成员唯一标识,设定以后不支持修改" v-model="form.id"></el-input> | ||||||
|             <el-form-item label="手机号" prop="mobile" :rules="[{ required: true, validator: validatorPhone, trigger: 'blur' }]"> |                 </el-form-item> | ||||||
|               <el-input size="small" placeholder="请输入手机号" v-model="form.mobile"></el-input> |                 <el-form-item label="手机号" prop="mobile" :rules="[{ required: true, validator: validatorPhone, trigger: 'blur' }]"> | ||||||
|             </el-form-item> |                   <el-input size="small" placeholder="请输入手机号" v-model="form.mobile"></el-input> | ||||||
|             <el-form-item label="性别" prop="gender"> |                 </el-form-item> | ||||||
|               <el-radio-group v-model="form.gender"> |                 <el-form-item label="性别" prop="gender"> | ||||||
|                 <el-radio label="1">男</el-radio> |                   <el-radio-group v-model="form.gender"> | ||||||
|                 <el-radio label="2">女</el-radio> |                     <el-radio label="1">男</el-radio> | ||||||
|               </el-radio-group> |                     <el-radio label="2">女</el-radio> | ||||||
|             </el-form-item> |                   </el-radio-group> | ||||||
|             <el-form-item label="座机" prop="telephone"> |                 </el-form-item> | ||||||
|               <el-input size="small" placeholder="请输入座机" v-model="form.telephone"></el-input> |                 <el-form-item label="座机" prop="telephone"> | ||||||
|             </el-form-item> |                   <el-input size="small" placeholder="请输入座机" v-model="form.telephone"></el-input> | ||||||
|             <el-form-item label="邮箱" prop="email"> |                 </el-form-item> | ||||||
|               <el-input size="small" placeholder="请输入邮箱" v-model="form.email"></el-input> |                 <el-form-item label="邮箱" prop="email"> | ||||||
|             </el-form-item> |                   <el-input size="small" placeholder="请输入邮箱" v-model="form.email"></el-input> | ||||||
|             <el-form-item label="地址" style="width: 100%;" prop="address"> |                 </el-form-item> | ||||||
|               <el-input size="small" style="width: 100%;" placeholder="请输入地址" v-model="form.address"></el-input> |                 <el-form-item label="地址" style="width: 100%;" prop="address"> | ||||||
|             </el-form-item> |                   <el-input size="small" style="width: 100%;" placeholder="请输入地址" v-model="form.address"></el-input> | ||||||
|           </div> |                 </el-form-item> | ||||||
|         </template> |               </div> | ||||||
|       </ai-card> |             </template> | ||||||
|       <ai-card title="组织信息"> |           </ai-card> | ||||||
|         <template #content> |         </el-form> | ||||||
|           <el-form-item label="部门" prop="departmentName" style="width: 100%;" :rules="[{ required: true, message: '请选择部门', trigger: 'change' }]"> |         <div class="right"></div> | ||||||
|             <el-input size="small" placeholder="请选择..." disabled v-model="form.departmentName"> |       </div> | ||||||
|               <ai-user-get slot="append" isStrictly :instance="instance" @change="onChange" v-model="department" isChooseUnit> |  | ||||||
|                 <el-button type="info">选择</el-button> |  | ||||||
|               </ai-user-get> |  | ||||||
|             </el-input> |  | ||||||
|           </el-form-item> |  | ||||||
|           <el-form-item label="标签" style="width: 100%;" prop="tags"> |  | ||||||
|             <el-select size="small" v-model="form.tagIds" multiple placeholder="请选择标签"> |  | ||||||
|               <el-option |  | ||||||
|                 v-for="item in tagsList" |  | ||||||
|                 :key="item.id" |  | ||||||
|                 :label="item.tagname" |  | ||||||
|                 :value="item.id"> |  | ||||||
|               </el-option> |  | ||||||
|             </el-select> |  | ||||||
|           </el-form-item> |  | ||||||
|           <el-form-item label="职务" prop="position"> |  | ||||||
|             <el-input size="small" placeholder="请输入职务" v-model="form.position"></el-input> |  | ||||||
|           </el-form-item> |  | ||||||
|         </template> |  | ||||||
|       </ai-card> |  | ||||||
|       </el-form> |  | ||||||
|     </template> |     </template> | ||||||
|     <template #footer> |     <template #footer> | ||||||
|       <el-button @click="cancel">取消</el-button> |       <el-button @click="cancel">取消</el-button> | ||||||
| @@ -193,4 +172,36 @@ | |||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <style scoped lang="scss"> | <style scoped lang="scss"> | ||||||
|  |   .AppAnnounceDetail { | ||||||
|  |     ::v-deep  .ai-detail__content { | ||||||
|  |       .ai-detail__content--wrapper { | ||||||
|  |         position: relative; | ||||||
|  |         max-width: 100%; | ||||||
|  |         margin: 0; | ||||||
|  |         height: 100%; | ||||||
|  |         overflow: hidden; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     .AppAnnounceDetail-container { | ||||||
|  |       display: flex; | ||||||
|  |       position: relative; | ||||||
|  |       height: 100%; | ||||||
|  |       padding: 0 20px; | ||||||
|  |       overflow-y: overlay; | ||||||
|  |  | ||||||
|  |       .left { | ||||||
|  |         flex: 1; | ||||||
|  |         margin-right: 20px; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       .right { | ||||||
|  |         position: sticky; | ||||||
|  |         top: 0; | ||||||
|  |         width: 400px; | ||||||
|  |         height: 90%; | ||||||
|  |         background: red; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
| </style> | </style> | ||||||
|   | |||||||
| @@ -10,15 +10,32 @@ | |||||||
|     <template slot="content"> |     <template slot="content"> | ||||||
|       <ai-search-bar class="search-bar"> |       <ai-search-bar class="search-bar"> | ||||||
|         <template #left> |         <template #left> | ||||||
|           <el-button size="small" type="primary" icon="iconfont iconAdd" v-if="tabIndex === 0" @click="toAdd('')">添加成员 |           <el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">创建宣发</el-button> | ||||||
|           </el-button> |           <ai-select | ||||||
|  |             v-model="search.confirmStatus" | ||||||
|  |             @change="search.current = 1, getList" | ||||||
|  |             placeholder="任务状态" | ||||||
|  |             :selectList="dict.getDict('confirmStatus')"> | ||||||
|  |           </ai-select> | ||||||
|  |           <el-date-picker | ||||||
|  |             v-model="search.startDate" | ||||||
|  |             type="date" | ||||||
|  |             size="small" | ||||||
|  |             placeholder="选择群发开始日期"> | ||||||
|  |           </el-date-picker> | ||||||
|  |           <el-date-picker | ||||||
|  |             v-model="search.endDate" | ||||||
|  |             type="date" | ||||||
|  |             size="small" | ||||||
|  |             placeholder="选择群发结束日期"> | ||||||
|  |           </el-date-picker> | ||||||
|         </template> |         </template> | ||||||
|         <template slot="right"> |         <template slot="right"> | ||||||
|           <el-input |           <el-input | ||||||
|             v-model="search.name" |             v-model="search.name" | ||||||
|             size="small" |             size="small" | ||||||
|             v-throttle="() => {search.current = 1, getList()}" |             v-throttle="() => { search.current = 1, getList() }" | ||||||
|             placeholder="请输入成员姓名、手机号或标签名称" |             placeholder="请输入任务名称" | ||||||
|             clearable |             clearable | ||||||
|             @clear="search.current = 1, search.name = '', getList()" |             @clear="search.current = 1, search.name = '', getList()" | ||||||
|             suffix-icon="iconfont iconSearch"> |             suffix-icon="iconfont iconSearch"> | ||||||
| @@ -67,64 +84,23 @@ export default { | |||||||
|  |  | ||||||
|   data() { |   data() { | ||||||
|     return { |     return { | ||||||
|       users: [], |  | ||||||
|       isShowMenu: false, |  | ||||||
|       department: [], |  | ||||||
|       btnLoading: false, |  | ||||||
|       menuInfo: { |  | ||||||
|         x: '', |  | ||||||
|         y: '', |  | ||||||
|         node: {} |  | ||||||
|       }, |  | ||||||
|       search: { |       search: { | ||||||
|         current: 1, |         current: 1, | ||||||
|         size: 10, |         size: 10, | ||||||
|         title: '', |  | ||||||
|         tagname: '', |  | ||||||
|         name: '', |         name: '', | ||||||
|         tagIds: '', |         startDate: '', | ||||||
|         departmentId: '' |         endDate: '' | ||||||
|       }, |  | ||||||
|       tagForm: { |  | ||||||
|         tagname: '' |  | ||||||
|       }, |  | ||||||
|       isShowDepart: false, |  | ||||||
|       departForm: { |  | ||||||
|         name: '' |  | ||||||
|       }, |       }, | ||||||
|       loading: false, |       loading: false, | ||||||
|       isShowTags: false, |  | ||||||
|       defaultChecked: [], |  | ||||||
|       defaultExpanded: [], |  | ||||||
|       tabIndex: 0, |  | ||||||
|       currIndex: -1, |  | ||||||
|       areaList: [], |  | ||||||
|       total: 0, |       total: 0, | ||||||
|       colConfigs: [ |       colConfigs: [ | ||||||
|         {type: 'selection', label: ''}, |         { prop: 'position', label: '任务名称' }, | ||||||
|         {slot: 'avatar', label: ''}, |         { prop: 'mobile', label: '群发类型' }, | ||||||
|         {slot: 'username'}, |         { prop: 'position', label: '创建人' }, | ||||||
|         {prop: 'position', label: '职务'}, |         { prop: 'mobile', label: '群发时间' }, | ||||||
|         // {prop: 'departmentNames', label: '部门'}, |         { prop: 'position', label: '状态' }, | ||||||
|         {prop: 'mobile', label: '手机号'}, |         { prop: 'mobile', label: '任务完成率' } | ||||||
|         {slot: 'tags', label: '标签'}, |       ] | ||||||
|         {prop: 'status', label: '账号状态', align: 'center', formart: v => v === 1 ? '已激活' : '未激活'} |  | ||||||
|       ], |  | ||||||
|       defaultProps: { |  | ||||||
|         children: 'children', |  | ||||||
|         label: 'name' |  | ||||||
|       }, |  | ||||||
|       unitName: '', |  | ||||||
|       rootId: '', |  | ||||||
|       unitList: [], |  | ||||||
|       tagsList: [], |  | ||||||
|       tagName: '', |  | ||||||
|       sourceTagList: [], |  | ||||||
|       tableData: [], |  | ||||||
|       tagId: '', |  | ||||||
|       departmentName: '', |  | ||||||
|       departId: '', |  | ||||||
|       ids: '' |  | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
| @@ -132,154 +108,11 @@ export default { | |||||||
|     ...mapState(['user']) |     ...mapState(['user']) | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   watch: { |  | ||||||
|     unitName(val) { |  | ||||||
|       this.$refs.tree.filter(val) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     tagName(val) { |  | ||||||
|       if (!val) { |  | ||||||
|         this.tagsList = this.sourceTagList |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       this.tagsList = this.sourceTagList.filter(v => v.tagname.indexOf(val) > -1) |  | ||||||
|     } |  | ||||||
|   }, |  | ||||||
|  |  | ||||||
|   created() { |   created() { | ||||||
|     this.getTree() |  | ||||||
|     this.getList() |     this.getList() | ||||||
|     this.getTags() |  | ||||||
|     document.querySelector('html').addEventListener('click', this.bindEvent) |  | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   methods: { |   methods: { | ||||||
|     changeTag(index) { |  | ||||||
|       this.currIndex = index |  | ||||||
|       this.search.current = 1 |  | ||||||
|       this.$nextTick(() => { |  | ||||||
|         this.getList() |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     bindEvent() { |  | ||||||
|       this.isShowMenu = false |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     nodeContextmenu(e, node) { |  | ||||||
|       this.isShowMenu = true |  | ||||||
|       this.menuInfo = { |  | ||||||
|         x: e.x + 16, |  | ||||||
|         y: e.y + 6, |  | ||||||
|         node |  | ||||||
|       } |  | ||||||
|     }, |  | ||||||
|     removeTags(id) { |  | ||||||
|       if (this.currIndex < 0) { |  | ||||||
|         return this.$message.error('请选择标签') |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       this.$confirm('确定移除该成员?').then(() => { |  | ||||||
|         this.instance.post(`/app/wxcp/wxtag/removeTag?userIds=${id}&tagId=${this.tagsList[this.currIndex].id}`).then(res => { |  | ||||||
|           if (res.code == 0) { |  | ||||||
|             this.$message.success('移除成功!') |  | ||||||
|             this.search.current = 1 |  | ||||||
|  |  | ||||||
|             this.getList() |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     onDepartment(e) { |  | ||||||
|       if (!e.length) { |  | ||||||
|         return this.$message.error('请选择部门') |  | ||||||
|       } |  | ||||||
|       const ids = e.map(v => v.id).join(',') |  | ||||||
|  |  | ||||||
|       this.department = [] |  | ||||||
|       this.instance.post(`/app/wxcp/wxuser/export?departmentId=${ids}`, null, { |  | ||||||
|         responseType: 'blob' |  | ||||||
|       }).then(res => { |  | ||||||
|         if (res?.type == "application/json") { |  | ||||||
|           let reader = new FileReader() |  | ||||||
|           reader.readAsText(res, "utf-8") |  | ||||||
|           reader.onload = e => { |  | ||||||
|             if (e.target.readyState === 2) { |  | ||||||
|               let ret = JSON.parse(e.target.result) |  | ||||||
|               if (ret?.code == 0) { |  | ||||||
|                 this.$message.success(ret.msg) |  | ||||||
|               } else this.$message.error(ret.msg) |  | ||||||
|             } |  | ||||||
|           } |  | ||||||
|         } else { |  | ||||||
|           const link = document.createElement('a') |  | ||||||
|           let blob = new Blob([res], {type: res.type}) |  | ||||||
|           link.style.display = 'none' |  | ||||||
|           link.href = URL.createObjectURL(blob) |  | ||||||
|           link.setAttribute('download', `${e[0].name}.xls`) |  | ||||||
|           document.body.appendChild(link) |  | ||||||
|           link.click() |  | ||||||
|           document.body.removeChild(link) |  | ||||||
|           this.$message.success('导出成功!') |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     onChooseUser(e) { |  | ||||||
|       if (!e.length) { |  | ||||||
|         return this.$message.error('请选择成员') |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       this.instance.post(`/app/wxcp/wxtag/markTag`, null, { |  | ||||||
|         params: { |  | ||||||
|           tagId: this.tagsList[this.currIndex].id, |  | ||||||
|           userIds: e.map(v => v.id).join(',') |  | ||||||
|         } |  | ||||||
|       }).then(res => { |  | ||||||
|         if (res.code == 0) { |  | ||||||
|           this.getList() |  | ||||||
|           this.users = [] |  | ||||||
|           this.search.current = 1 |  | ||||||
|           this.$refs.addTags.reset() |  | ||||||
|         } else { |  | ||||||
|           this.users = [] |  | ||||||
|         } |  | ||||||
|       }).catch(() => { |  | ||||||
|         this.users = [] |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     handleTreeCommand(e, item) { |  | ||||||
|       this.isShowMenu = false |  | ||||||
|  |  | ||||||
|       if (e === 'add') { |  | ||||||
|         this.departForm.parentid = item.id |  | ||||||
|         this.departId = '' |  | ||||||
|         this.isShowDepart = true |  | ||||||
|       } else if (e === 'edit') { |  | ||||||
|         this.departForm = { |  | ||||||
|           ...item |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         this.departId = item.id |  | ||||||
|         this.isShowDepart = true |  | ||||||
|       } else if (e === 'top') { |  | ||||||
|         if (!item.i) { |  | ||||||
|           return false |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         this.moveDepart(item.id, 0) |  | ||||||
|       } else if (e === 'bottom') { |  | ||||||
|         if ((item.i === item.len - 1) || (!item.i && item.i !== 0)) { |  | ||||||
|           return false |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         this.moveDepart(item.id, 1) |  | ||||||
|       } else if (e === 'remove') { |  | ||||||
|         this.removeDepart(item.id, item.parentid) |  | ||||||
|       } |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     removeDepart(id, parentid) { |     removeDepart(id, parentid) { | ||||||
|       this.$confirm('确定删除该数据?').then(() => { |       this.$confirm('确定删除该数据?').then(() => { | ||||||
|         this.instance.post(`/app/wxcp/wxdepartment/delete?id=${id}`).then(res => { |         this.instance.post(`/app/wxcp/wxdepartment/delete?id=${id}`).then(res => { | ||||||
| @@ -292,145 +125,12 @@ export default { | |||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     moveDepart(id, type) { |  | ||||||
|       this.instance.post(`/app/wxcp/wxdepartment/move?id=${id}&type=${type}`).then(res => { |  | ||||||
|         if (res.code == 0) { |  | ||||||
|           this.defaultChecked = [id] |  | ||||||
|           this.getTree() |  | ||||||
|           this.$message.success(type === 0 ? '上移成功' : '下移成功') |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     onDepartConfirm() { |  | ||||||
|       this.$refs.departForm.validate((valid) => { |  | ||||||
|         if (valid) { |  | ||||||
|           this.instance.post(`/app/wxcp/wxdepartment/addOrUpdate`, { |  | ||||||
|             ...this.departForm, |  | ||||||
|             departId: this.departId |  | ||||||
|           }).then(res => { |  | ||||||
|             if (res.code == 0) { |  | ||||||
|               this.defaultChecked = [this.departForm.parentid] |  | ||||||
|               this.isShowDepart = false |  | ||||||
|               this.getTree() |  | ||||||
|               this.$message.success(this.departId ? '编辑成功' : '新增成功') |  | ||||||
|             } |  | ||||||
|           }) |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     onFormConfirm() { |  | ||||||
|       this.$refs.tagForm.validate((valid) => { |  | ||||||
|         if (valid) { |  | ||||||
|           this.instance.post(`/app/wxcp/wxtag/addOrUpdate`, { |  | ||||||
|             ...this.tagForm |  | ||||||
|           }).then(res => { |  | ||||||
|             if (res.code == 0) { |  | ||||||
|               this.isShowTags = false |  | ||||||
|               this.getTags() |  | ||||||
|               this.$message.success(this.tagId ? '编辑成功' : '新增成功') |  | ||||||
|             } |  | ||||||
|           }) |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     handleCommand(e, item) { |  | ||||||
|       if (e === 'edit') { |  | ||||||
|         this.tagId = item.id |  | ||||||
|         this.tagForm = { |  | ||||||
|           ...item |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         this.isShowTags = true |  | ||||||
|       } else { |  | ||||||
|         this.$confirm('确定删除该数据?').then(() => { |  | ||||||
|           this.instance.post(`/app/wxcp/wxtag/delete?id=${item.id}`).then(res => { |  | ||||||
|             if (res.code == 0) { |  | ||||||
|               this.$message.success('删除成功!') |  | ||||||
|               this.getTags() |  | ||||||
|             } |  | ||||||
|           }) |  | ||||||
|         }) |  | ||||||
|       } |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     onClose() { |  | ||||||
|       this.tagId = '' |  | ||||||
|       this.tagForm.tagname = '' |  | ||||||
|       this.departForm.name = '' |  | ||||||
|       this.departId = '' |  | ||||||
|       this.departForm.nameEn = '' |  | ||||||
|       this.departForm.parentid = '' |  | ||||||
|       this.departForm.showIndex = '' |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     syncMembers() { |  | ||||||
|       if (!this.search.departmentId) { |  | ||||||
|         return this.$message.error('请选择部门') |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       this.btnLoading = true |  | ||||||
|  |  | ||||||
|       this.instance.post(`/app/wxcp/wxdepartment/syncDepart`).then(res => { |  | ||||||
|         if (res.code == 0) { |  | ||||||
|           this.instance.post(`/app/wxcp/wxdepartment/syncUser?departmentId=${this.search.departmentId}`, null, { |  | ||||||
|             timeout: 1000000 |  | ||||||
|           }).then(res => { |  | ||||||
|             if (res.code == 0) { |  | ||||||
|               this.$message.success('同步成功') |  | ||||||
|               this.getList() |  | ||||||
|               this.getTree() |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             this.btnLoading = false |  | ||||||
|           }).catch(() => { |  | ||||||
|             this.btnLoading = false |  | ||||||
|           }) |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|       }).catch(() => { |  | ||||||
|         this.btnLoading = false |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     getTags() { |  | ||||||
|       this.instance.post(`/app/wxcp/wxtag/listAll`).then(res => { |  | ||||||
|         if (res.code == 0) { |  | ||||||
|           this.sourceTagList = res.data.length ? JSON.parse(JSON.stringify(res.data)) : [] |  | ||||||
|           this.tagsList = res.data |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     onSwitchChange(id) { |  | ||||||
|       this.instance.post(`/app/wxcp/wxuser/enable?id=${id}`).then(res => { |  | ||||||
|         if (res.code == 0) { |  | ||||||
|           this.getList() |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     onTreeChange(e) { |  | ||||||
|       this.departmentName = e.name |  | ||||||
|       this.search.departmentId = e.id || '' |  | ||||||
|       this.search.current = 1 |  | ||||||
|       this.isShowMenu = false |  | ||||||
|  |  | ||||||
|       this.$nextTick(() => { |  | ||||||
|         this.getList() |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     getList() { |     getList() { | ||||||
|       this.loading = true |       this.loading = true | ||||||
|       this.instance.post(`/app/wxcp/wxuser/list`, null, { |       this.instance.post(`/app/wxcp/wxuser/list`, null, { | ||||||
|         params: { |         params: { | ||||||
|           ...this.search, |           ...this.search, | ||||||
|           departmentId: this.tabIndex === 0 ? this.search.departmentId : '', |           departmentId: this.tabIndex === 0 ? this.search.departmentId : '' | ||||||
|           tagIds: this.tabIndex === 1 ? (this.currIndex >= 0 ? this.tagsList[this.currIndex].id : '') : '', |  | ||||||
|           listType: this.tabIndex |  | ||||||
|         } |         } | ||||||
|       }).then(res => { |       }).then(res => { | ||||||
|         if (res.code == 0) { |         if (res.code == 0) { | ||||||
| @@ -449,94 +149,6 @@ export default { | |||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     removeAll() { |  | ||||||
|       if (!this.ids) return |  | ||||||
|  |  | ||||||
|       if (this.tabIndex === 1) { |  | ||||||
|         this.removeTags(this.ids) |  | ||||||
|       } else { |  | ||||||
|         this.remove(this.ids) |  | ||||||
|       } |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     handleSelectionChange(e) { |  | ||||||
|       this.ids = e.map(v => v.id).join(',') |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     filterNode(value, data) { |  | ||||||
|       if (!value) return true |  | ||||||
|       return data.name.indexOf(value) !== -1 |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     changeTab(id, index) { |  | ||||||
|       this.currIndex = index |  | ||||||
|       this.search.areaId = id |  | ||||||
|  |  | ||||||
|       this.$nextTick(() => { |  | ||||||
|         this.getList() |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     getTree() { |  | ||||||
|       let {unitName} = this |  | ||||||
|       this.instance.post(`/app/wxcp/wxdepartment/listAll`, null, { |  | ||||||
|         params: {unitName} |  | ||||||
|       }).then(res => { |  | ||||||
|         if (res?.data) { |  | ||||||
|           let parent = res.data.map(v => { |  | ||||||
|             v.label = v.name |  | ||||||
|             v.children = [] |  | ||||||
|             return v |  | ||||||
|           }).filter(e => !e.parentid)[0] |  | ||||||
|           this.defaultExpanded = [parent.id] |  | ||||||
|           this.defaultChecked = [parent.id] |  | ||||||
|           this.search.departmentId = parent.id |  | ||||||
|           this.departmentName = parent.name |  | ||||||
|           this.addChild(parent, res.data) |  | ||||||
|           this.unitList = [parent] |  | ||||||
|           this.$nextTick(() => { |  | ||||||
|             this.$refs.tree.setCurrentKey(parent.id) |  | ||||||
|           }) |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     addChild(parent, list) { |  | ||||||
|       for (let i = 0; i < list.length; i++) { |  | ||||||
|         if (list[i].parentid === parent.id) { |  | ||||||
|           list[i].i = parent.children.length |  | ||||||
|           parent.children.push(list[i]) |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       if (parent.children.length) { |  | ||||||
|         parent.children.forEach(v => { |  | ||||||
|           v.len = parent.children.length |  | ||||||
|         }) |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       if (list.length > 0) { |  | ||||||
|         parent['children'].map(v => this.addChild(v, list)) |  | ||||||
|       } |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     formatList(list) { |  | ||||||
|       var arr = [] |  | ||||||
|       for (let item of list) { |  | ||||||
|         if (item.childrenUser && item.childrenUser.length) { |  | ||||||
|           delete item.childrenUser |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (item.childrenDept && item.childrenDept.length) { |  | ||||||
|           this.formatList(item.childrenDept) |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         arr.push(item) |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       return arr |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     remove(id) { |     remove(id) { | ||||||
|       this.$confirm('确定删除该数据?').then(() => { |       this.$confirm('确定删除该数据?').then(() => { | ||||||
|         this.instance.post(`/app/wxcp/wxuser/delete?id=${id}`).then(res => { |         this.instance.post(`/app/wxcp/wxuser/delete?id=${id}`).then(res => { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user