1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <template>
- <!-- <BasicTable @register="registerTable" @edit-change="handleEditChange">
- <template #action="{ record, column }">
- <TableAction :actions="createActions(record, column)" />
- </template>
- </BasicTable> -->
- <a-table :columns="resultColumns" :data-source="dataSource" rowKey="id" class="components-table-demo-nested" :loading="loading" size="small" >
- <template #bodyCell="{ record, column }">
- <template v-if="column.dataIndex === 'action'">
- <TableAction :actions="createActions(record, column)" />
- <!-- <a href="javascript:void(0)" ><Icon icon="ant-design:delete-outlined"></Icon></a> -->
- </template>
- </template>
- <template #expandedRowRender="{record}">
- <a-empty v-if="record.testDetail && record.testDetail.length < 1"/>
- <a-table v-else :columns="innerResultColumns" :data-source="record.testDetail" rowKey="id" size="small">
- </a-table>
- </template>
- <!-- <template></template> -->
-
- </a-table>
- </template>
- <script lang="ts">
- import { resultList } from '/@/views/vent/monitorManager/windrectMonitor/windrect.api';
- import { ref, onMounted } from "vue";
- import { resultColumns, innerResultColumns } from '../windrect.data';
- import { BasicTable, TableAction, BasicColumn, ActionItem, EditRecordRow } from '/@/components/Table';
- import { getExportUrl } from '../windrect.api'
- import { useMethods } from '/@/hooks/system/useMethods';
- export default {
- name: 'ResultTable',
- props: {
- deviceType: {
- type: String,
- required: true,
- },
- },
- components: { TableAction },
- setup() {
- const loading = ref(false)
- const dataSource = ref([]);
- const { handleExportXls } = useMethods();
- const getMonitor = () => {
- resultList({}).then((res) => {
- loading.value = false
- dataSource.value = res.records
- });
- };
- function createActions(record: EditRecordRow, column: BasicColumn): ActionItem[] {
- return [
- {
- label: '导出',
- onClick: handleExportXls.bind(null, '测风报表导出', getExportUrl, { testid : record.id}),
- },
- {
- label: '删除',
- },
- ];
- }
- onMounted(() => {
- loading.value = true
- getMonitor();
- });
-
- return {
- dataSource,
- resultColumns,
- innerResultColumns,
- loading,
- createActions
- };
- },
- };
- </script>
|