另一个页面调用方法赋值 负责下拉框回显
methods: {// 按钮方法jieyue(row) {this.openDialog = true;this.$nextTick(() => {this.$refs.testDialog.init(row);});},
页面进入请求下拉框数据
// 窗口初始化方法,nextTick方法可以添加逻辑,如打开窗口时查询数据填充init(row) {this.form = row;this.open = true;getSepEnterprise().then(response => {// this.servicesOptions = response.services;this.managerOptions = response.salesManagers;// this.channelOption = response.channels;});},export default {name: "testDialog",data() {return {form: {},//服务商listservicesOptions:[],
下拉框
<el-form-item label="客户经理" prop="salesManagerId"><el-select v-model="form.salesManagerId" placeholder="请选择客户经理" @change="chooseManager($event)"><el-optionv-for="item in managerOptions":key="item.id":label="item.name":value="item.id"></el-option></el-select></el-form-item>
赋值事件
chooseManager(event){this.managerOptions.forEach(item => {if(item.id === event){this.form.salesManager = item.name;}})},
js文件
// 查询个体户业务客户签约详细
export function getSepEnterprise(id) {return request({url: '/sep/SepEnterprise/' + parseStrEmpty(id),method: 'get'})
}// 转换字符串,undefined,null等转化为""
export function parseStrEmpty(str) {if (!str || str == "undefined" || str == "null") {return "";}return str;
}
接这个博客后续
这辈子坚持与不坚持都不可怕,怕的是独自走在坚持的道路上!!!