|
@@ -0,0 +1,211 @@
|
|
|
+<template>
|
|
|
+ <a-card :title="title">
|
|
|
+ <template #extra>
|
|
|
+ <a-button type="primary" @click="handleOk" :loading="btnLoading" :disabled="btnLoading">发起申请</a-button>
|
|
|
+ <a-button style="margin-left:10px" @click="handleCancel">取消</a-button>
|
|
|
+
|
|
|
+ </template>
|
|
|
+ <iframe :src="viewSrc" id="viewFrame" width="100%" :height="height" style="border:0;background-color:#fff"/>
|
|
|
+ <a-modal title="提交申请" v-model="modalVisible" :mask-closable="false" :width="500" :footer="null">
|
|
|
+ <div v-if="modalVisible">
|
|
|
+ <a-form-item label="选择审批人" v-show="showAssign">
|
|
|
+ <a-select
|
|
|
+ style="width: 80%"
|
|
|
+ v-model="form.assignees"
|
|
|
+ placeholder="请选择"
|
|
|
+ mode="multiple"
|
|
|
+ :allowClear="true"
|
|
|
+ >
|
|
|
+ <a-select-option v-for="(item, i) in assigneeList" :key="i" :value="item.username">
|
|
|
+ {{
|
|
|
+ item.realname
|
|
|
+ }}
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="下一审批人" v-show="isGateway">
|
|
|
+ <a-alert type="info" showIcon message="分支网关处不支持自定义选择下一审批人,将自动下发给所有可审批人。">,将发送给下一节点所有人</a-alert>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="优先级" prop="priority">
|
|
|
+ <a-select
|
|
|
+ v-model="form.priority"
|
|
|
+ placeholder="请选择"
|
|
|
+ :allowClear="true"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <a-select-option :value="0">普通</a-select-option>
|
|
|
+ <a-select-option :value="1">重要</a-select-option>
|
|
|
+ <a-select-option :value="2">紧急</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="消息通知">
|
|
|
+ <a-checkbox v-model="form.sendMessage">站内消息通知</a-checkbox>
|
|
|
+ </a-form-item>
|
|
|
+ <div slot="footer">
|
|
|
+ <a-button type="text" @click="modalVisible = false">取消</a-button>
|
|
|
+ <div style="display:inline-block;width: 20px;"></div>
|
|
|
+ <a-button type="primary" :disabled="submitLoading" @click="applySubmit">提交</a-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </a-modal>
|
|
|
+ </a-card>
|
|
|
+
|
|
|
+
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import { getAction, postAction } from '@/api/manage'
|
|
|
+export default {
|
|
|
+ inject:['closeCurrent'],
|
|
|
+ data(){
|
|
|
+ return {
|
|
|
+ visible:true,
|
|
|
+ title:"",
|
|
|
+ viewSrc:"",
|
|
|
+ height:"300px",
|
|
|
+ btnLoading:false,
|
|
|
+ url:{
|
|
|
+ get:"/activiti/tbTableInfoOuter/queryByText", // 获取外部表单定义
|
|
|
+ apply:"/actBusiness/addOuter", // 保存申请
|
|
|
+ getFirstNode: '/actProcessIns/getFirstNode',// 获取第一个节点
|
|
|
+ submitApply: '/actBusiness/external/apply',// 提交申请
|
|
|
+ },
|
|
|
+ query:{},
|
|
|
+ modalVisible:false,
|
|
|
+ showAssign:false,
|
|
|
+ assigneeList:[],
|
|
|
+ isGateway:false,
|
|
|
+ form:{
|
|
|
+ },
|
|
|
+ submitLoading:false,
|
|
|
+ procDefId:"",
|
|
|
+ error:"",
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created(){
|
|
|
+ this.query = this.$route.query;
|
|
|
+ this.height=(document.body.scrollHeight-300)+"px";
|
|
|
+ this.title = "发起流程:"+this.query.type;
|
|
|
+ this.gotoView();
|
|
|
+ },
|
|
|
+ mounted(){
|
|
|
+
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ gotoView(){
|
|
|
+ getAction(this.url.get,{text:this.query.type}).then(res=>{
|
|
|
+ if (res.success){
|
|
|
+ this.viewSrc=res.result.viewurl+"?"+this.jsonToUrlParam();
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleCancel(){
|
|
|
+ this.closeCurrent();
|
|
|
+ },
|
|
|
+ handleOk(){
|
|
|
+ this.btnLoading = true;
|
|
|
+ postAction(this.url.apply,this.query).then(res=>{
|
|
|
+ this.btnLoading = false;
|
|
|
+ if (res.success){
|
|
|
+ this.form = res.result;
|
|
|
+ this.form.priority = 0;
|
|
|
+ this.form.assignees = [];
|
|
|
+ this.form.sendMessage = true;
|
|
|
+ this.showSubmitDlg();
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ jsonToUrlParam(){
|
|
|
+ var tmpArr = [];
|
|
|
+ for (var i in this.query){
|
|
|
+ var key = encodeURIComponent(i);
|
|
|
+ var value = encodeURIComponent(this.query[i]);
|
|
|
+ tmpArr.push(key+"="+value);
|
|
|
+ }
|
|
|
+ return tmpArr.join("&");
|
|
|
+ },
|
|
|
+ showSubmitDlg(){
|
|
|
+ // 加载审批人
|
|
|
+ getAction(this.url.getFirstNode, { procDefId: this.form.procDefId }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ if (res.result.type == 3 || res.result.type == 4) {
|
|
|
+ this.isGateway = true;
|
|
|
+ this.modalVisible = true;
|
|
|
+ this.showAssign = false;
|
|
|
+ this.error = '';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.isGateway = false;
|
|
|
+ if (res.result.users && res.result.users.length > 0) {
|
|
|
+ this.error = '';
|
|
|
+ this.assigneeList = res.result.users;
|
|
|
+ // 默认勾选
|
|
|
+ let ids = []
|
|
|
+ res.result.users.forEach(e => {
|
|
|
+ ids.push(e.username)
|
|
|
+ })
|
|
|
+ this.form.assignees = ids
|
|
|
+ this.showAssign = true
|
|
|
+ } else {
|
|
|
+ this.form.assignees = []
|
|
|
+ this.showAssign = true
|
|
|
+ this.error = '审批节点未分配候选审批人员,请联系管理员!'
|
|
|
+ }
|
|
|
+ if (this.error) {
|
|
|
+ this.$message.error(this.error)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.modalVisible = true
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ applySubmit() {
|
|
|
+ if (this.showAssign && this.form.assignees.length < 1) {
|
|
|
+ this.error = '请至少选择一个审批人'
|
|
|
+ this.$message.error(this.error)
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ this.error = ''
|
|
|
+ }
|
|
|
+ this.submitLoading = true
|
|
|
+ var params = Object.assign({}, this.form)
|
|
|
+ params.assignees = params.assignees.join(',')
|
|
|
+ postAction(this.url.submitApply, params)
|
|
|
+ .then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.modalVisible = false;
|
|
|
+ this.$message.success('提交成功,请等待审批',2).then(()=>{
|
|
|
+ this.closeCurrent();
|
|
|
+ });
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message)
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .finally(() => (this.submitLoading = false))
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style scoped>
|
|
|
+.header{
|
|
|
+ color: #666;
|
|
|
+ background: #fff;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bolder;
|
|
|
+}
|
|
|
+.footer{
|
|
|
+ color: #666;
|
|
|
+ background: #fff;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+</style>
|