基于jeecgboot的flowable流程支持online表单(三)

        这部分主要是实现online表单的各种形式表单,包括主从表表单,同时录入采用现有官方的模式录入数据,通过选择已有数据的方式进行流程申请与审批,免去各种录入组件等兼容性问题。

       1、后端实现

          主要实现online表单的信息获取以及具体表单的数据获取,以供前端使用

/**
	 * 通过formId查询
	 *
	 * @param formId
	 * @return
	 */
	@AutoLog(value = "flow_onl_cgform_head-通过formId查询")
	@ApiOperation(value="flow_onl_cgform_head-通过formId查询", notes="flow_onl_cgform_head-通过formId查询")
	@GetMapping(value = "/queryByFormId/{formId}")
	public Result queryByFormId(@PathVariable("formId")  String formId) {
		Map flowOnlCgformHeadMap = flowOnlCgformHeadService.getOnlCgformHeadByFormId(formId);
		if(flowOnlCgformHeadMap==null) {
			return Result.error("未找到对应数据");
		}
		return Result.OK(flowOnlCgformHeadMap);
	}
	
	@AutoLog(value = "getColumns-通过code查询获取online表单列表信息")
	@ApiOperation(value="getColumns-通过code查询获取online表单列表信息", notes="getColumns-通过code查询获取online表单列表信息")
	@GetMapping({"/getColumns/{code}"})
	public Result a(@PathVariable("code") String code) {
        Result result = new Result();
        OnlCgformHead onlCgformHead = (OnlCgformHead)this.onlCgformHeadService.getById(code);
        if (onlCgformHead == null) {
        	result.error500("实体不存在");
            return result;
        } else {
            LoginUser loginuser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
            OnlComplexModel onlComplexModel = this.onlineService.queryOnlineConfig(onlCgformHead, loginuser.getUsername());
            onlComplexModel.setIsDesForm(onlCgformHead.getIsDesForm());
            onlComplexModel.setDesFormCode(onlCgformHead.getDesFormCode());
            result.setResult(onlComplexModel);
            result.setOnlTable(onlCgformHead.getTableName());
            return result;
        }
    }
	
	@AutoLog(value = "getData-通过code查询获取online表单数据")
	@ApiOperation(value="getData-通过code查询获取online表单数据", notes="getData-通过code查询获取online表单数据")
	@GetMapping({"/getData/{code}"})
	public Result> a(@PathVariable("code") String code, HttpServletRequest request) {
		Result result = new Result();
		OnlCgformHead onlCgformHead = (OnlCgformHead) this.onlCgformHeadService.getById(code);
		if (onlCgformHead == null) {
			result.error500("实体不存在");
			return result;
		} else {
			Map map = null;

			try {
				Map objectmap = onlineUtils.objectHashMap(request);
				boolean bJoinQuery = onlineUtils.isJoinQuery(onlCgformHead);
				if (bJoinQuery) {
					map = this.onlineJoinQueryService.pageList(onlCgformHead, objectmap);
				} else {
					map = this.onlCgformFieldService.queryAutolistPage(onlCgformHead, objectmap, (List) null);
				}

				this.getEnhanceList(onlCgformHead, map);
				result.setResult(map);
			} catch (Exception except) {
				log.error(except.getMessage(), except);
				result.error500("数据库查询失败," + except.getMessage());
			}

			result.setOnlTable(onlCgformHead.getTableName());
			return result;
		}
	}

	
	@AutoLog(value = "getFormItem-通过code查询获取子表单数据")
	@ApiOperation(value="getFormItem-通过code查询获取子表单数据", notes="getFormItem-通过code查询获取子表单数据")
	@GetMapping({"/getFormItem/{code}"})
	public Result b(@PathVariable("code") String code, HttpServletRequest var2) {
		OnlCgformHead onlCgformHead = (OnlCgformHead) this.onlCgformHeadService.getById(code);
		if (onlCgformHead == null) {
			Result.error("表不存在");
		}

		Result result = new Result();
		LoginUser loginuser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		JSONObject formItemJsonObject = this.onlineService.queryOnlineFormItem(onlCgformHead, loginuser.getUsername());
		result.setResult(onlineUtils.resultOnlineFormItem(formItemJsonObject));
		result.setOnlTable(onlCgformHead.getTableName());
		return result;
	}

     2、前端实现

     下面代码主要是实现online表单具体数据的显示与申请提交




    3、审批流程的显示

     下面就是根据后端提供的online表单数据进行显示与处理

//流程过程中有online表单数据,获取online表单配置与数据
              if (res.result.hasOwnProperty('onlineConfig')) {
                this.onlineViewForm.onlineFormData = res.result.onlineConfig;
                console.log("onlineViewForm.onlineFormData=",this.onlineViewForm.onlineFormData);
                console.log("this.taskForm=",this.taskForm)
                var sonlineId = res.result.onlineId
                getOnlineFormData(sonlineId,this.taskForm.onlineDataId).then(res => {
                  console.log("getOnlineFormData res=",res);
                  if (res.success) {
                    this.onlineViewForm.model = res.result;
                    console.log("onlineViewForm.model=",this.onlineViewForm.model);
                    getOnlineFormItem(sonlineId).then(itemres => {//获取从表相关信息
                      if (itemres.success) {
                        console.log("getOnlineFormItem itemres=",itemres)
                        this.onlineFormItem.formData = itemres.result
                        if(itemres.result.head.subTableStr != null) {
                          var subTable = itemres.result.head.subTableStr
                          this.onlineFormItem.subTable = subTable.split(",")
                          console.log("this.onlineFormItem.subTable=",this.onlineFormItem.subTable)
                          for (var i=0;i基于jeecgboot的flowable流程支持online表单(三)_第1张图片

 

基于jeecgboot的flowable流程支持online表单(三)_第2张图片

 

你可能感兴趣的:(前端vue,java开发,前端,javascript,html)