index.vue 1.81 KB
<template>
	<el-dialog
		v-dialogDrag
		:close-on-click-modal="false"
		title="选择审批人"
		:visible.sync="visible"
		width="500px"
		@close="visible = false"
		:modal-append-to-body="false"
	>
		<div class="spr">
			<el-radio
				v-model="spr"
				:label="item.activityInstance"
				v-for="item in sprList"
				:key="item.activityInstance"
				border
				>{{ item.name }}</el-radio
			>
		</div>
		<div class="dialog-footer">
			<el-button type="primary" @click="confirm">确 定</el-button>
			<el-button @click="visible = false">取 消</el-button>
		</div>
	</el-dialog>
</template>

<script>
import { pretransitProcess, transitProcess } from "@api/user";
export default {
	name: "",
	components: {},
	props: {
		visible: {
			type: Boolean,
			default: function() {
				return false;
			},
		},
		workitemInstanceId: {
			type: String,
			default: "",
		},
	},
	data() {
		return {
			spr: "",
			sprList: [],
		};
	},
	created() {},
	mounted() {},
	methods: {
		confirm() {
			let params = {
				executeActors: this.sprList.filter(i => i.activityInstance == this.spr),
				message: "",
				params: {},
                targetNodes: [],
                workitemInstanceId:this.$route.query.workitemInstanceId
            };
			transitProcess(params).then((res) => {
				this.$message.success("提交成功!")
			});
		},
		getSpr() {
			let params = {
				params: {},
				workitemInstanceId: this.$route.query.workitemInstanceId,
			};
			pretransitProcess(params).then((res) => {
				this.sprList = res[0].masterActors;
				this.spr = res[0].masterActors[0].activityInstance;
			});
		},
	},
	computed: {},
	watch: {
		visible: {
			handler(val) {
				if (val) {
					this.getSpr();
				}
			},
			immediate: true,
		},
	},
};
</script>
<style scoped lang="less">
.spr {
	margin: 20px 0;
}
.dialog-footer {
	text-align: center;
}
</style>