浏览代码

bug解决

cz 2 年之前
父节点
当前提交
eb9d7064b2

+ 1 - 0
package.json

@@ -38,6 +38,7 @@
     "js-cookie": "3.0.1",
     "jsencrypt": "3.3.1",
     "jspdf": "^2.5.1",
+    "lossless-json": "^2.0.8",
     "moment": "^2.29.4",
     "nprogress": "0.2.0",
     "pinia": "2.0.22",

+ 6 - 1
src/views/WDLY/basic/product/index.vue

@@ -288,6 +288,8 @@ import byForm from "@/components/byForm/index";
 import treeList from "@/components/product/treeList";
 import SelectProduct from "@/components/WDLY/product/SelectProduct";
 import useUserStore from "@/store/modules/user";
+// 引入插件解决json.parse()会导致id值错误
+import { parse, stringify } from "lossless-json";
 
 import { computed, defineComponent, ref } from "vue";
 let openProduct = ref(false);
@@ -309,7 +311,7 @@ const sourceList = ref({
 let dialogVisible = ref(false);
 let openExcelDialog = ref(false);
 let moveDept = ref(false);
-
+const deptIdCopy = ref("");
 let modalType = ref("add");
 let rules = ref({
   productClassifyId: [
@@ -749,6 +751,7 @@ const submitForm = () => {
         type: "info",
       });
     }
+    jsonObj.deptId = deptIdCopy.value;
     formData.data.victoriatouristJson = jsonObj;
     jsonObj.productCombinationList = list;
     jsonObj.combination = formData.data.combination;
@@ -807,6 +810,7 @@ const getDept = () => {
 const getDtl = (row) => {
   modalType.value = "edit";
   proxy.post("/productInfo/detail", { id: row.id }).then((res) => {
+    deptIdCopy.value = parse(res.victoriatouristJson).deptId.value;
     fileList.value = row.fileList.map((x) => ({ ...x, url: x.fileUrl }));
     fileListCopy.value = [...fileList.value];
     res.type = res.type + ""; //type回显
@@ -814,6 +818,7 @@ const getDtl = (row) => {
     res.victoriatouristJson = res.victoriatouristJson
       ? JSON.parse(res.victoriatouristJson)
       : {};
+    // res.victoriatouristJson.deptId =
     res.combination = res.victoriatouristJson.combination
       ? res.victoriatouristJson.combination + ""
       : "0";

+ 0 - 1
src/views/WDLY/outInBound/transfer/index.vue

@@ -570,7 +570,6 @@ const clickAdd = () => {
 };
 
 const select = (x) => {
-  console.log(x, "ass");
   if (
     formData.data.stockTransferDetailsList &&
     formData.data.stockTransferDetailsList.length > 0

+ 311 - 113
src/views/WDLY/outInBound/waitOutBound/index.vue

@@ -34,6 +34,96 @@
         :rules="rules"
         ref="byform"
       >
+        <template #products>
+          <div style="width: 100%">
+            <el-button
+              type="primary"
+              @click="clickAdd()"
+              style="margin-bottom: 10px"
+              v-if="modalType == 'add'"
+            >
+              添加物品
+            </el-button>
+            <el-table :data="formData.data.stockTransferDetailsList">
+              <el-table-column prop="productCode" label="物品编码" />
+              <el-table-column prop="productName" label="物品名称" />
+              <el-table-column prop="productSpec" label="规格型号" />
+              <el-table-column
+                prop="outQuantity"
+                label="调仓数量"
+                v-if="modalType == 'detail'"
+              />
+              <el-table-column
+                prop="inQuantity"
+                label="接收数量"
+                v-if="modalType == 'detail'"
+              />
+
+              <el-table-column
+                prop="outQuantity"
+                label="调仓数量"
+                v-if="modalType == 'edit'"
+              />
+              <el-table-column
+                prop="outQuantity"
+                label="调仓数量"
+                min-width="150"
+                v-if="modalType == 'add'"
+              >
+                <template #default="{ row, $index }">
+                  <el-form-item
+                    :prop="
+                      'stockTransferDetailsList.' + $index + '.outQuantity'
+                    "
+                    :rules="rules.outQuantity"
+                    :inline-message="true"
+                  >
+                    <el-input-number
+                      v-model="row.outQuantity"
+                      :precision="2"
+                      :controls="false"
+                      :min="0"
+                    />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="inQuantity"
+                label="接收数量"
+                min-width="150"
+                v-if="modalType == 'edit'"
+              >
+                <template #default="{ row, $index }">
+                  <el-form-item
+                    :prop="'stockTransferDetailsList.' + $index + '.inQuantity'"
+                    :rules="rules.inQuantity"
+                    :inline-message="true"
+                  >
+                    <el-input-number
+                      v-model="row.inQuantity"
+                      :precision="2"
+                      :controls="false"
+                      :min="0"
+                    />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+
+              <el-table-column
+                prop="zip"
+                label="操作"
+                width="100"
+                v-if="modalType == 'add'"
+              >
+                <template #default="{ $index }">
+                  <el-button type="primary" link @click="handleRemove($index)"
+                    >删除</el-button
+                  >
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </template>
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
@@ -47,16 +137,34 @@
         </el-button>
       </template>
     </el-dialog>
+    <el-dialog
+      v-model="openProduct"
+      title="选择产品"
+      width="70%"
+      append-to-body
+    >
+      <InventoryInquiry
+        :selectStatus="true"
+        :warehouseId="formData.data.outWarehouseId"
+        @cancel="openProduct = false"
+        @select="select"
+        :key="formData.data.outWarehouseId"
+      ></InventoryInquiry>
+
+      <!-- <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="openProduct = false">取消</el-button>
+        </span>
+      </template> -->
+    </el-dialog>
   </div>
 </template>
   
 <script setup>
-/* eslint-disable vue/no-unused-components */
 import { ElMessage, ElMessageBox } from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
-import { computed, defineComponent, ref } from "vue";
-import useUserStore from "@/store/modules/user";
+import InventoryInquiry from "@/views/purchaseSales/outAndInWarehouse/inventoryInquiry/index";
 
 const loading = ref(false);
 const submitLoading = ref(false);
@@ -66,11 +174,11 @@ const sourceList = ref({
     total: 3,
     pageNum: 1,
     pageSize: 10,
-    type: 1,
+    type: "2",
   },
 });
+let openProduct = ref(false);
 let dialogVisible = ref(false);
-let roomDialogVisible = ref(false);
 let modalType = ref("add");
 let rules = ref({
   type: [
@@ -94,13 +202,13 @@ const selectConfig = reactive([
     data: [],
   },
 ]);
-const inboundType = ref([
+const outboundType = ref([
   {
-    label: "未库",
+    label: "未库",
     value: "0",
   },
   {
-    label: "部分库",
+    label: "部分库",
     value: "1",
   },
   {
@@ -116,50 +224,56 @@ const config = computed(() => {
         prop: "businessType",
       },
       render(type) {
-        return businessType.find((x) => x.value == type).label;
+        const current = businessType.find((x) => x.value == type);
+        if (current) {
+          return current.label;
+        }
       },
     },
     {
       attrs: {
         label: "单号",
-        prop: "code",
+        prop: "businessCode",
       },
     },
 
     {
       attrs: {
         label: "物品类型",
-        prop: "logisticsCompanyName",
+        prop: "productDefinition",
+      },
+      render(definition) {
+        return definition == 1 ? "产品" : definition == 2 ? "物料" : "";
       },
     },
     {
       attrs: {
         label: "物品编码",
-        prop: "receiptWarehouseName",
+        prop: "productCode",
       },
     },
     {
       attrs: {
         label: "物品名称",
-        prop: "operatorName",
+        prop: "productName",
       },
     },
     {
       attrs: {
         label: "型号规格",
-        prop: "createTime",
+        prop: "productSpec",
       },
     },
     {
       attrs: {
         label: "单位",
-        prop: "createTime",
+        prop: "productUnit",
       },
     },
     {
       attrs: {
         label: "待出库",
-        prop: "createTime",
+        prop: "quantity",
       },
     },
     {
@@ -168,7 +282,7 @@ const config = computed(() => {
         prop: "status",
       },
       render(status) {
-        return status == 0 ? "未入库" : status == 1 ? "部分入库" : "";
+        return status == 0 ? "未出库" : status == 1 ? "部分出库" : "";
       },
     },
     {
@@ -189,7 +303,7 @@ const config = computed(() => {
             },
             el: "button",
             click() {
-              getDtl(row);
+              outBound(row);
             },
           },
         ];
@@ -197,10 +311,8 @@ const config = computed(() => {
     },
   ];
 });
-
 let formData = reactive({
   data: {},
-  treeData: [],
 });
 const formOption = reactive({
   inline: true,
@@ -209,84 +321,119 @@ const formOption = reactive({
   rules: [],
 });
 const byform = ref(null);
-const treeData = ref([]);
-const formConfig = reactive([
-  {
-    type: "title",
-    title: "待出库信息",
-  },
-  {
-    type: "select",
-    prop: "businessType",
-    label: "数据来源",
-    required: true,
-    disabled: true,
-    itemWidth: 100,
-    data: [],
-  },
-  {
-    type: "input",
-    prop: "businessType",
-    label: "单号",
-    required: true,
-    disabled: true,
-    itemWidth: 100,
-    data: [],
-  },
-  {
-    type: "input",
-    prop: "businessType",
-    label: "物品名称",
-    required: true,
-    disabled: true,
-    itemWidth: 100,
-    data: [],
-  },
-  {
-    type: "input",
-    prop: "businessType",
-    label: "待出库数量",
-    required: true,
-    disabled: true,
-    itemWidth: 40,
-    data: [],
-  },
-  {
-    type: "title",
-    title: "本次出库",
-  },
-  {
-    type: "select",
-    prop: "warehouseId",
-    label: "仓库名称",
-    itemWidth: 100,
-    isLoad: {
-      url: "/warehouse/page",
-      req: {
-        pageNum: 1,
-        pageSize: 9999,
+let formConfig = ref([]);
+const configData = [
+  [
+    {
+      type: "title",
+      title: "待出库信息",
+    },
+    {
+      type: "select",
+      prop: "businessType",
+      label: "数据来源",
+      required: true,
+      disabled: true,
+      itemWidth: 100,
+      data: [],
+    },
+    {
+      type: "input",
+      prop: "businessType",
+      label: "单号",
+      required: true,
+      disabled: true,
+      itemWidth: 100,
+    },
+    {
+      type: "input",
+      prop: "businessType",
+      label: "物品名称",
+      required: true,
+      disabled: true,
+      itemWidth: 100,
+    },
+    {
+      type: "input",
+      prop: "businessType",
+      label: "待出库数量",
+      required: true,
+      disabled: true,
+      itemWidth: 40,
+    },
+    {
+      type: "title",
+      title: "本次出库",
+    },
+    {
+      type: "select",
+      prop: "warehouseId",
+      label: "仓库名称",
+      itemWidth: 100,
+      isLoad: {
+        url: "/warehouse/page",
+        req: {
+          pageNum: 1,
+          pageSize: 9999,
+        },
+        labelKey: "name",
+        labelVal: "id",
+        method: "post",
+        resUrl: "rows",
       },
-      labelKey: "name",
-      labelVal: "id",
-      method: "post",
-      resUrl: "rows",
     },
-  },
-  {
-    type: "input",
-    prop: "code",
-    label: "出库数量",
-    disabled: false,
-    itemWidth: 33,
-  },
-]);
+    {
+      type: "input",
+      prop: "code",
+      label: "出库数量",
+      disabled: false,
+      itemWidth: 33,
+    },
+  ],
+  [
+    {
+      type: "title",
+      title: "调仓信息",
+    },
+    {
+      type: "select",
+      prop: "outWarehouseId",
+      label: "调出仓库",
+      itemWidth: 33,
+      disabled: false,
+      data: [],
+    },
+    {
+      type: "select",
+      prop: "inWarehouseId",
+      label: "调入仓库",
+      itemWidth: 33,
+      disabled: false,
+      data: [],
+    },
+    {
+      type: "input",
+      prop: "remark",
+      label: "调拨说明",
+      itemType: "textarea",
+      disabled: false,
+    },
+    {
+      type: "title",
+      title: "调仓明细",
+    },
+    {
+      type: "slot",
+      slotName: "products",
+    },
+  ],
+];
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
   proxy
-    .post("/stockWait/pageByWdly", sourceList.value.pagination)
+    .post("/stockWaitDetails/page", sourceList.value.pagination)
     .then((message) => {
-      console.log(message);
       sourceList.value.data = message.rows.map((x) => ({
         ...x,
         ...JSON.parse(x.victoriatouristJson),
@@ -339,8 +486,14 @@ const submitForm = () => {
   });
 };
 
-const getDtl = (row) => {
-  modalType.value = "edit";
+const outBound = (row) => {
+  const index = row.$index;
+  modalType.value = "add";
+  if (index % 2 == 0) {
+    formConfig.value = configData[0];
+  } else {
+    formConfig.value = configData[1];
+  }
   // proxy.post("/stockWait/detailByWdly", { id: row.id }).then((res) => {
   //   const json = JSON.parse(res.victoriatouristJson);
   //   formData.data = {
@@ -359,35 +512,80 @@ const getDtl = (row) => {
   dialogVisible.value = true;
 };
 const warehouseType = ref([]);
-const getDict = () => {
-  // // 币种数据
+
+const businessType = [
+  { label: "退货出库", value: "4" },
+  { label: "京东订单出库", value: "5" },
+];
+
+const handleRemove = (index) => {
+  formData.data.stockTransferDetailsList.splice(index, 1);
+  return ElMessage({
+    message: "删除成功",
+    type: "success",
+  });
+};
+
+const clickAdd = () => {
+  if (formData.data.outWarehouseId) {
+    openProduct.value = true;
+  } else {
+    ElMessage("请先选择仓库");
+  }
+};
+
+const select = (x) => {
+  if (
+    formData.data.stockTransferDetailsList &&
+    formData.data.stockTransferDetailsList.length > 0
+  ) {
+    let data = formData.data.stockTransferDetailsList.filter(
+      (row) => row.bussinessId === x.productId
+    );
+    if (data && data.length > 0) {
+      return ElMessage("请勿重复添加");
+    }
+  }
+  formData.data.stockTransferDetailsList.push({
+    goodType: x.goodType,
+    productCode: x.productCode,
+    productName: x.productName,
+    productSpec: x.productSpec,
+    productUnit: x.productUnit,
+    count: 0,
+    price: 0,
+    bussinessId: x.productId,
+    amount: 0,
+  });
+  ElMessage({
+    message: "添加成功!",
+    type: "success",
+  });
+};
+const warehouseList = ref([]);
+const warehouseListData = () => {
   proxy
-    .post("/dictTenantData/page", {
+    .post("/warehouse/page", {
       pageNum: 1,
       pageSize: 999,
-      tenantId: useUserStore().user.tenantId,
-      dictCode: "warehouse_type",
     })
-    .then((res) => {
-      warehouseType.value = res.rows;
-      formConfig[0].data = res.rows.map((x) => ({
-        label: x.dictValue,
-        value: x.dictKey,
+    .then((message) => {
+      warehouseList.value = message.rows;
+      configData[1][1].data = message.rows.map((x) => ({
+        label: x.name,
+        value: x.id,
+      }));
+      configData[1][2].data = message.rows.map((x) => ({
+        label: x.name,
+        value: x.id,
       }));
     });
 };
-
-const businessType = [
-  { label: "线边回仓", value: "1" },
-  { label: "完工入库", value: "2" },
-  { label: "采购到货", value: "3" },
-  { label: "退货出库", value: "4" },
-];
-
+warehouseListData();
 getList();
-getDict();
 onMounted(() => {
-  selectConfig[0].data = inboundType.value;
+  selectConfig[0].data = businessType;
+  selectConfig[1].data = outboundType.value;
 });
 </script>