hi-ucs/back/src/views/modules/activiti/demo/comments.vue

295 lines
9.1 KiB
Vue
Raw Normal View History

2022-06-23 21:16:11 +08:00
<template>
<div class="wrapper">
<div>
<el-form
:model="dataForm"
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '120px' : 'auto'"
>
2022-08-03 10:32:08 +08:00
<el-tooltip placement="bottom" :content="dataForm.comment">
<template #title>
<span>{{ dataForm.comment }}</span>
</template>
<el-form-item label="评论内容">
<el-input
type="textarea"
v-model="dataForm.comment"
:disabled="fieldDisabled"
placeholder="评论内容"
></el-input>
</el-form-item>
</el-tooltip>
2022-06-23 21:16:11 +08:00
</el-form>
</div>
<!-- 流程综合组件 -->
2022-08-03 12:10:56 +08:00
<!-- <ren-process-multiple
2022-06-23 21:16:11 +08:00
v-if="processVisible"
updateInstanceIdUrl="/processForm/tabilityapplication/updateInstanceId"
saveFormUrl="/processForm/tabilityapplication"
dataFormName="dataForm"
ref="renProcessMultiple"
2022-08-03 12:10:56 +08:00
></ren-process-multiple> -->
<!-- 审批 -->
<div class="agreeOr" v-if="taskId">
<div>
<el-button type="primary" @click="showDialog('同意')">同意</el-button>
<el-button type="danger" plain @click="showDialog('拒绝')"
>驳回</el-button
>
</div>
</div>
<!-- 审批弹窗 -->
<el-dialog
title="审批意见"
:close-on-click-modal="false"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose"
>
<el-input v-model="input" placeholder="请输入审批意见"></el-input>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose2"> </el-button>
<el-button
type="primary"
@click.native="agreeOrNot($store.state.contentTabsActiveName)"
> </el-button
>
</span>
</el-dialog>
2022-06-23 21:16:11 +08:00
</div>
</template>
<script>
import processModule from '@/mixins/process-module'
2022-08-03 12:10:56 +08:00
import qs from 'qs'
import debounce from 'lodash/debounce'
import bus from '@/views/bus.js'
2022-06-23 21:16:11 +08:00
export default {
// 注入公共方法
mixins: [processModule],
components: {},
props: {
// fromList: {
// // type: Array,
// // default: () => {
// // return []
// // }
// }
},
data () {
return {
// processVisible: true,
2022-08-03 12:10:56 +08:00
// visible: false,
2022-06-23 21:16:11 +08:00
// 表单属性是否可编辑
fieldDisabled: false,
dataForm: [],
id: '',
2022-08-03 12:10:56 +08:00
shifoushizujian: true,
// 审批
dialogVisible: false,
dialogType: '',
input: '',
visible: true,
taskId: ''
2022-06-23 21:16:11 +08:00
}
},
watch: {},
computed: {},
methods: {
init () {
this.visible = true
// this.getInfo(this.$router.currentRoute.params.params.params.resourceDTO.id)
// this.dataForm = this.$router.currentRoute.params.params.params.resourceDTO
// this.id=this.$router.currentRoute
this.$nextTick(() => {
this.$refs.dataForm.resetFields()
// if (this.dataForm.id) {
// 如业务KEY已存在不允许编辑
this.fieldDisabled = true
// this.id = this.$router.currentRoute.businessKey
this.getInfo(this.$router.currentRoute.params.businessKey)
console.log('id', this.$router.currentRoute.params.businessKey)
// }
})
},
getInfo (id) {
2022-07-16 15:25:49 +08:00
this.$http.get('/demandComment/' + id).then(({ data: res }) => {
2022-06-23 21:16:11 +08:00
if (res.code !== 0) {
return this.$message.error(res.msg)
}
2022-07-16 15:25:49 +08:00
this.dataForm = res.data
// this.dataForm = res.data.resourceDTO
// if (this.dataForm.type != '应用资源') {
// this.shifoushizujian = false
// } else {
// this.shifoushizujian = true
// }
2022-06-23 21:16:11 +08:00
console.log('this.dataForm', this.dataForm)
})
2022-08-03 12:10:56 +08:00
},
// 审批
showDialog (title) {
this.dialogVisible = true
this.dialogType = title
},
handleClose (done) {
this.$confirm('确认关闭?')
.then((_) => {
this.input = ''
done()
})
.catch((_) => {})
},
handleClose2 () {
this.dialogVisible = false
this.input = ''
},
// 同意与退回
agreeOrNot: debounce(
function (data) {
this.dataForm.taskId = this.$route.params.taskId
if (this.dialogType === '同意') {
if (this.input !== '') {
console.log('this.dataForm', this.dataForm)
const params = qs.stringify({
taskId: this.dataForm.taskId,
comment: this.input
})
console.log(params)
this.$http
.post('/act/task/complete?' + params)
.then(({ data: res }) => {
if (res.code !== 0) {
this.$message.error(res.msg)
if (this.callbacks.taskHandleErrorCallback) {
this.callbacks.taskHandleErrorCallback(res)
}
return
}
bus.$emit('AbilityResourcesRemovedInit')
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.dialogVisible = false
if (this.callbacks.taskHandleSuccessCallback) {
this.callbacks.taskHandleSuccessCallback(res)
}
}
})
})
.catch(() => {})
this.tabRemoveHandle(data)
} else {
this.$message.error('请输入审批意见!')
}
} else if (this.dialogType === '拒绝') {
if (this.input !== '') {
const params = qs.stringify({
taskId: this.dataForm.taskId,
comment: this.input
})
this.$http
.post('/act/task/backToFirst?', params)
.then(({ data: res }) => {
if (res.code !== 0) {
this.$message.error(res.msg)
if (this.callbacks.taskHandleErrorCallback) {
this.callbacks.taskHandleErrorCallback(res)
}
return
}
bus.$emit('AbilityResourcesRemovedInit')
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
if (this.callbacks.taskHandleSuccessCallback) {
this.callbacks.taskHandleSuccessCallback(res)
}
}
})
})
this.tabRemoveHandle(data)
} else {
this.$message.error('请输入审批意见!')
}
}
},
1000,
{ leading: true, trailing: false }
),
tabRemoveHandle (tabName) {
console.log(tabName, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
if (tabName === 'home') {
return false
}
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(
(item) => item.name !== tabName
)
if (this.$store.state.contentTabs.length <= 0) {
this.$store.state.sidebarMenuActiveName =
this.$store.state.contentTabsActiveName = 'home'
return false
}
// 当前选中tab被删除
if (tabName === this.$store.state.contentTabsActiveName) {
const tab =
this.$store.state.contentTabs[
this.$store.state.contentTabs.length - 1
]
this.$router.push({
name: /^iframe_.+/.test(tab.name) ? 'iframe' : tab.name,
params: { ...tab.params },
query: { ...tab.query }
})
}
2022-06-23 21:16:11 +08:00
}
},
created () {
// this.dataForm = this.$router.currentRoute.params.id
this.init()
console.log('fromList', this.$router.currentRoute.params.businessKey)
// this.dataForm = this.$router.currentRoute.params.params.params.resourceDTO
var callbacks = {
startProcessSuccessCallback: this.closeCurrentTab,
startProcessErrorCallback: this.startProcessErrorCallback,
taskHandleSuccessCallback: this.closeCurrentTab,
taskHandleErrorCallback: this.taskHandleErrorCallback,
formSaveSuccessCallback: null,
formSaveErrorCallback: null
}
// 初始化综合组件
this.initProcessMultiple(callbacks)
2022-08-03 12:10:56 +08:00
this.taskId = this.$route.params.taskId
this.dataForm.taskId = this.$route.params.taskId
2022-06-23 21:16:11 +08:00
},
mounted () {}
}
</script>
2022-08-03 12:10:56 +08:00
<style lang="scss" >
.kuandukuandukuandu {
max-width: 1500px;
}
.agreeOr {
& > div {
// text-align: right;
padding-right: 40px;
margin: 20px 0;
2022-06-23 21:16:11 +08:00
}
}
</style>
2022-08-03 10:32:08 +08:00
<style lang="scss" scoped>
::v-deep .el-textarea__inner {
height: 100px;
resize: none;
2022-06-23 21:16:11 +08:00
}
</style>