巡检路线
This commit is contained in:
@@ -7,7 +7,6 @@ import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
inspectionRouteAdd,
|
||||
inspectionRouteInfo,
|
||||
inspectionRouteList,
|
||||
inspectionRouteUpdate
|
||||
} from '#/api/property/inspectionManagement/inspectionRoute';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
@@ -62,11 +61,14 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (isUpdate.value && id) {
|
||||
const record = await inspectionRouteInfo(id);
|
||||
pointList.value = (record.inspectionRoutePointVoList || []).map(item => ({
|
||||
id: item.id,
|
||||
pointId: item.pointId ?? '',
|
||||
pointName: item.pointName ?? '',
|
||||
startTime: item.startTime ?? '',
|
||||
endTime: item.endTime ?? '',
|
||||
sort: item.sort ?? '',
|
||||
}));
|
||||
await tableApi.reload();
|
||||
console.log(pointList.value,111)
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
@@ -83,10 +85,10 @@ async function handleConfirm() {
|
||||
}
|
||||
let data = {
|
||||
...cloneDeep(await formApi.getValues()),
|
||||
inspectionRoutePointBoList:[pointData.value]
|
||||
inspectionRoutePointBoList:[...pointList.value]
|
||||
}
|
||||
console.log(data,333)
|
||||
await (isUpdate.value ? inspectionRouteUpdate(data) : inspectionRouteAdd(data));
|
||||
pointList.value = []
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
@@ -99,9 +101,11 @@ async function handleConfirm() {
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
pointList.value = []
|
||||
resetInitialized();
|
||||
}
|
||||
|
||||
const pointItem = ref([])
|
||||
async function queryWorkOrdersType() {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
@@ -112,6 +116,10 @@ async function queryWorkOrdersType() {
|
||||
label: item.pointName,
|
||||
value: item.id,
|
||||
}));
|
||||
pointItem.value = res.rows.map((item) => ({
|
||||
pointId: item.id,
|
||||
pointName: item.pointName,
|
||||
}));
|
||||
tableApi.formApi.updateSchema([{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
@@ -166,7 +174,6 @@ const gridOptions: VxeGridProps = {
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
@@ -180,15 +187,20 @@ function handleAdd() {
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<InspectionRouteForm>) {
|
||||
pointModalApi.setData({ id: row.id });
|
||||
pointModalApi.setData({ row });
|
||||
pointModalApi.open();
|
||||
}
|
||||
|
||||
const pointData = ref({})
|
||||
const handlePoint = (data) => {
|
||||
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;
|
||||
data.pointName = pointItem.value.find(item => item.pointId === data.pointId)?.pointName;
|
||||
const existingIndex = pointList.value.findIndex(item => item.pointId === data.pointId);
|
||||
if (existingIndex !== -1) {
|
||||
pointList.value[existingIndex] = data;
|
||||
} else {
|
||||
pointList.value.push(data);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -196,7 +208,7 @@ const handlePoint = (data) => {
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
<Page :auto-content-height="true" style="background-color: #F1F3F6">
|
||||
<BasicTable table-title="巡检点" :grid-options="gridOptions">
|
||||
<BasicTable table-title="巡检点" :grid-options="{ ...gridOptions, data: pointList, pagerConfig: { total: pointList.length } }">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
@@ -217,7 +229,7 @@ const handlePoint = (data) => {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<PointModal @reload="tableApi.query()" @update-data="handlePoint"/>
|
||||
<PointModal @reload="tableApi.query()" @update-data="handlePoint" :pointList="pointList"/>
|
||||
</Page>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user