Browse Source

feat(pl): show brand constraint on plan product rows

Co-authored-by: Cursor <cursoragent@cursor.com>
zlwu 3 months ago
parent
commit
c35627d60a

+ 3 - 0
backend/app/schemas/pl/plan.py

@@ -17,6 +17,9 @@ class PlanProductBase(BaseModel):
     product_id: str = Field(..., alias="productId", description="产品ID")
     product_no: str = Field(..., max_length=50, alias="productNo", description="产品编号")
     product_name: str = Field(..., max_length=200, alias="productName", description="产品名称")
+    brand_mode: Optional[str] = Field(default=None, alias="brandMode", description="required/any")
+    brand_id: Optional[str] = Field(default=None, alias="brandId", description="指定品牌ID")
+    brand_name: Optional[str] = Field(default=None, alias="brandName", description="品牌名快照")
     model: Optional[str] = Field(default=None, max_length=100, description="规格型号")
     unit: str = Field(default="吨", max_length=20, description="单位")
     category_name: Optional[str] = Field(default=None, max_length=200, alias="categoryName", description="产品分类")

+ 3 - 0
backend/app/services/pl_plan_service.py

@@ -115,6 +115,9 @@ def build_plan_product(
         product_id=prod.product_id,
         product_no=prod.product_no,
         product_name=prod.product_name,
+        brand_mode=prod.brand_mode,
+        brand_id=prod.brand_id,
+        brand_name=prod.brand_name,
         model=prod.model,
         unit=prod.unit or "吨",
         category_name=prod.category_name,

+ 3 - 0
web-admin/src/api/pl/index.ts

@@ -382,6 +382,9 @@ export interface PlanProduct {
   productId: string
   productNo: string
   productName: string
+  brandMode?: string
+  brandId?: string
+  brandName?: string
   model?: string
   unit: string
   categoryName?: string

+ 9 - 0
web-admin/src/components/business/pl-plan-form-dialog/PlPlanFormProductTable.vue

@@ -8,6 +8,15 @@
             <PlProductNameHazardCell :product="row" />
           </template>
         </el-table-column>
+        <el-table-column label="品牌约定" min-width="110" align="center">
+          <template #default="{ row }">
+            <el-tag v-if="row.brandMode === 'required'" size="small" type="warning">
+              {{ row.brandName || '指定品牌' }}
+            </el-tag>
+            <el-tag v-else-if="row.brandMode === 'any'" size="small" type="info">不限</el-tag>
+            <span v-else>—</span>
+          </template>
+        </el-table-column>
         <el-table-column label="型号/规格" min-width="120" show-overflow-tooltip>
           <template #default="{ row }">
             {{ row.model || row.productModel || '—' }}