NewLife/NewLife.CubeVue

对接新接口,修改错误的地方
笑笑 authored at 2023-04-06 23:48:46 笑笑 committed at 2023-04-08 20:00:48
938e161
Tree
1 Parent(s) 53fc4bc
Summary: 5 changed files with 72 additions and 81 deletions.
Modified +1 -1
Modified +3 -2
Modified +64 -63
Modified +3 -14
Modified +1 -1
Modified +1 -1
diff --git a/demo/src/views/School/Student/list.vue b/demo/src/views/School/Student/list.vue
index b97d9d7..e3cd2f1 100644
--- a/demo/src/views/School/Student/list.vue
+++ b/demo/src/views/School/Student/list.vue
@@ -242,7 +242,7 @@ export default {
       vm.$api.getDataList(vm.currentPath, vm.queryData).then((res) => {
         vm.listLoading = false;
         vm.tabledata = res.data;
-        vm.page = res.pager;
+        vm.page = res.page;
       });
     },
     currentchange(val) {
Modified +3 -2
diff --git a/src/main.ts b/src/main.ts
index 93ca338..0a8c00e 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -13,7 +13,8 @@ app.use(cubeUI);
 
 const store = app.config.globalProperties.$store;
 
-// store.dispatch('setUrls', { baseUrl: 'http://localhost:5000' })
-store.dispatch('setUrls', { baseUrl: 'https://cube.newlifex.com' });
+// store.dispatch('setUrls', { baseUrl: 'http://localhost:5000' });
+// store.dispatch('setUrls', { baseUrl: '' });
+store.dispatch('setUrls', { baseUrl: 'https://cube3.newlifex.com' });
 
 app.mount('#app');
Modified +64 -63
diff --git a/src/views/Admin/Menu/form.vue b/src/views/Admin/Menu/form.vue
index 4d75e7d..5c083cf 100644
--- a/src/views/Admin/Menu/form.vue
+++ b/src/views/Admin/Menu/form.vue
@@ -45,7 +45,14 @@
 
       <el-form-item v-if="!isDetail">
         <div
-          style="position: fixed; margin:20px; float:right; bottom: 0px; right: 0px; z-index: 1;"
+          style="
+            position: fixed;
+            margin: 20px;
+            float: right;
+            bottom: 0px;
+            right: 0px;
+            z-index: 1;
+          "
         >
           <el-button @click="returnIndex">取消</el-button>
           <el-button type="primary" @click="confirm">保存</el-button>
@@ -56,7 +63,7 @@
 </template>
 
 <script lang="ts">
-import { defineComponent } from 'vue'
+import { defineComponent } from 'vue';
 export default defineComponent({
   data() {
     return {
@@ -67,142 +74,142 @@ export default defineComponent({
           name: 'id',
           displayName: '编号',
           dataType: 'Int32',
-          description: '编号'
+          description: '编号',
         },
         {
           name: 'name',
           displayName: '名称',
           dataType: 'String',
           length: 50,
-          description: '名称'
+          description: '名称',
         },
         {
           name: 'displayName',
           displayName: '显示名',
           dataType: 'String',
           length: 50,
-          description: '显示名'
+          description: '显示名',
         },
         {
           name: 'fullName',
           displayName: '全名',
           dataType: 'String',
           length: 200,
-          description: '全名'
+          description: '全名',
         },
         {
           name: 'parentID',
           displayName: '父编号',
           dataType: 'Int32',
-          description: '父编号'
+          description: '父编号',
         },
         {
           name: 'url',
           displayName: '链接',
           dataType: 'String',
           length: 200,
-          description: '链接'
+          description: '链接',
         },
         {
           name: 'sort',
           displayName: '排序',
           dataType: 'Int32',
-          description: '排序'
+          description: '排序',
         },
         {
           name: 'icon',
           displayName: '图标',
           dataType: 'String',
           length: 50,
-          description: '图标'
+          description: '图标',
         },
         {
           name: 'visible',
           displayName: '可见',
           dataType: 'Boolean',
-          description: '可见'
+          description: '可见',
         },
         {
           name: 'necessary',
           displayName: '必要',
           dataType: 'Boolean',
           description:
-            '必要。必要的菜单,必须至少有角色拥有这些权限,如果没有则自动授权给系统角色'
+            '必要。必要的菜单,必须至少有角色拥有这些权限,如果没有则自动授权给系统角色',
         },
         {
           name: 'permission',
           displayName: '权限子项',
           dataType: 'String',
           length: 200,
-          description: '权限子项。逗号分隔,每个权限子项名值竖线分隔'
+          description: '权限子项。逗号分隔,每个权限子项名值竖线分隔',
         },
         {
           name: 'ex1',
           displayName: '扩展1',
           dataType: 'Int32',
-          description: '扩展1'
+          description: '扩展1',
         },
         {
           name: 'ex2',
           displayName: '扩展2',
           dataType: 'Int32',
-          description: '扩展2'
+          description: '扩展2',
         },
         {
           name: 'ex3',
           displayName: '扩展3',
           dataType: 'Double',
-          description: '扩展3'
+          description: '扩展3',
         },
         {
           name: 'ex4',
           displayName: '扩展4',
           dataType: 'String',
           length: 50,
-          description: '扩展4'
+          description: '扩展4',
         },
         {
           name: 'ex5',
           displayName: '扩展5',
           dataType: 'String',
           length: 50,
-          description: '扩展5'
+          description: '扩展5',
         },
         {
           name: 'ex6',
           displayName: '扩展6',
           dataType: 'String',
           length: 50,
-          description: '扩展6'
+          description: '扩展6',
         },
         {
           name: 'remark',
           displayName: '备注',
           dataType: 'String',
           length: 500,
-          description: '备注'
-        }
-      ] as any
-    }
+          description: '备注',
+        },
+      ] as any,
+    };
   },
   computed: {
     id() {
-      return this.$route.params.id
+      return this.$route.params.id;
     },
     currentPath() {
-      let vm = this as any
-      let rplStr = `/${vm.type}${vm.id === undefined ? '' : '/' + vm.id}`
-      return this.$route.path.replace(rplStr, '')
+      let vm = this as any;
+      let rplStr = `/${vm.type}${vm.id === undefined ? '' : '/' + vm.id}`;
+      return this.$route.path.replace(rplStr, '');
     },
     type(): any {
-      return this.$route.params.type
+      return this.$route.params.type;
     },
     isAdd() {
-      return (this as any).type === 'Add'
+      return (this as any).type === 'Add';
     },
     isDetail() {
-      return (this as any).type === 'Detail'
-    }
+      return (this as any).type === 'Detail';
+    },
   },
   // watch: {
   //   $route: {
