Files
faw-report-library-web/src/components/ProcessFooter.vue
T
2023-04-18 15:51:26 +08:00

403 lines
9.9 KiB
Vue

<!-- ProcessFooter -->
<template>
<div class="process-footer" v-if="showSave || showSubmit || showCancel">
<div class="footer-line"></div>
<div class="btn-group-wrap" style="text-align: center">
<slot></slot>
<el-button
type="warning"
size="small"
class="common-button-warning"
@click="handleOnLineEdit"
v-if="showEdit">在线编辑</el-button>
<!-- <el-button-->
<!-- type="primary"-->
<!-- round-->
<!-- class="common-button-primary"-->
<!-- @click="handleEntrust"-->
<!-- :loading="isSubmit"-->
<!-- v-if="showEntrust">-->
<!-- <i class="iconfont" style="font-size: 12px;">&#xe615;</i>-->
<!-- 委托</el-button>-->
<el-button
type="primary"
size="small"
class="common-button-primary"
@click="handleSendEmail"
:loading="sendEmailLoading"
v-if="showSendEmail"
>发送邮件</el-button>
<el-button
type="danger"
class="common-button-danger"
size="small"
@click="handleOver"
:loading="submitLoading"
v-if="showOver"
>撤销申请</el-button>
<el-button
type="danger"
size="small"
class="common-button-danger"
@click="beforeBack"
:loading="isSubmit"
v-if="showBack">
{{ backBTNText }}</el-button>
<div style="display: inline-block;">
<el-button
type="primary"
size="large"
class="common-button-primary"
@click="handleTransfer"
:loading="TransferLoading"
v-if="showTransfer" round
>转办</el-button>
<el-button
type="primary"
size="small"
class="common-button-primary"
@click="handleSave"
:loading="saveLoading"
v-if="showSave" round>
保存
</el-button>
<el-button
type="primary"
size="large"
class="common-button-primary resetColor"
@click="handleReset"
:loading="resetLoading"
v-if="showReset" round>
重置
</el-button>
<el-button
type="primary"
size="large"
class="common-button-primary submitColor"
@click="handleSubmit"
:loading="submitLoading"
v-if="showSubmit" round
>{{ submitBTNTextShow }}</el-button>
</div>
<!-- <el-button-->
<!-- style="float:right;margin-top: 12px;"-->
<!-- type="danger"-->
<!-- round-->
<!-- class="common-button-danger"-->
<!-- @click="cancel"-->
<!-- :loading="isSubmit"-->
<!-- v-if="showCancel">-->
<!-- <i class="iconfont" style="font-size: 12px;">&#xe615;</i>-->
<!-- 取消 </el-button>-->
</div>
<!-- 组织机构树 -->
<!-- <ProcessChooseTree-->
<!-- :visible.sync="visibleTree"-->
<!-- show-user-->
<!-- :dept-select="false"-->
<!-- @dblClick="handleAssigneeNew"-->
<!-- ></ProcessChooseTree>-->
<!-- 在线编辑 -->
<!-- <only-office-edit ref="onlyOffice" :visible.sync="visibleOnlyOffice"></only-office-edit>-->
<!-- 从全公司选人,2021-03-22(上汽大数据量人员解决方案) -->
<org-table
v-if="showEntrust"
:visible.sync="visibleTree"
:config="{
value: this.orgTableVal,
valueName: this.orgTableName
}"
title="委托"
:exclude-user="userId"
:max-selected="1"
max-selected-tips="当前任务只能委托给一个人"
dialog-model
@confirm="handleAssigneeNew"
></org-table>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'ProcessFooter',
mixins: [],
props: {
// 是否显示结束流程按钮
showOver: {
type: Boolean,
default: false
},
// 是否显示取消按钮
showCancel: {
type: Boolean,
default: false
},
// 是否显示保存按钮
showSave: {
type: Boolean,
default: false
},
// 是否显示重置按钮
showReset: {
type: Boolean,
default: false
},
// 是否显示发送邮件按钮
showSendEmail: {
type: Boolean,
default: false
},
// 发送邮件按钮loading
sendEmailLoading: {
type: Boolean,
default: false
},
// 是否显示提交按钮
showSubmit: {
type: Boolean,
default: false
},
// 是否显示委托按钮
showEntrust: {
type: Boolean,
default: false
},
// 是否显示退回按钮
showBack: {
type: Boolean,
default: false
},
// 是否显示转办按钮
showTransfer: {
type: Boolean,
default: false
},
// 提交按钮loading
submitLoading: {
type: Boolean,
default: false
},
// 保存按钮loading
saveLoading: {
type: Boolean,
default: false
},
resetLoading: {
type: Boolean,
default: false
},
// 转办按钮loading
TransferLoading: {
type: Boolean,
default: false
},
// 是否默认委托事件
defaultEntrust: {
type: Boolean,
default: false
},
// 是否显示在线编辑按钮
showEdit: {
type: Boolean,
default: false
},
// 标准编号(在线编辑)
standNo: {
type: String
},
// 未选择标准编号/企标编号进行在线编辑的提示
noStandNoTip: {
type: String,
default: '请选择或输入企标编号后进行在线编辑'
},
// 审批节点
approval: {
type: Boolean,
default: false
},
// 带有退回/驳回意见
opinion: {
type: Boolean,
default: false
},
submitBTNText: {
type: String
}
},
data () {
return {
isSubmit: false,
visibleTree: false,
visibleOnlyOffice: false,
orgTableVal: '',
orgTableName: ''
}
},
methods: {
handleOver () {
this.$emit('over')
},
handleSave () {
this.$emit('save')
},
handleReset () {
this.$emit('reset')
},
handleSubmit () {
this.$emit('submit')
},
cancel () {
if (this.$store.state.detailMap !== '') {
this.$router.push({
path: this.$store.state.detailMap,
query: {
tabsName: this.$store.getters.getHandleInfo.tabsName
}
})
this.$store.commit('setDetailMap', '')
} else {
this.$router.push({
name: 'ProcessCenter',
query: {
tabsName: 'ProcessCenter'
}
})
}
// this.$emit('cancel')
},
handleSendEmail () {
this.$emit('sendEmail')
},
handleTransfer () {
this.$emit('transfer')
},
handleEntrust () {
if (this.defaultEntrust) {
this.visibleTree = true
} else {
this.$emit('entrust')
}
},
handleBack () {
if (!this.opinion) {
this.$confirm(`您确定要${this.approval ? '驳回' : '退回'}该任务吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
confirmButtonClass: 'common-button-primary'
}).then(() => {
this.$emit('back')
}).catch(() => {})
} else {
this.$emit('back')
}
},
/**
* @description: 委托
* @date: 2020-12-16 10:11:31
* @auth: chenxiaoxi
*/
handleAssigneeNew (checkedList, checkedIdList) {
if (!checkedList.length) { return false }
const assignee = checkedIdList[0]
const assigneeUserName = checkedList[0].userName
this.$confirm(`您确定要委托 ${assigneeUserName} 完成该任务吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
confirmButtonClass: 'common-button-primary'
}).then(() => {
changeAssigneeNew({
taskId: this.$store.getters.getHandleInfo.taskIds, // 任务id
assignee, // 被委托人
userId: this.$store.getters.userInfo.userId, // 委托人
pId: this.$store.getters.getHandleInfo.prcId // 流程实例
}).then(res => {
if (res.success) {
this.$message.success('委托成功')
setTimeout(() => {
this.$router.push({
name: 'ProcessCenter'
})
}, 100)
this.visibleTree = false
} else {
this.$message.warning(res.message)
}
})
}).catch(() => {})
},
/**
* @description: 在线编辑
* @date: 2021-01-08 10:32:16
* @auth: chenxiaoxi
*/
handleOnLineEdit () {
if (!this.standNo || this.standNo === '') {
this.$message.warning(this.noStandNoTip)
} else {
this.visibleOnlyOffice = true
this.$nextTick(() => {
this.$refs.onlyOffice.officeInit(this.standNo, this.standId)
})
}
},
beforeBack () {
this.handleBack()
}
},
computed: {
// 提交按钮文字
submitBTNTextShow () {
return this.submitBTNText ? this.submitBTNText : this.approval ? '同意' : '提交'
},
// 退回按钮文字
backBTNText () {
return this.approval ? '驳回' : '退回'
},
userId () {
return this.userInfo.userId
},
...mapGetters(['userInfo'])
},
watch: {},
mounted () {
console.log(this.showCancel)
}
}
</script>
<style lang="scss" scoped>
.process-footer {
line-height: 50px;
text-align: right;
background: #fff;
z-index: 999;
margin-top: 20px;
padding: 0;
.footer-line {
height: 1px;
box-shadow: 0 -1px 2px 0px #e8e8e8;
}
}
.resetColor{
background-color:#02a7f0 ;
border: none;
}
.submitColor{
background-color:#8400ff;
border: none;
}
</style>