feat: 完成巡检任务

This commit is contained in:
fyy
2025-07-15 16:12:11 +08:00
parent 1ed923c969
commit bd762452f8
7 changed files with 93 additions and 127 deletions

View File

@@ -1,41 +1,23 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'actInsTime',
label: '实际巡检时间',
labelWidth: 120,
},
{
component: 'Input',
fieldName: 'actUserId',
label: '当前巡检人',
},
// {
// component: 'Input',
// fieldName: 'actUserId',
// label: '当前巡检人',
// labelWidth: 160,
// },
{
component: 'Select',
componentProps: {
},
fieldName: 'taskType',
label: '巡检方式',
},
{
component: 'RadioGroup',
componentProps: {
buttonStyle: 'solid',
optionType: 'button',
options:getDictOptions('wy_xjzt')
},
fieldName: 'status',
label: '巡检状态',
labelWidth: 160,
},
];
@@ -56,50 +38,58 @@ export const columns: VxeGridProps['columns'] = [
{
title: '巡检计划',
field: 'planName',
width:'auto'
minWidth: 120,
},
{
title: '巡检开始日期',
field: 'startDate',
width:180
},
{
title: '巡检结束日期',
field: 'endDate',
width:180
},
{
title: '实际巡检时间',
field: 'actInsTime',
width:180
},
{
title: '当前巡检人',
field: 'actUserId',
width:'auto'
title: '巡检开始结束日期',
field: 'planInsTime',
minWidth:280
},
// {
// title: '当前巡检人',
// field: 'actUserId',
// width:'auto'
// },
{
title: '巡检方式',
field: 'taskType',
width:'auto'
width:'auto',
slots: {
default: ({ row }) => {
return renderDict(row.taskType, 'wy_xjqdfs');
},
},
},
{
title: '转移描述',
field: 'transferDesc',
width:200
width:200,
slots: {
default: ({ row }) => {
return row.transferDesc?row.transferDesc:'--';
},
},
},
{
title: '巡检状态',
field: 'status',
width:'auto',
slots: {
default: ({ row }) => {
return renderDict(row.status, 'wy_xjzt');
},
},
},
{
title: '备注',
field: 'remark',
width:'auto',
slots: {
default: ({ row }) => {
return row.remark?row.remark:'--';
},
},
},
{
field: 'action',
@@ -126,54 +116,45 @@ export const modalSchema: FormSchemaGetter = () => [
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',
label: '巡检开始结束日期',
fieldName: 'planInsTime',
component: 'Input',
},
// {
// label: '当前巡检人',
// fieldName: 'actUserId',
// component: 'Input',
// },
{
label: '巡检方式',
fieldName: 'taskType',
component: 'Select',
componentProps: {
options: getDictOptions('wy_xjqdfs'),
},
},
{
label: '转移描述',
fieldName: 'transferDesc',
component: 'Textarea',
componentProps:{
placeholder:''
}
},
{
label: '巡检状态',
fieldName: 'status',
component: 'RadioGroup',
component: 'Select',
componentProps: {
buttonStyle: 'solid',
optionType: 'button',
options: getDictOptions('wy_xjzt'),
},
},
{
label: '备注',
fieldName: 'remark',
component: 'Input',
componentProps:{
placeholder:''
}
}
];

View File

@@ -155,17 +155,17 @@ function handleDownloadExcel() {
</template>
<template #action="{ row }">
<Space>
<!-- <ghost-button
<ghost-button
v-access:code="['property:inspectionTask:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button> -->
>详情
</ghost-button>
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
v-if="row.status == 0 || row.status == 3"
>
<ghost-button
danger

View File

@@ -15,7 +15,7 @@ const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
return isUpdate.value ? '详情' : $t('pages.common.add');
});
const [BasicForm, formApi] = useVbenForm({
@@ -27,6 +27,7 @@ const [BasicForm, formApi] = useVbenForm({
// 通用配置项 会影响到所有表单项
componentProps: {
class: 'w-full',
disabled:true
}
},
schema: modalSchema(),
@@ -48,6 +49,7 @@ const [BasicModal, modalApi] = useVbenModal({
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
@@ -75,8 +77,8 @@ async function handleConfirm() {
return;
}
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? inspectionTaskUpdate(data) : inspectionTaskAdd(data));
// const data = cloneDeep(await formApi.getValues());
// await (isUpdate.value ? inspectionTaskUpdate(data) : inspectionTaskAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
@@ -98,4 +100,16 @@ async function handleClosed() {
<BasicForm />
</BasicModal>
</template>
<style scoped>
/* 使用 :deep() 穿透 scoped 样式,影响子组件 */
:deep(.ant-input[disabled]),
:deep(.ant-input-number-disabled .ant-input-number-input),
:deep(.ant-select-disabled .ant-select-selection-item),
:deep(.ant-picker-disabled .ant-picker-input > input) {
/* 设置一个更深的颜色 */
color: rgb(0 0 0 / 65%) !important;
/* 有些浏览器需要这个来覆盖默认颜色 */
-webkit-text-fill-color: rgb(0 0 0 / 65%) !important;
}
</style>