AVUE 下拉 select 下拉项 为 一个表的数据

一、后端

	/**
	 * 数据源列表
	 */
	@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();
	});
  },

三、截图预览




posted @ 2020-10-28 14:23  古兴越  阅读(2309)  评论(0编辑  收藏  举报