jingshuyong 11 месяцев назад
Родитель
Сommit
9c17c5596e

+ 12 - 0
src/api/afterSales/index.js

@@ -0,0 +1,12 @@
+import request from '@/utils/request';
+export async function getByInfo(id) {
+  const res = await request({
+    url: `/eom/sparePartsApply/getById/${id}`,
+    method: 'get'
+  });
+
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 144 - 0
src/views/bpm/handleTask/components/afterSales/accessory.vue

@@ -0,0 +1,144 @@
+<template>
+  <el-form ref="accessoryFormRef" :model="form" label-width="100px">
+    <headerTitle title="基本信息" style="margin-top: 15px"></headerTitle>
+    <el-row>
+      <el-col :span="6">
+        <el-form-item label="编码:">
+          <el-input v-model="form.code" readonly />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="工单名称:">
+          <el-input readonly v-model="form.name" />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="领用部门">
+          <el-input readonly v-model="form.receivingDeptName" />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="领用人">
+          <el-input readonly v-model="form.recipientName" />
+        </el-form-item>
+      </el-col>
+    </el-row>
+    <el-row>
+      <el-col :span="6">
+        <el-form-item label="使用时间:">
+          <el-date-picker
+            readonly
+            style="width: 100%"
+            v-model="form.usageTime"
+            type="date"
+            placeholder="选择"
+            value-format="yyyy-MM-dd HH:mm:ss"
+          ></el-date-picker>
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="使用部门">
+          <el-input readonly v-model="form.useDeptName" />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="使用人">
+          <el-input readonly v-model="form.userName" />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="用途:">
+          <el-input readonly v-model="form.purpose" type="textarea" :rows="2" />
+        </el-form-item>
+      </el-col>
+    </el-row>
+    <!-- 配件信息 -->
+    <spareInfo ref="spareInfoRef" :detailList="detailList" />
+    <div class="title" v-if="!isView && taskDefinitionKey == 'wms_out'">
+      出库单信息</div
+    >
+    <keep-alive>
+      <add
+        ref="add"
+        :form="form"
+        :sourceBizNo="form.code"
+        :bizType="4"
+        :saleProductList="detailList"
+        v-if="!isView && taskDefinitionKey == 'wms_out' && form.id"
+      ></add>
+    </keep-alive>
+  </el-form>
+</template>
+
+<script>
+  import add from '@/views/bpm/outgoingManagement/outbound.vue';
+  import { getByInfo } from '@/api/afterSales/index';
+  import spareInfo from './spareInfo.vue';
+  export default {
+    components: { spareInfo, add },
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        type: String,
+        default: ''
+      },
+      isView: ''
+    },
+    data() {
+      return {
+        form: {
+          code: '',
+          name: '',
+          receivingDeptName: '',
+          recipientName: '',
+          usageTime: '',
+          userName: '',
+          purpose: '',
+          useDeptName: ''
+        },
+        loginChangeRoleVOList: [],
+        executorList: [], // 执行人列表
+        detailList: []
+      };
+    },
+    created() {
+      this.getDetail(this.businessId);
+    },
+    methods: {
+      async getTableValue() {
+        return {
+          form: this.form,
+          returnStorageData:
+            this.$refs.add && (await this.$refs.add.getReturnStorage())
+        };
+      },
+      async getDetail(id) {
+        const row = await getByInfo(id);
+        this.form.categoryLevelTopId = this.getUniqueCategoryLevelIds(
+          row.details
+        );
+        this.form.name = row.name;
+        this.form.code = row.code;
+        this.form.useDeptName = row.useDeptName;
+        this.form.receivingDeptName = row.receivingDeptName;
+        this.form.recipientName = row.recipientName;
+        this.form.usageTime = row.usageTime;
+        this.form.userName = row.userName;
+        this.form.purpose = row.purpose;
+        this.form.id = row.id;
+        this.detailList = row.details;
+        this.form.remark = row.purpose;
+        
+        this.form.deptId = row.useDeptId;
+        this.form.deptName = row.useDeptName;
+        this.form.makerId = row.userId;
+        this.form.makerName = row.userName;
+      },
+      getUniqueCategoryLevelIds(arr) {
+        return [...new Set(arr.map((item) => item.categoryLevelId))].join(',');
+      }
+    }
+  };
+</script>

+ 157 - 0
src/views/bpm/handleTask/components/afterSales/spareInfo.vue

