|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <el-col :span="16" :offset="6" v-if="activeComp == taskDefinitionKey">
|
|
|
|
|
|
|
+ <el-col :span="16" :offset="6" v-if="activeComp == taskDefinitionKey || childActiveComp ==taskDefinitionKey">
|
|
|
<el-form label-width="100px" ref="formRef" :rules="rules" :model="form">
|
|
<el-form label-width="100px" ref="formRef" :rules="rules" :model="form">
|
|
|
<el-form-item
|
|
<el-form-item
|
|
|
v-if="
|
|
v-if="
|
|
@@ -44,7 +44,7 @@
|
|
|
type="success"
|
|
type="success"
|
|
|
size="mini"
|
|
size="mini"
|
|
|
@click="handleAudit(1)"
|
|
@click="handleAudit(1)"
|
|
|
- >通过
|
|
|
|
|
|
|
+ >通过
|
|
|
</el-button>
|
|
</el-button>
|
|
|
|
|
|
|
|
<el-button
|
|
<el-button
|
|
@@ -53,90 +53,164 @@
|
|
|
size="mini"
|
|
size="mini"
|
|
|
v-if="taskDefinitionKey !== 'stater'"
|
|
v-if="taskDefinitionKey !== 'stater'"
|
|
|
@click="handleAudit(0)"
|
|
@click="handleAudit(0)"
|
|
|
- >驳回
|
|
|
|
|
|
|
+ >驳回
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
- import {
|
|
|
|
|
- approveTaskWithVariablesAPI,
|
|
|
|
|
- saleReturnUpdateAPI
|
|
|
|
|
- } from '@/api/bpm/components/saleManage/saleorder';
|
|
|
|
|
- import { listAllUserBind } from '@/api/system/organization';
|
|
|
|
|
- import { EventBus } from './eventBus.js';
|
|
|
|
|
- import outin from '@/api/warehouseManagement/outin';
|
|
|
|
|
- // 流程实例的详情页,可用于审批
|
|
|
|
|
- //qcId techId produceId
|
|
|
|
|
- export default {
|
|
|
|
|
- name: '',
|
|
|
|
|
- components: {
|
|
|
|
|
- // Parser
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ approveTaskWithVariablesAPI,
|
|
|
|
|
+ saleReturnUpdateAPI
|
|
|
|
|
+} from '@/api/bpm/components/saleManage/saleorder';
|
|
|
|
|
+import {listAllUserBind} from '@/api/system/organization';
|
|
|
|
|
+import {EventBus} from './eventBus.js';
|
|
|
|
|
+import outin from '@/api/warehouseManagement/outin';
|
|
|
|
|
+// 流程实例的详情页,可用于审批
|
|
|
|
|
+//qcId techId produceId
|
|
|
|
|
+export default {
|
|
|
|
|
+ name: '',
|
|
|
|
|
+ components: {
|
|
|
|
|
+ // Parser
|
|
|
|
|
+ },
|
|
|
|
|
+ props: {
|
|
|
|
|
+ businessId: {
|
|
|
|
|
+ default: ''
|
|
|
},
|
|
},
|
|
|
- props: {
|
|
|
|
|
- businessId: {
|
|
|
|
|
- default: ''
|
|
|
|
|
|
|
+ taskId: {
|
|
|
|
|
+ default: ''
|
|
|
|
|
+ },
|
|
|
|
|
+ id: {
|
|
|
|
|
+ default: ''
|
|
|
|
|
+ },
|
|
|
|
|
+ taskDefinitionKey: {
|
|
|
|
|
+ default: ''
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ form: {
|
|
|
|
|
+ userId: '',
|
|
|
|
|
+ reason: ''
|
|
|
},
|
|
},
|
|
|
- taskId: {
|
|
|
|
|
- default: ''
|
|
|
|
|
|
|
+ submitParams: {
|
|
|
|
|
+ QCLeader: 'qcId',
|
|
|
|
|
+ techLeader: 'techId',
|
|
|
|
|
+ produceLeader: 'produceId'
|
|
|
},
|
|
},
|
|
|
- id: {
|
|
|
|
|
- default: ''
|
|
|
|
|
|
|
+ rules: {
|
|
|
|
|
+ reason: {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请输入审批建议',
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
|
+ },
|
|
|
|
|
+ userId: {required: true, message: '请选择指派人', trigger: 'change'}
|
|
|
},
|
|
},
|
|
|
- taskDefinitionKey: {
|
|
|
|
|
- default: ''
|
|
|
|
|
|
|
+ userOptions: [],
|
|
|
|
|
+ activeComp: '',
|
|
|
|
|
+ permissionType: '',
|
|
|
|
|
+ childActiveComp: '',
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ async created() {
|
|
|
|
|
+ this.userOptions = [];
|
|
|
|
|
+ listAllUserBind().then((data) => {
|
|
|
|
|
+ this.userOptions.push(...data);
|
|
|
|
|
+ });
|
|
|
|
|
+ this.activeComp = this.taskDefinitionKey;
|
|
|
|
|
+ EventBus.$on('getActiveCompValue', (row) => {
|
|
|
|
|
+ this.activeComp = row.activeComp;
|
|
|
|
|
+ this.childActiveComp = row.childActiveComp;
|
|
|
|
|
+ this.permissionType = row.permissionType;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ // 销售退货入库
|
|
|
|
|
+ async salesReturnsInStorage(data, pass) {
|
|
|
|
|
+ // 获取销售退货入库信息
|
|
|
|
|
+ let storageData = await this.getReturnStorage();
|
|
|
|
|
+ // 是否已经入库
|
|
|
|
|
+ if (storageData.isStorage) {
|
|
|
|
|
+ approveTaskWithVariablesAPI({
|
|
|
|
|
+ id: this.taskId,
|
|
|
|
|
+ reason: this.form.reason,
|
|
|
|
|
+ variables: {
|
|
|
|
|
+ pass: !!pass
|
|
|
|
|
+ }
|
|
|
|
|
+ }).then((res) => {
|
|
|
|
|
+ if (res.code != '-1') {
|
|
|
|
|
+ this.$emit('handleAudit', {
|
|
|
|
|
+ status: pass,
|
|
|
|
|
+ title: !pass ? '驳回' : ''
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 入库来源storageSource 0-正常 1-外部(外部跳过内部审核流程)
|
|
|
|
|
+ storageData.storageSource = 1;
|
|
|
|
|
+ // 获取货位信息(判断货位信息是否填写)
|
|
|
|
|
+ let houseListLength = storageData.outInDetailAddPOList.map((item) => {
|
|
|
|
|
+ return item.houseList.length;
|
|
|
|
|
+ });
|
|
|
|
|
+ let boolen = houseListLength.every((item) => item > 0);
|
|
|
|
|
+ if (boolen) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await outin.save(storageData);
|
|
|
|
|
+ console.log('res------------------', res);
|
|
|
|
|
+ data.returnInReceiptId = res.data;
|
|
|
|
|
+ const updateRes = await saleReturnUpdateAPI(data);
|
|
|
|
|
+ if (updateRes.code == 0) {
|
|
|
|
|
+ approveTaskWithVariablesAPI({
|
|
|
|
|
+ id: this.taskId,
|
|
|
|
|
+ reason: this.form.reason,
|
|
|
|
|
+ variables: {
|
|
|
|
|
+ pass: !!pass
|
|
|
|
|
+ }
|
|
|
|
|
+ }).then((res) => {
|
|
|
|
|
+ if (res.code != '-1') {
|
|
|
|
|
+ this.$emit('handleAudit', {
|
|
|
|
|
+ status: pass,
|
|
|
|
|
+ title: !pass ? '驳回' : ''
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('保存失败:', error);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.error('请选择物品货位信息');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- data() {
|
|
|
|
|
- return {
|
|
|
|
|
- form: {
|
|
|
|
|
- userId: '',
|
|
|
|
|
- reason: ''
|
|
|
|
|
- },
|
|
|
|
|
- submitParams: {
|
|
|
|
|
- QCLeader: 'qcId',
|
|
|
|
|
- techLeader: 'techId',
|
|
|
|
|
- produceLeader: 'produceId'
|
|
|
|
|
- },
|
|
|
|
|
- rules: {
|
|
|
|
|
- reason: {
|
|
|
|
|
- required: true,
|
|
|
|
|
- message: '请输入审批建议',
|
|
|
|
|
- trigger: 'blur'
|
|
|
|
|
- },
|
|
|
|
|
- userId: { required: true, message: '请选择指派人', trigger: 'change' }
|
|
|
|
|
- },
|
|
|
|
|
- userOptions: [],
|
|
|
|
|
- activeComp: '',
|
|
|
|
|
- permissionType: ''
|
|
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
- async created() {
|
|
|
|
|
- this.userOptions = [];
|
|
|
|
|
- listAllUserBind().then((data) => {
|
|
|
|
|
- this.userOptions.push(...data);
|
|
|
|
|
- });
|
|
|
|
|
- this.activeComp = this.taskDefinitionKey;
|
|
|
|
|
- EventBus.$on('getActiveCompValue', (row) => {
|
|
|
|
|
- this.activeComp = row.activeComp;
|
|
|
|
|
- this.permissionType = row.permissionType;
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- mounted() {},
|
|
|
|
|
- methods: {
|
|
|
|
|
- // 销售退货入库
|
|
|
|
|
- async salesReturnsInStorage(data, pass) {
|
|
|
|
|
- // 获取销售退货入库信息
|
|
|
|
|
- let storageData = await this.getReturnStorage();
|
|
|
|
|
- // 是否已经入库
|
|
|
|
|
- if (storageData.isStorage) {
|
|
|
|
|
|
|
+ //保存表格数据
|
|
|
|
|
+ async handleAudit(pass) {
|
|
|
|
|
+ let data = await this.getTableValue();
|
|
|
|
|
+ let updateCode = '1'; //判断saleReturnUpdateAPI方法是否执行成功
|
|
|
|
|
+ this.$refs.formRef.validate(async (validate) => {
|
|
|
|
|
+ if ((!validate || !data) && !!pass)
|
|
|
|
|
+ return this.$message.warning('有必填项未填,请检查');
|
|
|
|
|
+ // 销售退货入库节点
|
|
|
|
|
+ if (this.taskDefinitionKey === 'storeman' && !!pass) {
|
|
|
|
|
+ this.salesReturnsInStorage(data, pass);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (this.permissionType == 'update' && !!pass)
|
|
|
|
|
+ updateCode = await saleReturnUpdateAPI(data);
|
|
|
|
|
+ if (typeof updateCode !== 'string') return;
|
|
|
|
|
+ let variables = {
|
|
|
|
|
+ pass: !!pass
|
|
|
|
|
+ };
|
|
|
|
|
+ if (this.submitParams[this.taskDefinitionKey]) {
|
|
|
|
|
+ variables[this.submitParams[this.taskDefinitionKey]] =
|
|
|
|
|
+ this.form.userId;
|
|
|
|
|
+ }
|
|
|
approveTaskWithVariablesAPI({
|
|
approveTaskWithVariablesAPI({
|
|
|
id: this.taskId,
|
|
id: this.taskId,
|
|
|
reason: this.form.reason,
|
|
reason: this.form.reason,
|
|
|
- variables: {
|
|
|
|
|
- pass: !!pass
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ variables
|
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
|
if (res.code != '-1') {
|
|
if (res.code != '-1') {
|
|
|
this.$emit('handleAudit', {
|
|
this.$emit('handleAudit', {
|
|
@@ -145,99 +219,28 @@
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- } else {
|
|
|
|
|
- // 入库来源storageSource 0-正常 1-外部(外部跳过内部审核流程)
|
|
|
|
|
- storageData.storageSource = 1;
|
|
|
|
|
- // 获取货位信息(判断货位信息是否填写)
|
|
|
|
|
- let houseListLength = storageData.outInDetailAddPOList.map((item) => {
|
|
|
|
|
- return item.houseList.length;
|
|
|
|
|
- });
|
|
|
|
|
- let boolen = houseListLength.every((item) => item > 0);
|
|
|
|
|
- if (boolen) {
|
|
|
|
|
- try {
|
|
|
|
|
- const res = await outin.save(storageData);
|
|
|
|
|
- console.log('res------------------', res);
|
|
|
|
|
- data.returnInReceiptId = res.data;
|
|
|
|
|
- const updateRes = await saleReturnUpdateAPI(data);
|
|
|
|
|
- if (updateRes.code == 0) {
|
|
|
|
|
- approveTaskWithVariablesAPI({
|
|
|
|
|
- id: this.taskId,
|
|
|
|
|
- reason: this.form.reason,
|
|
|
|
|
- variables: {
|
|
|
|
|
- pass: !!pass
|
|
|
|
|
- }
|
|
|
|
|
- }).then((res) => {
|
|
|
|
|
- if (res.code != '-1') {
|
|
|
|
|
- this.$emit('handleAudit', {
|
|
|
|
|
- status: pass,
|
|
|
|
|
- title: !pass ? '驳回' : ''
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('保存失败:', error);
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- this.$message.error('请选择物品货位信息');
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
- },
|
|
|
|
|
- //保存表格数据
|
|
|
|
|
- async handleAudit(pass) {
|
|
|
|
|
- let data = await this.getTableValue();
|
|
|
|
|
- let updateCode = '1'; //判断saleReturnUpdateAPI方法是否执行成功
|
|
|
|
|
- this.$refs.formRef.validate(async (validate) => {
|
|
|
|
|
- if ((!validate || !data) && !!pass)
|
|
|
|
|
- return this.$message.warning('有必填项未填,请检查');
|
|
|
|
|
- // 销售退货入库节点
|
|
|
|
|
- if (this.taskDefinitionKey === 'storeman' && !!pass) {
|
|
|
|
|
- this.salesReturnsInStorage(data, pass);
|
|
|
|
|
- } else {
|
|
|
|
|
- if (this.permissionType == 'update' && !!pass)
|
|
|
|
|
- updateCode = await saleReturnUpdateAPI(data);
|
|
|
|
|
- if (typeof updateCode !== 'string') return;
|
|
|
|
|
- let variables = {
|
|
|
|
|
- pass: !!pass
|
|
|
|
|
- };
|
|
|
|
|
- if (this.submitParams[this.taskDefinitionKey]) {
|
|
|
|
|
- variables[this.submitParams[this.taskDefinitionKey]] =
|
|
|
|
|
- this.form.userId;
|
|
|
|
|
- }
|
|
|
|
|
- approveTaskWithVariablesAPI({
|
|
|
|
|
- id: this.taskId,
|
|
|
|
|
- reason: this.form.reason,
|
|
|
|
|
- variables
|
|
|
|
|
- }).then((res) => {
|
|
|
|
|
- if (res.code != '-1') {
|
|
|
|
|
- this.$emit('handleAudit', {
|
|
|
|
|
- status: pass,
|
|
|
|
|
- title: !pass ? '驳回' : ''
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- getTableValue() {
|
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
|
- this.$emit('getTableValue', async (data) => {
|
|
|
|
|
- resolve(await data);
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- getReturnStorage() {
|
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
|
- this.$emit('getReturnStorage', async (data) => {
|
|
|
|
|
- resolve(await data);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ getTableValue() {
|
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
|
+ this.$emit('getTableValue', async (data) => {
|
|
|
|
|
+ resolve(await data);
|
|
|
});
|
|
});
|
|
|
- }
|
|
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
- beforeDestroy() {
|
|
|
|
|
- EventBus.$off('getActiveCompValue');
|
|
|
|
|
|
|
+ getReturnStorage() {
|
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
|
+ this.$emit('getReturnStorage', async (data) => {
|
|
|
|
|
+ resolve(await data);
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- };
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ beforeDestroy() {
|
|
|
|
|
+ EventBus.$off('getActiveCompValue');
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss"></style>
|
|
<style lang="scss"></style>
|