cicd
This commit is contained in:
parent
96a9234239
commit
053a6d4f69
22
.gitea/workflows/dev.yml
Normal file
22
.gitea/workflows/dev.yml
Normal file
@ -0,0 +1,22 @@
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: http://127.0.0.1:3000/bichangxiong/checkout@v4 # 使用 Gitea 镜像
|
||||
with:
|
||||
fetch-depth: 1 # 只拉取最新一次提交
|
||||
- name: node
|
||||
run: pnpm i
|
||||
- name: Build
|
||||
run: pnpm build:antd
|
||||
- name: cp
|
||||
run: robocopy ./apps/web-antd/dist C:\devtool\nginx-1.28.0\html\web-antd /E
|
||||
|
||||
|
||||
|
61
apps/web-antd/src/api/property/assetType/index.ts
Normal file
61
apps/web-antd/src/api/property/assetType/index.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import type { AssetTypeVO, AssetTypeForm, AssetTypeQuery } 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 assetTypeList(params?: AssetTypeQuery) {
|
||||
return requestClient.get<PageResult<AssetTypeVO>>('/property/assetType/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出资产类型列表
|
||||
* @param params
|
||||
* @returns 资产类型列表
|
||||
*/
|
||||
export function assetTypeExport(params?: AssetTypeQuery) {
|
||||
return commonExport('/property/assetType/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询资产类型详情
|
||||
* @param id id
|
||||
* @returns 资产类型详情
|
||||
*/
|
||||
export function assetTypeInfo(id: ID) {
|
||||
return requestClient.get<AssetTypeVO>(`/property/assetType/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资产类型
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function assetTypeAdd(data: AssetTypeForm) {
|
||||
return requestClient.postWithMsg<void>('/property/assetType', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新资产类型
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function assetTypeUpdate(data: AssetTypeForm) {
|
||||
return requestClient.putWithMsg<void>('/property/assetType', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产类型
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function assetTypeRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/property/assetType/${id}`);
|
||||
}
|
64
apps/web-antd/src/api/property/assetType/model.d.ts
vendored
Normal file
64
apps/web-antd/src/api/property/assetType/model.d.ts
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
|
||||
export interface AssetTypeVO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
assetTypeName: string;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
sort: number;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
createTime: string;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
createBy: string;
|
||||
|
||||
}
|
||||
|
||||
export interface AssetTypeForm extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
assetTypeName?: string;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
sort?: number;
|
||||
|
||||
}
|
||||
|
||||
export interface AssetTypeQuery extends PageQuery {
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
assetTypeName?: string;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
sort?: number;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
61
apps/web-antd/src/api/property/booking/index.ts
Normal file
61
apps/web-antd/src/api/property/booking/index.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import type { BookingVO, BookingForm, BookingQuery } 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 bookingList(params?: BookingQuery) {
|
||||
return requestClient.get<PageResult<BookingVO>>('/property/booking/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出会议预约列表
|
||||
* @param params
|
||||
* @returns 会议预约列表
|
||||
*/
|
||||
export function bookingExport(params?: BookingQuery) {
|
||||
return commonExport('/property/booking/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询会议预约详情
|
||||
* @param id id
|
||||
* @returns 会议预约详情
|
||||
*/
|
||||
export function bookingInfo(id: ID) {
|
||||
return requestClient.get<BookingVO>(`/property/booking/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增会议预约
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function bookingAdd(data: BookingForm) {
|
||||
return requestClient.postWithMsg<void>('/property/booking', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新会议预约
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function bookingUpdate(data: BookingForm) {
|
||||
return requestClient.putWithMsg<void>('/property/booking', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除会议预约
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function bookingRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/property/booking/${id}`);
|
||||
}
|
224
apps/web-antd/src/api/property/booking/model.d.ts
vendored
Normal file
224
apps/web-antd/src/api/property/booking/model.d.ts
vendored
Normal file
@ -0,0 +1,224 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
|
||||
export interface BookingVO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 会议室名称
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* 会议室id
|
||||
*/
|
||||
meetId: string | number;
|
||||
|
||||
/**
|
||||
* 会议室地址
|
||||
*/
|
||||
meetLocation: string;
|
||||
|
||||
/**
|
||||
* 所属单位
|
||||
*/
|
||||
unit: string;
|
||||
|
||||
/**
|
||||
* 预定人
|
||||
*/
|
||||
person: string;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
phone: string;
|
||||
|
||||
/**
|
||||
* 预定开始时间
|
||||
*/
|
||||
scheduledStarttime: string;
|
||||
|
||||
/**
|
||||
* 预定结束时间
|
||||
*/
|
||||
scheduledEndtime: string;
|
||||
|
||||
/**
|
||||
* 参会人数
|
||||
*/
|
||||
personSum: number;
|
||||
|
||||
/**
|
||||
* 费用
|
||||
*/
|
||||
price: number;
|
||||
|
||||
/**
|
||||
* 是否包含增值服务
|
||||
*/
|
||||
attach: number;
|
||||
|
||||
/**
|
||||
* 支付状态
|
||||
*/
|
||||
payState: number;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
state: number;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
createTime: string;
|
||||
|
||||
}
|
||||
|
||||
export interface BookingForm extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 会议室名称
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* 会议室id
|
||||
*/
|
||||
meetId?: string | number;
|
||||
|
||||
/**
|
||||
* 会议室地址
|
||||
*/
|
||||
meetLocation?: string;
|
||||
|
||||
/**
|
||||
* 所属单位
|
||||
*/
|
||||
unit?: string;
|
||||
|
||||
/**
|
||||
* 预定人
|
||||
*/
|
||||
person?: string;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
phone?: string;
|
||||
|
||||
/**
|
||||
* 预定开始时间
|
||||
*/
|
||||
scheduledStarttime?: string;
|
||||
|
||||
/**
|
||||
* 预定结束时间
|
||||
*/
|
||||
scheduledEndtime?: string;
|
||||
|
||||
/**
|
||||
* 参会人数
|
||||
*/
|
||||
personSum?: number;
|
||||
|
||||
/**
|
||||
* 费用
|
||||
*/
|
||||
price?: number;
|
||||
|
||||
/**
|
||||
* 是否包含增值服务
|
||||
*/
|
||||
attach?: number;
|
||||
|
||||
/**
|
||||
* 支付状态
|
||||
*/
|
||||
payState?: number;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
state?: number;
|
||||
|
||||
}
|
||||
|
||||
export interface BookingQuery extends PageQuery {
|
||||
/**
|
||||
* 会议室名称
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* 会议室id
|
||||
*/
|
||||
meetId?: string | number;
|
||||
|
||||
/**
|
||||
* 会议室地址
|
||||
*/
|
||||
meetLocation?: string;
|
||||
|
||||
/**
|
||||
* 所属单位
|
||||
*/
|
||||
unit?: string;
|
||||
|
||||
/**
|
||||
* 预定人
|
||||
*/
|
||||
person?: string;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
phone?: string;
|
||||
|
||||
/**
|
||||
* 预定开始时间
|
||||
*/
|
||||
scheduledStarttime?: string;
|
||||
|
||||
/**
|
||||
* 预定结束时间
|
||||
*/
|
||||
scheduledEndtime?: string;
|
||||
|
||||
/**
|
||||
* 参会人数
|
||||
*/
|
||||
personSum?: number;
|
||||
|
||||
/**
|
||||
* 费用
|
||||
*/
|
||||
price?: number;
|
||||
|
||||
/**
|
||||
* 是否包含增值服务
|
||||
*/
|
||||
attach?: number;
|
||||
|
||||
/**
|
||||
* 支付状态
|
||||
*/
|
||||
payState?: number;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
state?: number;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
@ -37,7 +37,7 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'accssType',
|
||||
fieldName: 'accessType',
|
||||
label: '门禁设备类型',
|
||||
},
|
||||
{
|
||||
@ -115,7 +115,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
},
|
||||
{
|
||||
title: '门禁设备类型',
|
||||
field: 'accssType',
|
||||
field: 'accessType',
|
||||
},
|
||||
{
|
||||
title: '工厂编码',
|
||||
@ -206,7 +206,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
label: '门禁设备类型',
|
||||
fieldName: 'accssType',
|
||||
fieldName: 'accessType',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
|
@ -37,7 +37,7 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'accssType',
|
||||
fieldName: 'accessType',
|
||||
label: '门禁设备类型',
|
||||
},
|
||||
{
|
||||
@ -115,7 +115,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
},
|
||||
{
|
||||
title: '门禁设备类型',
|
||||
field: 'accssType',
|
||||
field: 'accessType',
|
||||
},
|
||||
{
|
||||
title: '工厂编码',
|
||||
@ -206,7 +206,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
label: '门禁设备类型',
|
||||
fieldName: 'accssType',
|
||||
fieldName: 'accessType',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
|
@ -37,7 +37,7 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'accssType',
|
||||
fieldName: 'accessType',
|
||||
label: '门禁设备类型',
|
||||
},
|
||||
{
|
||||
@ -115,7 +115,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
},
|
||||
{
|
||||
title: '门禁设备类型',
|
||||
field: 'accssType',
|
||||
field: 'accessType',
|
||||
},
|
||||
{
|
||||
title: '工厂编码',
|
||||
@ -206,7 +206,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
label: '门禁设备类型',
|
||||
fieldName: 'accssType',
|
||||
fieldName: 'accessType',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
|
@ -37,7 +37,7 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'accssType',
|
||||
fieldName: 'accessType',
|
||||
label: '门禁设备类型',
|
||||
},
|
||||
{
|
||||
@ -115,7 +115,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
},
|
||||
{
|
||||
title: '门禁设备类型',
|
||||
field: 'accssType',
|
||||
field: 'accessType',
|
||||
},
|
||||
{
|
||||
title: '工厂编码',
|
||||
@ -206,7 +206,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
label: '门禁设备类型',
|
||||
fieldName: 'accssType',
|
||||
fieldName: 'accessType',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
|
101
apps/web-antd/src/views/property/assetType/assetType-modal.vue
Normal file
101
apps/web-antd/src/views/property/assetType/assetType-modal.vue
Normal file
@ -0,0 +1,101 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { assetTypeAdd, assetTypeInfo, assetTypeUpdate } from '#/api/property/assetType';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
|
||||
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-2',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 80,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
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-[550px]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await assetTypeInfo(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 ? assetTypeUpdate(data) : assetTypeAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.lock(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
71
apps/web-antd/src/views/property/assetType/data.ts
Normal file
71
apps/web-antd/src/views/property/assetType/data.ts
Normal file
@ -0,0 +1,71 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'assetTypeName',
|
||||
label: '分类名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'sort',
|
||||
label: '排序',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '主键',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
title: '分类名称',
|
||||
field: 'assetTypeName',
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
field: 'sort',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
field: 'createBy',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '分类名称',
|
||||
fieldName: 'assetTypeName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '排序',
|
||||
fieldName: 'sort',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
182
apps/web-antd/src/views/property/assetType/index.vue
Normal file
182
apps/web-antd/src/views/property/assetType/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 {
|
||||
assetTypeExport,
|
||||
assetTypeList,
|
||||
assetTypeRemove,
|
||||
} from '#/api/property/assetType';
|
||||
import type { AssetTypeForm } from '#/api/property/assetType/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import assetTypeModal from './assetType-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 assetTypeList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-assetType-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [AssetTypeModal, modalApi] = useVbenModal({
|
||||
connectedComponent: assetTypeModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<AssetTypeForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<AssetTypeForm>) {
|
||||
await assetTypeRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<AssetTypeForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await assetTypeRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(assetTypeExport, '资产类型数据', 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="['property:assetType:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:assetType:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:assetType:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:assetType: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="['property:assetType:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<AssetTypeModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
@ -27,7 +27,7 @@ export default defineConfig(async () => {
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
// mock代理目标地址
|
||||
target: 'http://127.0.0.1:8080/',
|
||||
target: 'http://47.109.37.87:3010/',
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user