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. 105
      src/components/TableFormCountPlan/src/TableFormCountPlan.vue
  4. 156
      src/views/wms/countManage/count/countPlanMain/countPlanMain.data.ts
  5. 430
      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 :prop="columns[1].field" :label="columns[1].label" align="center">
<template #default="scope">
<div v-if=" scope.row.type == 'PROJECT'"> {{ scope.row.value }}</div>
<div v-else> {{ forrmatter1(scope.row) }}</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> {{ scope.row.value }}</div>
</template>
</el-table-column>
<el-table-column prop="" label="操作" align="center">
@ -66,11 +66,11 @@ const forrmatter = (val) => {
}
const forrmatter1 = (item) => {
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'){
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'){
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'){
return allList.value.abcList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'ITEMS_TYPE'){
@ -78,15 +78,15 @@ const forrmatter1 = (item) => {
}else if(item?.type == 'ITEMS_GROUP'){
return allList.value.itemGroupList.find((cur) => cur.value == item.value).label
}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'){
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'){
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'){
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'){
return allList.value.locationAllList.find((cur) => cur.value == item.value).label
// return allList.value.locationAllList.find((cur) => cur.value == item.value).label
}else{
return ''
}

105
src/components/TableFormCountPlan/src/TableFormCountPlan.vue

