duy 1 年間 前
コミット
54c6bc134b
2 ファイル変更19 行追加57 行削除
  1. 15 53
      src/views/system/role.vue
  2. 4 4
      src/views/system/user.vue

+ 15 - 53
src/views/system/role.vue

@@ -54,7 +54,7 @@
         <el-tree
             ref="treeRef"
             style="max-width: 600px"
-            :data="data"
+            :data="roleTreedata"
             show-checkbox
             default-expand-all
             node-key="id"
@@ -67,7 +67,7 @@
    <script setup>
    import { onMounted, ref, watch } from 'vue'
    import { HcDelMsg } from 'hc-vue3-ui'
-   import { getList, getRoleTree, remove } from '~api/system/role.js'
+   import { getList, grantTree, remove } from '~api/system/role.js'
    import { arrToId, formValidate, getArrValue, getObjValue } from 'js-fast-way'
    onMounted(()=>{
       getTableData()
@@ -85,6 +85,7 @@
    const addModal = ref(false)
    const addClick = ()=>{
        addModal.value = true
+       getRoleTreedata()
    }
    const baseForm = ref({
     roleName:'' })
@@ -165,59 +166,20 @@ const removeRole = async (ids) => {
 
 const defaultProps = {
   children: 'children',
-  label: 'label',
+  label: 'title',
 }
 
-const data = [
-  {
-    id: 1,
-    label: 'Level one 1',
-    children: [
-      {
-        id: 4,
-        label: 'Level two 1-1',
-        children: [
-          {
-            id: 9,
-            label: 'Level three 1-1-1',
-          },
-          {
-            id: 10,
-            label: 'Level three 1-1-2',
-          },
-        ],
-      },
-    ],
-  },
-  {
-    id: 2,
-    label: 'Level one 2',
-    children: [
-      {
-        id: 5,
-        label: 'Level two 2-1',
-      },
-      {
-        id: 6,
-        label: 'Level two 2-2',
-      },
-    ],
-  },
-  {
-    id: 3,
-    label: 'Level one 3',
-    children: [
-      {
-        id: 7,
-        label: 'Level two 3-1',
-      },
-      {
-        id: 8,
-        label: 'Level two 3-2',
-      },
-    ],
-  },
-]
+const roleTreedata = ref([])
+const getRoleTreedata = async () => {
+    const { error, code, data } = await grantTree()
+    if (!error && code === 200) {
+      roleTreedata.value = getArrValue(data)
+    } else {
+      roleTreedata.value = []
+    }
+    
+  
+}
 </script>
 
  <style lang='scss' scoped>

+ 4 - 4
src/views/system/user.vue

@@ -47,8 +47,8 @@
                     <el-form-item label="登陆账户:" prop="account">
                         <el-input v-model="baseForm.account" clearable placeholder="请输入" />
                     </el-form-item>
-                    <el-form-item label="密码:" prop="password">
-                        <el-input v-model="baseForm.password" clearable placeholder="请输入" show-password type="password" />
+                    <el-form-item label="密码:" prop="passText">
+                        <el-input v-model="baseForm.passText" clearable placeholder="请输入" show-password type="password" />
                     </el-form-item>
                 </div>
                 <div class="hc-form-item">
@@ -98,14 +98,14 @@ const addClick = () => {
     addModal.value = true
     getRoleOptions()
 }
-const baseForm = ref({ account: '', realName: '', password: '', roleId: '' })
+const baseForm = ref({ account: '', realName: '', passText: '', roleId: '' })
 const baseFormRules = {
     account: {
         required: true,
         trigger: 'blur',
         message: '请输入登陆账户',
     },
-    password: {
+    passText: {
         required: true,
         trigger: 'blur',
         message: '请输入密码',