Browse Source

下拉框-物料代码

master_hella_20240701
wangyufei 4 months ago
parent
commit
3c09f472f7
  1. 7
      src/components/Search/src/Search.vue
  2. 21
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/demandforecastingMain.data.ts
  3. 20
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue
  4. 4
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingSupplierMain/demandforecastingMain.data.ts

7
src/components/Search/src/Search.vue

@ -60,7 +60,7 @@ const props = defineProps({
} }
}) })
const emit = defineEmits(['search', 'reset','onInput','searchTableSuccess']) const emit = defineEmits(['search', 'reset','onInput','onChange','searchTableSuccess'])
const visible = ref(true) const visible = ref(true)
@ -108,7 +108,9 @@ const { register, elFormRef, methods } = useForm({
const onInput = (field,value) => { const onInput = (field,value) => {
emit('onInput', field,value) emit('onInput', field,value)
} }
const onChange = (field, value)=>{
emit('onChange', field,value)
}
const searchTableRef = ref() const searchTableRef = ref()
const opensearchTable = ( const opensearchTable = (
formField, formField,
@ -282,6 +284,7 @@ defineExpose({setFormValues}) // 提供 open 方法,用于打开弹窗
@register="register" @register="register"
@onInput="onInput" @onInput="onInput"
@opensearchTable="opensearchTable" @opensearchTable="opensearchTable"
@onChange="onChange"
> >
<template #action> <template #action>
<div v-if="layout === 'inline'"> <div v-if="layout === 'inline'">

21
src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/demandforecastingMain.data.ts

@ -1,8 +1,9 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime' import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
import * as SupplierApi from '@/api/wms/supplier' import * as SupplierApi from '@/api/wms/supplier'
// import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as SupplieritemApi from '@/api/wms/supplieritem' import * as SupplieritemApi from '@/api/wms/supplieritem'
import { Supplier} from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data' import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data'
import * as ItembasicApi from '@/api/wms/itembasic' import * as ItembasicApi from '@/api/wms/itembasic'
import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data"; import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data";
@ -13,14 +14,22 @@ import * as DemandforecastingMainApi from '@/api/wms/demandforecastingMain'
import * as DemandforecastingDetailApi from '@/api/wms/demandforecastingDetail' import * as DemandforecastingDetailApi from '@/api/wms/demandforecastingDetail'
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
const planerList = await DemandforecastingMainApi.queryUserPlanerList() let planerList = await DemandforecastingMainApi.queryUserPlanerList()
if(planerList.length>0){
planerList.unshift({
planerId:'',
planerNickname:'全选',
planerUsername:'全选'
})
}
console.log('planerList',planerList) console.log('planerList',planerList)
/** /**
* @returns {Array} * @returns {Array}
*/ */
Supplieritem.allSchemas.searchSchema = Supplieritem.allSchemas.searchSchema.filter(item=>item.field!="allowOverShipment")
export const Supplier = useCrudSchemas(reactive<CrudSchema[]>([ export const Supplier1 = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '用户名称', label: '用户名称',
field: 'userName', field: 'userName',
@ -101,10 +110,12 @@ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch:true, isSearch:true,
search:{ search:{
component:'Select', component:'Select',
value:planerList.length>0?[planerList[0]['planerId']]:[], value:planerList.length>1?[planerList[1]['planerId']]:[],
componentProps: { componentProps: {
showAll:true,// 备用做全选 showAll:true,// 备用做全选
multiple:true, multiple:true,
emptyValues:[null, undefined],
valueOnClear:null,
options:planerList.map(item=>({ options:planerList.map(item=>({
label:item.planerUsername, label:item.planerUsername,
value:item.planerId value:item.planerId
@ -129,7 +140,7 @@ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本 searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'supplierCode', // 查询弹窗赋值字段 searchField: 'supplierCode', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题 searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类 searchAllSchemas: Supplier1.allSchemas, // 查询弹窗所需类
searchPage: DemandforecastingMainApi.querySupplierList, // 查询弹窗所需分页方法 searchPage: DemandforecastingMainApi.querySupplierList, // 查询弹窗所需分页方法
searchCondition: [{ searchCondition: [{
key: 'planers', key: 'planers',

20
src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :showSearchTableQueryFields="['supplierCode','itemCode']" :hiddenFilterBtnFields="['supplierCode','itemCode']" :schema="DemandforecastingMain.allSchemas.searchSchema" @search="searchClick" @reset="searchClick" @searchTableSuccess="searchQueryTableSuccess"/> <Search ref="seachRef" :showSearchTableQueryFields="['supplierCode','itemCode']" :hiddenFilterBtnFields="['supplierCode','itemCode']" :schema="DemandforecastingMain.allSchemas.searchSchema" @search="searchClick" @reset="searchClick" @searchTableSuccess="searchQueryTableSuccess" @onChange="onSearchChange"/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
@ -151,7 +151,23 @@ const buttonBaseClick = async (val, item) => {
} }
const seachRef = ref()
const onSearchChange = (field, value)=>{
if(field=='planerId'){
if(value.length>0){
if(value[value.length-1]==''){
//
seachRef.value.setFormValues({
planerId:['']
})
}else{
seachRef.value.setFormValues({
planerId:value.filter(item=>item!='')
})
}
}
}
}
const searchClick = async (data)=>{ const searchClick = async (data)=>{
console.log('searchClick',data) console.log('searchClick',data)
await setSearchParamsHead(data) await setSearchParamsHead(data)

4
src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingSupplierMain/demandforecastingMain.data.ts

@ -1,7 +1,7 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime' import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
import * as SupplierApi from '@/api/wms/supplier' import * as SupplierApi from '@/api/wms/supplier'
// import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' import { Supplier} from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as SupplieritemApi from '@/api/wms/supplieritem' import * as SupplieritemApi from '@/api/wms/supplieritem'
import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data' import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data'
import * as ItembasicApi from '@/api/wms/itembasic' import * as ItembasicApi from '@/api/wms/itembasic'
@ -17,7 +17,7 @@ const { t } = useI18n() // 国际化
/** /**
* @returns {Array} * @returns {Array}
*/ */
Supplieritem.allSchemas.searchSchema = Supplieritem.allSchemas.searchSchema.filter(item=>item.field!="allowOverShipment")
export const Version = useCrudSchemas(reactive<CrudSchema[]>([ export const Version = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '供应商代码', label: '供应商代码',

Loading…
Cancel
Save