巡检路线
This commit is contained in:
parent
117b574410
commit
ed8fa0f5b4
@ -63,7 +63,6 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
];
|
||||
}
|
||||
record.status = record.status?.toString();
|
||||
console.log(record);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
|
@ -115,7 +115,6 @@ async function fetchOrderTyper() {
|
||||
const totalQuantity = board.value.satisfactionChartList.reduce((sum, item) => {
|
||||
return sum + Number(item.quantity || 0);
|
||||
}, 0);
|
||||
console.log(seriesData.value)
|
||||
renderOrderTyper({
|
||||
title: {text: '工单类型分类占比',left: '18px',top: '18px'},
|
||||
tooltip: {
|
||||
@ -127,7 +126,13 @@ async function fetchOrderTyper() {
|
||||
orient: 'vertical',
|
||||
icon: 'circle',
|
||||
itemWidth: 8,
|
||||
itemHeight: 8
|
||||
itemHeight: 8,
|
||||
formatter: (name) => {
|
||||
const dataItem = seriesData.value.find(item => item.name === name);
|
||||
const value = dataItem?.value || 0;
|
||||
const percentage = totalQuantity ? ((value / totalQuantity) * 100).toFixed(1) : 0;
|
||||
return `${name} ${percentage}% ${value}个`;
|
||||
},
|
||||
},
|
||||
series: [
|
||||
{
|
||||
|
@ -154,6 +154,6 @@ const handleUpdate = (dataSet) => {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InspectionRouteModal @reload="tableApi.query()" @update-data="handleUpdate"/>
|
||||
<InspectionRouteModal @update-data="handleUpdate"/>
|
||||
</Page>
|
||||
</template>
|
||||
|
@ -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>
|
||||
|
@ -2,7 +2,7 @@
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { inspectionRouteInfo } from '#/api/property/inspectionManagement/inspectionRoute';
|
||||
import dayjs from 'dayjs';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import {
|
||||
inspectionPointList,
|
||||
@ -34,6 +34,13 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
},
|
||||
);
|
||||
|
||||
const props = defineProps({
|
||||
pointList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
class: 'w-[550px]',
|
||||
fullscreenButton: false,
|
||||
@ -45,13 +52,14 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
const { row } = modalApi.getData() as { row?: number | string };
|
||||
isUpdate.value = !!row;
|
||||
await queryWorkOrdersType()
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await inspectionRouteInfo(id);
|
||||
await formApi.setValues(record);
|
||||
if (isUpdate.value && row ){
|
||||
row.startTime = dayjs(row.startTime)
|
||||
row.endTime = dayjs(row.endTime)
|
||||
console.log(row,456)
|
||||
await formApi.setValues(row);
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
@ -89,15 +97,26 @@ async function queryWorkOrdersType() {
|
||||
pageNum: 1
|
||||
}
|
||||
const res = await inspectionPointList(params)
|
||||
const options = res.rows.map((item) => ({
|
||||
let options = []
|
||||
if(isUpdate.value){
|
||||
options = res.rows.map((item) => ({
|
||||
label: item.pointName,
|
||||
value: item.id,
|
||||
}));
|
||||
}else{
|
||||
const existingIds = props.pointList.map(item => item.pointId);
|
||||
const filteredRows = res.rows.filter(item => !existingIds.includes(item.id));
|
||||
options = filteredRows.map((item) => ({
|
||||
label: item.pointName,
|
||||
value: item.id,
|
||||
}));
|
||||
}
|
||||
formApi.updateSchema([{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
showSearch: true,
|
||||
filterOption: filterOption,
|
||||
disabled: isUpdate.value,
|
||||
}),
|
||||
fieldName: 'pointId',
|
||||
}])
|
||||
|
Loading…
Reference in New Issue
Block a user