|
@@ -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);
|
|
|
},
|