From a4bd92264d09c462cf8734e247c99c9820dea00c Mon Sep 17 00:00:00 2001 From: ZhangAo Date: Tue, 31 Mar 2026 17:19:34 +0800 Subject: [PATCH] u --- .../config/datasource/DataSourceManager.java | 50 +- .../src/main/resources/application.yml | 4 +- .../main/resources/dbconfigs/g3hd.properties | 14 +- code/container-ocr/ocr-vue/.env | 4 +- code/container-ocr/ocr-vue/components.d.ts | 9 + .../components/g3-container-file/index.vue | 54 +- code/container-ocr/ocr-vue/src/utils/file.js | 30 +- .../ocr-vue/src/views/container/index.vue | 4 +- .../src/views/container/update-dialog.vue | 76 +- code/g3hy2024-uniapp/.gitignore | 22 + code/g3hy2024-uniapp/.npmrc | 1 + code/g3hy2024-uniapp/.vscode/extensions.json | 3 + code/g3hy2024-uniapp/.vscode/settings.json | 51 + .../.vscode/vue3.code-snippets | 17 + code/g3hy2024-uniapp/env/.env | 3 + code/g3hy2024-uniapp/eslint.config.js | 24 + code/g3hy2024-uniapp/index.html | 26 + code/g3hy2024-uniapp/package.json | 129 + code/g3hy2024-uniapp/pnpm-lock.yaml | 11757 ++++++++++++++++ code/g3hy2024-uniapp/project.config.json | 25 + .../project.private.config.json | 14 + code/g3hy2024-uniapp/public/logo.png | Bin 0 -> 1922 bytes code/g3hy2024-uniapp/public/vite.svg | 1 + code/g3hy2024-uniapp/src/App.vue | 35 + code/g3hy2024-uniapp/src/assets/vue.svg | 1 + .../src/components/OverlayLoading.vue | 32 + .../src/components/date-search/index.scss | 0 .../src/components/date-search/index.vue | 104 + .../src/components/date-search/types.ts | 10 + .../components/picker-select-input/index.vue | 71 + .../src/components/picker-select/index.vue | 403 + code/g3hy2024-uniapp/src/env.d.ts | 24 + code/g3hy2024-uniapp/src/layouts/default.vue | 11 + code/g3hy2024-uniapp/src/main.ts | 17 + code/g3hy2024-uniapp/src/manifest.json | 75 + .../src/pages-sub/file/index.vue | 162 + .../src/pages-sub/login/index.vue | 251 + .../src/pages-sub/update-password/index.vue | 251 + code/g3hy2024-uniapp/src/pages.json | 88 + .../src/pages/account/index.vue | 135 + code/g3hy2024-uniapp/src/pages/home/index.vue | 145 + code/g3hy2024-uniapp/src/request/api.ts | 197 + code/g3hy2024-uniapp/src/request/index.ts | 283 + .../g3hy2024-uniapp/src/router/interceptor.ts | 76 + .../src/static/app/icons/1024x1024.png | Bin 0 -> 59336 bytes .../src/static/app/icons/120x120.png | Bin 0 -> 3231 bytes .../src/static/app/icons/144x144.png | Bin 0 -> 3791 bytes .../src/static/app/icons/152x152.png | Bin 0 -> 3981 bytes .../src/static/app/icons/167x167.png | Bin 0 -> 4479 bytes .../src/static/app/icons/180x180.png | Bin 0 -> 4844 bytes .../src/static/app/icons/192x192.png | Bin 0 -> 5319 bytes .../src/static/app/icons/20x20.png | Bin 0 -> 574 bytes .../src/static/app/icons/29x29.png | Bin 0 -> 780 bytes .../src/static/app/icons/40x40.png | Bin 0 -> 985 bytes .../src/static/app/icons/58x58.png | Bin 0 -> 1483 bytes .../src/static/app/icons/60x60.png | Bin 0 -> 1521 bytes .../src/static/app/icons/72x72.png | Bin 0 -> 1802 bytes .../src/static/app/icons/76x76.png | Bin 0 -> 1972 bytes .../src/static/app/icons/80x80.png | Bin 0 -> 2060 bytes .../src/static/app/icons/87x87.png | Bin 0 -> 2289 bytes .../src/static/app/icons/96x96.png | Bin 0 -> 2396 bytes code/g3hy2024-uniapp/src/static/db.json | 3 + .../src/static/images/.gitkeep | 0 code/g3hy2024-uniapp/src/static/images/bg.jpg | Bin 0 -> 36991 bytes .../g3hy2024-uniapp/src/static/images/bg1.jpg | Bin 0 -> 30094 bytes .../g3hy2024-uniapp/src/static/images/bg2.jpg | Bin 0 -> 36856 bytes .../src/static/images/home/CheliangWeixiu.png | Bin 0 -> 11886 bytes .../static/images/home/ExpensesClaimIndex.png | Bin 0 -> 6737 bytes .../static/images/home/HistoricalWaybill.png | Bin 0 -> 5439 bytes .../src/static/images/home/MyExpenses.png | Bin 0 -> 4524 bytes .../src/static/images/home/logo.png | Bin 0 -> 30232 bytes .../src/static/images/home/paymentRequest.png | Bin 0 -> 7863 bytes .../static/images/home/receivableInvoice.png | Bin 0 -> 5529 bytes .../src/static/images/home/refuelling.png | Bin 0 -> 6651 bytes .../src/static/images/home/waybill.png | Bin 0 -> 7956 bytes code/g3hy2024-uniapp/src/static/logo.svg | 33 + .../src/static/tabbar/account.png | Bin 0 -> 6185 bytes .../src/static/tabbar/accountHL.png | Bin 0 -> 5892 bytes .../src/static/tabbar/home.png | Bin 0 -> 4369 bytes .../src/static/tabbar/homeHL.png | Bin 0 -> 4200 bytes code/g3hy2024-uniapp/src/static/tabbar/im.png | Bin 0 -> 6133 bytes .../src/static/tabbar/imHL.png | Bin 0 -> 5870 bytes code/g3hy2024-uniapp/src/store/counts.ts | 22 + code/g3hy2024-uniapp/src/store/index.ts | 17 + code/g3hy2024-uniapp/src/store/permission.ts | 95 + code/g3hy2024-uniapp/src/store/user.ts | 37 + code/g3hy2024-uniapp/src/style/iconfont.css | 59 + code/g3hy2024-uniapp/src/style/index.scss | 40 + code/g3hy2024-uniapp/src/style/mixins.scss | 23 + .../src/types/async-component.d.ts | 8 + .../src/types/async-import.d.ts | 13 + .../src/types/auto-import.d.ts | 187 + .../g3hy2024-uniapp/src/types/components.d.ts | 15 + code/g3hy2024-uniapp/src/typings.d.ts | 144 + code/g3hy2024-uniapp/src/typings.ts | 15 + code/g3hy2024-uniapp/src/uni_modules/.gitkeep | 0 code/g3hy2024-uniapp/src/utils/common.ts | 333 + code/g3hy2024-uniapp/src/utils/field.ts | 65 + code/g3hy2024-uniapp/src/utils/file.ts | 444 + code/g3hy2024-uniapp/src/utils/math.ts | 42 + code/g3hy2024-uniapp/src/utils/platform.ts | 26 + code/g3hy2024-uniapp/src/utils/request.ts | 28 + code/g3hy2024-uniapp/src/utils/systemInfo.ts | 38 + code/g3hy2024-uniapp/src/utils/tdl-loader.ts | 140 + code/g3hy2024-uniapp/src/utils/time.ts | 139 + code/g3hy2024-uniapp/src/utils/toast.ts | 65 + code/g3hy2024-uniapp/tsconfig.json | 44 + code/g3hy2024-uniapp/vite.config.ts | 133 + 108 files changed, 16862 insertions(+), 35 deletions(-) create mode 100644 code/g3hy2024-uniapp/.gitignore create mode 100644 code/g3hy2024-uniapp/.npmrc create mode 100644 code/g3hy2024-uniapp/.vscode/extensions.json create mode 100644 code/g3hy2024-uniapp/.vscode/settings.json create mode 100644 code/g3hy2024-uniapp/.vscode/vue3.code-snippets create mode 100644 code/g3hy2024-uniapp/env/.env create mode 100644 code/g3hy2024-uniapp/eslint.config.js create mode 100644 code/g3hy2024-uniapp/index.html create mode 100644 code/g3hy2024-uniapp/package.json create mode 100644 code/g3hy2024-uniapp/pnpm-lock.yaml create mode 100644 code/g3hy2024-uniapp/project.config.json create mode 100644 code/g3hy2024-uniapp/project.private.config.json create mode 100644 code/g3hy2024-uniapp/public/logo.png create mode 100644 code/g3hy2024-uniapp/public/vite.svg create mode 100644 code/g3hy2024-uniapp/src/App.vue create mode 100644 code/g3hy2024-uniapp/src/assets/vue.svg create mode 100644 code/g3hy2024-uniapp/src/components/OverlayLoading.vue create mode 100644 code/g3hy2024-uniapp/src/components/date-search/index.scss create mode 100644 code/g3hy2024-uniapp/src/components/date-search/index.vue create mode 100644 code/g3hy2024-uniapp/src/components/date-search/types.ts create mode 100644 code/g3hy2024-uniapp/src/components/picker-select-input/index.vue create mode 100644 code/g3hy2024-uniapp/src/components/picker-select/index.vue create mode 100644 code/g3hy2024-uniapp/src/env.d.ts create mode 100644 code/g3hy2024-uniapp/src/layouts/default.vue create mode 100644 code/g3hy2024-uniapp/src/main.ts create mode 100644 code/g3hy2024-uniapp/src/manifest.json create mode 100644 code/g3hy2024-uniapp/src/pages-sub/file/index.vue create mode 100644 code/g3hy2024-uniapp/src/pages-sub/login/index.vue create mode 100644 code/g3hy2024-uniapp/src/pages-sub/update-password/index.vue create mode 100644 code/g3hy2024-uniapp/src/pages.json create mode 100644 code/g3hy2024-uniapp/src/pages/account/index.vue create mode 100644 code/g3hy2024-uniapp/src/pages/home/index.vue create mode 100644 code/g3hy2024-uniapp/src/request/api.ts create mode 100644 code/g3hy2024-uniapp/src/request/index.ts create mode 100644 code/g3hy2024-uniapp/src/router/interceptor.ts create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/1024x1024.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/120x120.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/144x144.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/152x152.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/167x167.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/180x180.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/192x192.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/20x20.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/29x29.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/40x40.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/58x58.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/60x60.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/72x72.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/76x76.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/80x80.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/87x87.png create mode 100644 code/g3hy2024-uniapp/src/static/app/icons/96x96.png create mode 100644 code/g3hy2024-uniapp/src/static/db.json create mode 100644 code/g3hy2024-uniapp/src/static/images/.gitkeep create mode 100644 code/g3hy2024-uniapp/src/static/images/bg.jpg create mode 100644 code/g3hy2024-uniapp/src/static/images/bg1.jpg create mode 100644 code/g3hy2024-uniapp/src/static/images/bg2.jpg create mode 100644 code/g3hy2024-uniapp/src/static/images/home/CheliangWeixiu.png create mode 100644 code/g3hy2024-uniapp/src/static/images/home/ExpensesClaimIndex.png create mode 100644 code/g3hy2024-uniapp/src/static/images/home/HistoricalWaybill.png create mode 100644 code/g3hy2024-uniapp/src/static/images/home/MyExpenses.png create mode 100644 code/g3hy2024-uniapp/src/static/images/home/logo.png create mode 100644 code/g3hy2024-uniapp/src/static/images/home/paymentRequest.png create mode 100644 code/g3hy2024-uniapp/src/static/images/home/receivableInvoice.png create mode 100644 code/g3hy2024-uniapp/src/static/images/home/refuelling.png create mode 100644 code/g3hy2024-uniapp/src/static/images/home/waybill.png create mode 100644 code/g3hy2024-uniapp/src/static/logo.svg create mode 100644 code/g3hy2024-uniapp/src/static/tabbar/account.png create mode 100644 code/g3hy2024-uniapp/src/static/tabbar/accountHL.png create mode 100644 code/g3hy2024-uniapp/src/static/tabbar/home.png create mode 100644 code/g3hy2024-uniapp/src/static/tabbar/homeHL.png create mode 100644 code/g3hy2024-uniapp/src/static/tabbar/im.png create mode 100644 code/g3hy2024-uniapp/src/static/tabbar/imHL.png create mode 100644 code/g3hy2024-uniapp/src/store/counts.ts create mode 100644 code/g3hy2024-uniapp/src/store/index.ts create mode 100644 code/g3hy2024-uniapp/src/store/permission.ts create mode 100644 code/g3hy2024-uniapp/src/store/user.ts create mode 100644 code/g3hy2024-uniapp/src/style/iconfont.css create mode 100644 code/g3hy2024-uniapp/src/style/index.scss create mode 100644 code/g3hy2024-uniapp/src/style/mixins.scss create mode 100644 code/g3hy2024-uniapp/src/types/async-component.d.ts create mode 100644 code/g3hy2024-uniapp/src/types/async-import.d.ts create mode 100644 code/g3hy2024-uniapp/src/types/auto-import.d.ts create mode 100644 code/g3hy2024-uniapp/src/types/components.d.ts create mode 100644 code/g3hy2024-uniapp/src/typings.d.ts create mode 100644 code/g3hy2024-uniapp/src/typings.ts create mode 100644 code/g3hy2024-uniapp/src/uni_modules/.gitkeep create mode 100644 code/g3hy2024-uniapp/src/utils/common.ts create mode 100644 code/g3hy2024-uniapp/src/utils/field.ts create mode 100644 code/g3hy2024-uniapp/src/utils/file.ts create mode 100644 code/g3hy2024-uniapp/src/utils/math.ts create mode 100644 code/g3hy2024-uniapp/src/utils/platform.ts create mode 100644 code/g3hy2024-uniapp/src/utils/request.ts create mode 100644 code/g3hy2024-uniapp/src/utils/systemInfo.ts create mode 100644 code/g3hy2024-uniapp/src/utils/tdl-loader.ts create mode 100644 code/g3hy2024-uniapp/src/utils/time.ts create mode 100644 code/g3hy2024-uniapp/src/utils/toast.ts create mode 100644 code/g3hy2024-uniapp/tsconfig.json create mode 100644 code/g3hy2024-uniapp/vite.config.ts diff --git a/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/config/datasource/DataSourceManager.java b/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/config/datasource/DataSourceManager.java index 51a8dea1..aa9eaae6 100644 --- a/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/config/datasource/DataSourceManager.java +++ b/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/config/datasource/DataSourceManager.java @@ -13,6 +13,7 @@ import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; public class DataSourceManager extends AbstractRoutingDataSource { + private static final String CONFIG_PATH = "dbconfigs/"; private static final Map dataSources = new ConcurrentHashMap<>(); @@ -26,10 +27,16 @@ public class DataSourceManager extends AbstractRoutingDataSource { return DataSourceContextHolder.getDataSourceKey(); } + /** + * 获取连接(带异常保护) + */ public static Connection getConnection(String orgCode) throws Exception { - DataSource dataSource = getOrCreateDataSource(orgCode); - - return dataSource.getConnection(); + try { + DataSource dataSource = getOrCreateDataSource(orgCode); + return dataSource.getConnection(); + } catch (Exception e) { + throw new RuntimeException("获取数据库连接失败: " + orgCode, e); + } } /** @@ -49,9 +56,21 @@ public class DataSourceManager extends AbstractRoutingDataSource { return ds; } + // 创建数据源 ds = createDataSource(orgCode); - dataSources.put(orgCode, ds); + // ===== 关键:先验证连接,防止缓存坏数据源 ===== + try (Connection conn = ds.getConnection()) { + // 成功才缓存 + dataSources.put(orgCode, ds); + } catch (Exception e) { + if (ds instanceof DruidDataSource) { + ((DruidDataSource) ds).close(); + } + throw new RuntimeException("数据库连接失败: " + orgCode, e); + } + + // 刷新 routing datasource refresh(); return ds; @@ -62,14 +81,13 @@ public class DataSourceManager extends AbstractRoutingDataSource { * 刷新 routing datasource */ private static void refresh() { - DataSourceManager routing = SpringUtils.getBean(DataSourceManager.class); routing.setTargetDataSources(new ConcurrentHashMap<>(dataSources)); routing.afterPropertiesSet(); } /** - * 创建数据源 + * 创建数据源(已优化:防止无限重连/卡死) */ private static DataSource createDataSource(String orgCode) throws Exception { @@ -93,11 +111,23 @@ public class DataSourceManager extends AbstractRoutingDataSource { ds.setPassword(p.getProperty("password")); ds.setDriverClassName(p.getProperty("driver")); - ds.setInitialSize(2); - ds.setMaxActive(20); - ds.setMinIdle(2); - ds.setValidationQuery("SELECT 1"); + // ===== 基础连接池配置 ===== + ds.setInitialSize(1); + ds.setMaxActive(10); + ds.setMinIdle(1); + // ===== 核心:防止卡死 / 无限重试 ===== + ds.setMaxWait(3000); // 获取连接最大等待3秒 + ds.setBreakAfterAcquireFailure(true); // 获取失败直接抛异常 + ds.setConnectionErrorRetryAttempts(0); // 不重试 + ds.setFailFast(true); // 初始化时检测连接 + + // ===== 连接校验 ===== + ds.setValidationQuery("SELECT 1"); + ds.setTestOnBorrow(true); + ds.setTestWhileIdle(false); + + // 初始化(此时若连接失败会快速抛异常) ds.init(); return ds; diff --git a/code/container-ocr/ocr-springboot/src/main/resources/application.yml b/code/container-ocr/ocr-springboot/src/main/resources/application.yml index d7810e87..72134fc3 100644 --- a/code/container-ocr/ocr-springboot/src/main/resources/application.yml +++ b/code/container-ocr/ocr-springboot/src/main/resources/application.yml @@ -22,8 +22,8 @@ file: base-dir: D:/data/file static-path: /static/file - server-url: http://192.168.1.137:80/api - +# server-url: http://192.168.1.137:80/api + server-url: http://ser369.g3soft.cn:80/api common-dir: common container-dir: container temp-dir: temp \ No newline at end of file diff --git a/code/container-ocr/ocr-springboot/src/main/resources/dbconfigs/g3hd.properties b/code/container-ocr/ocr-springboot/src/main/resources/dbconfigs/g3hd.properties index 6aa855da..05bead7b 100644 --- a/code/container-ocr/ocr-springboot/src/main/resources/dbconfigs/g3hd.properties +++ b/code/container-ocr/ocr-springboot/src/main/resources/dbconfigs/g3hd.properties @@ -1,10 +1,10 @@ -url=jdbc:sqlserver://118.89.70.199:1433;databaseName=G3BoxOCR +#url=jdbc:sqlserver://118.89.70.199:1433;databaseName=G3BoxOCR +#username=sa +#password=zhang520.. +#driver=com.microsoft.sqlserver.jdbc.SQLServerDriver + +url=jdbc:sqlserver://127.0.0.1:1433;databaseName=G3ContainerOCR username=sa -password=zhang520.. +password=123456@aaa driver=com.microsoft.sqlserver.jdbc.SQLServerDriver -# url=jdbc:sqlserver://127.0.0.1:1433;databaseName=G3BoxOCR -# username=sa -# password=123456@aaa -# driver=com.microsoft.sqlserver.jdbc.SQLServerDriver - diff --git a/code/container-ocr/ocr-vue/.env b/code/container-ocr/ocr-vue/.env index 4da995fd..f3df623a 100644 --- a/code/container-ocr/ocr-vue/.env +++ b/code/container-ocr/ocr-vue/.env @@ -10,7 +10,7 @@ PUBLIC_SERVER_PORT=8080 # API # 后端 API 基础地址 -# PUBLIC_API_BASE_URL=http://ser369.g3soft.cn:80/api -PUBLIC_API_BASE_URL=http://192.168.5.6:80/api +PUBLIC_API_BASE_URL=http://ser369.g3soft.cn:80/api +# PUBLIC_API_BASE_URL=http://192.168.1.137:80/api PUBLIC_ALIYUN_BUCKET = g3hd diff --git a/code/container-ocr/ocr-vue/components.d.ts b/code/container-ocr/ocr-vue/components.d.ts index 0882878f..52fa9721 100644 --- a/code/container-ocr/ocr-vue/components.d.ts +++ b/code/container-ocr/ocr-vue/components.d.ts @@ -18,6 +18,7 @@ declare module 'vue' { ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] ElDialog: typeof import('element-plus/es')['ElDialog'] ElDivider: typeof import('element-plus/es')['ElDivider'] + ElDrawer: typeof import('element-plus/es')['ElDrawer'] ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] @@ -27,15 +28,23 @@ declare module 'vue' { ElInput: typeof import('element-plus/es')['ElInput'] ElMenu: typeof import('element-plus/es')['ElMenu'] ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] + ElOption: typeof import('element-plus/es')['ElOption'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElPopover: typeof import('element-plus/es')['ElPopover'] ElRadio: typeof import('element-plus/es')['ElRadio'] ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElResult: typeof import('element-plus/es')['ElResult'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] + ElSelect: typeof import('element-plus/es')['ElSelect'] ElSplitter: typeof import('element-plus/es')['ElSplitter'] ElSplitterPanel: typeof import('element-plus/es')['ElSplitterPanel'] ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] + ElSwitch: typeof import('element-plus/es')['ElSwitch'] + ElTable: typeof import('element-plus/es')['ElTable'] + ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] + ElTabPane: typeof import('element-plus/es')['ElTabPane'] + ElTabs: typeof import('element-plus/es')['ElTabs'] + ElText: typeof import('element-plus/es')['ElText'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTree: typeof import('element-plus/es')['ElTree'] G3Column: typeof import('./src/components/g3-table/g3-column.vue')['default'] diff --git a/code/container-ocr/ocr-vue/src/components/g3-container-file/index.vue b/code/container-ocr/ocr-vue/src/components/g3-container-file/index.vue index af963801..df3c7eb5 100644 --- a/code/container-ocr/ocr-vue/src/components/g3-container-file/index.vue +++ b/code/container-ocr/ocr-vue/src/components/g3-container-file/index.vue @@ -26,8 +26,8 @@ import { formatFileSize, getAliyunFileBlob, getFileExtension, - uploadFile, buildPublicUrl, + extractFilePath, } from "@/utils/file"; import { insertFileApi, @@ -150,7 +150,7 @@ async function handleConfirmUpdate() { return; } - updateLoading.value = true; + // updateLoading.value = true; const requestData = [ { @@ -162,20 +162,60 @@ async function handleConfirmUpdate() { subid: updateFile.value.subid, mx_filename: updateFile.value.mx_filename, mx_bz: updateFile.value.mx_bz, + mx_cate_id: updateFile.value.mx_cate_id, }, ], deletes: [], }, ]; + // 检查是否设置了箱门照 + if (updateFile.value.mx_cate_id === "0") { + requestData[0].updates[0].mx_xh = "0"; + + // 检查数据库表其它是否有文件已经设置了箱门照 + const searchCondition = `father = '${props.father}' AND mx_cate_id = '0' AND subid != '${updateFile.value.subid}'`; + const res = await loadDataApi("bf_file", searchCondition, "mx_xh", ["subid", "mx_xh"]); + + if (res.success && res.data.length > 0) { + requestData.push({ + tableName: "bf_file", + keyField: "subid", + inserts: [], + updates: [ + { + subid: res.data[0].subid, + mx_cate_id: "1", + mx_xh: updateFile.value.mx_xh, + }, + ], + deletes: [], + }); + + requestData.push({ + tableName: "b_container", + keyField: "b_id", + inserts: [], + updates: [ + { + b_id: props.father, + b_container_img: extractFilePath(updateFile.value.mx_mapfilename), + }, + ], + deletes: [], + }); + } + } + try { const response = await saveObjectApi(requestData); if (response.success) { - ElMessage.success("文件名更新成功"); - updateFileName(updateFile.value); + ElMessage.success("更新成功"); showUpdateDialog.value = false; + + loadFiles() } } catch (error) { ElMessage.error("更新文件时发生错误"); @@ -247,7 +287,7 @@ async function loadFiles() { } try { - const res = await loadDataApi("bf_file", searchCondition, "mx_xh"); + const res = await loadDataApi("bf_file", searchCondition, "mx_cate_id,mx_xh"); if (res.success) { let datas = res.data.map((item) => { @@ -1065,6 +1105,10 @@ function handleTreeNodeClick(data) {
备注:
+ diff --git a/code/container-ocr/ocr-vue/src/views/container/update-dialog.vue b/code/container-ocr/ocr-vue/src/views/container/update-dialog.vue index b9f3de5d..fce2ee94 100644 --- a/code/container-ocr/ocr-vue/src/views/container/update-dialog.vue +++ b/code/container-ocr/ocr-vue/src/views/container/update-dialog.vue @@ -1,4 +1,7 @@