From da8eb0d5393d93e5bf1c7e08556b972095a463f1 Mon Sep 17 00:00:00 2001 From: ko1234 Date: Wed, 11 Dec 2024 11:55:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A8=AD=E5=82=99=E7=AE=A1=E7=90=86:=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BF=AE=E6=94=B9=E5=88=AA=E9=99=A4=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E9=A1=9E=20|=20=20upload=E7=B5=84=E4=BB=B6=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E8=AA=A4=E8=A7=B8label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/asset/api.js | 5 +- src/apis/asset/index.js | 34 +++++- src/components/customUI/Upload.vue | 2 +- src/config/cn.json | 15 ++- src/config/tw.json | 11 +- src/config/us.json | 13 ++- .../components/AssetMainList.vue | 98 ++++++++++++++--- .../components/AssetMainListAddModal.vue | 103 ++++++++++++++++++ .../components/AssetSubList.vue | 82 ++++++++------ .../components/AssetSubListAddModal.vue | 10 +- .../components/AlertSetting/AlertSubList.vue | 2 +- 11 files changed, 305 insertions(+), 70 deletions(-) create mode 100644 src/views/AssetManagement/components/AssetMainListAddModal.vue diff --git a/src/apis/asset/api.js b/src/apis/asset/api.js index 6c0a0f0..5886180 100644 --- a/src/apis/asset/api.js +++ b/src/apis/asset/api.js @@ -1,5 +1,8 @@ -export const GET_ASSET_SUB_LIST_API = `/AssetManage/GetAssetSubList`; export const GET_ASSET_MAIN_LIST_API = `/AssetManage/GetAssetMainList`; +export const DELETE_ASSET_MAIN_LIST_API = `/AssetManage/DeleteAssetMain`; +export const POST_ASSET_MAIN_LIST_API = `/AssetManage/SaveAssetMain`; + +export const GET_ASSET_SUB_LIST_API = `/AssetManage/GetAssetSubList`; export const POST_ASSET_SUB_LIST_API = `/AssetManage/SaveAssetSub`; export const DELETE_ASSET_SUB_LIST_API = `/AssetManage/DeleteAssetSub`; diff --git a/src/apis/asset/index.js b/src/apis/asset/index.js index d50854b..b9a1e84 100644 --- a/src/apis/asset/index.js +++ b/src/apis/asset/index.js @@ -1,6 +1,8 @@ import { - GET_ASSET_SUB_LIST_API, GET_ASSET_MAIN_LIST_API, + DELETE_ASSET_MAIN_LIST_API, + POST_ASSET_MAIN_LIST_API, + GET_ASSET_SUB_LIST_API, DELETE_ASSET_SUB_LIST_API, POST_ASSET_SUB_LIST_API, GET_ASSET_LIST_API, @@ -17,8 +19,8 @@ import instance from "@/util/request"; import apihandler from "@/util/apihandler"; import { object } from "yup"; -export const getAssetSubList = async (id) => { - const res = await instance.post(GET_ASSET_SUB_LIST_API, { id }); +export const getAssetMainList = async () => { + const res = await instance.post(GET_ASSET_MAIN_LIST_API); return apihandler(res.code, res.data, { msg: res.msg, @@ -26,8 +28,30 @@ export const getAssetSubList = async (id) => { }); }; -export const getAssetMainList = async () => { - const res = await instance.post(GET_ASSET_MAIN_LIST_API); +export const deleteAssetMainItem = async (id) => { + const res = await instance.post(DELETE_ASSET_MAIN_LIST_API, { id }); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; + +export const postAssetMainList = async ({ id, system_key, system_value }) => { + const res = await instance.post(POST_ASSET_MAIN_LIST_API, { + id, + system_key, + system_value, + }); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; + +export const getAssetSubList = async (id) => { + const res = await instance.post(GET_ASSET_SUB_LIST_API, { id }); return apihandler(res.code, res.data, { msg: res.msg, diff --git a/src/components/customUI/Upload.vue b/src/components/customUI/Upload.vue index b5ce62d..37ff0a8 100644 --- a/src/components/customUI/Upload.vue +++ b/src/components/customUI/Upload.vue @@ -142,7 +142,7 @@ const revokeURL = (src) => { diff --git a/src/views/AssetManagement/components/AssetSubListAddModal.vue b/src/views/AssetManagement/components/AssetSubListAddModal.vue index b866adb..7cf4ef4 100644 --- a/src/views/AssetManagement/components/AssetSubListAddModal.vue +++ b/src/views/AssetManagement/components/AssetSubListAddModal.vue @@ -2,9 +2,11 @@ import { ref, defineProps, onMounted, watch } from "vue"; import * as yup from "yup"; import useFormErrorMessage from "@/hooks/useFormErrorMessage"; +import useSearchParam from "@/hooks/useSearchParam"; import { getAssetMainList, postAssetSubList } from "@/apis/asset"; import { useI18n } from "vue-i18n"; const { t } = useI18n(); +const { searchParams, changeParams } = useSearchParam(); const props = defineProps({ openModal: Function, onCancel: Function, @@ -66,19 +68,19 @@ const onOk = async () => { }); if (res.isSuccess) { - props.getData(); + props.getData(parseInt(searchParams.value.mainSys_id)); props.onCancel(); } };