Browse Source

批量删除

master_hella_20240701
wangyufei 5 months ago
parent
commit
15b8b46220
  1. 13
      src/utils/disposition/defaultButtons.ts
  2. 41
      src/views/wms/inventoryManage/expectin/index.vue
  3. 44
      src/views/wms/inventoryManage/expectout/index.vue

13
src/utils/disposition/defaultButtons.ts

@ -980,6 +980,19 @@ export function mainLisSelectiontPointBtn(option:any) {
hasPermi: ''
})
}
// 主列表-批量删除
export function mainLisSelectiontDeleteBtn(option:any) {
return __defaultBtnOption(option,{
label: t(`ts.批量删除`).replace('ts.', ''),
name: 'selection_delete',
hide: false,
type: 'primary',
icon: 'ep:download',
color: '',
float:'left',
hasPermi: ''
})
}
// 主列表-生成采购收货申请
export function mainListGenerateApplicationBtn(option:any) {
return __defaultBtnOption(option,{

41
src/views/wms/inventoryManage/expectin/index.vue

@ -1,7 +1,7 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="Expectin.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search :schema="Expectin.allSchemas.searchSchema" @search="searchList" @reset="searchList" />
</ContentWrap>
<!-- 列表头部 -->
@ -16,7 +16,9 @@
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable
<Table ref="tableRef"
:selection="true"
v-clientTable
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
@ -26,6 +28,7 @@
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
@getSelectionRows="getSelectionRows"
>
<template #jobNumber="{row}">
<el-button type="primary" link @click="openDetail(row, '任务号', row.jobNumber)">
@ -96,6 +99,8 @@ const HeadButttondata = [
defaultButtons.defaultFreshBtn(null),//
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.mainLisSelectiontDeleteBtn(null), //
// {
// label: '',
// name: 'zdy',
@ -123,10 +128,42 @@ const buttonBaseClick = (val, item) => {
getList()
}
} else if (val == 'filtrate') { //
} else if (val == 'selection_delete') { //
handleSelectionDelete()
} else { //
console.log('其他按钮', item)
}
}
const searchList = (model)=>{
selectionRows.value = []
setSearchParams(model)
}
const selectionRows = ref<any>([])
const tableRef = ref()
const getSelectionRows = (currentPage,currentPageSelectionRows) => {
console.log("getSelectionRows",currentPage,currentPageSelectionRows)
const currentRows = selectionRows.value.find(item=>item.currentPage==currentPage)
if(currentRows){
currentRows.selectionRows = currentPageSelectionRows
}else{
selectionRows.value.push({
currentPage,
selectionRows:currentPageSelectionRows
})
}
}
const handleSelectionDelete = async ()=>{
let rows:any = []
selectionRows.value.forEach(item=>{
rows = [...rows,...item.selectionRows.map(item1=>item1.id)]
})
if(rows.length==0){
return
}
console.log('批量删除',rows)
// await ExpectoutApi.deleteExpectoutIds(rows.join(',')) //
getList()
}
// -
const butttondata = [

44
src/views/wms/inventoryManage/expectout/index.vue

@ -1,7 +1,7 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="Expectout.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search :schema="Expectout.allSchemas.searchSchema" @search="searchList" @reset="searchList" />
</ContentWrap>
<!-- 列表头部 -->
@ -16,7 +16,9 @@
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable
<Table ref="tableRef"
:selection="true"
v-clientTable
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
@ -26,6 +28,8 @@
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
@getSelectionRows="getSelectionRows"
>
<template #jobNumber="{row}">
<el-button type="primary" link @click="openDetail(row, '任务号', row.jobNumber)">
@ -96,6 +100,7 @@ const HeadButttondata = [
defaultButtons.defaultFreshBtn(null),//
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.mainLisSelectiontDeleteBtn(null), //
// {
// label: '',
// name: 'zdy',
@ -122,17 +127,48 @@ const buttonBaseClick = (val, item) => {
} else {
getList()
}
} else if (val == 'selection_delete') { //
handleSelectionDelete()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
const searchList = (model)=>{
selectionRows.value = []
setSearchParams(model)
}
const selectionRows = ref<any>([])
const tableRef = ref()
const getSelectionRows = (currentPage,currentPageSelectionRows) => {
console.log("getSelectionRows",currentPage,currentPageSelectionRows)
const currentRows = selectionRows.value.find(item=>item.currentPage==currentPage)
if(currentRows){
currentRows.selectionRows = currentPageSelectionRows
}else{
selectionRows.value.push({
currentPage,
selectionRows:currentPageSelectionRows
})
}
}
const handleSelectionDelete = async ()=>{
let rows:any = []
selectionRows.value.forEach(item=>{
rows = [...rows,...item.selectionRows.map(item1=>item1.id)]
})
if(rows.length==0){
return
}
console.log('批量删除',rows)
await ExpectoutApi.deleteExpectoutIds(rows.join(','))
getList()
}
// -
const butttondata = [
// defaultButtons.mainListEditBtn({hasPermi:'wms:expectout:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:expectout:delete'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:expectout:deleteIds'}), //
]
// -

Loading…
Cancel
Save