重新初始化 BPM Form 模块

This commit is contained in:
YunaiV 2021-12-30 20:46:06 +08:00
parent 7ef86c14c0
commit 00f968657c
9 changed files with 274 additions and 89 deletions

View File

@ -84,16 +84,4 @@ public class BpmFormController {
return success(BpmFormConvert.INSTANCE.convertPage(pageResult)); return success(BpmFormConvert.INSTANCE.convertPage(pageResult));
} }
@GetMapping("/export-excel")
@ApiOperation("导出动态表单 Excel")
@PreAuthorize("@ss.hasPermission('bpm:form:export')")
@OperateLog(type = EXPORT)
public void exportFormExcel(@Valid BpmFormExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<BpmForm> list = formService.getFormList(exportReqVO);
// 导出 Excel
List<BpmFormExcelVO> datas = BpmFormConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "动态表单.xls", "数据", BpmFormExcelVO.class, datas);
}
} }

View File

@ -1,33 +1,14 @@
package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo; package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo;
import lombok.*; import io.swagger.annotations.ApiModel;
import java.util.*; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel(value = "动态表单 Excel 导出 Request VO", description = "参数和 OsFormPageReqVO 是一致的") @ApiModel(value = "动态表单 Excel 导出 Request VO", description = "参数和 BpmFormPageReqVO 是一致的")
@Data @Data
public class BpmFormExportReqVO { public class BpmFormExportReqVO {
@ApiModelProperty(value = "表单名称") @ApiModelProperty(value = "表单名称")
private String name; private String name;
@ApiModelProperty(value = "商户状态")
private Integer status;
@ApiModelProperty(value = "表单JSON")
private String formJson;
@ApiModelProperty(value = "备注")
private String remark;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
} }

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo; package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat; import io.swagger.annotations.ApiModel;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ApiModel("动态表单分页 Request VO") @ApiModel("动态表单分页 Request VO")
@Data @Data
@ -16,21 +16,4 @@ public class BpmFormPageReqVO extends PageParam {
@ApiModelProperty(value = "表单名称") @ApiModelProperty(value = "表单名称")
private String name; private String name;
@ApiModelProperty(value = "商户状态")
private Integer status;
@ApiModelProperty(value = "表单JSON")
private String formJson;
@ApiModelProperty(value = "备注")
private String remark;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
} }

View File

@ -37,10 +37,10 @@ public class BpmForm extends BaseDO {
* 状态 * 状态
*/ */
private Integer status; private Integer status;
/** // /**
* 表单JSON // * 表单JSON
*/ // */
private String formJson; // private String formJson;
/** /**
* 表单配置 * 表单配置
* *

View File

@ -22,20 +22,6 @@ public interface BpmFormMapper extends BaseMapperX<BpmForm> {
default PageResult<BpmForm> selectPage(BpmFormPageReqVO reqVO) { default PageResult<BpmForm> selectPage(BpmFormPageReqVO reqVO) {
return selectPage(reqVO, new QueryWrapperX<BpmForm>() return selectPage(reqVO, new QueryWrapperX<BpmForm>()
.likeIfPresent("name", reqVO.getName()) .likeIfPresent("name", reqVO.getName())
.eqIfPresent("status", reqVO.getStatus())
.eqIfPresent("form_json", reqVO.getFormJson())
.eqIfPresent("remark", reqVO.getRemark())
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc("id"));
}
default List<BpmForm> selectList(BpmFormExportReqVO reqVO) {
return selectList(new QueryWrapperX<BpmForm>()
.likeIfPresent("name", reqVO.getName())
.eqIfPresent("status", reqVO.getStatus())
.eqIfPresent("form_json", reqVO.getFormJson())
.eqIfPresent("remark", reqVO.getRemark())
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc("id")); .orderByDesc("id"));
} }

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.adminserver.modules.bpm.service.form; package cn.iocoder.yudao.adminserver.modules.bpm.service.form;
import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormCreateReqVO; import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormExportReqVO;
import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormPageReqVO; import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormPageReqVO;
import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormUpdateReqVO; import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmForm; import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmForm;
@ -65,12 +64,4 @@ public interface BpmFormService {
*/ */
PageResult<BpmForm> getFormPage(BpmFormPageReqVO pageReqVO); PageResult<BpmForm> getFormPage(BpmFormPageReqVO pageReqVO);
/**
* 获得动态表单列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 动态表单列表
*/
List<BpmForm> getFormList(BpmFormExportReqVO exportReqVO);
} }

View File

@ -77,9 +77,4 @@ public class BpmFormServiceImpl implements BpmFormService {
return formMapper.selectPage(pageReqVO); return formMapper.selectPage(pageReqVO);
} }
@Override
public List<BpmForm> getFormList(BpmFormExportReqVO exportReqVO) {
return formMapper.selectList(exportReqVO);
}
} }

View File

@ -0,0 +1,47 @@
import request from '@/utils/request'
// 创建工作流的表单定义
export function createForm(data) {
return request({
url: '/bpm/form/create',
method: 'post',
data: data
})
}
// 更新工作流的表单定义
export function updateForm(data) {
return request({
url: '/bpm/form/update',
method: 'put',
data: data
})
}
// 删除工作流的表单定义
export function deleteForm(id) {
return request({
url: '/bpm/form/delete?id=' + id,
method: 'delete'
})
}
// 获得工作流的表单定义
export function getForm(id) {
return request({
url: '/bpm/form/get?id=' + id,
method: 'get'
})
}
// 获得工作流的表单定义分页
export function getFormPage(query) {
return request({
url: '/bpm/form/page',
method: 'get',
params: query
})
}
export class exportFormExcel {
}

View File

@ -0,0 +1,214 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="表单名" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入表单名" clearable size="small" @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['bpm:form:create']">新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="表单名" align="center" prop="name" />
<el-table-column label="开启状态" align="center" prop="status">
<template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.SYS_COMMON_STATUS, scope.row.status) }}</span>
</template>
</el-table-column>
<el-table-column label="表单配置" align="center" prop="fields" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['bpm:form:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['bpm:form:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="表单名" prop="name">
<el-input v-model="form.name" placeholder="请输入表单名" />
</el-form-item>
<el-form-item label="开启状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.SYS_COMMON_STATUS)"
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="表单配置" prop="fields">
<el-input v-model="form.fields" placeholder="请输入表单配置" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createForm, updateForm, deleteForm, getForm, getFormPage, exportFormExcel } from "@/api/bpm/form";
export default {
name: "Form",
components: {
},
data() {
return {
//
loading: true,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
name: null,
},
//
form: {},
//
rules: {
name: [{ required: true, message: "表单名不能为空", trigger: "blur" }],
status: [{ required: true, message: "开启状态不能为空", trigger: "blur" }],
fields: [{ required: true, message: "表单配置不能为空", trigger: "blur" }],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
let params = {...this.queryParams};
//
getFormPage(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
name: undefined,
status: undefined,
fields: undefined,
remark: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加工作流的";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getForm(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改工作流的";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateForm(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createForm(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$confirm('是否确认删除工作流的编号为"' + id + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return deleteForm(id);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
}
}
};
</script>