|
|
@@ -27,23 +27,23 @@
|
|
|
@click="handleAudit(1)"
|
|
|
>通过
|
|
|
</el-button>
|
|
|
+
|
|
|
<el-button
|
|
|
icon="el-icon-circle-close"
|
|
|
type="danger"
|
|
|
size="mini"
|
|
|
+ :loading="isLoading"
|
|
|
v-click-once
|
|
|
@click="handleAudit(0)"
|
|
|
>驳回
|
|
|
</el-button>
|
|
|
-
|
|
|
<el-dropdown
|
|
|
@command="(command) => handleCommand(command)"
|
|
|
style="margin-left: 30px"
|
|
|
- v-if="taskDefinitionKey != 'deptLeaderApprove'"
|
|
|
>
|
|
|
- <span class="el-dropdown-link"
|
|
|
- >更多<i class="el-icon-arrow-down el-icon--right"></i
|
|
|
- ></span>
|
|
|
+ <span class="el-dropdown-link">
|
|
|
+ 更多<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
+ </span>
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
<el-dropdown-item command="cancel">作废</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
@@ -53,17 +53,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- // import outin from '@/api/warehouseManagement/outin';
|
|
|
- import storageApi from '@/api/warehouseManagement';
|
|
|
- import { cancel } from '@/api/bpm/components/purchasingManage/outSourceSend';
|
|
|
- import {approveTaskWithVariables, rejectTask} from '@/api/bpm/task';
|
|
|
+ import {
|
|
|
+ approveTaskWithVariables,
|
|
|
+ rejectTask,
|
|
|
+ cancelTask
|
|
|
+ } from '@/api/bpm/task';
|
|
|
|
|
|
- // 流程实例的详情页,可用于审批
|
|
|
export default {
|
|
|
- name: '',
|
|
|
- components: {
|
|
|
- // Parser
|
|
|
- },
|
|
|
+ name: 'HrContractSubmit',
|
|
|
props: {
|
|
|
businessId: {
|
|
|
default: ''
|
|
|
@@ -88,95 +85,12 @@
|
|
|
},
|
|
|
methods: {
|
|
|
async handleAudit(status) {
|
|
|
- // console.log(status);
|
|
|
- // let storemanIds = '';
|
|
|
- // let permissionType = this.tabOptions.find(
|
|
|
- // (item) => item.key == this.taskDefinitionKey
|
|
|
- // )?.permissionType;
|
|
|
- // if (this.taskDefinitionKey === 'deptLeaderApprove') {
|
|
|
- // let arr = await this.getTableValue();
|
|
|
- // let ids = arr.productList.map((item) => item.warehouseId);
|
|
|
- // let data = await getWarehouseListByIds(ids || []);
|
|
|
- // storemanIds = [...new Set(data.map((item) => item.ownerId))].join(
|
|
|
- // ','
|
|
|
- // );
|
|
|
- // }
|
|
|
- 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;
|
|
|
+ this.$message.warning('请填写审批意见');
|
|
|
+ return;
|
|
|
}
|
|
|
- if (this.taskDefinitionKey === 'storeman' && !!status) {
|
|
|
- // 入库来源isSkip 0-正常 1-外部(外部跳过内部审核流程)
|
|
|
- storageData.isSkip = 1;
|
|
|
- console.log(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);
|
|
|
- }
|
|
|
- },
|
|
|
- getTableValue() {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- this.$emit('getTableValue', async (data) => {
|
|
|
- resolve(await data);
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- async _approveTaskWithVariables(status, storemanIds) {
|
|
|
- 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 ? '驳回' : ''
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ await this._approveTaskWithVariables(status);
|
|
|
},
|
|
|
- //更多
|
|
|
handleCommand(command) {
|
|
|
if (command === 'cancel') {
|
|
|
this.$confirm('是否确认作废?', {
|
|
|
@@ -185,8 +99,9 @@
|
|
|
confirmButtonText: '确定'
|
|
|
})
|
|
|
.then(() => {
|
|
|
- cancel({
|
|
|
- id: this.taskId,
|
|
|
+ cancelTask({
|
|
|
+ id: this.id,
|
|
|
+ taskId: this.taskId,
|
|
|
reason: this.form.reason,
|
|
|
businessId: this.businessId
|
|
|
})
|
|
|
@@ -199,6 +114,27 @@
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
}
|
|
|
+ },
|
|
|
+ async _approveTaskWithVariables(status) {
|
|
|
+ const API = !!status ? approveTaskWithVariables : rejectTask;
|
|
|
+ try {
|
|
|
+ this.isLoading = true;
|
|
|
+ const res = await API({
|
|
|
+ id: this.taskId,
|
|
|
+ reason: this.form.reason,
|
|
|
+ variables: {
|
|
|
+ pass: !!status
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (res.data.code != '-1') {
|
|
|
+ this.$emit('handleAudit', {
|
|
|
+ status,
|
|
|
+ title: status === 0 ? '驳回' : ''
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ this.isLoading = false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|