chenrui 4 vuotta sitten
vanhempi
commit
f516259739
1 muutettua tiedostoa jossa 38 lisäystä ja 3 poistoa
  1. 38 3
      src/views/productManagement/productInfo/edit.vue

+ 38 - 3
src/views/productManagement/productInfo/edit.vue

@@ -49,7 +49,7 @@
           </a-input-group>
         </a-form-model-item>
         <a-form-model-item label="产品品牌" prop="productBrandSn">
-          <a-select
+          <!-- <a-select
             id="productInfoEdit-productBrand"
             placeholder="请输入名称或拼音查询,如果没有请点击 '+' 新增"
             :disabled="!!$route.params.id"
@@ -60,6 +60,21 @@
             :filter-option="filterOption"
             style="width: 90%;">
             <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn" :disabled="item.enabledFlag==0">{{ item.brandName }}</a-select-option>
+          </a-select> -->
+          <a-select
+            show-search
+            id="productInfoEdit-productBrand"
+            v-model="form.productBrandSn"
+            placeholder="请输入名称或拼音查询,如果没有请点击 '+' 新增"
+            :disabled="!!$route.params.id"
+            :filter-option="false"
+            :not-found-content="fetching ? undefined : null"
+            @search="fetchUser"
+            @change="handleChange"
+            style="width: 90%;"
+          >
+            <a-spin v-if="fetching" slot="notFoundContent" size="small" />
+            <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn" :disabled="item.enabledFlag==0">{{ item.brandName }}</a-select-option>
           </a-select>
           <a-button
             @click="openModal=true"
@@ -73,7 +88,7 @@
           <a-cascader
             :disabled="!!$route.params.id"
             @change="changeProductType"
-			expand-trigger="hover"
+            expand-trigger="hover"
             :options="productTypeList"
             :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
             id="productInfoEdit-productType"
@@ -165,12 +180,32 @@ export default {
           { required: true, message: '请选择产品分类', trigger: 'change' }
         ]
       },
+      fetching: false,
       productBrandList: [], //  品牌下拉数据
       productTypeList: [], //  分类下拉数据
       openModal: false //  新增编辑  弹框
     }
   },
   methods: {
+    // 搜索经销商
+    fetchUser (value) {
+      console.log('fetching user', value)
+      this.fetching = true
+      dealerProductBrandQuery({ 'sysFlag': '0', 'queryWord': value }).then(res => {
+        if (res.status == 200) {
+          this.productBrandList = res.data
+          this.fetching = false
+        } else {
+          this.dealerData = []
+          this.fetching = false
+        }
+      })
+    },
+    // 调往对象名称  change
+    handleChange (value) {
+      const ind = this.dealerData.findIndex(item => item.dealerSn == value)
+      this.form.targetName = this.dealerData[ind].dealerName
+    },
     filterEmpty () {
       let str = this.form.name
       str = str.replace(/\ +/g, '')
@@ -265,7 +300,7 @@ export default {
     }
   },
   mounted () { // 不使用beforeRouteEnter:由于页面路由动态id导致页面表现方式不同但路由相同,则会出现数据不重新请求问题
-    this.getProductBrand()
+    // this.getProductBrand()
     this.getProductType()
     this.$refs.ruleForm.resetFields()
     if (this.$route.params.id) { //  编辑页