|
|
@@ -49,9 +49,20 @@
|
|
|
size="mini"
|
|
|
@click="handleAudit(1)"
|
|
|
v-click-once
|
|
|
+ v-if="taskDefinitionKey != 'apsStoreman'"
|
|
|
>通过
|
|
|
</el-button>
|
|
|
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-edit-outline"
|
|
|
+ type="success"
|
|
|
+ size="mini"
|
|
|
+ :loading="isLoading"
|
|
|
+ @click="handleAudit(1)"
|
|
|
+ v-if="taskDefinitionKey == 'apsStoreman'"
|
|
|
+ >申请出库
|
|
|
+ </el-button>
|
|
|
+
|
|
|
<el-button
|
|
|
icon="el-icon-circle-close"
|
|
|
type="danger"
|
|
|
@@ -86,6 +97,7 @@
|
|
|
cancelTask
|
|
|
} from '@/api/bpm/task';
|
|
|
import { listAllUserBind } from '@/api/system/organization';
|
|
|
+ import storageApi from '@/api/warehouseManagement';
|
|
|
|
|
|
// 流程实例的详情页,可用于审批
|
|
|
export default {
|
|
|
@@ -112,7 +124,8 @@
|
|
|
// technicianId: '',
|
|
|
reason: ''
|
|
|
},
|
|
|
- userOptions: []
|
|
|
+ userOptions: [],
|
|
|
+ isLoading: false
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
@@ -122,16 +135,68 @@
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
- async handleAudit(status, type) {
|
|
|
- //生产主管审批选择技术员
|
|
|
+ async handleAudit(status) {
|
|
|
+ let data = await this.getTableValue();
|
|
|
+ let storageData = data.returnStorageData;
|
|
|
+ if (!!status) {
|
|
|
+ if (!storageData?.extInfo?.verifyDeptCode) {
|
|
|
+ this.$message.error('请选择部门');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!storageData?.fromUser) {
|
|
|
+ this.$message.error('请选择领料人');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!this.form.reason && !!status) {
|
|
|
+ this.$message.error('请输入审批意见');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (this.taskDefinitionKey === 'apsStoreman' && !!status) {
|
|
|
+ // 入库来源isSkip 0-正常 1-外部(外部跳过内部审核流程)
|
|
|
+ storageData.isSkip = 1;
|
|
|
+ console.log('storageData~~~', storageData);
|
|
|
+ try {
|
|
|
+ this.isLoading = true;
|
|
|
+ const res = await storageApi.outStorage(storageData);
|
|
|
+
|
|
|
+ if (res.code == 0) {
|
|
|
+ let API = !!status ? approveTaskWithVariables : rejectTask;
|
|
|
+ API({
|
|
|
+ id: this.taskId,
|
|
|
+ reason: this.form.reason,
|
|
|
+ variables: {
|
|
|
+ pass: !!status
|
|
|
+ }
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code != '-1') {
|
|
|
+ this.$emit('handleAudit', {
|
|
|
+ status: status,
|
|
|
+ title: !status ? '驳回' : ''
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.isLoading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.isLoading = false;
|
|
|
+ console.error('保存失败:', error);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // await this._approveTaskWithVariables(status, storemanIds);
|
|
|
+ await this._approveTaskWithVariables(status);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // async handleAudit(status, type) {
|
|
|
+ // //生产主管审批选择技术员
|
|
|
|
|
|
- // if (!this.form.technicianId && status == 1) {
|
|
|
- // this.$message.warning(`请选择采购员!`);
|
|
|
- // return;
|
|
|
- // }
|
|
|
+ // // if (!this.form.technicianId && status == 1) {
|
|
|
+ // // this.$message.warning(`请选择采购员!`);
|
|
|
+ // // return;
|
|
|
+ // // }
|
|
|
|
|
|
- this._approveTaskWithVariables(status);
|
|
|
- },
|
|
|
+ // this._approveTaskWithVariables(status);
|
|
|
+ // },
|
|
|
rejectTask(status) {
|
|
|
rejectTask({
|
|
|
id: this.taskId,
|
|
|
@@ -156,7 +221,7 @@
|
|
|
reason: this.form.reason,
|
|
|
pass: true
|
|
|
}).then((res) => {
|
|
|
- if (res.data.code != '-1') {
|
|
|
+ if (res.data.code != '-1') {
|
|
|
this.$emit('handleAudit', {
|
|
|
status,
|
|
|
title: ''
|