|
|
@@ -3,7 +3,6 @@
|
|
|
<el-form label-width="100px" ref="formRef" :model="form">
|
|
|
<el-form-item
|
|
|
label="审批建议"
|
|
|
-
|
|
|
style="margin-bottom: 20px"
|
|
|
:rules="{
|
|
|
required: true,
|
|
|
@@ -35,7 +34,7 @@
|
|
|
v-if="taskDefinitionKey != 'starter'"
|
|
|
>驳回
|
|
|
</el-button>
|
|
|
- <!-- <el-dropdown
|
|
|
+ <el-dropdown
|
|
|
@command="(command) => handleCommand(command)"
|
|
|
style="margin-left: 30px"
|
|
|
>
|
|
|
@@ -45,92 +44,126 @@
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
<el-dropdown-item command="cancel">作废</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
- </el-dropdown> -->
|
|
|
+ </el-dropdown>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {approveTaskWithVariables, rejectTask} from '@/api/bpm/task';
|
|
|
-import dictMixins from '@/mixins/dictMixins';
|
|
|
-import { questionSave } from '@/api/bpm/components/changeManagement/question';
|
|
|
-import { requestSave } from '@/api/bpm/components/changeManagement/request';
|
|
|
-import { noticeSave } from '@/api/bpm/components/changeManagement/notice';
|
|
|
-// import {
|
|
|
-// assign,
|
|
|
-// cancel
|
|
|
-// } from '@/api/bpm/components/purchasingManage/purchasePlanManage';
|
|
|
+ import {
|
|
|
+ approveTaskWithVariables,
|
|
|
+ rejectTask,
|
|
|
+ cancelTask
|
|
|
+ } from '@/api/bpm/task';
|
|
|
+ import dictMixins from '@/mixins/dictMixins';
|
|
|
+ import { questionSave } from '@/api/bpm/components/changeManagement/question';
|
|
|
+ import { requestSave } from '@/api/bpm/components/changeManagement/request';
|
|
|
+ import { noticeSave } from '@/api/bpm/components/changeManagement/notice';
|
|
|
+ // import {
|
|
|
+ // assign,
|
|
|
+ // cancel
|
|
|
+ // } from '@/api/bpm/components/purchasingManage/purchasePlanManage';
|
|
|
|
|
|
-// 流程实例的详情页,可用于审批
|
|
|
-export default {
|
|
|
- mixins: [dictMixins],
|
|
|
+ // 流程实例的详情页,可用于审批
|
|
|
+ export default {
|
|
|
+ mixins: [dictMixins],
|
|
|
|
|
|
- name: '',
|
|
|
- components: {
|
|
|
- // Parser
|
|
|
- },
|
|
|
- props: {
|
|
|
- businessId: {
|
|
|
- default: ''
|
|
|
+ name: '',
|
|
|
+ components: {
|
|
|
+ // Parser
|
|
|
},
|
|
|
- taskId: {
|
|
|
- default: ''
|
|
|
- },
|
|
|
- id: {
|
|
|
- default: ''
|
|
|
- },
|
|
|
- taskDefinitionKey: {
|
|
|
- default: ''
|
|
|
- }
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- form: {
|
|
|
- reason: ''
|
|
|
+ props: {
|
|
|
+ businessId: {
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ taskId: {
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ id: {
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ taskDefinitionKey: {
|
|
|
+ default: ''
|
|
|
}
|
|
|
- };
|
|
|
- },
|
|
|
- created() {},
|
|
|
- methods: {
|
|
|
- async handleAudit(status) {
|
|
|
- //申请人申请
|
|
|
- if (this.taskDefinitionKey === 'starter') {
|
|
|
- const data = await this.getTableValue();
|
|
|
- let api=data.objType==1?questionSave:data.objType==2?requestSave:noticeSave
|
|
|
- // return
|
|
|
- if (data) {
|
|
|
- await api(data);
|
|
|
- }
|
|
|
- }
|
|
|
- await this._approveTaskWithVariables(status);
|
|
|
},
|
|
|
- async _approveTaskWithVariables(status) {
|
|
|
- let variables = {
|
|
|
- pass: !!status
|
|
|
- };
|
|
|
- let API = !!status ? approveTaskWithVariables : rejectTask;
|
|
|
- API({
|
|
|
- id: this.taskId,
|
|
|
- reason: this.form.reason,
|
|
|
- variables
|
|
|
- }).then((res) => {
|
|
|
- if (res.data.code != '-1') {
|
|
|
- this.$emit('handleAudit', {
|
|
|
- status,
|
|
|
- title: status === 0 ? '驳回' : ''
|
|
|
- });
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ form: {
|
|
|
+ reason: ''
|
|
|
}
|
|
|
- });
|
|
|
+ };
|
|
|
},
|
|
|
- getTableValue() {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- this.$emit('getTableValue', async (data) => {
|
|
|
- resolve(await data);
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ async handleAudit(status) {
|
|
|
+ //申请人申请
|
|
|
+ if (this.taskDefinitionKey === 'starter') {
|
|
|
+ const data = await this.getTableValue();
|
|
|
+ let api =
|
|
|
+ data.objType == 1
|
|
|
+ ? questionSave
|
|
|
+ : data.objType == 2
|
|
|
+ ? requestSave
|
|
|
+ : noticeSave;
|
|
|
+ // return
|
|
|
+ if (data) {
|
|
|
+ await api(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ await this._approveTaskWithVariables(status);
|
|
|
+ },
|
|
|
+ async _approveTaskWithVariables(status) {
|
|
|
+ let variables = {
|
|
|
+ pass: !!status
|
|
|
+ };
|
|
|
+ let API = !!status ? approveTaskWithVariables : rejectTask;
|
|
|
+ API({
|
|
|
+ id: this.taskId,
|
|
|
+ reason: this.form.reason,
|
|
|
+ variables
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.data.code != '-1') {
|
|
|
+ this.$emit('handleAudit', {
|
|
|
+ status,
|
|
|
+ title: status === 0 ? '驳回' : ''
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //更多
|
|
|
+ handleCommand(command) {
|
|
|
+ if (command === 'cancel') {
|
|
|
+ this.$confirm('是否确认作废?', {
|
|
|
+ type: 'warning',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ confirmButtonText: '确定'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ cancelTask({
|
|
|
+ id: this.id,
|
|
|
+ taskId: this.taskId,
|
|
|
+ reason: this.form.reason,
|
|
|
+ businessId: this.businessId
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$emit('handleClose');
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message.error('流程作废失败');
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getTableValue() {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.$emit('getTableValue', async (data) => {
|
|
|
+ resolve(await data);
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss"></style>
|