|
|
@ -22,8 +22,8 @@ |
|
|
|
<el-col :span="22"> |
|
|
|
<div class="right"> |
|
|
|
<div v-show="type === '1'"> |
|
|
|
<div style="padding: 8px;"> |
|
|
|
<el-row style="padding: 8px;"> |
|
|
|
<div> |
|
|
|
<el-row> |
|
|
|
<el-col :span="22"> |
|
|
|
<el-button type="primary" @click="addNewData">新增项目号码</el-button> |
|
|
|
</el-col> |
|
|
@ -61,8 +61,8 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-show="type === '2'"> |
|
|
|
<div> |
|
|
|
<el-row style="padding: 8px;"> |
|
|
|
<div style="padding: 8px;"> |
|
|
|
<el-row style="position: absolute;right: 192px;top: 7px;z-index: 1;"> |
|
|
|
<el-col> |
|
|
|
<span>项目:</span><span> |
|
|
|
<el-select v-model="newItem.xiangmu" placeholder="请选择项目" size="large" style="width: 240px" |
|
|
@ -74,7 +74,7 @@ |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<div v-if="!_.isEmpty(newItem)"> |
|
|
|
<el-row style="padding: 8px;"> |
|
|
|
<el-row> |
|
|
|
<el-col> |
|
|
|
<el-tabs v-model="valueTag" @tab-click="handleClick"> |
|
|
|
<el-tab-pane label="所有码型" name="all"> |
|
|
@ -85,25 +85,30 @@ |
|
|
|
</el-tabs> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row style="padding: 8px;" :gutter="20" justify="center"> |
|
|
|
<el-row :gutter="20" justify="center"> |
|
|
|
<el-col :span="2" class="alignCenter"></el-col> |
|
|
|
<el-col :span="2" v-for="(item1, index1) in 10" :key="index1 + 'col'" class="alignCenter"> |
|
|
|
<span>第{{ item1 }}列</span> |
|
|
|
</el-col> |
|
|
|
<el-col :span="2" class="alignCenter"></el-col> |
|
|
|
</el-row> |
|
|
|
<el-row v-for="(item, index) in 10" style="padding: 8px;" :gutter="20" justify="center" |
|
|
|
:key="index + 'row'"> |
|
|
|
<el-row v-for="(item, index) in 10" :gutter="20" justify="center" :key="index + 'row'" |
|
|
|
style="padding: 4px 0px;"> |
|
|
|
<el-col :span="2" class="alignCenter">第{{ item }}行</el-col> |
|
|
|
<el-col :span="2" v-for="(item1, index1) in 10" :key="index1 + 'col'" class="alignCenter"> |
|
|
|
<span>{{ (allJifenData[`pos${item}${item1}`] - minData[`pos${item1}`]) || 0 }}</span> |
|
|
|
<div style="color: #999;"> |
|
|
|
{{ item }} |
|
|
|
</div> |
|
|
|
<div style="color: #ff0000;"> |
|
|
|
{{ (allJifenData[`pos${item}${item1}`] - minData[`pos${item1}`]) || 0 }} |
|
|
|
</div> |
|
|
|
</el-col> |
|
|
|
<el-col :span="2" class="alignCenter"></el-col> |
|
|
|
</el-row> |
|
|
|
<el-row style="padding: 8px;" :gutter="20" justify="center"> |
|
|
|
<el-row :gutter="20" justify="center"> |
|
|
|
<el-col :span="2" class="alignCenter">最小值</el-col> |
|
|
|
<el-col :span="2" v-for="(item1, index1) in 10" :key="index1 + 'col'" class="alignCenter"> |
|
|
|
<span>{{ minData[`pos${item1}`] }}</span> |
|
|
|
<span>{{ minData[`pos${item1}`] ? -minData[`pos${item1}`] : "0" }}</span> |
|
|
|
</el-col> |
|
|
|
<el-col :span="2" class="alignCenter"></el-col> |
|
|
|
</el-row> |
|
|
@ -258,7 +263,7 @@ export default { |
|
|
|
}, |
|
|
|
computed: {}, |
|
|
|
async mounted() { |
|
|
|
let fiveDay = dayjs('2024-08-29T00:00:00').valueOf() |
|
|
|
let fiveDay = dayjs('2024-08-30T00:00:00').valueOf() |
|
|
|
if (!this.isVip) { |
|
|
|
if (dayjs().valueOf() > fiveDay) { |
|
|
|
this.isVip = false |
|
|
@ -267,7 +272,6 @@ export default { |
|
|
|
this.isVip = true |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(666, _.groupBy(allDataObj.b.all, "pos")) |
|
|
|
this.addTableData = localStorage.getItem('addTableData') ? JSON.parse(localStorage.getItem('addTableData')) : []; |
|
|
|
}, |
|
|
|
methods: { |
|
|
@ -275,6 +279,7 @@ export default { |
|
|
|
this.type = type |
|
|
|
if (type === "1") { |
|
|
|
this.newItem = {} |
|
|
|
this.valueTag = "all" |
|
|
|
} |
|
|
|
}, |
|
|
|
handleDelete(index) { |
|
|
@ -293,6 +298,7 @@ export default { |
|
|
|
this.allJifenData = this.dealOneJifen(val) |
|
|
|
} else { |
|
|
|
let alljifen = {} |
|
|
|
// 先行后列 |
|
|
|
for (let i = 1; i < 11; i++) { |
|
|
|
for (let j = 1; j < 11; j++) { |
|
|
|
alljifen[`pos${i}${j}`] = 0 |
|
|
@ -322,84 +328,39 @@ export default { |
|
|
|
let minItem = _.min(minDataLocal[key]) |
|
|
|
this.minData[`${key}`] = minItem |
|
|
|
} |
|
|
|
console.log(74411, minDataLocal) |
|
|
|
}, |
|
|
|
dealOneJifen(val) { |
|
|
|
let jifenData = {} |
|
|
|
let maxingItem = _.find(this.allDataObj.maxing, o => o.value === (Number(val) - 1)) |
|
|
|
let allData = { ...this.allDataObj[maxingItem.name].all } |
|
|
|
let posGroup = _.groupBy(_.cloneDeep(allData), o => o.pos) |
|
|
|
let jishu = parseInt(posGroup.p1n.length / 10) |
|
|
|
//共有10列数据先循环列 |
|
|
|
let maxingItem = _.find(this.allDataObj.maxing, o => o.value === Number(val)) |
|
|
|
let allData = _.cloneDeep(this.allDataObj[maxingItem.name]) |
|
|
|
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 = 1; i < 11; i++) { |
|
|
|
let colObj = { |
|
|
|
[`p${i}w`]: _.cloneDeep(posGroup[`p${i}w`]), |
|
|
|
[`p${i}n`]: _.cloneDeep(posGroup[`p${i}n`]) |
|
|
|
for (let j = 1; j < 11; j++) { |
|
|
|
jifenData[`pos${i}${j}`] = 0 |
|
|
|
} |
|
|
|
// 每列有10行数据后循环行 |
|
|
|
for (let j = 0; j < 10; j++) { |
|
|
|
// 最后多出来的数据放到最后一行 |
|
|
|
if (j === 9) { |
|
|
|
for (let k = jishu * j; k < posGroup.p1n.length; k++) { |
|
|
|
let itemwData = colObj[`p${i}n`][k].data |
|
|
|
let itemnData = colObj[`p${i}n`][k].data |
|
|
|
for (let l = 0; l < itemwData.length; l++) { |
|
|
|
let itemW = itemwData[l] |
|
|
|
let itemn = itemnData[l] |
|
|
|
if (Number(itemW) === Number(this.newItem[`pos${itemW}`])) { |
|
|
|
if (jifenData.hasOwnProperty(`pos${itemW}${i}`)) { |
|
|
|
jifenData[`pos${itemW}${i}`]++ |
|
|
|
} else { |
|
|
|
jifenData[`pos${itemW}${i}`] = 1 |
|
|
|
} |
|
|
|
} |
|
|
|
if (Number(itemn) === Number(this.newItem[`pos${l + 1}`])) { |
|
|
|
if (jifenData.hasOwnProperty(`pos${j}${i}`)) { |
|
|
|
jifenData[`pos${j}${i}`]++ |
|
|
|
} else { |
|
|
|
jifenData[`pos${j}${i}`] = 1 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 模式一按照位置积分 |
|
|
|
for (let i = 0; i < posData.length; i++) { |
|
|
|
let posItem = posData[i]; |
|
|
|
for (let j = 0; j < allData.length; j++) { |
|
|
|
let item = _.compact(_.split(allData[j], ",")) |
|
|
|
if (item.indexOf(`${i + 1}`) === -1) { |
|
|
|
for (let k = 0; k < item.length; k++) { |
|
|
|
let maxingItem = item[k]; |
|
|
|
jifenData[`pos${posItem}${maxingItem}`]++ |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 最后多出来的数据放到最后一行 |
|
|
|
for (let k = jishu * j; k < jishu * (j + 1); k++) { |
|
|
|
let itemwData = colObj[`p${i}w`][k].data |
|
|
|
let itemnData = colObj[`p${i}n`][k].data |
|
|
|
let iscontinue = false |
|
|
|
for (let l = 0; l < itemwData.length; l++) { |
|
|
|
let itemW = itemwData[l] |
|
|
|
let itemn = itemnData[l] |
|
|
|
if (Number(itemW) === Number(this.newItem[`pos${itemW}`])) { |
|
|
|
iscontinue = true |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (Number(itemn) === Number(this.newItem[`pos${l + 1}`])) { |
|
|
|
iscontinue = true |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!iscontinue) { |
|
|
|
for (let l = 0; l < itemwData.length; l++) { |
|
|
|
let itemW = itemwData[l] |
|
|
|
let itemn = itemnData[l] |
|
|
|
if (Number(itemW) !== Number(this.newItem[`pos${itemW}`])) { |
|
|
|
if (jifenData.hasOwnProperty(`pos${itemW}${i}`)) { |
|
|
|
jifenData[`pos${itemW}${i}`]++ |
|
|
|
} else { |
|
|
|
jifenData[`pos${itemW}${i}`] = 1 |
|
|
|
} |
|
|
|
} |
|
|
|
if (Number(itemn) !== Number(this.newItem[`pos${l + 1}`])) { |
|
|
|
if (jifenData.hasOwnProperty(`pos${j}${i}`)) { |
|
|
|
jifenData[`pos${j}${i}`]++ |
|
|
|
} else { |
|
|
|
jifenData[`pos${j}${i}`] = 1 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 模式二按照号码积分 |
|
|
|
for (let j = 0; j < allData.length; j++) { |
|
|
|
let item = _.compact(_.split(allData[j], ",")) |
|
|
|
for (let i = 0; i < posData.length; i++) { |
|
|
|
if (item.indexOf(`${i + 1}`) === -1) { |
|
|
|
for (let k = 0; k < item.length; k++) { |
|
|
|
let maxingItem = item[k]; |
|
|
|
jifenData[`pos${maxingItem}${i + 1}`]++ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -420,6 +381,18 @@ export default { |
|
|
|
this.dialogFormData.posInput = "" |
|
|
|
}, |
|
|
|
submitDialog() { |
|
|
|
if (_.trim(this.dialogFormData.xiangmu) === "") { |
|
|
|
ElMessage.error('请填写项目名称') |
|
|
|
return |
|
|
|
} |
|
|
|
if (_.isEmpty(this.dialogFormData.maxing)) { |
|
|
|
ElMessage.error('请至少选择一种码型') |
|
|
|
return |
|
|
|
} |
|
|
|
if (_.find(this.addTableData, o => o.xiangmu === _.trim(this.dialogFormData.xiangmu))) { |
|
|
|
ElMessage.error('现有项目已经存在,请填写不同的项目') |
|
|
|
return |
|
|
|
} |
|
|
|
let posValue = _.uniq(_.compact(_.split(this.dialogFormData.posInput, /[,,]/))) |
|
|
|
let posValueObj = {} |
|
|
|
for (let i = 0; i < posValue.length; i++) { |
|
|
@ -427,7 +400,7 @@ export default { |
|
|
|
posValueObj[`pos${i + 1}`] = ele |
|
|
|
} |
|
|
|
this.addTableData.push({ |
|
|
|
xiangmu: this.dialogFormData.xiangmu, |
|
|
|
xiangmu: _.trim(this.dialogFormData.xiangmu), |
|
|
|
maxing: _.sortBy(this.dialogFormData.maxing), |
|
|
|
...posValueObj |
|
|
|
}) |
|
|
|