|
@ -1,9 +1,8 @@ |
|
|
<template> |
|
|
<template> |
|
|
<ContentWrap> |
|
|
<ContentWrap> |
|
|
<!-- 搜索工作栏 --> |
|
|
<!-- 搜索工作栏 --> |
|
|
<Search :schema="Invoicingcalendar.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
<Search :schema="[...PurchaseClaimRequestMain.allSchemas.searchSchema,...PurchaseClaimRequestDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
</ContentWrap> |
|
|
</ContentWrap> |
|
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
<!-- 列表头部 --> |
|
|
<TableHead |
|
|
<TableHead |
|
|
:HeadButttondata="HeadButttondata" |
|
|
:HeadButttondata="HeadButttondata" |
|
@ -11,12 +10,12 @@ |
|
|
:routeName="routeName" |
|
|
:routeName="routeName" |
|
|
@updataTableColumns="updataTableColumns" |
|
|
@updataTableColumns="updataTableColumns" |
|
|
@searchFormClick="searchFormClick" |
|
|
@searchFormClick="searchFormClick" |
|
|
:allSchemas="Invoicingcalendar.allSchemas" |
|
|
:allSchemas="PurchaseClaimRequestMain.allSchemas" |
|
|
|
|
|
:detailAllSchemas="PurchaseClaimRequestDetail.allSchemas" |
|
|
/> |
|
|
/> |
|
|
|
|
|
<!-- 列表 --> |
|
|
<!-- 列表 --> |
|
|
|
|
|
<ContentWrap> |
|
|
<ContentWrap> |
|
|
<Table |
|
|
<Table v-clientTable |
|
|
:columns="tableColumns" |
|
|
:columns="tableColumns" |
|
|
:data="tableObject.tableList" |
|
|
:data="tableObject.tableList" |
|
|
:loading="tableObject.loading" |
|
|
:loading="tableObject.loading" |
|
@ -27,83 +26,153 @@ |
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
v-model:sort="tableObject.sort" |
|
|
v-model:sort="tableObject.sort" |
|
|
> |
|
|
> |
|
|
<template #code="{row}"> |
|
|
<template #number="{row}"> |
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|
|
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> |
|
|
<span>{{ row.code }}</span> |
|
|
<span>{{ row.number }}</span> |
|
|
</el-button> |
|
|
</el-button> |
|
|
</template> |
|
|
</template> |
|
|
<template #action="{ row }"> |
|
|
<template #action="{ row,$index }"> |
|
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
</template> |
|
|
</template> |
|
|
</Table> |
|
|
</Table> |
|
|
</ContentWrap> |
|
|
</ContentWrap> |
|
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
<BasicForm |
|
|
<BasicForm |
|
|
ref="basicFormRef" |
|
|
ref="formRef" |
|
|
@success="formsSuccess" |
|
|
:isOpenSearchTable="true" |
|
|
:rules="InvoicingcalendarRules" |
|
|
fieldTableColumn="itemCode" |
|
|
:formAllSchemas="Invoicingcalendar.allSchemas" |
|
|
:rules="PurchaseClaimRequestMainRules" |
|
|
:apiUpdate="InvoicingcalendarApi.updateInvoicingcalendar" |
|
|
:formAllSchemas="PurchaseClaimRequestMain.allSchemas" |
|
|
:apiCreate="InvoicingcalendarApi.createInvoicingcalendar" |
|
|
:tableAllSchemas="PurchaseClaimRequestDetail.allSchemas" |
|
|
|
|
|
:tableFormRules="PurchaseClaimRequestDetailRules" |
|
|
|
|
|
:tableData="tableData" |
|
|
|
|
|
:apiUpdate="PurchaseClaimRequestMainApi.updatePurchaseClaimRequestMain" |
|
|
|
|
|
:apiCreate="PurchaseClaimRequestMainApi.createPurchaseClaimRequestMain" |
|
|
|
|
|
:isBusiness="true" |
|
|
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
|
|
:isShowReduceButtonSelection="true" |
|
|
|
|
|
@tableSelectionDelete="tableSelectionDelete" |
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
:isBusiness="false" |
|
|
@submitForm="submitForm" |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
<!-- 详情 --> |
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Invoicingcalendar.allSchemas" /> |
|
|
<Detail |
|
|
|
|
|
ref="detailRef" |
|
|
|
|
|
:isBasic="false" |
|
|
|
|
|
:allSchemas="PurchaseClaimRequestMain.allSchemas" |
|
|
|
|
|
:detailAllSchemas="PurchaseClaimRequestDetail.allSchemas" |
|
|
|
|
|
:detailAllSchemasRules="PurchaseClaimRequestDetailRules" |
|
|
|
|
|
:apiCreate="PurchaseClaimRequestDetailApi.createPurchaseClaimRequestDetail" |
|
|
|
|
|
:apiUpdate="PurchaseClaimRequestDetailApi.updatePurchaseClaimRequestDetail" |
|
|
|
|
|
:apiPage="PurchaseClaimRequestDetailApi.getPurchaseClaimRequestDetailPage" |
|
|
|
|
|
:apiDelete="PurchaseClaimRequestDetailApi.deletePurchaseClaimRequestDetail" |
|
|
|
|
|
/> |
|
|
<!-- 导入 --> |
|
|
<!-- 导入 --> |
|
|
<ImportForm ref="importFormRef" url="/wms/invoicingcalendar/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|
|
<ImportForm ref="importFormRef" url="/wms/deliver-plan-main/import" :importTemplateData="importTemplateData" |
|
|
|
|
|
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" :extend= "businessType"/> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import download from '@/utils/download' |
|
|
import download from '@/utils/download' |
|
|
import { Invoicingcalendar,InvoicingcalendarRules } from './invoicingcalendar.data' |
|
|
import { PurchaseClaimRequestMain,PurchaseClaimRequestMainRules,PurchaseClaimRequestDetailRules,PurchaseClaimRequestDetail} from './PurchaseClaimRequestMain.data' |
|
|
import * as InvoicingcalendarApi from '@/api/wms/invoicingcalendar' |
|
|
import * as PurchaseClaimRequestMainApi from '@/api/wms/PurchaseClaimRequestMain' |
|
|
|
|
|
import * as PurchaseClaimRequestDetailApi from '@/api/wms/purchaseClaimRequestDetail' |
|
|
|
|
|
import * as CustomerStatementDetailApi from '@/api/wms/customerStatementDetail' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
|
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
|
|
|
import Detail from '@/components/Detail/src/Detail.vue' |
|
|
|
|
|
import { formatDate } from '@/utils/formatTime' |
|
|
import { formatDate } from '@/utils/formatTime' |
|
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
|
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
|
|
const { loadStart, loadDone } = usePageLoading() |
|
|
const { loadStart, loadDone } = usePageLoading() |
|
|
defineOptions({ name: 'Invoicingcalendar' }) |
|
|
defineOptions({ name: 'purchaseClaimRequestMain' }) |
|
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
const message = useMessage() // 消息弹窗 |
|
|
const { t } = useI18n() // 国际化 |
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
|
|
const route = useRoute() // 路由信息 |
|
|
const route = useRoute() // 路由信息 |
|
|
const routeName = ref() |
|
|
const routeName = ref() |
|
|
routeName.value = route.name |
|
|
routeName.value = route.name |
|
|
const tableColumns = ref(Invoicingcalendar.allSchemas.tableColumns) |
|
|
const businessType = ref() |
|
|
|
|
|
const tableColumns = ref([...PurchaseClaimRequestMain.allSchemas.tableColumns,...PurchaseClaimRequestDetail.allSchemas.tableMainColumns]) |
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
|
|
getListApi: PurchaseClaimRequestMainApi.getPurchaseClaimRequestMainPage // 分页接口 |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
// 获得表格的各种操作 |
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
const { getList, setSearchParams } = tableMethods |
|
|
nextTick(() => { |
|
|
|
|
|
const setV = {} |
|
|
const tableData = ref([]) |
|
|
setV[formField] = val[0][searchField] |
|
|
|
|
|
formRef.setValues(setV) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
// 字段设置 更新主列表字段 |
|
|
const updataTableColumns = (val) => { |
|
|
const updataTableColumns = (val) => { |
|
|
tableColumns.value = val |
|
|
tableColumns.value = val |
|
|
} |
|
|
} |
|
|
|
|
|
// 查询页面返回 |
|
|
|
|
|
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'])) |
|
|
|
|
|
message.warning(`物料${itemCodes.join(',')}已经存在`) |
|
|
|
|
|
} |
|
|
|
|
|
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode'])) |
|
|
|
|
|
if(val.length==0) return |
|
|
|
|
|
val.forEach(item=>{ |
|
|
|
|
|
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) |
|
|
|
|
|
row[formField] = item[searchField] |
|
|
|
|
|
newRow['uom'] = item['customerUom'] |
|
|
|
|
|
newRow['id'] = item['id'] |
|
|
|
|
|
.push(newRow) |
|
|
|
|
|
}) |
|
|
|
|
|
}else{ |
|
|
|
|
|
row[formField] = val[0][searchField] |
|
|
|
|
|
} |
|
|
|
|
|
// if(formField == 'itemCode') { |
|
|
|
|
|
// row['uom'] = val[0]['customerUom'] |
|
|
|
|
|
// } |
|
|
|
|
|
// 明细查询页赋值 |
|
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
} else { |
|
|
getListApi: InvoicingcalendarApi.getInvoicingcalendarPage // 分页接口 |
|
|
const setV = {} |
|
|
}) |
|
|
if(formField == 'customerStatementNumber') { |
|
|
|
|
|
//客户对账单 |
|
|
|
|
|
setV['customer'] = val[0]['customerCode'] |
|
|
|
|
|
setV['customerName'] = val[0]['customerName'] |
|
|
|
|
|
CustomerStatementDetailApi.getCustomerStatementDetailPage({ |
|
|
|
|
|
pageNo:1, |
|
|
|
|
|
pageNSize: 100, |
|
|
|
|
|
masterId:val[0]['id'] |
|
|
|
|
|
}).then((res) => { |
|
|
|
|
|
console.log(55,res) |
|
|
|
|
|
tableData.value = res.list && res.list.length > 0 ?res.list : [] |
|
|
|
|
|
}) |
|
|
|
|
|
// tableData.value = [] |
|
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
} |
|
|
const { getList, setSearchParams } = tableMethods |
|
|
setV[formField] = val[0][searchField] |
|
|
|
|
|
formRef.setValues(setV) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
// 查询页面返回——详情 |
|
|
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
|
|
nextTick(() => { |
|
|
|
|
|
const setV = {} |
|
|
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
|
|
// setV['soLine'] = val[0]['lineNumber'] |
|
|
|
|
|
// setV['lineNumber'] = val[0]['lineNumber'] |
|
|
|
|
|
// setV['itemCode'] = val[0]['itemCode'] |
|
|
|
|
|
setV['remark'] = val[0]['remark'] |
|
|
|
|
|
setV['uom'] = val[0]['customerUom'] |
|
|
|
|
|
formRef.setValues(setV) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
// 列表头部按钮 |
|
|
const HeadButttondata = [ |
|
|
const HeadButttondata = [ |
|
|
defaultButtons.defaultAddBtn({hasPermi:'wms:invoicingcalendar:create'}), // 新增 |
|
|
defaultButtons.defaultAddBtn({hasPermi:`wms:${routeName.value}:create` }), // 新增 |
|
|
defaultButtons.defaultImportBtn({hasPermi:'wms:invoicingcalendar:import'}), // 导入 |
|
|
defaultButtons.defaultImportBtn({hasPermi:`wms:${routeName.value}:import` }), // 导入 |
|
|
defaultButtons.defaultExportBtn({hasPermi:'wms:invoicingcalendar:export'}), // 导出 |
|
|
defaultButtons.defaultExportBtn({hasPermi:`wms:${routeName.value}:export` }), // 导出 |
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
@ -116,7 +185,6 @@ const HeadButttondata = [ |
|
|
// color: '' |
|
|
// color: '' |
|
|
// }, |
|
|
// }, |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
// 头部按钮事件 |
|
|
const buttonBaseClick = (val, item) => { |
|
|
const buttonBaseClick = (val, item) => { |
|
|
if (val == 'add') { // 新增 |
|
|
if (val == 'add') { // 新增 |
|
@ -126,70 +194,63 @@ const buttonBaseClick = (val, item) => { |
|
|
} else if (val == 'export') { // 导出 |
|
|
} else if (val == 'export') { // 导出 |
|
|
handleExport() |
|
|
handleExport() |
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
|
|
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
|
|
|
|
|
searchFormClick({ |
|
|
|
|
|
filters: tableObject.params.filters |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
getList() |
|
|
getList() |
|
|
|
|
|
} |
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
} else { // 其他按钮 |
|
|
} else { // 其他按钮 |
|
|
console.log('其他按钮', item) |
|
|
console.log('其他按钮', item) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// 根据状态返回该按钮是否显示 |
|
|
|
|
|
const isShowMainButton = (row,val) => { |
|
|
|
|
|
if (val.indexOf(row.status) > -1) { |
|
|
|
|
|
return false |
|
|
|
|
|
} else { |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
// 列表-操作按钮 |
|
|
// 列表-操作按钮 |
|
|
const butttondata = [ |
|
|
const butttondata = (row,$index) => { |
|
|
defaultButtons.mainListEditBtn({hasPermi:'wms:invoicingcalendar:update'}), // 编辑 |
|
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
|
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:invoicingcalendar:delete'}), // 删除 |
|
|
if(findIndex>-1&&findIndex<$index){ |
|
|
] |
|
|
return [] |
|
|
|
|
|
} |
|
|
|
|
|
return [ |
|
|
|
|
|
defaultButtons.mainListPlanOpeBtn({hide:isShowMainButton(row,['5']),hasPermi:`wms:${routeName.value}:open`}), // 打开 |
|
|
|
|
|
defaultButtons.mainListPlanCloBtn({hide:isShowMainButton(row,['1','2','3','4']),hasPermi:`wms:${routeName.value}:close`}), // 关闭 |
|
|
|
|
|
defaultButtons.mainListPlanSubBtn({hide:isShowMainButton(row,['1']),hasPermi:`wms:${routeName.value}:submit`}), // 提交审批 |
|
|
|
|
|
defaultButtons.mainListPlanTurBtn({hide:isShowMainButton(row,['2']),hasPermi:`wms:${routeName.value}:reject`}), // 驳回 |
|
|
|
|
|
defaultButtons.mainListPlanAppBtn({hide:isShowMainButton(row,['2']),hasPermi:`wms:${routeName.value}:agree`}), // 审批通过 |
|
|
|
|
|
defaultButtons.mainListPlanPubBtn({hide:isShowMainButton(row,['3']),hasPermi:`wms:${routeName.value}:publish`}), // 发布 |
|
|
|
|
|
defaultButtons.mainListPlanResBtn({hide:isShowMainButton(row,['4']),hasPermi:`wms:${routeName.value}:resetting`}), // 重置 |
|
|
|
|
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:`wms:${routeName.value}:update`}), // 编辑 |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
// 列表-操作按钮事件 |
|
|
const buttonTableClick = async (val, row) => { |
|
|
const buttonTableClick = async (val, row) => { |
|
|
if (val == 'edit') { // 编辑 |
|
|
if (val == 'edit') { // 编辑 |
|
|
openForm('update', row) |
|
|
openForm('update', row) |
|
|
} else if (val == 'delete') { // 删除 |
|
|
} else if (val == 'delete') { // 删除 |
|
|
handleDelete(row.id) |
|
|
handleDelete(row.masterId) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
/** 添加/修改操作 */ |
|
|
const basicFormRef = ref() |
|
|
const formRef = ref() |
|
|
const openForm = (type: string, row?: any) => { |
|
|
const openForm =async (type: string, row?: number) => { |
|
|
basicFormRef.value.open(type, row) |
|
|
tableData.value = [] // 重置明细数据 |
|
|
} |
|
|
formRef.value.open(type, row) |
|
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
|
|
|
var isHave =Invoicingcalendar.allSchemas.formSchema.some(function (item) { |
|
|
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
|
|
|
}); |
|
|
|
|
|
if(isHave){ |
|
|
|
|
|
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|
|
|
|
|
message.error('失效时间要大于生效时间') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if(data.activeTime==0)data.activeTime = null; |
|
|
|
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
|
|
|
if (formType === 'create') { |
|
|
|
|
|
if(data.beginDay > data.endDay){ |
|
|
|
|
|
message.error('开始日期要小于截止日期') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
await InvoicingcalendarApi.createInvoicingcalendar(data) |
|
|
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
|
|
} else { |
|
|
|
|
|
if(data.beginDay > data.endDay){ |
|
|
|
|
|
message.error('开始日期要小于截止日期') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
await InvoicingcalendarApi.updateInvoicingcalendar(data) |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
} |
|
|
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
|
|
getList() |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
/** 详情操作 */ |
|
|
const detailRef = ref() |
|
|
const detailRef = ref() |
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicInvoicingcalendar') |
|
|
detailRef.value.openDetail(row, titleName, titleValue,'planDeliverMain') |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
/** 删除按钮操作 */ |
|
@ -197,14 +258,15 @@ const handleDelete = async (id: number) => { |
|
|
try { |
|
|
try { |
|
|
// 删除的二次确认 |
|
|
// 删除的二次确认 |
|
|
await message.delConfirm() |
|
|
await message.delConfirm() |
|
|
|
|
|
tableObject.loading = true |
|
|
// 发起删除 |
|
|
// 发起删除 |
|
|
await InvoicingcalendarApi.deleteInvoicingcalendar(id) |
|
|
await PurchaseClaimRequestMainApi.deletePurchaseClaimRequestMain(id) |
|
|
|
|
|
tableObject.loading = false |
|
|
message.success(t('common.delSuccess')) |
|
|
message.success(t('common.delSuccess')) |
|
|
// 刷新列表 |
|
|
// 刷新列表 |
|
|
await getList() |
|
|
buttonBaseClick('refresh',null) |
|
|
} catch {} |
|
|
} catch {} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 导出按钮操作 */ |
|
|
/** 导出按钮操作 */ |
|
|
const handleExport = async () => { |
|
|
const handleExport = async () => { |
|
|
try { |
|
|
try { |
|
@ -213,7 +275,7 @@ const handleExport = async () => { |
|
|
// 发起导出 |
|
|
// 发起导出 |
|
|
loadStart() |
|
|
loadStart() |
|
|
const excelTitle = ref(route.meta.title) |
|
|
const excelTitle = ref(route.meta.title) |
|
|
const data = await InvoicingcalendarApi.exportInvoicingcalendar(tableObject.params) |
|
|
const data = await PurchaseClaimRequestMainApi.exportPurchaseClaimRequestMain(tableObject.params) |
|
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|
|
} catch { |
|
|
} catch { |
|
|
} finally { |
|
|
} finally { |
|
@ -221,16 +283,109 @@ const handleExport = async () => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* tableForm方法 |
|
|
|
|
|
*/ |
|
|
|
|
|
const tableFormKeys = {} |
|
|
|
|
|
PurchaseClaimRequestDetail.allSchemas.tableFormColumns.forEach(item => { |
|
|
|
|
|
tableFormKeys[item.field] = item.default ? item.default : '' |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// 添加明细 |
|
|
|
|
|
const handleAddTable = () => { |
|
|
|
|
|
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) |
|
|
|
|
|
} |
|
|
|
|
|
// 删除明细 |
|
|
|
|
|
const handleDeleteTable = (item, index) => { |
|
|
|
|
|
let itemIndex = tableData.value.indexOf(item) |
|
|
|
|
|
if(itemIndex>-1){ |
|
|
|
|
|
tableData.value.splice(itemIndex, 1) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
const tableSelectionDelete = (selection) => { |
|
|
|
|
|
tableData.value = tableData.value.filter(item => !selection.includes(item)) |
|
|
|
|
|
} |
|
|
|
|
|
//为true表示子表数据中存在数量为0的数据 |
|
|
|
|
|
const flag = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
// 主子数据 提交 |
|
|
|
|
|
const submitForm = async (formType, submitData) => { |
|
|
|
|
|
let data = {...submitData} |
|
|
|
|
|
if(data.masterId){ |
|
|
|
|
|
data.id = data.masterId |
|
|
|
|
|
} |
|
|
|
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
|
|
|
data.subList.forEach(item=>{ |
|
|
|
|
|
item.toWarehouseCode = data.toWarehouseCode |
|
|
|
|
|
item.toLocationCode = data.toLocationCode |
|
|
|
|
|
}) |
|
|
|
|
|
data.businessType = businessType.value |
|
|
|
|
|
// 判断是否重复物料 |
|
|
|
|
|
let isExist = false |
|
|
|
|
|
tableData.value.forEach(item => { |
|
|
|
|
|
let rs = tableData.value.filter(filterItem => (filterItem.itemCode == item.itemCode)) |
|
|
|
|
|
if(rs.length > 1) isExist = true |
|
|
|
|
|
}) |
|
|
|
|
|
if (isExist) { |
|
|
|
|
|
formRef.value.formLoading = false |
|
|
|
|
|
return message.warning('物料代码重复') |
|
|
|
|
|
} |
|
|
|
|
|
data.subList.forEach(obj => { |
|
|
|
|
|
if(obj.qty == 0){ |
|
|
|
|
|
message.error(`数量不能为0!`) |
|
|
|
|
|
flag.value = true |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
if(flag.value){ |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
var isHave =PurchaseClaimRequestMain.allSchemas.formSchema.some(function (item) { |
|
|
|
|
|
return item.field === 'beginTime' || item.field === 'endTime'; |
|
|
|
|
|
}); |
|
|
|
|
|
if(isHave){ |
|
|
|
|
|
if(data.beginTime && data.endTime && data.beginTime >=data.expireTime){ |
|
|
|
|
|
message.error('结束时间要大于开始时间') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
console.log(data.beginTime) |
|
|
|
|
|
if(!data.beginTime)data.beginTime = null; |
|
|
|
|
|
if(!data.planDate)data.planDate = null; |
|
|
|
|
|
if(!data.endTime)data.endTime = null; |
|
|
|
|
|
formRef.value.formLoading = true |
|
|
|
|
|
try { |
|
|
|
|
|
if (formType === 'create') { |
|
|
|
|
|
await PurchaseClaimRequestMainApi.createPurchaseClaimRequestMain(data) |
|
|
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
|
|
} else { |
|
|
|
|
|
await PurchaseClaimRequestMainApi.updatePurchaseClaimRequestMain(data) |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
} |
|
|
|
|
|
formRef.value.dialogVisible = false |
|
|
|
|
|
// 刷新当前列表 |
|
|
|
|
|
if (formType === 'create') { |
|
|
|
|
|
getList() |
|
|
|
|
|
}else{ |
|
|
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
|
|
} |
|
|
|
|
|
} finally { |
|
|
|
|
|
formRef.value.formLoading = false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** 导入 */ |
|
|
/** 导入 */ |
|
|
const importFormRef = ref() |
|
|
const importFormRef = ref() |
|
|
const handleImport = () => { |
|
|
const handleImport = () => { |
|
|
importFormRef.value.open() |
|
|
importFormRef.value.open() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 导入附件弹窗所需的参数 |
|
|
// 导入附件弹窗所需的参数 |
|
|
const importTemplateData = reactive({ |
|
|
const importTemplateData = reactive({ |
|
|
templateUrl: '', |
|
|
templateUrl: '', |
|
|
templateTitle: `【${route.meta.title}】导入模版.xlsx` |
|
|
templateTitle: `【${route.meta.title}】导入模版.xlsx` |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 导入成功之后 |
|
|
// 导入成功之后 |
|
|
const importSuccess = () => { |
|
|
const importSuccess = () => { |
|
|
getList() |
|
|
getList() |
|
@ -248,7 +403,6 @@ const searchFormClick = (searchData) => { |
|
|
/** 初始化 **/ |
|
|
/** 初始化 **/ |
|
|
onMounted(async () => { |
|
|
onMounted(async () => { |
|
|
getList() |
|
|
getList() |
|
|
importTemplateData.templateUrl = await InvoicingcalendarApi.importTemplate() |
|
|
importTemplateData.templateUrl = await PurchaseClaimRequestMainApi.importTemplate() |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|