From 7c1ed5b09faa760292cdd47441ade8a16099d8b8 Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期一, 14 九月 2026 15:28:39 +0800
Subject: [PATCH] feat: 售后工单按条绑定部门与原因类型;新增加班工资管理;员工附件留档

---
 src/views/aftersales/ticket/data.ts |   95 +++++++++++++++++++++++++++++------------------
 1 files changed, 58 insertions(+), 37 deletions(-)

diff --git a/src/views/aftersales/ticket/data.ts b/src/views/aftersales/ticket/data.ts
index 15c83cc..0a27a78 100644
--- a/src/views/aftersales/ticket/data.ts
+++ b/src/views/aftersales/ticket/data.ts
@@ -12,10 +12,11 @@
 
 import { z } from '#/adapter/form';
 import CrmCustomerSelect from '#/components/crm-customer-select.vue';
-import { ErpSaleOrderSelect } from '#/views/erp/sale/order/components';
 import { MdItemSelect } from '#/views/mes/md/item/components';
 import { WmBatchSelect } from '#/views/wls/batch/components';
 import { UserSelect } from '#/views/system/user/components';
+import { getDeptList } from '#/api/system/dept';
+import { handleTree } from '#/packages/utils/src';
 
 /** 琛ㄥ崟绫诲瀷 */
 export type TicketFormType = 'create' | 'detail' | 'update';
@@ -40,11 +41,7 @@
 }
 
 /** 宸ュ崟琛ㄥ崟 */
-export function useTicketFormSchema(
-  formType: TicketFormType,
-  formApi?: VbenFormApi,
-  onSaleOrderChange?: (order: Record<string, unknown> | undefined) => void,
-): VbenFormSchema[] {
+export function useTicketFormSchema(formType: TicketFormType): VbenFormSchema[] {
   const readonly = isHeaderReadonly(formType);
   return [
     {
@@ -71,32 +68,6 @@
         placeholder: '璇疯緭鍏ュ伐鍗曚富棰�',
       },
       rules: 'required',
-    },
-    {
-      fieldName: 'saleOrderId',
-      label: '閿�鍞鍗曞彿',
-      component: markRaw(ErpSaleOrderSelect),
-      componentProps: {
-        placeholder: '璇烽�夋嫨閿�鍞鍗�',
-        outStatus: 3,
-        onChange: (item: Record<string, unknown> | undefined) => {
-          if (formApi) {
-            formApi.setFieldValue('saleOrderNo', item?.no ?? '');
-            if (item?.customerId) {
-              formApi.setFieldValue('customerId', item.customerId);
-            }
-          }
-          onSaleOrderChange?.(item);
-        },
-      },
-    },
-    {
-      fieldName: 'saleOrderNo',
-      component: 'Input',
-      dependencies: {
-        triggerFields: [''],
-        show: () => false,
-      },
     },
     {
       fieldName: 'customerId',
@@ -269,11 +240,6 @@
       minWidth: 150,
     },
     {
-      field: 'saleOrderNo',
-      title: '閿�鍞鍗曞彿',
-      minWidth: 150,
-    },
-    {
       field: 'issueType',
       title: '闂绫诲瀷',
       width: 100,
@@ -322,6 +288,11 @@
 ): VxeTableGridOptions<AftersalesTicketApi.TicketItem>['columns'] {
   return [
     {
+      field: 'itemNo',
+      title: '鏄庣粏鍗曞彿',
+      minWidth: 170,
+    },
+    {
       field: 'itemCode',
       title: '鐗╂枡缂栫爜',
       minWidth: 120,
@@ -357,6 +328,22 @@
       title: '闇�瑕侀��璐�',
       width: 90,
       slots: { default: 'needReturn' },
+    },
+    {
+      field: 'deptName',
+      title: '閮ㄩ棬',
+      minWidth: 120,
+    },
+    {
+      field: 'reasonType',
+      title: '鍘熷洜绫诲瀷',
+      width: 120,
+      slots: { default: 'reasonType' },
+    },
+    {
+      field: 'reason',
+      title: '鍏蜂綋鍘熷洜',
+      minWidth: 160,
     },
     ...(editable
       ? [
@@ -488,6 +475,40 @@
       rules: z.boolean().default(false),
     },
     {
+      fieldName: 'deptId',
+      label: '閮ㄩ棬',
+      component: 'ApiTreeSelect',
+      componentProps: {
+        api: async () => handleTree(await getDeptList()),
+        labelField: 'name',
+        valueField: 'id',
+        childrenField: 'children',
+        placeholder: '璇烽�夋嫨閮ㄩ棬',
+        treeDefaultExpandAll: true,
+      },
+      rules: 'selectRequired',
+    },
+    {
+      fieldName: 'reasonType',
+      label: '鍘熷洜绫诲瀷',
+      component: 'Select',
+      componentProps: {
+        options: getDictOptions(DICT_TYPE.AFTERSALE_REASON_TYPE, 'number'),
+        placeholder: '璇烽�夋嫨鍘熷洜绫诲瀷',
+      },
+      rules: 'selectRequired',
+    },
+    {
+      fieldName: 'reason',
+      label: '鍏蜂綋鍘熷洜',
+      component: 'Textarea',
+      formItemClass: 'col-span-3',
+      componentProps: {
+        placeholder: '璇疯緭鍏ュ叿浣撳師鍥�',
+        rows: 2,
+      },
+    },
+    {
       fieldName: 'remark',
       label: '澶囨敞',
       component: 'Textarea',

--
Gitblit v1.9.3