From 719146bf3020d1aee5fe92e446b1f65c7ee89cb4 Mon Sep 17 00:00:00 2001 From: whycq <you@example.com> Date: 星期三, 14 十二月 2022 23:05:37 +0800 Subject: [PATCH] # --- pages/business/cstmr/addCsmtr.vue | 78 +++++++++++++-------------------------- 1 files changed, 26 insertions(+), 52 deletions(-) diff --git a/pages/business/cstmr/addCsmtr.vue b/pages/business/cstmr/addCsmtr.vue index 37ba440..e4a7230 100644 --- a/pages/business/cstmr/addCsmtr.vue +++ b/pages/business/cstmr/addCsmtr.vue @@ -9,7 +9,8 @@ <uni-easyinput v-model="baseFormData.rela" placeholder="璇疯緭鍏ュ鎴峰叧绯�" /> </uni-forms-item> <uni-forms-item label="瀹㈡埛绫诲埆" required name="cstmrType"> - <uni-combox :candidates="cstmrTypes" placeholder="璇烽�夋嫨瀹㈡埛绫诲埆" v-model="cstmrType" @input="autoLoad('cstmrType',cstmrTypeQuery)"></uni-combox> + <uni-combox :candidates="cstmrTypes" placeholder="璇烽�夋嫨瀹㈡埛绫诲埆" + v-model="baseFormData.cstmrType" @input="autoLoad('cstmrType',baseFormData.cstmrType)"></uni-combox> <!-- <uni-easyinput v-model="baseFormData.cstmrType" placeholder="璇疯緭鍏ュ鎴风被鍒�" /> --> </uni-forms-item> <uni-forms-item label="鍖哄垎" required name="type"> @@ -26,7 +27,8 @@ <uni-easyinput v-model="baseFormData.addr" placeholder="璇疯緭鍏ヨ缁嗗湴鍧�" /> </uni-forms-item> <uni-forms-item label="璐熻矗浜�" required name="director"> - <uni-combox :candidates="directors" placeholder="璇烽�夋嫨瀹㈡埛绫诲埆" v-model="director"></uni-combox> + <uni-combox :candidates="directors" placeholder="璇烽�夋嫨璐熻矗浜�" + v-model="baseFormData.director" @input="autoLoad('user',baseFormData.director)"></uni-combox> <!-- <uni-easyinput v-model="baseFormData.director" placeholder="璇疯緭鍏ヨ礋璐d汉" /> --> </uni-forms-item> <uni-forms-item label="瀹㈡埛鑱旂郴浜�" required name="contacts"> @@ -36,7 +38,7 @@ <uni-easyinput type="textarea" v-model="baseFormData.remarks" placeholder="璇疯緭鍏ュ娉�" /> </uni-forms-item> </uni-forms> - <button type="primary" @click="addCstmr()">淇濆瓨</button> + <button type="primary" @click="addCstmr()">娣诲姞</button> </view> </view> </template> @@ -53,6 +55,8 @@ director: '', baseFormData: { citysData: [], + cstmrType: '', + director: '', }, rules: { name: { @@ -125,69 +129,37 @@ // 鑾峰彇鐪佸競鍖� this.citysData = test.citysData this.baseUrl = uni.getStorageSync('baseUrl') - this.autoLoad('cstmrType',cstmrType) - this.autoLoad('contacts',user) + this.autoLoad('cstmrType','') + this.autoLoad('user','') // this.getCstmrType() // this.getUser() }, methods: { autoLoad(type,condition) { let that = this + var a = that.baseUrl + '/' + type + 'Query/auth' uni.request({ - url: that.baseUrl + '/' + condition +'/auth', + url: that.baseUrl + '/' + type + 'Query' +'/auth', header:{'token':uni.getStorageSync('token')}, + data: {condition:condition}, method: 'GET', success(result) { var res = result.data if (res.code === 200) { var element; - for(element of res.data) { - if (type == cstmrType) { + if (type == 'cstmrType') { + for(element of res.data) { that.cstmrTypes.push(element.value) - return } - if (type == contacts) { - that.contacts.push(element.value) - return + return + } + if (type == 'user') { + for(element of res.data) { + that.directors.push(element.value) } - + return } - } - } - }) - }, - // 鑾峰彇瀹㈡埛绫诲埆 - getCstmrType() { - let that = this - uni.request({ - url: that.baseUrl + '/cstmrTypeQuery/auth', - header:{'token':uni.getStorageSync('token')}, - method: 'GET', - success(result) { - var res = result.data - if (res.code === 200) { - var element; - for(element of res.data) { - that.cstmrTypes.push(element.value) - } - } - } - }) - }, - // 鑾峰彇鐢ㄦ埛 - getUser() { - let that = this - uni.request({ - url: that.baseUrl + '/userQuery/auth', - header:{'token':uni.getStorageSync('token')}, - method: 'GET', - success(result) { - var res = result.data - if (res.code === 200) { - var element; - for(element of res.data) { - that.directors.push(element.value) - } + } } }) @@ -197,12 +169,15 @@ let that = this this.$refs.baseForm.validate().then(res=>{ console.log(res); + var a = JSON.stringify(res) + console.log(a); uni.request({ url: that.baseUrl + '/cstmr/add/auth', header:{ 'token':uni.getStorageSync('token'), - 'content-type':'application/x-www-form-urlencoded'}, - data: res, + // 'content-type':'application/json', + }, + data: a, method: 'POST', success(result) { var res = result.data @@ -210,7 +185,6 @@ } }) }).catch(err =>{ - }) } } -- Gitblit v1.9.1