feat: 工单类型加部门名称

This commit is contained in:
fyy
2025-08-29 21:10:53 +08:00
parent e25ec2d703
commit 9404ed2d6e
4 changed files with 132 additions and 60 deletions

View File

@@ -41,7 +41,10 @@ export interface WorkOrdersTypeVO {
* 处理优先级 * 处理优先级
*/ */
processingWeight: string; processingWeight: string;
/**
* 部门名称
*/
deptName?: string;
} }
export interface WorkOrdersTypeForm extends BaseEntity { export interface WorkOrdersTypeForm extends BaseEntity {

View File

@@ -1,7 +1,7 @@
import type { FormSchemaGetter } from '#/adapter/form'; import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import {renderDict} from "#/utils/render"; import { renderDict } from '#/utils/render';
import {getDictOptions} from "#/utils/dict"; import { getDictOptions } from '#/utils/dict';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
// { // {
@@ -36,6 +36,11 @@ export const columns: VxeGridProps['columns'] = [
treeNode: true, treeNode: true,
minWidth: 180, minWidth: 180,
}, },
{
title: '部门名称',
field: 'deptName',
width: 180,
},
{ {
title: '运作模式', title: '运作模式',
field: 'operationMode', field: 'operationMode',
@@ -51,7 +56,9 @@ export const columns: VxeGridProps['columns'] = [
field: 'processingWeight', field: 'processingWeight',
slots: { slots: {
default: ({ row }) => { default: ({ row }) => {
return row.processingWeight!=null?renderDict(row.processingWeight, 'pro_processing_weight'):''; return row.processingWeight != null
? renderDict(row.processingWeight, 'pro_processing_weight')
: '';
}, },
}, },
width: 100, width: 100,
@@ -101,6 +108,12 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input', component: 'Input',
rules: 'required', rules: 'required',
}, },
{
label: '部门名称',
fieldName: 'deptId',
component: 'TreeSelect',
rules: 'required',
},
{ {
label: '父级类型', label: '父级类型',
fieldName: 'parentId', fieldName: 'parentId',

View File

@@ -4,7 +4,7 @@ import {shallowRef} from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { Descriptions, DescriptionsItem, Rate } from 'ant-design-vue'; import { Descriptions, DescriptionsItem, Rate } from 'ant-design-vue';
import { workOrdersTypeInfo } from '#/api/property/businessManagement/workOrdersType'; import { workOrdersTypeInfo } from '#/api/property/businessManagement/workOrdersType';
import {renderDict} from "#/utils/render"; import { renderDict } from '#/utils/render';
const [BasicModal, modalApi] = useVbenModal({ const [BasicModal, modalApi] = useVbenModal({
onOpenChange: handleOpenChange, onOpenChange: handleOpenChange,
@@ -28,23 +28,48 @@ async function handleOpenChange(open: boolean) {
</script> </script>
<template> <template>
<BasicModal :footer="false" :fullscreen-button="false" title="工单类型信息" class="w-[70%]"> <BasicModal
<Descriptions v-if="workOrdersTypeInfoDetail" size="small" :column="2" bordered :footer="false"
:labelStyle="{width:'120px'}"> :fullscreen-button="false"
title="工单类型信息"
class="w-[70%]"
>
<Descriptions
v-if="workOrdersTypeInfoDetail"
size="small"
:column="2"
bordered
:labelStyle="{ width: '120px' }"
>
<!-- <DescriptionsItem label="工单类型编号">--> <!-- <DescriptionsItem label="工单类型编号">-->
<!-- {{ workOrdersTypeInfoDetail.orderTypeNo }}--> <!-- {{ workOrdersTypeInfoDetail.orderTypeNo }}-->
<!-- </DescriptionsItem>--> <!-- </DescriptionsItem>-->
<DescriptionsItem label="类型名称"> <DescriptionsItem label="类型名称">
{{ workOrdersTypeInfoDetail.orderTypeName }} {{ workOrdersTypeInfoDetail.orderTypeName }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="部门名称">
{{ workOrdersTypeInfoDetail.deptName }}
</DescriptionsItem>
<DescriptionsItem label="运作模式"> <DescriptionsItem label="运作模式">
<component v-if="workOrdersTypeInfoDetail.operationMode!=null" <component
:is="renderDict(workOrdersTypeInfoDetail.operationMode,'pro_operation_pattern')" v-if="workOrdersTypeInfoDetail.operationMode != null"
:is="
renderDict(
workOrdersTypeInfoDetail.operationMode,
'pro_operation_pattern',
)
"
/> />
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="处理优先级"> <DescriptionsItem label="处理优先级">
<component v-if="workOrdersTypeInfoDetail.processingWeight!=null" <component
:is="renderDict(workOrdersTypeInfoDetail.processingWeight,'pro_processing_weight')" v-if="workOrdersTypeInfoDetail.processingWeight != null"
:is="
renderDict(
workOrdersTypeInfoDetail.processingWeight,
'pro_processing_weight',
)
"
/> />
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="排序值"> <DescriptionsItem label="排序值">
@@ -53,9 +78,17 @@ async function handleOpenChange(open: boolean) {
<DescriptionsItem label="累计工单数量"> <DescriptionsItem label="累计工单数量">
{{ workOrdersTypeInfoDetail.number }} {{ workOrdersTypeInfoDetail.number }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="是否支持转单" v-if="workOrdersTypeInfoDetail.isTransfers!=null"> <DescriptionsItem
label="是否支持转单"
v-if="workOrdersTypeInfoDetail.isTransfers != null"
>
<component <component
:is="renderDict(workOrdersTypeInfoDetail.isTransfers,'support_transferring_orders')" :is="
renderDict(
workOrdersTypeInfoDetail.isTransfers,
'support_transferring_orders',
)
"
/> />
</DescriptionsItem> </DescriptionsItem>
</Descriptions> </Descriptions>

View File

@@ -2,15 +2,17 @@
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import {cloneDeep} from '@vben/utils';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { import {
workOrdersTypeAdd, workOrdersTypeAdd,
workOrdersTypeInfo, workOrdersTypeListAll, workOrdersTypeInfo,
workOrdersTypeUpdate workOrdersTypeListAll,
workOrdersTypeUpdate,
} from '#/api/property/businessManagement/workOrdersType'; } from '#/api/property/businessManagement/workOrdersType';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data'; import { modalSchema } from './data';
import { addFullName, cloneDeep } from '@vben/utils';
import { getDeptTree } from '#/api/system/user';
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false); const isUpdate = ref(false);
@@ -28,7 +30,7 @@ const [BasicForm, formApi] = useVbenForm({
// 通用配置项 会影响到所有表单项 // 通用配置项 会影响到所有表单项
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
} },
}, },
schema: modalSchema(), schema: modalSchema(),
showDefaultActions: false, showDefaultActions: false,
@@ -56,7 +58,8 @@ const [BasicModal, modalApi] = useVbenModal({
modalApi.modalLoading(true); modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string }; const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id; isUpdate.value = !!id;
await initTypeOptions(id) await initTypeOptions(id);
await setupDeptSelect();
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await workOrdersTypeInfo(id); const record = await workOrdersTypeInfo(id);
record.operationMode = record.operationMode?.toString(); record.operationMode = record.operationMode?.toString();
@@ -78,7 +81,9 @@ async function handleConfirm() {
} }
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次 // getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? workOrdersTypeUpdate(data) : workOrdersTypeAdd(data)); await (isUpdate.value
? workOrdersTypeUpdate(data)
: workOrdersTypeAdd(data));
resetInitialized(); resetInitialized();
emit('reload'); emit('reload');
modalApi.close(); modalApi.close();
@@ -97,10 +102,11 @@ async function handleClosed() {
async function initTypeOptions(id: string) { async function initTypeOptions(id: string) {
let params = { let params = {
excludeId: id, excludeId: id,
filterSubNodes: true //过滤子级 filterSubNodes: true, //过滤子级
} };
const typeList = await workOrdersTypeListAll(params) const typeList = await workOrdersTypeListAll(params);
formApi.updateSchema([{ formApi.updateSchema([
{
componentProps: () => ({ componentProps: () => ({
options: typeList, options: typeList,
showSearch: true, showSearch: true,
@@ -112,6 +118,24 @@ async function initTypeOptions(id:string) {
}, },
]); ]);
} }
async function setupDeptSelect() {
const deptTree = await getDeptTree();
// 选中后显示在输入框的值 即父节点 / 子节点
addFullName(deptTree, 'label', ' / ');
formApi.updateSchema([
{
componentProps: {
fieldNames: { label: 'label', value: 'id' },
treeData: deptTree,
treeDefaultExpandAll: true,
treeLine: { showLeafIcon: false },
// 选中后显示在输入框的值
treeNodeLabelProp: 'fullName',
},
fieldName: 'deptId',
},
]);
}
</script> </script>
<template> <template>
@@ -119,4 +143,3 @@ async function initTypeOptions(id:string) {
<BasicForm /> <BasicForm />
</BasicModal> </BasicModal>
</template> </template>