TOC退货库存报表 TOB退货库存报表

This commit is contained in:
caorui 2024-09-23 16:06:58 +08:00
parent e115249752
commit a174e8363a
2 changed files with 1348 additions and 0 deletions

View File

@ -0,0 +1,673 @@
<template>
<div class="MachineSchedulingTable">
<!-- 搜索框-->
<div class="search">
<div class="datepickBox" style="">
<el-date-picker
v-model="queryCriteria.businessDate_start"
type="date"
placeholder="出库日期-开始"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
<div class="datepickBox" style="">
<el-date-picker
v-model="queryCriteria.businessDate_end"
type="date"
placeholder="交易采购-结束"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
<div class="datepickBox" style="">
<el-date-picker
v-model="queryCriteria.successfulTradeDate_start"
type="date"
placeholder="交易成功开始时间"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
<div class="datepickBox" style="">
<el-date-picker
v-model="queryCriteria.successfulTradeDate_end"
type="date"
placeholder="交易成功结束时间"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
<!-- TOB退货-库存-库存 -->
<div class="chunk">
<el-input v-model="queryCriteria.newPushDate" placeholder="TOB库存推送时间"></el-input>
</div>
<div class="chunk">
<el-input v-model="queryCriteria.newTransmitInfo" placeholder="TOB库存推送详情"></el-input>
</div>
<div class="radio">
<el-select v-model="queryCriteria.newState" placeholder="TOB出库同步成功">
<el-option
v-for="item in stateOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<div class="chunk">
<el-input v-model="queryCriteria.newSystemNumber" placeholder="TOB库存下游单号"></el-input>
</div>
<div class="chunk">
<el-input v-model="queryCriteria.newSystemPrimary" placeholder="TOB库存下游主键"></el-input>
</div>
<!-- TOB退货-库存 - 确认收入 -->
<div class="chunk">
<el-input v-model="queryCriteria.newPushDate2" placeholder="TOB确认收入推送时间"></el-input>
</div>
<div class="chunk">
<el-input v-model="queryCriteria.newTransmitInfo2" placeholder="TOB确认收入推送详情"></el-input>
</div>
<div class="radio">
<el-select v-model="queryCriteria.newState2" placeholder="TOB确认收入-红-交易成功">
<el-option
v-for="item in stateOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<div class="chunk">
<el-input v-model="queryCriteria.newSystemNumber2" placeholder="TOB确认收入下游单号"></el-input>
</div>
<div class="chunk">
<el-input v-model="queryCriteria.newSystemPrimary2" placeholder="TOB确认收入下游主键"></el-input>
</div>
</div>
<div>
<el-button
type="primary"
@click="query"
:loading="loading"
size="small"
style=" margin: 5px 5px"
>查询
</el-button>
<!-- <el-button-->
<!-- type="primary"-->
<!-- @click="downLoad"-->
<!-- :loading="loading"-->
<!-- size="small"-->
<!-- style=" margin: 5px 5px"-->
<!-- >excel导出-->
<!-- </el-button>-->
<el-button
type="warning"
@click="reset"
:loading="loading"
size="small"
style="margin: 5px 5px"
>重置
</el-button>
</div>
<!-- 主体内容-->
<div class="main">
<baseNewTable
:tableData="mainTableData"
:tableColumn="mainTableColumn"
:tableLoading="tableLoading"
:tableDataMergeList="tableDataMergeList"
:pageModel="pageModel"
@pageSizeChange="(val) => pageSizeChange(val, pageModel)"
@pageChange="(val) => pageChange(val, pageModel)"
exportEventName="ToB库存报表"
>
</baseNewTable>
</div>
</div>
</template>
<script>
import baseNewTable from './baseNewTable2/index.vue'
import { authApi, downFilesBasedFileNameFileTypeAPI } from '@/api/apis/auth'
import {
basePrintJS
} from '@/utils/util.js'
export default {
name: 'MachineSchedulingTable',
data() {
return {
stateOptions: [
{ label: '全部', value: 'all' },
{ label: '成功', value: 'Y' },
{ label: '失败', value: 'N' }
],
//
queryCriteria: {
businessType:"TOB_RETURN",
},
pageModel: {
'pageSize': 100,
'pageNum': 1,
pageTotal: 0
},
options:[
{
label:"TOB销售",
value:"TOB_ORDER"
},
{
label:"TOB退货-库存",
value:"TOC_ORDER"
},
],
//loading
loading: false,
//loading
tableLoading: false,
workshop: [],
//
queryCriteriaOption: [],
//
colorNumOption: [],
//
contractCodeOption: [],
//
workBenchIDOption: [],
//
cInvNameOption: [],
//
cInvCNameOption: [],
//
stateNameOption: [
{
label: '甲',
value: '甲'
},
{
label: '乙',
value: '乙'
},
{
label: '丙',
value: '丙'
}
],
//
fixedButtonList: [
{
icon: 'el-icon-printer',
title: '打印'
},
{
icon: 'el-icon-folder',
title: '导出'
}
],
//
mainTableData: [],
//
mainTableColumn: [
{
label: '入库明细主键',
prop: 'id',
tooltip: true,
width: 150
},
{
label: '来源单据主键',
prop: 'reforderdetailid',
tooltip: true,
width: 150
},
{
label: '货品sku',
prop: 'skucode',
tooltip: true,
width: 150
},
{
label: '货品名称',
prop: 'skuname',
tooltip: true,
width: 150
},
{
label: '实收数量',
prop: 'receivedqty',
tooltip: true,
width: 150
},
{
label: 'TOB销售-库存-报错详情',
prop: 'newtransmitinfo',
tooltip: true,
width: 200
},
{
label: 'TOB销售-库存-推送时间',
prop: 'newpushdate',
tooltip: true,
width: 200
},
{
label: 'TOB销售-库存-推送状态',
prop: 'newstate',
tooltip: true,
width: 200
},
{
label: 'TOB库存-下游单号',
prop: 'newsystemnumber',
tooltip: true,
width: 200
},
{
label: 'TOB库存-下游主键',
prop: 'newsystemprimary',
tooltip: true,
width: 150
},
{
label: 'TOB确认收入-报错详情',
prop: 'newtransmitinfo2',
tooltip: true,
width: 150
},
{
label: 'TOB销售-确认收入-推送时间',
prop: 'newpushdate2',
tooltip: true,
width: 150
},
{
label: 'TOB销售-确认收入红-推送状态',
prop: 'newstate2',
tooltip: true,
width: 150
},
{
label: 'TOB确认收入红-下游单号',
prop: 'newsystemnumber2',
tooltip: true,
width: 150
},
{
label: 'TOB确认收入红-下游主键',
prop: 'newsystemprimary2',
tooltip: true,
width: 150
},
{
label: '业务类型',
prop: 'businesstype',
tooltip: true,
width: 150
},
{
label: '货主编码',
prop: 'headCompanyCode',
tooltip: true,
width: 150
},
{
label: '仓库编码',
prop: 'headFacilityCode',
tooltip: true,
width: 150
},
{
label: '平台编码',
prop: 'headSourcePlatformCode',
tooltip: true,
width: 150
},
{
label: '店铺编码',
prop: 'headStoreCode',
tooltip: true,
width: 150
},
{
label: '售后入库主键',
prop: 'headCode',
tooltip: true,
width: 150
},
],
//
tableDataMergeList: [],
dist_state: {
Y: '成功',
N: '失败'
}
}
},
methods: {
async downLoad() {
if (this.queryCriteria.business_date_start && this.queryCriteria.business_date_end) {
let startDate = new Date(this.queryCriteria.business_date_start)
let endDate = new Date(this.queryCriteria.business_date_end)
let differenceInMillis = endDate - startDate
let differenceInDays = differenceInMillis / (1000 * 60 * 60 * 24)
// 15
if (!isNaN(differenceInDays) && differenceInDays < 31) {
} else {
this.$vmNews('开始时间和结束时间范围请选择在30天内')
return
}
} else {
this.$vmNews('请选择开始时间和结束时间')
return
}
let params = {
...this.queryCriteria,
...this.pageModel,
pageSize: 9999,
pageNum: 1
}
this.openLoading('detail')
const res = await authApi('busidataTocsalesServiceImpl', 'busidataTocsalesServiceImpl', 'queryToCSalesReportExcel', '', params)
if (res.status == 200) {
const response = await downFilesBasedFileNameFileTypeAPI(res.attribute)
// console.log(res)
const url = window.URL.createObjectURL(new Blob([response]), { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
const link = document.createElement('a')
link.href = url
link.setAttribute('download', 'toc正向流程报表.xlsx') //
document.body.appendChild(link)
link.click()
}
return
},
reset() {
this.pageModel.pageNum = 1
this.queryCriteria = {
businessType:"TOB_RETURN",
}
},
//limit
pageSizeChange(val, obj) {
obj.pageSize = val
this.init()
},
//
pageChange(val, obj) {
obj.page = val
this.init()
},
//
async remoteMethod(val, row, options) {
//
if (row == 'cusCode') {
const res = await GetCustomerListAPI(val)
this[options] = []
if (res.code == 1) {
res.data[1].forEach((item) => {
this[options].push({ label: item.cCusName, value: item.cCusCode })
})
}
} else if (row === 'workBenchID') {
//
if (this[options].length) return
const res = await WorkbenchGetBillListAPI({
page: 1,
limit: 999,
Sequence: '',
SequenceName: '',
CodeOrName: '',
areaID: '',
workShopID: ''
})
this[options] = []
if (res.code == 1) {
res.data[1].forEach((item) => {
this[options].push({
label: item.workName,
value: item.workID
})
})
}
} else if (row === 'cInvCode') {
const res = await U8BaseGetInvenListAPI({
page: 1,
limit: 200,
codeOrName: val
})
this[options] = []
if (res.code == 1) {
res.data[1].forEach((item) => {
this[options].push({ label: item.cInvName, value: item.cInvCode })
})
}
} else if (row === 'cInvCCode') {
const res = await U8BaseGetInvClassListAPI({
page: 1,
limit: 200,
codeOrName: val
})
this[options] = []
if (res.code == 1) {
res.data[1].forEach((item) => {
this[options].push({
label: item.cInvCName,
value: item.cInvCCode
})
})
}
}
},
//
query() {
this.pageModel.pageNum = 1
// if (this.queryCriteria.business_date_start && this.queryCriteria.business_date_end) {
// let startDate = new Date(this.queryCriteria.business_date_start)
// let endDate = new Date(this.queryCriteria.business_date_end)
// let differenceInMillis = endDate - startDate
// let differenceInDays = differenceInMillis / (1000 * 60 * 60 * 24)
// // 15
// if (!isNaN(differenceInDays) && differenceInDays < 11) {
// } else {
// this.$vmNews('10')
// return
// }
// } else {
// this.$vmNews('')
// return
// }
this.init()
},
/*
* 导出打印功能
* item:当前按钮信息
* boxId:打印表单id(仅导出
* name:导出后文件名仅导出
* tableData:传打印表格当前tableData仅打印
* tableColumn:传打印表格当前tableColumn仅打印
* */
fixedClick(item, boxId, name, tableData, tableColumn) {
if (item.title == '导出') {
this.exportEvent(name, boxId)
} else if (item.title == '打印') {
this.duplicate(tableData, tableColumn)
}
},
//
exportEvent(excelName, boxId) {
// console.log(document.querySelector(boxId), '123', boxId)
let gatherData = {
raw: true
}
let grid = XLSX.utils.table_to_book(
document.querySelector(boxId),
gatherData
)
let workbook = XLSX.write(grid, {
bookType: 'xlsx',
bookSST: true,
type: 'array'
})
try {
FileSaver.saveAs(
new Blob([workbook], {
type: 'application/octet-stream'
}),
excelName + '.xlsx'
)
} catch (e) {
if (typeof console !== 'undefined') console.log(e, workbook)
}
return workbook
},
//
duplicate(tableData, tableColumn) {
basePrintJS(tableData, tableColumn)
},
//
async init() {
this.tableLoading = true
let params = {
...this.queryCriteria,
...this.pageModel
}
//
const res = await authApi('tocofsSaleoutServiceImplReport', 'tocofsSaleoutServiceImplReport', 'queryToCReturnReport', '', params)
// console.log(res, 'res')
this.pageModel.pageTotal = res.attribute.total
res.attribute.list.forEach(item => {
item.newstate = this.dist_state[item.newstate]
item.newstate2 = this.dist_state[item.newstate2]
item.newstate3 = this.dist_state[item.newstate3]
})
this.mainTableData = this.dataDispose(
res.attribute.list,
this.tableDataMergeList
)
this.tableLoading = false
},
//data
dataDispose(data, arr) {
if (!arr.length) return data
//
let tempObj = {}
//
let result = []
// [[1],[1,2],[1,2,3]]
const transformedArray = arr.reduce((acc, currentValue) => {
acc.push([...(acc.length ? acc[acc.length - 1] : []), currentValue])
return acc
}, [])
//
//arr
let newArr = []
let sortObj = {}
data.forEach((item) => {
let keyValue = ''
arr.forEach((key2, index) => {
keyValue += item[key2]
})
if (!sortObj[keyValue]) {
sortObj[keyValue] = data.filter((item01) => {
return arr.every((prop) => item01[prop] === item[prop])
})
}
})
Object.keys(sortObj)
.sort()
.forEach((key) => {
newArr = [...newArr, ...sortObj[key]]
})
//
newArr.forEach((item) => {
transformedArray.forEach((key) => {
//keyValue:keyvaluetempObjkey
let keyValue = ''
key.forEach((keyItem, index) => {
keyValue += item[keyItem]
if (index < key.length - 1) {
keyValue += '|'
}
})
if (!tempObj[keyValue]) {
//key
tempObj[keyValue] = newArr.filter((item01) => {
return key.every((prop) => item01[prop] === item[prop])
})
//
tempObj[keyValue][0][`${key[key.length - 1]}Length`] =
tempObj[keyValue].length
if (key.length === 1) {
result = [...tempObj[keyValue], ...result]
}
}
})
})
return result
}
},
mounted() {
this.init();
},
components: {
baseNewTable
}
}
</script>
<style scoped lang="scss">
.MachineSchedulingTable {
padding: 15px;
border-radius: 20px;
background-color: #fff;
overflow: auto;
.div_title {
color: #696969;
background-color: #f1efef;
line-height: 35px;
height: 35px;
margin: 20px 0 10px;
text-align: center;
> span {
width: 23%;
display: inline-block;
margin-left: 15px;
}
}
> .search {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-start;
> div {
margin-left: 10px !important;
width: 200px !important;
margin-bottom: 10px;
}
}
> .main {
> .tableBox {
}
}
}
::v-deep .el-select {
width: 100% !important;
}
</style>

View File

@ -0,0 +1,675 @@
<template>
<div class="MachineSchedulingTable">
<!-- 搜索框-->
<div class="search">
<div class="datepickBox" style="">
<el-date-picker
v-model="queryCriteria.businessDate_start"
type="date"
placeholder="出库日期-开始"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
<div class="datepickBox" style="">
<el-date-picker
v-model="queryCriteria.businessDate_end"
type="date"
placeholder="交易采购-结束"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
<div class="datepickBox" style="">
<el-date-picker
v-model="queryCriteria.successfulTradeDate_start"
type="date"
placeholder="交易成功开始时间"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
<div class="datepickBox" style="">
<el-date-picker
v-model="queryCriteria.successfulTradeDate_end"
type="date"
placeholder="交易成功结束时间"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
<!-- TOC退货-库存 -->
<div class="chunk">
<el-input v-model="queryCriteria.newPushDate3" placeholder="TOC库存推送时间"></el-input>
</div>
<div class="chunk">
<el-input v-model="queryCriteria.newTransmitInfo3" placeholder="TOC库存推送详情"></el-input>
</div>
<div class="radio">
<el-select v-model="queryCriteria.newState3" placeholder="TOC出库同步成功">
<el-option
v-for="item in stateOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<div class="chunk">
<el-input v-model="queryCriteria.newSystemNumber3" placeholder="TOC库存下游单号"></el-input>
</div>
<div class="chunk">
<el-input v-model="queryCriteria.newSystemPrimary3" placeholder="TOC库存下游主键"></el-input>
</div>
<!-- TOC退货 - 确认收入 -->
<div class="chunk">
<el-input v-model="queryCriteria.newPushDate4" placeholder="TOC确认收入推送时间"></el-input>
</div>
<div class="chunk">
<el-input v-model="queryCriteria.newTransmitInfo4" placeholder="TOC确认收入推送详情"></el-input>
</div>
<div class="radio">
<el-select v-model="queryCriteria.newState4" placeholder="TOC确认收入-红-交易成功">
<el-option
v-for="item in stateOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<div class="chunk">
<el-input v-model="queryCriteria.newSystemNumber4" placeholder="TOC确认收入下游单号"></el-input>
</div>
<div class="chunk">
<el-input v-model="queryCriteria.newSystemPrimary4" placeholder="TOC确认收入下游主键"></el-input>
</div>
</div>
<div>
<el-button
type="primary"
@click="query"
:loading="loading"
size="small"
style=" margin: 5px 5px"
>查询
</el-button>
<!-- <el-button-->
<!-- type="primary"-->
<!-- @click="downLoad"-->
<!-- :loading="loading"-->
<!-- size="small"-->
<!-- style=" margin: 5px 5px"-->
<!-- >excel导出-->
<!-- </el-button>-->
<el-button
type="warning"
@click="reset"
:loading="loading"
size="small"
style="margin: 5px 5px"
>重置
</el-button>
</div>
<!-- 主体内容-->
<div class="main">
<baseNewTable
:tableData="mainTableData"
:tableColumn="mainTableColumn"
:tableLoading="tableLoading"
:tableDataMergeList="tableDataMergeList"
:pageModel="pageModel"
@pageSizeChange="(val) => pageSizeChange(val, pageModel)"
@pageChange="(val) => pageChange(val, pageModel)"
exportEventName="ToC确认收入报表"
>
</baseNewTable>
</div>
</div>
</template>
<script>
import baseNewTable from './baseNewTable2/index.vue'
import { authApi, downFilesBasedFileNameFileTypeAPI } from '@/api/apis/auth'
import {
basePrintJS
} from '@/utils/util.js'
export default {
name: 'MachineSchedulingTable',
data() {
return {
stateOptions: [
{ label: '全部', value: 'all' },
{ label: '成功', value: 'Y' },
{ label: '失败', value: 'N' }
],
//
queryCriteria: {
businessType:"TOC_RETURN",
},
pageModel: {
'pageSize': 100,
'pageNum': 1,
pageTotal: 0
},
options:[
{
label:"TOB销售",
value:"TOB_ORDER"
},
{
label:"TOC退货-库存",
value:"TOC_ORDER"
},
],
//loading
loading: false,
//loading
tableLoading: false,
workshop: [],
//
queryCriteriaOption: [],
//
colorNumOption: [],
//
contractCodeOption: [],
//
workBenchIDOption: [],
//
cInvNameOption: [],
//
cInvCNameOption: [],
//
stateNameOption: [
{
label: '甲',
value: '甲'
},
{
label: '乙',
value: '乙'
},
{
label: '丙',
value: '丙'
}
],
//
fixedButtonList: [
{
icon: 'el-icon-printer',
title: '打印'
},
{
icon: 'el-icon-folder',
title: '导出'
}
],
//
mainTableData: [],
//
mainTableColumn: [
{
label: '入库明细主键',
prop: 'id',
tooltip: true,
width: 150
},
{
label: '来源单据主键',
prop: 'reforderdetailid',
tooltip: true,
width: 150
},
{
label: '货品sku',
prop: 'skucode',
tooltip: true,
width: 150
},
{
label: '货品名称',
prop: 'skuname',
tooltip: true,
width: 150
},
{
label: '实收数量',
prop: 'receivedqty',
tooltip: true,
width: 150
},
{
label: 'TOB销售-库存-报错详情',
prop: 'newtransmitinfo',
tooltip: true,
width: 200
},
{
label: 'TOB销售-库存-推送时间',
prop: 'newpushdate',
tooltip: true,
width: 200
},
{
label: 'TOB销售-库存-推送状态',
prop: 'newstate',
tooltip: true,
width: 200
},
{
label: 'TOB库存-下游单号',
prop: 'newsystemnumber',
tooltip: true,
width: 200
},
{
label: 'TOB库存-下游主键',
prop: 'newsystemprimary',
tooltip: true,
width: 150
},
{
label: 'TOB确认收入-报错详情',
prop: 'newtransmitinfo2',
tooltip: true,
width: 150
},
{
label: 'TOB销售-确认收入-推送时间',
prop: 'newpushdate2',
tooltip: true,
width: 150
},
{
label: 'TOB销售-确认收入红-推送状态',
prop: 'newstate2',
tooltip: true,
width: 150
},
{
label: 'TOB确认收入红-下游单号',
prop: 'newsystemnumber2',
tooltip: true,
width: 150
},
{
label: 'TOB确认收入红-下游主键',
prop: 'newsystemprimary2',
tooltip: true,
width: 150
},
{
label: '业务类型',
prop: 'businesstype',
tooltip: true,
width: 150
},
{
label: '货主编码',
prop: 'headCompanyCode',
tooltip: true,
width: 150
},
{
label: '仓库编码',
prop: 'headFacilityCode',
tooltip: true,
width: 150
},
{
label: '平台编码',
prop: 'headSourcePlatformCode',
tooltip: true,
width: 150
},
{
label: '店铺编码',
prop: 'headStoreCode',
tooltip: true,
width: 150
},
{
label: '售后入库主键',
prop: 'headCode',
tooltip: true,
width: 150
},
],
//
tableDataMergeList: [],
dist_state: {
Y: '成功',
N: '失败'
}
}
},
methods: {
async downLoad() {
if (this.queryCriteria.business_date_start && this.queryCriteria.business_date_end) {
let startDate = new Date(this.queryCriteria.business_date_start)
let endDate = new Date(this.queryCriteria.business_date_end)
let differenceInMillis = endDate - startDate
let differenceInDays = differenceInMillis / (1000 * 60 * 60 * 24)
// 15
if (!isNaN(differenceInDays) && differenceInDays < 31) {
} else {
this.$vmNews('开始时间和结束时间范围请选择在30天内')
return
}
} else {
this.$vmNews('请选择开始时间和结束时间')
return
}
let params = {
...this.queryCriteria,
...this.pageModel,
pageSize: 9999,
pageNum: 1
}
this.openLoading('detail')
const res = await authApi('busidataTocsalesServiceImpl', 'busidataTocsalesServiceImpl', 'queryToCSalesReportExcel', '', params)
if (res.status == 200) {
const response = await downFilesBasedFileNameFileTypeAPI(res.attribute)
// console.log(res)
const url = window.URL.createObjectURL(new Blob([response]), { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
const link = document.createElement('a')
link.href = url
link.setAttribute('download', 'toc正向流程报表.xlsx') //
document.body.appendChild(link)
link.click()
}
return
},
reset() {
this.pageModel.pageNum = 1
this.queryCriteria = {
businessType:"TOC_RETURN",
}
},
//limit
pageSizeChange(val, obj) {
obj.pageSize = val
this.init()
},
//
pageChange(val, obj) {
obj.page = val
this.init()
},
//
async remoteMethod(val, row, options) {
//
if (row == 'cusCode') {
const res = await GetCustomerListAPI(val)
this[options] = []
if (res.code == 1) {
res.data[1].forEach((item) => {
this[options].push({ label: item.cCusName, value: item.cCusCode })
})
}
} else if (row === 'workBenchID') {
//
if (this[options].length) return
const res = await WorkbenchGetBillListAPI({
page: 1,
limit: 999,
Sequence: '',
SequenceName: '',
CodeOrName: '',
areaID: '',
workShopID: ''
})
this[options] = []
if (res.code == 1) {
res.data[1].forEach((item) => {
this[options].push({
label: item.workName,
value: item.workID
})
})
}
} else if (row === 'cInvCode') {
const res = await U8BaseGetInvenListAPI({
page: 1,
limit: 200,
codeOrName: val
})
this[options] = []
if (res.code == 1) {
res.data[1].forEach((item) => {
this[options].push({ label: item.cInvName, value: item.cInvCode })
})
}
} else if (row === 'cInvCCode') {
const res = await U8BaseGetInvClassListAPI({
page: 1,
limit: 200,
codeOrName: val
})
this[options] = []
if (res.code == 1) {
res.data[1].forEach((item) => {
this[options].push({
label: item.cInvCName,
value: item.cInvCCode
})
})
}
}
},
//
query() {
this.pageModel.pageNum = 1
// if (this.queryCriteria.business_date_start && this.queryCriteria.business_date_end) {
// let startDate = new Date(this.queryCriteria.business_date_start)
// let endDate = new Date(this.queryCriteria.business_date_end)
// let differenceInMillis = endDate - startDate
// let differenceInDays = differenceInMillis / (1000 * 60 * 60 * 24)
// // 15
// if (!isNaN(differenceInDays) && differenceInDays < 11) {
// } else {
// this.$vmNews('10')
// return
// }
// } else {
// this.$vmNews('')
// return
// }
this.init()
},
/*
* 导出打印功能
* item:当前按钮信息
* boxId:打印表单id(仅导出
* name:导出后文件名仅导出
* tableData:传打印表格当前tableData仅打印
* tableColumn:传打印表格当前tableColumn仅打印
* */
fixedClick(item, boxId, name, tableData, tableColumn) {
if (item.title == '导出') {
this.exportEvent(name, boxId)
} else if (item.title == '打印') {
this.duplicate(tableData, tableColumn)
}
},
//
exportEvent(excelName, boxId) {
// console.log(document.querySelector(boxId), '123', boxId)
let gatherData = {
raw: true
}
let grid = XLSX.utils.table_to_book(
document.querySelector(boxId),
gatherData
)
let workbook = XLSX.write(grid, {
bookType: 'xlsx',
bookSST: true,
type: 'array'
})
try {
FileSaver.saveAs(
new Blob([workbook], {
type: 'application/octet-stream'
}),
excelName + '.xlsx'
)
} catch (e) {
if (typeof console !== 'undefined') console.log(e, workbook)
}
return workbook
},
//
duplicate(tableData, tableColumn) {
basePrintJS(tableData, tableColumn)
},
//
async init() {
this.tableLoading = true
setTimeout(()=>{
this.tableLoading = false
},10000)
let params = {
...this.queryCriteria,
...this.pageModel
}
//
const res = await authApi('tocofsSaleoutServiceImplReport', 'tocofsSaleoutServiceImplReport', 'queryToCReturnReport', '', params)
this.pageModel.pageTotal = res.attribute.total
res.attribute.list.forEach(item => {
item.newstate = this.dist_state[item.newstate]
item.newstate2 = this.dist_state[item.newstate2]
item.newstate3 = this.dist_state[item.newstate3]
})
this.mainTableData = this.dataDispose(
res.attribute.list,
this.tableDataMergeList
)
this.tableLoading = false
},
//data
dataDispose(data, arr) {
if (!arr.length) return data
//
let tempObj = {}
//
let result = []
// [[1],[1,2],[1,2,3]]
const transformedArray = arr.reduce((acc, currentValue) => {
acc.push([...(acc.length ? acc[acc.length - 1] : []), currentValue])
return acc
}, [])
//
//arr
let newArr = []
let sortObj = {}
data.forEach((item) => {
let keyValue = ''
arr.forEach((key2, index) => {
keyValue += item[key2]
})
if (!sortObj[keyValue]) {
sortObj[keyValue] = data.filter((item01) => {
return arr.every((prop) => item01[prop] === item[prop])
})
}
})
Object.keys(sortObj)
.sort()
.forEach((key) => {
newArr = [...newArr, ...sortObj[key]]
})
//
newArr.forEach((item) => {
transformedArray.forEach((key) => {
//keyValue:keyvaluetempObjkey
let keyValue = ''
key.forEach((keyItem, index) => {
keyValue += item[keyItem]
if (index < key.length - 1) {
keyValue += '|'
}
})
if (!tempObj[keyValue]) {
//key
tempObj[keyValue] = newArr.filter((item01) => {
return key.every((prop) => item01[prop] === item[prop])
})
//
tempObj[keyValue][0][`${key[key.length - 1]}Length`] =
tempObj[keyValue].length
if (key.length === 1) {
result = [...tempObj[keyValue], ...result]
}
}
})
})
return result
}
},
mounted() {
this.init();
},
components: {
baseNewTable
}
}
</script>
<style scoped lang="scss">
.MachineSchedulingTable {
padding: 15px;
border-radius: 20px;
background-color: #fff;
overflow: auto;
.div_title {
color: #696969;
background-color: #f1efef;
line-height: 35px;
height: 35px;
margin: 20px 0 10px;
text-align: center;
> span {
width: 23%;
display: inline-block;
margin-left: 15px;
}
}
> .search {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-start;
> div {
margin-left: 10px !important;
width: 200px !important;
margin-bottom: 10px;
}
}
> .main {
> .tableBox {
}
}
}
::v-deep .el-select {
width: 100% !important;
}
</style>