174 lines
4.5 KiB
Vue
174 lines
4.5 KiB
Vue
<template>
|
|
<view class="check-action">
|
|
<view class="btn-wrap">
|
|
<view>
|
|
<u--textarea v-model="value" placeholder="请输入审批意见"></u--textarea>
|
|
</view>
|
|
<view class="buttons">
|
|
<u-button @click="handlePass" class="btn first-btn" type="primary" text="通过"></u-button>
|
|
<u-button @click="handleReject" :disabled="localIsBtnRefuseDisable" type="warning" text="驳回"></u-button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<!-- <check-action v-if="isLoadOK && tableKey === '1' && isAudit === 'true'" @reject="handleReject"
|
|
@pass="handlePass" :okApi="okApi" :refuseApi="refuseApi"
|
|
:dataSource="$store.state.auditModel"></check-action>
|
|
-->
|
|
<!-- @reject="handleReject" @pass="handlePass" 如果调用页面需要对审批结束后继续处理 直接 在使用页面 写方法 -->
|
|
|
|
<script>
|
|
import {
|
|
handlePassAudit,
|
|
handleRejestAudit,
|
|
handlePassAuditCallBack
|
|
} from '../../services/apply/subPages/BS/notice'
|
|
import '@/utils/showMsg.js'
|
|
export default {
|
|
props: {
|
|
dataSource: {
|
|
type: Object,
|
|
default () {
|
|
return undefined
|
|
}
|
|
},
|
|
okApi: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
TASK_ORGID: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
refuseApi: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
isBtnRefuseDisable: {
|
|
typeof: Boolean,
|
|
default: true
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
value: '',
|
|
localIsBtnRefuseDisable: this.isBtnRefuseDisable
|
|
}
|
|
},
|
|
// beforeCreate() KO
|
|
// beforeMount() mounted() OK
|
|
created() {
|
|
if (this.refuseApi) {
|
|
this.localIsBtnRefuseDisable = false
|
|
} else {
|
|
const pages = getCurrentPages()
|
|
const currentPage = pages[pages.length - 1]
|
|
const query = currentPage.options || {}
|
|
this.localIsBtnRefuseDisable = !(query.refuseApi && query.refuseApi !== 'undefined')
|
|
}
|
|
},
|
|
mounted() {
|
|
if (this.$route && this.$route.query) {
|
|
this.localIsBtnRefuseDisable = !(this.$route.query.refuseApi && this.$route.query.refuseApi !== 'undefined')
|
|
}
|
|
},
|
|
watch: {
|
|
isBtnRefuseDisable(newValue) {
|
|
this.localIsBtnRefuseDisable = newValue;
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
handlePass() {
|
|
const genParams = this.handleGenParams(10)
|
|
handlePassAudit(genParams, this.okApi).then(res => {
|
|
// this.$emit('pass', this.dataSource)
|
|
uni.$showMsgFunc('审批成功!', () => {
|
|
// if (this.tableKey == null || this.tableKey == 0) {
|
|
// uni.navigateTo({
|
|
// url: 'safeCheckIndex'
|
|
// })
|
|
// } else {
|
|
|
|
if (this.okApi == 'PF/Approve/Submit' && res.Data) {
|
|
//最后一个节点处理问题
|
|
handlePassAuditCallBack(res.Data + "?id=" + genParams.DATA_ID).then(
|
|
res2 => {
|
|
uni.navigateBack()
|
|
})
|
|
} else {
|
|
uni.navigateBack()
|
|
}
|
|
// }
|
|
}, 'success', 1000)
|
|
})
|
|
},
|
|
handleReject() {
|
|
if (this.value == undefined || this.value === '' || this.value.length < 1) {
|
|
uni.$showErrorInfo('请输入驳回意见!')
|
|
return false
|
|
}
|
|
const genParams = this.handleGenParams(20)
|
|
handleRejestAudit(genParams, this.refuseApi).then(res => {
|
|
// this.$emit('reject', this.dataSource)
|
|
uni.$showMsgFunc('驳回成功!', () => {
|
|
uni.navigateBack()
|
|
}, 'success', 1000)
|
|
|
|
})
|
|
},
|
|
handleGenParams(status) {
|
|
const appInfoData = uni.getStorageSync('appInfo')
|
|
const userId = appInfoData?.User?.ID || ''
|
|
this.dataSource.Nav_ApproveDetails.sort((a, b) => a.NUM - b.NUM);
|
|
let currentNodes = this.dataSource.Nav_ApproveDetails?.filter(v => v.IS_CURRENT == true);
|
|
let isCurrent = false;
|
|
if (currentNodes && currentNodes.length > 0) {
|
|
let currentUserNode = currentNodes.filter(v => v.APPROVE_USER_ID === userId);
|
|
if (currentUserNode != null) {
|
|
isCurrent = true;
|
|
this.dataSource.CurrentNode = currentUserNode[0];
|
|
} else {
|
|
this.dataSource.CurrentNode = currentNodes[0];
|
|
}
|
|
}
|
|
if(this.TASK_ORGID&&this.TASK_ORGID.length>0){
|
|
this.dataSource.Parameter22 = this.TASK_ORGID
|
|
}
|
|
const params = {
|
|
...this.dataSource,
|
|
CurrentNode: {
|
|
...this.dataSource.CurrentNode,
|
|
NODE_APPROVE_STATUS: status,
|
|
CONTEXT: this.value
|
|
}
|
|
}
|
|
return params
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
.btn-wrap {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
padding: 16px;
|
|
z-index: 1000;
|
|
background: #fff;
|
|
box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, .05);
|
|
}
|
|
|
|
.buttons {
|
|
margin-top: 5px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.buttons .first-btn {
|
|
margin-right: 20px;
|
|
}
|
|
</style> |