2025-03-14 17:32:08 +08:00
|
|
|
<template>
|
|
|
|
<a-spin :spinning="syncoading">
|
|
|
|
<div class="p-2">
|
|
|
|
<!--引用表格-->
|
|
|
|
<BasicTable @register="registerTable">
|
|
|
|
<!--插槽:table标题-->
|
|
|
|
<template #tableTitle>
|
2025-03-18 18:06:20 +08:00
|
|
|
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreate"> 新增</a-button>
|
|
|
|
<a-button preIcon="ant-design:sync-outlined" @click="handleSync"> 同步</a-button>
|
2025-03-14 17:32:08 +08:00
|
|
|
</template>
|
|
|
|
<!--操作栏-->
|
|
|
|
<template #action="{ record }">
|
|
|
|
<TableAction :actions="getTableAction(record)"/>
|
|
|
|
</template>
|
|
|
|
<template v-slot:bodyCell="{ column, record, index, text }">
|
|
|
|
</template>
|
|
|
|
</BasicTable>
|
|
|
|
<!-- 表单区域 -->
|
|
|
|
<ProjectInfoDrawer @register="registerDrawer" @success="handleSuccess" />
|
|
|
|
</div>
|
|
|
|
</a-spin>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" name="iot-nuIotCameraInfo" setup>
|
|
|
|
import {ref, reactive, createVNode, h} from 'vue';
|
|
|
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
|
|
|
import { useListPage } from '/@/hooks/system/useListPage';
|
|
|
|
import { columns,searchFormSchema } from './ProjectInfo.data';
|
2025-03-20 09:26:41 +08:00
|
|
|
import { list, sync, deletePrject } from './ProjectInfo.api';
|
2025-03-14 17:32:08 +08:00
|
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
|
|
import { useRouter } from 'vue-router';
|
|
|
|
import { useDrawer } from "@/components/Drawer";
|
|
|
|
import ProjectInfoDrawer from './components/ProjectInfoDrawer.vue';
|
2025-03-18 18:06:20 +08:00
|
|
|
import {Modal} from "ant-design-vue";
|
|
|
|
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
|
2025-03-14 17:32:08 +08:00
|
|
|
//注册drawer
|
|
|
|
const [registerDrawer, { openDrawer }] = useDrawer();
|
|
|
|
let router = useRouter();
|
|
|
|
const formRef = ref();
|
|
|
|
const syncoading = ref<boolean>(false);
|
|
|
|
const queryParam = reactive<any>({});
|
|
|
|
const userStore = useUserStore();
|
|
|
|
//注册table数据
|
|
|
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|
|
|
tableProps: {
|
2025-03-20 09:26:41 +08:00
|
|
|
title: '护理单元-物联管理-机构信息',
|
2025-03-14 17:32:08 +08:00
|
|
|
api: list,
|
|
|
|
columns,
|
|
|
|
canResize:false,
|
|
|
|
formConfig: {
|
|
|
|
// labelWidth: 200,
|
|
|
|
schemas: searchFormSchema,
|
|
|
|
},
|
|
|
|
actionColumn: {
|
|
|
|
width: 120,
|
|
|
|
fixed: 'right',
|
|
|
|
},
|
|
|
|
beforeFetch: async (params) => {
|
|
|
|
return Object.assign(params, queryParam);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
|
|
|
const labelCol = reactive({
|
|
|
|
xs:24,
|
|
|
|
sm:4,
|
|
|
|
xl:6,
|
|
|
|
xxl:4
|
|
|
|
});
|
|
|
|
const wrapperCol = reactive({
|
|
|
|
xs: 24,
|
|
|
|
sm: 20,
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
2025-03-18 18:06:20 +08:00
|
|
|
* 新增
|
2025-03-14 17:32:08 +08:00
|
|
|
*/
|
2025-03-18 18:06:20 +08:00
|
|
|
function handleCreate() {
|
|
|
|
openDrawer(true, {
|
|
|
|
isUpdate: false,
|
|
|
|
showFooter: true,
|
|
|
|
tenantSaas: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 编辑
|
|
|
|
*/
|
|
|
|
function handleEdit(record: Recordable) {
|
2025-03-14 17:32:08 +08:00
|
|
|
openDrawer(true, {
|
|
|
|
record,
|
|
|
|
isUpdate: true,
|
2025-03-18 18:06:20 +08:00
|
|
|
showFooter: true,
|
2025-03-14 17:32:08 +08:00
|
|
|
tenantSaas: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2025-03-18 18:06:20 +08:00
|
|
|
/**
|
|
|
|
* 删除
|
|
|
|
*/
|
|
|
|
function handleDelete(record: Recordable) {
|
|
|
|
Modal.confirm({
|
|
|
|
title: '删除项目',
|
|
|
|
width: '500px',
|
|
|
|
icon: createVNode(ExclamationCircleOutlined),
|
|
|
|
content: createVNode('div', { style: 'color:red;' }, '项目删除后,与之相关信息将失效,确定要删除该项目吗?'),
|
|
|
|
okText: '确定',
|
|
|
|
onOk() {
|
|
|
|
deletePrject(record, reload);
|
|
|
|
},
|
|
|
|
onCancel() {
|
|
|
|
},
|
|
|
|
class: 'test',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2025-03-14 17:32:08 +08:00
|
|
|
/**
|
|
|
|
* 操作栏
|
|
|
|
*/
|
|
|
|
function getTableAction(record) {
|
|
|
|
return [
|
|
|
|
{
|
2025-03-18 18:06:20 +08:00
|
|
|
label: '编辑',
|
|
|
|
onClick: handleEdit.bind(null, record),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '删除',
|
|
|
|
onClick: handleDelete.bind(null, record),
|
2025-03-14 17:32:08 +08:00
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2025-03-18 18:06:20 +08:00
|
|
|
/**
|
|
|
|
* 成功回调
|
|
|
|
*/
|
|
|
|
function handleSuccess() {
|
|
|
|
reload();
|
|
|
|
}
|
|
|
|
|
2025-03-14 17:32:08 +08:00
|
|
|
/**
|
|
|
|
* 查询
|
|
|
|
*/
|
|
|
|
function searchQuery() {
|
|
|
|
reload();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 重置
|
|
|
|
*/
|
|
|
|
function searchReset() {
|
|
|
|
formRef.value.resetFields();
|
|
|
|
selectedRowKeys.value = [];
|
|
|
|
//刷新数据
|
|
|
|
reload();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 信息同步
|
|
|
|
*/
|
|
|
|
function handleSync(){
|
|
|
|
syncoading.value = true;
|
|
|
|
sync({}).then(res=>{
|
|
|
|
syncoading.value = false;
|
|
|
|
//刷新数据
|
|
|
|
reload();
|
|
|
|
}).catch(res=>{
|
|
|
|
syncoading.value = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
.jeecg-basic-table-form-container {
|
|
|
|
padding: 0;
|
|
|
|
.table-page-search-submitButtons {
|
|
|
|
display: block;
|
|
|
|
margin-bottom: 24px;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
.query-group-cust{
|
|
|
|
min-width: 100px !important;
|
|
|
|
}
|
|
|
|
.query-group-split-cust{
|
|
|
|
width: 30px;
|
|
|
|
display: inline-block;
|
|
|
|
text-align: center
|
|
|
|
}
|
|
|
|
.ant-form-item:not(.ant-form-item-with-help){
|
|
|
|
margin-bottom: 16px;
|
|
|
|
height: 32px;
|
|
|
|
}
|
|
|
|
:deep(.ant-picker),:deep(.ant-input-number){
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|