|
|
@@ -3,37 +3,19 @@
|
|
|
<Search :onClickSearch="async () => { }" :onClickReset="async () => { }" />
|
|
|
<div class="changeRecord-table">
|
|
|
<a-table :scroll="{ x: '100%', y: 500 }" :childrenColumnName="null" rowKey="device_sn"
|
|
|
- :loading="state.listLoading" :columns="columns" @change="() => { }" :rowClassName="rowClassName"
|
|
|
+ :loading="state.listLoading" :columns="columns" @change="refreshData" :rowClassName="rowClassName"
|
|
|
:dataSource="state.list" :pagination="paginationConfig">
|
|
|
<!-- 设备型号 -->
|
|
|
<template #device_name="{ record }">
|
|
|
- <div class="record">
|
|
|
- {{ record.device_name }}
|
|
|
- </div>
|
|
|
- <div class="record" v-if="record.children">
|
|
|
- <div class="mt-5 ml0"
|
|
|
- style="border-left: 2px solid rgb(200,200,200); border-bottom: 2px solid rgb(200,200,200); height: 16px;width: 16px; float: left;">
|
|
|
- </div>
|
|
|
- {{ record.children.device_name }}
|
|
|
- </div>
|
|
|
+ <CustomCell :record="record" fieldName="device_name" />
|
|
|
</template>
|
|
|
<!-- 设备SN -->
|
|
|
<template #device_sn="{ record }">
|
|
|
- <div class="record">
|
|
|
- {{ record.device_sn }}
|
|
|
- </div>
|
|
|
- <div class="record" v-if="record.children">
|
|
|
- {{ record.children.device_sn }}
|
|
|
- </div>
|
|
|
+ <CustomCell :record="record" fieldName="device_sn" />
|
|
|
</template>
|
|
|
<!-- 设备名称 -->
|
|
|
<template #nick_name="{ record }">
|
|
|
- <div class="record">
|
|
|
- {{ record.nick_name }}
|
|
|
- </div>
|
|
|
- <div class="record" v-if="record.children">
|
|
|
- {{ record.children.nick_name }}
|
|
|
- </div>
|
|
|
+ <CustomCell :record="record" fieldName="nick_name" />
|
|
|
</template>
|
|
|
</a-table>
|
|
|
</div>
|
|
|
@@ -43,20 +25,17 @@
|
|
|
<script lang="ts" setup>
|
|
|
import { reactive, onMounted } from 'vue';
|
|
|
import Search from './components/Search.vue';
|
|
|
+import CustomCell from './components/CustomCell.vue';
|
|
|
import { apis } from '/@/api/custom/index';
|
|
|
|
|
|
interface State {
|
|
|
listLoading: boolean,
|
|
|
list: any[],
|
|
|
- currentId: string,
|
|
|
- drawerVisible: boolean,
|
|
|
};
|
|
|
|
|
|
const state: State = reactive({
|
|
|
listLoading: false,
|
|
|
list: [],
|
|
|
- currentId: '',
|
|
|
- drawerVisible: false,
|
|
|
});
|
|
|
|
|
|
const paginationConfig = reactive({
|
|
|
@@ -68,7 +47,7 @@ const paginationConfig = reactive({
|
|
|
total: 0
|
|
|
})
|
|
|
|
|
|
-onMounted(async () => {
|
|
|
+const fetchList = async () => {
|
|
|
state.listLoading = true;
|
|
|
try {
|
|
|
const res = await apis.fetchChangeRecordList({ page: paginationConfig.current, page_size: paginationConfig.pageSize });
|
|
|
@@ -83,11 +62,15 @@ onMounted(async () => {
|
|
|
} finally {
|
|
|
state.listLoading = false;
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(async () => {
|
|
|
+ await fetchList();
|
|
|
})
|
|
|
|
|
|
const columns = [
|
|
|
{
|
|
|
- title: '时间',
|
|
|
+ title: '加入项目时间',
|
|
|
dataIndex: 'create_time',
|
|
|
width: 200,
|
|
|
sorter: (a: any, b: any) => a.create_time.localeCompare(b.create_time),
|
|
|
@@ -111,7 +94,6 @@ const columns = [
|
|
|
title: '变化描述',
|
|
|
dataIndex: 'log_info',
|
|
|
width: 150,
|
|
|
- sorter: (a: any, b: any) => a.log_info.localeCompare(b.log_info),
|
|
|
},
|
|
|
{
|
|
|
title: '设备型号',
|
|
|
@@ -130,7 +112,8 @@ const columns = [
|
|
|
title: '设备名称',
|
|
|
dataIndex: 'nick_name',
|
|
|
width: 150,
|
|
|
- slots: { customRender: 'nick_name' }
|
|
|
+ slots: { customRender: 'nick_name' },
|
|
|
+ sorter: (a: any, b: any) => a.nick_name.localeCompare(b.nick_name),
|
|
|
}
|
|
|
]
|
|
|
|
|
|
@@ -141,6 +124,12 @@ const rowClassName = (record: any, index: number) => {
|
|
|
}
|
|
|
return className.toString().replaceAll(',', ' ')
|
|
|
}
|
|
|
+
|
|
|
+const refreshData = async (page: any) => {
|
|
|
+ paginationConfig.current = page?.current!
|
|
|
+ paginationConfig.pageSize = page?.pageSize!
|
|
|
+ await fetchList();
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
@@ -148,10 +137,6 @@ const rowClassName = (record: any, index: number) => {
|
|
|
padding: 20px;
|
|
|
}
|
|
|
|
|
|
-.record {
|
|
|
- height: 30px;
|
|
|
-}
|
|
|
-
|
|
|
.ant-table {
|
|
|
border-top: 1px solid rgb(0, 0, 0, 0.06);
|
|
|
border-bottom: 1px solid rgb(0, 0, 0, 0.06);
|