From 5ed09341d1e72fa58a6dc4c31a5a5fd43a35caff Mon Sep 17 00:00:00 2001 From: yangchunlong <292345300@qq.com> Date: Wed, 12 Aug 2026 17:31:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=9A=80=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/compatibility.ts | 8 +++ src/components.d.ts | 9 --- .../compatibility/constant/edit.ts | 62 +++++-------------- .../compatibility/constant/rules.ts | 7 ++- .../compatibility/constant/search.ts | 24 +++---- .../compatibility/constant/table.ts | 39 +++++++----- .../productManagement/compatibility/index.vue | 33 +++++++++- 7 files changed, 97 insertions(+), 85 deletions(-) diff --git a/src/api/modules/compatibility.ts b/src/api/modules/compatibility.ts index 44a1b01..131be66 100644 --- a/src/api/modules/compatibility.ts +++ b/src/api/modules/compatibility.ts @@ -36,3 +36,11 @@ export const getCompatUpExportApi = (params: any) => { export const getCompatImportApi = (params: any) => { return http.post(`${BASE}/import`, params); }; +//配件類型 +export const getPartsListApi = (params: any) => { + return http.get(`${BASE}/parts/list`, params); +}; +//產品類型 +export const getTypesListApi = (params: any) => { + return http.get(`${BASE}/types/list`, params); +}; diff --git a/src/components.d.ts b/src/components.d.ts index 18b47a5..cf2e9c1 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -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"]; } } diff --git a/src/views/productManagement/compatibility/constant/edit.ts b/src/views/productManagement/compatibility/constant/edit.ts index 66461c0..aea482e 100644 --- a/src/views/productManagement/compatibility/constant/edit.ts +++ b/src/views/productManagement/compatibility/constant/edit.ts @@ -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: "是", diff --git a/src/views/productManagement/compatibility/constant/rules.ts b/src/views/productManagement/compatibility/constant/rules.ts index b24b9ba..b24c83b 100644 --- a/src/views/productManagement/compatibility/constant/rules.ts +++ b/src/views/productManagement/compatibility/constant/rules.ts @@ -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" }] }; diff --git a/src/views/productManagement/compatibility/constant/search.ts b/src/views/productManagement/compatibility/constant/search.ts index eada64b..09b8fe4 100644 --- a/src/views/productManagement/compatibility/constant/search.ts +++ b/src/views/productManagement/compatibility/constant/search.ts @@ -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, diff --git a/src/views/productManagement/compatibility/constant/table.ts b/src/views/productManagement/compatibility/constant/table.ts index a0a9f14..d4cde79 100644 --- a/src/views/productManagement/compatibility/constant/table.ts +++ b/src/views/productManagement/compatibility/constant/table.ts @@ -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 } ]; diff --git a/src/views/productManagement/compatibility/index.vue b/src/views/productManagement/compatibility/index.vue index 8b5669b..dc8379a 100644 --- a/src/views/productManagement/compatibility/index.vue +++ b/src/views/productManagement/compatibility/index.vue @@ -3,8 +3,8 @@
添加 - 导出 导入 + 导出
({ 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;