Browse Source

2312

master
lichong 7 months ago
parent
commit
c592ae0fb8
  1. 101
      src/renderer/src/App.vue

101
src/renderer/src/App.vue

@ -44,8 +44,8 @@
</el-row>
<el-row>
<el-col>
<el-table stripe :data="addTableData" show-tool border
style="width: 100%;height: calc(100vh - 72px);">
<el-table stripe :data="addTableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)"
show-tool border style="width: 100%;height: calc(100vh - 165px);">
<el-table-column type="index" width="80" />
<template v-for="(headerItem, heraderIndex) in addTableHeader">
<el-table-column :label="headerItem.label" show-overflow-tooltip v-if="!headerItem.hidden"
@ -70,6 +70,11 @@
</el-table-column>
</el-table>
</el-col>
<el-col>
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize"
:page-sizes="[10, 20, 50, 100]" layout="total, sizes, prev, pager, next, jumper"
:total="addTableData.length" style="justify-content: center;" />
</el-col>
</el-row>
</div>
</div>
@ -291,6 +296,8 @@ export default {
minData: {},
qishu: 1,
fileOriData: [],
currentPage: 1,
pageSize: 10,
}
},
watch: {
@ -369,9 +376,11 @@ export default {
let minDataLocal = {}
let maxingIndex = _.findIndex(this.addTableData, o => o.xiangmu === this.newItem.xiangmu)
if (maxingIndex - this.qishu < -1) {
ElMessage.error("数据不足,请先添加数据")
this.clickLeft("1")
return
ElMessage.error(`当前数据超出了最大期数${maxingIndex + 1},已自动调整为最大期数`)
this.addTableData[maxingIndex]["qishu"] = maxingIndex + 1
this.qishu = maxingIndex + 1
// this.clickLeft("1")
// return
}
if (val !== "all") {
this.allJifenData = this.dealOneJifen(val)
@ -449,7 +458,7 @@ export default {
let allData = _.cloneDeep(this.allDataObj[maxingItem.name])
let posArrList = []
for (let i = 0; i < qishu; i++) {
let item = addTableData[maxingIndex - i]
let item = _.get(addTableData, [maxingIndex - i], addTableData[0])
posArrList.push([item.pos1, item.pos2, item.pos3, item.pos4, item.pos5, item.pos6, item.pos7, item.pos8, item.pos9, item.pos10])
}
//
@ -662,47 +671,51 @@ export default {
fileReader.readAsArrayBuffer(file)
},
exportData() {
let lilstLocal = []
for (let i = 0; i < this.addTableData.length; i++) {
let newItem = this.addTableData[i];
let { alljifen, minData } = this.dealAllJifen(newItem, this.addTableData)
let count = 0
let minCount = 0
for (let key in alljifen) {
count += (alljifen[key] || 0)
}
for (let key in minData) {
minCount += (minData[key] || 0)
}
count -= (minCount * 10)
let nextItem = _.get(this.addTableData, [`${i + 1}`], {})
let nextCount = 0
if (!_.isEmpty(nextItem)) {
for (let i = 1; i < 11; i++) {
nextCount += alljifen[`pos${nextItem["pos" + i]}${i}`] || 0
let length = this.addTableData.length
ElMessage.success(`正在导出${length}条数据,请稍后`)
setTimeout(() => {
let lilstLocal = []
for (let i = 0; i < length; i++) {
let newItem = this.addTableData[i];
let { alljifen, minData } = this.dealAllJifen(newItem, this.addTableData)
let count = 0
let minCount = 0
for (let key in alljifen) {
count += (alljifen[key] || 0)
}
}
let xiangmuArr = []
for (let j = 1; j < 11; j++) {
xiangmuArr.push(newItem["pos" + j])
}
let xiangmuStr = _.join(xiangmuArr, ",")
lilstLocal.push({
"导入号码": `${xiangmuStr}`,
"期数": `${newItem.qishu}`,
"当期下注金额": `${count}`,
"比对下期号码中的金额": `${nextCount}`,
for (let key in minData) {
minCount += (minData[key] || 0)
}
count -= (minCount * 10)
let nextItem = _.get(this.addTableData, [`${i + 1}`], {})
let nextCount = 0
if (!_.isEmpty(nextItem)) {
for (let i = 1; i < 11; i++) {
nextCount += alljifen[`pos${nextItem["pos" + i]}${i}`] || 0
}
}
let xiangmuArr = []
for (let j = 1; j < 11; j++) {
xiangmuArr.push(newItem["pos" + j])
}
let xiangmuStr = _.join(xiangmuArr, ",")
lilstLocal.push({
"导入号码": `${xiangmuStr}`,
"期数": `${newItem.qishu}`,
"当期下注金额": `${count}`,
"比对下期号码中的金额": `${nextCount}`,
})
}
let jsonWorkSheet = xlsx.utils.json_to_sheet(lilstLocal);
let workBook = {
SheetNames: ["sheet1"],
Sheets: {
["sheet1"]: jsonWorkSheet,
})
}
};
xlsx.writeFile(workBook, `导出数据${dayjs().format("YYYY-MM-DD_HH-mm-ss")}.xlsx`);
let jsonWorkSheet = xlsx.utils.json_to_sheet(lilstLocal);
let workBook = {
SheetNames: ["sheet1"],
Sheets: {
["sheet1"]: jsonWorkSheet,
}
};
xlsx.writeFile(workBook, `导出数据${dayjs().format("YYYY-MM-DD_HH-mm-ss")}.xlsx`);
}, 1000)
},
clearData() {
this.addTableData = []

Loading…
Cancel
Save