huang_an 2 tahun lalu
induk
melakukan
ceca20c4c1
1 mengubah file dengan 0 tambahan dan 572 penghapusan
  1. 0 572
      src/views/warehouseManagement/outgoingManagement/newFile.js

+ 0 - 572
src/views/warehouseManagement/outgoingManagement/newFile.js

@@ -1,572 +0,0 @@
-import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
-import { getTreeByGroup } from '@/api/classifyManage';
-import { tableHeader } from '../common';
-
-export default (await import('vue')).defineComponent({
-  components: {
-    pickOrder,
-    selectUpload,
-    selectTree,
-    AssetsDialog,
-    WareHouseDailog,
-    upload,
-    detailSelect,
-    // TurnToAsset,
-    outputType,
-    eom
-  },
-  data() {
-    return {
-      llList: [],
-      codeList: [],
-      materialType,
-      warehousingType,
-      outputSceneState,
-      emergencyState,
-      saveLoading: false,
-      title: '',
-      tableData2: [],
-      uploadList: [],
-      fromUserList: [], //人员数组
-      warehousingMaterialList: [],
-      activeName: 'a',
-      treeList: [],
-      staffList: [],
-      formData: {
-        extInfo: {
-          assetType: '', //物品类型
-          deptCode: '', //部门code
-          deptName: '', //部门名称
-          verifyDeptCode: '', //审核部门编码
-          verifyDeptName: '', //审核部门名称
-          deliveryName: '', //送货人名称
-          deliveryPhone: '', //送货人电话
-          documentSource: '', //销售订单
-          urgent: '', //紧急状态
-          supplierId: '', //供应商ID
-          supplierName: '', //供应商名称
-          createUserName: '', //创建人名字
-          contentImage: [] //图片数组
-        },
-        fromUser: '', //送货人
-        bizType: '', //物品类型
-        verifyId: '', //审核人Id
-        verifyName: '', //审核人名称
-
-        createUserId: '',
-        remark: ''
-      },
-
-      rules: {
-        // 'extInfo.assetType': {
-        //   required: true,
-        //   message: '请选择出库产品类型',
-        //   trigger: 'change'
-        // },
-        bizType: {
-          required: true,
-          message: '请选择出库场景',
-          trigger: 'change'
-        },
-        fromUser: {
-          required: true,
-          message: '请选择领料人',
-          trigger: 'change'
-        }
-      },
-      options: [],
-      loading: false,
-      onSelectTableDataVal: []
-    };
-  },
-  computed: {
-    tableHeader() {
-      return tableHeader(this.formData.extInfo.assetType);
-    },
-    // 条码信息
-    materialCodeReqList() {
-      console.log(
-        '===',
-        this.warehousingMaterialList
-          .map((i) => i.warehouseLedgerDetails || [])
-          .flat()
-      );
-      return this.warehousingMaterialList
-        .map((i) => i.warehouseLedgerDetails || [])
-        .flat();
-    }
-  },
-  created() {
-    this.initData();
-  },
-  methods: {
-    eomSuccess(row) {
-      this.formData.documentSource = row.orderNo;
-      console.log(row);
-      this.onSelectTableData(row.tableData, 1);
-      this.$forceUpdate();
-    },
-    pickOrderRow(row) {
-      row.tableData = [];
-      this.formData.documentSource = row.code;
-      for (const key in row.orderInfoList) {
-        if (row.orderInfoList[key].bomDetailDTOS.length != 0) {
-          for (const i in row.orderInfoList[key].bomDetailDTOS) {
-            row.tableData.push({
-              ...row.orderInfoList[key].bomDetailDTOS[i],
-              code: row.orderInfoList[key].bomDetailDTOS[i].categoryCode,
-              name: row.orderInfoList[key].bomDetailDTOS[i].categoryName,
-              modelType: row.orderInfoList[key].bomDetailDTOS[i].model,
-              id: row.orderInfoList[key].bomDetailDTOS[i].categoryId
-            });
-          }
-        }
-        if (row.orderInfoList[key].instanceList.length != 0) {
-          for (const j in row.orderInfoList[key].instanceList) {
-            row.tableData.push({
-              ...row.orderInfoList[key].instanceList[j],
-              code: row.orderInfoList[key].instanceList[j].categoryCode,
-              name: row.orderInfoList[key].instanceList[j].categoryName,
-              modelType: row.orderInfoList[key].instanceList[j].model,
-              id: row.orderInfoList[key].instanceList[j].categoryId
-            });
-          }
-        }
-      }
-
-      const uniqueItems = [];
-      const uniqueIds = new Set();
-      row.tableData.forEach((item) => {
-        if (!uniqueIds.has(item.code)) {
-          uniqueIds.add(item.code);
-          uniqueItems.push(item);
-        }
-      });
-      row.tableData = uniqueItems;
-      console.log(row);
-      this.onSelectTableData(row.tableData, 1);
-      this.$forceUpdate();
-    },
-    handleEom() {
-      this.$refs.eomRef.open();
-    },
-    handlePickorder() {
-      this.$refs.pickOrderRef.open();
-    },
-    async handleDocumentSourceChange() {
-      if (!this.formData.documentSource) {
-        if (this.formData.bizType == 4) {
-          this.warehousingMaterialList = [];
-        }
-        return;
-      }
-
-      if (
-        !(this.formData.extInfo.assetType == 7 && this.formData.bizType == 4)
-      ) {
-        return;
-      }
-
-      const loading = this.$loading({ fullscreen: true });
-
-      const res = await getSparePartsInfo({
-        code: this.formData.documentSource
-      });
-      if (res?.success && res.data.length) {
-        const curMap = {
-          assetId: 'classificationId',
-          assetCode: 'informationCode', //编码
-          assetName: 'informationName', //名称
-          materialId: 'classificationId',
-          materialName: 'informationName',
-          batchNo: '', //批次号
-          unit: 'measuringUnit', //单位
-          minPackUnit: 'packingUnit' //最小包装单位
-        };
-
-        res.data.forEach((item) => {
-          let obj = {};
-          for (const key in curMap) {
-            obj[key] = curMap[key] ? item[curMap[key]] : '';
-          }
-          obj.curId =
-            obj.assetCode +
-            (obj.measurementUnit || '') +
-            (obj.minPackUnit || '') +
-            (obj.unit || '');
-          console.log(obj.curId);
-          const index = this.warehousingMaterialList.findIndex(
-            (i) => i.curId === obj.curId
-          );
-          if (index === -1) {
-            Object.assign(obj, item);
-            obj.sparePartsNum = item.num;
-
-            this.warehousingMaterialList.push(obj);
-          } else {
-            this.warehousingMaterialList[index].sparePartsNum = item.num;
-          }
-        });
-      }
-
-      loading.close();
-    },
-    // 备品备件来源单号
-    async remoteMethod(code) {
-      // if (code !== '') {
-      //   this.loading = true
-      const res = await getDocumentSource({ code });
-      if (res?.success) {
-        this.options = res.data;
-      }
-      //   this.loading = false
-      // } else {
-      //   this.options = []
-      // }
-    },
-    rowClass({ row, column, rowIndex, columnIndex }) {
-      if (rowIndex === 1) {
-        return {
-          display: 'none',
-          background: '#EEEEEE',
-          border: 'none'
-        };
-      }
-
-      return { background: '#EEEEEE', border: 'none' };
-    },
-    // 部门 点击事件
-    async auditorDeptClick(data) {
-      console.log(data);
-      this.formData.extInfo.verifyDeptCode = data?.id;
-      this.formData.extInfo.verifyDeptName = data?.name;
-      this.formData.verifyId = '';
-      this.formData.verifyName = '';
-
-      this.$refs.formName.validateField('verifyDeptName');
-      if (data) {
-        this.getStaffList(data);
-      }
-    },
-
-    async getStaffList(data) {
-      let res = await warehouseDefinition.getUserPage({
-        groupId: data.id,
-        size: 9999,
-        page: 1
-      });
-      this.staffList = res.list;
-    },
-    // // 转资产
-    // turnToAssets (row) {
-    //   this.$refs.turnToAssetRef
-    //     .open(row.transferCurVal)
-    //     .then(({ code, name }) => {
-    //       row.transferType = name
-    //       row.materialId = code
-    //       row.materialName = name.split('/').pop()
-    //       row.transferType = name
-    //       this.$set(row, 'transferCurVal', code)
-    //     })
-    // },
-    handleSetting(row) {
-      this.$refs.detailSelectRef
-        .open(row, row.warehouseLedgerDetails || [])
-        .then((res) => {
-          console.log(res);
-          console.log(row);
-          this.$set(
-            row,
-            'warehouseLedgerDetails',
-            (res || []).map((item) => {
-              delete item.updateTime;
-              delete item.createTime;
-              this.$set(item, 'isTransferAsset', false);
-              item.isUnpack = row.isUnpack;
-              return item;
-            })
-          );
-          this.$set(row, 'outInNum', res.length);
-          this.$set(row, 'minPackUnit', res[0].minPackUnit);
-          this.$set(
-            row,
-            'selfSum',
-            row.warehouseLedgerDetails.reduce((sum, pre) => {
-              if (row.isUnpack) {
-                return ++sum;
-              }
-              return sum + pre.measurementUnit;
-            }, 0)
-          );
-        });
-    },
-
-    // 仓库编辑
-    handleWareHouse(row) {
-      this.$refs.wareHouseDailogRef.open(row);
-    },
-    // 出库操作
-    listEdit(row) {
-      this.$set(row, 'isSave', false);
-    },
-
-    //出库明细删除
-    listDel(row, index) {
-      this.warehousingMaterialList.splice(index, 1);
-      if (this.warehousingMaterialList.length == 0) {
-        this.formData.documentSource = '';
-      }
-    },
-    // 出库明细生成条码信息
-    async createMaterialCode(row) {
-      let arr = [];
-      const res = await getAssetNum({
-        assetCode: row.assetCode,
-        num: row.outInNum || 1
-      });
-      if (res?.success) {
-        delete row.createTime;
-        arr = Array.from(new Array(res.data.length), (val, idx) => ({
-          ...row,
-          num: res.data[idx],
-          bizStatus: 2,
-          isTransferAsset: false
-        }));
-      }
-      return arr;
-    },
-
-    handleSave() {
-      this.$refs.formName.validate(async (valid) => {
-        if (valid) {
-          if (!this.warehousingMaterialList?.length) {
-            return this.$message.error('请添加出库明细!');
-          } else if (
-            this.warehousingMaterialList.some(
-              (item) => !item.warehouseLedgerDetails?.length
-            )
-          ) {
-            return this.$message.error('请完善出库明细数据!');
-          }
-          console.log('qqqq===>', this.warehousingMaterialList);
-          let arr = this.warehousingMaterialList.map((item) => {
-            return {
-              batchNo: item.batchNo,
-              categoryId: item.id,
-              count: item.outInNum,
-              num: item.outInNum,
-              minPackingCount: item.selfSum,
-              packingCount: item.outInNum,
-              outInDetailRecordAddPOList: item.warehouseLedgerDetails,
-              ...item
-            };
-          });
-          arr.forEach((item) => {
-            delete item.id;
-            delete item.warehouseLedgerDetails;
-            if (item.outInDetailRecordAddPOList.length > 0) {
-              let list = item.outInDetailRecordAddPOList.map((it) => {
-                return {
-                  positionId: it.positionId,
-                  code: it.sourceBizNo,
-                  dateType: it.dateType,
-                  dateValue: it.dateValue,
-                  minUnit: it.minUnit,
-                  batchNo: it.sourceBatchNo,
-                  position: it.pathName,
-                  // minPositionId: it.cargoSpaceId,
-                  minPositionId: it.minPositionId,
-                  name: it.name,
-                  pathIds: it.pathIds,
-                  unit: it.unit,
-                  packageNo: it.num
-                  // num: it.minPackingCount
-                };
-              });
-              item.outInDetailRecordAddPOList = list;
-            }
-          });
-          let obj = { ...this.formData, type: 2 };
-          for (const key in arr) {
-            arr[key].count = arr[key].outInNum;
-          }
-          obj.outInDetailAddPOList = arr;
-
-          this.saveLoading = true;
-
-          // console.log('明细', this.warehousingMaterialList);
-          // const categoryLevelId = this.$refs.assetsDialogRef.materialType;
-          // let newObj = {
-          //   inOutAddPO: {
-          //     ...this.formData,
-          //     ...this.formData.extInfo,
-          //     bizStatus: 2
-          //   },
-          //   warehouseLedgerInfos: this.handelArr(
-          //     this.warehousingMaterialList,
-          //     categoryLevelId
-          //   )
-          // };
-          // delete newObj.inOutAddPO.extInfo;
-          console.log('2222', obj);
-
-          // const res = await outin.save(obj);
-          // if (res.code == 0) {
-          //   this.$message.success('保存成功!');
-          // }
-          // this.saveLoading = false;
-          // this.$router.push('/warehouseManagement/outgoingManagement');
-          // if (res?.success) {
-          //   this.$message.success('保存成功!');
-          //   this.$router.go(-1);
-          // }
-        }
-      });
-    },
-    handelArr(arr, id) {
-      for (const key in arr) {
-        arr[key].inLedgerId = arr[key].id;
-        arr[key].categoryLevelId = id;
-        for (const k in arr[key].warehouseLedgerDetails) {
-          arr[key].warehouseLedgerDetails[k].ledgerDetailId =
-            arr[key].warehouseLedgerDetails[k].id;
-          arr[key].warehouseLedgerDetails[k].inDetailId = arr[key].inLedgerId;
-
-          arr[key].warehouseLedgerDetails[k].isTransferAsset = arr[key]
-            .warehouseLedgerDetails[k].isTransferAsset
-            ? 1
-            : 0;
-          arr[key].warehouseLedgerDetails[k].bizStatus = 2;
-        }
-      }
-      return arr;
-      // let newArr = arr.map((item) => {
-      //   return { ...item, ledgerId: item.id };
-      // });
-      // newArr.map((item) => {
-      //   item.warehouseLedgerDetails.map((ite) => {
-      //     return { ...ite, ledgerDetailId: ite.id, ledgerId: item.id };
-      //   });
-      // });
-      // return newArr;
-    },
-    //添加明细
-    onSelectTableData(val, e) {
-      // if (e == 1) {
-      //   this.llList = val;
-      // } else {
-      //   this.llList = [];
-      // }
-      // .concat(this.llList)
-      // if (this.warehousingMaterialList.length != 0) {
-      //   val = this.warehousingMaterialList.concat(val);
-      // }
-      this.onSelectTableDataVal = val;
-      this.warehousingMaterialList = val.map((next) => {
-        delete next.updateTime;
-        delete next.createTime;
-
-        return {
-          ...next,
-          realInventoryAmount: 0,
-          // cargoSpaceCode: '', //货位编码
-          // cargoSpaceId: '', //货位id
-          // shelfId: '', //货架id
-          // shelfCode: '', //货架名称
-          // areaId: '', //库区id
-          // areaName: '', //库区名称
-          // warehouseId: '', //仓库id
-          // warehouseName: '', //仓库名称
-          assetType: this.formData.extInfo.assetType,
-          outInNum: '',
-          assetCode: next.code,
-          assetName: next.name,
-          bizStatus: 2,
-          contactCode: next.contactCode
-        };
-      });
-      console.log('sasasasa===>>>', this.warehousingMaterialList);
-    },
-    codeListValue(val) {
-      console.log(val);
-      this.formData.extInfo.assetType = val.id;
-      this.$forceUpdate();
-      this.title = val?.name;
-      this.selectEquiType = val?.id;
-      console.log(this.title);
-    },
-    async initData() {
-      const { data } = await getTreeByGroup({ type: 1 });
-      this.codeList = data;
-      const res = await warehouseDefinition.tree();
-      this.treeList = this.$util.toTreeData({
-        data: res,
-        idField: 'id',
-        parentIdField: 'parentId'
-      });
-
-      let res22 = await warehouseDefinition.getUserPage({
-        size: -1,
-        page: 1
-      });
-      this.fromUserList = res22.list;
-
-      // /
-      // const res111 = await warehouseDefinition.list();
-      // this.warehouseList = res111.list;
-      const info = JSON.parse(localStorage.getItem('info'));
-      let obj = res.find((item) => item.id === info.deptId);
-      this.formData.extInfo.deptName = obj.name;
-      this.formData.extInfo.deptCode = obj.id;
-      this.formData.extInfo.createUserName = info.name;
-      this.formData.createUserId = info.id;
-    },
-    addStock() {
-      if (!this.title) return this.$message.error('请选择出库产品类型');
-      if (!this.formData.bizType && this.formData.bizType !== 0)
-        return this.$message.error('请选择出库场景');
-
-      if (this.formData.bizType == 4 && !this.formData.documentSource) {
-        return this.$message.error('请选择来源单据');
-      }
-
-      this.$refs.assetsDialogRef.open();
-    },
-    handleChange(data) {
-      this.title = data?.dictValue;
-      if (this.formData.bizType == 4) {
-        this.formData.documentSource = '';
-      }
-    },
-    handleChanges(code) {
-      const data = this.codeList.find((item) => item.dictCode == code);
-      this.title = data?.dictValue;
-      this.selectEquiType = data?.dictCode;
-      if (this.formData.bizType == 4) {
-        this.formData.documentSource = '';
-      }
-    },
-    handleBizSceneChange() {
-      if (this.formData.extInfo.assetType == 7) {
-        this.formData.extInfo.documentSource = '';
-      }
-    },
-    getSupplier() {
-      return new Promise((resolve, reject) => {
-        supplier.list({ page: 1, size: 999 }).then((res) => {
-          if (res.success) {
-            resolve(res);
-          }
-        });
-      });
-    },
-    upload(data) {
-      this.formData.contentImage = data;
-      this.$refs.formName.validateField('contentImage');
-    },
-    deptClick(data) {
-      this.formData.deptName = data?.name;
-      this.formData.deptCode = data?.code;
-    }
-  }
-});