Files
xj-admin/src/views/archive/healthCabin/healthRoom/components/terminalEquipmentDrawer.vue
T
2025-06-27 17:42:38 +08:00

76 lines
3.0 KiB
Vue

<template>
<BasicDrawer @register="projectDrawer" title="终端设备" :width="900" :show-footer="false" :maskClosable="false">
<BasicTable @register="projectTable" :rowSelection="rowSelection" class="device-table">
<template #tableTitle>
<a-button type="primary" :icon="h(PlusOutlined)" @click="addTerEqui"> 新增 </a-button>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
</BasicTable>
<AddTerEquiModal @register="TerEquiModal" @success="handleSuccess"></AddTerEquiModal>
</BasicDrawer>
</template>
<script lang="ts" setup>
import BasicDrawer from '/@/components/Drawer/src/BasicDrawer.vue';
import { useDrawerInner } from '/@/components/Drawer';
import AddTerEquiModal from '/@/views/archive/healthCabin/healthRoom/components/addTerEquipmentModal.vue';
import BasicTable from '/@/components/Table/src/BasicTable.vue';
import { useListPage } from '/@/hooks/system/useListPage';
import { terEquiColums } from '/@/views/archive/healthCabin/healthRoom/index.data';
import { ref, h } from 'vue';
import { listByTerminal, terEquiDelete } from '/@/views/archive/healthCabin/healthRoom/index.api';
import { PlusOutlined } from '@ant-design/icons-vue';
import { TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
const terminalCode = ref();
const [projectDrawer, { setDrawerProps }] = useDrawerInner(async (data) => {
console.log(data.record, 1111111);
terminalCode.value = data.record.terminalCode;
});
const [TerEquiModal, { openModal }] = useModal();
const { tableContext } = useListPage({
tableProps: {
title: '设备项目表',
api: listByTerminal,
columns: terEquiColums,
canResize: false,
orderFlag: false,
showIndexColumn: false,
useSearchForm: false,
actionColumn: {
width: 100,
fixed: 'right',
},
beforeFetch: (params) => {
params['terminalCode'] = terminalCode.value;
return params;
},
},
});
const [projectTable, { reload, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
function getTableAction(record: any) {
return [
{
label: '删除',
onClick: projectDelete.bind(null, record),
},
];
}
function addTerEqui() {
openModal(true, {
title: '新增',
terminalCode: terminalCode.value,
isUpdate: false,
});
}
function handleSuccess() {
reload();
}
function projectDelete(record) {
terEquiDelete({ id: record.id }, reload);
// projectDetele({ id: record.id }, reload);
}
</script>
<style lang="less" scoped></style>