Browse Source

盘点bug

master_hella_20240701
zhang_li 5 months ago
parent
commit
05da2400de
  1. 976
      src/components/BasicForm/src/BasicFormWmsCount.vue
  2. 20
      src/components/DetailTable/src/DetailTable.vue
  3. 187
      src/components/TableFormCountPlan/src/TableFormCountPlan.vue
  4. 158
      src/views/wms/countManage/count/countPlanMain/countPlanMain.data.ts
  5. 646
      src/views/wms/countManage/count/countPlanMain/index.vue

976
src/components/BasicForm/src/BasicFormWmsCount.vue

@ -0,0 +1,976 @@
<template>
<Dialog
:title="dialogTitle"
v-model="dialogVisible"
:width="dialogWidth"
:close-on-click-modal="false"
:vLoading="formLoading"
>
<div
style="max-height: 60vh;overflow-y: auto;">
<Form
ref="formRef"
:rules="rules"
:schema="formSchema"
:is-col="true"
@opensearchTable="opensearchTable"
@hiddenFilterButton="hiddenSearchTableFilterButton"
@changeDialogWidth="changeDialogWidth"
@clearSearchInput="clearSearchInput"
@onChange="onChange"
@onBlur="onBlur"
@onEnter="onEnter"
>
<template #crontab="formSchema1" v-if="fromeWhere == 'countPlan'">
<crontab v-model="formSchema1.crontab" :disabled="formSchema?.find(item=>item.field == 'crontab')?.componentProps?.disabled "/>
</template>
<template #type="formSchema" v-if="fromeWhere == 'countPlan'">
<el-select
v-model="formSchema.type"
placeholder="选择盘点类型"
@change="selectChange('type', $event)"
v-if="!isDetail"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.COUNT_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<el-select
v-model="formSchema.type"
placeholder="选择盘点范围类型"
@change="selectChangeDetail('type', $event,formSchema)"
v-if="isDetail"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.COUNT_SCOPE_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</template>
<template #value="formSchema" v-if="fromeWhere == 'countPlan'">
<el-select
v-model="formSchema.value"
placeholder="选择盘点范围值"
v-if="isDetail&& formTypeDetail =='Select'"
>
<el-option
v-for="dict in countPlanAllList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<el-input v-model="formSchema.value" v-if="isDetail && formTypeDetail =='InputString'"/>
</template>
</Form>
<div class="table" v-if="isBusiness && formType == 'create' && fromeWhere != 'countPlan'">
<TableForm
ref="tableFormRef"
class="w-[100%]"
:maxHeight = "490"
:tableFields="tableAllSchemas.tableFormColumns"
:tableData="tableData"
:tableFormRules="tableFormRules"
:isShowButton="isShowButton"
:isShowReduceButton="isShowReduceButton"
:isShowReduceButtonSelection="isShowReduceButtonSelection"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@tableSelectionChange="tableSelectionChange"
@tableSelectionDelete="tableSelectionDelete"
@extendedButtonsClick="extendedButtonsClick"
@formSelectChange="formSelectChange"
@formSelectvVisibleChange="formSelectvVisibleChange"
@tableSortChange="tableSortChange"
@selectCallback="selectCallback"
@handleTableSelect="handleTableSelect"
@inpuFocus="inpuFocus"
@buttonOperationClick="buttonOperationClick"
@inputStringBlur="inputStringBlur"
@inputNumberChange="inputNumberChange"
@tableFormSelectOnBlur="tableFormSelectOnBlur"
@formFormDateChange="formFormDateChange"
@clearInput='clearInput'
@inputFocusPlan='inputFocusPlan'
>
<template v-slot="{row}">
<slot :row="row"></slot>
</template>
</TableForm>
</div>
<div v-if="isBusiness && formType == 'create' && fromeWhere == 'countPlan'">
<TableFormCountPlan
:tableFields="tableAllSchemas.tableFormColumns"
:tableData="tableData"
:countScopeType="countScopeType"
:tableFormRules="tableFormRules"
ref="tableFormRef"
@tableFormChange="tableFormChange"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@inpuFocus="inpuFocus"
/>
</div>
<Form
ref="formRef1"
:rules="rules"
:schema="CountPlanMain1FormAllSchemas"
:is-col="true"
style="margin-top:20px"
@opensearchTable="opensearchTable1"
@hiddenFilterButton="hiddenSearchTableFilterButton"
@changeDialogWidth="changeDialogWidth"
@clearSearchInput="clearSearchInput"
@onChange="onChange"
@onBlur="onBlur"
@onEnter="onEnter"
/>
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
</template>
</Dialog>
<SearchTable ref="searchTableRef" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess" />
<SearchTable ref="searchTableRef1" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess1" />
</template>
<script setup lang="ts">
import { SearchTable } from '@/components/SearchTable'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import ButtonBase from '@/components/XButton/src/ButtonBase.vue'
import TableForm from '@/components/TableForm/src/TableForm.vue'
import TableFormCountPlan from '@/components/TableFormCountPlan/src/TableFormCountPlan.vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { debounce } from 'lodash-es'
const props = defineProps({
//
basicFormWidth: {
type: String,
default: ''
},
// TableForm /
isShowButton: {
type: Boolean,
default: true
},
// --
isShowReduceButtonSelection:{
type: Boolean,
default: false,
},
// tableForm
isShowReduceButton: {
type: Boolean,
default: true
},
// rules
rules: {
type: Object,
required: true,
default: null
},
//
formAllSchemas: {
type: Object,
required: true,
default: null
},
//
tableAllSchemas: {
type: Array,
required: true,
default: null
},
//
tableData: {
type: Array,
required: true,
default: null
},
tableFormRules: {
type: Array,
required: true,
default: null
},
//
// searchTableParams: {
// type: Array,
// required: false,
// default: null
// },
// APIVo
apiVo: {
type: Object,
required: true,
default: null
},
// API
apiCreate: {
type: Function,
required: true,
default: null
},
// API
apiUpdate: {
type: Function,
required: true,
default: null
},
// tableForm
isBusiness: {
type: Boolean,
required: true,
default: true
},
// form
form: {
type: Object,
required: true,
default: null
},
//
detailData: {
type: Object,
required: true,
default: null
},
// //
// masterParmas: {
// type: Object,
// required: false,
// default: null
// },
// countPlan
fromeWhere: {
type: String,
required: false,
default: ''
},
//
countScopeType: {
type: Array,
required: false,
default: null
},
//
isDetail: {
type: Boolean,
required: false,
default: false
},
//
formTypeDetail: {
type: String,
required: false,
default: 'InputString'
},
//
countPlanAllList: {
type: Array,
required: false,
default: null
},
// or
isShowFooterButtton: {
type: Boolean,
required: false,
default: true
},
//
tableFormDataLength: {
type: Boolean,
required: false,
default: true
},
//
footButttondata: {
type: Array,
required: false,
default: null
},
//
isOpenSearchTable:{
type: Boolean,
required: false,
default: false
},
fieldTableColumn:{
type: String,
required: false,
default: ''
},
//searchTable
/***[{
formField:form中对应的field,
tableField:searchtable中对应的field,
}]*/
sumFormDataField:{
type: Array,
required: false,
default: null
},
sumFormDataByForm:{
type:Function,
required: false,
default: null
},
sumFormDataByTableCustom:{
type:Function,
required: false,
default: null
},
showSearchTableQueryFields:{
type: Array,
required: false,
default: []
},
//
CountPlanMain1FormAllSchemas: {
type: Object,
required: true,
default: null
}
})
const { t } = useI18n() //
const message = useMessage() //
const dialogWidth = ref()
if (props.basicFormWidth) {
dialogWidth.value = props.basicFormWidth + '%'
} else {
dialogWidth.value = props.isBusiness ? '60%' : '40%'
}
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formRef = ref() // Ref
const formRef1 = ref() // Ref
const formSchema = ref(props.formAllSchemas?.formSchema)
const CountPlanMain1FormAllSchemas = ref(props.CountPlanMain1FormAllSchemas?.formSchema)
const tableAllSchemas = ref(props.tableAllSchemas)
const tableFormRules = ref(props.tableFormRules)
console.log(111,formSchema)
// -
// const buttondata = [
// defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(null)
// ]
// // -
// const buttonTableClick = async (val, row) => {
// if (val == 'edit') {
// } else if (val == 'delete') {
// } else {
// }
// }
/** 弹层操作 */
// formField form
// searchField
// type type=tableForm
// searchCondition
const searchTableRef = ref()
const searchTableRef1 = ref()
const opensearchTable = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row,
isConcatDetailSchemas=false,
searchDetailSchemas: any
) => {
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
//
let filters: any[] = []
for (var i=0; i< searchCondition.length; i++ ) {
// searchCondition.forEach((item) => {
// row
if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value]
? formRef.value.formModel[searchCondition[i].value]
: props.detailData
? props.detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
//
let isNull = false
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) {
isNull = true
}
if (isNull) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
}else if(searchCondition[i].isTableRowValue){
if(searchCondition[i].required){
if (row[searchCondition[i].value] == '' ||row[searchCondition[i].value] == undefined) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
}
row[searchCondition[i].value]
//table
_searchCondition[searchCondition[i].key] = row[searchCondition[i].value]
} else {
//
if (searchCondition[i].isSearch) {
if (searchCondition[i].isFormModel) {
//formModel
if(searchCondition[i].required){
if (formRef.value.formModel[searchCondition[i].value] == '' ||formRef.value.formModel[searchCondition[i].value] == undefined) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
}
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: formRef.value.formModel[searchCondition[i].value]
})
}else{
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: searchCondition[i].value
})
}
} else {
_searchCondition[searchCondition[i].key] = searchCondition[i].value
}
}
}
if (filters.length > 0) {
_searchCondition.isSearch = true
_searchCondition.filters = filters
}
}
const _searchTableTitle = searchTitle
const _searchTableAllSchemas = searchAllSchemas
const _searchTablePage = searchPage
searchTableRef.value.open(
_searchTableTitle,
_searchTableAllSchemas,
_searchTablePage,
formField,
searchField,
multiple,
type,
row,
_searchCondition,
undefined,
isConcatDetailSchemas,
searchDetailSchemas
)
}
const opensearchTable1 = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row,
isConcatDetailSchemas=false,
searchDetailSchemas: any
) => {
console.log(formField,searchField,searchTitle,searchAllSchemas,searchPage)
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
//
let filters: any[] = []
for (var i=0; i< searchCondition.length; i++ ) {
// searchCondition.forEach((item) => {
// row
if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = formRef1.value.formModel[searchCondition[i].value]
? formRef1.value.formModel[searchCondition[i].value]
: props.detailData
? props.detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
//
let isNull = false
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) {
isNull = true
}
if (isNull) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
}else if(searchCondition[i].isTableRowValue){
if(searchCondition[i].required){
if (row[searchCondition[i].value] == '' ||row[searchCondition[i].value] == undefined) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
}
row[searchCondition[i].value]
//table
_searchCondition[searchCondition[i].key] = row[searchCondition[i].value]
} else {
//
if (searchCondition[i].isSearch) {
if (searchCondition[i].isFormModel) {
//formModel
if(searchCondition[i].required){
if (formRef1.value.formModel[searchCondition[i].value] == '' ||formRef1.value.formModel[searchCondition[i].value] == undefined) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
}
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: formRef1.value.formModel[searchCondition[i].value]
})
}else{
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: searchCondition[i].value
})
}
} else {
_searchCondition[searchCondition[i].key] = searchCondition[i].value
}
}
}
if (filters.length > 0) {
_searchCondition.isSearch = true
_searchCondition.filters = filters
}
}
const _searchTableTitle = searchTitle
const _searchTableAllSchemas = searchAllSchemas
const _searchTablePage = searchPage
searchTableRef1.value.open(
_searchTableTitle,
_searchTableAllSchemas,
_searchTablePage,
formField,
searchField,
multiple,
type,
row,
_searchCondition,
undefined,
isConcatDetailSchemas,
searchDetailSchemas
)
}
// searchTable
const changeDialogWidth = (width)=>{
searchTableRef.value.changeDialogWidth(width)
}
const hiddenSearchTableFilterButton = ()=>{
searchTableRef.value.hiddenFilterButton()
}
const clearSearchInput = (field)=>{
emit('clearSearchInput',field)
}
const sumFormDataByTable = () => {
if(props.sumFormDataField){
const sumObject = {}
props.sumFormDataField.forEach(sumItem=>{
sumObject[sumItem?.formField]= props.tableData.reduce((prev, item) => prev + item[sumItem?.tableField],0)
})
nextTick(()=>{
formRef.value.setValues(sumObject)
})
}
}
watch(()=>props.tableData,() => {
sumFormDataByTable()
if(props?.sumFormDataByTableCustom&&unref(formRef)?.formModel&&props.tableData){
props?.sumFormDataByTableCustom(formRef,unref(formRef)?.formModel,props.tableData)
}
},{
deep:true
})
watch(()=>unref(formRef)?.formModel,() => {
if(props?.sumFormDataByForm&&unref(formRef)?.formModel){
props?.sumFormDataByForm(formRef,unref(formRef)?.formModel)
}
},{
deep:true
})
//
// val row
const searchTableSuccess = (formField, searchField, val, type, row) => {
emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
}
const searchTableSuccess1 = (formField, searchField, val, type, row) => {
emit('searchTableSuccess', formField, searchField, val, formRef1.value, type, row)
}
/** 打开弹窗 */
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any, alltitleName?: any) => {
dialogVisible.value = true
if(alltitleName){
dialogTitle.value = alltitleName
}else if (titleName) {
dialogTitle.value = t('action.' + titleName)
} else {
dialogTitle.value = t('action.' + type)
}
formType.value = type
resetForm()
//
// masterIdnumber
if (masterParmas) {
if (!row) {
row = {
masterId: masterParmas.masterId,
number: masterParmas.number
}
}
}
if (row?.id || row?.masterId) {
formLoading.value = true
try {
nextTick(() => {
formRef.value.setValues(row)
})
} finally {
formLoading.value = false
}
}else{
if(row){
nextTick(() => {
formRef.value.setValues(row)
})
}
}
}
//
const handleAddTable = () => {
if(props.isOpenSearchTable){
const tableFormKeys = {}
tableAllSchemas.value.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
if(props.fieldTableColumn!=''){
inpuFocus(tableAllSchemas.value.tableFormColumns.find(item=>item.field==props.fieldTableColumn),tableFormKeys,0)
}
}else{
emit('handleAddTable')
}
}
/** 弹窗按钮 */
let Butttondata:any = []
if (props.isShowFooterButtton) {
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
}
if (props.footButttondata) {
Butttondata = props.footButttondata
}
/** 按钮事件 */
const buttonBaseClick = (val) => {
//
if (props.footButttondata) {
emit('footButtonClick',val)
}
//
else if (val == 'save') {
submitForm()
}
//
else if (val == 'close') {
dialogVisible.value = false
}
}
/** 提交表单 */
// const emit = defineEmits(['success']) // success
const tableFormRef = ref()
const submitForm = async () => {
const elForm = unref(formRef)?.getElFormRef()
//
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
//
if (props.isBusiness) {
formLoading.value = true
if (formType.value == 'create') {
const validateForm = await tableFormRef.value.validateForm()
if (!validateForm && props.tableFormDataLength) {
if (props.tableData.length == 0) {
message.warning('请填写明细信息!')
formLoading.value = false
return
}
formLoading.value = false
return
}
//
try {
const data = unref(formRef)?.formModel
emit('submitForm', formType.value, data)
} finally {
formLoading.value = false
}
} else {
//
try {
const data = unref(formRef)?.formModel
emit('submitForm', formType.value, data)
} finally {
formLoading.value = false
}
}
} else {
//
formLoading.value = true
try {
const data = unref(formRef)?.formModel
emit('success', formType.value, data)
} finally {
formLoading.value = false
}
}
}
/** 重置表单 */
const resetForm = () => {
unref(formRef)?.resetFields()
}
//
const emit = defineEmits([
'success',
'tableSelectionChange',
'tableSelectionDelete',
'tableFormSelectOnBlur',
'extendedButtonsClick',
'formSelectChange',
'formSelectvVisibleChange',
'tableSortChange',
'selectCallback',
'handleTableSelect',
'handleDeleteTable',
'handleAddTable',
'inpuFocus',
'searchTableSuccess',
'opensearchTable',
'submitForm',
'selectChange',
'selectChangeDetail',
'tableFormChange',
'buttonOperationClick',
'inputStringBlur',
'onChange',
'onBlur',
'onEnter',
'inputNumberChange',
'formFormDateChange',
'footButtonClick',
'clearSearchInput',
'clearInput',
'inputFocusPlan'
])
//
const formSelectChange = (field, val, row) => {
emit('formSelectChange', field, val, row)
}
//
const formFormDateChange = (field, val,row, index) => {
emit('formFormDateChange', field, val,row, index)
}
const formSelectvVisibleChange = (field, val, row) => {
emit('formSelectvVisibleChange', field, val, row)
}
// selection
const tableSelectionChange = (val) => {
emit('tableSelectionChange', val)
}
const tableSelectionDelete = (val) => {
emit('tableSelectionDelete', val)
}
// tableform select bulr
const tableFormSelectOnBlur = (field, val, row, index) => {
emit('tableFormSelectOnBlur', field, val, row, index)
}
//
const tableSortChange = (column, prop, order) => {
emit('tableSortChange', column, prop, order)
}
// -
const inputNumberChange = (field, index, row, val) => {
emit('inputNumberChange', field, index, row, val)
}
//
// const showSelect = (val, statusID) => {
// return getDictForStatusID(val, statusID)
// }
//
const handleTableSelect = (row, column, event) => {
emit('handleTableSelect', row, column, event)
}
//
const handleDeleteTable = (row, index) => {
emit('handleDeleteTable', row, index,formRef.value)
}
const inputFocusPlan = (row)=>{
emit('inputFocusPlan', row)
}
//
const inpuFocus = (headerItem, row) => {
console.log(headerItem, row)
emit('inpuFocus', headerItem, row)
opensearchTable(
headerItem.field,
headerItem.tableForm.searchField,
row?.searchTable?.searchTitle,
row?.searchTable?.searchAllSchemas,
row?.searchTable?.searchPage,
headerItem.tableForm.searchCondition,
headerItem.tableForm.multiple,
'tableForm',
row,
headerItem.tableForm?.isConcatDetailSchemas,
headerItem.tableForm?.searchDetailSchemas
)
}
const clearInput = (field, row, index) => {
emit('clearInput',field, row, index)
}
/**
* 监听改变事件
* @param field 当前操作字段
* @param cur 改变后值
*/
const onChange = (field, cur) => {
emit('onChange', field, cur, formRef)
}
/**
* 监听失焦事件
* @param field 当前操作字段
* @param e
*/
const onBlur = (field, e) => {
emit('onBlur', field, e)
}
/**
* 回车事件
* @param field 当前操作字段
* @param e
*/
const onEnter = (field,value, e) => {
emit('onEnter', field,value, e)
}
//
const selectChange = (field, val) => {
emit('selectChange', field, val)
}
//
const selectChangeDetail = (field, val,formSchema) => {
formSchema.value = ''
emit('selectChangeDetail', field, val)
}
const tableFormChange = (field, val, row) => {
emit('tableFormChange', field, val, row)
}
const buttonOperationClick = (row, label, index)=> {
emit("buttonOperationClick", row, label, index);
}
const inputStringBlur = (headerItem, row, index)=> {
emit("inputStringBlur", headerItem, row, index);
}
defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading ,handleAddTable,changeDialogWidth}) // open
</script>
<style lang="scss" scoped>
.table {
border: 1px solid #dedede;
border-radius: 8px;
padding: 10px;
width: calc(100% - 32px);
display: flex;
}
::v-deep(.el-table__body) {
padding: 10px 0px;
}
::v-deep(.el-table--default .el-table__cell) {
padding: 2px 0px;
border: none;
}
::v-deep(.el-table td.el-table__cell .el-form-item__content) {
display: flex !important;
align-items: center !important;
justify-content: center !important;
}
::v-deep(.el-table td.el-table__cell div) {
overflow: visible;
}
::v-deep(.el-icon) {
display: block;
}button
.button {
> div {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
> div {
margin-left: 6px;
text-decoration: underline;
color: #409eff;
}
}
}
</style>

