feat(database): 将数据库从 SQLite 迁移到 MySQL

- 修改了 DBService 类,增加了 MySQL 数据库连接配置
- 重新定义了表结构,适应 MySQL 数据库- 更新了相关的 SQL 查询语句
- 增加了创建数据库的逻辑
- 优化了表创建语句,使用 InnoDB 引擎和 UTF-8 字符集
This commit is contained in:
liuxiaoqing
2025-08-20 15:11:35 +08:00
parent 31c2394e8a
commit 11530baefb
12 changed files with 205 additions and 150 deletions
@@ -38,7 +38,7 @@ const previousPage = () => {
};
// 保存
const saveReport = () => {
console.log('保存成功')
current.value = 0
}
// 表单数据
const formState = ref<string>('');
@@ -58,7 +58,7 @@ const formState = ref<string>('');
<a-col :span="12" offset="16">
<a-space>
<a-button type="default" v-if="current > 0" @click="previousPage">上一步</a-button>
<a-button type="primary" v-if="current < items.length-1 " @click="nextPage">下一步</a-button>
<a-button type="primary" v-if="current < items.length-1 " :disabled="!filePath" @click="nextPage">下一步</a-button>
<a-button type="dashed" v-if="current == items.length-1" @click="saveReport">完成</a-button>
</a-space>
</a-col>
@@ -1,5 +1,7 @@
<template>
<a-layout-content>
<a-spin v-if="loadding">
</a-spin>
<a-result
:status="formState.status"
:title="formState.cyjgxx"
@@ -16,7 +18,7 @@ import {ref,onMounted } from 'vue';
import request from "../../utils/request.ts";
const props = defineProps({ filePath: String });
import {baseURL} from "../../utils/baseurl.ts";
let loadding = ref(true)
const fileType = ref<string>('img')
onMounted(() => {
// alert(props.filePath)
@@ -25,6 +27,7 @@ onMounted(() => {
request.get('/verify?filePath='+encodeURIComponent(props.filePath)).then((res) => {
console.log(res)
formState.value = res.data
loadding.value = false
})
fileUrl.value = baseURL+"/"+props.filePath
}
@@ -63,7 +63,7 @@ const handleUpload = (options: any) => {
:max-count="1"
@remove="handleRemove"
>
<a-button >
<a-button>
<upload-outlined></upload-outlined>
上传发票
</a-button>
+6 -2
View File
@@ -129,12 +129,13 @@ const handleOk = () => {
invoiceId: formData.value.id,
status: formData.value.status?'yes':'no',
desc: formData.value.desc,
desc_files: formData.value.fileIds.join(','),
desc_files: formData.value.fileIds?.join(','),
}).then(( res ) => {
if(res.status == 200){
openModal.value = false;
confirmLoading.value = false;
messageApi.success("修改成功")
getList();//刷新
}
})
};
@@ -146,8 +147,8 @@ const handleOpen = (record:any) => {
}
formData.value = Object.assign({}, record);
formData.value.status = (record.status === 'yes')
formData.value.fileIds = record.desc_files.split(',');
if (record.desc_files) {
formData.value.fileIds = record.desc_files.split(',');
let paths = record.desc_files.split(",")
fileList.value = []
for(let i = 0; i < paths.length; i++) {
@@ -201,6 +202,9 @@ const handlePreview = async (file: any) => {
const handleFileChange = (info: UploadChangeParam) => {
if(info.file.status === 'done'){
info.file.uid = info.file.response.file_path
if (!formData.value.fileIds){
formData.value.fileIds = new Array<String>();
}
formData.value.fileIds.push(info.file.response.file_path)
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import axios, {type AxiosInstance} from 'axios';
import {baseURL} from "./baseurl.ts";
const service: AxiosInstance = axios.create({
baseURL: baseURL,
timeout: 5000,
timeout: 50000,
});
// 导出 axios 实例