Browse Source

加全选按钮的有:可用物料类型范围、出库库区类型范围、入库库区类型范围、出库库存状态范围、入库库存状态范围

hella_online_20240829
wangyufei 4 months ago
parent
commit
194598df3c
  1. 4
      README.md
  2. 4
      src/hooks/web/useCrudSchemas.ts
  3. 11
      src/views/wms/basicDataManage/documentSetting/businesstype/businesstype.data.ts
  4. 112
      src/views/wms/basicDataManage/documentSetting/businesstype/index.vue

4
README.md

@ -1,5 +1,9 @@
## dev发布2024-06-01-002
**xxxx.data.ts 文件配置说明**
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
dictAllOption:true,// true 字典中--下拉框中展示全选按钮
dictAllValue:'全选', // 全选按钮的value值
**form表单查询弹窗配置**
form: {
labelMessage: '信息提示说明!!!',

4
src/hooks/web/useCrudSchemas.ts

@ -264,6 +264,10 @@ const filterFormSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): For
options.push(dict)
})
} else {
if(schemaItem.dictAllOption){
const allOptions: ComponentOptions = { label: '全选', value: schemaItem.dictAllValue||'' }
options.push(allOptions)
}
getDictOptions(schemaItem.dictType).forEach((dict) => {
options.push(dict)
})

11
src/views/wms/basicDataManage/documentSetting/businesstype/businesstype.data.ts

@ -45,6 +45,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
field: 'itemTypes',
dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string',
dictAllOption:true,// 全选按钮
dictAllValue:'全选',
isTable: true,
sort: 'custom',
table: {
@ -57,6 +59,7 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
},
}
},
{
label: '可用物料状态范围',
field: 'itemStatuses',
@ -73,6 +76,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
field: 'outAreaTypes',
dictType: DICT_TYPE.AREA_TYPE,
dictClass: 'string',
dictAllOption:true,// 全选按钮
dictAllValue:'全选',
isTable: true,
sort: 'custom',
table: {
@ -90,6 +95,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
field: 'inAreaTypes',
dictType: DICT_TYPE.AREA_TYPE,
dictClass: 'string',
dictAllOption:true,// 全选按钮
dictAllValue:'全选',
isTable: true,
sort: 'custom',
table: {
@ -163,6 +170,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
field: 'outInventoryStatuses',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
dictAllOption:true,// 全选按钮
dictAllValue:'全选',
isTable: true,
sort: 'custom',
table: {
@ -180,6 +189,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
field: 'inInventoryStatuses',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
dictAllOption:true,// 全选按钮
dictAllValue:'全选',
isTable: true,
sort: 'custom',
table: {

112
src/views/wms/basicDataManage/documentSetting/businesstype/index.vue

@ -53,6 +53,7 @@
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
:basicFormWidth="75"
@onChange="onChange"
/>
<!-- 详情 -->
@ -76,6 +77,7 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
//
defineOptions({ name: 'Businesstype' })
@ -157,11 +159,44 @@ const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
const rowSplit = JSON.parse(JSON.stringify(row))
rowSplit.itemTypes = rowSplit.itemTypes.split(',')
rowSplit.outAreaTypes = rowSplit.outAreaTypes.split(',')
rowSplit.inAreaTypes = rowSplit.inAreaTypes.split(',')
rowSplit.outInventoryStatuses = rowSplit.outInventoryStatuses.split(',')
rowSplit.inInventoryStatuses = rowSplit.inInventoryStatuses.split(',')
// rowSplit.itemTypes = rowSplit.itemTypes.split(',')
//
const allItemTypesValue = getStrDictOptions(DICT_TYPE.ITEM_TYPE).map(item=>(item.value))
if(rowSplit.itemTypes == allItemTypesValue){
rowSplit.itemTypes = ['全选']
}else{
rowSplit.itemTypes = rowSplit.itemTypes.split(',')
}
//
const allValue = getStrDictOptions(DICT_TYPE.AREA_TYPE).map(item=>(item.value))
if(rowSplit.outAreaTypes == allValue){
rowSplit.outAreaTypes = ['全选']
}else{
rowSplit.outAreaTypes = rowSplit.outAreaTypes.split(',')
}
if(rowSplit.inAreaTypes == allValue){
rowSplit.inAreaTypes = ['全选']
}else{
rowSplit.inAreaTypes = rowSplit.inAreaTypes.split(',')
}
// rowSplit.outAreaTypes = rowSplit.outAreaTypes.split(',')
// rowSplit.inAreaTypes = rowSplit.inAreaTypes.split(',')
const allInventoryStatusesValue = getStrDictOptions(DICT_TYPE.INVENTORY_STATUS).map(item=>(item.value))
if(rowSplit.outInventoryStatuses == allInventoryStatusesValue){
rowSplit.outInventoryStatuses = ['全选']
}else{
rowSplit.outInventoryStatuses = rowSplit.outInventoryStatuses.split(',')
}
if(rowSplit.inInventoryStatuses == allInventoryStatusesValue){
rowSplit.inInventoryStatuses = ['全选']
}else{
rowSplit.inInventoryStatuses = rowSplit.inInventoryStatuses.split(',')
}
// rowSplit.outInventoryStatuses = rowSplit.outInventoryStatuses.split(',')
// rowSplit.inInventoryStatuses = rowSplit.inInventoryStatuses.split(',')
openForm('update', rowSplit)
} else if (val == 'delete') {
//
@ -176,7 +211,8 @@ const openForm = (type: string, row?: any) => {
}
// form
const formsSuccess = async (formType, data) => {
const formsSuccess = async (formType, submitData) => {
let data = {...submitData}
var isHave = Businesstype.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'
})
@ -188,11 +224,47 @@ const formsSuccess = async (formType, data) => {
}
if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null
data.itemTypes = data.itemTypes.join(',')
data.outAreaTypes = data.outAreaTypes.join(',')
data.inAreaTypes = data.inAreaTypes.join(',')
data.outInventoryStatuses = data.outInventoryStatuses.join(',')
data.inInventoryStatuses = data.inInventoryStatuses.join(',')
// data.itemTypes = data.itemTypes.join(',')
const allItemTypesValue = getStrDictOptions(DICT_TYPE.ITEM_TYPE).map(item=>(item.value))
if(data.itemTypes[data.itemTypes.length-1]=='全选'){
data.itemTypes = allItemTypesValue.join(',')
}else{
data.itemTypes = data.itemTypes.join(',')
}
// data.outAreaTypes = data.outAreaTypes.join(',')
// data.inAreaTypes = data.inAreaTypes.join(',')
//
const allValue = getStrDictOptions(DICT_TYPE.AREA_TYPE).map(item=>(item.value))
if(data.outAreaTypes[data.outAreaTypes.length-1]=='全选'){
data.outAreaTypes = allValue.join(',')
}else{
data.outAreaTypes = data.outAreaTypes.join(',')
}
if(data.inAreaTypes[data.inAreaTypes.length-1]=='全选'){
data.inAreaTypes = allValue.join(',')
}else{
data.inAreaTypes = data.inAreaTypes.join(',')
}
//
// data.outInventoryStatuses = data.outInventoryStatuses.join(',')
// data.inInventoryStatuses = data.inInventoryStatuses.join(',')
const allInventoryStatusesValue = getStrDictOptions(DICT_TYPE.INVENTORY_STATUS).map(item=>(item.value))
if(data.outInventoryStatuses[data.outInventoryStatuses.length-1]=='全选'){
data.outInventoryStatuses = allInventoryStatusesValue.join(',')
}else{
data.outInventoryStatuses = data.outInventoryStatuses.join(',')
}
if(data.inInventoryStatuses[data.inInventoryStatuses.length-1]=='全选'){
data.inInventoryStatuses = allInventoryStatusesValue.join(',')
}else{
data.inInventoryStatuses = data.inInventoryStatuses.join(',')
}
if (formType === 'create') {
await BusinesstypeApi.createBusinesstype(data)
.then(async () => {
@ -224,6 +296,24 @@ const formsSuccess = async (formType, data) => {
}
}
const onChange = (field, value)=>{
console.log('onChange',field,value)
if(field=='outAreaTypes'||field=='inAreaTypes'||field=='itemTypes'||field=='outInventoryStatuses'||field=='inInventoryStatuses'){
//
if(value.length>0){
if(value[value.length-1]=='全选'){
//
basicFormRef.value.formRef.setValues({
[field]:['全选']
})
}else{
basicFormRef.value.formRef.setValues({
[field]:value.filter(item=>item!='全选')
})
}
}
}
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {

Loading…
Cancel
Save