访客修改
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, ref, nextTick} from 'vue';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
@@ -38,6 +38,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
},
|
||||
);
|
||||
|
||||
const pointList = ref<any[]>([]);
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
class: 'w-[60%]',
|
||||
fullscreenButton: false,
|
||||
@@ -55,7 +56,17 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await inspectionRouteInfo(id);
|
||||
|
||||
pointList.value = record.inspectionRoutePointVoList || [];
|
||||
await nextTick();
|
||||
console.log(pointList.value,111)
|
||||
|
||||
await formApi.setValues(record);
|
||||
if (gridRef.value) {
|
||||
gridRef.value.reloadData(pointList.value);
|
||||
// 或者使用 proxy 方式
|
||||
// gridRef.value.commitProxy('reload');
|
||||
}
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
@@ -70,7 +81,11 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
let data = {
|
||||
...cloneDeep(await formApi.getValues()),
|
||||
inspectionRoutePointBoList:[pointData.value]
|
||||
}
|
||||
console.log(data,333)
|
||||
await (isUpdate.value ? inspectionRouteUpdate(data) : inspectionRouteAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
@@ -119,12 +134,9 @@ import {
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
inspectionRouteList,
|
||||
} from '#/api/property/inspectionManagement/inspectionRoute';
|
||||
import dayjs from 'dayjs';
|
||||
import type { InspectionRouteForm } from '#/api/property/inspectionManagement/inspectionRoute/model';
|
||||
import pointModal from './point-modal.vue';
|
||||
import pointModalSetting from './pointSetting-modal.vue';
|
||||
import { columnsPoint, querySchemaPoint } from './data';
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
@@ -144,20 +156,10 @@ const gridOptions: VxeGridProps = {
|
||||
reserve: true,
|
||||
},
|
||||
columns: columnsPoint,
|
||||
data: [],
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await inspectionRouteList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
@@ -173,34 +175,23 @@ const [PointModal, pointModalApi] = useVbenModal({
|
||||
connectedComponent: pointModal,
|
||||
});
|
||||
|
||||
const [PointModalSetting, pointModalSettingApi] = useVbenModal({
|
||||
connectedComponent: pointModalSetting,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
pointModalApi.setData({});
|
||||
pointModalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<InspectionRouteForm>) {
|
||||
pointModalSettingApi.setData({ id: row.id });
|
||||
pointModalSettingApi.open();
|
||||
pointModalApi.setData({ id: row.id });
|
||||
pointModalApi.open();
|
||||
}
|
||||
|
||||
const setData = ref({})
|
||||
const handleSet = (data) => {
|
||||
setData.value = data; // 更新父组件的数据源
|
||||
console.log(setData.value,111);
|
||||
};
|
||||
const pointData = ref({})
|
||||
const handlePoint = (data) => {
|
||||
pointData.value = data; // 更新父组件的数据源
|
||||
console.log(pointData.value,222);
|
||||
data.startTime = dayjs(data.startTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
pointData.value = data;
|
||||
|
||||
};
|
||||
// const allDate = {
|
||||
// ...pointData,
|
||||
// ...setData
|
||||
// }
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -229,7 +220,6 @@ const handlePoint = (data) => {
|
||||
</template>
|
||||
</BasicTable>
|
||||
<PointModal @reload="tableApi.query()" @update-data="handlePoint"/>
|
||||
<PointModalSetting @reload="tableApi.query()" @update-data="handleSet"/>
|
||||
</Page>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user