html
<el-form-item label="字段" prop="mapField">
<el-select v-model="form.mapField" placeholder="请选择字段" style="width: 100%;" :disabled="formType != 'add'" clearable>
<el-option v-for="item in mapField" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
js
// 从接口中,获取字段下拉列表
getFieldSel() {
requestCommon({
url: fieldListData(),
mod: 'GET',
data: this.paramData
})
.then(res => {
// console.log(res);
var resData = res.resData.records;
// console.log(resData);
var nameArr = [];
for (var i = 0; i < resData.length; i++) {
var arr = [];
arr['value'] = resData[i].indexValue;
arr['label'] = resData[i].indexValue;
nameArr[i] = arr;
}
// console.log(nameArr);
this.mapField = nameArr;
})
.catch(error => {
this.outputError(error);
});
},