492 lines
17 KiB
Vue
492 lines
17 KiB
Vue
<template>
|
|
<div class="process">
|
|
<div class="process_box">
|
|
<process-header v-if="$route.query.isBegin || $route.query.isDraft" :title="'发起流程'"></process-header>
|
|
<process-header v-else-if="$route.query.type == 'yiban'" :title="'已办流程'" :proceesNum="prcNum"></process-header>
|
|
<process-header v-else-if=" $route.query.taskDefinitionKey == 'reEdit'" :title="'发起人修改'" :proceesNum="prcNum"></process-header>
|
|
<process-header v-else="" :title="'发起流程'" ></process-header>
|
|
|
|
<div class="procedure">
|
|
<div class="process_content">
|
|
|
|
<span class="base_title">基础信息</span>
|
|
<report-form ref="basMes" :form-control="formControl" :form-controlname="formControlname"
|
|
:process-form="processForm"></report-form>
|
|
|
|
|
|
</div>
|
|
<div class="process_content" v-if="initShow">
|
|
<span class="base_title">审批记录</span>
|
|
<process-approval-history :prcNum="prcNum"></process-approval-history>
|
|
</div>
|
|
<div class="process_content" v-if="isLevel">
|
|
<span class="base_title">指派信息</span>
|
|
<el-form ref="assignFormRef" :model="assignForm" label-width="150px"
|
|
:rules="assignFormRules" class="label-input-form" size="medium">
|
|
<el-row>
|
|
<el-col :span="9" :offset="1">
|
|
<el-form-item label="选择审批人:" prop="oneApprove">
|
|
<el-input readonly :disabled="formControl" v-model="assignForm.oneApproveName"
|
|
placeholder="请选择审批人"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="9" style="margin-left: 5px">
|
|
<el-button size="medium" :disabled="checkBtn" class="checkBtn" @click="handleCheck('spr1')">选取</el-button>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
<process-footer
|
|
v-if="!formControl"
|
|
showCancel
|
|
:show-save="isShowSave"
|
|
:show-submit="isShowSubmit"
|
|
:submitLoading="isSubmit"
|
|
:resetLoading="saveLoading"
|
|
@save="handleSave"
|
|
@submit="handleSubmit"
|
|
></process-footer>
|
|
<orgTable :visible.sync="visibleOrgTable" title="人员列表" dialog-model :config="{
|
|
value: orgTableVal,
|
|
valueName: orgTableValName
|
|
}" :workNumFlag="true" :maxSelected="1" @confirm="isTreeOk"></orgTable>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import processHeader from '@/components/ProcessHeader'
|
|
import processFooter from '@/components/ProcessFooter'
|
|
import processApprovalHistory from '@/components/ProcessApprovalHistory'
|
|
import reportTable from './components/reportForm'
|
|
import {PERMISSION} from '@/utils/Enum/enum'
|
|
import orgTable from '../../components/OrgTable'
|
|
import processMixin from "../../components/ProcessMixin";
|
|
import reportForm from "./components/reportForm";
|
|
export default {
|
|
name: 'launch',
|
|
components: {
|
|
processHeader,
|
|
reportTable,
|
|
processFooter,
|
|
processApprovalHistory,
|
|
orgTable,
|
|
reportForm
|
|
},
|
|
mixins: [processMixin],
|
|
data() {
|
|
return {
|
|
checkBtn:false,
|
|
isLevel: true,
|
|
dataId:'',
|
|
showTableD: false,
|
|
initShow: false, // 控制审批记录是否显示 只有在不是第一次的时候才是true
|
|
treeType: '',
|
|
orgTableVal: '',
|
|
orgTableValName: '',
|
|
visibleOrgTable: false,
|
|
isSubmit: false,
|
|
saveLoading: false,
|
|
isShowSave: false,
|
|
isShowSubmit: true,
|
|
formControl: false,
|
|
formControlname: false,
|
|
assignForm: {
|
|
oneApprove: '',
|
|
twoApprove: '',
|
|
twoApproveName: '',
|
|
oneApproveName: '',
|
|
remark:''
|
|
},
|
|
processForm: {
|
|
prcName: '',
|
|
privacyLevel: '',
|
|
},
|
|
|
|
assignFormRules: {
|
|
oneApprove: [{
|
|
required: true,
|
|
message: '请选择审批人',
|
|
trigger: 'change'
|
|
}],
|
|
},
|
|
prcType: '',
|
|
prcName:'',
|
|
ids:''
|
|
}
|
|
},
|
|
async created() {
|
|
// 如果是从草稿进入的
|
|
if (this.$route.query.isDraft) {
|
|
this.isShowSave = true
|
|
this.dataId= this.$store.getters.handleProcess.dataId
|
|
this.taskId = this.$store.getters.handleProcess?.taskId
|
|
this.prcNum = this.$store.getters.handleProcess?.prcNum
|
|
this.prcId = this.$store.getters.handleProcess?.prcId
|
|
this.prcName = this.$store.getters.handleProcess?.prcName
|
|
this.prcType = this.$store.getters.handleProcess?.prcType
|
|
this.getProcessDetail().then(res => {
|
|
if(this.processOld.submitJson !== '{}'){
|
|
let submitJson=JSON.parse(this.processOld.submitJson)
|
|
this.processForm=JSON.parse(this.processOld.dataJson)
|
|
this.$set(this.assignForm,'oneApprove',submitJson.oneApprove)
|
|
this.$set(this.assignForm,'oneApproveName',submitJson.oneApproveName)
|
|
}
|
|
this.$nextTick(()=>{
|
|
this.$refs.assignFormRef.clearValidate()
|
|
})
|
|
})
|
|
this.getLearder()
|
|
}
|
|
else if (this.$route.query.taskDefinitionKey == 'reEdit' ) {
|
|
this.taskId = this.$store.getters.handleProcess.taskId
|
|
this.prcNum = this.$store.getters.handleProcess.prcNum
|
|
this.prcId = this.$store.getters.handleProcess.prcId
|
|
this.prcType = this.$store.getters.handleProcess?.prcType
|
|
this.initShow = true
|
|
this.formControlname = true
|
|
await this.getProcessDetail()
|
|
let submitJson = JSON.parse(this.processOld.submitJson)
|
|
// this.applicationForm.applyReason = applyReason.applyReason
|
|
this.processForm=JSON.parse(this.processOld.dataJson)
|
|
this.$set(this.assignForm,'oneApprove',submitJson.oneApprove)
|
|
this.$set(this.assignForm,'oneApproveName',submitJson.oneApproveName)
|
|
this.getLearder()
|
|
|
|
}
|
|
else if (this.$route.query.type == 'yiban') {
|
|
this.taskId = this.$store.getters.handleProcess.taskId
|
|
this.prcNum = this.$store.getters.handleProcess.prcNum
|
|
this.prcId = this.$store.getters.handleProcess.prcId
|
|
this.prcType = this.$store.getters.handleProcess?.prcType
|
|
this.formControl = true
|
|
this.initShow = true
|
|
this.showTableD = true
|
|
this.getProcessDetail().then((res) => {
|
|
let submitJson = JSON.parse(this.processOld.submitJson)
|
|
this.processForm=JSON.parse(this.processOld.dataJson)
|
|
// this.applicationForm.applyReason = applyReason.applyReason
|
|
this.$set(this.assignForm,'oneApprove',submitJson.oneApprove)
|
|
this.$set(this.assignForm,'oneApproveName',submitJson.oneApproveName)
|
|
})
|
|
}else{
|
|
this.isShowSave = true
|
|
this.$store.commit('setHandleProcess','')
|
|
this.handleReset()
|
|
if((this.$store.getters.userInfo.levelId=='1' || this.$store.getters.userInfo.levelId=='2'
|
|
||this.$store.getters.userInfo.levelId=='3' || this.$store.getters.userInfo.levelId=='4'
|
|
|| this.$store.getters.userInfo.levelId=='5'
|
|
)&& this.$store.getters.userInfo.employeeTypeId=='1' ){
|
|
this.isShowSave = false
|
|
this.isLevel=false
|
|
}else{
|
|
this.getLearder()
|
|
this.isLevel = true
|
|
this.isShowSave = true
|
|
}
|
|
// 第一次进入此页面 需要依据ids区分是新增还是编辑流程
|
|
if(this.$route.query.ids){
|
|
this.prcType=5
|
|
// 调用接口
|
|
this.ids=this.$route.query.ids
|
|
// 如果该用户的levelId==5 就直接编辑 并且不显示指派信息
|
|
|
|
this.getReportDetail()
|
|
}else{
|
|
this.prcType=4
|
|
// 需要给部门带出来
|
|
if(this.$store.getters.userInfo.orgEOList.length>0){
|
|
let temp=this.$store.getters.userInfo.orgEOList
|
|
this.$set(this.processForm,'departmentName',temp[0].longName)
|
|
this.$set(this.processForm,'department',temp[0].id)
|
|
console.log(this.processForm,"wowowwoo")
|
|
}
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
// 获取领导
|
|
getLearder(){
|
|
console.log("获取领导")
|
|
this.$api.reportProcess.getLeader({
|
|
userId:this.userId
|
|
}).then(res=>{
|
|
if(res.data){
|
|
this.$set(this.assignForm,'oneApprove',res.data[0].usid)
|
|
this.$set(this.assignForm,'oneApproveName',res.data[0].usname)
|
|
|
|
this.checkBtn=true
|
|
}else{
|
|
this.checkBtn=false
|
|
}
|
|
})
|
|
|
|
},
|
|
// 查询文件名称
|
|
getFileName(){
|
|
this.$api.reportProcess.searchFile({fileId:this.processForm.fileId}).then(res=>{
|
|
this.$set(this.processForm,'fileName',res.data)
|
|
})
|
|
},
|
|
// 获取报告详情
|
|
getReportDetail(){
|
|
this.$api.report.getReportDetail(this.ids).then(res=>{
|
|
this.processForm=res.data
|
|
this.processForm.reportId=this.processForm.id
|
|
if(this.isLevel){
|
|
delete this.processForm['id']
|
|
if(this.processForm.fileId){
|
|
this.getFileName()
|
|
}
|
|
}
|
|
|
|
})
|
|
},
|
|
handleReset() {
|
|
this.processForm={
|
|
departmentName:'',
|
|
department:'',
|
|
name:'',
|
|
year:'',
|
|
labelList:[],
|
|
confidentialLevel:'',
|
|
secrecyLast:'',
|
|
privacyLevel:'',
|
|
tags:'',
|
|
mainContent:'',
|
|
fileId:'',
|
|
fileName:'',
|
|
}
|
|
this.applicationForm = {
|
|
applyReason: '',
|
|
power: ''
|
|
}
|
|
|
|
this.assignForm = {
|
|
oneApprove: '',
|
|
twoApprove: ''
|
|
}
|
|
this.$nextTick(() => {
|
|
if( this.$refs.assignFormRef){
|
|
this.$refs.assignFormRef.clearValidate()
|
|
|
|
}
|
|
})
|
|
|
|
},
|
|
handleCheck(name) {
|
|
if (this.formControl) {
|
|
return false
|
|
}
|
|
this.treeType = name
|
|
this.orgTableVal = ''
|
|
this.orgTableValName = ''
|
|
if (name === 'spr1') {
|
|
this.orgTableVal = this.assignForm.oneApprove ? this.assignForm.oneApprove : ''
|
|
this.orgTableValName = this.assignForm.oneApproveName ? this.assignForm.oneApproveName : ''
|
|
} else {
|
|
this.orgTableVal = this.assignForm.twoApprove ? this.assignForm.twoApprove : ''
|
|
this.orgTableValName = this.assignForm.twoApproveName ? this.assignForm.twoApproveName : ''
|
|
}
|
|
this.visibleOrgTable = true
|
|
},
|
|
// 树点击
|
|
isTreeOk(checkedList) {
|
|
|
|
// console.log(checkedList)
|
|
const parts = []
|
|
const partsName = []
|
|
checkedList.map((item, index) => {
|
|
parts.push(item.userId || item.USID)
|
|
partsName.push(item.uname)
|
|
})
|
|
this.qcrList = checkedList
|
|
if (this.treeType === 'spr1') {
|
|
this.assignForm.oneApprove = parts.toString()
|
|
this.assignForm.oneApproveName = partsName.toString()
|
|
} else if (this.treeType === 'spr2') {
|
|
this.assignForm.twoApprove = parts.toString()
|
|
this.assignForm.twoApproveName = partsName.toString()
|
|
}
|
|
// console.log(this.assignForm.name1Id, this.assignForm.name2Id)
|
|
},
|
|
// 保存
|
|
handleSave(){
|
|
this.processForm=this.$refs.basMes.form
|
|
if(this.$refs.basMes.tags){
|
|
this.processForm.keyContent = JSON.stringify(this.$refs.basMes.tags)
|
|
}
|
|
this.processForm.prcName=this.processForm.name&&this.processForm.name
|
|
this.saveLoading = true
|
|
|
|
let submitJson = JSON.stringify({...this.assignForm, userId: this.$store.getters.userInfo.usid})
|
|
let dataJson = JSON.stringify(this.processForm)
|
|
let params = {
|
|
prcName: this.processForm.name,
|
|
userId: this.$store.getters.userInfo.usid,
|
|
prcType: this.prcType,
|
|
createUserName: this.$store.getters.userInfo.usname,
|
|
createUser: this.$store.getters.userInfo.usid,
|
|
submitJson,
|
|
dataJson,
|
|
id: this.$store.getters.handleProcess?.id,
|
|
reportId: this.processForm.reportId || ''
|
|
}
|
|
this.saveProcess(params).then(
|
|
()=>{
|
|
this.saveLoading = false
|
|
this.$store.commit('setActiveTabIndex', 'five')
|
|
this.$message['success']('保存成功')
|
|
this.$router.push({
|
|
path: "/userCenter/processCenter",
|
|
query: {
|
|
id: 'AEHJB8YNJ3'
|
|
}
|
|
})
|
|
}
|
|
).catch(()=>{
|
|
this.saveLoading = false
|
|
})
|
|
},
|
|
// 提交
|
|
handleSubmit() {
|
|
console.log(this.$store.getters.userInfo.usid, " this.$store.getters.userInfo.USID")
|
|
|
|
if(this.isLevel){
|
|
this.$refs.assignFormRef.validate( v => {
|
|
this.processForm=this.$refs.basMes.form
|
|
this.processForm.keyContent = JSON.stringify(this.$refs.basMes.tags)
|
|
this.processForm.prcName=this.processForm.name
|
|
// this.processForm.labelList= JSON.stringify(this.processForm.labelList)
|
|
|
|
let z=this.$refs.basMes.submit()
|
|
if (v && z) {
|
|
console.log(this.processForm,"his.processFormhis.processFormhis.processForm")
|
|
// 判断报告名称是否重复
|
|
this.$api.reportProcess.JggleName({
|
|
id:this.processForm.reportId || '',
|
|
name:this.processForm.name,
|
|
prcType:this.prcType
|
|
}).then(async res=>{
|
|
|
|
this.processForm.createUserId=this.userId
|
|
//如果不是第一次
|
|
if (this.initShow) {
|
|
// 判断当前提交人是不是审批人
|
|
let flag=await this.JuggleSub(this.taskId)
|
|
if(flag){
|
|
|
|
let dataJson = JSON.stringify(this.processForm)
|
|
let submitJson = JSON.stringify({...this.assignForm, userId: this.$store.getters.userInfo.usid})
|
|
this.completeProcess({
|
|
dataJson,
|
|
submitJson,
|
|
taskId: this.taskId,
|
|
userId: this.$store.getters.userInfo.usid,
|
|
prcType: this.prcType,
|
|
reportId: this.processForm.reportId|| ''
|
|
})
|
|
}
|
|
} else {
|
|
// 如果草稿发起 判断在不在流程中
|
|
if(this.$route.query.isDraft && this.prcType==5) {
|
|
this.isSendDraft().then((res)=> {
|
|
this.startProcess()
|
|
})
|
|
}else{
|
|
this.startProcess()
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.warning('请检查表单填写完整')
|
|
}
|
|
})
|
|
}else{
|
|
this.processForm=this.$refs.basMes.form
|
|
this.processForm.keyContent = JSON.stringify(this.$refs.basMes.tags)
|
|
this.processForm.prcName=this.processForm.name
|
|
// this.processForm.labelList= JSON.stringify(this.processForm.labelList)
|
|
|
|
let z=this.$refs.basMes.submit()
|
|
if(z){
|
|
this.processForm=this.$refs.basMes.form
|
|
this.processForm.id=this.processForm.reportId
|
|
this.processForm.keyContent = JSON.stringify(this.$refs.basMes.tags)
|
|
// 先判断名称是不是重复
|
|
this.$api.reportProcess.JggleName({
|
|
id:this.processForm.reportId || '',
|
|
name:this.processForm.name
|
|
}).then( res=>{
|
|
this.$api.report.reportAdd(this.processForm).then(_ => {
|
|
this.$message.success('操作成功');
|
|
this.$router.push({
|
|
path:"/report/manager",
|
|
query:{
|
|
id:'AEHJB8YNJ3'
|
|
}
|
|
})
|
|
})
|
|
})
|
|
}else{
|
|
this.$message.warning('请检查表单填写完整')
|
|
}
|
|
}
|
|
},
|
|
// 草稿发起 需要先调用这个接口
|
|
isSendDraft() {
|
|
let ids = this.processForm.reportId || ''
|
|
return new Promise((resolve, reject) => {
|
|
this.$api.process.selectReport({usid: this.userId, ids: [ids]}).then((res) => {
|
|
if (res.data.length == 0) {
|
|
resolve(true)
|
|
} else {
|
|
this.$message.warning("报告" + res.data.join(',') + "已经在流程中")
|
|
reject()
|
|
}
|
|
|
|
})
|
|
})
|
|
},
|
|
startProcess() {
|
|
//把表单都整合到form中
|
|
// dataJson与submitJson需要发到completeProcess
|
|
let form = {}
|
|
form = {
|
|
approveData: {
|
|
...this.processForm, ...this.assignForm,
|
|
userId: this.$store.getters.userInfo.usid
|
|
}, dataMsg: this.processForm
|
|
}
|
|
form.approvalOpinion = this.assignForm.remark
|
|
form.prcType = this.prcType
|
|
form.prcName = this.processForm.name
|
|
form.userId = this.$store.getters.userInfo.usid
|
|
form.bpnId = this.$store.getters.handleProcess?.id
|
|
//...this.applicationForm,...this.processForm,
|
|
let dataJson = JSON.stringify(this.processForm)
|
|
let submitJson = JSON.stringify({...this.assignForm, userId: this.$store.getters.userInfo.usid,approvalOpinion:this.assignForm.remark})
|
|
this.$api.process.startProcess(form).then(({data}) => {
|
|
this.completeProcess({dataJson, submitJson, taskId: data.result, userId: form.userId, prcType: this.prcType, reportId: this.processForm.reportId|| ''})
|
|
})
|
|
},
|
|
//获取流程详细信息
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.checkBtn {
|
|
padding: 11px 20px !important;
|
|
background-color:#1890FF;
|
|
color: #fff;
|
|
}
|
|
.el-button.is-disabled, .el-button.is-disabled:hover, .el-button.is-disabled:focus{
|
|
background-color: #82bffc;
|
|
color: #fff;
|
|
}
|
|
</style>
|