20
src/components/DetailTable/src/DetailTable.vue

@ -9,8 +9,8 @@
</el-table-column> </el-table-column>
<el-table-column :prop="columns[1].field" :label="columns[1].label" align="center"> <el-table-column :prop="columns[1].field" :label="columns[1].label" align="center">
<template #default="scope"> <template #default="scope">
<div v-if=" scope.row.type == 'PROJECT'"> {{ scope.row.value }}</div> <div v-if="scope.row.type == 'ABC' || scope.row.type == 'ITEMS_TYPE' ||scope.row.type == 'ITEMS_GROUP' "> {{ forrmatter1(scope.row) }}</div>
<div v-else> {{ forrmatter1(scope.row) }}</div> <div v-else> {{ scope.row.value }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="" label="操作" align="center"> <el-table-column prop="" label="操作" align="center">
@ -66,11 +66,11 @@ const forrmatter = (val) => {
} }
const forrmatter1 = (item) => { const forrmatter1 = (item) => {
if(item?.type == 'OWNER'){ if(item?.type == 'OWNER'){
return allList.value.ownerAllList.find((cur) => cur.value == item.value).label // return allList.value.ownerAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'SUPPLIER'){ }else if(item?.type == 'SUPPLIER'){
return allList.value.supplierAllList.find((cur) => cur.value == item.value).label // return allList.value.supplierAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'CUSTOMER'){ }else if(item?.type == 'CUSTOMER'){
return allList.value.customerAllList.find((cur) => cur.value == item.value).label // return allList.value.customerAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'ABC'){ }else if(item?.type == 'ABC'){
return allList.value.abcList.find((cur) => cur.value == item.value).label return allList.value.abcList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'ITEMS_TYPE'){ }else if(item?.type == 'ITEMS_TYPE'){
@ -78,15 +78,15 @@ const forrmatter1 = (item) => {
}else if(item?.type == 'ITEMS_GROUP'){ }else if(item?.type == 'ITEMS_GROUP'){
return allList.value.itemGroupList.find((cur) => cur.value == item.value).label return allList.value.itemGroupList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'ITEMS_CODE'){ }else if(item?.type == 'ITEMS_CODE'){
return allList.value.itembasicAllList.find((cur) => cur.value == item.value).label // return allList.value.itembasicAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'WAREHOUSE_CODE'){ }else if(item?.type == 'WAREHOUSE_CODE'){
return allList.value.warehouseAllList.find((cur) => cur.value == item.value).label // return allList.value.warehouseAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'AREABASIC_CODE'){ }else if(item?.type == 'AREABASIC_CODE'){
return allList.value.areaAllList.find((cur) => cur.value == item.value).label // return allList.value.areaAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'LOCATIONGROUP_CODE'){ }else if(item?.type == 'LOCATIONGROUP_CODE'){
return allList.value.locationgroupAllList.find((cur) => cur.value == item.value).label // return allList.value.locationgroupAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'LOCATION_CODE'){ }else if(item?.type == 'LOCATION_CODE'){
return allList.value.locationAllList.find((cur) => cur.value == item.value).label // return allList.value.locationAllList.find((cur) => cur.value == item.value).label
}else{ }else{
return '' return ''
} }

187
src/components/TableFormCountPlan/src/TableFormCountPlan.vue

@ -2,97 +2,117 @@
<template> <template>
<!-- 盘点计划的子表 --> <!-- 盘点计划的子表 -->
<div class="table1"> <div class="table1">
<el-table :data="tableData" stripe style="width: 100%" <el-table :data="tableData" stripe style="width: 100%" ref="TableBaseComponents_Ref">
ref="TableBaseComponents_Ref" >
<el-table-column fixed="left" :width="50" v-slot="{ row, $index }"> <el-table-column fixed="left" :width="50" v-slot="{ row, $index }">
<Icon <Icon
icon="ep:remove" icon="ep:remove"
color="#757575" color="#757575"
size="26" size="26"
style="cursor: pointer;margin-top: -16px;" style="cursor: pointer; margin-top: -16px"
@click="handleDeleteTable(row, $index)" @click="handleDeleteTable(row, $index)"
/> />
</el-table-column> </el-table-column>
<el-table-column :label="tableFields[0].label" align="center" v-slot="{ row, $index }"> <el-table-column :label="tableFields[0].label" align="center" v-slot="{ row, $index }">
<el-form :key="'类型form'+$index" <el-form
ref="TableBaseForm_Ref" :key="'类型form' + $index"
:model="row" ref="TableBaseForm_Ref"
style="width: 100%;" :model="row"
style="width: 100%"
:rules="tableFormRules" :rules="tableFormRules"
:class="tableFormRules ? '' : 'noRulesForm'"> :class="tableFormRules ? '' : 'noRulesForm'"
<el-form-item :key="'类型formitem'+$index" :prop="tableFields[0].field"> >
<el-select :key="'类型select'+row.id+$index" <el-form-item :key="'类型formitem' + $index" :prop="tableFields[0].field">
<el-select
:key="'类型select' + row.id + $index"
v-model="row.type" v-model="row.type"
:placeholder="tableFields[0].placeholder || '请输入' + tableFields[0].label" :placeholder="tableFields[0].placeholder || '请输入' + tableFields[0].label"
@change="tableFormChange(tableFields[0].field, $event, row)" @change="tableFormChange(tableFields[0].field, $event, row)"
> >
<el-option <el-option
v-for="dict in countScopeType" v-for="dict in countScopeType"
:key="'类型option'+dict.value" :key="'类型option' + dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
:prop="tableFields[1].field" :prop="tableFields[1].field"
:label="tableFields[1].label" :label="tableFields[1].label"
align="center" v-slot="{ row, $index }" align="center"
v-slot="{ row, $index }"
> >
<el-form :key="'值form'+$index" <el-form
ref="TableBaseForm_Ref1" :key="'值form' + $index"
:model="row" ref="TableBaseForm_Ref1"
style="width: 100%;" :model="row"
style="width: 100%"
:rules="tableFormRules" :rules="tableFormRules"
:class="tableFormRules ? '' : 'noRulesForm'"> :class="tableFormRules ? '' : 'noRulesForm'"
<el-form-item :key="'值formitem'+$index" :prop="tableFields[1].field"> >
<el-select :key="'值select'+row.id+$index" <el-form-item
:key="'值formitem' + $index"
:prop="tableFields[1].field"
v-if="
row.type == 'OWNER' ||
row.type == 'SUPPLIER' ||
row.type == 'CUSTOMER' ||
row.type == 'ITEMS_CODE' ||
row.type == 'WAREHOUSE_CODE' ||
row.type == 'AREABASIC_CODE' ||
row.type == 'LOCATIONGROUP_CODE' ||
row.type == 'LOCATION_CODE'
"
>
<el-input
:key="'值input' + $index"
v-model="row.value"
:placeholder="tableFields[1].placeholder || '请输入' + tableFields[1].label"
:disabled = "row.disabled || false"
style="flex: 1"
/>
<el-button :key="'值button' + $index" @click="inpuFocus(tableFields[1], row)"
><Icon icon="ep:search" size="14"
/></el-button>
</el-form-item>
<el-form-item
:key="'值formitem' + $index"
:prop="tableFields[1].field"
v-else-if="row.type == 'ABC' || row.type == 'ITEMS_TYPE' || row.type == 'ITEMS_GROUP'"
>
<el-select
:key="'值select' + row.id + $index"
v-model="row.value" v-model="row.value"
:placeholder=" :placeholder="tableFields[1].placeholder || '请输入' + tableFields[1].label"
tableFields[1].placeholder ||
'请输入' + tableFields[1].label
"
filterable filterable
:filter-method="(value) =>filterMethod(value,row)" :filter-method="(value) => filterMethod(value, row)"
@focus="focusValue(row)" @focus="focusValue(row)"
v-if=" :disabled = "row.disabled || false"
row.type == 'OWNER' ||
row.type == 'SUPPLIER' ||
row.type == 'CUSTOMER' ||
row.type == 'ABC' ||
row.type == 'ITEMS_TYPE' ||
row.type == 'ITEMS_GROUP' ||
row.type == 'ITEMS_CODE' ||
row.type == 'WAREHOUSE_CODE' ||
row.type == 'AREABASIC_CODE' ||
row.type == 'LOCATIONGROUP_CODE' ||
row.type == 'LOCATION_CODE'
"
> >
<el-option <el-option
v-for="item in currentList(initOptions_result)" v-for="item in row.initOptions"
:key="'值option'+item.value" :key="'值option' + item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
<div style="display: flex;align-items: center"> <!-- <div style="display: flex;align-items: center">
<span style="padding: 10px;">{{ pageCount }} </span> <span style="padding: 10px;">{{ pageCount }} </span>
<el-button text bg size="small" :disabled="pageCount<=1" @click="prexPage">上一页</el-button> <el-button text bg size="small" :disabled="pageCount<=1" @click="prexPage">上一页</el-button>
<el-button text bg size="small" :disabled="initOptions_result&&pageCount*15>=initOptions_result.length" @click="nextPage">下一页</el-button> <el-button text bg size="small" :disabled="initOptions_result&&pageCount*15>=initOptions_result.length" @click="nextPage">下一页</el-button>
</div> </div> -->
</el-select> </el-select>
<el-input :key="'值input'+$index" </el-form-item>
<el-form-item :key="'值formitem' + $index" :prop="tableFields[1].field" v-else>
<el-input
:key="'值input' + $index"
v-model="row.value" v-model="row.value"
:placeholder=" :disabled = "row.disabled || false"
tableFields[1].placeholder || :placeholder="tableFields[1].placeholder || '请输入' + tableFields[1].label"
'请输入' + tableFields[1].label
"
v-else
/> />
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="button flex"> <div class="button flex">
@ -132,7 +152,7 @@ const props = defineProps({
type: Array, type: Array,
required: false, required: false,
default: [] default: []
}, }
}) })
const tableData = props.tableData const tableData = props.tableData
const tableFields = props.tableFields const tableFields = props.tableFields
@ -140,26 +160,28 @@ const TableBaseComponents_Ref = ref()
const TableBaseForm_Ref = ref() const TableBaseForm_Ref = ref()
const TableBaseForm_Ref1 = ref() const TableBaseForm_Ref1 = ref()
const tableFormRules = ref(props.tableFormRules) const tableFormRules = ref(props.tableFormRules)
console.log('tableFormRules',tableFormRules.value) console.log('tableFormRules', tableFormRules.value)
/** /**
* 验证表单是否符合rules * 验证表单是否符合rules
* @param {*} success 如果验证成功走的方法 * @param {*} success 如果验证成功走的方法
* @param {*} error 如果验证不成功走的方法 * @param {*} error 如果验证不成功走的方法
*/ */
const validateForm = () => { const validateForm = () => {
let TableBaseForm_Arr = [] let TableBaseForm_Arr = []
TableBaseForm_Arr.push(TableBaseForm_Ref.value) TableBaseForm_Arr.push(TableBaseForm_Ref.value)
TableBaseForm_Arr.push(TableBaseForm_Ref1.value) TableBaseForm_Arr.push(TableBaseForm_Ref1.value)
let _lists = TableBaseForm_Arr?.map(v => v.validate()) let _lists = TableBaseForm_Arr?.map((v) => v.validate())
return Promise.all(_lists).then(() => { return Promise.all(_lists)
return true .then(() => {
}).catch(() => { return true
return false })
}) .catch(() => {
return false
})
} }
// //
const emit = defineEmits(['handleAddTable', 'selectChange', 'tableFormChange']) const emit = defineEmits(['handleAddTable', 'selectChange', 'tableFormChange', 'inpuFocus'])
// //
const selectChange = (field, val) => { const selectChange = (field, val) => {
emit('selectChange', field, val) emit('selectChange', field, val)
@ -179,21 +201,21 @@ const handleDeleteTable = (row, index) => {
} }
const pageCount = ref(1) const pageCount = ref(1)
const currentList = (options)=>{ const currentList = (options) => {
if(options&&options.length>0){ if (options && options.length > 0) {
return options.slice((pageCount.value-1)*15,pageCount.value*15) return options.slice((pageCount.value - 1) * 15, pageCount.value * 15)
}else{ } else {
return [] return []
} }
} }
const nextPage = ()=>{ const nextPage = () => {
pageCount.value++ pageCount.value++
} }
const prexPage = ()=>{ const prexPage = () => {
pageCount.value-- pageCount.value--
} }
const initOptions_result = ref([]) const initOptions_result = ref([])
const filterMethod = (query,row)=>{ const filterMethod = (query, row) => {
console.log('filterMethod') console.log('filterMethod')
if (query) { if (query) {
initOptions_result.value = row.initOptions.filter((item) => { initOptions_result.value = row.initOptions.filter((item) => {
@ -203,25 +225,28 @@ const filterMethod = (query,row)=>{
initOptions_result.value = [...row.initOptions] initOptions_result.value = [...row.initOptions]
} }
} }
const focusValue = (row)=>{ const focusValue = (row) => {
console.log('focusValue',row) console.log('focusValue', row)
if(!row.value){ if (!row.value) {
initOptions_result.value = [...row.initOptions] initOptions_result.value = [...row.initOptions]
} }
} }
const inpuFocus = (headerItem, row) => {
console.log(111, headerItem, row)
emit('inpuFocus', headerItem, row)
}
// setup // setup
defineExpose({ defineExpose({
TableBaseComponents_Ref, TableBaseComponents_Ref,
validateForm validateForm
}) })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.table1 { .table1 {
border: 1px solid #dedede; border: 1px solid #dedede;
border-radius: 8px; border-radius: 8px;
padding: 10px; padding: 10px;
width: calc(100% - 20px); width: calc(100% - 30px);
} }
.button { .button {
> div { > div {

158
src/views/wms/countManage/count/countPlanMain/countPlanMain.data.ts

@ -78,47 +78,50 @@ export const CountPlanMain = useCrudSchemas(reactive<CrudSchema[]>([
}, },
form: { form: {
component: 'InputNumber', component: 'InputNumber',
} componentProps:{
}, disabled:false
{
label: '物料忽略名单',
field: 'ignoreListOfItem',
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
multiple:true,//是否可以多选
searchListPlaceholder: '请选择物料忽略名单', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage // 查询弹窗所需分页方法
} }
} }
}, },
{ // {
label: '库位忽略名单', // label: '物料忽略名单',
field: 'ignoreListOfLocation', // field: 'ignoreListOfItem',
sort: 'custom', // sort: 'custom',
table: { // table: {
width: 150 // width: 150
}, // },
form: { // form: {
componentProps: { // componentProps: {
isSearchList: true, // 开启查询弹窗 // isSearchList: true, // 开启查询弹窗
multiple:true,//是否可以多选 // multiple:true,//是否可以多选
searchListPlaceholder: '请选择库位忽略名单', // 输入框占位文本 // searchListPlaceholder: '请选择物料忽略名单', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段 // searchField: 'code', // 查询弹窗赋值字段
searchTitle: '库位信息', // 查询弹窗标题 // searchTitle: '物料信息', // 查询弹窗标题
searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 // searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: LocationApi.getLocationPage // 查询弹窗所需分页方法 // searchPage: ItembasicApi.getItembasicPage // 查询弹窗所需分页方法
// }
// }
// },
// {
// label: '库位忽略名单',
// field: 'ignoreListOfLocation',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// multiple:true,//是否可以多选
// searchListPlaceholder: '请选择库位忽略名单', // 输入框占位文本
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '库位信息', // 查询弹窗标题
// searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
// searchPage: LocationApi.getLocationPage // 查询弹窗所需分页方法
} // }
} // }
}, // },
// { // {
// label: '盘点范围列表', // label: '盘点范围列表',
// field: 'scopeList', // field: 'scopeList',
@ -487,9 +490,7 @@ export const CountPlanMainRules = reactive({
crontab: [ crontab: [
{ required: false, message: '请填写执行周期', trigger: ['change','blur'] },{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { required: false, message: '请填写执行周期', trigger: ['change','blur'] },{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
], ],
ignoreListOfItem: [
{ required: true, message: '请选物料选择名单', trigger: 'change' }
],
isSnapshot: [ isSnapshot: [
{ required: true, message: '请选择快照盘点', trigger: 'change' } { required: true, message: '请选择快照盘点', trigger: 'change' }
], ],
@ -720,7 +721,7 @@ export const CountPlanDetail = useCrudSchemas(<CrudSchema[]>([
isTable: true, isTable: true,
sort: 'custom', sort: 'custom',
table: { table: {
width: 300 width: 400
}, },
tableForm: { tableForm: {
type: 'Select', type: 'Select',
@ -736,8 +737,33 @@ export const CountPlanDetail = useCrudSchemas(<CrudSchema[]>([
width: 300 width: 300
}, },
tableForm: { tableForm: {
width: '300', width: 400,
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择盘点范围类型',
searchField: 'type',
multiple:true,//是否可以多选
searchTitle: '物料信息',
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}, },
form: {
componentProps: {
disable:true,
isSearchList: true, // 开启查询弹窗
multiple:true,//是否可以多选
searchListPlaceholder: '请选择盘点范围类型', // 输入框占位文本
searchField: 'type', // 查询弹窗赋值字段
searchTitle: '物料信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage // 查询弹窗所需分页方法
}
}
}, },
{ {
label: '操作', label: '操作',
@ -757,7 +783,51 @@ export const CountPlanDetailRules = reactive({
{ required: true, message: '请选择盘点范围类型', trigger: 'change' } { required: true, message: '请选择盘点范围类型', trigger: 'change' }
], ],
value: [ value: [
{ required: true, message: '请选择盘点范围值', trigger: 'blur' }, { required: true, message: '请选择盘点范围值', trigger: ['blur','change'] },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: ['blur','change'] }
], ],
}) })
/**
* @returns {Array}
*/
export const CountPlanMain1 = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料忽略名单',
field: 'ignoreListOfItem',
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
multiple:true,//是否可以多选
searchListPlaceholder: '请选择物料忽略名单', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage // 查询弹窗所需分页方法
}
}
},
{
label: '库位忽略名单',
field: 'ignoreListOfLocation',
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
multiple:true,//是否可以多选
searchListPlaceholder: '请选择库位忽略名单', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '库位信息', // 查询弹窗标题
searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
searchPage: LocationApi.getLocationPage // 查询弹窗所需分页方法
}
}
},
]))

646
src/views/wms/countManage/count/countPlanMain/index.vue

File diff suppressed because it is too large
Loading…
Cancel
Save