Browse Source

判断计划

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

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

@ -120,8 +120,8 @@ export default defineComponent({
return unref(elFormRef) as ComponentRef<typeof ElForm> return unref(elFormRef) as ComponentRef<typeof ElForm>
} }
const opensearchTable = (field, searchField,searchTitle,searchAllSchemas, searchPage, searchCondition) => { const opensearchTable = (field, searchField,searchTitle,searchAllSchemas, searchPage, searchCondition,multiple) => {
emit('opensearchTable',field, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition) emit('opensearchTable',field, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition,multiple)
} }
expose({ expose({
@ -226,14 +226,17 @@ export default defineComponent({
formItemSlotsSearchList[item.field] = () => { formItemSlotsSearchList[item.field] = () => {
return ( 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={()=>{ <ElButton icon={Search} onClick={()=>{
opensearchTable( opensearchTable(
item.field, item?.componentProps?.searchField, item.field, item?.componentProps?.searchField,
item?.componentProps?.searchTitle, item?.componentProps?.searchTitle,
item?.componentProps?.searchAllSchemas, item?.componentProps?.searchAllSchemas,
item?.componentProps?.searchPage, 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)) { .search ::v-deep(.el-form-item:nth-last-child(1)) {
margin-right: 0px; margin-right: 0px;
width: 16%; width: auto;
.el-form-item__content { .el-form-item__content {
flex: 1; flex: 1;
>div{ >div{

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

@ -23,6 +23,8 @@
v-model:currentPage="tableObjectRef.currentPage" v-model:currentPage="tableObjectRef.currentPage"
v-model:sort="tableObjectRef.sort" v-model:sort="tableObjectRef.sort"
:selection="true" :selection="true"
:reserveSelection="true"
row-key="id"
/> />
</ContentWrap> </ContentWrap>
<template #footer> <template #footer>
@ -64,7 +66,8 @@ const searchFieldRef = ref()
const typeRef = ref() const typeRef = ref()
const rowRef = ref() const rowRef = ref()
const allSchemasRef = 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 searchDialogVisible.value = true
formFieldRef.value = formField formFieldRef.value = formField
searchFieldRef.value = searchField searchFieldRef.value = searchField
@ -74,6 +77,7 @@ const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, s
getPage.value = getApiPage getPage.value = getApiPage
typeRef.value = type typeRef.value = type
rowRef.value = row rowRef.value = row
multipleBol.value = multiple
// dialogTitle.value = t('action.' + type) // dialogTitle.value = t('action.' + type)
dialogTitle.value = titleName dialogTitle.value = titleName
const {tableObject, tableMethods } = useTable({ const {tableObject, tableMethods } = useTable({
@ -108,11 +112,22 @@ const submitForm = async () => {
// //
formLoading.value = true formLoading.value = true
const selections = searchTableRef.value.selections const selections = searchTableRef.value.selections
if (selections.length > 1 || selections.length == 0) { //
message.warning('请选择一条数据!') if(!multipleBol.value){
formLoading.value = false if(selections.length > 1 || selections.length == 0) {
return message.warning('请选择一条数据!')
formLoading.value = false
return
}
//
}else{
if(selections.length == 0) {
message.warning('至少选择一条数据!')
formLoading.value = false
return
}
} }
try { try {
searchDialogVisible.value = false 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(() => { const res = await config?.getListApi(unref(paramsObj)).finally(() => {
tableObject.loading = false tableObject.loading = false
}) })
console.log('res',res)
if (res) { if (res) {
tableObject.tableList = (res as unknown as ResponseType).list tableObject.tableList = (res as unknown as ResponseType).list
tableObject.total = (res as unknown as ResponseType).total ?? 0 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 type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
const { t } = useI18n() // 国际化 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} * @returns {Array}
@ -55,6 +59,17 @@ export const CountPlanMain = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150 width: 150
}, },
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
multiple:true,//是否可以多选
searchListPlaceholder: '请选择物品忽略名单', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物品信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage // 查询弹窗所需分页方法
}
}
}, },
{ {
label: '库位忽略名单', label: '库位忽略名单',
@ -63,6 +78,18 @@ export const CountPlanMain = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150 width: 150
}, },
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
multiple:true,//是否可以多选
searchListPlaceholder: '请选择库位忽略名单', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '库位信息', // 查询弹窗标题
searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
searchPage: LocationApi.getLocationPage // 查询弹窗所需分页方法
}
}
}, },
{ {
label: '盘点范围列表', label: '盘点范围列表',

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

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

Loading…
Cancel
Save