Sfoglia il codice sorgente

change: 编辑询价.product_sku 包含gi_的商品,产品别名必填.

peter 3 giorni fa
parent
commit
57bde4adfa
1 ha cambiato i file con 16 aggiunte e 2 eliminazioni
  1. 16 2
      src/pages/indent-manage/indent/edit.vue

+ 16 - 2
src/pages/indent-manage/indent/edit.vue

@@ -15,7 +15,7 @@
     >
       <el-form
         ref="indentForm"
-        :rules="rules"
+        :rules="computedRules"
         :model="form"
         label-width="130px"
       >
@@ -291,7 +291,7 @@
 </template>
 
 <script lang="ts" setup>
-import { defineComponent, ref, watch, nextTick, inject } from 'vue'
+import { defineComponent, ref, watch, nextTick, inject, computed } from 'vue'
 import {
   ElButton,
   ElForm,
@@ -497,6 +497,20 @@ const rules = {
     },
   ],
 }
+let computedRules = computed(() => {
+  // product_sku 包含gi_的商品, 需要填写产品别名(必填), 否则返回rules的复制体
+  let temp: any = cloneDeep(rules)
+  if (/gi_/i.test(form.value.product_sku)) {
+    temp.product_alias_name = [
+      {
+        required: true,
+        message: '请填写产品别名',
+        trigger: 'change',
+      },
+    ]
+  }
+  return temp
+})
 // 客户下拉框候选列表
 const customList = ref([] as any[])
 const loading = ref(false)