|
|
@ -1,22 +1,27 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="CountJobMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search |
|
|
|
:schema="CountJobMain.allSchemas.searchSchema" |
|
|
|
@search="setSearchParams" |
|
|
|
@reset="setSearchParams" |
|
|
|
/> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="CountJobMain.allSchemas" |
|
|
|
/> |
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="CountJobMain.allSchemas" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
|
<Table v-clientTable |
|
|
|
<Table |
|
|
|
v-clientTable |
|
|
|
:columns="tableColumns" |
|
|
|
:data="tableObject.tableList" |
|
|
|
:loading="tableObject.loading" |
|
|
@ -27,13 +32,16 @@ |
|
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort" |
|
|
|
> |
|
|
|
<template #number="{row}"> |
|
|
|
<template #number="{ row }"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> |
|
|
|
<span>{{ row.number }}</span> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
<template #action="{ row,$index }"> |
|
|
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
<template #action="{ row, $index }"> |
|
|
|
<ButtonBase |
|
|
|
:Butttondata="butttondata(row, $index)" |
|
|
|
@button-base-click="buttonTableClick($event, row)" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
@ -58,7 +66,7 @@ |
|
|
|
ref="detailRef" |
|
|
|
:isBasic="false" |
|
|
|
:allSchemas="CountJobMain.allSchemas" |
|
|
|
:detailAllSchemas="CountJobDetail.allSchemas" |
|
|
|
:detailAllSchemas="countJobDetailTableColumns" |
|
|
|
:detailAllSchemasRules="CountJobDetailRules" |
|
|
|
:searchTableParams="searchTableParams" |
|
|
|
:apiPage="CountJobDetailApi.getCountJobDetailPage" |
|
|
@ -76,17 +84,21 @@ |
|
|
|
:extend="rowMasterIdRef" |
|
|
|
:isShowDownloadBtn="true" |
|
|
|
/> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { CountJobMain,CountJobMainRules,CountJobDetail,CountJobDetailRules } from './countJobMain.data' |
|
|
|
import { |
|
|
|
CountJobMain, |
|
|
|
CountJobMainRules, |
|
|
|
CountJobDetail, |
|
|
|
CountJobDetailRules |
|
|
|
} from './countJobMain.data' |
|
|
|
import * as CountJobMainApi from '@/api/wms/countJobMain' |
|
|
|
import * as CountJobDetailApi from '@/api/wms/countJobDetail' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|
|
|
import * as PackageunitApi from "@/api/wms/packageunit"; |
|
|
|
import * as PackageunitApi from '@/api/wms/packageunit' |
|
|
|
import { formatDate } from '@/utils/formatTime' |
|
|
|
// 盘点任务主 |
|
|
|
defineOptions({ name: 'CountJobMain' }) |
|
|
@ -106,16 +118,16 @@ 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 ) => { |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|
|
|
nextTick(() => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 明细查询页赋值 |
|
|
@ -141,7 +153,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
} |
|
|
|
// 子表新增的时候选择表格之后需要会显得字段 |
|
|
|
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom'] |
|
|
|
const Echo = [] |
|
|
|
const Echo = [] |
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
getListApi: CountJobMainApi.getCountJobMainPage // 分页接口 |
|
|
@ -152,10 +164,10 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'wms:count-job-main:export'}), // 导出 |
|
|
|
defaultButtons.defaultExportBtn({ hasPermi: 'wms:count-job-main:export' }), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
|
// { |
|
|
|
// label: '自定义扩展按钮', |
|
|
|
// name: 'zdy', |
|
|
@ -168,24 +180,28 @@ const HeadButttondata = [ |
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'export') { // 导出 |
|
|
|
if (val == 'export') { |
|
|
|
// 导出 |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
|
|
|
} else if (val == 'refresh') { |
|
|
|
// 刷新 |
|
|
|
if (tableObject.params.filters && tableObject.params.filters.length > 0) { |
|
|
|
searchFormClick({ |
|
|
|
filters: tableObject.params.filters |
|
|
|
}) |
|
|
|
} else { |
|
|
|
getList() |
|
|
|
} |
|
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
|
} else { // 其他按钮 |
|
|
|
} else if (val == 'filtrate') { |
|
|
|
// 筛选 |
|
|
|
} else { |
|
|
|
// 其他按钮 |
|
|
|
console.log('其他按钮', item) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 根据状态返回该按钮是否显示 |
|
|
|
const isShowMainButton = (row,val) => { |
|
|
|
const isShowMainButton = (row, val) => { |
|
|
|
if (val.indexOf(row.status) > -1) { |
|
|
|
return false |
|
|
|
} else { |
|
|
@ -194,15 +210,17 @@ const isShowMainButton = (row,val) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = (row,$index) => { |
|
|
|
|
|
|
|
const butttondata = (row, $index) => { |
|
|
|
return [ |
|
|
|
defaultButtons.mainListJobAccBtn({hide:isShowMainButton(row,['1'])}), // 承接 |
|
|
|
defaultButtons.mainListJobCloBtn({hide:isShowMainButton(row,['1','2']),hasPermi:'wms:count-job-main:close'}), // 关闭 |
|
|
|
defaultButtons.mainListJobAccBtn({ hide: isShowMainButton(row, ['1']) }), // 承接 |
|
|
|
defaultButtons.mainListJobCloBtn({ |
|
|
|
hide: isShowMainButton(row, ['1', '2']), |
|
|
|
hasPermi: 'wms:count-job-main:close' |
|
|
|
}), // 关闭 |
|
|
|
{ |
|
|
|
label: '导出', |
|
|
|
name: 'exportCountJob', |
|
|
|
hide: isShowMainButton(row,['1','2']), |
|
|
|
hide: isShowMainButton(row, ['1', '2']), |
|
|
|
type: 'primary', |
|
|
|
color: '', |
|
|
|
link: true, //文本展现按钮 |
|
|
@ -211,58 +229,64 @@ const butttondata = (row,$index) => { |
|
|
|
{ |
|
|
|
label: '导入', |
|
|
|
name: 'importCountJob', |
|
|
|
hide: isShowMainButton(row,['2']), |
|
|
|
hide: isShowMainButton(row, ['2']), |
|
|
|
type: 'success', |
|
|
|
color: '', |
|
|
|
link: true, //文本展现按钮 |
|
|
|
hasPermi: '' // wms:count-job-main:importCountJob |
|
|
|
}, |
|
|
|
defaultButtons.mainListJobAbaBtn({hide:isShowMainButton(row,['2'])}), // 放弃 |
|
|
|
defaultButtons.mainListJobAbaBtn({ hide: isShowMainButton(row, ['2']) }), // 放弃 |
|
|
|
{ |
|
|
|
label: '完成', |
|
|
|
name: 'done', |
|
|
|
hide: isShowMainButton(row,['2']), |
|
|
|
hide: isShowMainButton(row, ['2']), |
|
|
|
type: 'success', |
|
|
|
color: '', |
|
|
|
link: true, //文本展现按钮 |
|
|
|
hasPermi: '' // wms:count-job-main:importCountJob |
|
|
|
}, |
|
|
|
} |
|
|
|
// defaultButtons.mainListJobExeBtn({hide:isShowMainButton(row,['2'])}), // 执行 |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'mainJobExe') { // 执行 |
|
|
|
if (val == 'mainJobExe') { |
|
|
|
// 执行 |
|
|
|
console.log('列表-操作按钮事件-执行') |
|
|
|
} else if (val == 'mainJobAba') { // 放弃 |
|
|
|
} else if (val == 'mainJobAba') { |
|
|
|
// 放弃 |
|
|
|
console.log('列表-操作按钮事件-放弃') |
|
|
|
tableObject.loading = true |
|
|
|
try { |
|
|
|
await CountJobMainApi.abandonCountJobMain(row.id) |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} finally { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
|
} else if (val == 'mainJobClo') { // 关闭 |
|
|
|
} else if (val == 'mainJobClo') { |
|
|
|
// 关闭 |
|
|
|
handleClose(row.id) |
|
|
|
} else if (val == 'mainJobAcc') { // 承接 |
|
|
|
} else if (val == 'mainJobAcc') { |
|
|
|
// 承接 |
|
|
|
tableObject.loading = true |
|
|
|
try { |
|
|
|
await CountJobMainApi.acceptCountJobMain(row.id) |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} finally { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
|
console.log('列表-操作按钮事件-承接') |
|
|
|
} else if (val == 'exportCountJob'){// 当前任务导出 |
|
|
|
handleExportCountJob(row.id,row.number) |
|
|
|
} else if( val == 'importCountJob'){ // 导入 |
|
|
|
} else if (val == 'exportCountJob') { |
|
|
|
// 当前任务导出 |
|
|
|
handleExportCountJob(row.id, row.number) |
|
|
|
} else if (val == 'importCountJob') { |
|
|
|
// 导入 |
|
|
|
handleImport(row.id) |
|
|
|
} else if( val == 'done'){ // 完成 |
|
|
|
} else if (val == 'done') { |
|
|
|
// 完成 |
|
|
|
handleDone(row.id) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** 关闭按钮操作 */ |
|
|
@ -272,7 +296,7 @@ const handleClose = async (id: number) => { |
|
|
|
tableObject.loading = true |
|
|
|
await CountJobMainApi.closeCountJobMain(id) |
|
|
|
message.success(t('common.closeSuccess')) |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} finally { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
@ -283,21 +307,37 @@ const handleDone = async (id: number) => { |
|
|
|
await message.confirm('确认完成吗?') |
|
|
|
tableObject.loading = true |
|
|
|
await CountJobMainApi.doneCountJobMain(id) |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} finally { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取部门 用于详情 部门回显 |
|
|
|
const { wsCache } = useCache() |
|
|
|
/** 详情操作 */ |
|
|
|
const detailRef = ref() |
|
|
|
const countJobDetailTableColumns = ref({}) |
|
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
|
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name |
|
|
|
const departmentCode = wsCache |
|
|
|
.get(CACHE_KEY.DEPT) |
|
|
|
.find((account) => account.id == row.departmentCode)?.name |
|
|
|
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode)) |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue,"jobCountMain") |
|
|
|
// 盲盘的时候不显示数量 |
|
|
|
countJobDetailTableColumns.value.tableColumns = [] |
|
|
|
if (!row.isShow) { |
|
|
|
CountJobDetail.allSchemas.tableColumns.forEach((item) => { |
|
|
|
if (item.field != 'qty') { |
|
|
|
countJobDetailTableColumns.value.tableColumns.push(item) |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
countJobDetailTableColumns.value.tableColumns = JSON.parse( |
|
|
|
JSON.stringify(CountJobDetail.allSchemas.tableColumns) |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'jobCountMain') |
|
|
|
} |
|
|
|
|
|
|
|
/** 导出按钮操作 */ |
|
|
@ -318,7 +358,7 @@ const handleExport = async () => { |
|
|
|
} |
|
|
|
|
|
|
|
/** 单条任务导出 */ |
|
|
|
const handleExportCountJob = async (id: number,number: string) => { |
|
|
|
const handleExportCountJob = async (id: number, number: string) => { |
|
|
|
try { |
|
|
|
await message.exportConfirm() |
|
|
|
exportLoading.value = true |
|
|
@ -327,7 +367,7 @@ const handleExportCountJob = async (id: number,number: string) => { |
|
|
|
// download.excel(data, '盘点任务主'+number+'.xlsx') |
|
|
|
download.excel(data, `【${excelTitle.value}${number}】【${formatDate(new Date())}】.xlsx`) |
|
|
|
} catch { |
|
|
|
}finally { |
|
|
|
} finally { |
|
|
|
exportLoading.value = false |
|
|
|
} |
|
|
|
} |
|
|
@ -336,7 +376,7 @@ const handleExportCountJob = async (id: number,number: string) => { |
|
|
|
const importFormRef = ref() |
|
|
|
const rowMasterIdRef = ref('') |
|
|
|
const handleImport = (id: string) => { |
|
|
|
rowMasterIdRef.value = id; |
|
|
|
rowMasterIdRef.value = id |
|
|
|
importFormRef.value.open() |
|
|
|
} |
|
|
|
|
|
|
|