1、工单类型
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
2025-07-09 15:03:17 +08:00
parent fb963ff3a7
commit 482d4b9199
7 changed files with 670 additions and 120 deletions

View File

@@ -1,5 +1,7 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
import {renderDict} from "#/utils/render";
import {getDictOptions} from "#/utils/dict";
export const querySchema: FormSchemaGetter = () => [
@@ -15,146 +17,101 @@ export const querySchema: FormSchemaGetter = () => [
},
{
component: 'Select',
componentProps: {
},
componentProps: {},
fieldName: 'type',
label: '工单类型',
},
{
component: 'RadioGroup',
component: 'Select',
componentProps: {
buttonStyle: 'solid',
optionType: 'button',
options: getDictOptions('wy_gdclzt'),
},
fieldName: 'status',
label: '状态',
},
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'dispatchTime',
label: '派单时间',
},
{
component: 'Input',
fieldName: 'initiatorName',
label: '发起人姓名',
},
{
component: 'Input',
fieldName: 'initiatorPhone',
label: '发起人手机号',
},
{
component: 'Input',
fieldName: 'handler',
label: '处理人姓名',
},
{
component: 'Input',
fieldName: 'location',
label: '地址',
},
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'planCompleTime',
label: '计划完成时间',
},
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'compleTime',
label: '完成时间',
},
{
component: 'Input',
fieldName: 'serviceEvalua',
label: '评价',
},
{
component: 'Input',
fieldName: 'isTimeOut',
label: '是否超时',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: 'id',
field: 'id',
},
{type: 'checkbox', width: 60},
{
title: '工单编号',
field: 'orderNo',
width: 180,
},
{
title: '工单名称',
field: 'orderName',
minWidth: 180,
},
{
title: '工单类型',
field: 'type',
slots: {
default: ({row}) => {
return renderDict(row.type, 'wy_gdlx');
},
},
width: 100,
},
{
title: '状态',
field: 'status',
slots: {
default: ({row}) => {
return renderDict(row.status, 'wy_gdclzt');
},
},
width: 100,
},
{
title: '派单时间',
field: 'dispatchTime',
width: 100,
},
{
title: '发起人姓名',
field: 'initiatorName',
width: 100,
},
{
title: '发起人手机号',
field: 'initiatorPhone',
width: 100,
},
{
title: '处理人姓名',
field: 'handler',
width: 100,
},
{
title: '地址',
field: 'location',
width: 100,
},
{
title: '计划完成时间',
field: 'planCompleTime',
width: 100,
},
{
title: '完成时间',
field: 'compleTime',
width: 100,
},
{
title: '评价',
field: 'serviceEvalua',
width: 100,
},
{
title: '是否超时',
field: 'isTimeOut',
width: 100,
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
slots: {default: 'action'},
title: '操作',
width: 180,
},
@@ -170,11 +127,6 @@ export const modalSchema: FormSchemaGetter = () => [
triggerFields: [''],
},
},
{
label: '工单编号',
fieldName: 'orderNo',
component: 'Input',
},
{
label: '工单名称',
fieldName: 'orderName',
@@ -185,20 +137,19 @@ export const modalSchema: FormSchemaGetter = () => [
label: '工单类型',
fieldName: 'type',
component: 'Select',
componentProps: {
},
rules: 'selectRequired',
},
{
label: '状态',
fieldName: 'status',
component: 'RadioGroup',
componentProps: {
buttonStyle: 'solid',
optionType: 'button',
},
componentProps: {},
rules: 'selectRequired',
},
// {
// label: '状态',
// fieldName: 'status',
// component: 'RadioGroup',
// componentProps: {
// buttonStyle: 'solid',
// optionType: 'button',
// },
// rules: 'selectRequired',
// },
{
label: '派单时间',
fieldName: 'dispatchTime',
@@ -208,27 +159,34 @@ export const modalSchema: FormSchemaGetter = () => [
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules: 'required',
rules: 'selectRequired',
},
{
label: '发起人姓名',
label: '发起人',
fieldName: 'initiatorName',
component: 'Input',
component: 'ApiSelect',
formItemClass: 'col-span-2',
rules: 'selectRequired',
},
// {
// label: '发起人手机号',
// fieldName: 'initiatorPhone',
// component: 'Input',
// },
{
label: '发起人手机号',
fieldName: 'initiatorPhone',
component: 'Input',
},
{
label: '处理人姓名',
label: '处理人',
fieldName: 'handler',
component: 'Input',
component: 'ApiSelect',
formItemClass: 'col-span-2',
rules: 'selectRequired',
},
{
label: '地址',
label: '具体位置',
fieldName: 'location',
component: 'Input',
formItemClass: 'col-span-2',
rules: 'selectRequired',
},
{
label: '计划完成时间',
@@ -239,6 +197,8 @@ export const modalSchema: FormSchemaGetter = () => [
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
labelWidth: 110,
rules: 'selectRequired',
},
{
label: '完成时间',
@@ -249,15 +209,22 @@ export const modalSchema: FormSchemaGetter = () => [
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules: 'selectRequired',
},
{
label: '评价',
fieldName: 'serviceEvalua',
component: 'Input',
component: 'Rate',
rules: 'required',
},
{
label: '是否超时',
fieldName: 'isTimeOut',
component: 'Input',
component: 'RadioGroup',
componentProps: {
buttonStyle: 'solid',
options: getDictOptions('wy_sf'),
},
rules: 'selectRequired',
},
];

View File

@@ -1,15 +1,21 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import {computed, ref} from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import {useVbenModal} from '@vben/common-ui';
import {$t} from '@vben/locales';
import {cloneDeep} from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { workOrdersAdd, workOrdersInfo, workOrdersUpdate } from '#/api/property/businessManagement/workOrders';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import {useVbenForm} from '#/adapter/form';
import {
workOrdersAdd,
workOrdersInfo,
workOrdersUpdate
} from '#/api/property/businessManagement/workOrders';
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
import { modalSchema } from './data';
import {modalSchema} from './data';
import {personList} from "#/api/property/resident/person";
import {renderDictValue} from "#/utils/render";
const emit = defineEmits<{ reload: [] }>();
@@ -21,7 +27,7 @@ const title = computed(() => {
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
// 默认占满两列
formItemClass: 'col-span-2',
formItemClass: 'col-span-1',
// 默认label宽度 px
labelWidth: 80,
// 通用配置项 会影响到所有表单项
@@ -34,7 +40,7 @@ const [BasicForm, formApi] = useVbenForm({
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
@@ -43,7 +49,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[550px]',
class: 'w-[70%]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
@@ -53,8 +59,8 @@ const [BasicModal, modalApi] = useVbenModal({
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
await queryPersonData()
const {id} = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
@@ -70,7 +76,7 @@ const [BasicModal, modalApi] = useVbenModal({
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
const {valid} = await formApi.validate();
if (!valid) {
return;
}
@@ -91,11 +97,42 @@ async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
async function queryPersonData() {
let params = {
pageSize: 1000,
pageNum: 1,
}
const res = await personList(params);
const options = res.rows.map((user) => ({
label: user.userName + '-' + renderDictValue(user.gender, 'sys_user_sex') + '-' + user.phone,
value: user.id,
}));
formApi.updateSchema([{
componentProps: () => ({
options: options,
filterOption: filterOption
}),
fieldName: 'initiatorName',
},
{
componentProps: () => ({
options: options,
filterOption: filterOption
}),
fieldName: 'handler',
}])
}
const filterOption = (input: string, option: any) => {
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
};
</script>
<template>
<BasicModal :title="title">
<BasicForm />
<BasicForm/>
</BasicModal>
</template>