Files
orico-officialWebsite-ts-admin/src/views/webManagement/commodity/utils/edit/reset.ts

23 lines
832 B
TypeScript

import { getProductDetailsApi } from "@/api/modules/productList";
import { useMsg } from "@/hooks/useMsg";
import { messageBox } from "@/utils/messageBox";
// import { cloneDeep } from "lodash-es";
import { initDetailParams } from "./initDetailParams";
//详情(重置,重新获取一下详情)
const getProductDetails = async (dataStore: any, editorRef: any) => {
const { id } = dataStore.basicInfoRuleForm;
const result = await getProductDetailsApi(id);
if (result?.code === 0) {
const { data } = result;
initDetailParams(dataStore, data, editorRef);
useMsg("success", "重置成功 !");
}
};
export const handleReset = (dataStore: any, editorRef?: any) => {
messageBox("该操作会将数据重置为初始状态", () => {
getProductDetails(dataStore, editorRef);
});
};