@@ -213,64 +220,58 @@ export default defineComponent({
   //   }
   // },
   created() {
-    this.init()
+    this.init();
   },
   activated() {
-    this.init()
+    this.init();
   },
   methods: {
     init() {
       // this.getFields()
       // this.getColumns()
       if (!this.isAdd) {
-        this.query()
+        this.query();
       }
     },
-    getColumns() {
-      // TODO 可改造成vue的属性,自动根据路由获取对应的列信息
-      let vm = this
-      let path = vm.currentPath
-      vm.$api.base.getColumns(path).then((res) => {
-        vm.fields = res.data
-      })
-    },
+    // getColumns() {
+    //   // TODO 可改造成vue的属性,自动根据路由获取对应的列信息
+    //   let vm = this
+    //   let path = vm.currentPath
+    //   vm.$api.base.getColumns(path).then((res) => {
+    //     vm.fields = res.data
+    //   })
+    // },
     query() {
-      let vm = this
-      if (vm.isDetail) {
-        vm.$api.base.getDetailData(vm.currentPath, vm.id).then((res) => {
-          vm.form = res.data
-        })
-      } else {
-        vm.$api.base.getData(vm.currentPath, vm.id).then((res) => {
-          vm.form = res.data
-        })
-      }
+      let vm = this;
+      vm.$api.base.getDetailData(vm.currentPath, vm.id).then((res) => {
+        vm.form = res.data;
+      });
     },
     confirm() {
-      let vm = this
+      let vm = this;
       if (vm.isAdd) {
         vm.$api.base.add(vm.currentPath, vm.form).then(() => {
           vm.$message({
             message: '新增成功',
             type: 'success',
-            duration: 5 * 1000
-          })
-        })
+            duration: 5 * 1000,
+          });
+        });
       } else {
         vm.$api.base.edit(vm.currentPath, vm.form).then(() => {
           vm.$message({
             message: '保存成功',
             type: 'success',
-            duration: 5 * 1000
-          })
-        })
+            duration: 5 * 1000,
+          });
+        });
       }
     },
     returnIndex() {
-      this.$router.push(this.currentPath)
-    }
-  }
-})
+      this.$router.push(this.currentPath);
+    },
+  },
+});
 </script>
 
 <style scoped>
Modified +3 -14
diff --git a/src/views/Admin/Menu/list.vue b/src/views/Admin/Menu/list.vue
index 5ebbe2f..887ac60 100644
--- a/src/views/Admin/Menu/list.vue
+++ b/src/views/Admin/Menu/list.vue
@@ -20,7 +20,7 @@
         @row-dblclick="rowDblclick"
         :tree-props="{
           children: 'children',
-          hasChildren: 'hasChildren'
+          hasChildren: 'hasChildren',
         }"
         row-key="id"
         default-expand-all
@@ -65,7 +65,7 @@
             <el-button
               v-if="
                 !hasPermission(permissionFlags.update) &&
-                  hasPermission(permissionFlags.detail)
+                hasPermission(permissionFlags.detail)
               "
               type="primary"
               size="small"
@@ -93,17 +93,6 @@
         </el-table-column>
       </el-table>
     </div>
-    <!-- <div>
-      <el-pagination
-        :current-page="page.pageIndex"
-        :page-size="page.pageSize"
-        :page-sizes="[10, 20, 50, 100]"
-        :total="page.totalCount"
-        @current-change="currentChange"
-        @size-change="handleSizeChange"
-        layout="total, sizes, prev, pager, next, jumper"
-      ></el-pagination>
-    </div> -->
   </div>
 </template>
 <script lang="ts">
@@ -220,7 +209,7 @@ export default defineComponent({
         const tableData = vm.getTreeData(res.data);
         // console.log(tableData)
         vm.tableData = tableData;
-        vm.page = (res as any).pager;
+        vm.page = (res as any).page;
         vm.page.totalCount = parseInt(vm.page.totalCount);
         vm.setTableHeight(vm.tableData.length);
       });
Modified +1 -1
diff --git a/src/views/Admin/Role/form.vue b/src/views/Admin/Role/form.vue
index ebded07..a714357 100644
--- a/src/views/Admin/Role/form.vue
+++ b/src/views/Admin/Role/form.vue
@@ -246,7 +246,7 @@ export default defineComponent({
     },
     query() {
       const vm = this;
-      vm.$api.base.getData(vm.currentPath, vm.id).then((res: any) => {
+      vm.$api.base.getDetailData(vm.currentPath, vm.id).then((res: any) => {
         vm.form = res.data;
         vm.allCheckUpdate();
       });