查询表单下拉框 select 联动操作

查询界面固定列


[vue3代码]写在生成的[表.vue]文件中,[vue2代码]写在[表.jsx]文件methods方法中;二选一实现
vue3 代码
const getOption = (field) => {
  for (let index = 0; index < searchFormOptions.length; index++) {
    const _options = this.searchFormOptions[index];
    const obj = _options.find((c) => {
      return c.field == field;
    });
    if (obj) {return obj;}
  }
};
//City改为要操作的字段
getOption("City").onChange = (val, option) => {
  //从后台加载数据源
  //proxy.http.post(url, {}, true).then(source => {
  //后台返回数据源格式
  source = [
    { key: "1", value: "text1" },
    { key: "2", value: "text2" },
  ];
  //重新绑定数据源
  getOption("字段").data = source; //字段改为你要绑定下拉框数据源的字段
  // if (source.length) {
  //   editFormFields[enableOption.field] = source[0].key;
  // }
  //})
};