From 081f242ea3c019f4eddd0fe342c5cf6189da1468 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 03 七月 2026 13:58:01 +0800
Subject: [PATCH] fix: 产品设计
---
src/views/mes/md/vendor/data.ts | 381 -----------------------------------------------------
1 files changed, 4 insertions(+), 377 deletions(-)
diff --git a/src/views/mes/md/vendor/data.ts b/src/views/mes/md/vendor/data.ts
index a1a2032..6a0bec1 100644
--- a/src/views/mes/md/vendor/data.ts
+++ b/src/views/mes/md/vendor/data.ts
@@ -1,383 +1,10 @@
-import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
+import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdVendorApi } from '#/api/mes/md/vendor';
-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_VENDOR_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: 'level',
- label: '渚涘簲鍟嗙瓑绾�',
- component: 'Select',
- componentProps: {
- allowClear: true,
- options: getDictOptions(DICT_TYPE.MES_VENDOR_LEVEL),
- placeholder: '璇烽�夋嫨渚涘簲鍟嗙瓑绾�',
- },
- },
- {
- 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: 'score',
- label: '渚涘簲鍟嗚瘎鍒�',
- component: 'InputNumber',
- componentProps: {
- class: '!w-full',
- max: 100,
- min: 0,
- precision: 0,
- },
- },
- {
- 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: 'logo',
- label: '渚涘簲鍟� LOGO',
- component: 'Input',
- componentProps: {
- placeholder: '璇疯緭鍏ヤ緵搴斿晢 LOGO 鍦板潃',
- },
- },
- {
- 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: 'status',
- label: '鐘舵��',
- component: 'Select',
- componentProps: {
- allowClear: true,
- options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
- placeholder: '璇烽�夋嫨鐘舵��',
- },
- },
- ];
-}
-
-/** 鍒楄〃鐨勫瓧娈� */
-export function useGridColumns(): VxeTableGridOptions<MesMdVendorApi.Vendor>['columns'] {
- return [
- {
- field: 'code',
- title: '渚涘簲鍟嗙紪鐮�',
- minWidth: 150,
- slots: { default: 'code' },
- },
- {
- field: 'name',
- title: '渚涘簲鍟嗗悕绉�',
- minWidth: 180,
- },
- {
- field: 'nickname',
- title: '渚涘簲鍟嗙畝绉�',
- width: 120,
- },
- {
- field: 'level',
- title: '渚涘簲鍟嗙瓑绾�',
- width: 130,
- cellRender: {
- name: 'CellDict',
- props: { type: DICT_TYPE.MES_VENDOR_LEVEL },
- },
- },
- {
- field: 'score',
- title: '渚涘簲鍟嗚瘎鍒�',
- width: 120,
- },
- {
- field: 'telephone',
- title: '渚涘簲鍟嗙數璇�',
- minWidth: 140,
- },
- {
- field: 'status',
- title: '鐘舵��',
- width: 120,
- cellRender: {
- name: 'CellDict',
- props: { type: DICT_TYPE.COMMON_STATUS },
- },
- },
- {
- field: 'remark',
- title: '澶囨敞',
- minWidth: 180,
- },
- {
- title: '鎿嶄綔',
- width: 160,
- fixed: 'right',
- slots: { default: 'actions' },
- },
- ];
-}
-
-/** 渚涘簲鍟嗛�夋嫨寮圭獥鐨勬悳绱㈣〃鍗� */
+/** 渚涘簲鍟嗛�夋嫨寮圭獥鎼滅储琛ㄥ崟 */
export function useVendorSelectGridFormSchema(): VbenFormSchema[] {
return [
{
@@ -419,7 +46,7 @@
];
}
-/** 渚涘簲鍟嗛�夋嫨寮圭獥鐨勫瓧娈� */
+/** 渚涘簲鍟嗛�夋嫨寮圭獥鍒楄〃瀛楁 */
export function useVendorSelectGridColumns(
multiple = true,
): VxeTableGridOptions<MesMdVendorApi.Vendor>['columns'] {
--
Gitblit v1.9.3