已办流程
parent
ab7bf6c268
commit
be4a123349
|
@ -4,6 +4,7 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.ExampleMatcher;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
@ -45,6 +46,7 @@ import cn.palmte.work.model.enums.ProcessStatus;
|
|||
import cn.palmte.work.model.enums.ProcessType;
|
||||
import cn.palmte.work.model.enums.ProjectType;
|
||||
import cn.palmte.work.model.enums.SealType;
|
||||
import cn.palmte.work.model.process.ProcurementContract;
|
||||
import cn.palmte.work.model.process.ProjectProcess;
|
||||
import cn.palmte.work.model.process.ProjectProcessRepository;
|
||||
import cn.palmte.work.model.process.SaleContract;
|
||||
|
@ -111,7 +113,9 @@ public class ProcessController {
|
|||
* 已办流程
|
||||
*/
|
||||
@GetMapping("/completed")
|
||||
public String completed() {
|
||||
public String completed(Model model) {
|
||||
model.addAttribute("processTypes", ProcessType.values());
|
||||
model.addAttribute("processStatus", ProcessStatus.values());
|
||||
return "/admin/business/process-completed";
|
||||
}
|
||||
|
||||
|
@ -201,6 +205,8 @@ public class ProcessController {
|
|||
entity.setApplyDate(LocalDate.parse(form.getApplyDate(), formatter));
|
||||
entity.setSealTypes(SealTypeArray.of(form.getSealTypes()));
|
||||
entity.setApplyDept(String.join(",", form.getApplyDept()));
|
||||
Admin admin = InterfaceUtil.getAdmin();
|
||||
entity.setApplyPersonId(admin.getId());
|
||||
|
||||
if (entity.getStatus() == null) {
|
||||
entity.setStatus(ProcessStatus.to_be_audit);
|
||||
|
@ -208,11 +214,22 @@ public class ProcessController {
|
|||
|
||||
entityManager.persist(entity);
|
||||
|
||||
SaleContract saleContract = new SaleContract();
|
||||
BeanUtils.copyProperties(form, saleContract);
|
||||
|
||||
saleContract.setProcessId(entity.getId());
|
||||
entityManager.persist(saleContract);
|
||||
if (entity.getProcessType() != null) {
|
||||
switch (entity.getProcessType()) {
|
||||
case sale_contract:
|
||||
SaleContract saleContract = SaleContract.from(form);
|
||||
saleContract.setProcessId(entity.getId());
|
||||
entityManager.persist(saleContract);
|
||||
break;
|
||||
case business_procurement:
|
||||
ProcurementContract procurementContract = ProcurementContract.from(form);
|
||||
procurementContract.setProcessId(entity.getId());
|
||||
entityManager.persist(procurementContract);
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("还不支持");
|
||||
}
|
||||
}
|
||||
|
||||
List<SaleContractDetailForm> incomeDetails = form.getIncomeDetails();
|
||||
if (!CollectionUtils.isEmpty(incomeDetails)) {
|
||||
|
@ -237,24 +254,19 @@ public class ProcessController {
|
|||
@ResponseBody
|
||||
@PostMapping("/query")
|
||||
public Page<ProjectProcess> list(@RequestBody ProcessQueryForm form, Pageable pageable) {
|
||||
// 从 0 开始
|
||||
PageRequest pageRequest = new PageRequest(pageable.getPageNumber() - 1, pageable.getPageSize());
|
||||
|
||||
// QueryHelper h = new QueryHelper("select * ", "from project_process ");
|
||||
// h.addCondition(form.projectNo != null, "project_no=?", form.projectNo);
|
||||
// h.addCondition(form.projectTitle != null, "project_title like concat('%',?,'%')", form.projectTitle);
|
||||
// h.addCondition(form.applyPersonName != null, "apply_person_name like concat('%',?,'%')", form.applyPersonName);
|
||||
// h.addCondition(form.processType != null, "process_type = ?", () -> form.processType.getValue());
|
||||
// h.addCondition(form.processStatus != null, "status = ?", () -> form.processStatus.getValue());
|
||||
|
||||
// String sql = h.getSql();
|
||||
ProjectProcess projectProcess = new ProjectProcess();
|
||||
BeanUtils.copyProperties(form, projectProcess);
|
||||
projectProcess.setStatus(form.getProcessStatus());
|
||||
|
||||
ExampleMatcher exampleMatcher = ExampleMatcher.matching()
|
||||
.withMatcher("contractNo", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withMatcher("projectTitle", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||
.withMatcher("applyPersonName", ExampleMatcher.GenericPropertyMatcher::contains);
|
||||
|
||||
return repository.findAll(Example.of(projectProcess, exampleMatcher), pageable);
|
||||
return repository.findAll(Example.of(projectProcess, exampleMatcher), pageRequest);
|
||||
}
|
||||
|
||||
// 审核
|
||||
|
|
|
@ -1,44 +1,351 @@
|
|||
<#assign base=request.contextPath />
|
||||
<#import "../../common/defaultLayout.ftl" as defaultLayout>
|
||||
<@defaultLayout.layout>
|
||||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
||||
<style>
|
||||
|
||||
.el-upload__input {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.el-textarea .el-input__count {
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.admin-content-body {
|
||||
margin-bottom: 100px;
|
||||
}
|
||||
|
||||
.el-table__empty-block {
|
||||
height: 60px !important;
|
||||
}
|
||||
|
||||
.el-radio-button__inner, .el-radio-group {
|
||||
line-height: unset;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app">{{ message }}</div>
|
||||
<div class="admin-content" id="app">
|
||||
<div class="admin-content-body">
|
||||
<div class="am-cf am-padding">
|
||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">业务应用</strong> /
|
||||
<small>待我审核</small></div>
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
||||
<div class="am-g">
|
||||
<div class="am-u-sm-12 am-u-md-12">
|
||||
<el-form :inline="true" ref="queryForm" :model="queryForm" label-position="right">
|
||||
|
||||
<div>
|
||||
<el-form-item label="标题">
|
||||
<el-input placeholder="请输入标题" v-model="queryForm.projectTitle" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="项目编号">
|
||||
<el-input placeholder="请输入项目编号" v-model="queryForm.projectNo" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="合同编号">
|
||||
<el-input placeholder="请输入合同编号" v-model="queryForm.contractNo" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="流程类型">
|
||||
<el-select v-model="queryForm.processType" placeholder="请选择" clearable>
|
||||
<el-option label="全部" :value="null"></el-option>
|
||||
<#list processTypes as processType>
|
||||
<el-option label="${processType.description}"
|
||||
value="${processType.name()}"></el-option>
|
||||
</#list>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="申请人">
|
||||
<el-input placeholder="请输入申请人" v-model="queryForm.applyPersonName" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="审核状态">
|
||||
<el-select v-model="queryForm.processStatus" placeholder="请选择" clearable>
|
||||
<el-option label="全部" :value="null"></el-option>
|
||||
<#list processStatus as item>
|
||||
<el-option label="${item.description}"
|
||||
value="${item.name()}"></el-option>
|
||||
</#list>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-button type="primary" @click="queryTable">查询</el-button>
|
||||
</div>
|
||||
|
||||
</el-form>
|
||||
|
||||
<el-table border :data="page.data">
|
||||
<el-table-column type="index" :index="1" label="序号" fixed></el-table-column>
|
||||
<el-table-column prop="projectNo" label="项目编号" fixed width="80"></el-table-column>
|
||||
<el-table-column prop="projectTitle" label="标题" width="350"></el-table-column>
|
||||
<el-table-column prop="processType" label="流程类型" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.processType | processType}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applyPersonName" label="申请人"></el-table-column>
|
||||
<el-table-column prop="status" label="审核状态" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.status | processStatus}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="amount" label="当前审核人" width="100"></el-table-column>
|
||||
<el-table-column prop="lastUpdateAt" label="最后更新时间" width="170"></el-table-column>
|
||||
|
||||
<el-table-column label="操作" fixed="right" width="140">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="showDetail(scope.row, scope)">查看详情</el-button>
|
||||
<el-button type="text" @click="auditProcess(scope.row, scope)">审核</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
|
||||
<el-pagination style="text-align: center; margin-top: 10px"
|
||||
:page-size="page.size"
|
||||
:current-page="page.current"
|
||||
@current-change="handlePageChange"
|
||||
layout="prev, pager, next" :total="page.total"></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog title="审核" :visible.sync="auditFormVisible">
|
||||
<el-form ref="auditForm" :model="auditForm" label-width="80px">
|
||||
|
||||
<el-form-item prop="processStatus" label="审核" :rules="[{ required: true, message: '还没审核'}]">
|
||||
<el-radio-group v-model="auditForm.processStatus">
|
||||
<el-radio label="audit_passed">审核通过</el-radio>
|
||||
<el-radio label="audit_not_passed">审核不通过</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="auditOpinion" label="审核意见" :rules="[{ required: true, message: '审核意见不能为空'}]">
|
||||
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 10}"
|
||||
maxlength="5000" v-model="auditForm.auditOpinion"
|
||||
placeholder="请输入审核意见" cols="90"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitAudit">提交</el-button>
|
||||
</div>
|
||||
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
|
||||
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
||||
|
||||
<script>
|
||||
const {createApp} = Vue
|
||||
|
||||
createApp({
|
||||
data() {
|
||||
return {
|
||||
message: 'Hello Vue!'
|
||||
}
|
||||
const isEmpty = (obj) => {
|
||||
return !obj || (obj.length && obj.length === 0)
|
||||
}
|
||||
|
||||
const isNotEmpty = (obj) => {
|
||||
return !isEmpty(obj)
|
||||
}
|
||||
|
||||
const isBlank = (obj) => {
|
||||
return isEmpty(obj) || (obj.trim && isEmpty(obj.trim()))
|
||||
}
|
||||
|
||||
const hasText = (obj) => {
|
||||
return !isBlank(obj)
|
||||
}
|
||||
|
||||
const data = () => {
|
||||
return {
|
||||
auditForm: {
|
||||
processStatus: null
|
||||
},
|
||||
auditFormVisible: false,
|
||||
page: {
|
||||
data: [],
|
||||
total: 0,
|
||||
size: 10,
|
||||
current: 1,
|
||||
},
|
||||
queryForm: {},
|
||||
projectSelected: false,
|
||||
fileList: [],
|
||||
// 销售合同收入明细
|
||||
incomeDetails: [],
|
||||
}
|
||||
}
|
||||
|
||||
const methods = {
|
||||
showDetail(row, scope) {
|
||||
console.log(row)
|
||||
console.log(scope)
|
||||
|
||||
},
|
||||
auditProcess(row, scope) {
|
||||
this.auditForm = {
|
||||
processId: row.id,
|
||||
processStatus: null
|
||||
}
|
||||
this.auditFormVisible = true
|
||||
},
|
||||
|
||||
submitAudit() {
|
||||
this.$refs["auditForm"].validate((valid) => {
|
||||
if (valid) {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在审核',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
|
||||
const form = this.auditForm
|
||||
|
||||
fetch("${base}/process/audit", {
|
||||
method: 'POST', // or 'PUT'
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(form),
|
||||
}).then(response => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '审核成功',
|
||||
type: 'success'
|
||||
})
|
||||
// 关闭对话框
|
||||
this.auditFormVisible = false
|
||||
}).catch(err => {
|
||||
this.$message.error("审核失败");
|
||||
}).finally(() => loading.close())
|
||||
}
|
||||
}).mount('#app')
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
render(obj) {
|
||||
console.log(obj)
|
||||
},
|
||||
|
||||
queryTable() {
|
||||
const form = {
|
||||
...this.queryForm,
|
||||
}
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在查询',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
|
||||
const { size, current } = this.page
|
||||
fetch("${base}/process/query?size=" + size + "&page=" + current, {
|
||||
method: 'POST', // or 'PUT'
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(form),
|
||||
}).then(res => res.json())
|
||||
.then(data => {
|
||||
this.page = {
|
||||
data: data.content,
|
||||
size: data.size,
|
||||
current: data.number + 1,
|
||||
total: data.totalElements
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error('查询失败');
|
||||
})
|
||||
.finally(() => loading.close())
|
||||
},
|
||||
|
||||
handlePageChange(val) {
|
||||
this.page.current = val
|
||||
this.queryTable()
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data,
|
||||
computed: {
|
||||
projectTitle() {
|
||||
const { projectNo, projectName, applyPersonName, applyDate } = this.processForm
|
||||
if (projectNo && projectName) {
|
||||
return projectNo.trim() + "-" + projectName.trim() + "-" + applyPersonName + "-" + applyDate
|
||||
}
|
||||
return ""
|
||||
},
|
||||
isButtonMode() {
|
||||
return this.mode === BUTTON
|
||||
},
|
||||
isBusinessProcurementContractProcessMode() {
|
||||
return this.mode === newBusinessProcurementContractProcess
|
||||
},
|
||||
isSalesContractProcessMode() {
|
||||
return this.mode === saleContractProcess
|
||||
},
|
||||
isSaleContractDetailMode() {
|
||||
return this.mode === saleContractDetail
|
||||
},
|
||||
subTitle() {
|
||||
switch (this.mode) {
|
||||
case BUTTON:
|
||||
return "新增流程"
|
||||
case saleContractProcess:
|
||||
return "新增销售合同流程"
|
||||
case saleContractDetail:
|
||||
return "销售合同清单明细"
|
||||
case newBusinessProcurementContractProcess:
|
||||
return "新增业务采购合同流程"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods,
|
||||
|
||||
mounted() {
|
||||
this.queryTable()
|
||||
},
|
||||
filters: {
|
||||
processStatus: function (val) {
|
||||
switch (val) {
|
||||
case 'draft':
|
||||
return "草稿"
|
||||
case 'to_be_audit':
|
||||
return "待审核"
|
||||
case 'audit_passed':
|
||||
return "审核通过"
|
||||
case 'audit_not_passed':
|
||||
return "审核不通过"
|
||||
}
|
||||
},
|
||||
processType: function (value) {
|
||||
switch (value) {
|
||||
case 'sale_contract':
|
||||
return "销售合同流程"
|
||||
case 'business_procurement':
|
||||
return "业务采购流程"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
|
||||
})
|
||||
</script>
|
||||
</@defaultLayout.layout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -4,18 +4,6 @@
|
|||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
||||
<style>
|
||||
|
||||
#businessPurchaseDetailsModal {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#businessPurchaseDetailsModal > table {
|
||||
|
||||
}
|
||||
|
||||
#newBusinessProcurementContractProcess {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.el-upload__input {
|
||||
display: none !important;
|
||||
}
|
||||
|
@ -57,6 +45,10 @@
|
|||
<el-input placeholder="请输入项目编号" v-model="queryForm.projectNo" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="合同编号">
|
||||
<el-input placeholder="请输入合同编号" v-model="queryForm.contractNo" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="流程类型">
|
||||
<el-select v-model="queryForm.processType" placeholder="请选择" clearable>
|
||||
<el-option label="全部" :value="null"></el-option>
|
||||
|
@ -81,18 +73,18 @@
|
|||
<el-table-column type="index" :index="1" label="序号" fixed></el-table-column>
|
||||
<el-table-column prop="projectNo" label="项目编号" fixed width="80"></el-table-column>
|
||||
<el-table-column prop="projectTitle" label="标题" width="350"></el-table-column>
|
||||
<el-table-column prop="processType" label="流程类型">
|
||||
<el-table-column prop="processType" label="流程类型" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.processType | processType}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applyPersonName" label="申请人"></el-table-column>
|
||||
<el-table-column prop="status" label="审核状态">
|
||||
<el-table-column prop="status" label="审核状态" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.status | processStatus}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="amount" label="当前审核人"></el-table-column>
|
||||
<el-table-column prop="amount" label="当前审核人" width="100"></el-table-column>
|
||||
<el-table-column prop="lastUpdateAt" label="最后更新时间" width="170"></el-table-column>
|
||||
|
||||
<el-table-column label="操作" fixed="right" width="140">
|
||||
|
@ -239,6 +231,7 @@
|
|||
queryTable() {
|
||||
const form = {
|
||||
...this.queryForm,
|
||||
processStatus: 'to_be_audit'
|
||||
}
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
|
@ -247,7 +240,8 @@
|
|||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
|
||||
fetch("${base}/process/query", {
|
||||
const { size, current } = this.page
|
||||
fetch("${base}/process/query?size=" + size + "&page=" + current, {
|
||||
method: 'POST', // or 'PUT'
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
@ -258,7 +252,7 @@
|
|||
this.page = {
|
||||
data: data.content,
|
||||
size: data.size,
|
||||
current: data.numberOfElements,
|
||||
current: data.number + 1,
|
||||
total: data.totalElements
|
||||
}
|
||||
})
|
||||
|
@ -269,9 +263,8 @@
|
|||
},
|
||||
|
||||
handlePageChange(val) {
|
||||
console.log(`当前页:` + val)
|
||||
|
||||
|
||||
this.page.current = val
|
||||
this.queryTable()
|
||||
},
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue