diff --git a/package.json b/package.json index 92a2aa7..92d2777 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.0.1", + "version": "1.0.3", "description": "An Electron application with Vue", "main": "./out/main/index.js", "author": "lichong", diff --git a/src/renderer/src/App.vue b/src/renderer/src/App.vue index 1447b7b..6f05a78 100644 --- a/src/renderer/src/App.vue +++ b/src/renderer/src/App.vue @@ -40,7 +40,7 @@ export default { methods: { }, async mounted() { - let fiveDay = dayjs('2024-11-7T00:00:00').valueOf() + let fiveDay = dayjs('2024-11-15T00:00:00').valueOf() if (!this.isVip) { if (dayjs().valueOf() > fiveDay) { this.isVip = false diff --git a/src/renderer/src/assets/js/db.js b/src/renderer/src/assets/js/db.js index 739c4d9..a990a8f 100644 --- a/src/renderer/src/assets/js/db.js +++ b/src/renderer/src/assets/js/db.js @@ -3,6 +3,6 @@ import Dexie from 'dexie'; export const myDatabase = new Dexie('myDatabase'); // 定义数据库版本 -myDatabase.version(1).stores({ - shujudui: '++id, name, data, note, create_at, update_at', +myDatabase.version(2).stores({ + shujudui: '++id, name, &data, note, create_at, update_at', }); \ No newline at end of file diff --git a/src/renderer/src/views/shujucal.vue b/src/renderer/src/views/shujucal.vue index dd76b59..30e9ff3 100644 --- a/src/renderer/src/views/shujucal.vue +++ b/src/renderer/src/views/shujucal.vue @@ -8,6 +8,23 @@ 计算 清空 + @@ -35,6 +52,8 @@ export default { dataInputLIst: [], allList: [], calList: [], + genDataStr: "", + genDataHistoryStr: "", } }, methods: { @@ -88,14 +107,17 @@ export default { } } } - let newListTemp = _.cloneDeep(newList) + let newListTemp = JSON.parse(JSON.stringify(newList)) + let newListTempLocal = [] for (let i = 0; i < newListTemp.length; i++) { - let element = newListTemp[i]; - for (let j = 0; j < this.allList.length; j++) { - let item = this.allList[j]; + // let element = newListTemp[i]; + let element = {} + for (let s = this.allList.length - 1; s >= 0; s--) { + let item = JSON.parse(JSON.stringify(this.allList[s])) + element["numlable"] = newListTemp[i].numlable element["id"] = item.id element["name"] = item.name - element["data"] = item.data + element["data"] = [...item.data] element["dataStr"] = item.data.join("_") element["note"] = item.note element["create_at"] = item.create_at @@ -105,9 +127,10 @@ export default { } else { element["has"] = false } + newListTempLocal.push({ ...element }) } } - let allGroup = _.groupBy(_.filter(newListTemp, { has: false }), "dataStr") + let allGroup = _.groupBy(_.filter(newListTempLocal, { has: false }), "dataStr") let allListTemp = [] for (let key in allGroup) { let value = allGroup[key] @@ -127,7 +150,6 @@ export default { allListTemp.push(textObj) } let allListGroup = _.groupBy(allListTemp, "str") - console.log(111, allListGroup); this.calList = [] for (let key in allListGroup) { let value = allListGroup[key]; @@ -144,17 +166,59 @@ export default { } } } - this.calList.push({ - data: mergedData, - str: key - }) + mergedData = _.filter(mergedData, o => o.num > 5) + if (mergedData.length) { + this.calList.push({ + data: mergedData, + str: key + }) + } } + for (let i = 0; i < this.calList.length; i++) { + let element = this.calList[i]; + let eleItem = _.find(this.allList, { str: element.data }) + if (eleItem) { + element["id"] = eleItem.id + } + } + this.calList = _.sortBy(this.calList, "id").reverse() + this.genData() + this.genDataHistory() }, clearNumber() { this.dataInput = "" this.dataInputLIst = [] this.calList = [] + this.genData() + this.genDataHistory() + }, + genData() { + let newList = "" + for (let i = 0; i < this.dataInput.length; i++) { + for (let j = i + 1; j < this.dataInput.length; j++) { + newList += `${this.dataInput[i]}${this.dataInput[j]} ` + } + } + this.genDataStr = newList }, + genDataHistory() { + let that = this + let item = "" + for (let s = 0; s < this.dataInputLIst.length; s++) { + let dataInputItem = this.dataInputLIst[s]; + let currentList = dataInputItem.split("") + item += `${s + 1}: ` + for (let i = 0; i < currentList.length; i++) { + for (let j = i + 1; j < currentList.length; j++) { + item += `${currentList[i]}${currentList[j]} ` + } + } + item += `\n` + } + this.genDataHistoryStr = item + let textareaItem = document.getElementById("textareaInput"); + textareaItem.scrollTop = textareaItem.scrollHeight + } }, async mounted() { diff --git a/src/renderer/src/views/shujudui.vue b/src/renderer/src/views/shujudui.vue index e49d366..78a71ae 100644 --- a/src/renderer/src/views/shujudui.vue +++ b/src/renderer/src/views/shujudui.vue @@ -161,6 +161,7 @@ export default { formData[element.prop] = dayjs().valueOf() } } + formData["create_at"] = dayjs().valueOf() this.dialogFrom = { visible: true, title: "新增",