feat: 工单类型加部门名称
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import type {PageQuery, BaseEntity} from '#/api/common';
|
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||||
|
|
||||||
export interface WorkOrdersTypeVO {
|
export interface WorkOrdersTypeVO {
|
||||||
/**
|
/**
|
||||||
@@ -41,7 +41,10 @@ export interface WorkOrdersTypeVO {
|
|||||||
* 处理优先级
|
* 处理优先级
|
||||||
*/
|
*/
|
||||||
processingWeight: string;
|
processingWeight: string;
|
||||||
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
|
deptName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorkOrdersTypeForm extends BaseEntity {
|
export interface WorkOrdersTypeForm extends BaseEntity {
|
||||||
|
@@ -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 = () => [
|
||||||
// {
|
// {
|
||||||
@@ -34,7 +34,12 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
title: '类型名称',
|
title: '类型名称',
|
||||||
field: 'orderTypeName',
|
field: 'orderTypeName',
|
||||||
treeNode: true,
|
treeNode: true,
|
||||||
minWidth:180,
|
minWidth: 180,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '部门名称',
|
||||||
|
field: 'deptName',
|
||||||
|
width: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '运作模式',
|
title: '运作模式',
|
||||||
@@ -44,14 +49,16 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
return renderDict(row.operationMode, 'pro_operation_pattern');
|
return renderDict(row.operationMode, 'pro_operation_pattern');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
width:180,
|
width: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '处理优先级',
|
title: '处理优先级',
|
||||||
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,
|
||||||
@@ -59,12 +66,12 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
{
|
{
|
||||||
title: '排序值',
|
title: '排序值',
|
||||||
field: 'sort',
|
field: 'sort',
|
||||||
width:180,
|
width: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '累计工单数量',
|
title: '累计工单数量',
|
||||||
field: 'number',
|
field: 'number',
|
||||||
width:180,
|
width: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '是否支持转单',
|
title: '是否支持转单',
|
||||||
@@ -74,7 +81,7 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
return renderDict(row.isTransfers, 'support_transferring_orders');
|
return renderDict(row.isTransfers, 'support_transferring_orders');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
width:180,
|
width: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'action',
|
field: 'action',
|
||||||
@@ -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',
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type {WorkOrdersTypeVO} from '#/api/property/businessManagement/workOrdersType/model';
|
import type { WorkOrdersTypeVO } from '#/api/property/businessManagement/workOrdersType/model';
|
||||||
import {shallowRef} from 'vue';
|
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,
|
||||||
@@ -20,7 +20,7 @@ async function handleOpenChange(open: boolean) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
modalApi.modalLoading(true);
|
modalApi.modalLoading(true);
|
||||||
const {id} = modalApi.getData() as { id: number | string };
|
const { id } = modalApi.getData() as { id: number | string };
|
||||||
const response = await workOrdersTypeInfo(id);
|
const response = await workOrdersTypeInfo(id);
|
||||||
workOrdersTypeInfoDetail.value = response;
|
workOrdersTypeInfoDetail.value = response;
|
||||||
modalApi.modalLoading(false);
|
modalApi.modalLoading(false);
|
||||||
@@ -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="运作模式" >
|
<DescriptionsItem label="部门名称">
|
||||||
<component v-if="workOrdersTypeInfoDetail.operationMode!=null"
|
{{ workOrdersTypeInfoDetail.deptName }}
|
||||||
:is="renderDict(workOrdersTypeInfoDetail.operationMode,'pro_operation_pattern')"
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="运作模式">
|
||||||
|
<component
|
||||||
|
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>
|
||||||
|
@@ -1,16 +1,18 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
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,14 +30,14 @@ const [BasicForm, formApi] = useVbenForm({
|
|||||||
// 通用配置项 会影响到所有表单项
|
// 通用配置项 会影响到所有表单项
|
||||||
componentProps: {
|
componentProps: {
|
||||||
class: 'w-full',
|
class: 'w-full',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
schema: modalSchema(),
|
schema: modalSchema(),
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
wrapperClass: 'grid-cols-2',
|
wrapperClass: 'grid-cols-2',
|
||||||
});
|
});
|
||||||
|
|
||||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||||
{
|
{
|
||||||
initializedGetter: defaultFormValueGetter(formApi),
|
initializedGetter: defaultFormValueGetter(formApi),
|
||||||
currentGetter: defaultFormValueGetter(formApi),
|
currentGetter: defaultFormValueGetter(formApi),
|
||||||
@@ -54,9 +56,10 @@ const [BasicModal, modalApi] = useVbenModal({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
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();
|
||||||
@@ -72,13 +75,15 @@ const [BasicModal, modalApi] = useVbenModal({
|
|||||||
async function handleConfirm() {
|
async function handleConfirm() {
|
||||||
try {
|
try {
|
||||||
modalApi.lock(true);
|
modalApi.lock(true);
|
||||||
const {valid} = await formApi.validate();
|
const { valid } = await formApi.validate();
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 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();
|
||||||
@@ -94,29 +99,47 @@ async function handleClosed() {
|
|||||||
resetInitialized();
|
resetInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
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: () => ({
|
{
|
||||||
options: typeList,
|
componentProps: () => ({
|
||||||
showSearch: true,
|
options: typeList,
|
||||||
optionFilterProp: 'orderTypeName',
|
showSearch: true,
|
||||||
fieldNames: {label: 'orderTypeName', value: 'id'},
|
optionFilterProp: 'orderTypeName',
|
||||||
allowClear: true,
|
fieldNames: { label: 'orderTypeName', value: 'id' },
|
||||||
}),
|
allowClear: true,
|
||||||
fieldName: 'parentId',
|
}),
|
||||||
},
|
fieldName: 'parentId',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
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>
|
||||||
<BasicModal :title="title">
|
<BasicModal :title="title">
|
||||||
<BasicForm/>
|
<BasicForm />
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user