From a8ebb2518636b05332532dde5dc8076ea7b76a3c Mon Sep 17 00:00:00 2001
From: zhang_li <2235006734@qqq.com>
Date: Wed, 22 Nov 2023 13:28:01 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E8=AE=A1=E5=88=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/BasicForm/src/BasicForm.vue | 13 ++++++---
src/components/Form/src/Form.vue | 11 +++++---
src/components/Search/src/Search.vue | 2 +-
.../SearchTable/src/SearchTable.vue | 25 +++++++++++++----
src/hooks/web/useTable.ts | 1 +
.../count/countPlanMain/countPlanMain.data.ts | 27 +++++++++++++++++++
.../countManage/count/countPlanMain/index.vue | 23 ++++++++--------
7 files changed, 78 insertions(+), 24 deletions(-)
diff --git a/src/components/BasicForm/src/BasicForm.vue b/src/components/BasicForm/src/BasicForm.vue
index a34fc9985..bdc79ae0e 100644
--- a/src/components/BasicForm/src/BasicForm.vue
+++ b/src/components/BasicForm/src/BasicForm.vue
@@ -7,7 +7,11 @@
:schema="formSchema"
:is-col="true"
@opensearchTable="opensearchTable"
- />
+ >
+
+
+
+
{
+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,
)
diff --git a/src/components/Form/src/Form.vue b/src/components/Form/src/Form.vue
index d9430aca4..7fb04d062 100644
--- a/src/components/Form/src/Form.vue
+++ b/src/components/Form/src/Form.vue
@@ -120,8 +120,8 @@ export default defineComponent({
return unref(elFormRef) as ComponentRef
}
- 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 (
<>
-
+
+
+
{
opensearchTable(
item.field, item?.componentProps?.searchField,
item?.componentProps?.searchTitle,
item?.componentProps?.searchAllSchemas,
item?.componentProps?.searchPage,
- item?.componentProps?.searchCondition
+ item?.componentProps?.searchCondition,
+ item?.componentProps?.multiple,
)}}/>
>
)
diff --git a/src/components/Search/src/Search.vue b/src/components/Search/src/Search.vue
index a71bb48e9..78865acf7 100644
--- a/src/components/Search/src/Search.vue
+++ b/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{
diff --git a/src/components/SearchTable/src/SearchTable.vue b/src/components/SearchTable/src/SearchTable.vue
index 1575a41a9..c173c536f 100644
--- a/src/components/SearchTable/src/SearchTable.vue
+++ b/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"
/>
@@ -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
// 发送操作成功的事件
diff --git a/src/hooks/web/useTable.ts b/src/hooks/web/useTable.ts
index 53cd83cce..f3481e9f6 100644
--- a/src/hooks/web/useTable.ts
+++ b/src/hooks/web/useTable.ts
@@ -150,6 +150,7 @@ export const useTable = (config?: UseTableConfig) => {
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
diff --git a/src/views/wms/countManage/count/countPlanMain/countPlanMain.data.ts b/src/views/wms/countManage/count/countPlanMain/countPlanMain.data.ts
index a751fb818..69a2b2eb5 100644
--- a/src/views/wms/countManage/count/countPlanMain/countPlanMain.data.ts
+++ b/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([
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([
table: {
width: 150
},
+ form: {
+ componentProps: {
+ isSearchList: true, // 开启查询弹窗
+ multiple:true,//是否可以多选
+ searchListPlaceholder: '请选择库位忽略名单', // 输入框占位文本
+ searchField: 'code', // 查询弹窗赋值字段
+ searchTitle: '库位信息', // 查询弹窗标题
+ searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
+ searchPage: LocationApi.getLocationPage // 查询弹窗所需分页方法
+
+ }
+ }
},
{
label: '盘点范围列表',
diff --git a/src/views/wms/countManage/count/countPlanMain/index.vue b/src/views/wms/countManage/count/countPlanMain/index.vue
index 4bfafd1f4..15ffc7a3b 100644
--- a/src/views/wms/countManage/count/countPlanMain/index.vue
+++ b/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 @@
/>
-
+