Browse Source

Merge remote-tracking branch 'origin/master'

LLL 1 year ago
parent
commit
d96f6eda15

+ 16 - 6
itdmWeb/src/views/module-iTDM/weituokehu/ItdmWtkehuList.vue

@@ -161,10 +161,15 @@
               let arr = this.dataSource.filter((res) => {
                 return res.weituiClient == row.weituiClient;
               });
-              if(row.weituiClient !== this.dataSource[index - 1].weituiClient){
+
+              if(index == 0){
                 obj.attrs.rowSpan = arr.length
-              } else {
-                obj.attrs.rowSpan = 0
+              }else {
+                if(row.weituiClient !== this.dataSource[index - 1].weituiClient){
+                  obj.attrs.rowSpan = arr.length
+                } else {
+                  obj.attrs.rowSpan = 0
+                }
               }
               return obj
             },
@@ -183,10 +188,15 @@
               let arr = this.dataSource.filter((res) => {
                 return res.weituiAddress == row.weituiAddress;
               });
-              if(row.weituiAddress !== this.dataSource[index - 1].weituiAddress){
+
+              if(index == 0){
                 obj.attrs.rowSpan = arr.length
-              } else {
-                obj.attrs.rowSpan = 0
+              }else {
+                if(row.weituiAddress !== this.dataSource[index - 1].weituiAddress){
+                  obj.attrs.rowSpan = arr.length
+                } else {
+                  obj.attrs.rowSpan = 0
+                }
               }
               return obj
             },

+ 54 - 1
itdmWeb/src/views/module-iTDM/weituokehu/modules/ItdmWtkehuForm.vue

@@ -5,7 +5,23 @@
         <a-row>
           <a-col :span="24">
             <a-form-model-item label="委托单位名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="weituiClient">
-              <a-input v-model="model.weituiClient" placeholder="请输入委托单位名称"  ></a-input>
+              <!-- <a-input v-model="model.weituiClient" placeholder="请输入委托单位名称"  ></a-input> -->
+              <a-auto-complete
+                :disabled="formDisabled"
+                v-model="model.weituiClient"
+                placeholder="请输入委托单位名称"
+                option-label-prop="label"
+                @change="handleSelect"
+                @search="querySearch"
+              >
+              <template slot="dataSource">
+                <a-select-option v-for="(item, index) in weituoClients" :key="index" :value="item.id" :label="item.weituiClient">
+                  {{item.weituiClient}}
+                </a-select-option>
+              </template>
+
+
+              </a-auto-complete>
             </a-form-model-item>
           </a-col>
           <a-col :span="24">
@@ -53,6 +69,8 @@
     },
     data () {
       return {
+        restaurants: [], // 获取的所有客户信息
+        weituoClients: [], // 搜索用的客户下拉列表
         model:{
          },
         labelCol: {
@@ -93,8 +111,43 @@
     created () {
        //备份model原始值
       this.modelDefault = JSON.parse(JSON.stringify(this.model));
+      this.initweituo()
     },
     methods: {
+      initweituo() {
+        getAction('/ItdmWtkehu/itdmWtkehu/xialalist', {}).then((res) => {
+          this.restaurants = res
+          this.weituoClients = res
+        })
+      },
+      // 带输入建议的输入框
+      querySearch(queryString) {
+        var restaurants = this.restaurants
+        var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
+        console.log(queryString, results)
+
+        this.weituoClients = results
+      },
+      createFilter(queryString) {
+        return (restaurant) => {
+          console.log(restaurant)
+          return (restaurant.weituiClient.toLowerCase().indexOf(queryString.toLowerCase()) !== -1)
+        }
+      },
+      // 选择委托单位
+      handleSelect(item) {
+        console.log(item)
+
+        var v = this.restaurants.find(i => i.id == item)
+        // var v = this.restaurants.find(i => i.weituiClient === item)
+        if(v){
+          console.log(v)
+          this.$set(this.model, "weituiClient", v.weituiClient)
+          this.$set(this.model, "weituiAddress", v.weituiAddress)
+          this.$refs.form.validate()
+          console.log(this.model)
+        }
+      },
       add () {
         this.edit(this.modelDefault);
       },