|
|
@ -1,18 +1,22 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="PurchasereturnRequestMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search |
|
|
|
:schema="PurchasereturnRequestMain.allSchemas.searchSchema" |
|
|
|
@search="setSearchParams" |
|
|
|
@reset="setSearchParams" |
|
|
|
/> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="PurchasereturnRequestMain.allSchemas" |
|
|
|
/> |
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="PurchasereturnRequestMain.allSchemas" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
@ -27,13 +31,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 }"> |
|
|
|
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
<ButtonBase |
|
|
|
:Butttondata="butttondata(row)" |
|
|
|
@button-base-click="buttonTableClick($event, row)" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
@ -50,7 +57,7 @@ |
|
|
|
:apiUpdate="PurchasereturnRequestMainApi.updatePurchasereturnRequestMain" |
|
|
|
:apiCreate="PurchasereturnRequestMainApi.createPurchasereturnRequestMain" |
|
|
|
:isBusiness="true" |
|
|
|
:isShowButton="false" |
|
|
|
:isShowButton="isShowButton" |
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
@ -73,18 +80,29 @@ |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/wms/purchasereturn-request-main/import" :importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" /> |
|
|
|
<ImportForm |
|
|
|
ref="importFormRef" |
|
|
|
url="/wms/purchasereturn-request-main/import" |
|
|
|
:importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" |
|
|
|
:updateIsDisable="true" |
|
|
|
:coverIsDisable="true" |
|
|
|
:mode="2" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { PurchasereturnRequestMain,PurchasereturnRequestMainRules,PurchasereturnRequestDetail,PurchasereturnRequestDetailRules } from './purchasereturnRequestMain.data' |
|
|
|
import { |
|
|
|
PurchasereturnRequestMain, |
|
|
|
PurchasereturnRequestMainRules, |
|
|
|
PurchasereturnRequestDetail, |
|
|
|
PurchasereturnRequestDetailRules |
|
|
|
} from './purchasereturnRequestMain.data' |
|
|
|
import * as PurchasereturnRequestMainApi from '@/api/wms/purchasereturnRequestMain' |
|
|
|
import * as PurchasereturnRequestDetailApi from '@/api/wms/purchasereturnRequestDetail' |
|
|
|
import * as PurchasereceiptRecordDetailApi from '@/api/wms/purchasereceiptRecordDetail' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import { Console } from 'console' |
|
|
|
|
|
|
|
// 采购退货申请 |
|
|
|
defineOptions({ name: 'PurchasereturnRequestMain' }) |
|
|
@ -97,31 +115,67 @@ const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(PurchasereturnRequestMain.allSchemas.tableColumns) |
|
|
|
|
|
|
|
const isShowButton = ref(true) |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
|
} |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|
|
|
nextTick(() => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 明细查询页赋值 |
|
|
|
console.log(row['batch']) |
|
|
|
console.log(val[0]['toBatch']) |
|
|
|
console.log(val[0]) |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
row['poNumber'] = val[0]['poNumber'] |
|
|
|
row['poLine'] = val[0]['poLine'] |
|
|
|
row['itemCode'] = val[0]['itemCode'] |
|
|
|
row['itemName'] = val[0]['itemName'] |
|
|
|
row['itemDesc1'] = val[0]['itemDesc1'] |
|
|
|
row['itemDesc2'] = val[0]['itemDesc2'] |
|
|
|
row['batch'] = val[0]['batch'] |
|
|
|
row['altBatch'] = val[0]['altBatch'] |
|
|
|
row['packingNumber'] = val[0]['packingNumber'] |
|
|
|
row['containerNumber'] = val[0]['containerNumber'] |
|
|
|
row['qty'] = val[0]['qty'] |
|
|
|
row['uom'] = val[0]['uom'] |
|
|
|
row['supplierQty'] = val[0]['supplierQty'] |
|
|
|
row['supplierUom'] = val[0]['supplierUom'] |
|
|
|
row['inventoryStatus'] = val[0]['inventoryStatus'] |
|
|
|
row['fromLocationCode'] = val[0]['locationCode'] |
|
|
|
row['toLocationCode'] = val[0]['toLocationCode'] |
|
|
|
row['fromLocationGroupCode'] = val[0]['locationGroupCode'] |
|
|
|
row['toLocationGroupCode'] = val[0]['toLocationGroupCode'] |
|
|
|
row['fromAreaCode'] = val[0]['areaCode'] |
|
|
|
row['toAreaCode'] = val[0]['toAreaCode'] |
|
|
|
row['fromQwnerCode'] = val[0]['fromQwnerCode'] |
|
|
|
row['toOwnerCode'] = val[0]['toOwnerCode'] |
|
|
|
row['arriveDate'] = val[0]['arriveDate'] |
|
|
|
row['produceDate'] = val[0]['produceDate'] |
|
|
|
row['expireDate'] = val[0]['expireDate'] |
|
|
|
row['convertRate'] = val[0]['convertRate'] |
|
|
|
row['visualInspectResult'] = val[0]['visualInspectResult'] |
|
|
|
row['visualInspectPhotos'] = val[0]['visualInspectPhotos'] |
|
|
|
row['failedReason'] = val[0]['failedReason'] |
|
|
|
row['singlePrice'] = val[0]['singlePrice'] |
|
|
|
row['amount'] = val[0]['amount'] |
|
|
|
row['projectCode'] = val[0]['projectCode'] |
|
|
|
} else { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
setV['purchaseReceiptRecordNumber'] = val[0]['number'] |
|
|
|
setV['supplierCode'] = val[0]['supplierCode'] |
|
|
|
|
|
|
|
|
|
|
|
// 获取子表数据 getBomDisassemble |
|
|
|
PurchasereceiptRecordDetailApi.getPurchasereceiptRecordDetailList({ |
|
|
|
masterId: val[0]['id']}).then(res => { |
|
|
|
if (res) tableData.value = res; |
|
|
|
masterId: val[0]['id'] |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
if (res) tableData.value = res |
|
|
|
console.log(PurchasereturnRequestDetail.allSchemas.tableFormColumns) |
|
|
|
tableData.value.forEach(item=>{ |
|
|
|
tableData.value.forEach((item) => { |
|
|
|
item.batch = item.toBatch |
|
|
|
item.packingNumber = item.toPackingNumber |
|
|
|
item.containerNumber = item.toContainerNumber |
|
|
@ -129,15 +183,21 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
item.fromLocationCode = item.toLocationCode |
|
|
|
item.toLocationCode = fromLocationCode |
|
|
|
}) |
|
|
|
PurchasereturnRequestDetail.allSchemas.tableFormColumns.map(item => { |
|
|
|
if(item.field == 'remark') { |
|
|
|
isShowButton.value = false |
|
|
|
PurchasereturnRequestDetail.allSchemas.tableFormColumns.map((item) => { |
|
|
|
item.tableForm.disabled = true |
|
|
|
if (item.field == 'remark') { |
|
|
|
item.tableForm.disabled = false |
|
|
|
} |
|
|
|
if(item.field == 'failedReason') { |
|
|
|
if (item.field == 'failedReason') { |
|
|
|
item.tableForm.disabled = false |
|
|
|
} |
|
|
|
if (item.field == 'itemCode') { |
|
|
|
item.tableForm.isInpuFocusShow = false |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
formRef.setValues(setV) |
|
|
@ -145,7 +205,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
}) |
|
|
|
} |
|
|
|
// 查询页面返回——详情 |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
@ -155,7 +215,7 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
|
|
|
|
// 子表新增的时候选择表格之后需要会显得字段 |
|
|
|
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom'] |
|
|
|
const Echo = [] |
|
|
|
const Echo = [] |
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
getListApi: PurchasereturnRequestMainApi.getPurchasereturnRequestMainPage // 分页接口 |
|
|
@ -174,27 +234,33 @@ const HeadButttondata = [ |
|
|
|
defaultButtons.defaultExportBtn(null), // 导出 |
|
|
|
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') { // 刷新 |
|
|
|
} else if (val == 'refresh') { |
|
|
|
// 刷新 |
|
|
|
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 { |
|
|
@ -204,39 +270,67 @@ const isShowMainButton = (row,val) => { |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = (row) => { |
|
|
|
return [ |
|
|
|
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3','4','6']),hasPermi:'wms:purchasereceipt-request-main:close'}), // 关闭 |
|
|
|
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['5']),hasPermi:'wms:purchasereceipt-request-main:reAdd'}), //重新添加 |
|
|
|
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchasereceipt-request-main:submit'}), // 提交审批 |
|
|
|
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:purchasereceipt-request-main:refused'}), // 驳回 |
|
|
|
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:purchasereceipt-request-main:agree'}), // 审批通过 |
|
|
|
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:purchasereceipt-request-main:handle'}), // 处理 |
|
|
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchasereceipt-request-main:update'}), // 编辑 |
|
|
|
] |
|
|
|
return [ |
|
|
|
defaultButtons.mainListCloseBtn({ |
|
|
|
hide: isShowMainButton(row, ['1', '2', '3', '4', '6']), |
|
|
|
hasPermi: 'wms:purchasereceipt-request-main:close' |
|
|
|
}), // 关闭 |
|
|
|
defaultButtons.mainListReAddBtn({ |
|
|
|
hide: isShowMainButton(row, ['5']), |
|
|
|
hasPermi: 'wms:purchasereceipt-request-main:reAdd' |
|
|
|
}), //重新添加 |
|
|
|
defaultButtons.mainListSubmitBtn({ |
|
|
|
hide: isShowMainButton(row, ['1']), |
|
|
|
hasPermi: 'wms:purchasereceipt-request-main:submit' |
|
|
|
}), // 提交审批 |
|
|
|
defaultButtons.mainListTurnDownBtn({ |
|
|
|
hide: isShowMainButton(row, ['2']), |
|
|
|
hasPermi: 'wms:purchasereceipt-request-main:refused' |
|
|
|
}), // 驳回 |
|
|
|
defaultButtons.mainListApproveBtn({ |
|
|
|
hide: isShowMainButton(row, ['2']), |
|
|
|
hasPermi: 'wms:purchasereceipt-request-main:agree' |
|
|
|
}), // 审批通过 |
|
|
|
defaultButtons.mainListHandleBtn({ |
|
|
|
hide: isShowMainButton(row, ['3']), |
|
|
|
hasPermi: 'wms:purchasereceipt-request-main:handle' |
|
|
|
}), // 处理 |
|
|
|
defaultButtons.mainListEditBtn({ |
|
|
|
hide: isShowMainButton(row, ['1']), |
|
|
|
hasPermi: 'wms:purchasereceipt-request-main:update' |
|
|
|
}) // 编辑 |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'mainClose') { // 关闭 |
|
|
|
if (val == 'mainClose') { |
|
|
|
// 关闭 |
|
|
|
handleClose(row.id) |
|
|
|
} else if (val == 'mainReAdd') { // 重新添加 |
|
|
|
} else if (val == 'mainReAdd') { |
|
|
|
// 重新添加 |
|
|
|
handleReAdd(row.id) |
|
|
|
} else if (val == 'mainSubmit') { // 提交审批 |
|
|
|
} else if (val == 'mainSubmit') { |
|
|
|
// 提交审批 |
|
|
|
handleSubmit(row.id) |
|
|
|
} else if (val == 'mainTurnDown') { // 驳回 |
|
|
|
} else if (val == 'mainTurnDown') { |
|
|
|
// 驳回 |
|
|
|
handleRefused(row.id) |
|
|
|
} else if (val == 'mainApprove') { // 审批通过 |
|
|
|
} else if (val == 'mainApprove') { |
|
|
|
// 审批通过 |
|
|
|
handleAgree(row.id) |
|
|
|
} else if (val == 'mainHandle') { // 处理 |
|
|
|
} else if (val == 'mainHandle') { |
|
|
|
// 处理 |
|
|
|
handleHandle(row.id) |
|
|
|
} else if (val == 'edit') { // 编辑 |
|
|
|
} else if (val == 'edit') { |
|
|
|
// 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
const formRef = ref() |
|
|
|
const openForm =async (type: string, row?: number) => { |
|
|
|
const openForm = async (type: string, row?: number) => { |
|
|
|
tableData.value = [] // 重置明细数据 |
|
|
|
formRef.value.open(type, row) |
|
|
|
} |
|
|
@ -324,10 +418,10 @@ const handleExport = async () => { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* tableForm方法 |
|
|
|
*/ |
|
|
|
* tableForm方法 |
|
|
|
*/ |
|
|
|
const tableFormKeys = {} |
|
|
|
PurchasereturnRequestDetail.allSchemas.tableFormColumns.forEach(item => { |
|
|
|
PurchasereturnRequestDetail.allSchemas.tableFormColumns.forEach((item) => { |
|
|
|
tableFormKeys[item.field] = item.default ? item.default : '' |
|
|
|
}) |
|
|
|
const tableData = ref([]) |
|
|
@ -335,10 +429,41 @@ const tableData = ref([]) |
|
|
|
// 添加明细 |
|
|
|
const handleAddTable = () => { |
|
|
|
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) |
|
|
|
PurchasereturnRequestDetail.allSchemas.tableFormColumns.map((item) => { |
|
|
|
item.tableForm.disabled = true |
|
|
|
if (item.field == 'remark') { |
|
|
|
item.tableForm.disabled = false |
|
|
|
} |
|
|
|
if (item.field == 'failedReason') { |
|
|
|
item.tableForm.disabled = false |
|
|
|
} |
|
|
|
if (item.field == 'qty') { |
|
|
|
item.tableForm.disabled = false |
|
|
|
} |
|
|
|
if (item.field == 'reason') { |
|
|
|
item.tableForm.disabled = false |
|
|
|
} |
|
|
|
if (item.field == 'itemCode') { |
|
|
|
item.tableForm.isInpuFocusShow = true |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
// 删除明细 |
|
|
|
const handleDeleteTable = (item, index) => { |
|
|
|
const handleDeleteTable = (item, index,formRef) => { |
|
|
|
tableData.value.splice(index, 1) |
|
|
|
console.log(item) |
|
|
|
if (tableData.value.length == 0) { |
|
|
|
isShowButton.value = true |
|
|
|
nextTick(() => { |
|
|
|
|
|
|
|
const setV = {} |
|
|
|
|
|
|
|
setV['purchaseReceiptRecordNumber'] = '' |
|
|
|
setV['supplierCode'] = '' |
|
|
|
formRef.setValues(setV) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 主子数据 提交 |
|
|
|