fix: 🧩 修复BUG
This commit is contained in:
@@ -16,7 +16,6 @@ export const getProductAttrDelApi = (params: any) => {
|
|||||||
// 产品属性更新
|
// 产品属性更新
|
||||||
export const getProductAttrUpApi = (params: any) => {
|
export const getProductAttrUpApi = (params: any) => {
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
|
|
||||||
return http.put<any>(`${PRODUCT_ATTR}/update/${id}`, params);
|
return http.put<any>(`${PRODUCT_ATTR}/update/${id}`, params);
|
||||||
};
|
};
|
||||||
//产品属性新增
|
//产品属性新增
|
||||||
|
|||||||
@@ -23,3 +23,8 @@ export const getProductBuypassUpdateApi = (params: any) => {
|
|||||||
const { id, param } = params;
|
const { id, param } = params;
|
||||||
return http.put<any>(`${PRODUCT_BUYPASS}/update/${id}`, param);
|
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),
|
editRuleForm: cloneDeep(EDIT_RULE_FORM),
|
||||||
editFormData: cloneDeep(EDIT_FORM_DATA) //抽屉表单配置项
|
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 getArticleClassData = async () => {
|
||||||
const result = await getArticleClassDataApi();
|
const result = await getArticleClassDataApi();
|
||||||
@@ -89,8 +82,38 @@ const getArticleListDetails = async () => {
|
|||||||
console.log(data);
|
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 () => {
|
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 });
|
const result = await getArticleListUpApi({ id: $route.query.id, ...dataStore.editRuleForm });
|
||||||
|
|
||||||
if (result?.code === 0) {
|
if (result?.code === 0) {
|
||||||
|
|||||||
@@ -105,6 +105,10 @@ const getProductAttrUp = async () => {
|
|||||||
if (obj.prop_name) {
|
if (obj.prop_name) {
|
||||||
dataStore.editRuleForm.props.push(obj);
|
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);
|
const result = await getProductAttrUpApi(dataStore.editRuleForm);
|
||||||
if (result?.code === 0) {
|
if (result?.code === 0) {
|
||||||
useMsg("success", result?.msg);
|
useMsg("success", result?.msg);
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ import { useUserStore } from "@/stores/modules/user";
|
|||||||
//列表接口
|
//列表接口
|
||||||
// getProductBuypassListImportApi
|
// getProductBuypassListImportApi
|
||||||
import {
|
import {
|
||||||
|
getProductBuypassListSaveApi,
|
||||||
getProductBuypassListApi,
|
getProductBuypassListApi,
|
||||||
getProductPlatformsListApi,
|
getProductPlatformsListApi,
|
||||||
getProductBuypassListExportApi,
|
getProductBuypassListExportApi,
|
||||||
@@ -92,53 +93,22 @@ const dataStore = reactive<any>({
|
|||||||
ruleForm: cloneDeep(RULE_FORM), // 搜索參數
|
ruleForm: cloneDeep(RULE_FORM), // 搜索參數
|
||||||
formData: FORM_DATA //搜索配置项
|
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 getProductBuypassUpdate = async (params: any) => {
|
||||||
const result = await getProductBuypassUpdateApi(params);
|
const result = await getProductBuypassUpdateApi(params);
|
||||||
if (result?.code === 0) {
|
if (result?.code === 0) {
|
||||||
console.log(result?.data);
|
// console.log(result?.data);
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// 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 handleInputOrChange = (it: any, scope: any, itIndex: any) => {
|
||||||
const { link, platform_name, link_id } = it;
|
const { link, platform_name, link_id } = it;
|
||||||
@@ -166,13 +136,25 @@ const handleInputOrChange = (it: any, scope: any, itIndex: any) => {
|
|||||||
platform_id = item.id;
|
platform_id = item.id;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
getProductBuypassUpdate({
|
//更新
|
||||||
id: link_id,
|
if (link_id) {
|
||||||
param: {
|
getProductBuypassListSave({
|
||||||
platform_id,
|
id: link_id,
|
||||||
link
|
param: {
|
||||||
}
|
platform_id,
|
||||||
});
|
link
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
//添加
|
||||||
|
getProductBuypassUpdate({
|
||||||
|
id: link_id,
|
||||||
|
param: {
|
||||||
|
platform_id,
|
||||||
|
link
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
//平台
|
//平台
|
||||||
const getProductPlatformsList = async () => {
|
const getProductPlatformsList = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user