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(); } };