Browse Source

采购离散订单查看功能

hella_online_20240924
yufei_wang 2 months ago
parent
commit
051354f904
  1. 2
      src/locales/en-US.ts
  2. 2
      src/locales/zh-CN.ts
  3. 455
      src/views/wms/supplierManage/purchaseDiscreteOrder/purchaseDiscreteOrderMain/index.vue
  4. 1864
      src/views/wms/supplierManage/purchaseDiscreteOrder/purchaseDiscreteOrderMain/purchaseDiscreteOrderMain.data.ts

2
src/locales/en-US.ts

@ -1148,6 +1148,8 @@ export default {
'确 认':'Confirm',
:'Please enter the reason for rejection',
:'View details',
:'unread',
:'read',
:'All read',
'申请发货数量不能大于 计划数量 - 已发货数量':'The requested quantity cannot be greater than the planned quantity - the quantity shipped',
:'Oversend is not allowed',

2
src/locales/zh-CN.ts

@ -1151,6 +1151,8 @@ export default {
'确 认':'确 认',
:'请输入拒收原因',
:'查看明细',
:'未读',
:'已读',
:'全部已读',
'申请发货数量不能大于 计划数量 - 已发货数量':'申请发货数量不能大于 计划数量 - 已发货数量',
:'不允许超发',

455
src/views/wms/supplierManage/purchaseDiscreteOrder/purchaseDiscreteOrderMain/index.vue

@ -0,0 +1,455 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="SupplierinvoiceRecordMain.allSchemas.searchSchema" @search="searchList" @reset="searchList" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="SupplierinvoiceRecordMain.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table ref="tableRef"
:selection="true"
v-clientTable
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
@getSelectionRows="getSelectionRows"
>
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, t('ts.单据号'), row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #differencePrice="{row}">
<span :class="{'red-text':row.differencePrice!=0}">{{ row.differencePrice }}</span>
</template>
<template #action="{ row,$index }">
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗发票回转 -->
<!--
:apiUpdate="BasicEamProductionlineApi.updateBasicEamProductionline"
:apiCreate="BasicEamProductionlineApi.createBasicEamProductionline"
@searchTableSuccess="searchTableSuccess" -->
<BasicForm
ref="basicFormRef"
@success="submitForm"
:rules="SupplierinvoiceRecordMainTransferRules"
:formAllSchemas="SupplierinvoiceRecordMainTransfer.allSchemas"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:annexTable="[{
label: t('ts.合同附件'),
prop: 'Annex',
tableName:'contract',
showDownload:true,
showPreview: true,
hiddenDelete:true,
hiddenUpload:true,
queryParams:[{
queryField:'tableId',
rowField:'annexMasterId',
}],
},{
label: t('ts.发票附件'),
prop: 'Annex',
tableName:'invoice',
showDownload:true,
showPreview: true,
hiddenDelete:true,
hiddenUpload:true,
queryParams:[{
queryField:'tableId',
rowField:'annexMasterId',
}],
},{
label: t('ts.货运单附件'),
prop: 'Annex',
tableName:'waybill',
showDownload:true,
hiddenDelete:true,
queryParams:[{
queryField:'tableId',
rowField:'annexMasterId',
}],
},{
label: t('ts.其他附件'),
prop: 'Annex',
tableName:'invoiceOther',
showDownload:true,
hiddenDelete:true,
queryParams:[{
queryField:'tableId',
rowField:'annexMasterId',
}],
}]"
:annexAlias="{
hidden:true,
label:t('ts.其他附件'),
showDownload:true,
hiddenDelete:true
}"
:otherHeadButttonData="[{
label: t('ts.打印明细'),
name: 'printing',
hide: false,
type: 'primary',
// icon: 'ep:operation',
color: '',
float:'left',
hasPermi: ''
},{
label: t('ts.导出明细'),
name: 'export-detail',
hide: false,
type: 'primary',
// icon: 'ep:operation',
color: '',
float:'left',
hasPermi: ''
}]"
:isBasic="false"
direction="horizontal"
:column="3"
:allSchemas="SupplierinvoiceRecordDetailMain.allSchemas"
:detailAllSchemas="SupplierinvoiceRecordDetail.allSchemas"
:detailAllSchemasRules="SupplierinvoiceRecordDetailRules"
:apiPage="SupplierinvoiceRecordDetailApi.getSupplierinvoiceRecordDeatilPage"
@buttonBaseClick="detailButtonBaseClick"
>
<!-- 价税合计尾差 -->
<template #Descriptions_totalTaxDiffAmount="{ row }">
<span>{{row['totalTaxDiffAmount']}}<span class="red-text"> (含返利合计:{{ row['rebateTotal'] }})</span></span>
</template>
<!-- 未税尾差 -->
<template #Descriptions_beforeTaxDiffAmount="{ row }">
<span>{{row['beforeTaxDiffAmount']}}<span class="red-text"> (含返利未税:{{ row['discountAmount1'] }})</span></span>
</template>
<!-- 税额尾差 -->
<template #Descriptions_taxAmountDiff="{ row }">
<span>{{row['taxAmountDiff']}}<span class="red-text"> (含返利税额:{{ row['rebateTax'] }})</span></span>
</template>
<template #differencePrice="{row}">
<span :class="{'red-text':row.differencePrice!=0}">{{ row.differencePrice }}</span>
</template>
</Detail>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { SupplierinvoiceRecordMain,SupplierinvoiceRecordDetail,SupplierinvoiceRecordDetailRules,SupplierinvoiceRecordDetailMain,SupplierinvoiceRecordMainTransfer,SupplierinvoiceRecordMainTransferRules } from './purchaseDiscreteOrderMain.data'
import * as SupplierinvoiceRecordMainApi from '@/api/wms/supplierinvoiceRecordMain'
import * as SupplierinvoiceRecordDetailApi from '@/api/wms/supplierinvoiceRecordDeatil'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import * as SupplierinvoiceRequestDetailApi from '@/api/wms/supplierinvoiceRequestDetail'
import * as PackageApi from "@/api/wms/package";
import {getAccessToken} from "@/utils/auth";
import {getJmreportBaseUrl} from "@/utils/systemParam";
import { formatDate } from '@/utils/formatTime'
import { usePageLoading } from '@/hooks/web/usePageLoading'
import dayjs from 'dayjs'
const { loadStart, loadDone } = usePageLoading()
//
defineOptions({ name: 'purchaseDiscreteOrderMain' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(SupplierinvoiceRecordMain.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: SupplierinvoiceRecordMainApi.getSupplierinvoiceRecordMainPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
// defaultButtons.defaultExportBtn({hasPermi:'wms:supplierinvoice-record-main:export'}), //
defaultButtons.mainLisSelectiontPointBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'export') { //
handleExport()
}else if (val=='selection_point'){//
handleSelectionPoint()
} 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 { //
console.log('其他按钮', item)
}
}
const BASE_URL = getJmreportBaseUrl()
const srcPoint = ref(BASE_URL + '/jmreport/view/970966724605804544?token=' + getAccessToken())
const handleSelectionPoint = async ()=>{
let rows:any = []
selectionRows.value.forEach(item=>{
rows = [...rows,...item.selectionRows.map(item1=>item1.id)]
})
if(rows.length==0){
message.warning('至少选择一条数据!')
return
}
console.log('批量打印',rows.join(','))
window.open(srcPoint.value+'&ids='+rows.join(','))
}
// -
const butttondata = (row,$index) => {
return [
{
label: t('ts.未读'),
name: 'unread',
type: 'primary',
icon: '',
color: '',
hasPermi: '',
link: true, //
},
{
label: t('ts.已读'),
name: 'read',
type: 'info',
icon: '',
color: '',
hasPermi: '',
link: true, //
},
{
label: t('ts.查看明细'),
name: 'open_detail',
type: 'primary',
icon: '',
color: '',
hasPermi: '',
link: true, //
}
]
}
/** 添加/修改操作 */
const basicFormRef = ref()
// -
const buttonTableClick = async (val, row) => {
if (val == 'open_detail') { //
openDetail(row, '单据号', row.number)
}else if(val == 'unread'){
//
}else if(val == 'read'){
//
}
}
//
const submitForm = async (formType, data) => {
data.reverseInvoiceJournal = 'APINVCOR'
data.adjustmentJournal = 'APADJ'
console.log('发票回转',formType, data)
loadStart()
try{
await SupplierinvoiceRecordMainApi.reverseSupplierinvoiceRecordMain(data)
message.success(t('ts.发票回转成功'))
basicFormRef.value.dialogVisible = false
buttonBaseClick('refresh', null)
} finally {
loadDone()
}
}
//
const { wsCache } = useCache()
/** 详情操作 */
const detailRef = ref()
const clicKRowId = ref();
const openDetail = async (row: any, titleName: any, titleValue: any) => {
console.log('openDetail',row)
clicKRowId.value = row.id
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name
//masterId
const { tableObject: requestTableObject, tableMethods:requestTableMethods } = useTable({
getListApi: SupplierinvoiceRequestDetailApi.getSupplierinvoiceRequestDetailPage //
})
const { getList:requestGetList } = requestTableMethods
requestTableObject.params.number = row.requestNumber
await requestGetList()
if(requestTableObject.tableList.length>0){
row.annexMasterId = requestTableObject.tableList[0].masterId
}
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode))
detailRef.value.openDetail(row, titleName, titleValue,"recordSupplierinvoiceMain")
}
const searchList = (model)=>{
if(model.postingDate&&model.postingDate.length>1){
model.postingDate[1] = model.postingDate[1].replace('00:00:00','23:59:59')
}
selectionRows.value = []
let model1 = {
...model,
statuss: model.status.join(',')?model.status.join(','):''
}
delete model1.status
setSearchParams(model1)
}
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 handleExport = async () => {
let rows:any = []
selectionRows.value.forEach(item=>{
rows = [...rows,...item.selectionRows.map(item1=>item1.number)]
})
if (!tableObject.params.createTime || tableObject.params.createTime && tableObject.params. createTime.length == 0) {
delete tableObject.params.createTime
}
try {
//
await message.exportConfirm()
//
loadStart()
const excelTitle = ref(route.meta.title)
const data = await SupplierinvoiceRecordMainApi.exportSupplierinvoiceRecordMain({...tableObject.params,checkNums:rows})
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch {
} finally {
loadDone()
}
}
const detailButtonBaseClick = (val, item) => {
console.log("点击的按钮",val)
if(val == 'printing'){
//
handleDocumentPrint(clicKRowId.value)
}else if(val === 'export-detail'){
console.log("导出明细:",clicKRowId.value)
handleDetailExport(clicKRowId.value)
}
}
//
const documentSrc = ref(BASE_URL + '/jmreport/view/972639553789239296?token=' + getAccessToken())
const handleDocumentPrint = async (id) => {
window.open(documentSrc.value + '&id=' + id)
}
/** 导出明细按钮操作 */
const exportLoadingDetail = ref(false) //
const handleDetailExport = async (masterId) => {
try {
//
await message.exportConfirm()
//
exportLoadingDetail.value = true
let params = {
masterId: masterId
}
const excelTitle = ref(route.meta.title)
const data = await SupplierinvoiceRecordMainApi.exportSupplierinvoiceRecordDetail(params)
download.excel(data, `${excelTitle.value}明细】【${formatDate(new Date())}】.xlsx`)
} catch {
} finally {
exportLoadingDetail.value = false
}
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
})
</script>
<style lang="scss" scoped>
.is-red{
border-radius:var(--el-border-radius-base);
border:1px solid var(--el-color-danger);
box-shadow: 0 0 0 1px var(--el-color-danger) inset;
}
.red-text{
color:var(--el-color-danger);
font-weight:700;
}
</style>

1864
src/views/wms/supplierManage/purchaseDiscreteOrder/purchaseDiscreteOrderMain/purchaseDiscreteOrderMain.data.ts

File diff suppressed because it is too large
Loading…
Cancel
Save