Просмотр исходного кода

工单列表 创建新工单时,添加产品信息要限制品牌、大类、小类、机型不可重复添加,在点击确定时,校验是否有重复的机型,有则提示:已添加该机型,请勿重复添加

linwenxin 1 год назад
Родитель
Сommit
4e2fb43751

+ 15 - 0
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/productColumns.js

@@ -200,6 +200,21 @@ export default {
                 <el-button size="mini" type="primary" onClick={() => {
                   this.appointVerify(this.getVfyKey(this.isEditIndex, false), (v) => {
                     if (v) {
+                      try {
+                        this.orderInfo.orderProducts.map((item, index_) => {
+                          var row = this.orderInfo.orderProducts[index_ + 1]
+                          if (row) {
+                            if (
+                              `${row.brandId}_${row.mainId}_${row.smallId}_${row.productName}` == `${item.brandId}_${item.mainId}_${item.smallId}_${item.productName}`
+                            ) {
+                              throw new Error('');
+                            }
+                          }
+                        })
+                      } catch (error) {
+                        this.$message.warning('产品机型重复')
+                        return
+                      }
                       this.isEditIndex = 0
                       this.orderInfo.orderProducts.unshift({
                         "brandId": "",