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"> <el-col :span="22">
<div class="right"> <div class="right">
<div v-show="type === '1'"> <div v-show="type === '1'">
<div style="padding: 8px;"> <div>
<el-row style="padding: 8px;"> <el-row>
<el-col :span="22"> <el-col :span="22">
<el-button type="primary" @click="addNewData">新增项目号码</el-button> <el-button type="primary" @click="addNewData">新增项目号码</el-button>
</el-col> </el-col>
@ -61,8 +61,8 @@
</div> </div>
</div> </div>
<div v-show="type === '2'"> <div v-show="type === '2'">
<div> <div style="padding: 8px;">
<el-row style="padding: 8px;"> <el-row style="position: absolute;right: 192px;top: 7px;z-index: 1;">
<el-col> <el-col>
<span>项目</span><span> <span>项目</span><span>
<el-select v-model="newItem.xiangmu" placeholder="请选择项目" size="large" style="width: 240px" <el-select v-model="newItem.xiangmu" placeholder="请选择项目" size="large" style="width: 240px"
@ -74,7 +74,7 @@
</el-col> </el-col>
</el-row> </el-row>
<div v-if="!_.isEmpty(newItem)"> <div v-if="!_.isEmpty(newItem)">
<el-row style="padding: 8px;"> <el-row>
<el-col> <el-col>
<el-tabs v-model="valueTag" @tab-click="handleClick"> <el-tabs v-model="valueTag" @tab-click="handleClick">
<el-tab-pane label="所有码型" name="all"> <el-tab-pane label="所有码型" name="all">
@ -85,25 +85,30 @@
</el-tabs> </el-tabs>
</el-col> </el-col>
</el-row> </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" class="alignCenter"></el-col>
<el-col :span="2" v-for="(item1, index1) in 10" :key="index1 + 'col'" class="alignCenter"> <el-col :span="2" v-for="(item1, index1) in 10" :key="index1 + 'col'" class="alignCenter">
<span>{{ item1 }}</span> <span>{{ item1 }}</span>
</el-col> </el-col>
<el-col :span="2" class="alignCenter"></el-col> <el-col :span="2" class="alignCenter"></el-col>
</el-row> </el-row>
<el-row v-for="(item, index) in 10" style="padding: 8px;" :gutter="20" justify="center" <el-row v-for="(item, index) in 10" :gutter="20" justify="center" :key="index + 'row'"
:key="index + 'row'"> style="padding: 4px 0px;">
<el-col :span="2" class="alignCenter">{{ item }}</el-col> <el-col :span="2" class="alignCenter">{{ item }}</el-col>
<el-col :span="2" v-for="(item1, index1) in 10" :key="index1 + 'col'" class="alignCenter"> <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>
<el-col :span="2" class="alignCenter"></el-col> <el-col :span="2" class="alignCenter"></el-col>
</el-row> </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" class="alignCenter">最小值</el-col>
<el-col :span="2" v-for="(item1, index1) in 10" :key="index1 + 'col'" class="alignCenter"> <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>
<el-col :span="2" class="alignCenter"></el-col> <el-col :span="2" class="alignCenter"></el-col>
</el-row> </el-row>
@ -258,7 +263,7 @@ export default {
}, },
computed: {}, computed: {},
async mounted() { async mounted() {
let fiveDay = dayjs('2024-08-29T00:00:00').valueOf() let fiveDay = dayjs('2024-08-30T00:00:00').valueOf()
if (!this.isVip) { if (!this.isVip) {
if (dayjs().valueOf() > fiveDay) { if (dayjs().valueOf() > fiveDay) {
this.isVip = false this.isVip = false
@ -267,7 +272,6 @@ export default {
this.isVip = true this.isVip = true
} }
} }
console.log(666, _.groupBy(allDataObj.b.all, "pos"))
this.addTableData = localStorage.getItem('addTableData') ? JSON.parse(localStorage.getItem('addTableData')) : []; this.addTableData = localStorage.getItem('addTableData') ? JSON.parse(localStorage.getItem('addTableData')) : [];
}, },
methods: { methods: {
@ -275,6 +279,7 @@ export default {
this.type = type this.type = type
if (type === "1") { if (type === "1") {
this.newItem = {} this.newItem = {}
this.valueTag = "all"
} }
}, },
handleDelete(index) { handleDelete(index) {
@ -293,6 +298,7 @@ export default {
this.allJifenData = this.dealOneJifen(val) this.allJifenData = this.dealOneJifen(val)
} else { } else {
let alljifen = {} let alljifen = {}
//
for (let i = 1; i < 11; i++) { for (let i = 1; i < 11; i++) {
for (let j = 1; j < 11; j++) { for (let j = 1; j < 11; j++) {
alljifen[`pos${i}${j}`] = 0 alljifen[`pos${i}${j}`] = 0
@ -322,84 +328,39 @@ export default {
let minItem = _.min(minDataLocal[key]) let minItem = _.min(minDataLocal[key])
this.minData[`${key}`] = minItem this.minData[`${key}`] = minItem
} }
console.log(74411, minDataLocal)
}, },
dealOneJifen(val) { dealOneJifen(val) {
let jifenData = {} let jifenData = {}
let maxingItem = _.find(this.allDataObj.maxing, o => o.value === (Number(val) - 1)) let maxingItem = _.find(this.allDataObj.maxing, o => o.value === Number(val))
let allData = { ...this.allDataObj[maxingItem.name].all } let allData = _.cloneDeep(this.allDataObj[maxingItem.name])
let posGroup = _.groupBy(_.cloneDeep(allData), o => o.pos) 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]
let jishu = parseInt(posGroup.p1n.length / 10) //
//10
for (let i = 1; i < 11; i++) { for (let i = 1; i < 11; i++) {
let colObj = { for (let j = 1; j < 11; j++) {
[`p${i}w`]: _.cloneDeep(posGroup[`p${i}w`]), jifenData[`pos${i}${j}`] = 0
[`p${i}n`]: _.cloneDeep(posGroup[`p${i}n`])
} }
// 10 }
for (let j = 0; j < 10; j++) { //
// for (let i = 0; i < posData.length; i++) {
if (j === 9) { let posItem = posData[i];
for (let k = jishu * j; k < posGroup.p1n.length; k++) { for (let j = 0; j < allData.length; j++) {
let itemwData = colObj[`p${i}n`][k].data let item = _.compact(_.split(allData[j], ","))
let itemnData = colObj[`p${i}n`][k].data if (item.indexOf(`${i + 1}`) === -1) {
for (let l = 0; l < itemwData.length; l++) { for (let k = 0; k < item.length; k++) {
let itemW = itemwData[l] let maxingItem = item[k];
let itemn = itemnData[l] jifenData[`pos${posItem}${maxingItem}`]++
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
}
}
}
} }
} 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 for (let j = 0; j < allData.length; j++) {
let iscontinue = false let item = _.compact(_.split(allData[j], ","))
for (let l = 0; l < itemwData.length; l++) { for (let i = 0; i < posData.length; i++) {
let itemW = itemwData[l] if (item.indexOf(`${i + 1}`) === -1) {
let itemn = itemnData[l] for (let k = 0; k < item.length; k++) {
if (Number(itemW) === Number(this.newItem[`pos${itemW}`])) { let maxingItem = item[k];
iscontinue = true jifenData[`pos${maxingItem}${i + 1}`]++
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
}
}
}
}
} }
} }
} }
@ -420,6 +381,18 @@ export default {
this.dialogFormData.posInput = "" this.dialogFormData.posInput = ""
}, },
submitDialog() { 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 posValue = _.uniq(_.compact(_.split(this.dialogFormData.posInput, /[,,]/)))
let posValueObj = {} let posValueObj = {}
for (let i = 0; i < posValue.length; i++) { for (let i = 0; i < posValue.length; i++) {
@ -427,7 +400,7 @@ export default {
posValueObj[`pos${i + 1}`] = ele posValueObj[`pos${i + 1}`] = ele
} }
this.addTableData.push({ this.addTableData.push({
xiangmu: this.dialogFormData.xiangmu, xiangmu: _.trim(this.dialogFormData.xiangmu),
maxing: _.sortBy(this.dialogFormData.maxing), maxing: _.sortBy(this.dialogFormData.maxing),
...posValueObj ...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、 //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 maxing = [
let maxing1 = [
{ {
name: "a", name: "a",
value: 0, value: 1,
}, },
{ {
name: "b", name: "b",
value: 1, value: 2,
}, },
{ {
name: "c", name: "c",
value: 2, value: 3,
}, },
{ {
name: "d", name: "d",
value: 3, value: 4,
}, },
{ {
name: "e", name: "e",
value: 4, value: 5,
}, },
{ {
name: "f", name: "f",
value: 5, value: 6,
}, },
{ {
name: "g", name: "g",
value: 6, value: 7,
}, },
{ {
name: "h", name: "h",
value: 7, value: 8,
}, },
{ {
name: "i", name: "i",
value: 8, value: 9,
}, },
{ {
name: "j", name: "j",
value: 9, value: 10,
}, },
] ]
// 模式w-位置、n-数字
let moshi = ["w", "n"]
// 原数据1-10 // 原数据1-10
let orgData = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] let orgData = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
let allObj = { maxing: maxing1 } let allObj = { maxing: maxing }
function genAllData(orgData) { function genAllData(orgData) {
let a2 = [] let a2 = []
for (; a2.push([]) < orgData.length;); for (; a2.push([]) < orgData.length;);
@ -61,24 +58,8 @@ function genAllData(orgData) {
return a2 return a2
} }
allArr = genAllData(orgData) allArr = genAllData(orgData)
for (let i = 0; i < maxing1.length; i++) { for (let i = 0; i < maxing.length; i++) {
let itemi = maxing1[i]; let itemi = maxing[i];
allObj[itemi.name] = {} allObj[itemi.name] = allArr[itemi.value - 1]
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"])
} }
console.log(888, allObj) console.log(888, allObj)

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

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