| | |
| | | v-model="baseFormData.company" @input="autoLoad('company',baseFormData.company)"></uni-combox> |
| | | </view> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="省市区" name="citysData"> |
| | | <uni-data-picker @change="areaChange" placeholder="请选择省市区" popup-title="请选择所在地区" :localdata="citysData" v-model="baseFormData.pcd"> |
| | | </uni-data-picker> |
| | | <uni-forms-item label="甲方单位" name="cstmrId"> |
| | | <view @click="autoLoad('cstmr','')"> |
| | | <uni-combox :candidates="cstmrs" placeholder="请选择甲方单位" |
| | | v-model="baseFormData.cstmrId" @input="autoLoad('cstmr',baseFormData.cstmrId)"></uni-combox> |
| | | </view> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="负责人" name="director"> |
| | | <view @click="autoLoad('user','')"> |
| | |
| | | v-model="baseFormData.director" @input="autoLoad('user',baseFormData.director)"></uni-combox> |
| | | </view> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="甲方单位" name="cstmr"> |
| | | <view @click="autoLoad('cstmr','')"> |
| | | <uni-combox :candidates="cstmrs" placeholder="请选择甲方单位" |
| | | v-model="baseFormData.cstmr" @input="autoLoad('user',baseFormData.cstmr)"></uni-combox> |
| | | </view> |
| | | <uni-forms-item label="省市区" name="citysData"> |
| | | <uni-data-picker @change="areaChange" placeholder="请选择省市区" popup-title="请选择所在地区" :localdata="citysData" v-model="baseFormData.pcd"> |
| | | </uni-data-picker> |
| | | </uni-forms-item> |
| | | <uni-forms-item label="项目总金额" name="money"> |
| | | <uni-easyinput v-model="baseFormData.money" placeholder="请输入项目总金额" /> |
| | |
| | | <uni-easyinput type="textarea" v-model="baseFormData.remarks" placeholder="请输入备注" /> |
| | | </uni-forms-item> |
| | | </uni-forms> |
| | | <button type="primary" @click="addCstmr()">添加</button> |
| | | <button type="primary" @click="addOrder()">添加</button> |
| | | </view> |
| | | </view> |
| | | </template> |
| | |
| | | cstmrTypes: [], |
| | | cstmrType: '', |
| | | companies: [], |
| | | company: '', |
| | | directors: [], |
| | | director: '', |
| | | cstmrs: [], |
| | | cstmr: '', |
| | | cstmrTypeList: [], |
| | | cstmrList: [], |
| | | directorList: [], |
| | | companyList: [], |
| | | baseFormData: { |
| | | citysData: [], |
| | | cstmrType: '', |
| | |
| | | director: '', |
| | | rela: '', |
| | | remarks: '', |
| | | cstmr: '' |
| | | cstmrId: '', |
| | | addr: '', |
| | | money: '' |
| | | }, |
| | | rules: { |
| | | name: { |
| | |
| | | errorMessage: '请填写客户名称', |
| | | }] |
| | | }, |
| | | rela: { |
| | | rules: [{ |
| | | required: false, |
| | | errorMessage: '请填写客户名称', |
| | | }] |
| | | }, |
| | | cstmrType: { |
| | | rules: [{ |
| | | required: true, |
| | | errorMessage: '请选择客户类别', |
| | | }] |
| | | }, |
| | | company: { |
| | | rules: [{ |
| | | required: true, |
| | | errorMessage: '请选所属公司', |
| | | }] |
| | | }, |
| | | type: { |
| | | rules: [{ |
| | | required: true, |
| | | errorMessage: '请选择区分', |
| | | }] |
| | | }, |
| | | tel: { |
| | | rules: [{ |
| | | required: true, |
| | | errorMessage: '请输入电话号码', |
| | | }] |
| | | }, |
| | | contacts: { |
| | | rules: [{ |
| | | required: true, |
| | | errorMessage: '请输入客户联系人', |
| | | }] |
| | | }, |
| | | remarks: { |
| | | rules: [{ |
| | | required: false, |
| | | errorMessage: '请输入客户联系人', |
| | | }] |
| | | } |
| | | }, |
| | | // 单选数据源 |
| | | type$: [{ |
| | |
| | | onShow() { |
| | | // 获取省市区 |
| | | this.citysData = test.citysData |
| | | this.autoLoad('company','') |
| | | this.autoLoad('user','') |
| | | }, |
| | | methods: { |
| | | bindPickerChange: function(e) { |
| | |
| | | }, |
| | | autoLoad(type,condition) { |
| | | let that = this |
| | | that.cstmrTypes = [] |
| | | that.companies = [] |
| | | that.directors = [] |
| | | that.directorList = [] |
| | | that.cstmrs = [] |
| | | var a = that.baseUrl + '/' + type + 'Query/auth' |
| | | uni.request({ |
| | |
| | | var res = result.data |
| | | if (res.code === 200) { |
| | | var element; |
| | | if (type == 'cstmrType') { |
| | | for(element of res.data) { |
| | | that.cstmrTypes.push(element.value) |
| | | that.cstmrTypeList.push(element) |
| | | } |
| | | return |
| | | } |
| | | if (type == 'user') { |
| | | for(element of res.data) { |
| | | that.directors.push(element.value) |
| | |
| | | if (type == 'company') { |
| | | for (element of res.data) { |
| | | that.companies.push(element.name) |
| | | |
| | | that.listAuth(type) |
| | | that.companyList.push(element) |
| | | } |
| | | return |
| | | } |
| | | if (type == 'cstmr') { |
| | | for (element of res.data) { |
| | | that.cstmrs.push(element.value) |
| | | |
| | | that.cstmrList.push(element) |
| | | } |
| | | return |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | // 添加用户 |
| | | addCstmr() { |
| | | listAuth(type) { |
| | | |
| | | }, |
| | | // 添加跟踪项目 |
| | | addOrder() { |
| | | let that = this |
| | | var element; |
| | | // 所属公司 |
| | | for (element of that.companyList) { |
| | | if(element.name == that.baseFormData.company) { |
| | | that.baseFormData.company = element.id |
| | | } |
| | | } |
| | | for (element of that.cstmrList) { |
| | | if(element.value == that.baseFormData.cstmrId) { |
| | | that.baseFormData.cstmrId = element.id |
| | | } |
| | | } |
| | | for (element of that.directorList) { |
| | | if(element.value == that.baseFormData.director) { |
| | | that.baseFormData.director = element.id |
| | | } |
| | | } |
| | | for (element of that.cstmrTypeList) { |
| | | if(element.value == that.baseFormData.cstmrType) { |
| | | that.baseFormData.cstmrType = element.id |
| | | } |
| | | } |
| | | this.$refs.baseForm.validate().then(res=>{ |
| | | if (res.rela == undefined) { |
| | | res.rela = '' |
| | | if (res.addr == undefined) { |
| | | res.addr = '' |
| | | } |
| | | if(res.money == undefined) { |
| | | res.money = '' |
| | | } |
| | | if(res.remarks == undefined) { |
| | | res.remarks = '' |
| | | } |
| | | res.pcd = this.citysDataTemp |
| | | uni.request({ |
| | | url: that.baseUrl + '/cstmr/add/auth', |
| | | url: that.baseUrl + '/order/add/auth', |
| | | header:{ |
| | | 'token':uni.getStorageSync('token'), |
| | | 'content-type':'application/x-www-form-urlencoded', |