Просмотр исходного кода

feat(配件回收管理): 新增配件回收记录详情页及回收入库功能

yusheng 7 месяцев назад
Родитель
Сommit
c4df9e6960

+ 12 - 0
src/api/bpm/components/salesServiceManagement/recycle.js

@@ -0,0 +1,12 @@
+import request from '@/utils/request';
+import { download } from '@/utils/file';
+
+
+// 配件回收记录 表格 详情
+export async function recycleDetails(id) {
+  const res = await request.get(`/eom/afterSalesAccessoryApply/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 1 - 0
src/utils/dict/warehouse.js

@@ -47,6 +47,7 @@ export const sceneState = [
   { code: 13, label: '受托入库', documentsName: '受托收货单' },
   { code: 14, label: '项目入库', documentsName: '项目编码' },
   { code: 15, label: '调拨入库' },
+  { code: 16, label: '回收入库' },
   { code: 99, label: '其他入库' }
 ];
 export const outputSceneState = [

+ 257 - 0
src/views/bpm/handleTask/components/salesServiceManagement/recycle/recycleDialog.vue

@@ -0,0 +1,257 @@
+<template>
+  <div>
+    <el-form ref="recyleFormRef" :model="form" label-width="100px">
+      <headerTitle title="基本信息" style="margin-top: 15px"></headerTitle>
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="编码:" prop="code">
+            <el-input v-model="form.code" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="回收部门:" prop="recycleDeptId">
+            <el-input v-model="form.recycleDeptName" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="回收人:" prop="recycleName">
+            <el-input v-model="form.recycleName" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="工单名称:" prop="orderWorkName">
+            <el-input v-model="form.orderWorkName" disabled placeholder=" " />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="工单编码:">
+            <el-input v-model="form.orderWorkCode" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="客户名称:" prop="code">
+            <el-input v-model="form.contactName" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="客户编码:" prop="code">
+            <el-input v-model="form.contactCode" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="设备名称" prop="demandDetailId">
+            <el-input v-model="form.categoryName" disabled />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="设备编码:">
+            <el-input v-model="form.categoryCode" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="回收时间:">
+            <el-date-picker
+              style="width: 100%"
+              v-model="form.usageTime"
+              type="date"
+              placeholder="选择"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              disabled
+            ></el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="原因">
+            <el-input
+              v-model="form.reason"
+              type="textarea"
+              :rows="2"
+              disabled
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <headerTitle title="配件回收清单" style="margin-top: 15px"> </headerTitle>
+      <ele-pro-table
+        ref="table"
+        :needPage="false"
+        :columns="columns"
+        :datasource="form.detailList"
+        class="time-form"
+        :maxHeight="400"
+        full-height="calc(100vh - 116px)"
+      >
+      </ele-pro-table>
+    </el-form>
+    <headerTitle
+      title="入库信息"
+      style="margin-top: 15px"
+      v-if="taskDefinitionKey == 'storemanApprove' && form.code"
+    >
+    </headerTitle>
+
+    <add
+      ref="add"
+      :form="form"
+      v-if="taskDefinitionKey == 'storemanApprove' && form.code && !isView"
+      :sourceBizNo="form.code"
+      :saleProductList="
+        form.detailList.map((item) => {
+          item.productCode = item.categoryCode;
+          item.totalCountNew = this.form.detailList.filter(
+            (item1) => item1.categoryCode == item.categoryCode
+          ).length;
+          item.measuringUnit = item.measureUnit;
+          return item;
+        })
+      "
+      :bizType="16"
+      :isMoreProduct="true"
+    ></add>
+    <detailDialog
+      :businessId="form.code"
+      v-if="isView && form.code"
+    ></detailDialog>
+  </div>
+</template>
+
+<script>
+  import { recycleDetails } from '@/api/bpm/components/salesServiceManagement/recycle';
+  import add from '@/views/bpm/stockManagement/storage.vue';
+  import detailDialog from '@/views/bpm/stockManagement/details.vue';
+
+  export default {
+    components: {
+      add,
+      detailDialog
+    },
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      },
+      isView: ''
+    },
+
+    data() {
+      return {
+        loading: false,
+
+        form: {},
+        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,
+            slot: 'totalCount'
+          },
+          {
+            prop: 'singlePrice',
+            label: '单价',
+            align: 'center',
+            width: 100,
+            slot: 'singlePrice'
+          },
+          {
+            prop: 'totalPrice',
+            label: '总价',
+            align: 'center',
+            width: 100
+          },
+          //   {
+          //     prop: 'measureQuantity',
+          //     label: '库存',
+          //     align: 'center'
+          //   },
+          {
+            prop: 'measureUnit',
+            label: '计量单位',
+            align: 'center'
+          },
+          {
+            prop: 'warehouseName',
+            label: '仓库',
+            slot: 'warehouseName',
+            align: 'center'
+          }
+        ]
+      };
+    },
+    created() {
+      this.getDetail();
+    },
+
+    methods: {
+      async getDetail() {
+        this.form = await recycleDetails(this.businessId);
+      },
+      async getTableValue() {
+        try {
+          this.form.returnStorageData = await this.$refs.add.getReturnStorage();
+          return Object.assign({}, this.form);
+        } catch (error) {
+          return '';
+          // 表单验证未通过,不执行保存操作
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .device_name {
+    .el-select-dropdown__wrap {
+      .el-select-dropdown__item {
+        padding: 0 !important;
+      }
+    }
+
+    .option_ {
+      width: 100%;
+      padding: 0 20px;
+    }
+  }
+</style>

+ 200 - 0
src/views/bpm/handleTask/components/salesServiceManagement/recycle/submit.vue

@@ -0,0 +1,200 @@
+<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"
+        @click="handleAudit(1)"
+        v-if="taskDefinitionKey != 'storemanApprove'"
+        >通过
+      </el-button>
+      <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        @click="storemanApprove"
+        v-if="taskDefinitionKey == 'storemanApprove'"
+        >申请入库
+      </el-button>
+      <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="approveTaskWithVariables(0)"
+        >驳回
+      </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
+        ></span>
+        <el-dropdown-menu slot="dropdown">
+          <el-dropdown-item command="cancel">作废</el-dropdown-item>
+        </el-dropdown-menu>
+      </el-dropdown>
+    </div>
+  </el-col>
+</template>
+
+<script>
+  import {
+    approveTaskWithVariables,
+    rejectTask,
+    cancelTask
+  } 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 {
+        form: {
+          technicianId: '',
+          reason: ''
+        },
+        activeComp: ''
+      };
+    },
+    async created() {},
+    methods: {
+      /** 处理转办审批人 */
+      handleUpdateAssignee() {
+        this.$emit('handleUpdateAssignee');
+      },
+      /** 退回 */
+      handleBackList() {
+        this.$emit('handleBackList');
+      },
+      async storemanApprove() {
+        let res = await this.getTableValue();
+        let storageData = res.returnStorageData;
+
+        if (!storageData) {
+          return;
+        }
+        // 入库来源isSkip 0-正常  1-外部(外部跳过内部审核流程)
+        storageData.isSkip = 1;
+
+        try {
+          this.isSaveLoading = true;
+          await storageApi.storage(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;
+          this.$message.error('保存失败');
+        }
+      },
+
+      async handleAudit(status) {
+        await this.approveTaskWithVariables(status);
+      },
+
+      async approveTaskWithVariables(status) {
+        let variables = {
+          pass: !!status
+        };
+        let API = !!status ? approveTaskWithVariables : rejectTask;
+        API({
+          id: this.taskId,
+          reason: this.form.reason,
+          variables
+        }).then((res) => {
+          if (res.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(() => {
+              cancelTask({
+                id: this.id,
+                taskId: this.taskId,
+                reason: this.form.reason,
+                businessId: this.businessId
+              })
+                .then(() => {
+                  this.$emit('handleClose');
+                })
+                .catch(() => {
+                  this.$message.error('流程作废失败');
+                });
+            })
+            .catch(() => {});
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss"></style>

+ 7 - 2
src/views/bpm/stockManagement/storage.vue

@@ -1673,7 +1673,8 @@
 
               let warehouseId = filtersItem.warehouseId;
               let warehouseName = filtersItem.warehouseName;
-              let measureQuantity = filtersItem.totalCount || 0;
+              let measureQuantity =
+                filtersItem.totalCountNew || filtersItem.totalCount || 0;
               // let measureQuantityOld = filtersItem.totalCount || 0;
               if (
                 (filtersItem.sendTotalWeight ||
@@ -1684,7 +1685,11 @@
                   filtersItem.sendTotalWeight || filtersItem.receiveTotalWeight;
               }
               let packingQuantity =
-                filtersItem.purchaseCount || filtersItem.totalCount || 0;
+                filtersItem.totalCountNew ||
+                filtersItem.purchaseCount ||
+                filtersItem.totalCount ||
+                0;
+                console.log(packingQuantity,'packingQudasdasdantity')
               let packingUnit =
                 filtersItem.purchaseUnit || filtersItem.measuringUnit || '';