66 lines
1.7 KiB
Vue
66 lines
1.7 KiB
Vue
<template>
|
|
<div>
|
|
{{ formKey }}
|
|
<el-button type="primary" v-for="item in buttons" :key="item.name" @click="buttonClick(item)" size="small">
|
|
{{ item.name }}
|
|
</el-button>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
module.exports = {
|
|
name: "index",
|
|
props: {
|
|
taskId: {
|
|
type: Number,
|
|
required: true
|
|
},
|
|
formKey: {
|
|
type: String,
|
|
required: true
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
buttons: []
|
|
}
|
|
},
|
|
methods: {
|
|
getButtons() {
|
|
$.get("/platform/flow/common/loadSequenceFlows", { taskId: this.taskId }).then((res) => {
|
|
if (res.code === 0) {
|
|
this.buttons = res.data
|
|
}
|
|
})
|
|
},
|
|
buttonClick(item) {
|
|
this.$root.$refs[this.formKey].validate((valid) => {
|
|
if (valid) {
|
|
this.$confirm(`您确定要${item.name}吗,${item.name}后将流转到${item.toNode},是否继续?`, "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "info"
|
|
})
|
|
.then(() => {
|
|
this.$emit("confirm", item.name)
|
|
})
|
|
.catch(() => {})
|
|
}
|
|
})
|
|
}
|
|
},
|
|
watch: {
|
|
taskId: {
|
|
handler: function (val) {
|
|
if (val) {
|
|
this.getButtons()
|
|
}
|
|
},
|
|
immediate: true
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped></style>
|