This commit is contained in:
parent
1ed923c969
commit
8e361c6b59
@ -59,7 +59,7 @@ export interface InspectionPlanVO {
|
||||
/**
|
||||
* 选择员工
|
||||
*/
|
||||
userId: string | number;
|
||||
userId: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
@ -74,21 +74,22 @@ export interface InspectionPlanVO {
|
||||
/**
|
||||
* 巡检月
|
||||
*/
|
||||
inspectionMonth?:string;
|
||||
inspectionMonth?: string;
|
||||
/**
|
||||
* 巡检日
|
||||
*/
|
||||
inspectionDay?:string;
|
||||
inspectionDay?: string;
|
||||
/**
|
||||
* 巡检周
|
||||
*/
|
||||
inspectionWorkday?:string;
|
||||
inspectionWorkday?: string;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
state?:string
|
||||
state?: string
|
||||
|
||||
inspectionPlanStaffVoList?: any[]
|
||||
}
|
||||
|
||||
export interface InspectionPlanForm extends BaseEntity {
|
||||
@ -159,15 +160,15 @@ export interface InspectionPlanForm extends BaseEntity {
|
||||
/**
|
||||
* 巡检月
|
||||
*/
|
||||
inspectionMonth?:string;
|
||||
inspectionMonth?: string;
|
||||
/**
|
||||
* 巡检日
|
||||
*/
|
||||
inspectionDay?:string;
|
||||
inspectionDay?: string;
|
||||
/**
|
||||
* 巡检周
|
||||
*/
|
||||
inspectionWorkday?:string;
|
||||
inspectionWorkday?: string;
|
||||
|
||||
}
|
||||
|
||||
@ -234,13 +235,13 @@ export interface InspectionPlanQuery extends PageQuery {
|
||||
/**
|
||||
* 巡检月
|
||||
*/
|
||||
inspectionMonth?:string;
|
||||
inspectionMonth?: string;
|
||||
/**
|
||||
* 巡检日
|
||||
*/
|
||||
inspectionDay?:string;
|
||||
inspectionDay?: string;
|
||||
/**
|
||||
* 巡检周
|
||||
*/
|
||||
inspectionWorkday?:string;
|
||||
inspectionWorkday?: string;
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -68,14 +68,14 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (isUpdate.value && id) {
|
||||
const record = await inspectionPlanInfo(id);
|
||||
record.planDate = [record.startDate, record.endDate]
|
||||
if(record.inspectionPlanPeriod=='1'){
|
||||
record.inspectionMonth=record.inspectionMonth?.split(',')
|
||||
record.inspectionDay=record.inspectionDay?.split(',')
|
||||
}else {
|
||||
record.inspectionWorkday=record.inspectionWorkday?.split(',')
|
||||
if (record.inspectionPlanPeriod == '1') {
|
||||
record.inspectionMonth = record.inspectionMonth?.split(',')
|
||||
record.inspectionDay = record.inspectionDay?.split(',')
|
||||
} else {
|
||||
record.inspectionWorkday = record.inspectionWorkday?.split(',')
|
||||
}
|
||||
if(record.inspectionPlanStaffVoList&&record.inspectionPlanStaffVoList.length){
|
||||
record.userId=record.inspectionPlanStaffVoList.map(item=>item.userId)
|
||||
if (record.inspectionPlanStaffVoList && record.inspectionPlanStaffVoList.length) {
|
||||
record.userId = record.inspectionPlanStaffVoList.map(item => item.userId)
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
@ -97,28 +97,28 @@ async function handleConfirm() {
|
||||
if (data.planDate && data.planDate.length) {
|
||||
data.startDate = data.planDate[0]
|
||||
data.endDate = data.planDate[1]
|
||||
data.startTime=data.planDate[0]?.split(' ')[1]
|
||||
data.endTime=data.planDate[1]?.split(' ')[1]
|
||||
data.startTime = data.planDate[0]?.split(' ')[1]
|
||||
data.endTime = data.planDate[1]?.split(' ')[1]
|
||||
}
|
||||
if(data.inspectionPlanPeriod=='1'){
|
||||
data.inspectionMonth=data.inspectionMonth?.join(',')
|
||||
data.inspectionDay=data.inspectionDay?.join(',')
|
||||
data.inspectionWorkday=undefined
|
||||
}else {
|
||||
data.inspectionWorkday=data.inspectionWorkday?.join(',')
|
||||
data.inspectionMonth=undefined
|
||||
data.inspectionDay=undefined
|
||||
if (data.inspectionPlanPeriod == '1') {
|
||||
data.inspectionMonth = data.inspectionMonth?.join(',')
|
||||
data.inspectionDay = data.inspectionDay?.join(',')
|
||||
data.inspectionWorkday = undefined
|
||||
} else {
|
||||
data.inspectionWorkday = data.inspectionWorkday?.join(',')
|
||||
data.inspectionMonth = undefined
|
||||
data.inspectionDay = undefined
|
||||
}
|
||||
if(data.userId){
|
||||
data.inspectionPlanStaffBoList=[]
|
||||
data.userId.forEach(item=>
|
||||
if (data.userId) {
|
||||
data.inspectionPlanStaffBoList = []
|
||||
data.userId.forEach((item: any) => {
|
||||
data.inspectionPlanStaffBoList.push({
|
||||
userId:item,
|
||||
startTime:data.startDate,
|
||||
endTime:data.endDate
|
||||
}))
|
||||
userId: item,
|
||||
startTime: data.startDate,
|
||||
endTime: data.endDate
|
||||
})
|
||||
})
|
||||
}
|
||||
// data.userId=data.userId?.join(',')
|
||||
await (isUpdate.value ? inspectionPlanUpdate(data) : inspectionPlanAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
@ -143,7 +143,7 @@ async function queryPersonData() {
|
||||
const res = await personList(params);
|
||||
const options = res.rows.map((user) => ({
|
||||
label: user.userName + '-' + renderDictValue(user.gender, 'sys_user_sex')
|
||||
+ '-' + user.phone+'-'+user.unitName,
|
||||
+ '-' + user.phone + '-' + user.unitName,
|
||||
value: user.id,
|
||||
}));
|
||||
formApi.updateSchema([{
|
||||
@ -200,12 +200,13 @@ const filterOption = (input: string, option: any) => {
|
||||
<style lang="scss" scoped>
|
||||
.before-time {
|
||||
display: flex;
|
||||
|
||||
.tail-text {
|
||||
width: 100px;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
line-height:32px;
|
||||
line-height: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user