Browse Source

1232

master
lichong 7 months ago
parent
commit
0e4399c81d
  1. 2
      src/main/index.js
  2. 124
      src/renderer/src/App.vue

2
src/main/index.js

@ -10,7 +10,7 @@ let mainWindow
function createWindow() {
mainWindow = new BrowserWindow({
minWidth: 1366,
minHeight: 684,
minHeight: 734,
show: false,
autoHideMenuBar: true,
icon: logoIcon,

124
src/renderer/src/App.vue

@ -33,10 +33,12 @@
</el-row>
<el-row>
<el-col>
<el-table stripe :data="addTableData" border style="width: 100%;height: calc(100vh - 72px);">
<el-table stripe :data="addTableData" show-tool border
style="width: 100%;height: calc(100vh - 72px);">
<el-table-column type="index" width="80" />
<template v-for="(headerItem, heraderIndex) in addTableHeader">
<el-table-column :label="headerItem.label" v-if="!headerItem.hidden" :key="heraderIndex">
<el-table-column :label="headerItem.label" show-overflow-tooltip v-if="!headerItem.hidden"
:key="heraderIndex">
<template #default="scope">
<div>
<span :style="`color:${scope.row[headerItem.prop + '_check'] ? 'red' : '#000'}`">{{
@ -62,9 +64,10 @@
</div>
<div v-show="type === '2'">
<div style="padding: 8px;">
<el-row style="position: absolute;right: 192px;top: 7px;z-index: 1;">
<el-row style="position: absolute;right: 400px;top: 7px;z-index: 1;">
<el-col>
<span>项目</span><span>
<span>项目</span>
<span>
<el-select v-model="newItem.xiangmu" placeholder="请选择项目" size="large" style="width: 240px"
@change="changejifen">
<el-option v-for="(item, index) in addTableData" :key="index" :label="item.xiangmu"
@ -73,6 +76,21 @@
</span>
</el-col>
</el-row>
<el-row style="position: absolute;right: 160px;top: 7px;z-index: 1;">
<el-col>
<span>期数</span>
<span>
<el-input-number v-model="qishu" :min="1" :max="addTableData.length || 1" />
</span>
</el-col>
</el-row>
<el-row style="position: absolute;right: 40px;top: 7px;z-index: 1;">
<el-col>
<span>
<el-button type="primary" round @click="jisuanjifen" :disabled="_.isEmpty(newItem)">计算积分</el-button>
</span>
</el-col>
</el-row>
<div v-if="!_.isEmpty(newItem)">
<el-row>
<el-col>
@ -112,6 +130,16 @@
</el-col>
<el-col :span="2" class="alignCenter"></el-col>
</el-row>
<el-row :gutter="20" justify="center" style="padding: 18px 0px 0px 0px;">
<el-col :span="12" class="alignCenter">
<span>当期下注金额:</span>
<span style="color: #ff0000;">{{ alljifenCount }}</span>
</el-col>
<el-col :span="12" class="alignCenter">
<span>比对下期数据中的金额:</span>
<span style="color: #ff0000;">{{ nextCount }}</span>
</el-col>
</el-row>
</div>
</div>
</div>
@ -181,7 +209,7 @@ export default {
_: _,
allDataObj: allDataObj,
dayjs: dayjs,
isVip: false,
isVip: true,
type: "1",
addTableData: [],
addTableHeader: [
@ -239,7 +267,7 @@ export default {
show: false,
title: "",
xiangmu: "",
maxing: [],
maxing: [2, 3, 4, 5, 6, 7, 8],
type: 1,
posInput: "",
},
@ -249,6 +277,7 @@ export default {
valueTag: "all",
allJifenData: {},
minData: {},
qishu: 1,
}
},
watch: {
@ -261,9 +290,28 @@ export default {
deep: true
}
},
computed: {},
computed: {
alljifenCount() {
let count = 0
for (let key in this.allJifenData) {
count += this.allJifenData[key] || 0
}
return count
},
nextCount() {
let count = 0
let maxingIndex = _.findIndex(this.addTableData, o => o.xiangmu === this.newItem.xiangmu)
let arrObj = _.get(this.addTableData, [maxingIndex + 1], {})
for (let i = 1; i < 11; i++) {
let ele = arrObj[`pos${i}`];
count += this.allJifenData[`pos${ele}${i}`] || 0
}
return count
},
},
async mounted() {
let fiveDay = dayjs('2024-08-30T00:00:00').valueOf()
let fiveDay = dayjs('2024-09-15T00:00:00').valueOf()
if (!this.isVip) {
if (dayjs().valueOf() > fiveDay) {
this.isVip = false
@ -272,7 +320,13 @@ export default {
this.isVip = true
}
}
this.addTableData = localStorage.getItem('addTableData') ? JSON.parse(localStorage.getItem('addTableData')) : [];
let addTableDataLocal = localStorage.getItem('addTableData') ? JSON.parse(localStorage.getItem('addTableData')) : [];
let addTableDataCopy = []
for (let i = 0; i < addTableDataLocal.length; i++) {
let ele = addTableDataLocal[i];
addTableDataCopy.push({ ...ele, qishu: ele.qishu || 1 })
}
this.addTableData = addTableDataCopy
},
methods: {
clickLeft(type) {
@ -280,6 +334,11 @@ export default {
if (type === "1") {
this.newItem = {}
this.valueTag = "all"
} else if (type === "2") {
if (!(this.addTableData.length)) {
ElMessage.error("请先添加数据")
this.clickLeft("1")
}
}
},
handleDelete(index) {
@ -287,6 +346,7 @@ export default {
},
viewData(row) {
this.clickLeft("2")
this.qishu = row.qishu || 1
this.newItem = { ...row }
},
handleClick(pane) {
@ -294,6 +354,12 @@ export default {
},
dealjifen(val) {
let minDataLocal = {}
let maxingIndex = _.findIndex(this.addTableData, o => o.xiangmu === this.newItem.xiangmu)
if (maxingIndex - this.qishu < -1) {
ElMessage.error("数据不足,请先添加数据")
this.clickLeft("1")
return
}
if (val !== "all") {
this.allJifenData = this.dealOneJifen(val)
} else {
@ -330,10 +396,17 @@ export default {
}
},
dealOneJifen(val) {
let qishu = this.qishu
let jifenData = {}
let maxingItem = _.find(this.allDataObj.maxing, o => o.value === Number(val))
let maxingIndex = _.findIndex(this.addTableData, o => o.xiangmu === this.newItem.xiangmu)
let allData = _.cloneDeep(this.allDataObj[maxingItem.name])
let posArrList = []
let posData = [this.newItem.pos1, this.newItem.pos2, this.newItem.pos3, this.newItem.pos4, this.newItem.pos5, this.newItem.pos6, this.newItem.pos7, this.newItem.pos8, this.newItem.pos9, this.newItem.pos10]
for (let i = 0; i < qishu; i++) {
let item = this.addTableData[maxingIndex - i]
posArrList.push([item.pos1, item.pos2, item.pos3, item.pos4, item.pos5, item.pos6, item.pos7, item.pos8, item.pos9, item.pos10])
}
//
for (let i = 1; i < 11; i++) {
for (let j = 1; j < 11; j++) {
@ -344,12 +417,19 @@ export default {
for (let i = 0; i < allData.length; i++) {
let item = _.compact(_.split(allData[i], ","))
let moshi1Arr = []
for (let j = 0; j < item.length; j++) {
moshi1Arr.push(posData[Number(item[j]) - 1])
// moshi1Arr.push(posData[Number(item[j]) - 1])
for (let j = 0; j < posArrList.length; j++) {
let ele = posArrList[j];
let itemArr = []
for (let k = 0; k < item.length; k++) {
itemArr.push(ele[Number(item[k]) - 1])
}
moshi1Arr.push(itemArr)
}
let some = _.uniq(_.flatten(moshi1Arr));
for (let j = 0; j < item.length; j++) {
for (let k = 1; k < 11; k++) {
if (moshi1Arr.indexOf(`${k}`) === -1) {
if (some.indexOf(`${k}`) === -1) {
jifenData[`pos${k}${item[j]}`]++
}
}
@ -358,20 +438,29 @@ export default {
// ()
for (let i = 0; i < allData.length; i++) {
let item = _.compact(_.split(allData[i], ","))
let moshi1Arr = []
for (let j = 0; j < item.length; j++) {
moshi1Arr.push(posData[Number(item[j]) - 1])
let moshi2Arr = []
for (let j = 0; j < posArrList.length; j++) {
let ele = posArrList[j];
let itemArr = []
for (let k = 0; k < item.length; k++) {
itemArr.push(ele[Number(item[k]) - 1])
}
moshi2Arr.push(itemArr)
}
for (let j = 0; j < moshi1Arr.length; j++) {
let same = _.intersection(...moshi2Arr);
for (let j = 0; j < same.length; j++) {
for (let k = 1; k < 11; k++) {
if (item.indexOf(`${k}`) === -1) {
jifenData[`pos${moshi1Arr[j]}${k}`]++
jifenData[`pos${same[j]}${k}`]++
}
}
}
}
return jifenData
},
jisuanjifen() {
this.dealjifen(this.valueTag)
},
changejifen(val) {
this.newItem = { ..._.cloneDeep(_.filter(this.addTableData, (item) => item.xiangmu === val)[0]) }
},
@ -407,6 +496,7 @@ export default {
this.addTableData.push({
xiangmu: _.trim(this.dialogFormData.xiangmu),
maxing: _.sortBy(this.dialogFormData.maxing),
qishu: 1,
...posValueObj
})
this.closeDialog()

Loading…
Cancel
Save