Переглянути джерело

Merge branch 'master' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-wt into dengfei

695593266@qq.com 8 місяців тому
батько
коміт
0380033537

+ 59 - 0
src/api/bpm/components/salesServiceManagement/return.js

@@ -0,0 +1,59 @@
+import request from '@/utils/request';
+import { download } from '@/utils/file';
+
+//列表---------------------------------------------------------------
+export async function getPage(data) {
+  const res = await request.get('/eom/aftersalessparepartsreturnapply/page', {
+    params: data
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//新增
+export async function save(data) {
+  const res = await request.post(
+    '/eom/aftersalessparepartsreturnapply/save',
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//根据id查询详情
+export async function getById(id) {
+  const res = await request.get(
+    `/eom/aftersalessparepartsreturnapply/getById/${id}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//修改
+export async function update(data) {
+  const res = await request.put(
+    '/eom/aftersalessparepartsreturnapply/update',
+    data
+  );
+  if (res.data.code === '0') {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//删除
+export async function deleteList(data) {
+  const res = await request.delete(
+    '/eom/aftersalessparepartsreturnapply/delete',
+    {
+      data
+    }
+  );
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 56 - 25
src/views/bpm/handleTask/components/saleOrder/returnGoods/submit.vue

@@ -23,7 +23,7 @@
         type="success"
         size="mini"
         @click="handleAudit(1)"
-        v-if="outInData.verifyStatus==2"
+        v-if="outInData.verifyStatus == 2"
         >通过
       </el-button>
       <el-button
@@ -33,7 +33,8 @@
         @click="storemanApprove"
         v-if="
           ['storemanApprove'].includes(taskDefinitionKey) &&
-          activeComp == 'main'&&[0,3].includes(outInData.verifyStatus)
+          activeComp == 'main' &&
+          [0, 3].includes(outInData.verifyStatus)
         "
         >申请出库
       </el-button>
@@ -42,11 +43,19 @@
         type="danger"
         size="mini"
         @click="handleAudit(0)"
-        v-if="!['starter'].includes(taskDefinitionKey)&&outInData.verifyStatus!=1"
+        v-if="
+          !['starter'].includes(taskDefinitionKey) &&
+          outInData.verifyStatus != 1
+        "
         >驳回
       </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
+        @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>
@@ -84,9 +93,13 @@
     UpdateReturnInformation,
     getWarehouseListByIds,
     approve,
-    saleReturnProcessCancel,
+    saleReturnProcessCancel
   } from '@/api/bpm/components/saleManage/saleorder';
-  import { approveTaskWithVariables,rejectTask,cancelTask } from '@/api/bpm/task';
+  import {
+    approveTaskWithVariables,
+    rejectTask,
+    cancelTask
+  } from '@/api/bpm/task';
   import { listAllUserBind } from '@/api/system/organization';
 
   // 流程实例的详情页,可用于审批
@@ -119,8 +132,8 @@
           reason: ''
         },
         userOptions: [],
-        activeComp:'',
-        outInData:{verifyStatus:2},
+        activeComp: '',
+        outInData: { verifyStatus: 2 }
       };
     },
     async created() {
@@ -133,7 +146,7 @@
         try {
           this.outInData = await getOutInBySourceBizNo(data.orderNo);
         } catch (error) {}
-          this.outInData.verifyStatus=0
+        this.outInData.verifyStatus = 0;
       }
     },
     methods: {
@@ -192,6 +205,21 @@
       activeCompChange(activeComp) {
         this.activeComp = activeComp;
       },
+      rejectTask(status) {
+        rejectTask({
+          id: this.taskId,
+          reason: this.form.reason,
+
+          returnType
+        }).then((res) => {
+          if (res.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: status === 0 ? '驳回' : ''
+            });
+          }
+        });
+      },
       async approveTaskWithVariables(status, returnType) {
         let API = !!status ? approve : rejectTask;
         approve({
@@ -220,25 +248,28 @@
       //更多
       handleCommand(command) {
         if (command === 'cancel') {
-          this.$confirm("是否确认作废?", {
+          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(() => {});
+          })
+            .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>

+ 259 - 0
src/views/bpm/handleTask/components/salesServiceManagement/return/recycleDialog.vue

@@ -0,0 +1,259 @@
+<template>
+  <div>
+    <el-form ref="recyleFormRef" :model="form" label-width="100px">
+      <headerTitle title="基本信息" style="margin-top: 15px"></headerTitle>
+      <el-row>
+        <el-col :span="12">
+          <el-form-item label="编码:" prop="code">
+            <el-input v-model="form.code" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item
+            label="名称:"
+            prop="name"
+            :rules="{
+              required: true,
+              message: '请输入名称',
+              trigger: 'change'
+            }"
+          >
+            <el-input v-model="form.name" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item
+            label="配件申请单:"
+            prop="sparePartsApplyCode"
+            :rules="{
+              required: true,
+              message: '请选择配件申请单',
+              trigger: 'change'
+            }"
+          >
+            <el-input
+              v-model="form.sparePartsApplyCode"
+              disabled
+              placeholder="请选择"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="备注:" prop="remark">
+            <el-input
+              v-model="form.remark"
+              disabled
+              type="textarea"
+              placeholder="请输入"
+            />
+          </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"
+      :detailList="
+        form.detailList
+          .filter((item) => item.packageId)
+          .map((item) => {
+            item.productCode = item.categoryCode;
+            item.quantity = item.measureQuantity;
+            return item;
+          })
+      "
+      :saleProductList="
+        form.detailList
+          .filter((item) => !item.packageId)
+          .map((item) => {
+            item.productCode = item.categoryCode;
+            item.quantity = item.measureQuantity;
+            return item;
+          })
+      "
+      :bizType="3"
+      :isMoreProduct="true"
+    ></add>
+    <detailDialog :businessId="form.code" v-if="isView&&form.code"></detailDialog>
+  </div>
+</template>
+
+<script>
+  import { getById } from '@/api/bpm/components/salesServiceManagement/return';
+  import add from '@/views/bpm/stockManagement/storage.vue';
+  import detailDialog from '@/views/bpm/stockManagement/details.vue';
+
+  const defForm = {
+    code: '',
+    name: '',
+    sparePartsApplyId: '',
+    sparePartsApplyCode: '',
+    workOrderId: '',
+    remark: '',
+    detailList: []
+  };
+
+  export default {
+    components: {
+      add,
+      detailDialog
+    },
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      },
+      isView: ''
+    },
+
+    data() {
+      return {
+        loading: false,
+
+        form: {
+          ...defForm
+        },
+        columns: [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            fixed: 'left'
+          },
+
+          {
+            minWidth: 160,
+            prop: 'categoryCode',
+            label: '编码',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            minWidth: 120,
+            prop: 'categoryName',
+            label: '名称',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+
+          {
+            minWidth: 160,
+            prop: 'batchNo',
+            label: '批次号',
+            showOverflowTooltip: true,
+            slot: 'batchNo',
+            align: 'center'
+          },
+          {
+            minWidth: 150,
+            prop: 'measureQuantity',
+            slot: 'measureQuantity',
+            label: '归还数量',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            minWidth: 150,
+            prop: 'measureUnit',
+            label: '计量单位',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            minWidth: 160,
+            prop: 'sendCode',
+            label: '发货条码',
+            showOverflowTooltip: true,
+            slot: 'barcodes',
+            align: 'center'
+          },
+
+          {
+            minWidth: 160,
+            prop: 'packageNo',
+            align: 'center',
+            label: '包装编码',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 160,
+            prop: 'categoryModel',
+            align: 'center',
+            label: '型号',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 160,
+            prop: 'specification',
+            align: 'center',
+            label: '规格',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 160,
+            prop: 'brandNum',
+            align: 'center',
+            label: '牌号',
+            showOverflowTooltip: true
+          }
+        ]
+      };
+    },
+    mounted() {
+      this.getDetail();
+    },
+
+    methods: {
+      async getDetail() {
+        this.form = await getById(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/return/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>

+ 32 - 19
src/views/bpm/stockManagement/storage.vue

@@ -120,6 +120,18 @@
               ></el-input>
             </el-form-item>
           </el-col>
+          <el-col :span="6">
+            <el-form-item label="生产要求" prop="productionRequirements">
+              <el-input
+                v-model="formData.productionRequirements"
+                clearable
+                type="textarea"
+                placeholder=""
+                :rows="1"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col>
         </el-row>
       </el-form>
       <div class="inbound_details">
@@ -1480,8 +1492,8 @@
         // this.formData.extInfo.deliveryPhone = this.$store.state.user.info.phone;
         // this.formData.createUserId = this.$store.state.user.info.userId;
         // this.formData.extInfo.deptName = this.$store.state.user.info.deptName;
-
-         // 入库登记人
+      
+           // 入库登记人
         // const startUser = this.processInstance?.startUser || {};
         const userInfo = this.$store.state.user.info || {};
 
@@ -1492,9 +1504,8 @@
         this.formData.createUserId = this.form.createUserId || userInfo.userId || '';
         this.formData.createUserName = this.form.createUserName || userInfo.name || '';
         this.formData.extInfo.deptName = this.form.deptName || userInfo.deptName || '';
-        this.formData.approvalUserName = this.form.approvalUserName || '';
-        this.formData.approvalUserId = this.form.approvalUserId || '';
-
+        this.formData.approvalUserName = this.form.approvalUserName ||userInfo.name;
+        this.formData.approvalUserId = this.form.approvalUserId || userInfo.userId;
         // this.formData.extInfo.supplierName = this.form.supplierName;
         // this.formData.extInfo.supplierId = this.form.supplierId;
         console.log('saleProductList-------------------', this.saleProductList);
@@ -1845,11 +1856,7 @@
               }
               let packingUnit = item.packingUnit;
               let singleWeight = item.singleWeight || 0; // 单重重量
-              console.log(
-                this.isMoreProduct,
-                this.detailList,
-                'this.isMoreProduct'
-              );
+
               return {
                 index: this.productList.length + index,
                 isSave: true,
@@ -1860,7 +1867,7 @@
                 specification: item.specification, // 规格
                 brandNum: item.brandNum, // 牌号
                 batchNo:
-                  this.bizType == 1
+                  this.bizType == 1 || this.bizType == 3
                     ? this.detailList[0]?.batchNo || batchNo
                     : batchNo, // 批次号
                 supplierListOptions: supplierList[item.id], // 供应商列表
@@ -1890,8 +1897,8 @@
                 measureUnit: item.measuringUnit, // 计量单位
                 measureType: item.measureType, // 计量方式
                 netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
-                weight: weight, // 重量
-                singleWeight: singleWeight,
+                weight: weight || 0, // 重量
+                singleWeight: singleWeight || 0,
                 weightUnit: item.weightUnit, // 重量单位
                 totalMoney: item.totalPrice, // 总价
                 unitPrice: item.unitPrice, // 单价
@@ -2057,13 +2064,13 @@
                   packingCodeList[index]?.onlyCode, // 包装编码
                 packingQuantity: 1, // 包装数量
                 packingUnit: item.packingUnit, // 单位
-                measureQuantity: item.quantity, // 计量数量
-                measureUnit: item.measuringUnit, // 计量单位
+                measureQuantity: item.quantity || item.measureQuantity, // 计量数量
+                measureUnit: item.measuringUnit || item.measureUnit, // 计量单位
                 supplierCode: item.supplierCode,
                 supplierId: item.supplierId,
                 supplierName: item.supplierName,
-                weight: item.packingWeight, // 重量
-                singleWeight: item.singleWeight,
+                weight: item.packingWeight || 0, // 重量
+                singleWeight: item.singleWeight || 0,
                 pricingWay: item.pricingWay,
                 weightUnit: item.weightUnit || this.productList[0].weightUnit, // 重量单位
                 packingSpecificationOption: this.isMoreProduct
@@ -2532,11 +2539,17 @@
           },
           0
         );
-        this.$set(this.productList[productIndex], 'weight', totalWeight);
+
+        if (totalWeight != 'NaN') {
+          this.$set(this.productList[productIndex], 'weight', totalWeight);
+        } else {
+          this.$set(this.productList[productIndex], 'weight', 0);
+        }
+
         this.$set(
           this.productList[productIndex],
           'singleWeight',
-          totalWeight / this.productList[productIndex].measureQuantity
+          totalWeight / this.productList[productIndex].measureQuantity || 0
         );
         // 修改拆分物料
         // this.materialList.map((item, index) => {