diff --git a/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/config/WebMvcConfig.java b/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/config/WebMvcConfig.java index 21948f42..b7edcd11 100644 --- a/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/config/WebMvcConfig.java +++ b/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/config/WebMvcConfig.java @@ -2,7 +2,9 @@ package cn.g3soft.config; import cn.g3soft.interceptor.AuthInterceptor; import cn.g3soft.interceptor.DataSourceInterceptor; -import cn.g3soft.interceptor.RequestBodyCacheInterceptor; +import cn.g3soft.interceptor.RequestWrapperFilter; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -11,9 +13,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; public class WebMvcConfig implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(new RequestBodyCacheInterceptor()) - .addPathPatterns("/**"); - registry.addInterceptor(new AuthInterceptor()) .addPathPatterns("/**") .excludePathPatterns( @@ -28,4 +27,13 @@ public class WebMvcConfig implements WebMvcConfigurer { "/error" ); } + + @Bean + public FilterRegistrationBean requestWrapperFilter() { + FilterRegistrationBean registration = new FilterRegistrationBean<>(); + registration.setFilter(new RequestWrapperFilter()); + registration.addUrlPatterns("/*"); + registration.setOrder(1); // 一定要靠前 + return registration; + } } \ No newline at end of file diff --git a/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/exception/GlobalExceptionHandler.java b/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/exception/GlobalExceptionHandler.java index ca21b60d..bdfb5f97 100644 --- a/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/exception/GlobalExceptionHandler.java +++ b/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/exception/GlobalExceptionHandler.java @@ -1,6 +1,5 @@ package cn.g3soft.exception; -import cn.g3soft.interceptor.RequestBodyCacheInterceptor; import cn.g3soft.utils.ExceptionUtils; import cn.g3soft.utils.Result; import lombok.extern.slf4j.Slf4j; @@ -14,9 +13,7 @@ import javax.servlet.http.HttpServletRequest; public class GlobalExceptionHandler { @ExceptionHandler(Exception.class) public Result handleException(Exception ex, HttpServletRequest request) { - String requestBody = RequestBodyCacheInterceptor.getRequestBodyFromThreadLocal(); - - ExceptionDetailInfo info = ExceptionUtils.extractExceptionInfo(ex, requestBody, "cn.g3soft"); + ExceptionDetailInfo info = ExceptionUtils.extractExceptionInfo(ex, request, "cn.g3soft"); log.error("异常发生在 {}#{}({}:{}),ID: {},信息: {}", info.getClassName(), diff --git a/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/interceptor/RequestBodyCacheInterceptor.java b/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/interceptor/RequestBodyCacheInterceptor.java deleted file mode 100644 index 983acd26..00000000 --- a/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/interceptor/RequestBodyCacheInterceptor.java +++ /dev/null @@ -1,60 +0,0 @@ -package cn.g3soft.interceptor; - -import org.springframework.stereotype.Component; -import org.springframework.web.servlet.HandlerInterceptor; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; - -@Component -public class RequestBodyCacheInterceptor implements HandlerInterceptor { - - private static final ThreadLocal requestBodyThreadLocal = new ThreadLocal<>(); - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - // 仅在异常发生时读取请求体 - if (response.isCommitted()) { - return true; - } - - // 缓存请求体到 ThreadLocal - if (isExceptionRequest(request)) { - String requestBody = getRequestBody(request); - requestBodyThreadLocal.set(requestBody); // 将请求体保存到 ThreadLocal - } - - return true; - } - - private boolean isExceptionRequest(HttpServletRequest request) { - // 你可以根据某些条件判断是否需要读取请求体,比如请求头或者请求的 URI - // 这里简单示范,假设在异常时才读取 - return true; // 仅在异常发生时才读取请求体 - } - - private String getRequestBody(HttpServletRequest request) throws IOException { - BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8)); - StringBuilder bodyBuilder = new StringBuilder(); - String line; - while ((line = reader.readLine()) != null) { - bodyBuilder.append(line); - } - return bodyBuilder.toString(); - } - - // 提供获取请求体的方法 - public static String getRequestBodyFromThreadLocal() { - return requestBodyThreadLocal.get(); - } - - @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { - // 清除ThreadLocal中的请求体 - requestBodyThreadLocal.remove(); - } -} \ No newline at end of file diff --git a/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/interceptor/RequestWrapperFilter.java b/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/interceptor/RequestWrapperFilter.java new file mode 100644 index 00000000..b769034f --- /dev/null +++ b/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/interceptor/RequestWrapperFilter.java @@ -0,0 +1,39 @@ +package cn.g3soft.interceptor; + +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.util.ContentCachingRequestWrapper; + +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; + +public class RequestWrapperFilter implements Filter { + private static final int MAX_CACHE_SIZE = 1024 * 50; // 50KB + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { + + HttpServletRequest req = (HttpServletRequest) request; + + String contentType = req.getContentType(); + + // 只处理 JSON,排除文件上传 + if (contentType != null + && contentType.contains("application/json") + && !contentType.contains("multipart/form-data")) { + + ContentCachingRequestWrapper wrapper = + new ContentCachingRequestWrapper(req, MAX_CACHE_SIZE); + + chain.doFilter(wrapper, response); + } else { + chain.doFilter(request, response); + } + } +} \ No newline at end of file diff --git a/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/utils/ExceptionUtils.java b/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/utils/ExceptionUtils.java index b3e32aa9..4dcadbc7 100644 --- a/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/utils/ExceptionUtils.java +++ b/code/container-ocr/ocr-springboot/src/main/java/cn/g3soft/utils/ExceptionUtils.java @@ -3,6 +3,7 @@ package cn.g3soft.utils; import cn.g3soft.exception.ExceptionDetailInfo; import cn.g3soft.utils.uniqueId.idgen.UniqueId; import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.web.util.ContentCachingRequestWrapper; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; @@ -10,10 +11,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; -import java.util.Date; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; +import java.util.*; public class ExceptionUtils { @@ -43,7 +41,6 @@ public class ExceptionUtils { } } - Map parameterMap = request.getParameterMap(); String briefMessage; if (ex.getMessage() != null) { @@ -67,54 +64,38 @@ public class ExceptionUtils { briefMessage = ex.getClass().getSimpleName(); } - String paramJson = null; - // 先尝试从parameterMap获取普通参数 - Map paramMap = new HashMap<>(); - Enumeration paramNames = request.getParameterNames(); - while (paramNames.hasMoreElements()) { - String paramName = paramNames.nextElement(); - paramMap.put(paramName, request.getParameter(paramName)); - } + // ================= 参数获取 ================= + String paramJson = "{}"; - // 如果普通参数为空,尝试读取请求体(用于@RequestBody) - if (paramMap.isEmpty()) { - try { - // 获取请求体内容 - ServletInputStream inputStream = request.getInputStream(); - BufferedReader reader = new BufferedReader( - new InputStreamReader(inputStream, StandardCharsets.UTF_8)); - StringBuilder bodyBuilder = new StringBuilder(); - String line; - while ((line = reader.readLine()) != null) { - bodyBuilder.append(line); + try { + // 1️⃣ URL参数 + Map parameterMap = request.getParameterMap(); + if (!parameterMap.isEmpty()) { + Map simpleMap = new HashMap<>(); + for (Map.Entry entry : parameterMap.entrySet()) { + simpleMap.put(entry.getKey(), Arrays.toString(entry.getValue())); } - String requestBody = bodyBuilder.toString(); + paramJson = JsonUtils.toJson(simpleMap); + } else { + // 2️⃣ Body(重点) + if (request instanceof ContentCachingRequestWrapper) { + ContentCachingRequestWrapper wrapper = + (ContentCachingRequestWrapper) request; - if (!requestBody.isEmpty()) { - // 如果是JSON格式,可以尝试解析 - try { - // 尝试将JSON字符串格式化为可读格式 - ObjectMapper mapper = new ObjectMapper(); - Object jsonObject = mapper.readValue(requestBody, Object.class); - paramJson = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonObject); - } catch (Exception e) { - // 如果不是JSON,直接使用原始字符串 - paramJson = requestBody.length() > 1000 ? - requestBody.substring(0, 1000) + "..." : requestBody; + byte[] buf = wrapper.getContentAsByteArray(); + + if (buf.length > 0) { + String body = new String(buf, StandardCharsets.UTF_8); + + // 截断,防止过长 + paramJson = body.length() > 1000 + ? body.substring(0, 1000) + "..." + : body; } - } else { - paramJson = "{}"; } - } catch (IOException e) { - paramJson = "请求体读取失败: " + e.getMessage(); - } - } else { - // 如果有普通参数,则序列化普通参数 - try { - paramJson = JsonUtils.toJson(paramMap); - } catch (Exception e) { - paramJson = "参数序列化失败: " + e.getMessage(); } + } catch (Exception e) { + paramJson = "参数解析失败: " + e.getMessage(); } return ExceptionDetailInfo.builder() diff --git a/code/container-ocr/ocr-uniapp/test.html b/code/container-ocr/ocr-uniapp/test.html index 6cd9c627..4aeb3d52 100644 --- a/code/container-ocr/ocr-uniapp/test.html +++ b/code/container-ocr/ocr-uniapp/test.html @@ -1,187 +1,110 @@ - + - 数据看板 - - + + 集装箱录入 - - - -
- -
-

数据看板

-
- -
- - -
-
近7天上传趋势
-
-
- - -
- - -
-
操作员上传排行
-
-
- - -
- - -
-
最新上传
- - - - - - - -
箱号操作员时间数量
-
- - -
-
📢 企业公告
-
-
- -
- -
- - -
-
⚠️ 数据异常
-
-
- -
- - - \ No newline at end of file diff --git a/code/container-ocr/ocr-vue/components.d.ts b/code/container-ocr/ocr-vue/components.d.ts index 048a47eb..cdbb6b41 100644 --- a/code/container-ocr/ocr-vue/components.d.ts +++ b/code/container-ocr/ocr-vue/components.d.ts @@ -15,7 +15,6 @@ declare module 'vue' { ElButton: typeof import('element-plus/es')['ElButton'] ElCard: typeof import('element-plus/es')['ElCard'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] - ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] ElDialog: typeof import('element-plus/es')['ElDialog'] ElDivider: typeof import('element-plus/es')['ElDivider'] @@ -34,8 +33,8 @@ declare module 'vue' { 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'] - ElSegmented: typeof import('element-plus/es')['ElSegmented'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSplitter: typeof import('element-plus/es')['ElSplitter'] ElSplitterPanel: typeof import('element-plus/es')['ElSplitterPanel'] @@ -43,13 +42,12 @@ declare module 'vue' { 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'] G3Detail: typeof import('./src/components/g3-detail/index.vue')['default'] + G3Error: typeof import('./src/components/g3-error/index.vue')['default'] G3File: typeof import('./src/components/g3-file/index.vue')['default'] G3Grid: typeof import('./src/components/g3-grid/g3-grid.vue')['default'] G3GridGroup: typeof import('./src/components/g3-grid/g3-grid-group.vue')['default'] diff --git a/code/container-ocr/ocr-vue/src/components/g3-error/index.js b/code/container-ocr/ocr-vue/src/components/g3-error/index.js index fb471875..5bdfe7a0 100644 --- a/code/container-ocr/ocr-vue/src/components/g3-error/index.js +++ b/code/container-ocr/ocr-vue/src/components/g3-error/index.js @@ -1,15 +1,33 @@ import ErrorModal from "./index.vue"; +let isShowingErrorModal = false; +let currentApp = null; + export const ErrorModalService = { show(responseData) { + if (isShowingErrorModal && currentApp) { + currentApp._instance.props.responseData = responseData; + return; + } + + isShowingErrorModal = true; + const container = document.createElement("div"); document.body.appendChild(container); const app = createApp({ + data() { + return { + data: responseData, + }; + }, render() { return h(ErrorModal, { - responseData: responseData, + responseData: this.data, onClose: () => { + isShowingErrorModal = false; + currentApp = null; + app.unmount(); document.body.removeChild(container); }, @@ -17,6 +35,7 @@ export const ErrorModalService = { }, }); + currentApp = app; app.mount(container); }, }; diff --git a/code/container-ocr/ocr-vue/src/components/g3-error/index.vue b/code/container-ocr/ocr-vue/src/components/g3-error/index.vue index 3a391513..69fe1809 100644 --- a/code/container-ocr/ocr-vue/src/components/g3-error/index.vue +++ b/code/container-ocr/ocr-vue/src/components/g3-error/index.vue @@ -2,11 +2,13 @@
- ⚠️ 系统异常提示 - {{ props.responseData.message }} - - {{ props.responseData.code || 500 }}⚠️ 系统异常提示 +
-
{{ item.label }}
-
{{
-              item.value
-            }}
+
+              {{ item.value }}
+            
{{ item.value }}
@@ -48,10 +53,21 @@ - 请将错误信息 导出 或 复制 发送给管理员! + + 请将错误信息 + 导出 + 或 + 复制 + 发送给管理员! +
-
+
- + 导出TXT
-
+
- + 复制信息
-
+
`${item.label}:\n${item.value}\n`).join("\n"); + const content = logList.value + .map((item) => `${item.label}:\n${item.value}\n`) + .join("\n"); const blob = new Blob([content], { type: "text/plain;charset=utf-8" }); const url = URL.createObjectURL(blob); @@ -177,6 +209,8 @@ function copyInfo() {
diff --git a/code/container-ocr/ocr-vue/src/styles/element-plus.scss b/code/container-ocr/ocr-vue/src/styles/element-plus.scss index 2a19075c..a7c09a8f 100644 --- a/code/container-ocr/ocr-vue/src/styles/element-plus.scss +++ b/code/container-ocr/ocr-vue/src/styles/element-plus.scss @@ -30,3 +30,7 @@ } } } + +.el-message { + z-index: 99999 !important; +} diff --git a/code/container-ocr/ocr-vue/src/views/container/index.vue b/code/container-ocr/ocr-vue/src/views/container/index.vue index a5007480..859fda15 100644 --- a/code/container-ocr/ocr-vue/src/views/container/index.vue +++ b/code/container-ocr/ocr-vue/src/views/container/index.vue @@ -56,7 +56,9 @@ const viewName = "v_container"; const showPreview = ref(false); const previewIndex = ref(-1); const previewImageList = computed(() => { - return tableData.value.map((item) => item.b_container_img).filter((img) => img); + return tableData.value + .map((item) => item.b_container_img) + .filter((img) => img); }); const currentRow = ref({}); @@ -189,9 +191,12 @@ async function deleteRows(rows = []) { const safeDeleteIds = deleteIds.map((id) => Number(id)); // 使用安全的 SQL 查询 - const fileRes = await loadDataApi("bf_file", `father IN (${safeDeleteIds.join(",")})`, "", [ - "subid", - ]); + const fileRes = await loadDataApi( + "bf_file", + `father IN (${safeDeleteIds.join(",")})`, + "", + ["subid"], + ); if (!fileRes.success) { return; @@ -267,7 +272,11 @@ async function handleDownloadOne(data) { }); try { - const fileRes = await loadDataApi("bf_file", `father = ${data.b_id}`, "mx_xh asc"); + const fileRes = await loadDataApi( + "bf_file", + `father = ${data.b_id}`, + "mx_xh asc", + ); if (!fileRes.success) { ElMessage.error("获取附件失败"); @@ -275,7 +284,11 @@ async function handleDownloadOne(data) { } const downloadFiles = fileRes.data.map((item, index) => ({ - mx_filename: buildFileName(data.b_container_no, index + 1, item.mx_filename), + mx_filename: buildFileName( + data.b_container_no, + index + 1, + item.mx_filename, + ), mx_mapfilename: item.mx_mapfilename, })); @@ -338,7 +351,11 @@ async function handleDownloadBatch() { // 👉 先统计总文件数(用于进度) for (const item of records) { - const fileRes = await loadDataApi("bf_file", `father = '${item.b_id}'`, ""); + const fileRes = await loadDataApi( + "bf_file", + `father = '${item.b_id}'`, + "", + ); if (fileRes.success) { total += (fileRes.data || []).length; } @@ -350,7 +367,11 @@ async function handleDownloadBatch() { const folder = zip.folder(folderName); - const fileRes = await loadDataApi("bf_file", `father = '${item.b_id}'`, "mx_xh asc"); + const fileRes = await loadDataApi( + "bf_file", + `father = '${item.b_id}'`, + "mx_xh asc", + ); if (!fileRes.success) { ElMessage.error("获取附件失败"); @@ -367,7 +388,8 @@ async function handleDownloadBatch() { const blob = await res.blob(); const fileName = - buildFileName(item.b_container_no, index + 1, file.mx_filename) || "未命名文件"; + buildFileName(item.b_container_no, index + 1, file.mx_filename) || + "未命名文件"; folder.file(fileName, blob); } catch (e) { @@ -432,7 +454,15 @@ function buildFileName(containerNo, index, fileName) { - + @@ -470,7 +500,7 @@ function buildFileName(containerNo, index, fileName) { @@ -534,7 +564,14 @@ function buildFileName(containerNo, index, fileName) { }" height="100%" > - + diff --git a/code/container-ocr/ocr-vue/src/views/home/notice.vue b/code/container-ocr/ocr-vue/src/views/home/notice.vue index e0350e3f..b147b52b 100644 --- a/code/container-ocr/ocr-vue/src/views/home/notice.vue +++ b/code/container-ocr/ocr-vue/src/views/home/notice.vue @@ -9,7 +9,11 @@ const dialogData = ref({}); const showFile = ref(false); onMounted(async () => { - const loadRes = await loadDataApi("oa_notices", ` b_visible='1'`, "b_inputdate desc"); + const loadRes = await loadDataApi( + "v_oa_notices", + ` b_visible='1'`, + "b_inputdatetime desc", + ); if (loadRes.success) { dataList.value = loadRes.data; @@ -31,10 +35,18 @@ function handleShowDialog(data) {
-
+
{{ item.b_subject }}
+ + +
发布人
@@ -45,7 +57,11 @@ function handleShowDialog(data) {
发布时间
- {{ formatToDateTime(dialogData.b_updatedatetime || dialogData.b_inputdatetime) }} + {{ + formatToDateTime( + dialogData.b_updatedatetime || dialogData.b_inputdatetime, + ) + }}
@@ -69,7 +85,12 @@ function handleShowDialog(data) { - + diff --git a/code/container-ocr/ocr-vue/src/views/index.vue b/code/container-ocr/ocr-vue/src/views/index.vue deleted file mode 100644 index 3945bab6..00000000 --- a/code/container-ocr/ocr-vue/src/views/index.vue +++ /dev/null @@ -1,30 +0,0 @@ - - - diff --git a/code/container-ocr/ocr-vue/src/views/system/oa/notice/index.vue b/code/container-ocr/ocr-vue/src/views/system/oa/notice/index.vue index f99abe25..2d6b6d68 100644 --- a/code/container-ocr/ocr-vue/src/views/system/oa/notice/index.vue +++ b/code/container-ocr/ocr-vue/src/views/system/oa/notice/index.vue @@ -2,7 +2,12 @@ import { ElMessage, ElMessageBox } from "element-plus"; import EditDrawer from "./edit-drawer.vue"; import CategoryDialog from "./category-dialog.vue"; -import { loadDataBySqlApi, saveObjectApi } from "@/request/api"; +import { + loadDataApi, + loadDataBySqlApi, + loadPageDataApi, + saveObjectApi, +} from "@/request/api"; const tableRef = ref(null); @@ -15,7 +20,7 @@ const columnData = ref([ { prop: "v_inputuser_name", label: "发布人", width: 120 }, { prop: "b_inputdate", label: "发布日期", width: 140 }, ]); -const treeId = ref(""); +const treeId = ref(-1); const tableData = ref([]); const loading = reactive({ table: false, @@ -24,12 +29,27 @@ const loading = reactive({ error: "", }); +const searchForm = ref({ + username: "", + subject: "", +}); + +const pagination = reactive({ + page: 0, + size: 20, + total: 0, +}); + const defaultProps = { children: "children", label: "label", isLeaf: "leaf", }; +onMounted(() => { + loadTableDatas(); +}); + async function handleNodeClick(node) { if (!node.id) { return; @@ -122,7 +142,8 @@ async function handleEditRow(row) { function handleEditChange() { drawerVisible.value = false; - loadNodeData(treeId.value, "10"); + // loadNodeData(treeId.value, "10"); + loadTableDatas(); } function handleEditClosed() { @@ -130,6 +151,58 @@ function handleEditClosed() { } // ----------------------------------- +function loadTableDatas() { + loading.table = true; + + let searchCondition = ""; + + if (searchForm.value.subject) { + searchCondition += `b_subject LIKE '%${searchForm.value.subject}%' AND `; + } + + if (searchForm.value.username) { + searchCondition += `v_inputuser_name LIKE '%${searchForm.value.username}%' AND `; + } + + if (searchCondition.endsWith(" AND ")) { + searchCondition = searchCondition.slice(0, -4); + } + + loadPageDataApi({ + viewName: "v_oa_notices", + page: pagination.page, + size: pagination.size, + orderField: "b_updatedatetime desc", + searchCondition, + }) + .then((res) => { + if (res.success) { + tableData.value = res.data.rows; + pagination.total = res.data.total; + } + }) + .finally(() => { + loading.table = false; + }); +} + +const handleSizeChange = (val) => { + pagination.size = val; + + loadTableDatas(); +}; +const handleCurrentChange = (val) => { + pagination.page = val; + + loadTableDatas(); +}; + +function handleSearch() { + pagination.page = 1; + + loadTableDatas(); +} + // 删除单行 async function handleDeleteRow(row) { if (!row) return; @@ -182,7 +255,8 @@ async function deleteRows(rows = []) { if (res.success) { ElMessage.success("删除成功"); - loadNodeData(treeId.value, "10"); + // loadNodeData(treeId.value, "10"); + loadTableDatas() } }); } @@ -190,16 +264,16 @@ async function deleteRows(rows = []) {