From b64a0deae5b5d33f9e20671a68936b27f0b9b00b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 21 七月 2026 18:03:03 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0
---
src/views/mes/md/client/data.ts | 387 ------------------------------------------------------
1 files changed, 4 insertions(+), 383 deletions(-)
diff --git a/src/views/mes/md/client/data.ts b/src/views/mes/md/client/data.ts
index da024de..45df0e7 100644
--- a/src/views/mes/md/client/data.ts
+++ b/src/views/mes/md/client/data.ts
@@ -1,389 +1,10 @@
-import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
+import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdClientApi } from '#/api/mes/md/client';
-import { h } from 'vue';
+import { DICT_TYPE } from '#/packages/constants/src';
-import {
- CommonStatusEnum,
- DICT_TYPE,
- MesAutoCodeRuleCode,
-} from '..\..\..\..\packages\constants\src';
-import { getDictOptions } from '..\..\..\..\packages\effects\hooks\src';
-
-import { Button } from 'ant-design-vue';
-
-import { z } from '#/adapter/form';
-import { generateAutoCode } from '#/api/mes/md/autocode/record';
-
-/** 琛ㄥ崟绫诲瀷 */
-export type FormType = 'create' | 'detail' | 'update';
-
-/** 鏂板/淇敼瀹㈡埛鐨勮〃鍗� */
-export function useFormSchema(
- formType: FormType,
- formApi?: VbenFormApi,
-): VbenFormSchema[] {
- return [
- {
- fieldName: 'id',
- component: 'Input',
- dependencies: {
- triggerFields: [''],
- show: () => false,
- },
- },
- {
- fieldName: 'code',
- label: '瀹㈡埛缂栫爜',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ュ鎴风紪鐮�',
- },
- rules: 'required',
- suffix:
- formType === 'detail'
- ? undefined
- : () =>
- h(
- Button,
- {
- type: 'default',
- onClick: async () => {
- const code = await generateAutoCode(
- MesAutoCodeRuleCode.MD_CLIENT_CODE,
- );
- await formApi?.setFieldValue('code', code);
- },
- },
- { default: () => '鑷姩鐢熸垚' },
- ),
- },
- {
- fieldName: 'name',
- label: '瀹㈡埛鍚嶇О',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ュ鎴峰悕绉�',
- },
- rules: z.string().min(1, '瀹㈡埛鍚嶇О涓嶈兘涓虹┖').max(100),
- },
- {
- fieldName: 'nickname',
- label: '瀹㈡埛绠�绉�',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ュ鎴风畝绉�',
- },
- },
- {
- fieldName: 'englishName',
- label: '瀹㈡埛鑻辨枃鍚嶇О',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ュ鎴疯嫳鏂囧悕绉�',
- },
- },
- {
- fieldName: 'type',
- label: '瀹㈡埛绫诲瀷',
- component: 'Select',
- componentProps: {
- allowClear: true,
- options: getDictOptions(DICT_TYPE.MES_CLIENT_TYPE, 'number'),
- placeholder: '璇烽�夋嫨瀹㈡埛绫诲瀷',
- },
- rules: 'selectRequired',
- },
- {
- fieldName: 'description',
- label: '瀹㈡埛绠�浠�',
- component: 'Textarea',
- formItemClass: 'col-span-3',
- componentProps: {
- placeholder: '璇疯緭鍏ュ鎴风畝浠�',
- rows: 2,
- },
- },
- {
- fieldName: 'address',
- label: '瀹㈡埛鍦板潃',
- component: 'Textarea',
- formItemClass: 'col-span-3',
- componentProps: {
- placeholder: '璇疯緭鍏ュ鎴峰湴鍧�',
- rows: 2,
- },
- },
- {
- fieldName: 'website',
- label: '瀹㈡埛瀹樼綉鍦板潃',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ュ鎴峰畼缃戝湴鍧�',
- },
- },
- {
- fieldName: 'email',
- label: '瀹㈡埛閭鍦板潃',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ュ鎴烽偖绠卞湴鍧�',
- },
- rules: z.string().email('閭鏍煎紡涓嶆纭�').or(z.literal('')).optional(),
- },
- {
- fieldName: 'telephone',
- label: '瀹㈡埛鐢佃瘽',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ュ鎴风數璇�',
- },
- },
- {
- fieldName: 'logo',
- label: '瀹㈡埛 LOGO',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ュ鎴� LOGO 鍦板潃',
- },
- },
- {
- fieldName: 'contact1Name',
- label: '鑱旂郴浜�1',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ヨ仈绯讳汉1',
- },
- },
- {
- fieldName: 'contact1Telephone',
- label: '鑱旂郴浜�1鐢佃瘽',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ヨ仈绯讳汉1鐢佃瘽',
- },
- },
- {
- fieldName: 'contact1Email',
- label: '鑱旂郴浜�1閭',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ヨ仈绯讳汉1閭',
- },
- rules: z.string().email('閭鏍煎紡涓嶆纭�').or(z.literal('')).optional(),
- },
- {
- fieldName: 'contact2Name',
- label: '鑱旂郴浜�2',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ヨ仈绯讳汉2',
- },
- },
- {
- fieldName: 'contact2Telephone',
- label: '鑱旂郴浜�2鐢佃瘽',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ヨ仈绯讳汉2鐢佃瘽',
- },
- },
- {
- fieldName: 'contact2Email',
- label: '鑱旂郴浜�2閭',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ヨ仈绯讳汉2閭',
- },
- rules: z.string().email('閭鏍煎紡涓嶆纭�').or(z.literal('')).optional(),
- },
- {
- fieldName: 'creditCode',
- label: '绀句細淇$敤浠g爜',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ョ粺涓�绀句細淇$敤浠g爜',
- },
- },
- {
- fieldName: 'status',
- label: '鐘舵��',
- component: 'RadioGroup',
- componentProps: {
- buttonStyle: 'solid',
- optionType: 'button',
- options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
- },
- rules: z.number().default(CommonStatusEnum.ENABLE),
- },
- {
- fieldName: 'remark',
- label: '澶囨敞',
- component: 'Textarea',
- formItemClass: 'col-span-3',
- componentProps: {
- placeholder: '璇疯緭鍏ュ娉�',
- rows: 3,
- },
- },
- ];
-}
-
-/** 瀵煎叆瀹㈡埛鐨勮〃鍗� */
-export function useImportFormSchema(): VbenFormSchema[] {
- return [
- {
- fieldName: 'file',
- label: '瀹㈡埛鏁版嵁',
- component: 'Upload',
- rules: 'required',
- help: '浠呭厑璁稿鍏� xls銆亁lsx 鏍煎紡鏂囦欢',
- },
- {
- fieldName: 'updateSupport',
- label: '鏄惁瑕嗙洊',
- component: 'Switch',
- componentProps: {
- checkedChildren: '鏄�',
- unCheckedChildren: '鍚�',
- },
- rules: z.boolean().default(false),
- help: '鏄惁鏇存柊宸茬粡瀛樺湪鐨勫鎴锋暟鎹�',
- },
- ];
-}
-
-/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
-export function useGridFormSchema(): VbenFormSchema[] {
- return [
- {
- fieldName: 'code',
- label: '瀹㈡埛缂栫爜',
- component: 'Input',
- componentProps: {
- allowClear: true,
- placeholder: '璇疯緭鍏ュ鎴风紪鐮�',
- },
- },
- {
- fieldName: 'name',
- label: '瀹㈡埛鍚嶇О',
- component: 'Input',
- componentProps: {
- allowClear: true,
- placeholder: '璇疯緭鍏ュ鎴峰悕绉�',
- },
- },
- {
- fieldName: 'nickname',
- label: '瀹㈡埛绠�绉�',
- component: 'Input',
- componentProps: {
- allowClear: true,
- placeholder: '璇疯緭鍏ュ鎴风畝绉�',
- },
- },
- {
- fieldName: 'englishName',
- label: '鑻辨枃鍚嶇О',
- component: 'Input',
- componentProps: {
- allowClear: true,
- placeholder: '璇疯緭鍏ュ鎴疯嫳鏂囧悕绉�',
- },
- },
- {
- fieldName: 'type',
- label: '瀹㈡埛绫诲瀷',
- component: 'Select',
- componentProps: {
- allowClear: true,
- options: getDictOptions(DICT_TYPE.MES_CLIENT_TYPE, 'number'),
- placeholder: '璇烽�夋嫨瀹㈡埛绫诲瀷',
- },
- },
- {
- fieldName: 'status',
- label: '鐘舵��',
- component: 'Select',
- componentProps: {
- allowClear: true,
- options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
- placeholder: '璇烽�夋嫨鐘舵��',
- },
- },
- ];
-}
-
-/** 鍒楄〃鐨勫瓧娈� */
-export function useGridColumns(): VxeTableGridOptions<MesMdClientApi.Client>['columns'] {
- return [
- {
- field: 'code',
- title: '瀹㈡埛缂栫爜',
- minWidth: 150,
- slots: { default: 'code' },
- },
- {
- field: 'name',
- title: '瀹㈡埛鍚嶇О',
- minWidth: 160,
- },
- {
- field: 'nickname',
- title: '瀹㈡埛绠�绉�',
- minWidth: 130,
- },
- {
- field: 'type',
- title: '瀹㈡埛绫诲瀷',
- width: 120,
- cellRender: {
- name: 'CellDict',
- props: { type: DICT_TYPE.MES_CLIENT_TYPE },
- },
- },
- {
- field: 'telephone',
- title: '瀹㈡埛鐢佃瘽',
- minWidth: 140,
- },
- {
- field: 'contact1Name',
- title: '鑱旂郴浜�1',
- width: 120,
- },
- {
- field: 'contact1Telephone',
- title: '鑱旂郴浜�1鐢佃瘽',
- minWidth: 140,
- },
- {
- field: 'status',
- title: '鐘舵��',
- width: 120,
- cellRender: {
- name: 'CellDict',
- props: { type: DICT_TYPE.COMMON_STATUS },
- },
- },
- {
- field: 'createTime',
- title: '鍒涘缓鏃堕棿',
- width: 180,
- formatter: 'formatDateTime',
- },
- {
- title: '鎿嶄綔',
- width: 160,
- fixed: 'right',
- slots: { default: 'actions' },
- },
- ];
-}
-
-/** 瀹㈡埛閫夋嫨寮圭獥鐨勬悳绱㈣〃鍗� */
+/** 瀹㈡埛閫夋嫨寮圭獥鎼滅储琛ㄥ崟 */
export function useClientSelectGridFormSchema(): VbenFormSchema[] {
return [
{
@@ -425,7 +46,7 @@
];
}
-/** 瀹㈡埛閫夋嫨寮圭獥鐨勫瓧娈� */
+/** 瀹㈡埛閫夋嫨寮圭獥鍒楄〃瀛楁 */
export function useClientSelectGridColumns(
multiple = true,
): VxeTableGridOptions<MesMdClientApi.Client>['columns'] {
--
Gitblit v1.9.3