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. 92
      src/views/wms/basicDataManage/documentSetting/businesstype/index.vue

4
README.md

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

4
src/hooks/web/useCrudSchemas.ts

@ -264,6 +264,10 @@ const filterFormSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): For
options.push(dict) options.push(dict)
}) })
} else { } else {
if(schemaItem.dictAllOption){
const allOptions: ComponentOptions = { label: '全选', value: schemaItem.dictAllValue||'' }
options.push(allOptions)
}
getDictOptions(schemaItem.dictType).forEach((dict) => { getDictOptions(schemaItem.dictType).forEach((dict) => {
options.push(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', field: 'itemTypes',
dictType: DICT_TYPE.ITEM_TYPE, dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string', dictClass: 'string',
dictAllOption:true,// 全选按钮
dictAllValue:'全选',
isTable: true, isTable: true,
sort: 'custom', sort: 'custom',
table: { table: {
@ -57,6 +59,7 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
}, },
} }
}, },
{ {
label: '可用物料状态范围', label: '可用物料状态范围',
field: 'itemStatuses', field: 'itemStatuses',
@ -73,6 +76,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
field: 'outAreaTypes', field: 'outAreaTypes',
dictType: DICT_TYPE.AREA_TYPE, dictType: DICT_TYPE.AREA_TYPE,
dictClass: 'string', dictClass: 'string',
dictAllOption:true,// 全选按钮
dictAllValue:'全选',
isTable: true, isTable: true,
sort: 'custom', sort: 'custom',
table: { table: {
@ -90,6 +95,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
field: 'inAreaTypes', field: 'inAreaTypes',
dictType: DICT_TYPE.AREA_TYPE, dictType: DICT_TYPE.AREA_TYPE,
dictClass: 'string', dictClass: 'string',
dictAllOption:true,// 全选按钮
dictAllValue:'全选',
isTable: true, isTable: true,
sort: 'custom', sort: 'custom',
table: { table: {
@ -163,6 +170,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
field: 'outInventoryStatuses', field: 'outInventoryStatuses',
dictType: DICT_TYPE.INVENTORY_STATUS, dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string', dictClass: 'string',
dictAllOption:true,// 全选按钮
dictAllValue:'全选',
isTable: true, isTable: true,
sort: 'custom', sort: 'custom',
table: { table: {
@ -180,6 +189,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
field: 'inInventoryStatuses', field: 'inInventoryStatuses',
dictType: DICT_TYPE.INVENTORY_STATUS, dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string', dictClass: 'string',
dictAllOption:true,// 全选按钮
dictAllValue:'全选',
isTable: true, isTable: true,
sort: 'custom', sort: 'custom',
table: { table: {

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

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

Loading…
Cancel
Save