|
|
@@ -1,6 +1,31 @@
|
|
|
<template>
|
|
|
<el-col :span="16" :offset="6">
|
|
|
<el-form label-width="100px" ref="formRef" :model="form">
|
|
|
+ <el-form-item
|
|
|
+ label="质检员"
|
|
|
+ prop="qualityInspector"
|
|
|
+ style="margin-bottom: 20px"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请选择',
|
|
|
+ trigger: 'change'
|
|
|
+ }"
|
|
|
+ v-if="taskDefinitionKey == 'QCLeaderApprove'"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="form.qualityInspector"
|
|
|
+ clearable
|
|
|
+ style="width: 100%"
|
|
|
+ :filterable="true"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in userOptions"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item
|
|
|
label="审批建议"
|
|
|
prop="reason"
|
|
|
@@ -23,7 +48,7 @@
|
|
|
icon="el-icon-edit-outline"
|
|
|
type="success"
|
|
|
size="mini"
|
|
|
- :loading="isLoading"
|
|
|
+ :loading="isSaveLoading"
|
|
|
@click="handleAudit(1)"
|
|
|
>通过
|
|
|
</el-button>
|
|
|
@@ -76,6 +101,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import { uploadQualityFile } from '@/api/classifyManage';
|
|
|
+ import { listAllUserBind } from '@/api/system/organization';
|
|
|
import outin from '@/api/warehouseManagement/outin';
|
|
|
import { cancel } from '@/api/bpm/components/saleManage/entrustedReceive';
|
|
|
import { approveTaskWithVariables } from '@/api/bpm/task';
|
|
|
@@ -103,22 +130,43 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- isLoading: false,
|
|
|
+ userOptions: [],
|
|
|
+ isSaveLoading: false,
|
|
|
form: {
|
|
|
reason: ''
|
|
|
},
|
|
|
tabOptions: [
|
|
|
{ key: 'starter', permissionType: 'update', name: '发起人申请' },
|
|
|
{
|
|
|
- key: 'deptLeaderApprove', permissionType: 'view', name: '部门主管审批'},
|
|
|
- { key: 'storeManagerApprove', permissionType: 'view', name: '仓管出库' },
|
|
|
+ key: 'deptLeaderApprove',
|
|
|
+ permissionType: 'view',
|
|
|
+ name: '部门主管审批'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'storeManagerApprove',
|
|
|
+ permissionType: 'view',
|
|
|
+ name: '仓管出库'
|
|
|
+ },
|
|
|
{ key: 'QCLeaderApprove', permissionType: 'view', name: '质检主管' },
|
|
|
- { key: 'qualityInspection', permissionType: 'view', name: '质检员质检' },
|
|
|
- { key: 'qualityInspectionFeedback', permissionType: 'view', name: '质检员反馈' }
|
|
|
+ {
|
|
|
+ key: 'qualityInspection',
|
|
|
+ permissionType: 'view',
|
|
|
+ name: '质检员质检'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'qualityInspectionFeedback',
|
|
|
+ permissionType: 'view',
|
|
|
+ name: '质检员反馈'
|
|
|
+ }
|
|
|
]
|
|
|
};
|
|
|
},
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.userOptions = [];
|
|
|
+ listAllUserBind().then((data) => {
|
|
|
+ this.userOptions.push(...data);
|
|
|
+ });
|
|
|
+ },
|
|
|
methods: {
|
|
|
/** 处理转办审批人 */
|
|
|
handleUpdateAssignee() {
|
|
|
@@ -137,6 +185,12 @@
|
|
|
if (permissionType === 'update') {
|
|
|
await this.getTableValue();
|
|
|
}
|
|
|
+ if (this.taskDefinitionKey === 'QCLeaderApprove' && status) {
|
|
|
+ if (!this.form.qualityInspector) {
|
|
|
+ return this.$message.error('请选择质检员!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (this.taskDefinitionKey === 'deptLeaderApprove') {
|
|
|
let arr = await this.getTableValue();
|
|
|
let ids = arr.productList.map((item) => item.warehouseId);
|
|
|
@@ -145,35 +199,49 @@
|
|
|
','
|
|
|
);
|
|
|
}
|
|
|
- if (this.taskDefinitionKey === 'storeman') {
|
|
|
- let data = await this.getTableValue();
|
|
|
- let storageData = data.returnStorageData;
|
|
|
+
|
|
|
+ if (this.taskDefinitionKey === 'qualityInspection' && status) {
|
|
|
+ let arr = await this.getTableValue(); // 是否全部已检
|
|
|
+ if (!arr.isAllChecked) {
|
|
|
+ return this.$message.error('请完成质检!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.taskDefinitionKey === 'qualityInspectionFeedback' && status) {
|
|
|
+ let arr = await this.getTableValue();
|
|
|
+ if (arr.qualityInspector.qualityFile.length == 0) {
|
|
|
+ return this.$message.error('请上传回执附件!');
|
|
|
+ }
|
|
|
+ await uploadQualityFile(arr.qualityInspector);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.taskDefinitionKey === 'storeManagerApprove' && status) {
|
|
|
+ let res = await this.getTableValue();
|
|
|
+ let storageData = res.returnStorageData;
|
|
|
+ console.log(storageData);
|
|
|
// 入库来源storageSource 0-正常 1-外部(外部跳过内部审核流程)
|
|
|
storageData.storageSource = 1;
|
|
|
- console.log(storageData);
|
|
|
try {
|
|
|
- this.isLoading = true;
|
|
|
- const res = await outin.saveNew(storageData);
|
|
|
- if (res.code == 0) {
|
|
|
- approveTaskWithVariables({
|
|
|
- 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;
|
|
|
- });
|
|
|
- }
|
|
|
+ this.isSaveLoading = true;
|
|
|
+ await outin.save(storageData);
|
|
|
+ approveTaskWithVariables({
|
|
|
+ id: this.taskId,
|
|
|
+ reason: this.form.reason,
|
|
|
+ variables: {
|
|
|
+ pass: true
|
|
|
+ }
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code != '-1') {
|
|
|
+ this.$emit('handleAudit', {
|
|
|
+ status: 1,
|
|
|
+ title: '入库'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.isSaveLoading = false;
|
|
|
+ });
|
|
|
} catch (error) {
|
|
|
- this.isLoading = false;
|
|
|
- console.error('保存失败:', error);
|
|
|
+ this.isSaveLoading = false;
|
|
|
+ this.$message.error('保存失败');
|
|
|
}
|
|
|
} else {
|
|
|
await this._approveTaskWithVariables(status, storemanIds);
|
|
|
@@ -184,6 +252,9 @@
|
|
|
pass: !!status,
|
|
|
storemanIds
|
|
|
};
|
|
|
+ if (this.form.qualityInspector) {
|
|
|
+ variables['qualityInspector'] = this.form.qualityInspector;
|
|
|
+ }
|
|
|
approveTaskWithVariables({
|
|
|
id: this.taskId,
|
|
|
reason: this.form.reason,
|