Browse Source

product 增加tag

luguang 2 months ago
parent
commit
bad7b8f112

+ 17 - 5
src/views/workshop/product/components/edit.vue

@@ -2,18 +2,18 @@
   <div class="app-container">
     <!-- 产品表表单 -->
     <el-dialog
-      :title="textMap[editType]+'产品'"
+      :title="textMap[editType] + '产品'"
       :visible.sync="editShow"
       :before-close="handleClose"
       :close-on-click-modal="false"
     >
       <el-form
         ref="editForm"
-        :rules="editType==='update'?rules:rules"
+        :rules="editType === 'update' ? rules : rules"
         :model="editForm"
         label-position="right"
         label-width="8rem"
-        style="width: 90%; margin-left:2%;"
+        style="width: 90%; margin-left: 2%"
       >
         <el-form-item label="产品名称" prop="securities">
           <el-input v-model="editForm.securities" />
@@ -34,15 +34,26 @@
             <template slot="append">枚</template>
           </el-input>
         </el-form-item>
+        <el-form-item label="类型" prop="tag">
+          <el-select v-model="editForm.tag" class="filter-item" placeholder="请选择">
+            <el-option
+              v-for="item in $commonArray.options['tagOpt']"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button type="danger" @click="handleClose">关 闭</el-button>
         <el-button
-          v-show="editType!=='view'"
+          v-show="editType !== 'view'"
           type="primary"
           :disabled="isDisable"
           @click="confirmClick"
-        >保 存</el-button>
+          >保 存</el-button
+        >
       </span>
     </el-dialog>
   </div>
@@ -65,6 +76,7 @@ export default {
         spec: [{ required: true, message: '规格不能为空', trigger: 'change' }],
         crownPrefix: [{ required: true, message: '冠字号代码不能为空', trigger: 'change' }],
         boxAmount: [{ required: true, message: '整拍箱数不能为空', trigger: 'change' }],
+        tag: [{ required: true, message: '请选择类型', trigger: 'change' }],
         amountPerBox: [{ required: true, message: '整箱枚数不能为空', trigger: 'change' }]
       }
     }

+ 7 - 0
src/views/workshop/product/index.vue

@@ -37,6 +37,13 @@
           >{{ $commonArray.methods.getArrayVal('statusOpt', row.status) }}</el-tag>
         </template>
       </el-table-column>
+      <el-table-column label="类型" min-width="40" align="center">
+        <template slot-scope="{ row }">
+          <span
+            v-if="row.tag"
+          >{{ $commonArray.methods.getArrayVal('tagOpt', row.tag) }}</span>
+        </template>
+      </el-table-column>
       <el-table-column label="操作" align="center">
         <template slot-scope="{row}">
           <el-link type="primary" :underline="false" @click="handleUpdate(row)">编辑</el-link>