Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
commit
fa30efb031
@ -59,7 +59,7 @@ export interface InspectionPlanVO {
|
||||
/**
|
||||
* 选择员工
|
||||
*/
|
||||
userId: string | number;
|
||||
userId: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
@ -74,20 +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 {
|
||||
@ -158,15 +160,15 @@ export interface InspectionPlanForm extends BaseEntity {
|
||||
/**
|
||||
* 巡检月
|
||||
*/
|
||||
inspectionMonth?:string;
|
||||
inspectionMonth?: string;
|
||||
/**
|
||||
* 巡检日
|
||||
*/
|
||||
inspectionDay?:string;
|
||||
inspectionDay?: string;
|
||||
/**
|
||||
* 巡检周
|
||||
*/
|
||||
inspectionWorkday?:string;
|
||||
inspectionWorkday?: string;
|
||||
|
||||
}
|
||||
|
||||
@ -233,13 +235,13 @@ export interface InspectionPlanQuery extends PageQuery {
|
||||
/**
|
||||
* 巡检月
|
||||
*/
|
||||
inspectionMonth?:string;
|
||||
inspectionMonth?: string;
|
||||
/**
|
||||
* 巡检日
|
||||
*/
|
||||
inspectionDay?:string;
|
||||
inspectionDay?: string;
|
||||
/**
|
||||
* 巡检周
|
||||
*/
|
||||
inspectionWorkday?:string;
|
||||
inspectionWorkday?: string;
|
||||
}
|
||||
|
@ -92,8 +92,7 @@ export interface PersonLibImgForm extends BaseEntity {
|
||||
imgUrl?: string;
|
||||
|
||||
/**
|
||||
* 性别 1:男
|
||||
2:女 99:未说明
|
||||
* 性别 1:男 2:女 99:未说明
|
||||
*/
|
||||
sex?: number;
|
||||
|
||||
@ -108,9 +107,7 @@ export interface PersonLibImgForm extends BaseEntity {
|
||||
tel?: string;
|
||||
|
||||
/**
|
||||
* 证件类型
|
||||
1:身份证 2:护照
|
||||
3:行驶证 99:其它
|
||||
* 证件类型、1:身份证 2:护照 3:行驶证 99:其它
|
||||
*/
|
||||
certificateType?: number;
|
||||
|
||||
@ -152,8 +149,7 @@ export interface PersonLibImgQuery extends PageQuery {
|
||||
imgUrl?: string;
|
||||
|
||||
/**
|
||||
* 性别 1:男
|
||||
2:女 99:未说明
|
||||
* 性别 1:男 2:女 99:未说明
|
||||
*/
|
||||
sex?: number;
|
||||
|
||||
@ -168,9 +164,7 @@ export interface PersonLibImgQuery extends PageQuery {
|
||||
tel?: string;
|
||||
|
||||
/**
|
||||
* 证件类型
|
||||
1:身份证 2:护照
|
||||
3:行驶证 99:其它
|
||||
* 证件类型 1:身份证 2:护照 3:行驶证 99:其它
|
||||
*/
|
||||
certificateType?: number;
|
||||
|
||||
|
@ -30,58 +30,13 @@ const localRoutes: RouteRecordStringComponent[] = [
|
||||
*/
|
||||
export const localMenuList: RouteRecordStringComponent[] = [
|
||||
{
|
||||
component: 'BasicLayout',
|
||||
name: 'Analytics',
|
||||
path: '/analytics',
|
||||
component: '/dashboard/analytics/index',
|
||||
meta: {
|
||||
order: -1,
|
||||
title: 'page.dashboard.title',
|
||||
// 不使用基础布局(仅在顶级生效)
|
||||
noBasicLayout: true,
|
||||
affixTab: true,
|
||||
title: '首页',
|
||||
},
|
||||
name: 'Dashboard',
|
||||
path: '/',
|
||||
redirect: '/analytics',
|
||||
children: [
|
||||
{
|
||||
name: 'Analytics',
|
||||
path: '/analytics',
|
||||
component: '/dashboard/analytics/index',
|
||||
meta: {
|
||||
affixTab: true,
|
||||
title: 'page.dashboard.analytics',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Workspace',
|
||||
path: '/workspace',
|
||||
component: '/dashboard/workspace/index',
|
||||
meta: {
|
||||
title: 'page.dashboard.workspace',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'VbenDocument',
|
||||
path: '/vben-admin/document',
|
||||
component: 'IFrameView',
|
||||
meta: {
|
||||
icon: 'lucide:book-open-text',
|
||||
iframeSrc: 'https://dapdap.top',
|
||||
keepAlive: true,
|
||||
title: $t('demos.vben.document'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'V5UpdateLog',
|
||||
path: '/changelog',
|
||||
component: '/演示使用自行删除/changelog/index',
|
||||
meta: {
|
||||
icon: 'lucide:book-open-text',
|
||||
keepAlive: true,
|
||||
title: '更新记录',
|
||||
badge: `当前: ${version}`,
|
||||
badgeVariants: 'bg-primary',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
component: '/_core/about/index',
|
||||
|
@ -67,6 +67,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
class: 'w-full',
|
||||
disabled: isReadonly.value,
|
||||
})),
|
||||
schema: modalSchema(isReadonly.value),
|
||||
},
|
||||
// 1. 使用正确的属性名 handleValuesChange
|
||||
handleValuesChange: async (values, fieldsChanged) => {
|
||||
@ -327,6 +328,8 @@ async function handleConfirm() {
|
||||
return;
|
||||
}
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
console.log(data);
|
||||
|
||||
// 单位数据缓存
|
||||
if (unitListData.length === 0) {
|
||||
const res = await resident_unitList();
|
||||
@ -340,10 +343,9 @@ async function handleConfirm() {
|
||||
data.name = cleanObj ? cleanObj.name : data.name || '';
|
||||
data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : '';
|
||||
data.sumPeices = Number(totalSumPeices.value)
|
||||
// data.sumPeices = parseInt(totalSumPeices.value, 10);
|
||||
// 组装 cleanIds
|
||||
// data.cleanIds = detailTable.value.map((item: any) => item.id);
|
||||
data.cleanList = detailTable.value;
|
||||
if (data.starTime) data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
if (data.endTime) data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
isUpdate.value ? await clean_orderUpdate({...data,id:editCleanOrderId.value}) : await clean_orderAdd(data);
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
|
@ -4,7 +4,7 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import { resident_unitList } from '#/api/property/resident/unit';
|
||||
import { useCleanStore } from '#/store';
|
||||
import type { FormSchema } from '../../../../../../../packages/@core/ui-kit/form-ui/src/types';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
const cleanStore = useCleanStore();
|
||||
|
||||
export const querySchema: (areaList: any[]) => FormSchema[] = (areaList) => [
|
||||
@ -131,7 +131,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
export const modalSchema: (isReadonly: boolean) => FormSchema[] = (isReadonly) => [
|
||||
{
|
||||
label: '主键id',
|
||||
fieldName: 'id',
|
||||
@ -163,12 +163,21 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
label: '结束时间',
|
||||
fieldName: 'endTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
componentProps: (values) => ({
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
placeholder: '请选择结束时间',
|
||||
},
|
||||
placeholder: !values.starTime?'请先选择开始时间':`请选择结束时间(结束时间不能早于开始时间)`,
|
||||
disabled: isReadonly || !values.starTime, // 没选开始时间时禁用
|
||||
disabledDate: (current:any) => {
|
||||
if (!values.starTime) return false;
|
||||
// 只允许选择大于等于开始时间的日期
|
||||
return current && current < dayjs(values.starTime).startOf('second');
|
||||
},
|
||||
}),
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
triggerFields: ['starTime'],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '申请人',
|
||||
|
@ -26,6 +26,9 @@ const title = computed(() => {
|
||||
let plantListData: any[] = [];
|
||||
const detailIndex = ref<number>();//传index对应详情的某条数据,对该条数据进行编辑修改
|
||||
|
||||
// 新增:接收已选产品id
|
||||
const selectedIds = ref<any[]>([]);
|
||||
|
||||
// 添加数量最大值
|
||||
const productNumMax = ref<any>(0);
|
||||
|
||||
@ -39,29 +42,9 @@ const detailSchema = [
|
||||
api: async () => {
|
||||
const res = await plantsProductList({state:1,inventory:0});
|
||||
plantListData = res.rows || [];
|
||||
|
||||
// 获取当前模态框的数据,包含已添加的产品列表
|
||||
const modalData = modalApi.getData();
|
||||
const existingProducts = modalData?.existingProducts || [];
|
||||
const currentProductId = modalData?.currentProductId;
|
||||
|
||||
// 过滤掉已经添加到产品列表中的产品
|
||||
// 如果是编辑模式,需要排除当前正在编辑的产品
|
||||
const filteredRows = res.rows.filter((item: any) => {
|
||||
// 如果是编辑模式且是当前正在编辑的产品,则保留
|
||||
if (currentProductId && item.id === currentProductId) {
|
||||
return true;
|
||||
}
|
||||
// 过滤掉已添加的产品
|
||||
return !existingProducts.some((existing: any) =>
|
||||
existing.productId === item.id || existing.id === item.id
|
||||
);
|
||||
});
|
||||
|
||||
return {
|
||||
...res,
|
||||
rows: filteredRows
|
||||
};
|
||||
// 过滤掉已选产品
|
||||
const filtered = plantListData.filter(item => !selectedIds.value.includes(item.id));
|
||||
return { ...res, rows: filtered };
|
||||
},
|
||||
resultField: 'rows',
|
||||
labelField: 'plantName',
|
||||
@ -104,6 +87,7 @@ const detailSchema = [
|
||||
componentProps: {
|
||||
min: 1,
|
||||
max: productNumMax,
|
||||
disabled: isView,
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
@ -219,19 +203,21 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
const data = modalApi.getData();
|
||||
detailIndex.value = modalApi.getData().index;
|
||||
if(!data || Object.keys(data).length === 0){
|
||||
//modalApi.getData()为空时表示添加
|
||||
isAdd.value = true;
|
||||
}else if(data.readonly){
|
||||
detailIndex.value = data.index;
|
||||
// 新增:弹窗打开时同步 selectedIds
|
||||
selectedIds.value = data.selectedIds || [];
|
||||
if(data.readonly){
|
||||
//不存在detailIndex.value时表示查看
|
||||
isView.value = true;
|
||||
} else if(data.add){
|
||||
//modalApi.getData()为空时表示添加
|
||||
isAdd.value = true;
|
||||
}else{
|
||||
//表示编辑
|
||||
isUpdate.value = true;
|
||||
}
|
||||
// TODO: 获取详情数据
|
||||
await formApi.setValues(modalApi.getData());
|
||||
await formApi.setValues(data);
|
||||
await markInitialized();
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
|
@ -29,10 +29,10 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 默认label宽度 px
|
||||
labelWidth: 120,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
componentProps: computed(() => ({
|
||||
class: 'w-full',
|
||||
disabled: isReadonly,
|
||||
},
|
||||
disabled: isReadonly.value,
|
||||
})),
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
@ -72,7 +72,6 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
// 后端返回绿植产品包列表结构处理
|
||||
// detailTable.value = record.productList.map((item:any) => {...item.product,item.productNum,});
|
||||
detailTable.value = record.productList.map((item: any) => ({ ...item.product, productNum: item.productNum,productId: item.productId }));
|
||||
// console.log(detailTable.value);
|
||||
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
@ -143,13 +142,12 @@ const detailColumns = [
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right' as const,
|
||||
width: 200,
|
||||
},
|
||||
];
|
||||
function handleAddDetail() {
|
||||
detailModalApi.setData({
|
||||
existingProducts: detailTable.value
|
||||
});
|
||||
// 传递已选产品id列表
|
||||
const selectedIds = detailTable.value.map((item: any) => item.productId || item.plantName);
|
||||
detailModalApi.setData({ selectedIds,add:true });
|
||||
detailModalApi.open();
|
||||
}
|
||||
//添加植物组合包产品
|
||||
@ -172,13 +170,9 @@ function handleViewDetail(record: any) {
|
||||
}
|
||||
// 编辑产品详情
|
||||
function handleEditDetail(record: any, index: number) {
|
||||
detailModalApi.setData({
|
||||
...record,
|
||||
index,
|
||||
readonly: false,
|
||||
existingProducts: detailTable.value.filter((item: any, i: number) => i !== index),
|
||||
currentProductId: record.productId || record.id
|
||||
});
|
||||
// 编辑时,排除当前项id
|
||||
const selectedIds = detailTable.value.filter((_: any, i: number) => i !== index).map((item: any) => item.productId || item.plantName);
|
||||
detailModalApi.setData({ ...record, index, selectedIds,edit:true });
|
||||
detailModalApi.open();
|
||||
}
|
||||
//分类字典
|
||||
|
@ -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>
|
||||
|
@ -37,11 +37,11 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'planName',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
title: '巡检路线',
|
||||
field: 'inspectionRouteId',
|
||||
width: 180,
|
||||
},
|
||||
// {
|
||||
// title: '巡检路线',
|
||||
// field: 'inspectionRouteId',
|
||||
// width: 180,
|
||||
// },
|
||||
{
|
||||
title: '巡检周期',
|
||||
field: 'inspectionPlanPeriod',
|
||||
|
@ -68,13 +68,15 @@ 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)
|
||||
}
|
||||
record.userId=record.userId?.split(',')
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
@ -95,17 +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]
|
||||
}
|
||||
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: any) => {
|
||||
data.inspectionPlanStaffBoList.push({
|
||||
userId: item,
|
||||
startTime: data.startDate,
|
||||
endTime: data.endDate
|
||||
})
|
||||
})
|
||||
}
|
||||
data.userId=data.userId?.join(',')
|
||||
await (isUpdate.value ? inspectionPlanUpdate(data) : inspectionPlanAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
@ -130,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([{
|
||||
@ -187,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,9 @@ const monthArr=Array.from({ length: 12 }, (_, i) => ({
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="巡检人员" :span="2">
|
||||
{{ inspectionPlanDetail.projectName }}
|
||||
<span style="margin-right: 10px;" v-for="item in inspectionPlanDetail.inspectionPlanStaffVoList">
|
||||
{{item.userName}}
|
||||
</span>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="备注" :span="2">
|
||||
{{ inspectionPlanDetail.remark }}
|
||||
|
@ -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:''
|
||||
}
|
||||
}
|
||||
];
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
@ -9,31 +9,29 @@ import { personLibList } from '#/api/sis/personLib';
|
||||
import type { PersonLibQuery, PersonLibVO } from '#/api/sis/personLib/model';
|
||||
|
||||
let libArr: PersonLibVO[] = [];
|
||||
const labelText: VbenFormSchema = {
|
||||
label: '图片库',
|
||||
fieldName: 'libId',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
resultField: 'list', // 根据API返回结构调整
|
||||
labelField: 'libName',
|
||||
valueField: 'id',
|
||||
// immediate: true,
|
||||
api: async () => {
|
||||
if (!libArr || libArr.length == 0) {
|
||||
const params: PersonLibQuery = {
|
||||
pageNum: 1,
|
||||
pageSize: 500,
|
||||
};
|
||||
const res = await personLibList(params);
|
||||
libArr = res.rows;
|
||||
}
|
||||
return libArr;
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '图片库',
|
||||
fieldName: 'libId',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
resultField: 'list', // 根据API返回结构调整
|
||||
labelField: 'libName',
|
||||
valueField: 'id',
|
||||
// immediate: true,
|
||||
api: async () => {
|
||||
if (!libArr || libArr.length == 0) {
|
||||
const params: PersonLibQuery = {
|
||||
pageNum: 1,
|
||||
pageSize: 500,
|
||||
};
|
||||
const res = await personLibList(params);
|
||||
libArr = res.rows;
|
||||
}
|
||||
return libArr;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
labelText,
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'imgName',
|
||||
@ -96,7 +94,30 @@ export const columns: VxeGridProps['columns'] = [
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
labelText,
|
||||
{
|
||||
label: '图片库',
|
||||
fieldName: 'libIds',
|
||||
component: 'ApiSelect',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
resultField: 'list', // 根据API返回结构调整
|
||||
labelField: 'libName',
|
||||
valueField: 'id',
|
||||
mode: 'multiple',
|
||||
// immediate: true,
|
||||
api: async () => {
|
||||
if (!libArr || libArr.length == 0) {
|
||||
const params: PersonLibQuery = {
|
||||
pageNum: 1,
|
||||
pageSize: 500,
|
||||
};
|
||||
const res = await personLibList(params);
|
||||
libArr = res.rows;
|
||||
}
|
||||
return libArr;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '人像名称',
|
||||
fieldName: 'imgName',
|
||||
|
@ -141,14 +141,14 @@ function accessControlAuth() {
|
||||
<BasicTable table-title="人像信息列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
<!-- <a-button
|
||||
type="primary"
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
v-access:code="['system:personLibImg:add']"
|
||||
@click="accessControlAuth"
|
||||
>
|
||||
门禁授权
|
||||
</a-button>
|
||||
</a-button> -->
|
||||
<a-button
|
||||
v-access:code="['system:personLibImg:export']"
|
||||
@click="handleDownloadExcel"
|
||||
|
Loading…
Reference in New Issue
Block a user