From 2210c590f886d75bc760fa08caa18dd0181026b5 Mon Sep 17 00:00:00 2001
From: fujunling <2984387807@qq.com>
Date: 星期四, 01 六月 2023 18:48:08 +0800
Subject: [PATCH] 动态表单分组

---
 Source/UBCS-WEB/src/components/Crud/Crud.vue |  125 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 123 insertions(+), 2 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Crud/Crud.vue b/Source/UBCS-WEB/src/components/Crud/Crud.vue
index 30b5efe..4e4eda7 100644
--- a/Source/UBCS-WEB/src/components/Crud/Crud.vue
+++ b/Source/UBCS-WEB/src/components/Crud/Crud.vue
@@ -1,14 +1,135 @@
 <template>
-  <avue-crud :data="data" ></avue-crud>
+<basic-container>
+  <avue-crud ref="crud"
+             :data="data"
+             :option="option"
+             @sort-change="sortChange"
+             v-loading="loading"
+             :page="page"
+             @selection-change="selectionChange"
+             @on-load="onLoad">
+      <template slot="menu">
+        <el-button type="text">鏂囧瓧鎸夐挳</el-button>
+      </template>
+  </avue-crud>
+</basic-container>
 </template>
 
 <script>
+import { MasterTable,TableData } from "@/api/GetItem";
 export default {
   name: "Crud.vue",
   data(){
     return{
+      loading:false,
       data:[],
-      option:{}
+      option:{
+        //榛樿楂樺害,
+        align:'center',
+        menuAlign:'center',
+        addBtn:false,
+        editBtn:false,
+        selection:true,
+        selectionFixed:false,
+        index:true,
+        column:[]
+      },
+      List:[],
+      columnType: {
+        text: "input",
+        combox: "select",
+        truefalse: "switch",
+        number: "number",
+        datetime:"datetime",
+      },
+      page:{
+        total: 0,
+        currentPage: 1,
+        pageSize: 10,
+        pageSizes: [10, 30, 50, 100, 200],
+      },
+    }
+  },
+  created() {
+      this.CrudHeaderRend();
+      this.CrudRend()
+  },
+  activated() {
+    this.doLayout()
+  },
+  methods:{
+    doLayout() {
+      this.$nextTick(() => {
+        this.$refs.crud.doLayout();
+      });
+    },
+    //琛ㄦ牸澶存覆鏌�
+    CrudHeaderRend(){
+      MasterTable({codeClassifyOid:"D9CF223F-317D-71EB-BD11-433A94CAD9F3",functionId: 5,_: 1685067339479}).then(res=>{
+        this.List=res.data.tableDefineVO.cols[0];
+        this.List.forEach(item=>{
+          let columnItem={
+            label:item.title,
+            prop:item.field,
+            type:this.columnType[item.type],
+            sortable:item.sort,
+            width:item.minWidth
+          };
+          this.option.column.push(columnItem);
+
+        })
+      })
+    },
+    //琛ㄦ牸鏁版嵁
+    CrudRend(){
+      TableData({templateOid: "A12826E4-2B66-6D56-DE30-92BB1D7F607F",
+        codeClassifyOid: "D9CF223F-317D-71EB-BD11-433A94CAD9F3",
+        page: this.page.currentPage,
+        limit: this.page.pageSize,
+        _: 1685089123575
+      }).then(res=>{
+        this.page.total=res.data.total;
+        this.data=res.data.data;
+      })
+    },
+    // 鎺掑簭
+    sortChange(val){
+      this.loading=true;
+      let order=""
+      if(val.order == "ascending"){
+        order="asc";
+      }else {
+        order="desc";
+      }
+      TableData(  {
+        templateOid: "A12826E4-2B66-6D56-DE30-92BB1D7F607F",
+        codeClassifyOid: "D9CF223F-317D-71EB-BD11-433A94CAD9F3",
+        order:order,
+        sort:val.prop,
+        page: this.page.currentPage,
+        limit: this.page.pageSize,
+      }).then(res=>{
+        setTimeout(() => {
+          this.data=res.data.data;
+          this.loading=false;
+        }, 100);
+      })
+    },
+    //鍒嗛〉鍒锋柊
+    async onLoad(val){
+      console.log(val)
+     await TableData({templateOid: "A12826E4-2B66-6D56-DE30-92BB1D7F607F",
+        codeClassifyOid: "D9CF223F-317D-71EB-BD11-433A94CAD9F3",
+        page: val.currentPage,
+        limit: val.pageSize,
+        _: 1685089123575
+      }).then(res=>{
+       this.data=res.data.data;
+      })
+    },
+    //澶氶��
+    selectionChange(row){
+      console.log(row)
     }
   }
 }

--
Gitblit v1.9.3