fix: 🧩 修复BUG
This commit is contained in:
@@ -16,7 +16,6 @@ export const getProductAttrDelApi = (params: any) => {
|
||||
// 产品属性更新
|
||||
export const getProductAttrUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
|
||||
return http.put<any>(`${PRODUCT_ATTR}/update/${id}`, params);
|
||||
};
|
||||
//产品属性新增
|
||||
|
||||
@@ -23,3 +23,8 @@ export const getProductBuypassUpdateApi = (params: any) => {
|
||||
const { id, param } = params;
|
||||
return http.put<any>(`${PRODUCT_BUYPASS}/update/${id}`, param);
|
||||
};
|
||||
|
||||
//新增
|
||||
export const getProductBuypassListSaveApi = (params: any) => {
|
||||
return http.post<any>(`${PRODUCT_BUYPASS}/save`, params);
|
||||
};
|
||||
|
||||
@@ -54,14 +54,7 @@ const dataStore = reactive<any>({
|
||||
editRuleForm: cloneDeep(EDIT_RULE_FORM),
|
||||
editFormData: cloneDeep(EDIT_FORM_DATA) //抽屉表单配置项
|
||||
});
|
||||
//新增
|
||||
const getArticleListAddSave = async () => {
|
||||
const result = await getArticleListAddSaveApi(dataStore.editRuleForm);
|
||||
if (result.code === 0) {
|
||||
const { msg } = result;
|
||||
useMsg("success", msg);
|
||||
}
|
||||
};
|
||||
|
||||
//文章分类
|
||||
const getArticleClassData = async () => {
|
||||
const result = await getArticleClassDataApi();
|
||||
@@ -89,8 +82,38 @@ const getArticleListDetails = async () => {
|
||||
console.log(data);
|
||||
}
|
||||
};
|
||||
|
||||
const convertDateFormat = (dateString: any) => {
|
||||
const date = new Date(dateString);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
const hours = String(date.getHours()).padStart(2, "0");
|
||||
const minutes = String(date.getMinutes()).padStart(2, "0");
|
||||
const seconds = String(date.getSeconds()).padStart(2, "0");
|
||||
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
};
|
||||
//新增
|
||||
const getArticleListAddSave = async () => {
|
||||
if (dataStore.editRuleForm.release_time) {
|
||||
dataStore.editRuleForm.release_time = convertDateFormat(dataStore.editRuleForm.release_time);
|
||||
} else {
|
||||
dataStore.editRuleForm.release_time = null;
|
||||
}
|
||||
const result = await getArticleListAddSaveApi(dataStore.editRuleForm);
|
||||
if (result.code === 0) {
|
||||
const { msg } = result;
|
||||
useMsg("success", msg);
|
||||
}
|
||||
};
|
||||
//更新
|
||||
const getArticleListUp = async () => {
|
||||
if (dataStore.editRuleForm.release_time) {
|
||||
dataStore.editRuleForm.release_time = convertDateFormat(dataStore.editRuleForm.release_time);
|
||||
} else {
|
||||
dataStore.editRuleForm.release_time = null;
|
||||
}
|
||||
const result = await getArticleListUpApi({ id: $route.query.id, ...dataStore.editRuleForm });
|
||||
|
||||
if (result?.code === 0) {
|
||||
|
||||
@@ -105,6 +105,10 @@ const getProductAttrUp = async () => {
|
||||
if (obj.prop_name) {
|
||||
dataStore.editRuleForm.props.push(obj);
|
||||
}
|
||||
|
||||
let dataClone = cloneDeep(dataStore.editRuleForm.props);
|
||||
let props = JSON.stringify([...dataClone]);
|
||||
dataStore.editRuleForm.props = props;
|
||||
const result = await getProductAttrUpApi(dataStore.editRuleForm);
|
||||
if (result?.code === 0) {
|
||||
useMsg("success", result?.msg);
|
||||
|
||||
@@ -63,6 +63,7 @@ import { useUserStore } from "@/stores/modules/user";
|
||||
//列表接口
|
||||
// getProductBuypassListImportApi
|
||||
import {
|
||||
getProductBuypassListSaveApi,
|
||||
getProductBuypassListApi,
|
||||
getProductPlatformsListApi,
|
||||
getProductBuypassListExportApi,
|
||||
@@ -92,53 +93,22 @@ const dataStore = reactive<any>({
|
||||
ruleForm: cloneDeep(RULE_FORM), // 搜索參數
|
||||
formData: FORM_DATA //搜索配置项
|
||||
});
|
||||
|
||||
//添加
|
||||
const getProductBuypassListSave = async (params: any) => {
|
||||
const result = await getProductBuypassListSaveApi(params);
|
||||
if (result?.code === 0) {
|
||||
// proTableRef?.value?.getTableList();
|
||||
// console.log(result?.data);
|
||||
}
|
||||
};
|
||||
//更新
|
||||
const getProductBuypassUpdate = async (params: any) => {
|
||||
const result = await getProductBuypassUpdateApi(params);
|
||||
if (result?.code === 0) {
|
||||
console.log(result?.data);
|
||||
} else {
|
||||
// console.log(result?.data);
|
||||
}
|
||||
};
|
||||
// const handleChange=()=>{
|
||||
|
||||
// }
|
||||
|
||||
// const up=(it: any, scope: any, itIndex: any)=>{
|
||||
// const { link, platform_name, link_id } = it;
|
||||
// let is = scope.row.rowspan.some((item: any, index: number) => {
|
||||
// if (index !== itIndex && item.platform_name === platform_name) {
|
||||
// return true;
|
||||
// }
|
||||
// });
|
||||
// if (is) {
|
||||
// useMsg("warning", "同型号平台不能重复 !");
|
||||
// return;
|
||||
// }
|
||||
// if (!platform_name) {
|
||||
// useMsg("warning", "平台不能为空 !");
|
||||
// return;
|
||||
// }
|
||||
// if (!link) {
|
||||
// useMsg("warning", "链接不能为空 !");
|
||||
// return;
|
||||
// }
|
||||
// //获取ID
|
||||
// let platform_id: any = null;
|
||||
// dataStore.options.forEach((item: any) => {
|
||||
// if (item.platform === platform_name) {
|
||||
// platform_id = item.id;
|
||||
// }
|
||||
// });
|
||||
// getProductBuypassUpdate({
|
||||
// id: link_id,
|
||||
// param: {
|
||||
// platform_id,
|
||||
// link
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//输入框失焦
|
||||
const handleInputOrChange = (it: any, scope: any, itIndex: any) => {
|
||||
const { link, platform_name, link_id } = it;
|
||||
@@ -166,13 +136,25 @@ const handleInputOrChange = (it: any, scope: any, itIndex: any) => {
|
||||
platform_id = item.id;
|
||||
}
|
||||
});
|
||||
getProductBuypassUpdate({
|
||||
id: link_id,
|
||||
param: {
|
||||
platform_id,
|
||||
link
|
||||
}
|
||||
});
|
||||
//更新
|
||||
if (link_id) {
|
||||
getProductBuypassListSave({
|
||||
id: link_id,
|
||||
param: {
|
||||
platform_id,
|
||||
link
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//添加
|
||||
getProductBuypassUpdate({
|
||||
id: link_id,
|
||||
param: {
|
||||
platform_id,
|
||||
link
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//平台
|
||||
const getProductPlatformsList = async () => {
|
||||
|
||||
Reference in New Issue
Block a user