下拉框之间怎么联动?

유강

//前端js增强处代码,都是默认表单
// return {
//   initOption() {
//     useFun.setPropConfig('warehouse_id', { cascader: ['location_id'] })

//     useFun.setPropConfig('location_id', {
//       props: { lable: 'name', value: 'id' },
//       dicUrl: '/jeelowcode/dbform-data/list/2010608703107035137',
//       dicMethod: 'post',
//       dicQuery: { warehouse_id: '{{warehouse_id}}' },
//       dicFormatter: (res) => {
//         return res.records
//       }
//     })
//   }
// }

return {
  initOption() { //表格显示前执行

    //设置岗位字段格式化
    useFun.setPropConfig('location_id', {
      props: { label: 'name', value: 'id' },
      dicFormatter: (res) => {
        console.log(res)
        return res.records
      }
    })
    //监听部门变化
    useFun.setPropConfig('warehouse_id', {
      change: ({ value }) => {
        console.log(value)
        //重新设置请求url
        useFun.setPropConfig('location_id', {
          dicUrl: '/jeelowcode/dbform-data/list/2010608703107035137',
          dicMethod: 'post',
          dicQuery: { warehouse_id: value }
        })
        //更新岗位字典
        setTimeout(() => {
          crudRef.value.updateDic('location_id', [])
        }, 30)
      }
    })
  }
}


回答9

유강
@超级管理员

就是我现在选择了仓库之后,库区数据是空,不选仓库时也是空

유강
@超级管理员

然后选择第一种的情况下,就会有数据,但是下拉时lable渲染不出来,就只展示空白行

유강
@超级管理员

return {

 initOption() { //表格显示前执行


   //设置岗位字段格式化

   useFun.setPropConfig('location_id', {

     props: { label: 'name', value: 'id' },

     dicFormatter: (res) => {

       console.log(res)

       return res.records

     }

   })

   //监听部门变化

   useFun.setPropConfig('warehouse_id', {

     change: ({ value }) => {

       console.log(value)

       //重新设置请求url

       useFun.setPropConfig('location_id', {

         dicUrl: '/jeelowcode/dbform-data/list/2010608703107035137',

         dicMethod: 'post',

         dicQuery: { warehouse_id: value }

       })

       //更新岗位字典

       setTimeout(() => {

         crudRef.value.updateDic('location_id')

       }, 30)

     }

   })

 }

}

我删除之后,还是显示无数据

유강
@超级管理员

我这是表单开发,没有使用自定义表单,改成avueFormRef.value后,筛选直接就不生效

超级管理员
@유강

那用crudRef应该没什么问题,或者你演示环境复现一下我看一下哪里出问题了

写回答

扫码关注

微信公众号二维码