From f2682488459e225ee9f72ad87eaba3096954eed1 Mon Sep 17 00:00:00 2001 From: wangyufei <2267742828@qq.com> Date: Thu, 13 Jun 2024 15:19:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E7=BA=BF=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=85=B3=E7=B3=BB=E7=AE=A1=E7=90=86=EF=BC=9A=E4=BA=A7=E7=BA=BF?= =?UTF-8?q?=E4=BB=A3=E7=A0=81---SearchTable---SelectV2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + src/components/Form/src/Form.vue | 3 +++ src/components/Form/src/helper.ts | 2 +- .../itemManage/productionlineitem/index.vue | 24 +++++++++---------- .../productionlineitem.data.ts | 22 ++++++++++++----- 5 files changed, 33 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 6966b07c3..648fbf09c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ form: { labelMessage: '信息提示说明!!!', componentProps: { + value:'undefined',//默认值,设置为'undefined'-->实际是undefined(解决SelectV2不显示占位符placeholder) enterSearch: true, //可输入回车 对应绑定事件:@onEnter="onEnter" isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择物料代码', // 输入框占位文本 diff --git a/src/components/Form/src/Form.vue b/src/components/Form/src/Form.vue index d9e8fc919..aa85fc5f5 100644 --- a/src/components/Form/src/Form.vue +++ b/src/components/Form/src/Form.vue @@ -464,4 +464,7 @@ export default defineComponent({ margin-right: 0 !important; margin-left: 0 !important; } +::v-deep(.el-select-v2 .el-icon) { + display: inline-flex; +} diff --git a/src/components/Form/src/helper.ts b/src/components/Form/src/helper.ts index 6f0ddafc5..ac3540f4d 100644 --- a/src/components/Form/src/helper.ts +++ b/src/components/Form/src/helper.ts @@ -127,7 +127,7 @@ export const initModel = (schema: FormSchema[], formModel: Recordable) => { } else if (v.component && v.component !== 'Divider') { const hasField = Reflect.has(model, v.field) // 如果先前已经有值存在,则不进行重新赋值,而是采用现有的值 - model[v.field] = hasField ? model[v.field] : v.value !== void 0 ? v.value : '' + model[v.field] = hasField ? model[v.field] : v.value === 'undefined' ? undefined : v.value !== void 0 ? v.value : '' } }) return model diff --git a/src/views/wms/basicDataManage/itemManage/productionlineitem/index.vue b/src/views/wms/basicDataManage/itemManage/productionlineitem/index.vue index 3ca414730..4599b7d87 100644 --- a/src/views/wms/basicDataManage/itemManage/productionlineitem/index.vue +++ b/src/views/wms/basicDataManage/itemManage/productionlineitem/index.vue @@ -152,25 +152,25 @@ const openForm = (type: string, row?: any) => { if(type == "update"){ Productionlineitem.allSchemas.formSchema.forEach((item) => { if (item.field == 'productionLineCode') { - item.componentProps.disabled = true - item.componentProps.isSearchList = false - } - if (item.field == 'itemCode') { - item.componentProps.disabled = true - item.componentProps.isSearchList = false - } - }) + item.componentProps.disabled = true + // item.componentProps.isSearchList = false + } + if (item.field == 'itemCode') { + item.componentProps.disabled = true + item.componentProps.isSearchList = false + } + }) }else { Productionlineitem.allSchemas.formSchema.forEach((item) => { if (item.field == 'productionLineCode') { item.componentProps.disabled = false - item.componentProps.isSearchList = true + // item.componentProps.isSearchList = true } if (item.field == 'itemCode') { - item.componentProps.disabled = false - item.componentProps.isSearchList = true - } + item.componentProps.disabled = false + item.componentProps.isSearchList = true + } }) } basicFormRef.value.open(type, row) diff --git a/src/views/wms/basicDataManage/itemManage/productionlineitem/productionlineitem.data.ts b/src/views/wms/basicDataManage/itemManage/productionlineitem/productionlineitem.data.ts index 1d3ce0f67..3524c8118 100644 --- a/src/views/wms/basicDataManage/itemManage/productionlineitem/productionlineitem.data.ts +++ b/src/views/wms/basicDataManage/itemManage/productionlineitem/productionlineitem.data.ts @@ -2,6 +2,7 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as ProductionLineCodeApi from '@/api/wms/productionline' import { Productionline } from './../../factoryModeling/productionline/productionline.data' +import * as LocationApi from '@/api/wms/location' import * as ItembasicApi from '@/api/wms/itembasic' import { Itembasic } from './../itembasic/itembasic.data' @@ -10,6 +11,7 @@ const { t } = useI18n() // 国际化 const confgiData = await confgiApi.queryByKey("Productionlineitem") +const lineCodeData = await ProductionLineCodeApi.getProductionlinePage({isSearch:false}) /** * @returns {Array} 生产线物料关系 @@ -71,17 +73,25 @@ export const Productionlineitem = useCrudSchemas(reactive([ width: 150, fixed: 'left' }, + isForm:true, form: { + show:true, + component: 'SelectV2', + value:'undefined', // labelMessage: '信息提示说明!!!', componentProps: { - isSearchList: true, - searchListPlaceholder: '请选择生产线', + // isSearchList: true, + placeholder:'请选择库位代码', searchField: 'code', - searchTitle: '生产线信息', - searchAllSchemas: Productionline.allSchemas, - searchPage: ProductionLineCodeApi.getProductionlinePage + // searchTitle: '生产线信息', + // searchAllSchemas: Productionline.allSchemas, + // searchPage: ProductionLineCodeApi.getProductionlinePage + options:lineCodeData.list.map(item=>({ + label:item.code, + value:item.code + })) } - } + }, }, { label: '物料代码',