@@ -0,0 +1,157 @@
+<template>
+  <el-form ref="spareInfoRef">
+    <headerTitle :title="title" style="margin-top: 15px"></headerTitle>
+    <ele-pro-table
+      ref="table"
+      :columns="columns"
+      :datasource="tableList"
+      row-key="id"
+      height="30vh"
+      :needPage="false"
+    >
+      <template v-slot:toolbar>
+        <div class="toobar toobar_r">
+          <div class="total_price">总计: {{ totalPrice }} (元)</div>
+        </div>
+      </template>
+    </ele-pro-table>
+  </el-form>
+</template>
+
+<script>
+  export default {
+    props: {
+      detailList: {
+        type: Array,
+        default: () => []
+      },
+      types: {
+        type: String,
+        default: ''
+      },
+      title: {
+        type: String,
+        default: '配件信息'
+      }
+    },
+    watch: {
+      detailList: {
+        handler(newVal) {
+          this.tableList = JSON.parse(JSON.stringify(newVal));
+          this.calculatePrice();
+        },
+        immediate: true
+      }
+    },
+    data() {
+      return {
+        tableList: [],
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+
+          {
+            prop: 'categoryCode',
+            label: '物品编码',
+            align: 'center'
+          },
+          {
+            prop: 'categoryName',
+            label: '物品名称',
+            align: 'center'
+          },
+
+          {
+            prop: 'categoryModel',
+            label: '型号',
+            align: 'center'
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center'
+          },
+          {
+            prop: 'level',
+            label: '级别',
+            align: 'center'
+          },
+          {
+            prop: 'totalCount',
+            label: '数量',
+            align: 'center',
+            width: 100
+          },
+          {
+            prop: 'singlePrice',
+            label: '单价',
+            align: 'center',
+            width: 100
+          },
+          {
+            prop: 'totalPrice',
+            label: '总价',
+            align: 'center',
+            width: 100
+          },
+          {
+            prop: 'measureUnit',
+            label: '计量单位',
+            align: 'center'
+          },
+          {
+            prop: 'warehouseName',
+            label: '仓库',
+            align: 'center'
+          }
+        ],
+        totalPrice: 0 // 总计
+      };
+    },
+    mounted() {},
+    methods: {
+      // 计算汇总价格 ***
+      calculatePrice() {
+        let totlal = 0;
+        this.tableList.map((el) => (totlal += el.totalPrice || 0));
+        this.totalPrice = totlal;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .add-product {
+    // width: 70%;
+    display: flex;
+    align-items: center;
+    // justify-content: flex-end;
+    font-size: 30px;
+    color: #1890ff;
+    margin: 10px 0;
+    cursor: pointer;
+  }
+
+  .toobar {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding-right: 16px;
+
+    .total_price {
+      margin-left: 24px;
+      min-width: 50px;
+    }
+  }
+
+  .toobar_r {
+    justify-content: flex-end;
+  }
+</style>

+ 215 - 0
src/views/bpm/handleTask/components/afterSales/submit.vue

@@ -0,0 +1,215 @@
+<template>
+  <el-col :span="16" :offset="6">
+    <el-form label-width="100px" ref="formRef" :model="form">
+      <el-form-item
+        label="审批建议"
+        style="margin-bottom: 20px"
+        :rules="{
+          required: true,
+          message: '请选择',
+          trigger: 'change'
+        }"
+      >
+        <el-input
+          type="textarea"
+          v-model="form.reason"
+          placeholder="请输入审批建议"
+        />
+      </el-form-item>
+    </el-form>
+    <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
+      <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        v-if="
+          taskDefinitionKey != 'wms_out' ||
+          (taskDefinitionKey == 'wms_out' &&
+            outInData.verifyStatus == 2)
+        "
+        @click="handleAudit(1)"
+        >通过
+      </el-button>
+      <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        :loading="isSaveLoading"
+        @click="wms_out"
+        v-if="
+          ['wms_out'].includes(taskDefinitionKey) 
+
+        "
+        >申请出库
+      </el-button>
+      <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="rejectTask(0)"
+        >驳回
+      </el-button>
+    </div>
+  </el-col>
+</template>
+
+<script>
+  import {
+    saleSendProcessCancel
+  } from '@/api/bpm/components/saleManage/saleorder';
+  import { approveTaskWithVariables, rejectTask } from '@/api/bpm/task';
+  import storageApi from '@/api/warehouseManagement';
+
+  // 流程实例的详情页,可用于审批
+  export default {
+    name: '',
+    components: {
+      //   Parser
+    },
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskId: {
+        default: ''
+      },
+      id: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        isSaveLoading: false,
+        form: {
+          technicianId: '',
+          reason: ''
+        },
+        outInData: { verifyStatus: 0 },
+        activeComp: ''
+      };
+    },
+    async created() {
+     
+    },
+    methods: {
+      async wms_out() {
+        let res = await this.getTableValue();
+        let storageData = res.returnStorageData;
+        console.log(storageData);
+        // 出库来源isSkip 0-正常  1-外部(外部跳过内部审核流程)
+        storageData.isSkip = 1;
+        storageData.isMes = 1;
+        try {
+          this.isSaveLoading = true;
+          await storageApi.outStorage(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.isSaveLoading = false;
+          console.error('保存失败:', error);
+        }
+      },
+      activeCompChange(activeComp) {
+        this.activeComp = activeComp;
+      },
+      /** 处理转办审批人 */
+      handleUpdateAssignee() {
+        this.$emit('handleUpdateAssignee');
+      },
+      /** 退回 */
+      handleBackList() {
+        this.$emit('handleBackList');
+      },
+      rejectTask(status) {
+        let variables = {
+          pass: !!status
+        };
+        rejectTask({
+          id: this.taskId,
+          reason: this.form.reason,
+          variables
+        }).then((res) => {
+          if (res.data.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: status === 0 ? '驳回' : ''
+            });
+          }
+        });
+      },
+      async handleAudit(status) {
+         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 ? '驳回' : ''
+            });
+          }
+        });
+         
+      },
+      async _approveTaskWithVariables(status, storemanIds) {
+      
+      },
+      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(() => {
+              saleSendProcessCancel({
+                id: this.taskId,
+                reason: this.form.reason,
+                businessId: this.businessId
+              })
+                .then(() => {
+                  this.$emit('handleClose');
+                })
+                .catch(() => {
+                  this.$message.error('流程作废失败');
+                });
+            })
+            .catch(() => {});
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss"></style>

+ 1 - 2
src/views/bpm/outgoingManagement/outbound.vue

@@ -702,7 +702,6 @@ export default {
 
       if (this.detailList?.length > 0) {
         // 获取领料人列表
-
         if (this.form.executorDeptId) {
           this.getStaffList({ id: this.form.executorDeptId }).then(() => {
             // 获取领料人和领料部门
@@ -763,7 +762,7 @@ export default {
           type: '1',
           builders: this.saleProductList.map((item) => {
             return {
-              categoryId: item.productId,
+              categoryId: item.productId||item.categoryId,
               num: item.totalCount,
             };
           })