账号管理
This commit is contained in:
		| @@ -24,15 +24,30 @@ | ||||
|               <div>{{ row.name }}</div> | ||||
|             </el-row> | ||||
|           </el-table-column> | ||||
|           <el-table-column slot="options" align="center" label="操作" fixed="right" width="160px"> | ||||
|             <el-row type="flex" justify="center" align="middle" slot-scope="{row}"> | ||||
|               <el-button type="text" @click="appAllot(row)">功能分配</el-button> | ||||
|               <el-button type="text" @click="handleDelete(row.id)">删除</el-button> | ||||
|             </el-row> | ||||
|           <el-table-column slot="options" align="center" label="操作" fixed="right" width="180px"> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <div class="table-options"> | ||||
|                 <el-button type="text" @click="appAllot(row)">功能分配</el-button> | ||||
|                 <el-button type="text" @click="chooseWechat(row.id)">公众号</el-button> | ||||
|                 <el-button type="text" @click="handleDelete(row.id)">删除</el-button> | ||||
|               </div> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
|         </ai-table> | ||||
|       </template> | ||||
|     </ai-list> | ||||
|     <ai-dialog | ||||
|       :visible.sync="isShow" | ||||
|       width="690px" | ||||
|       title="公众号配置" | ||||
|       @close="onClose" | ||||
|       @onConfirm="onConfirm"> | ||||
|       <el-form ref="form" class="ai-form" :model="form" label-width="90px" label-position="right"> | ||||
|         <el-form-item label="公众号" style="width: 100%" prop="appids" :rules="[{required: true, message: '请选择公众号', trigger: 'change'}]"> | ||||
|           <ai-select :selectList="wechatList" multiple placeholder="请选择公众号" v-model="form.appids"></ai-select> | ||||
|         </el-form-item> | ||||
|       </el-form> | ||||
|     </ai-dialog> | ||||
|     <!--添加账号、功能分配--> | ||||
|     <ai-dialog :title="dialogTitle" :visible.sync="dialog" width="600px" @open="initDialogData" | ||||
|                @onConfirm="updateAccount" @closed="dialogForm={}"> | ||||
| @@ -46,15 +61,18 @@ | ||||
|           <el-input v-model.trim="dialogForm.phone" placeholder="请输入..." clearable | ||||
|                     :maxLength="11" :disabled="isEdit"/> | ||||
|         </el-form-item> | ||||
|         <el-form-item required label="账号密码" prop="password" v-if="!isEdit" :rules="[{required: true, message: '请输入密码'}]"> | ||||
|           <el-input v-model.trim="dialogForm.password" placeholder="请输入密码" clearable :minlength="6" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item required label="所属单位" prop="unitName" :rules="[{required: true, message: '请输入所属单位'}]"> | ||||
|           <el-input v-model.trim="dialogForm.unitName" placeholder="请输入所属单位" clearable /> | ||||
|         </el-form-item> | ||||
|         <el-form-item required label="角色" prop="roleId"> | ||||
|           <el-select size="small" placeholder="请选择角色" :value="dialogForm.roleId" filterable | ||||
|                      v-model="dialogForm.roleId" clearable> | ||||
|             <el-option v-for="(op,i) in accountRoles" :key="i" :label="op.name" :value="op.id"/> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="行政地区" prop="areaId"> | ||||
|           <ai-area-get v-model="dialogForm.areaId" :instance="instance" @select="handleAreaSelect"/> | ||||
|         </el-form-item> | ||||
|       </el-form> | ||||
|     </ai-dialog> | ||||
|   </section> | ||||
| @@ -90,18 +108,17 @@ export default { | ||||
|       return [ | ||||
|         // {type: 'selection', align: 'center'}, | ||||
|         {label: "姓名", slot: "name"}, | ||||
|         {label: "联系方式", prop: "phone", align: 'center'}, | ||||
|         {label: "手机号", prop: "phone", align: 'center'}, | ||||
|         {label: "所属单位", prop: "unitName", align: 'center'}, | ||||
|         {label: "角色", prop: "roleName", align: 'center'}, | ||||
|         {label: "地区", prop: "areaName"}, | ||||
|         {slot: "options"} | ||||
|       ] | ||||
|     }, | ||||
|     rules() { | ||||
|       return { | ||||
|         name: [{required: true, message: "请填写姓名"}], | ||||
|         // organizationId: [{required: true, message: "请选择党组织"}], | ||||
|         // unitId: [{required: true, message: "请选择单位"}], | ||||
|         // areaId: [{required: true, message: '请选择地区', trigger: 'change'}], | ||||
|         password:[{required: true, message: '请输入密码'}], | ||||
|         unitName: [{required: true, message: "请选择所属单位"}], | ||||
|         roleId: [{required: true, message: "请选择角色"}], | ||||
|         phone: [{required: true, message: "请输入手机号码"}] | ||||
|       } | ||||
| @@ -118,7 +135,13 @@ export default { | ||||
|       dialogForm: {}, | ||||
|       tableData: [], | ||||
|       search: {condition: ""}, | ||||
|       ids: [] | ||||
|       ids: [], | ||||
|       isShow: false, | ||||
|       form: { | ||||
|         appids: [], | ||||
|         userId: '' | ||||
|       }, | ||||
|       wechatList: [] | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
| @@ -132,6 +155,53 @@ export default { | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     chooseWechat (id) { | ||||
|       this.form.userId = id | ||||
|       this.instance.post(`/sysuserwxmp/list?size=1000&userId=${id}`).then(res => { | ||||
|         if (res.code == 0) { | ||||
|           this.form.appids = res.data.records.map(v => v.appId) | ||||
|         } | ||||
|       }) | ||||
|  | ||||
|       this.isShow = true | ||||
|     }, | ||||
|  | ||||
|     getWechatList () { | ||||
|       this.instance.post(`/wxmpconfig/list?size=1000`).then(res => { | ||||
|         if (res.code == 0) { | ||||
|           this.wechatList = res.data.records.map(v => { | ||||
|             return { | ||||
|               dictValue: v.appId, | ||||
|               dictName: v.mpName | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     onConfirm () { | ||||
|       this.$refs.form.validate((valid) => { | ||||
|         if (valid) { | ||||
|           this.instance.post(`/sysuserwxmp/addOrUpdate`, { | ||||
|             ...this.form | ||||
|           }).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('提交成功!') | ||||
|               this.isShow = false | ||||
|  | ||||
|               this.getList() | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     onClose () { | ||||
|       this.form.appids = [] | ||||
|       this.form.userId = '' | ||||
|       this.isShow = false | ||||
|     }, | ||||
|  | ||||
|     initDialogData() { | ||||
|       //用于优化初始化数据 | ||||
|       this.getAccountRoles() | ||||
| @@ -188,6 +258,7 @@ export default { | ||||
|   }, | ||||
|   created() { | ||||
|     this.getTableData() | ||||
|     this.getWechatList() | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user