lichong 7 months ago
parent
commit
2c9bafd1b6
  1. 145
      src/renderer/src/App.vue
  2. 49
      src/renderer/src/assets/json/orgData.js
  3. 451463
      src/renderer/src/assets/json/orgData.json

145
src/renderer/src/App.vue

@ -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
})

49
src/renderer/src/assets/json/orgData.js

@ -1,52 +1,49 @@
//1码型-a、 2码型-b、3码型-c、4码型-d、5码型-e、6码型-f、7码型-g、8码型-h、9码型-i、8码型-j、
let maxing = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
let maxing1 = [
let maxing = [
{
name: "a",
value: 0,
value: 1,
},
{
name: "b",
value: 1,
value: 2,
},
{
name: "c",
value: 2,
value: 3,
},
{
name: "d",
value: 3,
value: 4,
},
{
name: "e",
value: 4,
value: 5,
},
{
name: "f",
value: 5,
value: 6,
},
{
name: "g",
value: 6,
value: 7,
},
{
name: "h",
value: 7,
value: 8,
},
{
name: "i",
value: 8,
value: 9,
},
{
name: "j",
value: 9,
value: 10,
},
]
// 模式w-位置、n-数字
let moshi = ["w", "n"]
// 原数据1-10
let orgData = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
let allObj = { maxing: maxing1 }
let allObj = { maxing: maxing }
function genAllData(orgData) {
let a2 = []
for (; a2.push([]) < orgData.length;);
@ -61,24 +58,8 @@ function genAllData(orgData) {
return a2
}
allArr = genAllData(orgData)
for (let i = 0; i < maxing1.length; i++) {
let itemi = maxing1[i];
allObj[itemi.name] = {}
for (let j = 0; j < moshi.length; j++) {
let itemj = moshi[j];
allObj[itemi.name][itemj] = []
for (let k = 0; k < allArr[itemi.value].length; k++) {
let itemk = allArr[itemi.value][k];
for (let l = 1; l < 11; l++) {
let pos = l;
allObj[itemi.name][itemj].push({
maxing: itemi.name,
pos: `p${pos}${itemj}`,
data: itemk.split(",")
})
}
}
}
allObj[itemi.name]["all"] = allObj[itemi.name]["w"].concat(allObj[itemi.name]["n"])
for (let i = 0; i < maxing.length; i++) {
let itemi = maxing[i];
allObj[itemi.name] = allArr[itemi.value - 1]
}
console.log(888, allObj)

451463
src/renderer/src/assets/json/orgData.json

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