This commit is contained in:
parent
1ed923c969
commit
8e361c6b59
@ -59,7 +59,7 @@ export interface InspectionPlanVO {
|
|||||||
/**
|
/**
|
||||||
* 选择员工
|
* 选择员工
|
||||||
*/
|
*/
|
||||||
userId: string | number;
|
userId: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
@ -89,6 +89,7 @@ export interface InspectionPlanVO {
|
|||||||
*/
|
*/
|
||||||
state?: string
|
state?: string
|
||||||
|
|
||||||
|
inspectionPlanStaffVoList?: any[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InspectionPlanForm extends BaseEntity {
|
export interface InspectionPlanForm extends BaseEntity {
|
||||||
|
@ -0,0 +1,160 @@
|
|||||||
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||||||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
import {renderDict} from "#/utils/render";
|
||||||
|
import {getDictOptions} from "#/utils/dict";
|
||||||
|
|
||||||
|
1
|
||||||
|
|
||||||
|
|
||||||
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'actUserId',
|
||||||
|
label: '当前巡检人',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options:getDictOptions('wy_xjqdfs')
|
||||||
|
},
|
||||||
|
fieldName: 'taskType',
|
||||||
|
label: '巡检方式',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const columns: VxeGridProps['columns'] = [
|
||||||
|
{ type: 'checkbox', width: 60 },
|
||||||
|
{
|
||||||
|
title: '任务编号',
|
||||||
|
field: 'id',
|
||||||
|
width:'auto'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '巡检计划',
|
||||||
|
field: 'planName',
|
||||||
|
minWidth:200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '巡检时间范围',
|
||||||
|
field: 'planInsTime',
|
||||||
|
width:'auto'
|
||||||
|
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '实际巡检时间',
|
||||||
|
// field: 'endDate',
|
||||||
|
// width:180
|
||||||
|
//
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '签到状态',
|
||||||
|
field: 'actInsTime',
|
||||||
|
width:150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '巡检人',
|
||||||
|
field: 'planUserName',
|
||||||
|
width:'auto'
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '巡检方式',
|
||||||
|
field: 'taskType',
|
||||||
|
width:'auto',
|
||||||
|
slots: {
|
||||||
|
default: ({ row }) => {
|
||||||
|
return renderDict(row.taskType, 'wy_xjqdfs');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '巡检状态',
|
||||||
|
field: 'status',
|
||||||
|
width:100,
|
||||||
|
slots: {
|
||||||
|
default: ({ row }) => {
|
||||||
|
return renderDict(row.taskType, 'wy_xjqdfs');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '巡检照片',
|
||||||
|
field: 'remark',
|
||||||
|
width:120
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// field: 'action',
|
||||||
|
// fixed: 'right',
|
||||||
|
// slots: { default: 'action' },
|
||||||
|
// title: '操作',
|
||||||
|
// width: 120,
|
||||||
|
// },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const modalSchema: FormSchemaGetter = () => [
|
||||||
|
{
|
||||||
|
label: '主键id',
|
||||||
|
fieldName: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
dependencies: {
|
||||||
|
show: () => false,
|
||||||
|
triggerFields: [''],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '巡检计划',
|
||||||
|
fieldName: 'planName',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '巡检开始日期',
|
||||||
|
fieldName: 'startDate',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '巡检结束日期',
|
||||||
|
fieldName: 'endDate',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '实际巡检时间',
|
||||||
|
fieldName: 'actInsTime',
|
||||||
|
component: 'DatePicker',
|
||||||
|
componentProps: {
|
||||||
|
showTime: true,
|
||||||
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '当前巡检人',
|
||||||
|
fieldName: 'actUserId',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '巡检方式',
|
||||||
|
fieldName: 'taskType',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '转移描述',
|
||||||
|
fieldName: 'transferDesc',
|
||||||
|
component: 'Textarea',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '巡检状态',
|
||||||
|
fieldName: 'status',
|
||||||
|
component: 'RadioGroup',
|
||||||
|
componentProps: {
|
||||||
|
buttonStyle: 'solid',
|
||||||
|
optionType: 'button',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '备注',
|
||||||
|
fieldName: 'remark',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
];
|
@ -0,0 +1,113 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import {Page, useVbenModal, type VbenFormProps} from '@vben/common-ui';
|
||||||
|
|
||||||
|
import {Space} from 'ant-design-vue';
|
||||||
|
|
||||||
|
import {
|
||||||
|
useVbenVxeGrid,
|
||||||
|
type VxeGridProps
|
||||||
|
} from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import {
|
||||||
|
inspectionTaskExport,
|
||||||
|
inspectionTaskList,
|
||||||
|
} from '#/api/property/inspectionManagement/inspectionTask';
|
||||||
|
import type {InspectionTaskForm} from '#/api/property/inspectionManagement/inspectionTask/model';
|
||||||
|
import {commonDownloadExcel} from '#/utils/file/download';
|
||||||
|
|
||||||
|
import inspectionDetailsModal from './inspectionDetails-modal.vue';
|
||||||
|
import {columns, querySchema} from './data';
|
||||||
|
|
||||||
|
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',
|
||||||
|
};
|
||||||
|
|
||||||
|
const gridOptions: VxeGridProps = {
|
||||||
|
checkboxConfig: {
|
||||||
|
// 高亮
|
||||||
|
highlight: true,
|
||||||
|
// 翻页时保留选中状态
|
||||||
|
reserve: true,
|
||||||
|
// 点击行选中
|
||||||
|
// trigger: 'row',
|
||||||
|
},
|
||||||
|
|
||||||
|
columns,
|
||||||
|
height: 'auto',
|
||||||
|
keepSource: true,
|
||||||
|
pagerConfig: {},
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async ({page}, formValues = {}) => {
|
||||||
|
return await inspectionTaskList({
|
||||||
|
pageNum: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
},
|
||||||
|
// 表格全局唯一表示 保存列配置需要用到
|
||||||
|
id: 'property-inspectionDetails-index'
|
||||||
|
};
|
||||||
|
|
||||||
|
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||||
|
formOptions,
|
||||||
|
gridOptions,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [InspectionDetailsModal, modalApi] = useVbenModal({
|
||||||
|
connectedComponent: inspectionDetailsModal,
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handInfo(row: Required<InspectionTaskForm>) {
|
||||||
|
detailApi.setData({id: row.id});
|
||||||
|
detailApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDownloadExcel() {
|
||||||
|
commonDownloadExcel(inspectionTaskExport, '巡检任务数据', tableApi.formApi.form.values, {
|
||||||
|
fieldMappingTime: formOptions.fieldMappingTime,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Page :auto-content-height="true">
|
||||||
|
<BasicTable table-title="巡检明细列表">
|
||||||
|
<template #toolbar-tools>
|
||||||
|
<Space>
|
||||||
|
<a-button
|
||||||
|
v-access:code="['property:inspectionTask:export']"
|
||||||
|
@click="handleDownloadExcel"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.export') }}
|
||||||
|
</a-button>
|
||||||
|
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<!-- <Space>-->
|
||||||
|
<!-- <ghost-button-->
|
||||||
|
<!-- v-access:code="['property:inspectionTask:info']"-->
|
||||||
|
<!-- @click.stop="handInfo(row)"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- {{ $t('pages.common.info') }}-->
|
||||||
|
<!-- </ghost-button>-->
|
||||||
|
<!-- </Space>-->
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<InspectionDetailsModal @reload="tableApi.query()"/>
|
||||||
|
</Page>
|
||||||
|
</template>
|
@ -0,0 +1,101 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
import { $t } from '@vben/locales';
|
||||||
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
|
import { useVbenForm } from '#/adapter/form';
|
||||||
|
import { inspectionTaskAdd, inspectionTaskInfo, inspectionTaskUpdate } from '#/api/property/inspectionManagement/inspectionTask';
|
||||||
|
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||||
|
|
||||||
|
import { modalSchema } from './data';
|
||||||
|
|
||||||
|
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: 80,
|
||||||
|
// 通用配置项 会影响到所有表单项
|
||||||
|
componentProps: {
|
||||||
|
class: 'w-full',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
schema: modalSchema(),
|
||||||
|
showDefaultActions: false,
|
||||||
|
wrapperClass: 'grid-cols-2',
|
||||||
|
});
|
||||||
|
|
||||||
|
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||||
|
{
|
||||||
|
initializedGetter: defaultFormValueGetter(formApi),
|
||||||
|
currentGetter: defaultFormValueGetter(formApi),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
|
// 在这里更改宽度
|
||||||
|
class: 'w-[550px]',
|
||||||
|
fullscreenButton: false,
|
||||||
|
onBeforeClose,
|
||||||
|
onClosed: handleClosed,
|
||||||
|
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 inspectionTaskInfo(id);
|
||||||
|
await formApi.setValues(record);
|
||||||
|
}
|
||||||
|
await markInitialized();
|
||||||
|
|
||||||
|
modalApi.modalLoading(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleConfirm() {
|
||||||
|
try {
|
||||||
|
modalApi.lock(true);
|
||||||
|
const { valid } = await formApi.validate();
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||||
|
const data = cloneDeep(await formApi.getValues());
|
||||||
|
await (isUpdate.value ? inspectionTaskUpdate(data) : inspectionTaskAdd(data));
|
||||||
|
resetInitialized();
|
||||||
|
emit('reload');
|
||||||
|
modalApi.close();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
modalApi.lock(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleClosed() {
|
||||||
|
await formApi.resetForm();
|
||||||
|
resetInitialized();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<BasicModal :title="title">
|
||||||
|
<BasicForm />
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
|
@ -111,14 +111,14 @@ async function handleConfirm() {
|
|||||||
}
|
}
|
||||||
if (data.userId) {
|
if (data.userId) {
|
||||||
data.inspectionPlanStaffBoList = []
|
data.inspectionPlanStaffBoList = []
|
||||||
data.userId.forEach(item=>
|
data.userId.forEach((item: any) => {
|
||||||
data.inspectionPlanStaffBoList.push({
|
data.inspectionPlanStaffBoList.push({
|
||||||
userId: item,
|
userId: item,
|
||||||
startTime: data.startDate,
|
startTime: data.startDate,
|
||||||
endTime: data.endDate
|
endTime: data.endDate
|
||||||
}))
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
// data.userId=data.userId?.join(',')
|
|
||||||
await (isUpdate.value ? inspectionPlanUpdate(data) : inspectionPlanAdd(data));
|
await (isUpdate.value ? inspectionPlanUpdate(data) : inspectionPlanAdd(data));
|
||||||
resetInitialized();
|
resetInitialized();
|
||||||
emit('reload');
|
emit('reload');
|
||||||
@ -200,6 +200,7 @@ const filterOption = (input: string, option: any) => {
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.before-time {
|
.before-time {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
.tail-text {
|
.tail-text {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
|
Loading…
Reference in New Issue
Block a user