自学内容网 自学内容网

多个页面一张SQL表,前端放入type类型

前端有三个页面需要修改

1.List

data () {
      return {
        // 类型
        queryParam: {
          type: "1",
        },
        type: 1,
       }

method:{
    handleAdd () {
        this.$refs.modalForm.add(this.type)
        this.$refs.modalForm.title = '新增'
        this.$refs.modalForm.disableSubmit = false
      },
      handleEdit (record) {
        this.$refs.modalForm.edit(record, this.type)
        this.$refs.modalForm.title = '编辑'
        this.$refs.modalForm.disableSubmit = false
      },
}

2.Modal

      add (type) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add(type);
        })
      },
      edit (record,type) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record,type);
        })
      },

3.Form

    data () {
      return {
        type: '1',
      }
    },

submitForm () {

        this.form.validateFields((err, values) => {
          if (!err) {
            
            if (this.type) {
              values['type'] = this.type;
            }

            let formData = Object.assign(this.model, values);

          }

        })
      },

两个setFieldsValue都要有 type

后端Controller


        queryPageList

QueryWrapper<YztSkillAchieve> queryWrapper = QueryGenerator.initQueryWrapper(yztSkillAchieve, req.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
queryWrapper.eq("SYS_ORG_CODE", sysUser.getOrgCode());
queryWrapper.orderByDesc("CREATE_TIME");
queryWrapper.orderByDesc("UPDATE_TIME");
if(yztSkillAchieve.getType().isEmpty() == false){
//筛选type
queryWrapper.eq("type", yztSkillAchieve.getType());
}else{
throw new RuntimeException("未知的类型!");
}

你有很多个菜单那么就要复制很多个List,Modal,Form,给他们写死不同的type值。


原文地址:https://blog.csdn.net/qq_46423858/article/details/145159821

免责声明:本站文章内容转载自网络资源,如侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!