guoyuji
2024-05-08 57e2cc7c1b6d2d5f5e633f836b7be29feed73f7d
north-glass-erp/northglass-erp/src/views/system/role/RoleList.vue
@@ -55,6 +55,10 @@
    buttons: [
    ],
    slots:{
      buttons: "role_add"
    },
    zoom: true,
    custom: true
  },
@@ -212,6 +216,28 @@
  })
}
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>
@@ -222,6 +248,15 @@
        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">