guhongwei před 5 roky
rodič
revize
2ce600360e
1 změnil soubory, kde provedl 15 přidání a 9 odebrání
  1. 15 9
      src/views/account/register.vue

+ 15 - 9
src/views/account/register.vue

@@ -26,9 +26,9 @@
         >
           <el-table-column label="姓名" width="180">
             <template v-slot="scope">
-              <tag type="success" v-if="scope.row.hasChildren">{{ scope.row.zhu }}</tag>
-              <tag type="warning">{{ scope.row.cong }}</tag>
-              <tag>{{ scope.row.name }} </tag>
+              <el-tag type="success" v-if="owner(scope.row.hasChildren)">主</el-tag>
+              <el-tag type="warning" v-else>从</el-tag>
+              {{ scope.row.name }}
             </template>
           </el-table-column>
           <el-table-column prop="address" label="地址"> </el-table-column>
@@ -107,21 +107,20 @@ export default {
         name: '王小虎',
         address: '上海市普陀区金沙江路 1518 弄',
         state: '0',
-        zhu: '主',
+        hasChildren: false,
       },
       {
         id: 2,
         name: '王小虎',
         address: '上海市普陀区金沙江路 1517 弄',
         state: '1',
-        zhu: '主',
+        hasChildren: false,
       },
       {
         id: 3,
         name: '王小虎',
         address: '上海市普陀区金沙江路 1519 弄',
         state: '0',
-        zhu: '主',
         hasChildren: true,
       },
       {
@@ -129,7 +128,7 @@ export default {
         name: '王小虎',
         address: '上海市普陀区金沙江路 1516 弄',
         state: '0',
-        zhu: '主',
+        hasChildren: false,
       },
     ],
     editForm: {
@@ -142,6 +141,15 @@ export default {
   created() {},
   computed: {},
   methods: {
+    owner(has) {
+      if (has === false) {
+        return true;
+      } else if (has === true) {
+        return true;
+      } else if (has === undefined) {
+        return false;
+      }
+    },
     load(tree, treeNode, resolve) {
       setTimeout(() => {
         resolve([
@@ -150,14 +158,12 @@ export default {
             name: '王小虎',
             address: '上海市普陀区金沙江路 1519 弄',
             state: '1',
-            cong: '从',
           },
           {
             id: 32,
             name: '王小虎',
             address: '上海市普陀区金沙江路 1519 弄',
             state: '0',
-            cong: '从',
           },
         ]);
       }, 1000);