|
@@ -1,152 +1,185 @@
|
|
|
<template>
|
|
|
<div class="app-container scroll-y">
|
|
|
- <tableTemp :tableHeader="state.list" :tableProperty="{rowKey:'ID'}" :tableData="tableData" :tableBtnGroup="tableBtnGroup" @btnClick="btnClick" @load="loadMore"></tableTemp>
|
|
|
+ <tableTemp
|
|
|
+ :tableHeader="state.list"
|
|
|
+ :tableProperty="{ rowKey: 'ID' }"
|
|
|
+ :tableData="tableData"
|
|
|
+ :tableBtnGroup="tableBtnGroup"
|
|
|
+ @btnClick="btnClick"
|
|
|
+ @load="loadMore"
|
|
|
+ ></tableTemp>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import tableTemp from "@/components/tableTemp/index.vue";
|
|
|
-import { ref } from 'vue';
|
|
|
+import { ref } from "vue";
|
|
|
|
|
|
const state = reactive({
|
|
|
- list: [{label:"序号",key:"ID",sortable:true},{label:"姓名",key:"NAME",},{label:"成绩",key:"score",sortable:true,lableClass:'scoreColumn'}],
|
|
|
- listLoading: true
|
|
|
-})
|
|
|
-const tableData = ref(
|
|
|
- [{
|
|
|
- ID:0,
|
|
|
- NAME:"张三",
|
|
|
- score:'100',
|
|
|
- children:[
|
|
|
- {
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- }
|
|
|
- ]
|
|
|
- },{
|
|
|
- ID:1,
|
|
|
- NAME:"李四三",
|
|
|
- score:'80'
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- },{
|
|
|
- ID:2,
|
|
|
- NAME:"王麻子",
|
|
|
- score:'50',
|
|
|
- rowClass:"warning-row"
|
|
|
- }])
|
|
|
-const tableBtnGroup = ref(
|
|
|
- [
|
|
|
- {
|
|
|
- name:"编辑",
|
|
|
- className:"editBtn",
|
|
|
- param:2
|
|
|
- },
|
|
|
- {
|
|
|
- name:"删除",
|
|
|
- className:"delBtn",
|
|
|
- param:3
|
|
|
- }
|
|
|
- ]
|
|
|
-)
|
|
|
+ list: [
|
|
|
+ { label: "序号", key: "ID", sortable: true },
|
|
|
+ { label: "姓名", key: "NAME" },
|
|
|
+ { label: "成绩", key: "score", sortable: true, lableClass: "scoreColumn" },
|
|
|
+ ],
|
|
|
+ listLoading: true,
|
|
|
+});
|
|
|
+const tableData = ref([
|
|
|
+ {
|
|
|
+ ID: 0,
|
|
|
+ NAME: "张三",
|
|
|
+ score: "100",
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 1,
|
|
|
+ NAME: "李四三",
|
|
|
+ score: "80",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
+ },
|
|
|
+]);
|
|
|
+const tableBtnGroup = ref([
|
|
|
+ {
|
|
|
+ name: "编辑",
|
|
|
+ className: "editBtn",
|
|
|
+ param: 2,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "删除",
|
|
|
+ className: "delBtn",
|
|
|
+ param: 3,
|
|
|
+ },
|
|
|
+]);
|
|
|
+const emits = defineEmits(["editDialog", "eleDialog"]);
|
|
|
+//编辑-删除
|
|
|
+const btnClick = (row, index, param) => {
|
|
|
+ if (param === 2) {
|
|
|
+ emits("editDialog");
|
|
|
+ } else if (param === 3) {
|
|
|
+ emits("eleDialog");
|
|
|
+ }
|
|
|
+ console.log(row);
|
|
|
+ console.log(index);
|
|
|
+};
|
|
|
|
|
|
-const btnClick = (row,index)=>{
|
|
|
- console.log(row)
|
|
|
- console.log(index)
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-const loadMore = (type)=>{
|
|
|
- console.log(type)
|
|
|
-}
|
|
|
+const loadMore = (type) => {
|
|
|
+ console.log(type);
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
::v-deep.el-table .scoreColumn {
|
|
|
- background: #EB2F3B!important;
|
|
|
+ background: #eb2f3b !important;
|
|
|
}
|
|
|
::v-deep.el-table .warning-row {
|
|
|
- background-color: #EB2F3B!important;
|
|
|
+ background-color: #eb2f3b !important;
|
|
|
}
|
|
|
::v-deep.el-table .success-row {
|
|
|
- --el-table-tr-bg-color: var(--el-color-success-light-9)
|
|
|
+ --el-table-tr-bg-color: var(--el-color-success-light-9);
|
|
|
}
|
|
|
</style>
|