业务应用/已办流程
parent
dfbadfe668
commit
ca0b7680b6
|
@ -12,6 +12,7 @@ import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
@ -25,6 +26,7 @@ import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -266,6 +268,10 @@ public class ProcessController {
|
||||||
.withMatcher("projectTitle", ExampleMatcher.GenericPropertyMatcher::contains)
|
.withMatcher("projectTitle", ExampleMatcher.GenericPropertyMatcher::contains)
|
||||||
.withMatcher("applyPersonName", ExampleMatcher.GenericPropertyMatcher::contains);
|
.withMatcher("applyPersonName", ExampleMatcher.GenericPropertyMatcher::contains);
|
||||||
|
|
||||||
|
// 只展示自己创建的草稿
|
||||||
|
// Admin admin = InterfaceUtil.getAdmin();
|
||||||
|
// projectProcess.setApplyPersonId(admin.getId());
|
||||||
|
|
||||||
return repository.findAll(Example.of(projectProcess, exampleMatcher), pageRequest);
|
return repository.findAll(Example.of(projectProcess, exampleMatcher), pageRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,4 +304,45 @@ public class ProcessController {
|
||||||
return entityManager.find(ProjectProcess.class, id);
|
return entityManager.find(ProjectProcess.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/revoke/{id}")
|
||||||
|
public void revoke(@PathVariable("id") int id) {
|
||||||
|
// TODO 发起申请的人,在第一个人还没审批的情况下可以撤回
|
||||||
|
jdbcTemplate.update("update project_process set `status` =? where id =? ", ProcessStatus.draft.getValue(), id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public void delete(@PathVariable("id") int id) {
|
||||||
|
Admin admin = InterfaceUtil.getAdmin();
|
||||||
|
Integer applyUserId = admin.getId();
|
||||||
|
int update = jdbcTemplate.update("delete from project_process where id =? and apply_person_id=?", id, applyUserId);
|
||||||
|
if (update != 1) {
|
||||||
|
throw new RuntimeException("删除的流程不存在或者不属于自己");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看审核流程
|
||||||
|
*/
|
||||||
|
@ResponseBody
|
||||||
|
@GetMapping("/audits/{id}")
|
||||||
|
public List<Map<String, String>> showAudits(@PathVariable("id") int id) {
|
||||||
|
ArrayList<Map<String, String>> ret = new ArrayList<>();
|
||||||
|
|
||||||
|
ret.add(create("2021-01-03 12:07:45", "提交审核"));
|
||||||
|
ret.add(create("2021-01-28 12:15:05", "工程运维管理部孙果审核已通过"));
|
||||||
|
ret.add(create("2021-02-03 22:01:12", "系统产品集成部尹浩审核已通过"));
|
||||||
|
ret.add(create("2021-03-03 22:05:12", "财务部主管何丹审核已通过"));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> create(String timestamp, String content) {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("content", content);
|
||||||
|
map.put("timestamp", timestamp);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<div class="admin-content-body">
|
<div class="admin-content-body">
|
||||||
<div class="am-cf am-padding">
|
<div class="am-cf am-padding">
|
||||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">业务应用</strong> /
|
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">业务应用</strong> /
|
||||||
<small>待我审核</small></div>
|
<small>已办流程</small></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="am-g">
|
<div class="am-g">
|
||||||
|
@ -84,6 +84,7 @@
|
||||||
<el-table-column type="index" :index="1" label="序号" fixed></el-table-column>
|
<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="projectNo" label="项目编号" fixed width="80"></el-table-column>
|
||||||
<el-table-column prop="projectTitle" label="标题" width="350"></el-table-column>
|
<el-table-column prop="projectTitle" label="标题" width="350"></el-table-column>
|
||||||
|
<el-table-column prop="contractNo" label="合同编号" width="80"></el-table-column>
|
||||||
<el-table-column prop="processType" label="流程类型" width="100">
|
<el-table-column prop="processType" label="流程类型" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.processType | processType}}</span>
|
<span>{{scope.row.processType | processType}}</span>
|
||||||
|
@ -98,10 +99,20 @@
|
||||||
<el-table-column prop="amount" label="当前审核人" width="100"></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 prop="lastUpdateAt" label="最后更新时间" width="170"></el-table-column>
|
||||||
|
|
||||||
<el-table-column label="操作" fixed="right" width="140">
|
<el-table-column label="操作" fixed="right" width="250">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" @click="showDetail(scope.row, scope)">查看详情</el-button>
|
<el-button
|
||||||
<el-button type="text" @click="auditProcess(scope.row, scope)">审核</el-button>
|
v-if="scope.row.status==='audit_passed' || scope.row.status==='audit_not_passed' || scope.row.status==='to_be_audit'"
|
||||||
|
type="text" @click="showDetail(scope.row, scope)">查看详情
|
||||||
|
</el-button>
|
||||||
|
<el-button v-if="scope.row.status==='audit_passed' || scope.row.status==='audit_not_passed'"
|
||||||
|
type="text" @click="showAuditDetail(scope.row, scope)">查看审核流程
|
||||||
|
</el-button>
|
||||||
|
<el-button v-if="scope.row.status==='draft' || scope.row.status==='audit_not_passed'"
|
||||||
|
type="text" @click="editProcess(scope.row, scope)">编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button v-if="scope.row.status==='to_be_audit'" type="text" @click="revokeProcess(scope.row, scope)">撤回</el-button>
|
||||||
|
<el-button v-if="scope.row.status==='draft'" type="text" @click="deleteProcess(scope.row, scope)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
@ -115,27 +126,17 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dialog title="审核" :visible.sync="auditFormVisible">
|
<el-dialog title="审核详情" :visible.sync="auditDetailVisible">
|
||||||
<el-form ref="auditForm" :model="auditForm" label-width="80px">
|
<el-timeline>
|
||||||
|
<el-timeline-item
|
||||||
<el-form-item prop="processStatus" label="审核" :rules="[{ required: true, message: '还没审核'}]">
|
v-for="(item, index) in auditDetails"
|
||||||
<el-radio-group v-model="auditForm.processStatus">
|
:key="index"
|
||||||
<el-radio label="audit_passed">审核通过</el-radio>
|
:color="item.color||'red'"
|
||||||
<el-radio label="audit_not_passed">审核不通过</el-radio>
|
:size="item.size||'normal'"
|
||||||
</el-radio-group>
|
:timestamp="item.timestamp">
|
||||||
</el-form-item>
|
{{item.content}}
|
||||||
|
</el-timeline-item>
|
||||||
<el-form-item prop="auditOpinion" label="审核意见" :rules="[{ required: true, message: '审核意见不能为空'}]">
|
</el-timeline>
|
||||||
<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>
|
</el-dialog>
|
||||||
|
|
||||||
|
@ -169,7 +170,8 @@
|
||||||
auditForm: {
|
auditForm: {
|
||||||
processStatus: null
|
processStatus: null
|
||||||
},
|
},
|
||||||
auditFormVisible: false,
|
auditDetailVisible: false,
|
||||||
|
auditDetails: [],
|
||||||
page: {
|
page: {
|
||||||
data: [],
|
data: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
|
@ -177,10 +179,6 @@
|
||||||
current: 1,
|
current: 1,
|
||||||
},
|
},
|
||||||
queryForm: {},
|
queryForm: {},
|
||||||
projectSelected: false,
|
|
||||||
fileList: [],
|
|
||||||
// 销售合同收入明细
|
|
||||||
incomeDetails: [],
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,12 +188,110 @@
|
||||||
console.log(scope)
|
console.log(scope)
|
||||||
|
|
||||||
},
|
},
|
||||||
auditProcess(row, scope) {
|
editProcess(row, scope) {
|
||||||
this.auditForm = {
|
|
||||||
processId: row.id,
|
},
|
||||||
processStatus: null
|
deleteProcess(row, scope) {
|
||||||
}
|
this.$confirm('您确认要删除审批流程吗?', '删除', {
|
||||||
this.auditFormVisible = true
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
const loading = this.$loading({
|
||||||
|
lock: true,
|
||||||
|
text: '正在删除',
|
||||||
|
spinner: 'el-icon-loading',
|
||||||
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
|
})
|
||||||
|
|
||||||
|
fetch("${base}/process/" + row.id, {
|
||||||
|
method: 'DELETE', // or 'PUT'
|
||||||
|
}).then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
this.queryTable()
|
||||||
|
this.$message({
|
||||||
|
showClose: true,
|
||||||
|
message: '删除成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Promise.reject(response)
|
||||||
|
}
|
||||||
|
}).catch(res => {
|
||||||
|
res.json().then(json => {
|
||||||
|
this.$message.error(json.message || "删除失败");
|
||||||
|
})
|
||||||
|
}).finally(() => loading.close())
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消删除'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
revokeProcess(row, scope) {
|
||||||
|
this.$confirm('您确认要撤回审批流程吗?', '撤回', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
const loading = this.$loading({
|
||||||
|
lock: true,
|
||||||
|
text: '正在撤销',
|
||||||
|
spinner: 'el-icon-loading',
|
||||||
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
|
})
|
||||||
|
|
||||||
|
fetch("${base}/process/revoke/" + row.id, {
|
||||||
|
method: 'POST', // or 'PUT'
|
||||||
|
}).then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
this.queryTable()
|
||||||
|
this.$message({
|
||||||
|
showClose: true,
|
||||||
|
message: '撤销成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Promise.reject(response)
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
this.$message.error("撤销失败");
|
||||||
|
}).finally(() => loading.close())
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showAuditDetail(row, scope) {
|
||||||
|
const loading = this.$loading({
|
||||||
|
lock: true,
|
||||||
|
text: '正在查询数据',
|
||||||
|
spinner: 'el-icon-loading',
|
||||||
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
|
})
|
||||||
|
|
||||||
|
fetch("${base}/process/audits/" + row.id).then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
// 展示弹窗
|
||||||
|
response.json().then(json => {
|
||||||
|
this.auditDetailVisible = true
|
||||||
|
this.auditDetails = json
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Promise.reject(response)
|
||||||
|
}
|
||||||
|
}).catch(res => {
|
||||||
|
res.json().then(json => {
|
||||||
|
this.$message.error(json.message || "数据获取失败");
|
||||||
|
})
|
||||||
|
}).finally(() => loading.close())
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
submitAudit() {
|
submitAudit() {
|
||||||
|
|
|
@ -755,11 +755,16 @@
|
||||||
},
|
},
|
||||||
body: JSON.stringify(form),
|
body: JSON.stringify(form),
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
this.$message({
|
if (response.ok) {
|
||||||
showClose: true,
|
this.$message({
|
||||||
message: '提交成功',
|
showClose: true,
|
||||||
type: 'success'
|
message: '提交成功',
|
||||||
})
|
type: 'success'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Promise.reject("失败")
|
||||||
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.$message.error("项目提交失败");
|
this.$message.error("项目提交失败");
|
||||||
}).finally(() => loading.close())
|
}).finally(() => loading.close())
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
<el-table-column type="index" :index="1" label="序号" fixed></el-table-column>
|
<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="projectNo" label="项目编号" fixed width="80"></el-table-column>
|
||||||
<el-table-column prop="projectTitle" label="标题" width="350"></el-table-column>
|
<el-table-column prop="projectTitle" label="标题" width="350"></el-table-column>
|
||||||
|
<el-table-column prop="contractNo" label="合同编号" width="80"></el-table-column>
|
||||||
<el-table-column prop="processType" label="流程类型" width="100">
|
<el-table-column prop="processType" label="流程类型" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.processType | processType}}</span>
|
<span>{{scope.row.processType | processType}}</span>
|
||||||
|
@ -91,6 +92,7 @@
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" @click="showDetail(scope.row, scope)">查看详情</el-button>
|
<el-button type="text" @click="showDetail(scope.row, scope)">查看详情</el-button>
|
||||||
<el-button type="text" @click="auditProcess(scope.row, scope)">审核</el-button>
|
<el-button type="text" @click="auditProcess(scope.row, scope)">审核</el-button>
|
||||||
|
<el-button type="text" @click="revokeProcess(scope.row, scope)">审核</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
@ -167,9 +169,6 @@
|
||||||
},
|
},
|
||||||
queryForm: {},
|
queryForm: {},
|
||||||
projectSelected: false,
|
projectSelected: false,
|
||||||
fileList: [],
|
|
||||||
// 销售合同收入明细
|
|
||||||
incomeDetails: [],
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,13 +205,26 @@
|
||||||
},
|
},
|
||||||
body: JSON.stringify(form),
|
body: JSON.stringify(form),
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
// 关闭对话框
|
||||||
|
this.auditFormVisible = false
|
||||||
|
this.queryTable()
|
||||||
|
this.$message({
|
||||||
|
showClose: true,
|
||||||
|
message: '撤销成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Promise.reject(response)
|
||||||
|
}
|
||||||
|
|
||||||
this.$message({
|
this.$message({
|
||||||
showClose: true,
|
showClose: true,
|
||||||
message: '审核成功',
|
message: '审核成功',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
// 关闭对话框
|
|
||||||
this.auditFormVisible = false
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.$message.error("审核失败");
|
this.$message.error("审核失败");
|
||||||
}).finally(() => loading.close())
|
}).finally(() => loading.close())
|
||||||
|
|
Loading…
Reference in New Issue