feat: 🚀 接口联调

This commit is contained in:
2026-08-12 17:31:50 +08:00
parent 21b56d186e
commit 5ed09341d1
7 changed files with 97 additions and 85 deletions

View File

@@ -36,3 +36,11 @@ export const getCompatUpExportApi = (params: any) => {
export const getCompatImportApi = (params: any) => {
return http.post<any>(`${BASE}/import`, params);
};
//配件類型
export const getPartsListApi = (params: any) => {
return http.get<any>(`${BASE}/parts/list`, params);
};
//產品類型
export const getTypesListApi = (params: any) => {
return http.get<any>(`${BASE}/types/list`, params);
};

9
src/components.d.ts vendored
View File

@@ -12,11 +12,6 @@ declare module "vue" {
ElBreadcrumb: typeof import("element-plus/es")["ElBreadcrumb"];
ElBreadcrumbItem: typeof import("element-plus/es")["ElBreadcrumbItem"];
ElButton: typeof import("element-plus/es")["ElButton"];
ElCarousel: typeof import("element-plus/es")["ElCarousel"];
ElCarouselItem: typeof import("element-plus/es")["ElCarouselItem"];
ElCheckbox: typeof import("element-plus/es")["ElCheckbox"];
ElCheckboxGroup: typeof import("element-plus/es")["ElCheckboxGroup"];
ElColorPicker: typeof import("element-plus/es")["ElColorPicker"];
ElContainer: typeof import("element-plus/es")["ElContainer"];
ElDatePicker: typeof import("element-plus/es")["ElDatePicker"];
ElDialog: typeof import("element-plus/es")["ElDialog"];
@@ -38,7 +33,6 @@ declare module "vue" {
ElOption: typeof import("element-plus/es")["ElOption"];
ElPagination: typeof import("element-plus/es")["ElPagination"];
ElRadio: typeof import("element-plus/es")["ElRadio"];
ElRadioButton: typeof import("element-plus/es")["ElRadioButton"];
ElRadioGroup: typeof import("element-plus/es")["ElRadioGroup"];
ElScrollbar: typeof import("element-plus/es")["ElScrollbar"];
ElSelect: typeof import("element-plus/es")["ElSelect"];
@@ -49,8 +43,6 @@ declare module "vue" {
ElTabPane: typeof import("element-plus/es")["ElTabPane"];
ElTabs: typeof import("element-plus/es")["ElTabs"];
ElTag: typeof import("element-plus/es")["ElTag"];
ElTooltip: typeof import("element-plus/es")["ElTooltip"];
ElTree: typeof import("element-plus/es")["ElTree"];
ElTreeSelect: typeof import("element-plus/es")["ElTreeSelect"];
ElUpload: typeof import("element-plus/es")["ElUpload"];
IEpArrowDown: typeof import("~icons/ep/arrow-down")["default"];
@@ -62,6 +54,5 @@ declare module "vue" {
IEpSwitchButton: typeof import("~icons/ep/switch-button")["default"];
RouterLink: typeof import("vue-router")["RouterLink"];
RouterView: typeof import("vue-router")["RouterView"];
RulesForm: typeof import("./components/rulesForm/index.vue")["default"];
}
}

View File

@@ -19,95 +19,65 @@ interface FormItem {
}
export const EDIT_FORM_DATA: FormItem[] = [
{
prop: "category_id1",
prop: "type_id",
placeholder: "请选择",
type: "select",
label: "产品类型: ",
options: [
{
value: 1,
label: "私有云NAS"
},
{
value: 2,
label: "直连存储DAS"
}
]
options: []
},
{
prop: "desc",
prop: "brand_name",
placeholder: "请输入",
type: "input",
label: "品牌: "
},
{
prop: "desc",
prop: "model",
placeholder: "请输入",
type: "input",
label: "市场型号: "
label: "型号: "
},
{
prop: "category_id1",
prop: "part_id",
placeholder: "请选择",
type: "select",
label: "配件类型: ",
options: [
{
value: 1,
label: "机械硬盘"
},
{
value: 2,
label: "2.5寸固态硬盘"
},
{
value: 3,
label: "M.2固态硬盘"
},
{
value: 4,
label: "内存条"
},
{
value: 5,
label: "UPS不间断电源"
}
]
options: []
},
{
prop: "desc",
prop: "level_name",
placeholder: "请输入",
type: "input",
label: "级别: "
},
{
prop: "desc",
prop: "spec_name",
placeholder: "请输入",
type: "input",
label: "规格: "
},
{
prop: "desc",
prop: "series_name",
placeholder: "请输入",
type: "input",
label: "系列: "
},
{
prop: "desc",
prop: "capacity",
placeholder: "请输入",
type: "input",
label: "容量: "
},
{
prop: "desc",
prop: "frequency",
placeholder: "请输入",
type: "input",
label: "频率: "
},
{
prop: "desc",
placeholder: "请输入",
prop: "compatible_models",
placeholder: "请输入(多个以英文逗号分隔)",
type: "input",
label: "兼容型号: "
},
@@ -118,10 +88,10 @@ export const EDIT_FORM_DATA: FormItem[] = [
label: "排序: "
},
{
prop: "recommend",
prop: "disabled",
placeholder: "请输入",
type: "radio",
label: "首页启用: ",
label: "是否启用: ",
options: [
{
label: "是",

View File

@@ -1,5 +1,8 @@
export const RULES = {
name: [{ required: true, message: "视频名称不能为空 ! ", trigger: "blur" }],
category_id1: [{ required: true, message: "视频分类不能为空 ! ", trigger: "blur" }],
type_id: [{ required: true, message: "产品类型不能为空 ! ", trigger: "change" }],
brand_name: [{ required: true, message: "品牌不能为空 ! ", trigger: "blur" }],
model: [{ required: true, message: "型号不能为空 ! ", trigger: "blur" }],
part_id: [{ required: true, message: "配件类型不能为空 ! ", trigger: "change" }],
compatible_models: [{ required: true, message: "型号不能为空 ! ", trigger: "blur" }],
sort: [{ required: true, message: "视频排序不能为空 ! ", trigger: "blur" }]
};

View File

@@ -17,35 +17,37 @@ interface FormItem {
}
export const FORM_DATA: FormItem[] = [
{
prop: "name",
prop: "compatible_model",
placeholder: "请输入",
type: "input",
isArray: true,
label: "兼容型号: "
},
{
prop: "name",
prop: "model",
placeholder: "请输入",
type: "input",
isArray: true,
label: "型号: "
},
{
prop: "name",
prop: "type_id",
placeholder: "请输入",
type: "input",
isArray: true,
label: "产品类型: "
type: "select",
// isArray: true,
label: "产品类型: ",
options: []
},
{
prop: "name",
prop: "part_id",
placeholder: "请输入",
type: "input",
isArray: true,
label: "配件类型: "
type: "select",
// isArray: true,
label: "配件类型: ",
options: []
},
{
prop: "name",
prop: "brand_name",
placeholder: "请输入",
type: "input",
isArray: true,

View File

@@ -10,73 +10,82 @@ export const COLUMNS = [
{
align: "left",
label: "产品类型",
prop: "name",
fixed: true
prop: "type_name",
fixed: true,
width: 200
},
{
align: "left",
label: "品牌",
prop: "category_name"
prop: "brand_name",
width: 200
},
{
align: "left",
label: "型号",
prop: "category_name"
prop: "model",
width: 200
},
{
align: "left",
label: "配件类型",
prop: "category_name"
prop: "part_name",
width: 200
},
{
align: "left",
label: "级别",
prop: "category_name"
prop: "level_name"
},
{
align: "left",
label: "规格",
prop: "category_name"
prop: "spec_name",
width: 200
},
{
align: "left",
label: "系列",
prop: "category_name"
prop: "series_name",
width: 200
},
{
align: "left",
label: "容量",
prop: "category_name"
prop: "capacity"
},
{
align: "left",
label: "频率",
prop: "category_name"
prop: "frequency"
},
{
align: "left",
label: "兼容型号",
prop: "category_name"
prop: "compatible_models",
width: 200
},
{
align: "left",
label: "点赞数",
prop: "category_name"
prop: "like_count"
},
{
align: "left",
label: "排序",
prop: "category_name"
prop: "sort"
},
{
align: "left",
label: "创建时间",
prop: "created_at"
prop: "created_at",
width: 200
},
{
align: "left",
label: "更新时间",
prop: "created_at"
prop: "updated_at",
width: 200
},
{ prop: "operation", label: "操作", fixed: "right", width: 200 }
];

View File

@@ -3,8 +3,8 @@
<div class="table-box">
<div style="padding-bottom: 16px">
<el-button type="primary" @click="handleAdd"> 添加 </el-button>
<el-button type="primary" @click="handleExport"> 导出 </el-button>
<el-button type="primary" @click="handleImport"> 导入 </el-button>
<el-button type="primary" @click="handleExport"> 导出 </el-button>
</div>
<ProTable
ref="proTableRef"
@@ -72,7 +72,9 @@ import {
getCompatSaveApi,
getCompatUpApi,
getCompatUpExportApi,
getCompatImportApi
getCompatImportApi,
getPartsListApi,
getTypesListApi
} from "@/api/modules/compatibility";
//深拷贝方法
@@ -100,6 +102,33 @@ const dataStore = reactive<any>({
selectRow: {} //当前选择的row
});
//配件類型
const getPartsList = async (id: any) => {
const result = await getPartsListApi(id);
if (result?.code === 0) {
let data = [];
result?.data?.forEach((item: any) => {
data.push({ value: item.id, label: item.name });
});
dataStore.formData[3].options = data;
dataStore.editFormData[3].options = data;
}
};
getPartsList();
//產品類型
const getTypesList = async (id: any) => {
const result = await getTypesListApi(id);
if (result?.code === 0) {
let data = [];
result?.data?.forEach((item: any) => {
data.push({ value: item.id, label: item.name });
});
dataStore.formData[2].options = data;
dataStore.editFormData[0].options = data;
}
};
getTypesList();
//抽屉确认
const handleConfirmClick = () => {
if (!formRef.value!.ruleFormRef) return;