|
|
@ -1,23 +1,31 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="[...PurchaseBarterRequestMain.allSchemas.searchSchema,...PurchaseBarterRequestDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search |
|
|
|
:schema="[ |
|
|
|
...PurchaseBarterRequestMain.allSchemas.searchSchema, |
|
|
|
...PurchaseBarterRequestDetail.allSchemas.searchSchema |
|
|
|
]" |
|
|
|
@search="setSearchParams" |
|
|
|
@reset="setSearchParams" |
|
|
|
/> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="PurchaseBarterRequestMain.allSchemas" |
|
|
|
:detailAllSchemas="PurchaseBarterRequestDetail.allSchemas" |
|
|
|
/> |
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="PurchaseBarterRequestMain.allSchemas" |
|
|
|
:detailAllSchemas="PurchaseBarterRequestDetail.allSchemas" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
|
<Table v-clientTable |
|
|
|
<Table |
|
|
|
v-clientTable |
|
|
|
:columns="tableColumns" |
|
|
|
:data="tableObject.tableList" |
|
|
|
:loading="tableObject.loading" |
|
|
@ -28,13 +36,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 }"> |
|
|
|
<ButtonBaseMore :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
<template #action="{ row, $index }"> |
|
|
|
<ButtonBaseMore |
|
|
|
:Butttondata="butttondata(row, $index)" |
|
|
|
@button-base-click="buttonTableClick($event, row)" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
@ -79,10 +90,16 @@ |
|
|
|
@onBlur="onBlur" |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/wms/purchase-barter-request-main/import" :importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" /> |
|
|
|
<ImportForm |
|
|
|
ref="importFormRef" |
|
|
|
url="/wms/purchase-barter-request-main/import" |
|
|
|
:importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" |
|
|
|
:updateIsDisable="true" |
|
|
|
:coverIsDisable="true" |
|
|
|
:mode="2" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
@ -98,12 +115,13 @@ import { |
|
|
|
import * as PurchaseBarterRequestMainApi from '@/api/wms/purchaseBarterRequestMain' |
|
|
|
import * as PurchaseBarterRequestDetailApi from '@/api/wms/purchaseBarterRequestDetail' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import * as ItembasicApi from "@/api/wms/itembasic"; |
|
|
|
import * as ItembasicApi from '@/api/wms/itembasic' |
|
|
|
import { formatTime } from '@/utils' |
|
|
|
import { formatDate } from '@/utils/formatTime' |
|
|
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
|
|
|
import {getJmreportBaseUrl} from "@/utils/systemParam"; |
|
|
|
import {getAccessToken} from "@/utils/auth"; |
|
|
|
import { getJmreportBaseUrl } from '@/utils/systemParam' |
|
|
|
import { getAccessToken } from '@/utils/auth' |
|
|
|
import { log } from 'node:console' |
|
|
|
|
|
|
|
const { loadStart, loadDone } = usePageLoading() |
|
|
|
// 采购换货申请 |
|
|
@ -115,31 +133,38 @@ const { t } = useI18n() // 国际化 |
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref([...PurchaseBarterRequestMain.allSchemas.tableColumns,...PurchaseBarterRequestDetail.allSchemas.tableMainColumns]) |
|
|
|
const tableColumns = ref([ |
|
|
|
...PurchaseBarterRequestMain.allSchemas.tableColumns, |
|
|
|
...PurchaseBarterRequestDetail.allSchemas.tableMainColumns |
|
|
|
]) |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|
|
|
nextTick(async () => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
if(formField == 'itemCode'){ |
|
|
|
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['itemCode']==item['itemCode'])) |
|
|
|
if(itemCodes.length>0){ |
|
|
|
itemCodes = itemCodes.map(item=>(item['itemCode'])) |
|
|
|
if (formField == 'itemCode') { |
|
|
|
let itemCodes = val.filter((item) => |
|
|
|
tableData.value.find((item1) => item1['itemCode'] == item['itemCode']) |
|
|
|
) |
|
|
|
if (itemCodes.length > 0) { |
|
|
|
itemCodes = itemCodes.map((item) => item['itemCode']) |
|
|
|
message.warning(`物料${itemCodes.join(',')}已经存在`) |
|
|
|
} |
|
|
|
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode'])) |
|
|
|
if(val.length==0){ |
|
|
|
val = val.filter( |
|
|
|
(item) => !tableData.value.find((item1) => item1['itemCode'] == item['itemCode']) |
|
|
|
) |
|
|
|
if (val.length == 0) { |
|
|
|
return |
|
|
|
} |
|
|
|
let newVal = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode'])) |
|
|
|
newVal.forEach(item=>{ |
|
|
|
let newVal = val.filter( |
|
|
|
(item) => !tableData.value.find((item1) => item1['itemCode'] == item['itemCode']) |
|
|
|
) |
|
|
|
newVal.forEach((item) => { |
|
|
|
let tfk = JSON.parse(JSON.stringify(tableFormKeys)) |
|
|
|
tfk['itemCode'] = item['itemCode'] |
|
|
|
tfk['itemName'] = item['itemName'] |
|
|
@ -153,7 +178,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
} |
|
|
|
} |
|
|
|
const setV = {} |
|
|
|
if(formField === 'supplierCode'){ |
|
|
|
if (formField === 'supplierCode') { |
|
|
|
setV['supplierCode'] = val[0]['code'] |
|
|
|
setV['supplierName'] = val[0]['name'] |
|
|
|
tableData.value = [] |
|
|
@ -162,14 +187,13 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
}) |
|
|
|
} |
|
|
|
const handleDetailSubmitForm = async (formType, data) => { |
|
|
|
if(data.qty > data.inventoryQty){ |
|
|
|
message.warning("换货数量不能大于库存数量") |
|
|
|
if (data.qty > data.inventoryQty) { |
|
|
|
message.warning('换货数量不能大于库存数量') |
|
|
|
return |
|
|
|
} |
|
|
|
if (formType === 'create') { |
|
|
|
await PurchaseBarterRequestDetailApi.createPurchaseBarterRequestDetail(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
|
|
|
|
} else { |
|
|
|
await PurchaseBarterRequestDetailApi.updatePurchaseBarterRequestDetail(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
@ -178,11 +202,11 @@ const handleDetailSubmitForm = async (formType, data) => { |
|
|
|
getList() |
|
|
|
} |
|
|
|
// 查询页面返回——详情 |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
if(formField == 'itemCode'){ |
|
|
|
if (formField == 'itemCode') { |
|
|
|
setV['itemCode'] = val[0]['itemCode'] |
|
|
|
setV['itemName'] = val[0]['itemName'] |
|
|
|
setV['uom'] = val[0]['uom'] |
|
|
@ -196,7 +220,7 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const Echo = [] |
|
|
|
const Echo = [] |
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
getListApi: PurchaseBarterRequestDetailApi.getPurchaseBarterRequestDetailPage // 分页接口 |
|
|
@ -207,38 +231,44 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn({hasPermi:'wms:purchase-barter-request-main:create'}), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({hasPermi:'wms:purchase-barter-request-main:import'}), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'wms:purchase-barter-request-main:export'}), // 导出 |
|
|
|
defaultButtons.defaultAddBtn({ hasPermi: 'wms:purchase-barter-request-main:create' }), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({ hasPermi: 'wms:purchase-barter-request-main:import' }), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({ hasPermi: 'wms:purchase-barter-request-main:export' }), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
|
] |
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'add') { // 新增 |
|
|
|
if (val == 'add') { |
|
|
|
// 新增 |
|
|
|
openForm('create') |
|
|
|
} else if (val == 'import') { // 导入 |
|
|
|
} else if (val == 'import') { |
|
|
|
// 导入 |
|
|
|
handleImport() |
|
|
|
} else if (val == 'export') { // 导出 |
|
|
|
} else 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 { |
|
|
@ -247,55 +277,85 @@ const isShowMainButton = (row,val) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = (row,$index) => { |
|
|
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
|
|
|
if(findIndex>-1&&findIndex<$index){ |
|
|
|
const butttondata = (row, $index) => { |
|
|
|
const findIndex = row['masterId'] |
|
|
|
? tableObject.tableList.findIndex((item) => item['masterId'] == row['masterId']) |
|
|
|
: -1 |
|
|
|
if (findIndex > -1 && findIndex < $index) { |
|
|
|
return [] |
|
|
|
} |
|
|
|
return [ |
|
|
|
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3','8']),hasPermi:'wms:purchase-barter-request-main:close'}), // 关闭 |
|
|
|
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']),hasPermi:'wms:purchase-barter-request-main:reAdd'}), // 重新添加 |
|
|
|
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchase-barter-request-main:submit'}), // 提交审批 |
|
|
|
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:purchase-barter-request-main:refused'}), // 驳回 |
|
|
|
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:purchase-barter-request-main:agree'}), // 审批通过 |
|
|
|
// defaultButtons.outBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:purchase-barter-request-main:out'}), // 出库 |
|
|
|
// defaultButtons.inBtn({hide:isShowMainButton(row,['11']),hasPermi:'wms:purchase-barter-request-main:in'}), // 入库 |
|
|
|
// defaultButtons.mainListSuspend1Btn({hide:isShowMainButton(row,['11']),hasPermi:'wms:purchase-barter-request-main:suspend'}), // 中止 |
|
|
|
defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchase-barter-request-main:delete'}), // 删除 |
|
|
|
defaultButtons.mainListDocumentPrintBtn({hide:isShowMainButton(row,['8'])}) |
|
|
|
] |
|
|
|
return [ |
|
|
|
defaultButtons.mainListCloseBtn({ |
|
|
|
hide: isShowMainButton(row, ['1', '2', '3', '8']), |
|
|
|
hasPermi: 'wms:purchase-barter-request-main:close' |
|
|
|
}), // 关闭 |
|
|
|
defaultButtons.mainListReAddBtn({ |
|
|
|
hide: isShowMainButton(row, ['4', '5']), |
|
|
|
hasPermi: 'wms:purchase-barter-request-main:reAdd' |
|
|
|
}), // 重新添加 |
|
|
|
defaultButtons.mainListSubmitBtn({ |
|
|
|
hide: isShowMainButton(row, ['1']), |
|
|
|
hasPermi: 'wms:purchase-barter-request-main:submit' |
|
|
|
}), // 提交审批 |
|
|
|
defaultButtons.mainListTurnDownBtn({ |
|
|
|
hide: isShowMainButton(row, ['2']), |
|
|
|
hasPermi: 'wms:purchase-barter-request-main:refused' |
|
|
|
}), // 驳回 |
|
|
|
defaultButtons.mainListApproveBtn({ |
|
|
|
hide: isShowMainButton(row, ['2']), |
|
|
|
hasPermi: 'wms:purchase-barter-request-main:agree' |
|
|
|
}), // 审批通过 |
|
|
|
// defaultButtons.outBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:purchase-barter-request-main:out'}), // 出库 |
|
|
|
// defaultButtons.inBtn({hide:isShowMainButton(row,['11']),hasPermi:'wms:purchase-barter-request-main:in'}), // 入库 |
|
|
|
// defaultButtons.mainListSuspend1Btn({hide:isShowMainButton(row,['11']),hasPermi:'wms:purchase-barter-request-main:suspend'}), // 中止 |
|
|
|
defaultButtons.mainListDeleteBtn({ |
|
|
|
hide: isShowMainButton(row, ['1']), |
|
|
|
hasPermi: 'wms:purchase-barter-request-main:delete' |
|
|
|
}), // 删除 |
|
|
|
defaultButtons.mainListDocumentPrintBtn({ hide: isShowMainButton(row, ['8']) }) |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
console.log("val",val) |
|
|
|
if (val == 'mainClose') { // 关闭 |
|
|
|
console.log('val', val) |
|
|
|
if (val == 'mainClose') { |
|
|
|
// 关闭 |
|
|
|
console.log('列表-操作按钮事件-关闭') |
|
|
|
handleClose(row.masterId) |
|
|
|
} else if (val == 'mainReAdd') { // 重新添加 |
|
|
|
} else if (val == 'mainReAdd') { |
|
|
|
// 重新添加 |
|
|
|
console.log('列表-操作按钮事件-重新添加') |
|
|
|
handleReAdd(row.masterId) |
|
|
|
} else if (val == 'mainSubmit') { // 提交审批 |
|
|
|
} else if (val == 'mainSubmit') { |
|
|
|
// 提交审批 |
|
|
|
console.log('列表-操作按钮事件-提交审批') |
|
|
|
handleSubmit(row.masterId) |
|
|
|
} else if (val == 'mainTurnDown') { // 驳回 |
|
|
|
} else if (val == 'mainTurnDown') { |
|
|
|
// 驳回 |
|
|
|
console.log('列表-操作按钮事件-驳回') |
|
|
|
handleRefused(row.masterId) |
|
|
|
} else if (val == 'mainApprove') { // 审批通过 |
|
|
|
} else if (val == 'mainApprove') { |
|
|
|
// 审批通过 |
|
|
|
console.log('列表-操作按钮事件-审批通过') |
|
|
|
handleAgree(row.masterId) |
|
|
|
} else if (val == 'out') { // 出库 |
|
|
|
} else if (val == 'out') { |
|
|
|
// 出库 |
|
|
|
console.log('列表-操作按钮事件-出库') |
|
|
|
handleOut(row.masterId) |
|
|
|
} else if (val == 'in') { // 入库 |
|
|
|
} else if (val == 'in') { |
|
|
|
// 入库 |
|
|
|
console.log('列表-操作按钮事件-入库') |
|
|
|
handleIn(row.masterId) |
|
|
|
}else if (val == 'suspend') { // 中止 |
|
|
|
} else if (val == 'suspend') { |
|
|
|
// 中止 |
|
|
|
console.log('列表-操作按钮事件-中止') |
|
|
|
handleSuspend(row.masterId) |
|
|
|
}else if (val == 'edit') { // 编辑 |
|
|
|
} else if (val == 'edit') { |
|
|
|
// 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
} else if (val == 'delete') { |
|
|
|
// 删除 |
|
|
|
handleDelete(row.masterId) |
|
|
|
} else if (val == 'documentPrint') { |
|
|
|
handleDocumentPrint(row.masterId) |
|
|
@ -304,21 +364,30 @@ const buttonTableClick = async (val, row) => { |
|
|
|
|
|
|
|
// 单据打印 |
|
|
|
const BASE_URL = getJmreportBaseUrl() |
|
|
|
const documentSrc = ref(BASE_URL + '/jmreport/view/1015825402241605632?token=' + getAccessToken()) |
|
|
|
const documentSrc = ref(BASE_URL + '/jmreport/view/1037144474399084544?token=' + getAccessToken()) |
|
|
|
const documentSrc2 = ref(BASE_URL + '/jmreport/view/1015825402241605632?token=' + getAccessToken()) |
|
|
|
const handleDocumentPrint = async (id) => { |
|
|
|
window.open(documentSrc.value + '&id=' + id) |
|
|
|
await PurchaseBarterRequestDetailApi.getCount(id).then(async (res) => { |
|
|
|
if (res) { |
|
|
|
//不超过二十条 |
|
|
|
window.open(documentSrc.value + '&id=' + id) |
|
|
|
} else { |
|
|
|
//超过二十条 |
|
|
|
window.open(documentSrc2.value + '&id=' + id) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
/** 关闭按钮操作 */ |
|
|
|
const handleClose = async (id: number) => { |
|
|
|
await message.confirm(t('common.confirmColse')) |
|
|
|
tableObject.loading = true |
|
|
|
try{ |
|
|
|
try { |
|
|
|
await PurchaseBarterRequestMainApi.closePurchaseBarterRequestMain(id) |
|
|
|
message.success(t('common.closeSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}catch{ |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
|
} |
|
|
@ -327,12 +396,12 @@ const handleClose = async (id: number) => { |
|
|
|
const handleReAdd = async (id: number) => { |
|
|
|
await message.confirm(t('common.confirmReAdd')) |
|
|
|
tableObject.loading = true |
|
|
|
try{ |
|
|
|
try { |
|
|
|
await PurchaseBarterRequestMainApi.reAddPurchaseBarterRequestMain(id) |
|
|
|
message.success(t('common.reAddSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}catch{ |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
|
} |
|
|
@ -341,12 +410,12 @@ const handleReAdd = async (id: number) => { |
|
|
|
const handleSubmit = async (id: number) => { |
|
|
|
await message.confirm(t('common.confirmSubmit')) |
|
|
|
tableObject.loading = true |
|
|
|
try{ |
|
|
|
try { |
|
|
|
await PurchaseBarterRequestMainApi.submitPurchaseBarterRequestMain(id) |
|
|
|
message.success(t('common.submitSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}catch{ |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
|
} |
|
|
@ -355,12 +424,12 @@ const handleSubmit = async (id: number) => { |
|
|
|
const handleRefused = async (id: number) => { |
|
|
|
await message.confirm(t('common.confirmRefused')) |
|
|
|
tableObject.loading = true |
|
|
|
try{ |
|
|
|
try { |
|
|
|
await PurchaseBarterRequestMainApi.refusedPurchaseBarterRequestMain(id) |
|
|
|
message.success(t('common.refusedSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}catch{ |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
|
} |
|
|
@ -369,12 +438,12 @@ const handleRefused = async (id: number) => { |
|
|
|
const handleAgree = async (id: number) => { |
|
|
|
await message.confirm(t('common.confirmAgree')) |
|
|
|
tableObject.loading = true |
|
|
|
try{ |
|
|
|
try { |
|
|
|
await PurchaseBarterRequestMainApi.agreePurchaseBarterRequestMain(id) |
|
|
|
message.success(t('common.agreeSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}catch{ |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
|
} |
|
|
@ -386,7 +455,7 @@ const handleOut = async (id: number) => { |
|
|
|
try { |
|
|
|
await PurchaseBarterRequestMainApi.outStoragePurchaseBarterRequestMain(id) |
|
|
|
message.success(t('common.handleSuccess')) |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} finally { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
@ -398,7 +467,7 @@ const handleIn = async (id: number) => { |
|
|
|
try { |
|
|
|
await PurchaseBarterRequestMainApi.inStoragePurchaseBarterRequestMain(id) |
|
|
|
message.success(t('common.handleSuccess')) |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} finally { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
@ -410,7 +479,7 @@ const handleSuspend = async (id: number) => { |
|
|
|
try { |
|
|
|
await PurchaseBarterRequestMainApi.suspendPurchaseBarterRequestMain(id) |
|
|
|
message.success(t('common.handleSuccess')) |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} finally { |
|
|
|
tableObject.loading = false |
|
|
|
} |
|
|
@ -418,15 +487,13 @@ const handleSuspend = async (id: number) => { |
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
const formRef = ref() |
|
|
|
const openForm =async (type: string, row?: number) => { |
|
|
|
const openForm = async (type: string, row?: number) => { |
|
|
|
PurchaseBarterRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if(type == "update"){ |
|
|
|
|
|
|
|
}else{ |
|
|
|
if (type == 'update') { |
|
|
|
} else { |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
tableData.value = [] // 重置明细数据 |
|
|
|
formRef.value.open(type, row) |
|
|
|
} |
|
|
@ -436,9 +503,11 @@ const { wsCache } = useCache() |
|
|
|
/** 详情操作 */ |
|
|
|
const detailRef = 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,'requestPurchaseBarterMain') |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'requestPurchaseBarterMain') |
|
|
|
} |
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
@ -452,7 +521,7 @@ const handleDelete = async (id: number) => { |
|
|
|
message.success(t('common.delSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
// 刷新列表 |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
|
|
|
@ -465,7 +534,9 @@ const handleExport = async () => { |
|
|
|
loadStart() |
|
|
|
const excelTitle = ref(route.meta.title) |
|
|
|
tableObject.params.detailDataType = 1 |
|
|
|
const data = await PurchaseBarterRequestMainApi.exportPurchaseBarterRequestMain(tableObject.params) |
|
|
|
const data = await PurchaseBarterRequestMainApi.exportPurchaseBarterRequestMain( |
|
|
|
tableObject.params |
|
|
|
) |
|
|
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|
|
|
} catch { |
|
|
|
} finally { |
|
|
@ -474,10 +545,10 @@ const handleExport = async () => { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* tableForm方法 |
|
|
|
*/ |
|
|
|
* tableForm方法 |
|
|
|
*/ |
|
|
|
const tableFormKeys = {} |
|
|
|
PurchaseBarterRequestDetail.allSchemas.tableFormColumns.forEach(item => { |
|
|
|
PurchaseBarterRequestDetail.allSchemas.tableFormColumns.forEach((item) => { |
|
|
|
tableFormKeys[item.field] = item.default ? item.default : '' |
|
|
|
}) |
|
|
|
const tableData = ref([]) |
|
|
@ -491,47 +562,50 @@ const handleAddTable = () => { |
|
|
|
// 删除明细 |
|
|
|
const handleDeleteTable = (item, index) => { |
|
|
|
let itemIndex = tableData.value.indexOf(item) |
|
|
|
if(itemIndex>-1){ |
|
|
|
if (itemIndex > -1) { |
|
|
|
tableData.value.splice(itemIndex, 1) |
|
|
|
} |
|
|
|
} |
|
|
|
const tableSelectionDelete = (selection) => { |
|
|
|
tableData.value = tableData.value.filter(item => !selection.includes(item)) |
|
|
|
tableData.value = tableData.value.filter((item) => !selection.includes(item)) |
|
|
|
} |
|
|
|
// 主子数据 提交 |
|
|
|
const submitForm = async (formType, submitData) => { |
|
|
|
|
|
|
|
let data = {...submitData} |
|
|
|
if(data.masterId){ |
|
|
|
let data = { ...submitData } |
|
|
|
if (data.masterId) { |
|
|
|
data.id = data.masterId |
|
|
|
} |
|
|
|
} |
|
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
|
const cmdExists = data.subList.some(filter => |
|
|
|
parseFloat(filter.inventoryQty) < parseFloat(filter.qty) |
|
|
|
); |
|
|
|
const cmdExists = data.subList.some( |
|
|
|
(filter) => parseFloat(filter.inventoryQty) < parseFloat(filter.qty) |
|
|
|
) |
|
|
|
|
|
|
|
try { |
|
|
|
if (formType === 'create') { |
|
|
|
if(data.subList.length == 0){ |
|
|
|
message.warning("请添加子列表数据") |
|
|
|
return; |
|
|
|
if (data.subList.length == 0) { |
|
|
|
message.warning('请添加子列表数据') |
|
|
|
return |
|
|
|
} |
|
|
|
let flag = false; |
|
|
|
let flag = false |
|
|
|
data.subList.forEach((item) => { |
|
|
|
if(item.qty == 0){ |
|
|
|
message.warning("数量不能为0") |
|
|
|
flag = true; |
|
|
|
return; |
|
|
|
} |
|
|
|
if (item.qty == 0) { |
|
|
|
message.warning('数量不能为0') |
|
|
|
flag = true |
|
|
|
return |
|
|
|
} |
|
|
|
}) |
|
|
|
if(flag){ |
|
|
|
if (flag) { |
|
|
|
return |
|
|
|
} |
|
|
|
if(cmdExists){ |
|
|
|
message.warning("换货数量不能大于库存数量") |
|
|
|
if (cmdExists) { |
|
|
|
message.warning('换货数量不能大于库存数量') |
|
|
|
return |
|
|
|
} |
|
|
|
formRef.value.formLoading = true |
|
|
|
data.intexContactBegin = data.intexContact[0] |
|
|
|
data.intexContactEnd = data.intexContact[0] |
|
|
|
data.supplierContactBegin = data.supplierContact[0] |
|
|
|
data.supplierContactEnd = data.supplierContact[0] |
|
|
|
await PurchaseBarterRequestMainApi.createPurchaseBarterRequestMain(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
@ -543,8 +617,8 @@ const submitForm = async (formType, submitData) => { |
|
|
|
// 刷新当前列表 |
|
|
|
if (formType === 'create') { |
|
|
|
getList() |
|
|
|
}else{ |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
} else { |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} |
|
|
|
} finally { |
|
|
|
formRef.value.formLoading = false |
|
|
@ -553,14 +627,14 @@ const submitForm = async (formType, submitData) => { |
|
|
|
|
|
|
|
// 子表新增/编辑校验 |
|
|
|
const detailValidate = (data) => { |
|
|
|
let tag = false; |
|
|
|
if(data.qty <= 0){ |
|
|
|
let tag = false |
|
|
|
if (data.qty <= 0) { |
|
|
|
message.warning('数量必须大于0') |
|
|
|
tag = false; |
|
|
|
return tag; |
|
|
|
}else { |
|
|
|
tag = true; |
|
|
|
return tag; |
|
|
|
tag = false |
|
|
|
return tag |
|
|
|
} else { |
|
|
|
tag = true |
|
|
|
return tag |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -591,25 +665,27 @@ const searchFormClick = (searchData) => { |
|
|
|
} |
|
|
|
|
|
|
|
let validityDays = 0 |
|
|
|
const detailOpenForm = (type, row)=>{ |
|
|
|
console.log('detailOpenForm',row) |
|
|
|
if(type=='update'){ |
|
|
|
const detailOpenForm = (type, row) => { |
|
|
|
console.log('detailOpenForm', row) |
|
|
|
if (type == 'update') { |
|
|
|
//有效期 |
|
|
|
ItembasicApi.getItembasicPage({ |
|
|
|
code:row.itemCode |
|
|
|
}).then((res)=>{ |
|
|
|
res.list.forEach((item,index)=>{ |
|
|
|
const findItem = tableData.value.find(item1=>item1['itemCode']==row['code']) |
|
|
|
if(findItem){ |
|
|
|
code: row.itemCode |
|
|
|
}).then((res) => { |
|
|
|
res.list.forEach((item, index) => { |
|
|
|
const findItem = tableData.value.find((item1) => item1['itemCode'] == row['code']) |
|
|
|
if (findItem) { |
|
|
|
validityDays = findItem['expireTime'] |
|
|
|
} |
|
|
|
}) |
|
|
|
detailRef.value.formRef.formRef.formModel.expireDate = addDay(detailRef.value.formRef.formRef.formModel.produceDate,validityDays).valueOf() |
|
|
|
detailRef.value.formRef.formRef.formModel.expireDate = addDay( |
|
|
|
detailRef.value.formRef.formRef.formModel.produceDate, |
|
|
|
validityDays |
|
|
|
).valueOf() |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
validityDays = 0 |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const onBlur = (field, e) => { |
|
|
|