This commit is contained in:
parent
7d1c5357d8
commit
602e8951cc
@ -1,22 +1,13 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue';
|
import {onMounted, ref} from 'vue';
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { $t } from '@vben/locales';
|
|
||||||
import { cloneDeep } from '@vben/utils';
|
import { cloneDeep } from '@vben/utils';
|
||||||
import dayjs, { Dayjs } from 'dayjs';
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
import { attachAdd, attachInfo, attachUpdate } from '#/api/property/roomBooking/conferenceAddServices';
|
import { attachAdd, attachInfo, attachUpdate } from '#/api/property/roomBooking/conferenceAddServices';
|
||||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||||
|
|
||||||
import { modalSchema } from './data';
|
import { modalSchema } from './data';
|
||||||
import duration from "dayjs/plugin/duration";
|
|
||||||
import relativeTime from "dayjs/plugin/relativeTime";
|
|
||||||
dayjs.extend(duration);
|
|
||||||
dayjs.extend(relativeTime);
|
|
||||||
const emit = defineEmits<{ reload: [] }>();
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
|
|
||||||
const [BasicForm, formApi] = useVbenForm({
|
const [BasicForm, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
// 默认占满两列
|
// 默认占满两列
|
||||||
@ -41,31 +32,11 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const [BasicModal, modalApi] = useVbenModal({
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
// 在这里更改宽度
|
|
||||||
class: 'w-[60%]',
|
class: 'w-[60%]',
|
||||||
fullscreenButton: false,
|
fullscreenButton: false,
|
||||||
onBeforeClose,
|
onBeforeClose,
|
||||||
onClosed: handleClosed,
|
onClosed: handleClosed,
|
||||||
onConfirm: handleConfirm,
|
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 attachInfo(id);
|
|
||||||
record.unit = record.unit?.toString();
|
|
||||||
record.state = record.state?.toString();
|
|
||||||
await formApi.setValues(record);
|
|
||||||
}
|
|
||||||
await markInitialized();
|
|
||||||
|
|
||||||
modalApi.modalLoading(false);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
async function handleConfirm() {
|
async function handleConfirm() {
|
||||||
@ -77,7 +48,7 @@ async function handleConfirm() {
|
|||||||
}
|
}
|
||||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||||
const data = cloneDeep(await formApi.getValues());
|
const data = cloneDeep(await formApi.getValues());
|
||||||
await (isUpdate.value ? attachUpdate(data) : attachAdd(data));
|
await (attachAdd(data));
|
||||||
resetInitialized();
|
resetInitialized();
|
||||||
emit('reload');
|
emit('reload');
|
||||||
modalApi.close();
|
modalApi.close();
|
||||||
@ -93,8 +64,16 @@ async function handleClosed() {
|
|||||||
resetInitialized();
|
resetInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
const CRDetail = ref({
|
async function handleOpenChange() {
|
||||||
|
const { id } = modalApi.getData() as { id?: number };
|
||||||
|
if(id){
|
||||||
|
const response = await attachInfo(id);
|
||||||
|
conferenceReservationsDetail.value = response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(()=>{
|
||||||
|
handleOpenChange()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,21 +1,4 @@
|
|||||||
import type { FormSchemaGetter } from '#/adapter/form';
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||||||
import {getDictOptions} from "#/utils/dict";
|
|
||||||
|
|
||||||
export const querySchema: FormSchemaGetter = () => [
|
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'projectName',
|
|
||||||
label: '产品名称',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
options: getDictOptions('product_management_status'),
|
|
||||||
},
|
|
||||||
fieldName: 'state',
|
|
||||||
label: '状态',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export const modalSchema: FormSchemaGetter = () => [
|
export const modalSchema: FormSchemaGetter = () => [
|
||||||
{
|
{
|
||||||
@ -71,12 +54,12 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
component: 'Input',
|
component: 'Input',
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// label: '备注',
|
label: '备注',
|
||||||
// fieldName: 'price',
|
fieldName: 'price',
|
||||||
// component: 'Input',
|
component: 'Input',
|
||||||
// rules: 'required',
|
rules: 'required',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
label: '是否需要增值服务',
|
label: '是否需要增值服务',
|
||||||
fieldName: 'bookingParkingSpace',
|
fieldName: 'bookingParkingSpace',
|
||||||
|
@ -22,13 +22,13 @@
|
|||||||
<a-input placeholder="请输入" v-model:value="formState.username"/>
|
<a-input placeholder="请输入" v-model:value="formState.username"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item class="form-button">
|
<a-form-item class="form-button">
|
||||||
<a-button >重置</a-button>
|
<a-button @click="handleClean">重置</a-button>
|
||||||
<a-button type="primary" class="primary-button">搜索</a-button>
|
<a-button type="primary" class="primary-button" @click="handleSearch">搜索</a-button>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
<div class="card-box">
|
<div class="card-box">
|
||||||
<div v-for="(item,index) in meetingList" :key="index" class="card-list">
|
<div v-for="(item,index) in meetingList" :key="index" class="card-list">
|
||||||
<div><span class="card-title">{{ item.one }}</span><a-button class="card-button" type="primary" @click="handleAdd">去预约</a-button></div>
|
<div><span class="card-title">{{ item.one }}</span><a-button class="card-button" type="primary" @click="handleAdd(item.id)">去预约</a-button></div>
|
||||||
<div>容纳人数: {{ item.two }}人</div>
|
<div>容纳人数: {{ item.two }}人</div>
|
||||||
<div>基础费用: {{ item.three }}元</div>
|
<div>基础费用: {{ item.three }}元</div>
|
||||||
<div>基础设备: {{ item.four }}</div>
|
<div>基础设备: {{ item.four }}</div>
|
||||||
@ -52,6 +52,8 @@ import {
|
|||||||
RangePicker as ARangePicker
|
RangePicker as ARangePicker
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import conferenceAddServicesModal from '../conferenceReservations/conferenceReservations-modal.vue';
|
import conferenceAddServicesModal from '../conferenceReservations/conferenceReservations-modal.vue';
|
||||||
|
import {attachInfo} from "#/api/property/roomBooking/conferenceAddServices";
|
||||||
|
|
||||||
interface FormState {
|
interface FormState {
|
||||||
username: string;
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
@ -60,20 +62,35 @@ const formState = reactive<FormState>({
|
|||||||
username: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function handleSearch() {
|
||||||
|
const obj = {
|
||||||
|
...formState,
|
||||||
|
}
|
||||||
|
const response = await attachInfo(obj);
|
||||||
|
meetingList.value = response.rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleClean = () =>{
|
||||||
|
formState.username = '';
|
||||||
|
formState.password = '';
|
||||||
|
}
|
||||||
|
|
||||||
const [modal, modalApi] = useVbenModal({
|
const [modal, modalApi] = useVbenModal({
|
||||||
connectedComponent: conferenceAddServicesModal,
|
connectedComponent: conferenceAddServicesModal,
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
modalApi.setData({});
|
modalApi.setData({id: row.id});
|
||||||
modalApi.open();
|
modalApi.open();
|
||||||
}
|
}
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
console.log('Success:', values);
|
console.log('Success:', values);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFinishFailed = (errorInfo: any) => {
|
const onFinishFailed = (errorInfo: any) => {
|
||||||
console.log('Failed:', errorInfo);
|
console.log('Failed:', errorInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
const meetingList = ref([
|
const meetingList = ref([
|
||||||
{
|
{
|
||||||
one: '10楼1002会议室',
|
one: '10楼1002会议室',
|
||||||
|
Loading…
Reference in New Issue
Block a user