From 31efd53bd386da7d7bb9a3b158d4efe9349e0779 Mon Sep 17 00:00:00 2001
From: lichong <18518571399@163.com>
Date: Tue, 22 Oct 2024 00:31:20 +0800
Subject: [PATCH] 10.22
---
electron-builder.yml | 4 +-
package.json | 5 +-
src/main/index.js | 6 +-
src/renderer/src/assets/json/chufang.json | 8 +-
src/renderer/src/components/formcomponent.vue | 84 ++++++++++++++-----
.../src/components/tablecomponent.vue | 22 +++--
src/renderer/src/views/chufang.vue | 19 +----
7 files changed, 96 insertions(+), 52 deletions(-)
diff --git a/electron-builder.yml b/electron-builder.yml
index df648a1..69f052c 100644
--- a/electron-builder.yml
+++ b/electron-builder.yml
@@ -1,5 +1,5 @@
appId: com.electron.lichong
-productName: 桌面应用
+productName: 处方记录
directories:
buildResources: build
files:
@@ -14,7 +14,7 @@ win:
executableName: lichong-app
nsis:
oneClick: false
- artifactName: 处方统计-${version}-setup.${ext}
+ artifactName: 处方记录-${version}-setup.${ext}
allowToChangeInstallationDirectory: true
shortcutName: ${productName}
uninstallDisplayName: ${productName}
diff --git a/package.json b/package.json
index 2f404fb..e0f0af9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "electron",
- "version": "1.0.0",
+ "version": "1.0.1",
"description": "An Electron application with Vue",
"main": "./out/main/index.js",
"author": "lichong",
@@ -16,6 +16,7 @@
"dependencies": {
"@electron-toolkit/preload": "^1.0.2",
"@electron-toolkit/utils": "^1.0.2",
+ "@reiyanyan/vue-camera": "^1.3.1",
"dayjs": "^1.11.11",
"dexie": "^4.0.8",
"element-plus": "^2.7.1",
@@ -35,4 +36,4 @@
"vite": "^3.1.8",
"vue": "^3.2.41"
}
-}
\ No newline at end of file
+}
diff --git a/src/main/index.js b/src/main/index.js
index cd53c3e..a4bfc05 100644
--- a/src/main/index.js
+++ b/src/main/index.js
@@ -1,4 +1,4 @@
-import { app, shell, BrowserWindow, nativeImage, ipcMain } from 'electron'
+import { app, shell, BrowserWindow, nativeImage } from 'electron'
import * as path from 'path'
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
@@ -16,7 +16,9 @@ function createWindow() {
icon: logoIcon,
webPreferences: {
preload: path.resolve(__dirname, '../preload/index.js'),
- sandbox: false
+ sandbox: false,
+ nodeIntegration: true,
+ contextIsolation: false
}
})
mainWindow.on('ready-to-show', () => {
diff --git a/src/renderer/src/assets/json/chufang.json b/src/renderer/src/assets/json/chufang.json
index 4255014..6470b52 100644
--- a/src/renderer/src/assets/json/chufang.json
+++ b/src/renderer/src/assets/json/chufang.json
@@ -29,14 +29,14 @@
"type": "date",
"isSort": true,
"tableShow": true,
- "formShow": false
+ "formShow": true
},
{
"label": "更新时间",
"prop": "update_at",
"type": "date",
- "isSort": false,
- "tableShow": false,
- "formShow": false
+ "isSort": true,
+ "tableShow": true,
+ "formShow": true
}
]
\ No newline at end of file
diff --git a/src/renderer/src/components/formcomponent.vue b/src/renderer/src/components/formcomponent.vue
index fc0be91..6a45cae 100644
--- a/src/renderer/src/components/formcomponent.vue
+++ b/src/renderer/src/components/formcomponent.vue
@@ -1,24 +1,50 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
![Captured Photo]()
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -55,10 +81,28 @@ export default {
return {
_: _,
dayjs: dayjs,
+ }
+ },
+ methods: {
+ async openVedio(formItem) {
+ this.formData[formItem.prop] = ""
+ let stream = await navigator.mediaDevices.getUserMedia({
+ video: {
+ width: { ideal: 200 },
+ height: { ideal: 200 }
+ },
+ });
+ this.$refs[`${formItem.prop}video`][0].srcObject = stream;
+ },
+ takePhoto(formItem) {
+ let video = this.$refs[`${formItem.prop}video`][0]
+ let canvas = this.$refs[`${formItem.prop}canvas`][0]
+ let context = canvas.getContext('2d');
+ context.drawImage(video, 0, 0, 202, 202);
+ this.formData[formItem.prop] = canvas.toDataURL('image/png');
}
},
- methods: {},
async mounted() { },
watch: {},
computed: {}
diff --git a/src/renderer/src/components/tablecomponent.vue b/src/renderer/src/components/tablecomponent.vue
index 5d457e0..da262ce 100644
--- a/src/renderer/src/components/tablecomponent.vue
+++ b/src/renderer/src/components/tablecomponent.vue
@@ -6,7 +6,7 @@
:checkbox-config="{ labelField: 'seq', highlight: true }" @checkbox-all="selectAllChangeEvent"
@checkbox-change="selectChange" ref="tableRef" border :column-config="{ resizable: true }">
-
+
@@ -15,17 +15,19 @@
{{ row[headerItem.prop] }}
- {{ row[headerItem.prop] }}
+ {{ dayjs(row[headerItem.prop]).format("YYYY-MM-DD HH:mm:ss") }}
-
- {{ row[headerItem.prop] }}
+
+
+
+ 无
+
{{ row[headerItem.prop] }}
-
+
@@ -80,6 +82,12 @@ export default {
}
},
methods: {
+ clearSelection() {
+ const $table = this.$refs.tableRef
+ if ($table) {
+ $table.clearCheckboxRow()
+ }
+ },
selectChange({ checked }) {
let $table = this.$refs.tableRef
if ($table) {
diff --git a/src/renderer/src/views/chufang.vue b/src/renderer/src/views/chufang.vue
index 0ecb48d..1f8c88e 100644
--- a/src/renderer/src/views/chufang.vue
+++ b/src/renderer/src/views/chufang.vue
@@ -24,7 +24,7 @@
-
+
@@ -136,18 +136,7 @@ export default {
},
//确认模态框
async submitDialog() {
- for (let i = 0; i < this.formHeader.length; i++) {
- let headItem = this.formHeader[i];
- if (headItem.type === "date") {
- this.dialogFrom.formData[headItem.prop] = dayjs(this.dialogFrom.formData[headItem.prop]).format("YYYY-MM-DD")
- }
- }
- let params = {
- ...this.dialogFrom.formData, ...this.dealRow(this.dialogFrom.formData), create_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), update_at: dayjs().format('YYYY-MM-DD HH:mm:ss')
- }
- if (this.dialogFrom.type === "put") {
- delete params.create_at
- }
+ let params = { ...this.dialogFrom.formData, }
try {
await myDatabase.chufang[this.dialogFrom.type]({ ...params, update_at: dayjs().format('YYYY-MM-DD HH:mm:ss') })
await this.updateSeach()
@@ -169,7 +158,7 @@ export default {
if (element.type === "text") {
formData[element.prop] = ""
} else if (element.type === "date") {
- formData[element.prop] = dayjs().subtract(element.default || 0, 'year').format("YYYY-MM-DD")
+ formData[element.prop] = dayjs().valueOf()
}
}
this.dialogFrom = {
@@ -230,7 +219,7 @@ export default {
await myDatabase.chufang.bulkDelete(idList)
await this.updateSeach()
})
- .catch(() => {
+ .catch((err) => {
ElMessage({
type: 'info',
message: '取消删除',