2026-03-27 17:42:01 +08:00
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<!--引用表格-->
|
|
|
|
|
<BasicTable @register="registerTable">
|
|
|
|
|
<!--插槽:table标题-->
|
|
|
|
|
<template #tableTitle>
|
2026-04-20 21:19:13 +08:00
|
|
|
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd"> 新增</a-button>
|
2026-03-27 17:42:01 +08:00
|
|
|
</template>
|
|
|
|
|
<template #bodyCell="{ column, record, index, text }">
|
|
|
|
|
</template>
|
|
|
|
|
<!--操作栏-->
|
|
|
|
|
<template #action="{ record }">
|
|
|
|
|
<TableAction :actions="getTableAction(record)"/>
|
|
|
|
|
</template>
|
|
|
|
|
</BasicTable>
|
|
|
|
|
<DeviceConfigModal ref="registerDrawer" @success="handleSuccess" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" name="iot-nuIotElectricitynInfo" setup>
|
|
|
|
|
import {reactive, ref,h} from 'vue';
|
|
|
|
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
|
|
|
|
import { useListPage } from '/@/hooks/system/useListPage';
|
|
|
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
|
|
|
import {Modal} from "ant-design-vue";
|
2026-04-07 18:01:07 +08:00
|
|
|
import {list} from './config.api';
|
2026-03-27 17:42:01 +08:00
|
|
|
import { columns, searchFormSchema } from './config.data';
|
|
|
|
|
import {useModal} from "@/components/Modal";
|
|
|
|
|
import DeviceConfigModal from "./components/DeviceConfigModal.vue";
|
|
|
|
|
import { defHttp } from '/@/utils/http/axios';
|
|
|
|
|
|
|
|
|
|
const queryParam = reactive<any>({});
|
|
|
|
|
const registerDrawer = ref();
|
|
|
|
|
const tipVisible = ref(false);
|
|
|
|
|
//注册model
|
|
|
|
|
const [registerModal, {openModal}] = useModal();
|
|
|
|
|
//注册table数据
|
|
|
|
|
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
|
|
|
|
|
tableProps:{
|
|
|
|
|
title: '物联设备配置',
|
|
|
|
|
api: list,
|
|
|
|
|
columns,
|
|
|
|
|
canResize:false,
|
|
|
|
|
showIndexColumn: true,
|
|
|
|
|
formConfig: {
|
|
|
|
|
//labelWidth: 120,
|
|
|
|
|
schemas: searchFormSchema,
|
|
|
|
|
autoSubmitOnEnter:true,
|
|
|
|
|
showAdvancedButton:false,
|
|
|
|
|
fieldMapToNumber: [
|
|
|
|
|
],
|
|
|
|
|
fieldMapToTime: [
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
pagination: {
|
|
|
|
|
current: 1,
|
|
|
|
|
pageSize: 15,
|
|
|
|
|
pageSizeOptions: ['15', '50', '70', '100'],
|
|
|
|
|
},
|
|
|
|
|
actionColumn: {
|
|
|
|
|
width: 290,
|
|
|
|
|
fixed:'right'
|
|
|
|
|
},
|
|
|
|
|
beforeFetch: (params) => {
|
|
|
|
|
return Object.assign(params, queryParam);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 编辑
|
|
|
|
|
*/
|
|
|
|
|
function handleAdd() {
|
|
|
|
|
registerDrawer.value.disableSubmit = false;
|
|
|
|
|
registerDrawer.value.add();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 编辑事件
|
|
|
|
|
*/
|
|
|
|
|
function handleEdit(record: Recordable) {
|
|
|
|
|
registerDrawer.value.disableSubmit = false;
|
|
|
|
|
registerDrawer.value.edit(record);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 详情
|
|
|
|
|
*/
|
|
|
|
|
function handleDetail(record: Recordable) {
|
|
|
|
|
registerDrawer.value.disableSubmit = true;
|
|
|
|
|
registerDrawer.value.edit(record);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleCancel() {
|
|
|
|
|
tipVisible.value = false;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 成功回调
|
|
|
|
|
*/
|
|
|
|
|
function handleSuccess() {
|
|
|
|
|
(selectedRowKeys.value = []) && reload();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 操作栏
|
|
|
|
|
*/
|
|
|
|
|
function getTableAction(record){
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
label: '详情',
|
|
|
|
|
onClick: handleDetail.bind(null, record),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '编辑',
|
|
|
|
|
onClick: handleEdit.bind(null, record),
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|