This commit is contained in:
parent
0d2a4db6a6
commit
ed2e88b99e
61
apps/web-antd/src/api/sis/elevatorInfo/index.ts
Normal file
61
apps/web-antd/src/api/sis/elevatorInfo/index.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import type { ElevatorInfoVO, ElevatorInfoForm, ElevatorInfoQuery } from './model';
|
||||
|
||||
import type { ID, IDS } from '#/api/common';
|
||||
import type { PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 查询电梯基本信息列表
|
||||
* @param params
|
||||
* @returns 电梯基本信息列表
|
||||
*/
|
||||
export function elevatorInfoList(params?: ElevatorInfoQuery) {
|
||||
return requestClient.get<PageResult<ElevatorInfoVO>>('/sis/elevatorInfo/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出电梯基本信息列表
|
||||
* @param params
|
||||
* @returns 电梯基本信息列表
|
||||
*/
|
||||
export function elevatorInfoExport(params?: ElevatorInfoQuery) {
|
||||
return commonExport('/sis/elevatorInfo/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询电梯基本信息详情
|
||||
* @param elevatorId id
|
||||
* @returns 电梯基本信息详情
|
||||
*/
|
||||
export function elevatorInfoInfo(elevatorId: ID) {
|
||||
return requestClient.get<ElevatorInfoVO>(`/sis/elevatorInfo/${elevatorId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电梯基本信息
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function elevatorInfoAdd(data: ElevatorInfoForm) {
|
||||
return requestClient.postWithMsg<void>('/sis/elevatorInfo', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新电梯基本信息
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function elevatorInfoUpdate(data: ElevatorInfoForm) {
|
||||
return requestClient.putWithMsg<void>('/sis/elevatorInfo', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除电梯基本信息
|
||||
* @param elevatorId id
|
||||
* @returns void
|
||||
*/
|
||||
export function elevatorInfoRemove(elevatorId: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/sis/elevatorInfo/${elevatorId}`);
|
||||
}
|
294
apps/web-antd/src/api/sis/elevatorInfo/model.d.ts
vendored
Normal file
294
apps/web-antd/src/api/sis/elevatorInfo/model.d.ts
vendored
Normal file
@ -0,0 +1,294 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
|
||||
export interface ElevatorInfoVO {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
elevatorId: string | number;
|
||||
|
||||
/**
|
||||
* 电梯编号
|
||||
*/
|
||||
elevatorCode: string;
|
||||
|
||||
/**
|
||||
* 电梯名称
|
||||
*/
|
||||
elevatorName: string;
|
||||
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
location: string;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
brand: string;
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
model: string;
|
||||
|
||||
/**
|
||||
* 生产日期
|
||||
*/
|
||||
manufactureDate: string;
|
||||
|
||||
/**
|
||||
* 安装日期
|
||||
*/
|
||||
installationDate: string;
|
||||
|
||||
/**
|
||||
* 最大载重(kg)
|
||||
*/
|
||||
maxLoad: number;
|
||||
|
||||
/**
|
||||
* 服务楼层数
|
||||
*/
|
||||
floorsServed: number;
|
||||
|
||||
/**
|
||||
* 维保公司
|
||||
*/
|
||||
maintenanceCompany: string;
|
||||
|
||||
/**
|
||||
* 维保电话
|
||||
*/
|
||||
maintenancePhone: string;
|
||||
|
||||
/**
|
||||
* 上次年检日期
|
||||
*/
|
||||
lastInspectionDate: string;
|
||||
|
||||
/**
|
||||
* 下次年检日期
|
||||
*/
|
||||
nextInspectionDate: string;
|
||||
|
||||
/**
|
||||
* 梯控厂商
|
||||
*/
|
||||
controlFactory: string;
|
||||
|
||||
/**
|
||||
* 梯控设备ip
|
||||
*/
|
||||
controlIp: string;
|
||||
|
||||
/**
|
||||
* 梯控设备编码
|
||||
*/
|
||||
controlPort: number;
|
||||
|
||||
/**
|
||||
* 梯控设备登录账号
|
||||
*/
|
||||
controlAccount: string;
|
||||
|
||||
/**
|
||||
* 梯控设备登录密码
|
||||
*/
|
||||
controlPwd: string;
|
||||
|
||||
}
|
||||
|
||||
export interface ElevatorInfoForm extends BaseEntity {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
elevatorId?: string | number;
|
||||
|
||||
/**
|
||||
* 电梯编号
|
||||
*/
|
||||
elevatorCode?: string;
|
||||
|
||||
/**
|
||||
* 电梯名称
|
||||
*/
|
||||
elevatorName?: string;
|
||||
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
location?: string;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
brand?: string;
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
model?: string;
|
||||
|
||||
/**
|
||||
* 生产日期
|
||||
*/
|
||||
manufactureDate?: string;
|
||||
|
||||
/**
|
||||
* 安装日期
|
||||
*/
|
||||
installationDate?: string;
|
||||
|
||||
/**
|
||||
* 最大载重(kg)
|
||||
*/
|
||||
maxLoad?: number;
|
||||
|
||||
/**
|
||||
* 服务楼层数
|
||||
*/
|
||||
floorsServed?: number;
|
||||
|
||||
/**
|
||||
* 维保公司
|
||||
*/
|
||||
maintenanceCompany?: string;
|
||||
|
||||
/**
|
||||
* 维保电话
|
||||
*/
|
||||
maintenancePhone?: string;
|
||||
|
||||
/**
|
||||
* 上次年检日期
|
||||
*/
|
||||
lastInspectionDate?: string;
|
||||
|
||||
/**
|
||||
* 下次年检日期
|
||||
*/
|
||||
nextInspectionDate?: string;
|
||||
|
||||
/**
|
||||
* 梯控厂商
|
||||
*/
|
||||
controlFactory?: string;
|
||||
|
||||
/**
|
||||
* 梯控设备ip
|
||||
*/
|
||||
controlIp?: string;
|
||||
|
||||
/**
|
||||
* 梯控设备编码
|
||||
*/
|
||||
controlPort?: number;
|
||||
|
||||
/**
|
||||
* 梯控设备登录账号
|
||||
*/
|
||||
controlAccount?: string;
|
||||
|
||||
/**
|
||||
* 梯控设备登录密码
|
||||
*/
|
||||
controlPwd?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface ElevatorInfoQuery extends PageQuery {
|
||||
/**
|
||||
* 电梯编号
|
||||
*/
|
||||
elevatorCode?: string;
|
||||
|
||||
/**
|
||||
* 电梯名称
|
||||
*/
|
||||
elevatorName?: string;
|
||||
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
location?: string;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
brand?: string;
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
model?: string;
|
||||
|
||||
/**
|
||||
* 生产日期
|
||||
*/
|
||||
manufactureDate?: string;
|
||||
|
||||
/**
|
||||
* 安装日期
|
||||
*/
|
||||
installationDate?: string;
|
||||
|
||||
/**
|
||||
* 最大载重(kg)
|
||||
*/
|
||||
maxLoad?: number;
|
||||
|
||||
/**
|
||||
* 服务楼层数
|
||||
*/
|
||||
floorsServed?: number;
|
||||
|
||||
/**
|
||||
* 维保公司
|
||||
*/
|
||||
maintenanceCompany?: string;
|
||||
|
||||
/**
|
||||
* 维保电话
|
||||
*/
|
||||
maintenancePhone?: string;
|
||||
|
||||
/**
|
||||
* 上次年检日期
|
||||
*/
|
||||
lastInspectionDate?: string;
|
||||
|
||||
/**
|
||||
* 下次年检日期
|
||||
*/
|
||||
nextInspectionDate?: string;
|
||||
|
||||
/**
|
||||
* 梯控厂商
|
||||
*/
|
||||
controlFactory?: string;
|
||||
|
||||
/**
|
||||
* 梯控设备ip
|
||||
*/
|
||||
controlIp?: string;
|
||||
|
||||
/**
|
||||
* 梯控设备编码
|
||||
*/
|
||||
controlPort?: number;
|
||||
|
||||
/**
|
||||
* 梯控设备登录账号
|
||||
*/
|
||||
controlAccount?: string;
|
||||
|
||||
/**
|
||||
* 梯控设备登录密码
|
||||
*/
|
||||
controlPwd?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
231
apps/web-antd/src/views/sis/elevatorInfo/data.ts
Normal file
231
apps/web-antd/src/views/sis/elevatorInfo/data.ts
Normal file
@ -0,0 +1,231 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'elevatorCode',
|
||||
label: '电梯编号',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'elevatorName',
|
||||
label: '电梯名称',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '电梯编号',
|
||||
field: 'elevatorCode',
|
||||
},
|
||||
{
|
||||
title: '电梯名称',
|
||||
field: 'elevatorName',
|
||||
},
|
||||
{
|
||||
title: '安装位置',
|
||||
field: 'location',
|
||||
},
|
||||
{
|
||||
title: '品牌',
|
||||
field: 'brand',
|
||||
},
|
||||
{
|
||||
title: '型号',
|
||||
field: 'model',
|
||||
},
|
||||
{
|
||||
title: '生产日期',
|
||||
field: 'manufactureDate',
|
||||
},
|
||||
{
|
||||
title: '安装日期',
|
||||
field: 'installationDate',
|
||||
},
|
||||
{
|
||||
title: '最大载重(kg)',
|
||||
field: 'maxLoad',
|
||||
},
|
||||
{
|
||||
title: '服务楼层数',
|
||||
field: 'floorsServed',
|
||||
},
|
||||
{
|
||||
title: '维保公司',
|
||||
field: 'maintenanceCompany',
|
||||
},
|
||||
/*{
|
||||
title: '维保电话',
|
||||
field: 'maintenancePhone',
|
||||
},
|
||||
{
|
||||
title: '上次年检日期',
|
||||
field: 'lastInspectionDate',
|
||||
},
|
||||
{
|
||||
title: '下次年检日期',
|
||||
field: 'nextInspectionDate',
|
||||
},*/
|
||||
{
|
||||
title: '梯控厂商',
|
||||
field: 'controlFactory',
|
||||
},
|
||||
{
|
||||
title: '梯控ip',
|
||||
field: 'controlIp',
|
||||
},
|
||||
{
|
||||
title: '梯控端口',
|
||||
field: 'controlPort',
|
||||
},
|
||||
{
|
||||
title: '梯控账号',
|
||||
field: 'controlAccount',
|
||||
},
|
||||
{
|
||||
title: '梯控密码',
|
||||
field: 'controlPwd',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '',
|
||||
fieldName: 'elevatorId',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '电梯名称',
|
||||
fieldName: 'elevatorName',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'TreeSelect',
|
||||
fieldName: 'unitId',
|
||||
defaultValue: undefined,
|
||||
label: '社区建筑',
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '安装位置',
|
||||
fieldName: 'location',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '品牌',
|
||||
fieldName: 'brand',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '型号',
|
||||
fieldName: 'model',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '生产日期',
|
||||
fieldName: 'manufactureDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '安装日期',
|
||||
fieldName: 'installationDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '最大载重(kg)',
|
||||
fieldName: 'maxLoad',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '服务楼层数',
|
||||
fieldName: 'floorsServed',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '维保公司',
|
||||
fieldName: 'maintenanceCompany',
|
||||
component: 'Input',
|
||||
},
|
||||
/* {
|
||||
label: '维保电话',
|
||||
fieldName: 'maintenancePhone',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '上次年检日期',
|
||||
fieldName: 'lastInspectionDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '下次年检日期',
|
||||
fieldName: 'nextInspectionDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},*/
|
||||
{
|
||||
label: '梯控厂商',
|
||||
fieldName: 'controlFactory',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '梯控ip',
|
||||
fieldName: 'controlIp',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '梯控端口',
|
||||
fieldName: 'controlPort',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '梯控账号',
|
||||
fieldName: 'controlAccount',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '梯控密码',
|
||||
fieldName: 'controlPwd',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
];
|
142
apps/web-antd/src/views/sis/elevatorInfo/elevatorInfo-modal.vue
Normal file
142
apps/web-antd/src/views/sis/elevatorInfo/elevatorInfo-modal.vue
Normal file
@ -0,0 +1,142 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep, getPopupContainer, handleNode } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { elevatorInfoAdd, elevatorInfoInfo, elevatorInfoUpdate } from '#/api/sis/elevatorInfo';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
});
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-1',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 100,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
},
|
||||
);
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[60%]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
setupCommunitySelect()
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await elevatorInfoInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? elevatorInfoUpdate(data) : elevatorInfoAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.lock(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化城市
|
||||
*/
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(3);
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 3) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
class: 'w-full',
|
||||
fieldNames: {
|
||||
key: 'id',
|
||||
label: 'label',
|
||||
value: 'code',
|
||||
children: 'children',
|
||||
},
|
||||
getPopupContainer,
|
||||
placeholder: '请选择建筑',
|
||||
showSearch: true,
|
||||
treeData: areaList,
|
||||
treeDefaultExpandAll: true,
|
||||
treeLine: { showLeafIcon: false },
|
||||
// 筛选的字段
|
||||
treeNodeFilterProp: 'label',
|
||||
// 选中后显示在输入框的值
|
||||
treeNodeLabelProp: 'fullName',
|
||||
}),
|
||||
fieldName: 'unitId',
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
182
apps/web-antd/src/views/sis/elevatorInfo/index.vue
Normal file
182
apps/web-antd/src/views/sis/elevatorInfo/index.vue
Normal file
@ -0,0 +1,182 @@
|
||||
<script setup lang="ts">
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
elevatorInfoExport,
|
||||
elevatorInfoList,
|
||||
elevatorInfoRemove,
|
||||
} from '#/api/sis/elevatorInfo';
|
||||
import type { ElevatorInfoForm } from '#/api/sis/elevatorInfo/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import elevatorInfoModal from './elevatorInfo-modal.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
schema: querySchema(),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
// 处理区间选择器RangePicker时间格式 将一个字段映射为两个字段 搜索/导出会用到
|
||||
// 不需要直接删除
|
||||
// fieldMappingTime: [
|
||||
// [
|
||||
// 'createTime',
|
||||
// ['params[beginTime]', 'params[endTime]'],
|
||||
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
|
||||
// ],
|
||||
// ],
|
||||
};
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
checkboxConfig: {
|
||||
// 高亮
|
||||
highlight: true,
|
||||
// 翻页时保留选中状态
|
||||
reserve: true,
|
||||
// 点击行选中
|
||||
// trigger: 'row',
|
||||
},
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// columns: columns(),
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await elevatorInfoList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'elevatorId',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'sis-elevatorInfo-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [ElevatorInfoModal, modalApi] = useVbenModal({
|
||||
connectedComponent: elevatorInfoModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<ElevatorInfoForm>) {
|
||||
modalApi.setData({ id: row.elevatorId });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<ElevatorInfoForm>) {
|
||||
await elevatorInfoRemove(row.elevatorId);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<ElevatorInfoForm>) => row.elevatorId);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await elevatorInfoRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(elevatorInfoExport, '电梯基本信息数据', tableApi.formApi.form.values, {
|
||||
fieldMappingTime: formOptions.fieldMappingTime,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<BasicTable table-title="电梯基本信息列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
v-access:code="['sis:elevatorInfo:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['sis:elevatorInfo:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['sis:elevatorInfo:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['sis:elevatorInfo:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
>
|
||||
{{ $t('pages.common.edit') }}
|
||||
</ghost-button>
|
||||
<Popconfirm
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
title="确认删除?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<ghost-button
|
||||
danger
|
||||
v-access:code="['sis:elevatorInfo:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<ElevatorInfoModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
@ -28,7 +28,8 @@ export default defineConfig(async () => {
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
// mock代理目标地址
|
||||
target: 'http://192.168.43.169:8080',
|
||||
// target: 'http://192.168.43.169:8080',
|
||||
target: 'http://127.0.0.1:8080',
|
||||
// target: 'http://192.168.0.108:8080',
|
||||
// target: 'http://192.168.0.106:8080',
|
||||
// target: 'http://47.109.37.87:3010',
|
||||
|
Loading…
Reference in New Issue
Block a user