|
@@ -1,12 +1,15 @@
|
|
|
<template>
|
|
|
<div class="app-container scroll-y">
|
|
|
<tableTemp
|
|
|
+ ref="domeTable"
|
|
|
:tableHeader="state.list"
|
|
|
:tableProperty="{ rowKey: 'ID' }"
|
|
|
:tableData="tableData"
|
|
|
:tableBtnGroup="tableBtnGroup"
|
|
|
+ :cellClass="cellClassName"
|
|
|
@btnClick="btnClick"
|
|
|
@load="loadMore"
|
|
|
+ @cellClass="test"
|
|
|
></tableTemp>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -14,177 +17,148 @@
|
|
|
<script setup lang="ts">
|
|
|
import tableTemp from "@/components/tableTemp/index.vue";
|
|
|
import { ref } from "vue";
|
|
|
-const props = defineProps({
|
|
|
- //单独的编辑新增
|
|
|
- tableBtnGroup: {
|
|
|
- type: Array,
|
|
|
- default: () => [
|
|
|
- {
|
|
|
- name: "编辑",
|
|
|
- className: "editBtn",
|
|
|
- param: 2,
|
|
|
- },
|
|
|
+import { test } from 'vitest';
|
|
|
+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: [
|
|
|
{
|
|
|
- name: "删除",
|
|
|
- className: "delBtn",
|
|
|
- param: 3,
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
+ rowClass: "warning-row",
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
- //列表
|
|
|
- tableData: {
|
|
|
- type: Array,
|
|
|
- default: () => [],
|
|
|
+ {
|
|
|
+ ID: 1,
|
|
|
+ NAME: "李四三",
|
|
|
+ score: "80",
|
|
|
},
|
|
|
- //表头
|
|
|
- state: {
|
|
|
- type: Object,
|
|
|
- default: () => [],
|
|
|
+ {
|
|
|
+ ID: 2,
|
|
|
+ NAME: "王麻子",
|
|
|
+ score: "50",
|
|
|
},
|
|
|
-});
|
|
|
-// 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",
|
|
|
-// },
|
|
|
-// ]);
|
|
|
-// if () {
|
|
|
+ {
|
|
|
+ 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 tableBtnGroup = ref([
|
|
|
+ {
|
|
|
+ name: "编辑",
|
|
|
+ className: "editBtn",
|
|
|
+ param: 2,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "删除",
|
|
|
+ className: "delBtn",
|
|
|
+ param: 3,
|
|
|
+ },
|
|
|
+]);
|
|
|
const emits = defineEmits(["editDialog", "eleDialog", "aloneDialog"]);
|
|
|
//编辑-删除
|
|
|
const btnClick = (row, index, param) => {
|
|
@@ -202,9 +176,23 @@ const btnClick = (row, index, param) => {
|
|
|
const loadMore = (type) => {
|
|
|
console.log(type);
|
|
|
};
|
|
|
+
|
|
|
+const domeTable =ref(null)
|
|
|
+const test = (row) => {
|
|
|
+ if(row.column.property==="score"&& row.row.score>80){
|
|
|
+ console.log(domeTable.value)
|
|
|
+ domeTable.value.cellClass ="warn"
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ domeTable.value.cellClass =""
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
+::v-deep.el-table .warn {
|
|
|
+ background: #dfb21c !important;
|
|
|
+}
|
|
|
::v-deep.el-table .scoreColumn {
|
|
|
background: #eb2f3b !important;
|
|
|
}
|