From 4c3d21652873e2011b99d36388e86c3f9af1aa63 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期一, 29 五月 2023 17:53:42 +0800
Subject: [PATCH] 动态表格组件更新
---
Source/UBCS-WEB/src/components/Crud/Crud.vue | 100 +++++++++++++++++++++++++++++++++++--------------
Source/UBCS-WEB/src/api/GetItem.js | 3 +
Source/UBCS-WEB/vue.config.js | 4 +-
3 files changed, 75 insertions(+), 32 deletions(-)
diff --git a/Source/UBCS-WEB/src/api/GetItem.js b/Source/UBCS-WEB/src/api/GetItem.js
index e3b471f..91f6755 100644
--- a/Source/UBCS-WEB/src/api/GetItem.js
+++ b/Source/UBCS-WEB/src/api/GetItem.js
@@ -12,10 +12,11 @@
export const TableData =(params)=>{
return request({
- url: 'api/ubcs-code/ubcs-code//mdmEngineController/gridTableDataByClassifyOid',
+ url: 'api/ubcs-code/ubcs-code/mdmEngineController/gridTableDataByClassifyOid',
method: 'get',
params:{
...params
}
})
}
+
diff --git a/Source/UBCS-WEB/src/components/Crud/Crud.vue b/Source/UBCS-WEB/src/components/Crud/Crud.vue
index 90412c5..4e4eda7 100644
--- a/Source/UBCS-WEB/src/components/Crud/Crud.vue
+++ b/Source/UBCS-WEB/src/components/Crud/Crud.vue
@@ -1,6 +1,17 @@
<template>
-<basic-container style="height: 750px">
- <avue-crud ref="crud" :data="data" :option="option" style="height: 750px" @sort-change="sortChange"></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>
@@ -10,18 +21,17 @@
name: "Crud.vue",
data(){
return{
- data:[
- {
- zhiliangbz:"111",
- },
- {
- xinghaoguige:"1121",
- },
- ],
+ loading:false,
+ data:[],
option:{
//榛樿楂樺害,
align:'center',
menuAlign:'center',
+ addBtn:false,
+ editBtn:false,
+ selection:true,
+ selectionFixed:false,
+ index:true,
column:[]
},
List:[],
@@ -30,13 +40,19 @@
combox: "select",
truefalse: "switch",
number: "number",
- datetime: "datetime",
+ datetime:"datetime",
+ },
+ page:{
+ total: 0,
+ currentPage: 1,
+ pageSize: 10,
+ pageSizes: [10, 30, 50, 100, 200],
},
}
},
created() {
- this.CrudHeaderRend();
- this.CrudRend()
+ this.CrudHeaderRend();
+ this.CrudRend()
},
activated() {
this.doLayout()
@@ -47,11 +63,11 @@
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=>{
- console.log(item)
let columnItem={
label:item.title,
prop:item.field,
@@ -64,31 +80,57 @@
})
})
},
+ //琛ㄦ牸鏁版嵁
CrudRend(){
TableData({templateOid: "A12826E4-2B66-6D56-DE30-92BB1D7F607F",
codeClassifyOid: "D9CF223F-317D-71EB-BD11-433A94CAD9F3",
- page: 1,
- limit: 9,
+ page: this.page.currentPage,
+ limit: this.page.pageSize,
_: 1685089123575
}).then(res=>{
- console.log(res)
- this.data=res.data.data
+ this.page.total=res.data.total;
+ this.data=res.data.data;
})
},
// 鎺掑簭
sortChange(val){
- console.log(val)
-
- // TableData( {
- // templateOid: "A12826E4-2B66-6D56-DE30-92BB1D7F607F",
- // codeClassifyOid: "D9CF223F-317D-71EB-BD11-433A94CAD9F3",
- // order:"desc",
- // sort:val.prop
- // }).then(res=>{
- // console.log(res.data.data)
- // this.data=res.data.data
- // })
+ 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)
+ }
}
}
</script>
diff --git a/Source/UBCS-WEB/vue.config.js b/Source/UBCS-WEB/vue.config.js
index 3b94341..f2b7e3d 100644
--- a/Source/UBCS-WEB/vue.config.js
+++ b/Source/UBCS-WEB/vue.config.js
@@ -28,8 +28,8 @@
//鏈湴鏈嶅姟鎺ュ彛鍦板潃
// target: 'http://localhost:37000',
//target: 'http://192.168.3.7:37000',
- // target: 'http://dev.vci-tech.com:37000',
- target: 'http://192.168.1.51:37000/',
+ target: 'http://dev.vci-tech.com:37000',
+ // target: 'http://192.168.1.51:37000/',
//杩滅▼婕旂ず鏈嶅姟鍦板潃,鍙敤浜庣洿鎺ュ惎鍔ㄩ」鐩�
// target: 'https://saber.bladex.vip/api',
ws: true,
--
Gitblit v1.9.3