@ -2,26 +2,28 @@
<template>
<!-- 盘点计划的子表 -->
<div class="table1">
<el-table :data="tableData" stripe style="width: 100%"
ref="TableBaseComponents_Ref" >
<el-table :data="tableData" stripe style="width: 100%" ref="TableBaseComponents_Ref">
<el-table-column fixed="left" :width="50" v-slot="{ row, $index }">
<Icon
icon="ep:remove"
color="#757575"
size="26"
style="cursor: pointer;margin-top: -16px;"
style="cursor: pointer; margin-top: -16px"
@click="handleDeleteTable(row, $index)"
/>
</el-table-column>
<el-table-column :label="tableFields[0].label" align="center" v-slot="{ row, $index }">
<el-form :key="'类型form'+$index"
<el-form
:key="'类型form' + $index"
ref="TableBaseForm_Ref"
:model="row"
style="width: 100%;"
style="width: 100%"
: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-select
:key="'类型select' + row.id + $index"
v-model="row.type"
:placeholder="tableFields[0].placeholder || '请输入' + tableFields[0].label"
@change="tableFormChange(tableFields[0].field, $event, row)"
@ -39,57 +41,75 @@
<el-table-column
:prop="tableFields[1].field"
:label="tableFields[1].label"
align="center" v-slot="{ row, $index }"
align="center"
v-slot="{ row, $index }"
>
<el-form :key="'值form'+$index"
<el-form
:key="'值form' + $index"
ref="TableBaseForm_Ref1"
:model="row"
style="width: 100%;"
style="width: 100%"
:rules="tableFormRules"
:class="tableFormRules ? '' : 'noRulesForm'">
<el-form-item :key="'值formitem'+$index" :prop="tableFields[1].field">
<el-select :key="'值select'+row.id+$index"
v-model="row.value"
:placeholder="
tableFields[1].placeholder ||
'请输入' + tableFields[1].label
"
filterable
:filter-method="(value) =>filterMethod(value,row)"
@focus="focusValue(row)"
:class="tableFormRules ? '' : 'noRulesForm'"
>
<el-form-item
:key="'值formitem' + $index"
:prop="tableFields[1].field"
v-if="
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-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"
:placeholder="tableFields[1].placeholder || '请输入' + tableFields[1].label"
filterable
:filter-method="(value) => filterMethod(value, row)"
@focus="focusValue(row)"
:disabled = "row.disabled || false"
>
<el-option
v-for="item in currentList(initOptions_result)"
v-for="item in row.initOptions"
:key="'值option' + item.value"
:label="item.label"
:value="item.value"
/>
<div style="display: flex;align-items: center">
<!-- <div style="display: flex;align-items: center">
<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="initOptions_result&&pageCount*15>=initOptions_result.length" @click="nextPage">下一页</el-button>
</div>
</div> -->
</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"
:placeholder="
tableFields[1].placeholder ||
'请输入' + tableFields[1].label
"
v-else
:disabled = "row.disabled || false"
:placeholder="tableFields[1].placeholder || '请输入' + tableFields[1].label"
/>
</el-form-item>
</el-form>
@ -132,7 +152,7 @@ const props = defineProps({
type: Array,
required: false,
default: []
},
}
})
const tableData = props.tableData
const tableFields = props.tableFields
@ -151,15 +171,17 @@ console.log('tableFormRules',tableFormRules.value)
let TableBaseForm_Arr = []
TableBaseForm_Arr.push(TableBaseForm_Ref.value)
TableBaseForm_Arr.push(TableBaseForm_Ref1.value)
let _lists = TableBaseForm_Arr?.map(v => v.validate())
return Promise.all(_lists).then(() => {
let _lists = TableBaseForm_Arr?.map((v) => v.validate())
return Promise.all(_lists)
.then(() => {
return true
}).catch(() => {
})
.catch(() => {
return false
})
}
//
const emit = defineEmits(['handleAddTable', 'selectChange', 'tableFormChange'])
const emit = defineEmits(['handleAddTable', 'selectChange', 'tableFormChange', 'inpuFocus'])
//
const selectChange = (field, val) => {
emit('selectChange', field, val)
@ -209,19 +231,22 @@ const focusValue = (row)=>{
initOptions_result.value = [...row.initOptions]
}
}
const inpuFocus = (headerItem, row) => {
console.log(111, headerItem, row)
emit('inpuFocus', headerItem, row)
}
// setup
defineExpose({
TableBaseComponents_Ref,
validateForm
})
</script>
<style scoped lang="scss">
.table1 {
border: 1px solid #dedede;
border-radius: 8px;
padding: 10px;
width: calc(100% - 20px);
width: calc(100% - 30px);
}
.button {
> div {

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

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

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

@ -20,7 +20,8 @@
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable
<Table
v-clientTable
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
@ -38,20 +39,22 @@
</template>
<template #action="{ row, $index }">
<ButtonBase
:Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event, row)"
:Butttondata="butttondata(row, $index)"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
<BasicFormWmsCount
ref="formRef"
@success="getList"
:rules="CountPlanMainRules"
:formAllSchemas="CountPlanMain.allSchemas"
:tableAllSchemas="CountPlanDetail.allSchemas"
:tableFormRules="CountPlanDetailRules"
:CountPlanMain1FormAllSchemas="CountPlanMain1.allSchemas"
:tableData="tableData"
:apiUpdate="CountPlanMainApi.updateCountPlanMain"
:apiCreate="CountPlanMainApi.createCountPlanMain"
@ -67,6 +70,7 @@
@formSelectvVisibleChange="formSelectvVisibleChange"
@selectChange="selectChange"
@tableFormChange="tableFormChange"
@onChange="onChange"
/>
<!-- 详情 -->
@ -88,6 +92,7 @@
fromeWhere="countPlan"
:formTypeDetail="formTypeDetail"
:countPlanAllList="countPlanAllList"
@searchTableSuccessDetail="searchTableSuccessDetail"
@detailOpenForm="detailOpenForm"
:detailButtonIsShowFilter="false"
/>
@ -107,22 +112,38 @@ import {
CountPlanMain,
CountPlanMainRules,
CountPlanDetail,
CountPlanDetailRules
CountPlanDetailRules,
CountPlanMain1
} from './countPlanMain.data'
import * as CountPlanMainApi from '@/api/wms/countPlanMain'
import * as CountPlanDetailApi from '@/api/wms/countPlanDetail'
import { Owner } from '@/views/wms/basicDataManage/orderManage/owner/owner.data'
import * as OwnerApi from '@/api/wms/owner'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as SupplierApi from '@/api/wms/supplier'
import { Customer } from '@/views/wms/basicDataManage/customerManage/customer/customer.data'
import * as CustomerApi from '@/api/wms/customer'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import * as ItembasicApi from '@/api/wms/itembasic'
import { Warehouse } from '@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data'
import * as WarehouseApi from '@/api/wms/warehouse'
import { Area } from '@/views/wms/basicDataManage/factoryModeling/areabasic/areabasic.data'
import * as AreaApi from '@/api/wms/areabasic'
import { Locationgroup } from '@/views/wms/basicDataManage/factoryModeling/locationgroup/locationgroup.data'
import * as LocationgroupApi from '@/api/wms/locationgroup'
import * as LocationpApi from '@/api/wms/location'
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data'
import * as LocationApi from '@/api/wms/location'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
import BasicFormWmsCount from '@/components/BasicForm/src/BasicFormWmsCount.vue'
//
defineOptions({ name: 'CountPlanMain' })
@ -134,6 +155,7 @@ const route = useRoute() // 路由信息
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(CountPlanMain.allSchemas.tableColumns)
const countPlanAllList = ref([]) //
//
const updataTableColumns = (val) => {
@ -154,18 +176,9 @@ const searchTableParams = ref([
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => {
if (type == 'tableForm') {
//
//row[formField] = val[0][searchField]
//row['poLine'] = val[0]['poLine']
//row['batch'] = val[0]['toBatch']
//row['altBatch'] = val[0]['altBatch']
//row['itemCode'] = val[0]['itemCode']
//row['itemName'] = val[0]['itemName']
//row['itemDesc1'] = val[0]['itemDesc1']
//row['itemDesc2'] = val[0]['itemDesc2']
//row['projectCode'] = val[0]['projectCode']
//row['qty'] = val[0]['qty']
//row['uom'] = val[0]['uom']
if (formField == 'value') {
row[formField] = val.map((item) => item.code).join(',')
}
} else {
const setV = {}
// setV[formField] = val[0][searchField]
@ -174,8 +187,14 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
}
})
}
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(async () => {
const setV = {}
setV[formField] = val.map((item) => item.code).join(',')
formRef.setValues(setV)
})
}
const Echo = []
const { tableObject, tableMethods } = useTable({
@ -242,7 +261,6 @@ const isShowMainButton = (row, val) => {
// -
const butttondata = (row, $index) => {
return [
defaultButtons.mainListPlanOpeBtn({
hide: isShowMainButton(row, ['5']),
@ -281,93 +299,119 @@ const butttondata = (row,$index) => {
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainPlanOpe') { //
if (val == 'mainPlanOpe') {
//
tableObject.loading = true
CountPlanMainApi.open(row.id).then(() => {
CountPlanMainApi.open(row.id)
.then(() => {
message.success(t('打开成功'))
tableObject.loading = false
getList()
}).catch(err => {
})
.catch((err) => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainPlanClo') { //
} else if (val == 'mainPlanClo') {
//
await message.confirm('确认要关闭吗?')
tableObject.loading = true
CountPlanMainApi.close(row.id).then(() => {
CountPlanMainApi.close(row.id)
.then(() => {
message.success(t('关闭成功'))
tableObject.loading = false
getList()
}).catch(err => {
})
.catch((err) => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainPlanSub') { //
} else if (val == 'mainPlanSub') {
//
await message.confirm(t('common.confirmSubmit'))
tableObject.loading = true
await CountPlanMainApi.submit(row.id)
message.success(t('提交审批成功'))
tableObject.loading = false
await getList()
} else if (val == 'mainPlanTur') { //
} else if (val == 'mainPlanTur') {
//
await message.confirm('确认要驳回吗?')
tableObject.loading = true
CountPlanMainApi.reject(row.id).then(() => {
CountPlanMainApi.reject(row.id)
.then(() => {
message.success(t('驳回成功'))
tableObject.loading = false
getList()
}).catch(err => {
})
.catch((err) => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainPlanApp') { //
} else if (val == 'mainPlanApp') {
//
await message.confirm('确认要审批通过吗?')
tableObject.loading = true
CountPlanMainApi.agree(row.id).then(() => {
CountPlanMainApi.agree(row.id)
.then(() => {
message.success(t('审批已通过'))
tableObject.loading = false
getList()
}).catch(err => {
})
.catch((err) => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainPlanPub') { //
} else if (val == 'mainPlanPub') {
//
await message.confirm('确认要发布吗?')
tableObject.loading = true
CountPlanMainApi.publish(row.id).then(() => {
CountPlanMainApi.publish(row.id)
.then(() => {
message.success(t('发布成功'))
tableObject.loading = false
getList()
}).catch(err => {
})
.catch((err) => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'mainPlanRes') { //
} else if (val == 'mainPlanRes') {
//
await message.confirm('确认要重置吗?')
tableObject.loading = true
CountPlanMainApi.resetting(row.id).then(() => {
CountPlanMainApi.resetting(row.id)
.then(() => {
message.success(t('common.updateSuccess'))
tableObject.loading = false
getList()
}).catch(err => {
})
.catch((err) => {
tableObject.loading = false
console.log(err)
})
} else if (val == 'edit') { //
} else if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
} else if (val == 'delete') {
//
handleDelete(row.id)
}
}
const onChange = (field, value) => {
console.log(field, value)
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = async (type: string, row?: number) => {
const openForm = async (type: string, row?: any) => {
tableData.value = [
{
type: '',
value: []
}
] //
row = row ? row : {}
row.dimension = 'BY_INEVNEOTY'
formRef.value.open(type, row)
// Promise.all([getOwnerAllList(),
@ -413,40 +457,117 @@ const detailOpenForm = (type, row) => {
formTypeDetail.value = 'Select'
switch (row.type) {
case 'OWNER':
getOwnerAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isSearchList = true
item.componentProps.searchTitle = '货主信息'
item.componentProps.searchAllSchemas = Owner.allSchemas
item.componentProps.searchPage = OwnerApi.getOwnerPage
}
})
break
case 'SUPPLIER':
getSupplierAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isSearchList = true
item.componentProps.searchTitle = '供应商信息'
item.componentProps.searchAllSchemas = Supplier.allSchemas
item.componentProps.searchPage = SupplierApi.getSupplierPage
}
})
break
case 'CUSTOMER':
getCustomerAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isSearchList = true
item.componentProps.searchTitle = '客戶信息'
item.componentProps.searchAllSchemas = Customer.allSchemas
item.componentProps.searchPage = CustomerApi.getCustomerPage
}
})
break
case 'ABC':
countPlanAllList.value = getStrDictOptions(DICT_TYPE.ABC_CLASS)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.component = 'Select'
item.componentProps.isSearchList = false
item.componentProps.options = getStrDictOptions(DICT_TYPE.ABC_CLASS)
}
})
break
case 'ITEMS_TYPE':
countPlanAllList.value = getStrDictOptions(DICT_TYPE.ITEM_TYPE)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.component = 'Select'
item.componentProps.isSearchList = false
item.componentProps.options = getStrDictOptions(DICT_TYPE.ITEM_TYPE)
}
})
break
case 'ITEMS_GROUP':
countPlanAllList.value = getStrDictOptions(DICT_TYPE.ITEM_GROUP)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.component = 'Select'
item.componentProps.isSearchList = false
item.componentProps.options = getStrDictOptions(DICT_TYPE.ITEM_GROUP)
}
})
break
case 'ITEMS_CODE':
getItembasicAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isInpuFocusShow = true
item.componentProps.searchTitle = '物品信息'
item.componentProps.searchAllSchemas = Itembasic.allSchemas
item.componentProps.searchPage = ItembasicApi.getItembasicPage
}
})
break
case 'WAREHOUSE_CODE':
getWarehouseAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isInpuFocusShow = true
item.componentProps.searchTitle = '仓库信息'
item.componentProps.searchAllSchemas = Warehouse.allSchemas
item.componentProps.searchPage = WarehouseApi.getWarehousePage
}
})
break
case 'AREABASIC_CODE':
getAreaAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isInpuFocusShow = true
item.componentProps.searchTitle = '库区信息'
item.componentProps.searchAllSchemas = Area.allSchemas
item.componentProps.searchPage = AreaApi.getAreaPage
}
})
break
case 'LOCATIONGROUP_CODE':
getLocationgroupAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isInpuFocusShow = true
item.componentProps.searchTitle = '库位组信息'
item.componentProps.searchAllSchemas = Locationgroup.allSchemas
item.componentProps.searchPage = LocationgroupApi.getLocationgroupPage
}
})
break
case 'LOCATION_CODE':
getLocationAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isInpuFocusShow = true
item.componentProps.searchTitle = '库位组信息'
item.componentProps.searchAllSchemas = Location.allSchemas
item.componentProps.searchPage = LocationApi.getLocationPage
}
})
break
}
} else if (val == 'PROJECT') {
} else if ( row.type == 'PROJECT') {
formTypeDetail.value = 'InputString'
}
}
@ -511,7 +632,7 @@ const handleDeleteTable = (item, index) => {
tableData.value.splice(index, 1)
}
const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item))
tableData.value = tableData.value.filter((item) => !selection.includes(item))
}
//
const submitForm = async (formType, data) => {
@ -569,29 +690,26 @@ const selectChange = (field, val) => {
if (field == 'type') {
//
if (val == 'CYCLE') {
// CountPlanMain.allSchemas.formSchema.splice(1,0,{
// component: "Input",
// componentProps: {},
// field:"crontab",
// label:"",
// value:""
// })
console.log(CountPlanMain.allSchemas.formSchema)
CountPlanMain.allSchemas.formSchema.forEach(item=>{
CountPlanMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'crontab') {
item.componentProps.disabled = false
}
if (item.field == 'limitedValue') {
item.componentProps.disabled = true
}
})
CountPlanMainRules.crontab[0].required = true
} else {
CountPlanMainRules.crontab[0].required = false
CountPlanMain.allSchemas.formSchema.forEach(item=>{
CountPlanMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'crontab') {
item.componentProps.disabled = true
}
if (item.field == 'limitedValue') {
item.componentProps.disabled = true
}
})
// CountPlanMain.allSchemas.formSchema.splice(1,1)
}
if (val == 'DYNAMIC') {
@ -610,9 +728,9 @@ const selectChange = (field, val) => {
}
}
const formTypeDetail = ref('InputString') //
const countPlanAllList = ref([]) //
//
const selectChangeDetail = (field, val) => {
console.log(field, val)
if (field == 'type') {
// CountPlanDetail.allSchemas.formSchema[1].value = ''
if (
@ -631,37 +749,114 @@ const selectChangeDetail = (field, val) => {
formTypeDetail.value = 'Select'
switch (val) {
case 'OWNER':
getOwnerAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isSearchList = true
item.componentProps.searchTitle = '货主信息'
item.componentProps.searchAllSchemas = Owner.allSchemas
item.componentProps.searchPage = OwnerApi.getOwnerPage
}
})
break
case 'SUPPLIER':
getSupplierAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isSearchList = true
item.componentProps.searchTitle = '供应商信息'
item.componentProps.searchAllSchemas = Supplier.allSchemas
item.componentProps.searchPage = SupplierApi.getSupplierPage
}
})
break
case 'CUSTOMER':
getCustomerAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isSearchList = true
item.componentProps.searchTitle = '客戶信息'
item.componentProps.searchAllSchemas = Customer.allSchemas
item.componentProps.searchPage = CustomerApi.getCustomerPage
}
})
break
case 'ABC':
countPlanAllList.value = getStrDictOptions(DICT_TYPE.ABC_CLASS)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.component = 'Select'
item.componentProps.isSearchList = false
item.componentProps.options = getStrDictOptions(DICT_TYPE.ABC_CLASS)
}
})
break
case 'ITEMS_TYPE':
countPlanAllList.value = getStrDictOptions(DICT_TYPE.ITEM_TYPE)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.component = 'Select'
item.componentProps.isSearchList = false
item.componentProps.options = getStrDictOptions(DICT_TYPE.ITEM_TYPE)
}
})
break
case 'ITEMS_GROUP':
countPlanAllList.value = getStrDictOptions(DICT_TYPE.ITEM_GROUP)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.component = 'Select'
item.componentProps.isSearchList = false
item.componentProps.options = getStrDictOptions(DICT_TYPE.ITEM_GROUP)
}
})
break
case 'ITEMS_CODE':
getItembasicAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isInpuFocusShow = true
item.componentProps.searchTitle = '物品信息'
item.componentProps.searchAllSchemas = Itembasic.allSchemas
item.componentProps.searchPage = ItembasicApi.getItembasicPage
}
})
break
case 'WAREHOUSE_CODE':
getWarehouseAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isInpuFocusShow = true
item.componentProps.searchTitle = '仓库信息'
item.componentProps.searchAllSchemas = Warehouse.allSchemas
item.componentProps.searchPage = WarehouseApi.getWarehousePage
}
})
break
case 'AREABASIC_CODE':
getAreaAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isInpuFocusShow = true
item.componentProps.searchTitle = '库区信息'
item.componentProps.searchAllSchemas = Area.allSchemas
item.componentProps.searchPage = AreaApi.getAreaPage
}
})
break
case 'LOCATIONGROUP_CODE':
getLocationgroupAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isInpuFocusShow = true
item.componentProps.searchTitle = '库位组信息'
item.componentProps.searchAllSchemas = Locationgroup.allSchemas
item.componentProps.searchPage = LocationgroupApi.getLocationgroupPage
}
})
break
case 'LOCATION_CODE':
getLocationAllList(null,true)
CountPlanDetail.allSchemas.formSchema.forEach((item) => {
if (item.field == 'value') {
item.componentProps.isInpuFocusShow = true
item.componentProps.searchTitle = '库位组信息'
item.componentProps.searchAllSchemas = Location.allSchemas
item.componentProps.searchPage = LocationApi.getLocationPage
}
})
break
}
} else if (val == 'PROJECT') {
@ -671,6 +866,8 @@ const selectChangeDetail = (field, val) => {
}
//
const tableFormChange = async (field, val, row) => {
// debugger
console.log(field, val, row)
if (field == 'type') {
row.value = ''
if (
@ -687,39 +884,104 @@ const tableFormChange = async (field, val, row) => {
row.type == 'LOCATION_CODE'
) {
row.formType = 'Select'
switch (row.type) {
switch (val) {
case 'OWNER':
getOwnerAllList(row)
row.searchTable = {
isInpuFocusShow: true,
searchTitle: '货主信息',
searchAllSchemas: Owner.allSchemas,
searchPage: OwnerApi.getOwnerPage
}
break
case 'SUPPLIER':
getSupplierAllList(row)
row.searchTable = {
isInpuFocusShow: true,
searchTitle: '供应商信息',
searchAllSchemas: Supplier.allSchemas,
searchPage: SupplierApi.getSupplierPage
}
break
case 'CUSTOMER':
getCustomerAllList(row)
row.searchTable = {
isInpuFocusShow: true,
searchTitle: '客戶信息',
searchAllSchemas: Customer.allSchemas,
searchPage: CustomerApi.getCustomerPage
}
break
case 'ABC':
row.initOptions = getStrDictOptions(DICT_TYPE.ABC_CLASS)
CountPlanDetail.allSchemas.tableFormColumns.forEach((item) => {
if (item.field == 'value') {
item.type = 'Select'
item.isInpuFocusShow = false
item.dictClass = 'string'
item.dictType = 'abc_class'
}
})
break
case 'ITEMS_TYPE':
row.initOptions = getStrDictOptions(DICT_TYPE.ITEM_TYPE)
CountPlanDetail.allSchemas.tableFormColumns.forEach((item) => {
if (item.field == 'value') {
item.type = 'Select'
item.isInpuFocusShow = false
item.dictClass = 'string'
item.dictType = 'item_type'
}
})
break
case 'ITEMS_GROUP':
row.initOptions = getStrDictOptions(DICT_TYPE.ITEM_GROUP)
CountPlanDetail.allSchemas.tableFormColumns.forEach((item) => {
if (item.field == 'value') {
item.type = 'Select'
item.isInpuFocusShow = false
item.dictClass = 'string'
item.dictType = 'item_group'
}
})
break
case 'ITEMS_CODE':
getItembasicAllList(row)
row.searchTable = {
isInpuFocusShow: true,
searchTitle: '物品信息',
searchAllSchemas: Itembasic.allSchemas,
searchPage: ItembasicApi.getItembasicPage
}
break
case 'WAREHOUSE_CODE':
getWarehouseAllList(row)
row.searchTable = {
isInpuFocusShow: true,
searchTitle: '仓库信息',
searchAllSchemas: Warehouse.allSchemas,
searchPage: WarehouseApi.getWarehousePage
}
break
case 'AREABASIC_CODE':
getAreaAllList(row)
row.searchTable = {
isInpuFocusShow: true,
searchTitle: '库区信息',
searchAllSchemas: Area.allSchemas,
searchPage: AreaApi.getAreaPage
}
break
case 'LOCATIONGROUP_CODE':
getLocationgroupAllList(row)
row.searchTable = {
isInpuFocusShow: true,
searchTitle: '库位组信息',
searchAllSchemas: Locationgroup.allSchemas,
searchPage: LocationgroupApi.getLocationgroupPage
}
break
case 'LOCATION_CODE':
getLocationAllList(row)
row.searchTable = {
isInpuFocusShow: true,
searchTitle: '库位组信息',
searchAllSchemas: Location.allSchemas,
searchPage: LocationApi.getLocationPage
}
break
}
} else if (row.type == 'PROJECT') {
@ -743,7 +1005,6 @@ const allList = ref({
})
//
const getOwnerAllList = async (row, update_countPlanAllList = false) => {
let getLoading = null
let res = null
if (!allList.value.ownerAllList || allList.value.ownerAllList.length == 0) {
@ -972,7 +1233,6 @@ const getLocationAllList = async (row,update_countPlanAllList=false) => {
})
res = await LocationpApi.getLocationList({ available: 'TRUE' })
console.log('res', res)
}
if (res) {
allList.value.locationAllList = res.map((element) => {

Loading…
Cancel
Save