diff --git a/code/web/regulatory-management-util/.env.development b/code/web/regulatory-management-util/.env.development index 00f8005..60ad21f 100644 --- a/code/web/regulatory-management-util/.env.development +++ b/code/web/regulatory-management-util/.env.development @@ -18,4 +18,6 @@ VITE_APP_CACHE_ENABLED=true #上传文件 VITE_APP_URL_UPLOAD_FILE=http://222.76.244.118:8081/RegulatoryManagementBackend/file/file-upload.do VITE_APP_URL_MOVE_FILE=http://222.76.244.118:8081/RegulatoryManagementBackend/file/move-file.do +# 添加新制度库 +VITE_APP_URL_ADD_NEW_REGULATORY=http://localhost:8080/RegulatoryManagementBackend/regulatory/add-new-regulatory.do VITE_APP_URL_PREFIX=http://222.76.244.118:8081/RegulatoryManagementBackend/ \ No newline at end of file diff --git a/code/web/regulatory-management-util/package-lock.json b/code/web/regulatory-management-util/package-lock.json index 9f2d469..c4272a8 100644 --- a/code/web/regulatory-management-util/package-lock.json +++ b/code/web/regulatory-management-util/package-lock.json @@ -1702,6 +1702,7 @@ "integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/lodash": "*" } @@ -1712,6 +1713,7 @@ "integrity": "sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "undici-types": "~7.16.0" } @@ -1758,6 +1760,7 @@ "integrity": "sha512-3xP4XzzDNQOIqBMWogftkwxhg5oMKApqY0BAflmLZiFYHqyhSOxv/cd/zPQLTcCXr4AkaKb25joocY0BD1WC6A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.51.0", "@typescript-eslint/types": "8.51.0", @@ -2242,6 +2245,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2720,6 +2724,7 @@ "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -3434,14 +3439,16 @@ "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/lodash-es": { "version": "4.17.22", "resolved": "https://registry.npmmirror.com/lodash-es/-/lodash-es-4.17.22.tgz", "integrity": "sha512-XEawp1t0gxSi9x01glktRZ5HDy0HXqrM0x5pXQM98EaI0NxO6jVM7omDOxsuEo5UIASAnm2bRp1Jt/e0a2XU8Q==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/lodash-unified": { "version": "1.0.3", @@ -3913,6 +3920,7 @@ "integrity": "sha512-uf6HoO8fy6ClsrShvMgaKUn14f2EHQLQRtpsZZLeU/Mv0Q1K5P0+x2uvH6Cub39TVVbWNSrraUhDAoFph6vh0A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "chokidar": "^4.0.0", "immutable": "^5.0.2", @@ -4073,6 +4081,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "devOptional": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -4121,6 +4130,7 @@ "integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", @@ -4202,6 +4212,7 @@ "resolved": "https://registry.npmmirror.com/vue/-/vue-3.5.26.tgz", "integrity": "sha512-SJ/NTccVyAoNUJmkM9KUqPcYlY+u8OVL1X5EW9RIs3ch5H2uERxyyIUI4MRxVCSOiEcupX9xNGde1tL9ZKpimA==", "license": "MIT", + "peer": true, "dependencies": { "@vue/compiler-dom": "3.5.26", "@vue/compiler-sfc": "3.5.26", @@ -4225,6 +4236,7 @@ "dev": true, "hasInstallScript": true, "license": "MIT", + "peer": true, "bin": { "vue-demi-fix": "bin/vue-demi-fix.js", "vue-demi-switch": "bin/vue-demi-switch.js" @@ -4251,6 +4263,7 @@ "integrity": "sha512-CydUvFOQKD928UzZhTp4pr2vWz1L+H99t7Pkln2QSPdvmURT0MoC4wUccfCnuEaihNsu9aYYyk+bep8rlfkUXw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "debug": "^4.4.0", "eslint-scope": "^8.2.0", diff --git a/code/web/regulatory-management-util/src/utils/config.ts b/code/web/regulatory-management-util/src/utils/config.ts index d1c3fc4..6623e1f 100644 --- a/code/web/regulatory-management-util/src/utils/config.ts +++ b/code/web/regulatory-management-util/src/utils/config.ts @@ -12,6 +12,7 @@ const API_URL= { URL_UPLOAD_FILE: import.meta.env.VITE_APP_URL_UPLOAD_FILE, URL_MOVE_FILE: import.meta.env.VITE_APP_URL_MOVE_FILE, URL_PREFIX: import.meta.env.VITE_APP_URL_PREFIX, + URL_ADD_NEW_REGULATORY: import.meta.env.VITE_APP_URL_ADD_NEW_REGULATORY, }; console.log( API_URL ); diff --git a/code/web/regulatory-management-util/src/utils/regulatory_utils.ts b/code/web/regulatory-management-util/src/utils/regulatory_utils.ts index dccc696..8ed69b3 100644 --- a/code/web/regulatory-management-util/src/utils/regulatory_utils.ts +++ b/code/web/regulatory-management-util/src/utils/regulatory_utils.ts @@ -18,14 +18,56 @@ interface AddNewRegulatoryResponse message: string; } -/** - * - * @param regulatory - * @param render 回调函数,请求成功后调用。 - */ -function addNewRegulatory( regulatory: RegulatoryData, render: any ): void -{ - const url = API_URL.URL_UPLOAD_FILE; +interface Render { + ( resonse: AddNewRegulatoryResponse ) :void, } -export {addNewRegulatory, type AddNewRegulatoryResponse}; \ No newline at end of file +/** + * + * @param regulatory RegulatoryData类型制度对象,用于发送请求。 + * @param render 回调函数,请求成功后调用。 + */ +function addNewRegulatory( regulatory: RegulatoryData, render: Render ): void +{ + // const url = API_URL.URL_ADD_NEW_REGULATORY; + + // 响应对象 + const resp: AddNewRegulatoryResponse = { + success: false, + message: "", + }; + + service.request({ + method:"post", + url: API_URL.URL_ADD_NEW_REGULATORY, + data: regulatory, + }) + .then(( response ):void=> + { + const data = response.data ?? {}; + + resp.success = data.success ?? false; + resp.message = data.message ?? "服务器没有返回调用结果消息,请检查日志!"; + + if ( render !== undefined ) + { + render( resp ); + } + }) + .catch(( error ): void=> + { + resp.success = false; + resp.message = String( error ); + + if ( render !== undefined ) + { + render( resp ); + } + }); +} + +export { + addNewRegulatory, + type AddNewRegulatoryResponse, + type Render +}; \ No newline at end of file diff --git a/code/web/regulatory-management-util/src/views/console/data/NewRegulatory.vue b/code/web/regulatory-management-util/src/views/console/data/NewRegulatory.vue index 4b851b1..410a1c1 100644 --- a/code/web/regulatory-management-util/src/views/console/data/NewRegulatory.vue +++ b/code/web/regulatory-management-util/src/views/console/data/NewRegulatory.vue @@ -162,7 +162,8 @@ Copyright © CPIC All rights reserved