|
|
@@ -25,7 +25,7 @@
|
|
|
size="mini"
|
|
|
@click="handleAudit(1)"
|
|
|
v-if="taskDefinitionKey != 'storeman'"
|
|
|
- >通过
|
|
|
+ >通过
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
v-else
|
|
|
@@ -35,7 +35,7 @@
|
|
|
:loading="isLoading"
|
|
|
@click="storemanApprove"
|
|
|
v-if="['storeman'].includes(taskDefinitionKey)"
|
|
|
- >申请出库
|
|
|
+ >申请出库
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
icon="el-icon-circle-close"
|
|
|
@@ -43,14 +43,14 @@
|
|
|
size="mini"
|
|
|
@click="handleAudit(0)"
|
|
|
v-if="!['starter'].includes(taskDefinitionKey)"
|
|
|
- >驳回
|
|
|
+ >驳回
|
|
|
</el-button>
|
|
|
<el-dropdown
|
|
|
@command="(command) => handleCommand(command)"
|
|
|
style="margin-left: 30px"
|
|
|
>
|
|
|
<span class="el-dropdown-link"
|
|
|
- >更多<i class="el-icon-arrow-down el-icon--right"></i
|
|
|
+ >更多<i class="el-icon-arrow-down el-icon--right"></i
|
|
|
></span>
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
<el-dropdown-item command="cancel">作废</el-dropdown-item>
|
|
|
@@ -61,180 +61,179 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import outin from '@/api/warehouseManagement/outin';
|
|
|
- import {
|
|
|
- UpdateReturnInformation,
|
|
|
- saleReturnProcessCancel,
|
|
|
- getWarehouseListByIds
|
|
|
- } from '@/api/bpm/components/saleManage/saleorder';
|
|
|
- import { approveTaskWithVariables } from '@/api/bpm/task';
|
|
|
- import { listAllUserBind } from '@/api/system/organization';
|
|
|
+import outin from '@/api/warehouseManagement/outin';
|
|
|
+import {
|
|
|
+ UpdateReturnInformation,
|
|
|
+ saleReturnProcessCancel,
|
|
|
+ getWarehouseListByIds
|
|
|
+} from '@/api/bpm/components/saleManage/saleorder';
|
|
|
+import {approveTaskWithVariables} from '@/api/bpm/task';
|
|
|
+import {listAllUserBind} from '@/api/system/organization';
|
|
|
|
|
|
- // 流程实例的详情页,可用于审批
|
|
|
- export default {
|
|
|
- name: '',
|
|
|
- components: {
|
|
|
- // Parser
|
|
|
+// 流程实例的详情页,可用于审批
|
|
|
+export default {
|
|
|
+ name: '',
|
|
|
+ components: {
|
|
|
+ // Parser
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ businessId: {
|
|
|
+ default: ''
|
|
|
},
|
|
|
- props: {
|
|
|
- businessId: {
|
|
|
- default: ''
|
|
|
- },
|
|
|
- taskId: {
|
|
|
- default: ''
|
|
|
- },
|
|
|
- id: {
|
|
|
- default: ''
|
|
|
+ taskId: {
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ id: {
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ taskDefinitionKey: {
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isLoading: false,
|
|
|
+ form: {
|
|
|
+ technicianId: '',
|
|
|
+ reason: ''
|
|
|
},
|
|
|
- taskDefinitionKey: {
|
|
|
- default: ''
|
|
|
+ userOptions: [],
|
|
|
+ activeComp: ''
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async created() {
|
|
|
+ this.userOptions = [];
|
|
|
+ listAllUserBind().then((data) => {
|
|
|
+ this.userOptions.push(...data);
|
|
|
+ });
|
|
|
+ if (this.taskDefinitionKey == 'storemanApprove') {
|
|
|
+ let data = await getReturnSaleOrderrecordDetail(this.businessId);
|
|
|
+ try {
|
|
|
+ this.outInData = await getOutInBySourceBizNo(data.orderNo);
|
|
|
+ } catch (error) {
|
|
|
}
|
|
|
+ this.outInData.verifyStatus = 0;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 处理转办审批人 */
|
|
|
+ handleUpdateAssignee() {
|
|
|
+ this.$emit('handleUpdateAssignee');
|
|
|
},
|
|
|
- data() {
|
|
|
- return {
|
|
|
- isLoading: false,
|
|
|
- form: {
|
|
|
- technicianId: '',
|
|
|
- reason: ''
|
|
|
- },
|
|
|
- userOptions: [],
|
|
|
- activeComp: ''
|
|
|
- };
|
|
|
+ /** 退回 */
|
|
|
+ handleBackList() {
|
|
|
+ this.$emit('handleBackList');
|
|
|
},
|
|
|
- async created() {
|
|
|
- this.userOptions = [];
|
|
|
- listAllUserBind().then((data) => {
|
|
|
- this.userOptions.push(...data);
|
|
|
- });
|
|
|
- if (this.taskDefinitionKey == 'storemanApprove') {
|
|
|
- let data = await getReturnSaleOrderrecordDetail(this.businessId);
|
|
|
- try {
|
|
|
- this.outInData = await getOutInBySourceBizNo(data.orderNo);
|
|
|
- } catch (error) {}
|
|
|
- this.outInData.verifyStatus = 0;
|
|
|
+ async storemanApprove() {
|
|
|
+ let data = await this.getTableValue();
|
|
|
+ let storageData = data.returnStorageData;
|
|
|
+ // 入库来源storageSource 0-正常 1-外部(外部跳过内部审核流程)
|
|
|
+ storageData.storageSource = 1;
|
|
|
+ try {
|
|
|
+ this.isLoading = true;
|
|
|
+ const res = await outin.saveNew(storageData);
|
|
|
+ if (res.code == 0) {
|
|
|
+ approveTaskWithVariables({
|
|
|
+ id: this.taskId,
|
|
|
+ reason: this.form.reason,
|
|
|
+ variables: {
|
|
|
+ pass: true
|
|
|
+ }
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code != '-1') {
|
|
|
+ this.$emit('handleAudit', {
|
|
|
+ status: 1,
|
|
|
+ title: '出库'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.isLoading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.isLoading = false;
|
|
|
+ console.error('保存失败:', error);
|
|
|
}
|
|
|
},
|
|
|
- methods: {
|
|
|
- /** 处理转办审批人 */
|
|
|
- handleUpdateAssignee() {
|
|
|
- this.$emit('handleUpdateAssignee');
|
|
|
- },
|
|
|
- /** 退回 */
|
|
|
- handleBackList() {
|
|
|
- this.$emit('handleBackList');
|
|
|
- },
|
|
|
- async storemanApprove() {
|
|
|
- let data = await this.getTableValue();
|
|
|
- let storageData = data.returnStorageData;
|
|
|
- // 入库来源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: true
|
|
|
- }
|
|
|
- }).then((res) => {
|
|
|
- if (res.code != '-1') {
|
|
|
- this.$emit('handleAudit', {
|
|
|
- status: 1,
|
|
|
- title: '出库'
|
|
|
- });
|
|
|
- }
|
|
|
- this.isLoading = false;
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- this.isLoading = false;
|
|
|
- console.error('保存失败:', error);
|
|
|
- }
|
|
|
- },
|
|
|
- async handleAudit(status) {
|
|
|
- let storemanIds = '';
|
|
|
- //发起人补充
|
|
|
- if (this.taskDefinitionKey === 'starter') {
|
|
|
- let arr = await this.getTableValue();
|
|
|
- if (!arr) {
|
|
|
- return;
|
|
|
- }
|
|
|
- let data = await UpdateReturnInformation(arr);
|
|
|
- if (data.code != '0') {
|
|
|
- return;
|
|
|
- }
|
|
|
+ async handleAudit(status) {
|
|
|
+ let storemanIds = '';
|
|
|
+ //发起人补充
|
|
|
+ if (this.taskDefinitionKey === 'starter') {
|
|
|
+ let arr = await this.getTableValue();
|
|
|
+ if (!arr) {
|
|
|
+ return;
|
|
|
}
|
|
|
- //部门负责人审核
|
|
|
- if (this.taskDefinitionKey === 'deptLeader') {
|
|
|
- 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 UpdateReturnInformation(arr);
|
|
|
+ if (data.code != '0') {
|
|
|
+ return;
|
|
|
}
|
|
|
+ }
|
|
|
+ //部门负责人审核
|
|
|
+ if (this.taskDefinitionKey === 'deptLeader') {
|
|
|
+ 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(',');
|
|
|
+ }
|
|
|
|
|
|
- this.approveTaskWithVariables(status, storemanIds);
|
|
|
- },
|
|
|
- activeCompChange(activeComp) {
|
|
|
- this.activeComp = activeComp;
|
|
|
- },
|
|
|
- async approveTaskWithVariables(status, storemanIds) {
|
|
|
- let variables = {
|
|
|
- pass: !!status,
|
|
|
- storemanIds
|
|
|
- };
|
|
|
- approveTaskWithVariables({
|
|
|
- id: this.taskId,
|
|
|
- reason: this.form.reason,
|
|
|
- variables
|
|
|
- }).then((res) => {
|
|
|
- if (res.data.code != '-1') {
|
|
|
- this.$emit('handleAudit', {
|
|
|
- status,
|
|
|
- title: status === 0 ? '驳回' : ''
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- getTableValue() {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- this.$emit('getTableValue', async (data) => {
|
|
|
- resolve(await data);
|
|
|
+ this.approveTaskWithVariables(status, storemanIds);
|
|
|
+ },
|
|
|
+ activeCompChange(activeComp) {
|
|
|
+ this.activeComp = activeComp;
|
|
|
+ },
|
|
|
+ async approveTaskWithVariables(status, storemanIds) {
|
|
|
+ let variables = {
|
|
|
+ pass: !!status
|
|
|
+ };
|
|
|
+ if (storemanIds) variables.storemanIds = storemanIds
|
|
|
+ approveTaskWithVariables({
|
|
|
+ id: this.taskId,
|
|
|
+ reason: this.form.reason,
|
|
|
+ variables
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.data.code != '-1') {
|
|
|
+ this.$emit('handleAudit', {
|
|
|
+ status,
|
|
|
+ title: status === 0 ? '驳回' : ''
|
|
|
});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ getTableValue() {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.$emit('getTableValue', async (data) => {
|
|
|
+ resolve(await data);
|
|
|
});
|
|
|
- },
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- //更多
|
|
|
- handleCommand(command) {
|
|
|
- if (command === 'cancel') {
|
|
|
- this.$confirm('是否确认作废?', {
|
|
|
- type: 'warning',
|
|
|
- cancelButtonText: '取消',
|
|
|
- confirmButtonText: '确定'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- saleReturnProcessCancel({
|
|
|
- id: this.taskId,
|
|
|
- reason: this.form.reason,
|
|
|
- businessId: this.businessId
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.$emit('handleClose');
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.$message.error('流程作废失败');
|
|
|
- });
|
|
|
+ //更多
|
|
|
+ handleCommand(command) {
|
|
|
+ if (command === 'cancel') {
|
|
|
+ this.$confirm('是否确认作废?', {
|
|
|
+ type: 'warning',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ confirmButtonText: '确定'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ saleReturnProcessCancel({
|
|
|
+ id: this.taskId,
|
|
|
+ reason: this.form.reason,
|
|
|
+ businessId: this.businessId
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
- }
|
|
|
+ .then(() => {
|
|
|
+ this.$emit('handleClose');
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message.error('流程作废失败');
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss"></style>
|