| | |
| | | buttons: [ |
| | | |
| | | ], |
| | | slots:{ |
| | | buttons: "role_add" |
| | | |
| | | }, |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | |
| | | }) |
| | | } |
| | | |
| | | const addRole = () =>{ |
| | | ElMessageBox.prompt('请输入新角色', '新增角色', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | inputPattern:/^.{1,255}$/, |
| | | inputErrorMessage: '不能为空且长度不能超过255', |
| | | }) |
| | | .then(({ value }) => { |
| | | const role= { |
| | | role: value |
| | | } |
| | | request.post("/role/add",role).then(res=>{ |
| | | if(res.code==='200' && res.data===true){ |
| | | ElMessage.success('新增成功') |
| | | router.push({path:'/main/role/roleList',query:{random:Math.random()}}) |
| | | }else{ |
| | | ElMessage.error('新增失败') |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | > |
| | | <template #role_add> |
| | | <vxe-button |
| | | @click="addRole" |
| | | status='primary' |
| | | style="margin-right: 1rem" |
| | | >角色新增</vxe-button> |
| | | </template> |
| | | |
| | | |
| | | <template #filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |