Browse Source

判断计划

master
zhang_li 1 year ago
parent
commit
a8ebb25186
  1. 13
      src/components/BasicForm/src/BasicForm.vue
  2. 11
      src/components/Form/src/Form.vue
  3. 2
      src/components/Search/src/Search.vue
  4. 25
      src/components/SearchTable/src/SearchTable.vue
  5. 1
      src/hooks/web/useTable.ts
  6. 27
      src/views/wms/countManage/count/countPlanMain/countPlanMain.data.ts
  7. 23
      src/views/wms/countManage/count/countPlanMain/index.vue

13
src/components/BasicForm/src/BasicForm.vue

@ -7,7 +7,11 @@
:schema="formSchema"
:is-col="true"
@opensearchTable="opensearchTable"
/>
>
<template #crontab="formSchema">
<crontab v-model="formSchema.crontab" />
</template>
</Form>
<div class="table" v-if="isBusiness && formType == 'create'">
<TableForm ref="tableFormRef"
class="w-[100%]"
@ -139,7 +143,7 @@ const formSchema = ref(props.formAllSchemas?.formSchema)
// type type=tableForm
// searchCondition
const searchTableRef = ref()
const opensearchTable = (formField, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition, type, row ) => {
const opensearchTable = (formField, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition,multiple, type, row ) => {
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
@ -157,7 +161,7 @@ const opensearchTable = (formField, searchField, searchTitle, searchAllSchemas,
const _searchTableTitle = searchTitle
const _searchTableAllSchemas = searchAllSchemas
const _searchTablePage = searchPage
searchTableRef.value.open(_searchTableTitle, _searchTableAllSchemas, _searchTablePage, formField, searchField, type, row, _searchCondition)
searchTableRef.value.open(_searchTableTitle, _searchTableAllSchemas, _searchTablePage, formField, searchField,multiple, type, row, _searchCondition)
}
//
// val row
@ -316,6 +320,8 @@ const handleAddTable = () => {
}
//
const inpuFocus = (headerItem, row, index) => {
console.log(headerItem.tableForm.multiple);
opensearchTable(
headerItem.field,
headerItem.tableForm.searchField,
@ -323,6 +329,7 @@ const inpuFocus = (headerItem, row, index) => {
headerItem.tableForm.searchAllSchemas,
headerItem.tableForm.searchPage,
headerItem.tableForm.searchCondition,
headerItem.tableForm.multiple,
'tableForm',
row,
)

11
src/components/Form/src/Form.vue

@ -120,8 +120,8 @@ export default defineComponent({
return unref(elFormRef) as ComponentRef<typeof ElForm>
}
const opensearchTable = (field, searchField,searchTitle,searchAllSchemas, searchPage, searchCondition) => {
emit('opensearchTable',field, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition)
const opensearchTable = (field, searchField,searchTitle,searchAllSchemas, searchPage, searchCondition,multiple) => {
emit('opensearchTable',field, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition,multiple)
}
expose({
@ -226,14 +226,17 @@ export default defineComponent({
formItemSlotsSearchList[item.field] = () => {
return (
<>
<ElInput class={'myInput'} v-model={formModel.value[item.field]} placeholder={item?.componentProps?.searchListPlaceholder} disabled={true} />
<ElTooltip placement="top" content={formModel.value[item.field]}>
<ElInput class={'myInput'} v-model={formModel.value[item.field]} placeholder={item?.componentProps?.searchListPlaceholder} disabled={true} /></ElTooltip>
<ElButton icon={Search} onClick={()=>{
opensearchTable(
item.field, item?.componentProps?.searchField,
item?.componentProps?.searchTitle,
item?.componentProps?.searchAllSchemas,
item?.componentProps?.searchPage,
item?.componentProps?.searchCondition
item?.componentProps?.searchCondition,
item?.componentProps?.multiple,
)}}/>
</>
)

2
src/components/Search/src/Search.vue

@ -170,7 +170,7 @@ onMounted(() => {})
}
.search ::v-deep(.el-form-item:nth-last-child(1)) {
margin-right: 0px;
width: 16%;
width: auto;
.el-form-item__content {
flex: 1;
>div{

25
src/components/SearchTable/src/SearchTable.vue

@ -23,6 +23,8 @@
v-model:currentPage="tableObjectRef.currentPage"
v-model:sort="tableObjectRef.sort"
:selection="true"
:reserveSelection="true"
row-key="id"
/>
</ContentWrap>
<template #footer>
@ -64,7 +66,8 @@ const searchFieldRef = ref()
const typeRef = ref()
const rowRef = ref()
const allSchemasRef = ref()
const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any, type: any, row: any, searchCondition:any ) => {
const multipleBol = ref(false)
const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any,multiple: any, type: any, row: any, searchCondition:any ) => {
searchDialogVisible.value = true
formFieldRef.value = formField
searchFieldRef.value = searchField
@ -74,6 +77,7 @@ const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, s
getPage.value = getApiPage
typeRef.value = type
rowRef.value = row
multipleBol.value = multiple
// dialogTitle.value = t('action.' + type)
dialogTitle.value = titleName
const {tableObject, tableMethods } = useTable({
@ -108,11 +112,22 @@ const submitForm = async () => {
//
formLoading.value = true
const selections = searchTableRef.value.selections
if (selections.length > 1 || selections.length == 0) {
message.warning('请选择一条数据!')
formLoading.value = false
return
//
if(!multipleBol.value){
if(selections.length > 1 || selections.length == 0) {
message.warning('请选择一条数据!')
formLoading.value = false
return
}
//
}else{
if(selections.length == 0) {
message.warning('至少选择一条数据!')
formLoading.value = false
return
}
}
try {
searchDialogVisible.value = false
//

1
src/hooks/web/useTable.ts

@ -150,6 +150,7 @@ export const useTable = <T = any>(config?: UseTableConfig<T>) => {
const res = await config?.getListApi(unref(paramsObj)).finally(() => {
tableObject.loading = false
})
console.log('res',res)
if (res) {
tableObject.tableList = (res as unknown as ResponseType).list
tableObject.total = (res as unknown as ResponseType).total ?? 0

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

@ -1,6 +1,10 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
const { t } = useI18n() // 国际化
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import * as ItembasicApi from '@/api/wms/itembasic'
import * as LocationApi from '@/api/wms/location'
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data'
/**
* @returns {Array}
@ -55,6 +59,17 @@ export const CountPlanMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 150
},
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
multiple:true,//是否可以多选
searchListPlaceholder: '请选择物品忽略名单', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物品信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage // 查询弹窗所需分页方法
}
}
},
{
label: '库位忽略名单',
@ -63,6 +78,18 @@ export const CountPlanMain = useCrudSchemas(reactive<CrudSchema[]>([
table: {
width: 150
},
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
multiple:true,//是否可以多选
searchListPlaceholder: '请选择库位忽略名单', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '库位信息', // 查询弹窗标题
searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
searchPage: LocationApi.getLocationPage // 查询弹窗所需分页方法
}
}
},
{
label: '盘点范围列表',

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

@ -44,7 +44,6 @@
@success="getList"
:rules="CountPlanMainRules"
:formAllSchemas="CountPlanMain.allSchemas"
:searchTableParams="searchTableParams"
:tableAllSchemas="CountPlanDetail.allSchemas"
:tableFormRules="CountPlanDetailRules"
:tableData="tableData"
@ -73,7 +72,7 @@
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/count-plan-main/import" :importTemplateData="importTemplateData" @success="importSuccess" />
<ImportForm ref="importFormRef" url="/wms/count-plan-main/import" :importTemplateData="importTemplateData" @success="importSuccess"/>
</template>
<script setup lang="ts">
@ -82,6 +81,8 @@ import { CountPlanMain,CountPlanMainRules,CountPlanDetail,CountPlanDetailRules }
import * as CountPlanMainApi from '@/api/wms/countPlanMain'
import * as CountPlanDetailApi from '@/api/wms/countPlanDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
//
defineOptions({ name: 'CountPlanMain' })
@ -101,17 +102,18 @@ const updataTableColumns = (val) => {
//
const searchTableParams = ref([
//{
// formField: 'productItemCode',
// searchTableTitle: '',
// searchTableAllSchemas: Itembasic.allSchemas,
// searchTablePage: ItembasicApi.getItembasicPage
//}
{
formField: 'productItemCode',
searchTableTitle: '物料信息',
searchTableAllSchemas: Itembasic.allSchemas,
searchTablePage: ItembasicApi.getItembasicPage
}
])
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick(() => {
if (type == 'tableForm') {
//
//row[formField] = val[0][searchField]
@ -127,9 +129,8 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
//row['uom'] = val[0]['uom']
} else {
const setV = {}
setV[formField] = val[0][searchField]
//setV['ppNumber'] = val[0]['ppNumber']
//setV['supplierCode'] = val[0]['supplierCode']
// setV[formField] = val[0][searchField]
setV[formField] = val.map(item=>item.code).join(',')
formRef.setValues(setV)
}
})

Loading…
Cancel
Save