Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
15683799673
2025-07-21 03:38:34 +08:00
21 changed files with 337 additions and 246 deletions

View File

@@ -59,3 +59,12 @@ export function groupUpdate(data: GroupForm) {
export function groupRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/Property/group/${id}`);
}
/**
* 获取节假日数据
* @param year
*/
export async function getHoliday(year: string) {
const response = await fetch(`https://timor.tech/api/holiday/year/${year}`);
return response.json();
}

View File

@@ -1,4 +1,4 @@
import type { PageQuery, BaseEntity } from '#/api/common';
import type {PageQuery, BaseEntity} from '#/api/common';
export interface GroupVO {
/**
@@ -63,7 +63,16 @@ export interface GroupQuery extends PageQuery {
attendanceType?: number;
/**
* 日期范围参数
*/
* 日期范围参数
*/
params?: any;
}
/**
* 假期
*/
export interface Holiday {
holiday: boolean;
name: string;
date: string;
}

View File

@@ -1,8 +1,6 @@
import type { ShiftVO, ShiftForm, ShiftQuery } 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';

View File

@@ -40,7 +40,6 @@ export interface ShiftVO {
* 休息结束时间
*/
restEndTime: string;
}
export interface ShiftForm extends BaseEntity {
@@ -83,7 +82,6 @@ export interface ShiftForm extends BaseEntity {
* 休息结束时间
*/
restEndTime?: string;
}
export interface ShiftQuery extends PageQuery {

View File

@@ -58,6 +58,8 @@ export interface HouseChargeVO {
costItemsVo: CostItemSettingVO;
chargeStatus: string;
personId: string;
}
export interface HouseChargeForm extends BaseEntity {

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 KiB

View File

@@ -2,7 +2,7 @@ import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict";
import {renderDict} from "#/utils/render";
import type { TableColumnsType } from 'ant-design-vue';
export const querySchema: FormSchemaGetter = () => [
{
@@ -124,6 +124,18 @@ export const modalSchema: FormSchemaGetter = () => [
rules:'required',
defaultValue:'1',
},
{
label: '',
fieldName: 'shiftData',
component: 'Input',
dependencies: {
show: (formValue) => formValue.attendanceType=='1',
triggerFields: ['attendanceType'],
},
slots:{
default:'shiftData'
},
},
{
label: '排班周期',
fieldName: 'schedulingCycle',
@@ -138,32 +150,99 @@ export const modalSchema: FormSchemaGetter = () => [
defaultValue:'1',
rules:'required'
},
{
label: '',
fieldName: 'cycleData',
component: 'Input',
dependencies: {
show: (formValue) => formValue.attendanceType=='1',
triggerFields: ['attendanceType'],
},
slots:{
default:'cycleData'
},
},
];
export const weekdayColumns: VxeGridProps['columns'] = [
export const weekdayColumns: TableColumnsType = [
{
title: '工作日',
name: 'label',
key: 'label',
width:180,
align:'center',
dataIndex:'label'
},
{
title: '班次',
name: 'shift',
key: 'shift',
minWidth:180,
align:'center',
dataIndex:'shift'
},
{
title: '操作',
name: 'action',
key: 'action',
dataIndex:'action',
width:180,
align:'center',
slots:{
default:'action'
},
},
]
export const noClockingColumns: TableColumnsType = [
{
title: '无需打卡日期',
key: 'label',
width:180,
align:'center',
dataIndex:'label'
},
{
title: '操作',
key: 'action',
dataIndex:'action',
width:180,
align:'center',
},
]
export const clockingColumns: TableColumnsType = [
{
title: '必须打卡日期',
key: 'label',
width:180,
align:'center',
dataIndex:'label'
},
{
title: '操作',
key: 'action',
dataIndex:'action',
width:180,
align:'center',
},
]
export const cycleColumns: TableColumnsType = [
{
title: '天数',
key: 'label',
width:180,
align:'center',
dataIndex:'label'
},
{
title: '班次',
key: 'label',
width:180,
align:'center',
dataIndex:'label'
},
{
title: '操作',
key: 'action',
dataIndex:'action',
width:180,
align:'center',
},
]

View File

@@ -13,9 +13,16 @@ import {
} from '#/api/property/attendanceManagement/attendanceGroupSettings';
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
import {modalSchema, weekdayColumns} from './data';
import {Tag, Button, Table} from 'ant-design-vue'
import {
clockingColumns,
cycleColumns,
modalSchema,
noClockingColumns,
weekdayColumns
} from './data';
import {Tag, Button, Table, Checkbox} from 'ant-design-vue'
import {getDictOptions} from "#/utils/dict";
import holidayCalendar from './holiday-calendar.vue'
const emit = defineEmits<{ reload: [] }>();
@@ -24,7 +31,9 @@ const weekdayData = ref<any[]>([])
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
const settingData = ref<any>({
isAutomatic: true,
})
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
// 默认占满两列
@@ -50,8 +59,9 @@ const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[70%]',
class: 'w-[80%]',
fullscreenButton: false,
maskClosable:false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
@@ -66,18 +76,17 @@ const [BasicModal, modalApi] = useVbenModal({
if (isUpdate.value && id) {
const record = await groupInfo(id);
await formApi.setValues(record);
}else {
weekdayData.value=[]
getDictOptions('wy_kqgzr').forEach(item=>{
weekdayData.value.push({
dayOfWeek:item.value,
label:item.label,
shift:item.value=='6'||item.value=='7'?'休息':'常规班次08:00:00~12:00:00 14:00:00~17:00:00'
})
} else {
weekdayData.value = []
getDictOptions('wy_kqgzr').forEach(item => {
weekdayData.value.push({
dayOfWeek: item.value,
label: item.label,
shift: item.value == '6' || item.value == '7' ? '休息' : '常规班次08:00:00~12:00:00 14:00:00~17:00:00'
})
})
}
await markInitialized();
modalApi.modalLoading(false);
},
});
@@ -106,41 +115,95 @@ async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
const [HolidayCalendar, holidayApi] = useVbenModal({
connectedComponent: holidayCalendar,
});
/**
* 查看法定节假日日历
*/
async function showHoliday() {
holidayApi.open()
}
</script>
<template>
<BasicModal :title="title">
<BasicForm>
<template #weekdaySetting>
<div style="font-size: 0.875rem;">
<div class="item-font">
<span>快捷设置班次</span>
<Tag color="processing">常规班次08:00:00~12:00:00 14:00:00~17:00:00</Tag>
<Button type="link">更改班次</Button>
</div>
</template>
<template #settingItem>
<Table style="width: 100%" bordered :columns="weekdayColumns" :data-source="weekdayData"
size="small" :pagination="false">
<!-- <template #headerCell="{ column }">-->
<!-- </template>-->
<!-- <template #bodyCell="{ column, record }">-->
<!-- <template>-->
<!-- {{ record[column.field] }}-->
<!-- </template>-->
<!-- </template>-->
<!-- <template #action="{row}">-->
<!-- <Button type="link">更改班次</Button>-->
<!-- <Button type="link">休息</Button>-->
<!-- </template>-->
</Table>
<div class="item-font" style="width: 100%;">
<Table style="width: 100%" bordered :columns="weekdayColumns" :data-source="weekdayData"
size="small" :pagination="false">
<!-- <template #headerCell="{ column }">-->
<!-- </template>-->
<!-- <template #bodyCell="{ column, record }">-->
<!-- <template>-->
<!-- {{ record[column.field] }}-->
<!-- </template>-->
<!-- </template>-->
<!-- <template #action="{row}">-->
<!-- <Button type="link">更改班次</Button>-->
<!-- <Button type="link">休息</Button>-->
<!-- </template>-->
</Table>
<Checkbox class="item-padding-top" v-model:checked="settingData.isAutomatic">
法定节假日自动排休
</Checkbox>
<!-- https://timor.tech/api/holiday/year/2024 国务院节假日安排API-->
<Button type="link" @click="showHoliday">查看法定节假日日历</Button>
<p class="item-padding-top item-font-weight">特殊日期</p>
<p class="item-padding">无需打卡日期</p>
<Table style="width: 80%" bordered :columns="noClockingColumns" :data-source="[]"
size="small" :pagination="false">
</Table>
<p class="item-padding">必须打卡日期</p>
<Table style="width: 80%" bordered :columns="clockingColumns" :data-source="[]"
size="small" :pagination="false">
</Table>
</div>
</template>
<template #attendanceShift>
班次
<Button size="small">选择班次</Button>
</template>
<template #shiftData>
<Tag closable color="processing">早班</Tag>
</template>
<template #schedulingCycle>
周期
<span class="item-font">周期天数4天</span>
</template>
<template #cycleData>
<Table style="width: 100%" bordered :columns="cycleColumns" :data-source="[]"
size="small" :pagination="false">
</Table>
</template>
</BasicForm>
<HolidayCalendar></HolidayCalendar>
</BasicModal>
</template>
<style lang="scss" scoped>
.item-font {
font-size: 0.875rem;
}
.item-font-weight {
font-weight: 500;
}
.item-padding-top {
padding-top: 1.1rem;
}
.item-padding {
padding: 1.1rem 0 0.5rem 0;
}
</style>

View File

@@ -0,0 +1,78 @@
<script setup lang="ts">
import {ref, shallowRef} from 'vue';
import {useVbenModal} from '@vben/common-ui';
import dayjs, {type Dayjs} from 'dayjs';
import duration from 'dayjs/plugin/duration';
import relativeTime from 'dayjs/plugin/relativeTime';
dayjs.extend(duration);
dayjs.extend(relativeTime);
import type {HouseChargeVO} from "#/api/property/costManagement/houseCharge/model";
import {getHoliday} from "#/api/property/attendanceManagement/attendanceGroupSettings";
import {Calendar, Tag} from 'ant-design-vue'
import type {Holiday} from "#/api/property/attendanceManagement/attendanceGroupSettings/model";
const [BasicModal, modalApi] = useVbenModal({
onOpenChange: handleOpenChange,
onClosed() {
houseChargeDetail.value = null;
},
});
const houseChargeDetail = shallowRef<null | HouseChargeVO>(null);
const holidayData = ref<any>({})
async function handleOpenChange(open: boolean) {
if (!open) {
return null;
}
modalApi.modalLoading(true);
const res = await getHoliday(new Date().getFullYear());
holidayData.value = res.holiday
modalApi.modalLoading(false);
}
const day = ref<Holiday>();
const getListData = (value: Dayjs) => {
const date = value.format('MM-DD');
day.value = holidayData.value?.[date] ?? null;
return !!day.value;
};
const getMonthData = (value: Dayjs) => {
if (value.month() === 8) {
return 1394;
}
};
</script>
<template>
<BasicModal :footer="false" :fullscreen-button="false" title="法定节假日日历" class="w-[40%]">
<Calendar>
<template #dateCellRender="{ current }">
<div v-if="getListData(current)" style="height: 50px">
<Tag v-if="day.holiday" color="blue">
<span style="padding: 0 10px"></span>
</Tag>
<Tag v-else color="red">
<span style="padding: 0 10px"></span>
</Tag>
</div>
</template>
<template #monthCellRender="{ current }">
<div v-if="getMonthData(current)" class="notes-month">
<span>Backlog number</span>
</div>
</template>
</Calendar>
</BasicModal>
</template>
<style scoped lang="scss">
:deep(.ant-picker-calendar.ant-picker-calendar-full .ant-picker-calendar-date-content) {
height: 46px !important;
}
</style>

View File

@@ -17,6 +17,7 @@ import shiftModal from './shift-modal.vue';
import shiftDetail from './shift-detail.vue';
import { columns, querySchema } from './data';
import {TableSwitch} from "#/components/table";
import { $t } from '#/locales';
const formOptions: VbenFormProps = {
commonConfig: {

View File

@@ -3,15 +3,9 @@ import type {ShiftVO} from '#/api/property/attendanceManagement/shiftSetting/mod
import {shallowRef} from 'vue';
import {useVbenModal} from '@vben/common-ui';
import {Descriptions, DescriptionsItem} from 'ant-design-vue';
import dayjs from 'dayjs';
import duration from 'dayjs/plugin/duration';
import relativeTime from 'dayjs/plugin/relativeTime';
import {shiftInfo} from '#/api/property/attendanceManagement/shiftSetting';
import {renderDict} from "#/utils/render";
dayjs.extend(duration);
dayjs.extend(relativeTime);
const [BasicModal, modalApi] = useVbenModal({
onOpenChange: handleOpenChange,
onClosed() {
@@ -40,7 +34,7 @@ async function handleOpenChange(open: boolean) {
{{ shiftSettingDetail.name }}
</DescriptionsItem>
<DescriptionsItem label="考勤时间">
{{ shiftSettingDetail.startTime ? shiftSettingDetail.startTime + '-' + shiftSettingDetail.endTime : '-' }}
{{ shiftSettingDetail.startTime + '-' + shiftSettingDetail.endTime }}
</DescriptionsItem>
<DescriptionsItem label="是否休息">
{{ shiftSettingDetail.isRest===0 ? '不休息' : '休息' }}

View File

@@ -4,28 +4,23 @@ import dayjs from 'dayjs';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { shiftAdd, shiftInfo, shiftUpdate } from '#/api/property/attendanceManagement/shiftSetting';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
import {TimeRangePicker} from "ant-design-vue";
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: 100,
// 通用配置项 会影响到所有表单项
componentProps: {
class: 'w-full',
}
@@ -43,7 +38,6 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
);
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
@@ -54,16 +48,13 @@ const [BasicModal, modalApi] = useVbenModal({
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await shiftInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
@@ -75,7 +66,6 @@ async function handleConfirm() {
if (!valid) {
return;
}
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues());
data.startTime = dayjs(data.attendanceTimeRange[0]).format('HH:mm:ss');
data.endTime = dayjs(data.attendanceTimeRange[1]).format('HH:mm:ss');
@@ -86,7 +76,7 @@ async function handleConfirm() {
await (isUpdate.value ? shiftUpdate(data) : shiftAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
await modalApi.close();
} catch (error) {
console.error(error);
} finally {

View File

@@ -2,16 +2,14 @@
import { Radio, Select, Button, Table,Calendar } from 'ant-design-vue';
import type { RadioChangeEvent } from 'ant-design-vue';
import {ref} from 'vue';
import dayjs from 'dayjs';
import { Dayjs } from 'dayjs';
import { columns, querySchema } from './data';
import {
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
type VxeGridProps
} from '#/adapter/vxe-table';
import { getVxePopupContainer } from '@vben/utils';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import {
arrangementExport,
arrangementList,
@@ -22,11 +20,7 @@ import type { ArrangementForm } from '#/api/property/attendanceManagement/arrang
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
const emit = defineEmits<{(e:'changeView',value:boolean):void}>();
const props = defineProps<{
viewMode:'calender' | 'schedule'
}>();
@@ -40,25 +34,6 @@ function handleViewModeChange(e: RadioChangeEvent): void {
emit('changeView',e.target.value)
}
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: {
@@ -90,10 +65,23 @@ const gridOptions: VxeGridProps = {
keyField: 'id',
},
// 表格全局唯一表示 保存列配置需要用到
id: 'property-arrangement-index'
id: 'property-arrangement-index',
toolbarConfig: {
// 控制工具栏整体是否显示(默认显示)
show: true,
// 隐藏"刷新/重置"按钮(对应 redo
refresh: false,
// 隐藏"全屏"按钮
fullscreen: false,
// 隐藏"列设置"按钮(对应 setting
columns: false,
// 隐藏"表格尺寸"按钮(对应 size
size: undefined,
// 其他可能的按钮(如导出等,按需配置)
// export: false, // 如果有导出按钮,也可以隐藏
},
};
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
@@ -129,7 +117,7 @@ async function handleDelete(row: Required<ArrangementForm>) {
</div>
<div class="flex-1">
<Page :auto-content-height="true">
<BasicTable table-title="排班列表">
<BasicTable >
<template #action="{ row }">
<Space>
<ghost-button
@@ -162,4 +150,3 @@ async function handleDelete(row: Required<ArrangementForm>) {
</template>
<style>
</style>

View File

@@ -6,13 +6,11 @@ import {cloneDeep} from '@vben/utils';
import {useVbenForm} from '#/adapter/form';
import {
houseChargeAdd,
houseChargeInfo, houseChargeRefund,
houseChargeUpdate
} from '#/api/property/costManagement/houseCharge';
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
import {modalSchemaRefund, modalSchemaUpdate} from './data';
import {modalSchemaRefund} from './data';
import {renderDict} from "#/utils/render";
import {Descriptions, DescriptionsItem, Divider} from "ant-design-vue";
import type {HouseChargeVO} from "#/api/property/costManagement/houseCharge/model";
@@ -62,14 +60,15 @@ const [BasicModal, modalApi] = useVbenModal({
modalApi.modalLoading(true);
const {id} = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
record.value = await houseChargeInfo(id);
if (record.value) {
room.value = record.value.roomVo
costItem.value = record.value.costItemsVo
if(id){
record.value = await houseChargeInfo(id);
if (record.value) {
room.value = record.value.roomVo
costItem.value = record.value.costItemsVo
}
await formApi.setValues(record.value);
}
await formApi.setValues(record.value);
await markInitialized();
modalApi.modalLoading(false);
},
});
@@ -83,8 +82,8 @@ async function handleConfirm() {
}
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues());
data.costItemsId = record.value.costItemsId
data.personId = record.value.personId
data.costItemsId = record.value?.costItemsId
data.personId = record.value?.personId
await houseChargeRefund(data);
resetInitialized();
emit('reload');
@@ -123,7 +122,7 @@ async function handleClosed() {
{{ record.startTime }}
</DescriptionsItem>
<DescriptionsItem label="房间">
{{ room.roomNumber }}
{{ room?.roomNumber }}
</DescriptionsItem>
<DescriptionsItem label="面积(㎡)">
{{ `${room?.area} (套内面积:${room?.insideInArea}` }}

View File

@@ -71,6 +71,10 @@ const [BasicModal, modalApi] = useVbenModal({
if (isUpdate.value && id) {
const record = await meterInfoInfo(id);
record.meterType = record.meterType.toString();
record.meterUnit = record.meterUnit.toString();
record.runningState = record.runningState.toString();
record.communicationState = record.communicationState.toString();
await formApi.setValues(record);
}
await markInitialized();

View File

@@ -168,14 +168,19 @@ const updateTime = () => {
const initBarChart = () => {
if (!barChart.value) return
const chart = echarts.init(barChart.value)
const option = getThreeDBarOption({
xData: ['A区', 'B区', 'C区', 'D区'],
yData: [320, 452, 688, 400]
})
chart.setOption(option)
barChartInstance = chart
addChartToResizeManager(chart)
const myChart = echarts.init(barChart.value);
myChart.setOption({
tooltip: {},
xAxis: { data: ['A', 'B', 'C', 'D'] },
yAxis: {},
series: [
{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20],
},
],
});
}
// 初始化电力图表
@@ -601,6 +606,9 @@ onBeforeUnmount(() => {
min-height: unset;
margin: 0 auto;
}
.bar-chart{
}
}
.second{
height: 12rem;

View File

@@ -1,116 +0,0 @@
<script setup lang="ts">
import { ref } from 'vue'
import { cloneDeep } from '@vben/utils'
import { useVbenModal } from '@vben/common-ui'
import { useVbenForm } from '#/adapter/form'
import { queryByUnitId } from '#/api/property/floor'
import { refAdd, refQuery } from '#/api/sis/elevatorInfo'
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'
const dataForm = ref<any>()
const title = ref('楼层授权')
const [BasicForm, formApi] = useVbenForm({
// 所有表单项共用,可单独在表单内覆盖
commonConfig: {
// 默认占满两列
formItemClass: 'col-span-1',
// 所有表单项
componentProps: {
class: 'w-full',
},
},
layout: 'horizontal',
schema: [
{
component: 'CheckboxGroup',
componentProps: {
name: 'cname',
options: [],
},
defaultValue: [],
fieldName: 'floorNums',
label: '楼层'
}],
wrapperClass: 'grid-cols-1',
showDefaultActions: false
})
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[700px]',
fullscreenButton: false,
loading: true,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpened: handleInit,
})
function handleInit() {
dataForm.value = modalApi.getData()
const { unitId } = modalApi.getData()
queryByUnitId(unitId).then((res) => {
const arr: any[] = []
res.forEach((item) => {
arr.push({
label: item.floorName,
value: item.floorNumber,
})
})
formApi.updateSchema([
{
fieldName: 'floorNums',
componentProps: { options: arr },
}
])
handleChecked()
})
}
function handleChecked() {
const { elevatorId } = modalApi.getData()
refQuery(elevatorId).then((res) => {
const arr: any[] = []
res.forEach((item) => {
arr.push(item.floorNum)
})
formApi.setFieldValue('floorNums', arr)
}).finally(() => {
modalApi.setState({ loading: false });
})
}
const { resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
)
async function handleConfirm() {
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues())
const params = {
elevatorId: dataForm.value.elevatorId,
floorNums: data.floorNums
}
refAdd(params).finally(() => {
modalApi.close()
})
}
async function handleClosed() {
await formApi.resetForm()
resetInitialized()
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
</BasicModal>
</template>

View File

@@ -25,7 +25,6 @@ import { commonDownloadExcel } from '#/utils/file/download';
import elevatorInfoModal from './elevatorInfo-modal.vue';
import { columns, querySchema } from './data';
import floorAuthModal from './floorAuth-modal.vue';
const formOptions: VbenFormProps = {
commonConfig: {
@@ -89,10 +88,6 @@ const [ElevatorInfoModal, modalApi] = useVbenModal({
connectedComponent: elevatorInfoModal,
});
const [FloorAuthModal, floorAuthModalApi] = useVbenModal({
connectedComponent: floorAuthModal,
});
function handleAdd() {
modalApi.setData({});
modalApi.open();
@@ -128,11 +123,6 @@ function handleDownloadExcel() {
});
}
function handleAuth(row: Required<ElevatorInfoForm>) {
floorAuthModalApi.setData({ unitId: row.unitId, elevatorId: row.elevatorId });
floorAuthModalApi.open();
}
</script>
<template>
@@ -165,8 +155,6 @@ function handleAuth(row: Required<ElevatorInfoForm>) {
</template>
<template #action="{ row }">
<Space>
<ghost-button @click.stop="handleAuth(row)">楼层授权</ghost-button>
<ghost-button
v-access:code="['sis:elevatorInfo:edit']"
@click.stop="handleEdit(row)"
@@ -191,6 +179,5 @@ function handleAuth(row: Required<ElevatorInfoForm>) {
</template>
</BasicTable>
<ElevatorInfoModal @reload="tableApi.query()" />
<FloorAuthModal @reload="tableApi.query()" />
</Page>
</template>