一、后端
/**
* 數據源列表
*/
@GetMapping("/select")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "下拉數據源", notes = "查詢列表")
public R<List<Brand>> select() {
List<Brand> list = brandService.list();
return R.data(list);
}
二、前端
1、顯示下拉
{
label: "品牌",
prop: "brandId",
rules: [{
required: false,
message: "請輸入品牌",
trigger: "blur"
}],
hide: true,// 在列上隱藏
type: "select",
dicUrl: "/api/blade-pms/brand/select",
props: {
label: "name",
value: "id"
},
},
2、下拉文本字段 在對話框中隱藏不顯示
{
label: "店鋪名稱",
prop: "storeName",
display: false,
},
3、添加/編輯 寫入下拉文本 到字段
rowSave(row, done, loading) {
row.storeName = row.$storeId;
add(row).then(() => {
done();
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
}, error => {
window.console.log(error);
loading();
});
},
rowUpdate(row, index, done, loading) {
row.storeName = row.$storeId;
update(row).then(() => {
done();
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
}, error => {
window.console.log(error);
loading();
});
},
三、截圖預覽