Browse Source

生产线物料关系管理:产线代码---SearchTable---SelectV2

master_hella_20240701
wangyufei 5 months ago
parent
commit
f268248845
  1. 1
      README.md
  2. 3
      src/components/Form/src/Form.vue
  3. 2
      src/components/Form/src/helper.ts
  4. 24
      src/views/wms/basicDataManage/itemManage/productionlineitem/index.vue
  5. 22
      src/views/wms/basicDataManage/itemManage/productionlineitem/productionlineitem.data.ts

1
README.md

@ -4,6 +4,7 @@
form: { form: {
labelMessage: '信息提示说明!!!', labelMessage: '信息提示说明!!!',
componentProps: { componentProps: {
value:'undefined',//默认值,设置为'undefined'-->实际是undefined(解决SelectV2不显示占位符placeholder)
enterSearch: true, //可输入回车 对应绑定事件:@onEnter="onEnter" enterSearch: true, //可输入回车 对应绑定事件:@onEnter="onEnter"
isSearchList: true, // 开启查询弹窗 isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchListPlaceholder: '请选择物料代码', // 输入框占位文本

3
src/components/Form/src/Form.vue

@ -464,4 +464,7 @@ export default defineComponent({
margin-right: 0 !important; margin-right: 0 !important;
margin-left: 0 !important; margin-left: 0 !important;
} }
::v-deep(.el-select-v2 .el-icon) {
display: inline-flex;
}
</style> </style>

2
src/components/Form/src/helper.ts

@ -127,7 +127,7 @@ export const initModel = (schema: FormSchema[], formModel: Recordable) => {
} else if (v.component && v.component !== 'Divider') { } else if (v.component && v.component !== 'Divider') {
const hasField = Reflect.has(model, v.field) 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 return model

24
src/views/wms/basicDataManage/itemManage/productionlineitem/index.vue

@ -152,25 +152,25 @@ const openForm = (type: string, row?: any) => {
if(type == "update"){ if(type == "update"){
Productionlineitem.allSchemas.formSchema.forEach((item) => { Productionlineitem.allSchemas.formSchema.forEach((item) => {
if (item.field == 'productionLineCode') { if (item.field == 'productionLineCode') {
item.componentProps.disabled = true item.componentProps.disabled = true
item.componentProps.isSearchList = false // item.componentProps.isSearchList = false
} }
if (item.field == 'itemCode') { if (item.field == 'itemCode') {
item.componentProps.disabled = true item.componentProps.disabled = true
item.componentProps.isSearchList = false item.componentProps.isSearchList = false
} }
}) })
}else { }else {
Productionlineitem.allSchemas.formSchema.forEach((item) => { Productionlineitem.allSchemas.formSchema.forEach((item) => {
if (item.field == 'productionLineCode') { if (item.field == 'productionLineCode') {
item.componentProps.disabled = false item.componentProps.disabled = false
item.componentProps.isSearchList = true // item.componentProps.isSearchList = true
} }
if (item.field == 'itemCode') { if (item.field == 'itemCode') {
item.componentProps.disabled = false item.componentProps.disabled = false
item.componentProps.isSearchList = true item.componentProps.isSearchList = true
} }
}) })
} }
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)

22
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 { dateFormatter } from '@/utils/formatTime'
import * as ProductionLineCodeApi from '@/api/wms/productionline' import * as ProductionLineCodeApi from '@/api/wms/productionline'
import { Productionline } from './../../factoryModeling/productionline/productionline.data' import { Productionline } from './../../factoryModeling/productionline/productionline.data'
import * as LocationApi from '@/api/wms/location'
import * as ItembasicApi from '@/api/wms/itembasic' import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from './../itembasic/itembasic.data' import { Itembasic } from './../itembasic/itembasic.data'
@ -10,6 +11,7 @@ const { t } = useI18n() // 国际化
const confgiData = await confgiApi.queryByKey("Productionlineitem") const confgiData = await confgiApi.queryByKey("Productionlineitem")
const lineCodeData = await ProductionLineCodeApi.getProductionlinePage({isSearch:false})
/** /**
* @returns {Array} 线 * @returns {Array} 线
@ -71,17 +73,25 @@ export const Productionlineitem = useCrudSchemas(reactive<CrudSchema[]>([
width: 150, width: 150,
fixed: 'left' fixed: 'left'
}, },
isForm:true,
form: { form: {
show:true,
component: 'SelectV2',
value:'undefined',
// labelMessage: '信息提示说明!!!', // labelMessage: '信息提示说明!!!',
componentProps: { componentProps: {
isSearchList: true, // isSearchList: true,
searchListPlaceholder: '请选择生产线', placeholder:'请选择库位代码',
searchField: 'code', searchField: 'code',
searchTitle: '生产线信息', // searchTitle: '生产线信息',
searchAllSchemas: Productionline.allSchemas, // searchAllSchemas: Productionline.allSchemas,
searchPage: ProductionLineCodeApi.getProductionlinePage // searchPage: ProductionLineCodeApi.getProductionlinePage
options:lineCodeData.list.map(item=>({
label:item.code,
value:item.code
}))
} }
} },
}, },
{ {
label: '物料代码', label: '物料代码',

Loading…
Cancel
Save