Browse Source

Merge branch 'master' of http://36.137.93.232:3000/hf/byte-sailing-new

lxf 2 years ago
parent
commit
032b55f1e4

+ 16 - 1
src/components/WDLY/process/SendPurchaseWDLY.vue

@@ -424,7 +424,22 @@ const getSupplierList = async (req) => {
 };
 // 供应商改变逻辑
 const handleChangeSupplier = (val) => {
-  console.log(val, "as");
+  const ids = formData.data.purchaseDetailList.map((x) => x.bussinessId);
+  proxy
+    .post("/supplierPrice/getSupplierPriceByProductIds", {
+      supplierInfoId: val,
+      productIdList: ids,
+    })
+    .then((res) => {
+      for (let i = 0; i < formData.data.purchaseDetailList.length; i++) {
+        const e = formData.data.purchaseDetailList[i];
+        for (const key in res) {
+          if (e.bussinessId === key) {
+            e.price = Number(res[key]);
+          }
+        }
+      }
+    });
 };
 // 计算采购总金额
 const handleChangeAmount = () => {

+ 373 - 0
src/components/WDLY/product/SelectGoods.vue

@@ -0,0 +1,373 @@
+<template>
+  <div>
+    <byTable
+      ref="table"
+      :source="sourceList.data"
+      :pagination="sourceList.pagination"
+      :config="config"
+      :loading="loading"
+      highlight-current-row
+      :selectConfig="selectConfig"
+      :table-events="{
+        //element talbe事件都能传
+        select: select,
+      }"
+      :action-list="[]"
+      @get-list="getList"
+    >
+    </byTable>
+    <div>
+      <div>已选择货品</div>
+      <div style="margin: 10px 0px">
+        <el-tag
+          style="margin-right: 10px"
+          type="info"
+          closable
+          v-for="(good, index) in goodList"
+          :key="good.id"
+          @close="handleRemove(index)"
+          >{{ good.name }}</el-tag
+        >
+      </div>
+      <div style="text-align: center">
+        <el-button @click="handleCancel">取消</el-button>
+        <el-button type="primary" @click="handleSubmit"> 确 定 </el-button>
+      </div>
+    </div>
+  </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 treeList from "@/components/product/treeList";
+import { computed, defineComponent, ref, watch } from "vue";
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+    type: "",
+    productClassifyId: "",
+    keyword: "",
+    definition: "1",
+  },
+});
+let dialogVisible = ref(false);
+let openExcelDialog = ref(false);
+
+let modalType = ref("add");
+let rules = ref({
+  productClassifyId: [
+    { required: true, message: "请选择产品分类", trigger: "change" },
+  ],
+  type: [{ required: true, message: "请选择产品类型", trigger: "change" }],
+  name: [{ required: true, message: "请输入产品名称", trigger: "blur" }],
+  unit: [{ required: true, message: "请选择单位", trigger: "change" }],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = reactive([
+  {
+    label: "物品类型",
+    prop: "definition",
+    isShowAll: false, //不显示全部搜索
+    data: [
+      {
+        label: "产品",
+        value: "1",
+      },
+      {
+        label: "物料",
+        value: "2",
+      },
+    ],
+  },
+  {
+    label: "所属分类",
+    prop: "productClassifyId",
+    data: [],
+  },
+]);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "货品类型",
+        prop: "type",
+      },
+      render(type) {
+        return sourceList.value.pagination.definition == 1 ? "产品" : "物料";
+      },
+    },
+    {
+      attrs: {
+        label: "所属分类",
+        prop: "classifyName",
+      },
+    },
+    {
+      attrs: {
+        label: "货品编码",
+        prop: "code",
+      },
+    },
+    {
+      attrs: {
+        label: "货品名称",
+        prop: "name",
+      },
+    },
+
+    {
+      attrs: {
+        label: "规格型号",
+        prop: "spec",
+      },
+    },
+    {
+      attrs: {
+        label: "单位",
+        prop: "unit",
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "100",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "选择",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              handleSelect(row);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {},
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const treeListData = ref([]);
+const formConfig = computed(() => {
+  return [
+    {
+      type: "treeSelect",
+      prop: "productClassifyId",
+      label: "产品分类",
+      data: [],
+    },
+    {
+      type: "select",
+      prop: "type",
+      label: "产品类型",
+      required: true,
+      data: [
+        {
+          label: "成品",
+          id: "1",
+        },
+        {
+          label: "半成品",
+          id: "2",
+        },
+      ],
+    },
+    {
+      type: "input",
+      prop: "name",
+      label: "产品名称",
+    },
+    {
+      type: "input",
+      prop: "spec",
+      label: "规格型号",
+    },
+    {
+      type: "select",
+      prop: "unit",
+      label: "单位",
+      required: true,
+      data: [
+        {
+          label: "个",
+          id: "个",
+        },
+        {
+          label: "双",
+          id: "双",
+        },
+      ],
+    },
+    {
+      type: "slot",
+      slotName: "productPic",
+      prop: "fileList",
+      label: "产品图片",
+    },
+    {
+      type: "input",
+      prop: "remark",
+      label: "备注",
+      itemType: "textarea",
+    },
+  ];
+});
+
+const lastDefinition = ref("");
+const getList = async (req = {}) => {
+  for (const key in req) {
+    sourceList.value.pagination[key] = req[key];
+    if (key === "definition") {
+      if (lastDefinition.value !== req[key]) {
+        getTreeList();
+        lastDefinition.value = req[key];
+        // 如果选择的物品分类不一致,则分类默认选中全部
+        return table.value.searchItemSelct("all", selectConfig[1]);
+      }
+    }
+  }
+  sourceList.value.pagination = {
+    ...sourceList.value.pagination,
+    ...req,
+  };
+  loading.value = true;
+  proxy
+    .post("/productInfo/page", sourceList.value.pagination)
+    .then((message) => {
+      sourceList.value.data = message.rows.map((x) => ({ ...x, fileList: [] }));
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+
+      const productIdList = message.rows.map((x) => x.id);
+      // 请求文件数据并回显
+      if (productIdList.length > 0) {
+        proxy
+          .post("/fileInfo/getList", { businessIdList: productIdList })
+          .then((fileObj) => {
+            for (let i = 0; i < sourceList.value.data.length; i++) {
+              const e = sourceList.value.data[i];
+              for (const key in fileObj) {
+                if (e.id === key) {
+                  e.fileList = fileObj[key];
+                }
+              }
+            }
+          });
+      }
+    });
+};
+
+const getTreeList = () => {
+  proxy
+    .post("/productClassify/tree", {
+      parentId: "",
+      name: "",
+      definition: sourceList.value.pagination.definition,
+    })
+    .then((message) => {
+      selectConfig[1].data = message.map((x) => ({
+        label: x.label,
+        value: x.id,
+      }));
+    });
+};
+
+const goodList = ref([]);
+const handleSelect = (row) => {
+  const flag = goodList.value.some((x) => x.id === row.id);
+  if (flag)
+    return ElMessage({
+      message: "该产品已选择",
+      type: "info",
+    });
+  goodList.value.push({
+    ...row,
+    goodType: sourceList.value.pagination.definition,
+  });
+  return ElMessage({
+    message: "选择成功",
+    type: "success",
+  });
+};
+
+const handleRemove = (index) => {
+  goodList.value.splice(index, 1);
+  return ElMessage({
+    message: "删除成功",
+    type: "success",
+  });
+};
+
+const handleSubmit = () => {
+  if (!goodList.value.length > 0)
+    return ElMessage({
+      message: "请添加货品",
+      type: "info",
+    });
+  proxy.$emit("pushGoods", goodList.value);
+  goodList.value = [];
+};
+
+const handleCancel = () => {
+  goodList.value = [];
+  proxy.$emit("cancel");
+};
+
+const table = ref(null);
+
+const searchItemSelct = () => {
+  // 默认选中的方法
+  table.value.searchItemSelct(selectConfig[0].data[0], selectConfig[0]);
+};
+
+onMounted(() => {
+  searchItemSelct();
+});
+</script>
+  
+<style lang="scss" scoped>
+.user {
+  padding: 20px;
+  display: flex;
+  justify-content: space-between;
+  .tree {
+    width: 300px;
+  }
+  .content {
+    width: calc(100% - 320px);
+  }
+}
+.pic {
+  object-fit: contain;
+  width: 50px;
+  height: 50px;
+  cursor: pointer;
+  vertical-align: middle;
+}
+</style>

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

@@ -948,6 +948,7 @@ const getDict = () => {
   proxy.getDict(["unit", "product_type"]).then((res) => {
     productUnit.value = res["unit"];
     productType.value = res["product_type"];
+    console.log(res, "wqasd");
     formConfig.value[1].data = productType.value.map((x) => ({
       label: x.dictValue,
       value: x.dictKey,

+ 1 - 1
src/views/WDLY/outInBound/logistics/index.vue

@@ -574,7 +574,7 @@ const handleArrival = (row) => {
         productUnit: x.unit,
         productType: x.type,
         productCode: x.code,
-        bussinessId: x.id,
+        bussinessId: x.productId,
         purchaseDetailId: x.purchaseDetailId,
         deliverGoodsDetailsId: x.deliverGoodsId,
         transitQuantity: x.transitQuantity,

+ 71 - 4
src/views/WDLY/outInBound/transfer/index.vue

@@ -54,7 +54,7 @@
           <div style="width: 100%">
             <el-button
               type="primary"
-              @click="openProduct = true"
+              @click="clickAdd()"
               style="margin-bottom: 10px"
               v-if="modalType == 'add'"
             >
@@ -159,12 +159,19 @@
       width="70%"
       append-to-body
     >
-      <SelectProduct @handleSelect="handleSelect"></SelectProduct>
-      <template #footer>
+      <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>
+      </template> -->
     </el-dialog>
   </div>
 </template>
@@ -177,6 +184,8 @@ import byForm from "@/components/byForm/index";
 import { computed, defineComponent, ref, watch } from "vue";
 import useUserStore from "@/store/modules/user";
 import SelectProduct from "@/components/WDLY/product/SelectProduct";
+import SelectGoods from "@/components/WDLY/product/SelectGoods";
+import InventoryInquiry from "@/views/purchaseSales/outAndInWarehouse/inventoryInquiry/index";
 
 const loading = ref(false);
 const submitLoading = ref(false);
@@ -524,6 +533,26 @@ const handleSelect = (row) => {
   });
 };
 
+const pushGoods = (goods) => {
+  const arr = goods.map((x) => ({
+    goodType: x.goodType,
+    productCode: x.code,
+    productName: x.name,
+    productSpec: x.spec,
+    productUnit: x.unit,
+    count: 0,
+    price: 0,
+    bussinessId: x.id,
+    amount: 0,
+  }));
+  formData.data.stockTransferDetailsList =
+    formData.data.stockTransferDetailsList.concat(arr);
+  return ElMessage({
+    message: "添加成功!",
+    type: "success",
+  });
+};
+
 const handleRemove = (index) => {
   formData.data.stockTransferDetailsList.splice(index, 1);
   return ElMessage({
@@ -531,6 +560,44 @@ const handleRemove = (index) => {
     type: "success",
   });
 };
+
+const clickAdd = () => {
+  if (formData.data.outWarehouseId) {
+    openProduct.value = true;
+  } else {
+    ElMessage("请先选择仓库");
+  }
+};
+
+const select = (x) => {
+  console.log(x, "ass");
+  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",
+  });
+};
 </script>
   
 <style lang="scss" scoped>

+ 28 - 13
src/views/WDLY/purchaseManage/alreadyPurchase/index.vue

@@ -49,13 +49,13 @@
               "
             >
               <el-table-column
-                prop="definition"
+                prop="productDefinition"
                 label="物品类型"
                 :formatter="
                   (row) =>
-                    row.definition == 1
+                    row.productDefinition == 1
                       ? '产品'
-                      : row.definition == 2
+                      : row.productDefinition == 2
                       ? '物料'
                       : ''
                 "
@@ -240,7 +240,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "收货仓库",
-        prop: "",
+        prop: "receiptWarehouseName",
       },
     },
     {
@@ -269,10 +269,10 @@ const config = computed(() => {
         label: "采购状态",
         prop: "purchaseStatus",
       },
-      // render(status) {
-      //   const current = statusData.value.find((x) => x.value == status);
-      //   if (current) return current.label;
-      // },
+      render(status) {
+        const current = statusData.value.find((x) => x.value == status);
+        if (current) return current.label;
+      },
     },
     {
       attrs: {
@@ -286,7 +286,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "付款状态",
-        prop: "payStatus",
+        prop: "payStatus1",
       },
     },
     {
@@ -297,6 +297,9 @@ const config = computed(() => {
       },
       renderHTML(row) {
         return [
+          //  (row.purchaseStatus == 20 || row.purchaseStatus == 30) &&
+          // row.arrivalStatus != 2
+          //   ?
           {
             attrs: {
               label: "发货登记",
@@ -394,9 +397,13 @@ const configData = [
       itemWidth: 50,
     },
     {
+      type: "title",
+      title: "发货明细",
+    },
+    {
       type: "slot",
       slotName: "detailSlot",
-      label: "发货明细",
+      label: "",
     },
   ],
   [
@@ -428,9 +435,13 @@ const configData = [
       },
     },
     {
+      type: "title",
+      title: "发货明细",
+    },
+    {
       type: "slot",
       slotName: "detailSlot",
-      label: "发货明细",
+      label: "",
     },
   ],
 ];
@@ -443,7 +454,10 @@ const getList = async (req) => {
     .post("/purchase/pageByWdly", sourceList.value.pagination)
     .then((message) => {
       console.log(message);
-      sourceList.value.data = message.rows;
+      sourceList.value.data = message.rows.map((x) => ({
+        ...x,
+        ...JSON.parse(x.victoriatouristJson),
+      }));
       sourceList.value.pagination.total = message.total;
       setTimeout(() => {
         loading.value = false;
@@ -637,11 +651,12 @@ watch(
           productUnit: x.unit,
           productType: x.type,
           productCode: x.code,
-          bussinessId: x.id,
+          bussinessId: x.productId,
           purchaseDetailId: x.purchaseDetailId,
           deliverGoodsDetailsId: x.deliverGoodsId,
           transitQuantity: x.transitQuantity,
           deliverGoodsQuantity: x.deliverGoodsQuantity,
+          productDefinition: x.definition,
         }));
       });
     }

+ 15 - 3
src/views/WDLY/purchaseManage/purchase/index.vue

@@ -155,7 +155,7 @@ const sourceList = ref({
     total: 3,
     pageNum: 1,
     pageSize: 10,
-    status: "15",
+    status: "",
   },
 });
 let dialogVisible = ref(false);
@@ -203,10 +203,10 @@ const config = computed(() => {
     {
       attrs: {
         label: "货品类型",
-        prop: "definition",
+        prop: "productDefinition",
       },
       render(definition) {
-        return definition == 1 ? "产品" : definition == 1 ? "物料" : "";
+        return definition == 1 ? "产品" : definition == 2 ? "物料" : "";
       },
     },
 
@@ -227,6 +227,9 @@ const config = computed(() => {
         label: "单位",
         prop: "productUnit",
       },
+      render(unit) {
+        return proxy.dictDataEcho(unit, productUnit.value);
+      },
     },
     {
       attrs: {
@@ -524,6 +527,15 @@ const warehouseListData = () => {
     });
 };
 warehouseListData();
+
+const productUnit = ref([]);
+const getDict = () => {
+  proxy.getDict(["unit"]).then((res) => {
+    productUnit.value = res["unit"];
+    console.log(productUnit.value, "qwda");
+  });
+};
+getDict();
 </script>
   
 <style lang="scss" scoped>

+ 2 - 2
src/views/WDLY/purchaseManage/subscribe/index.vue

@@ -196,10 +196,10 @@ const config = computed(() => {
     {
       attrs: {
         label: "货品类型",
-        prop: "definition",
+        prop: "productDefinition",
       },
       render(definition) {
-        return definition == 1 ? "产品" : definition == 1 ? "物料" : "";
+        return definition == 1 ? "产品" : definition == 2 ? "物料" : "";
       },
     },
     {

+ 4 - 4
src/views/WDLY/stockManage/productCombination/index.vue

@@ -47,7 +47,7 @@
               style="margin-bottom: 10px"
               v-if="modalType == 'add'"
             >
-              添加产品
+              选择产品
             </el-button>
             <el-table :data="formData.data.groupRecordDetailsList">
               <el-table-column prop="productName" label="产品名称" />
@@ -56,7 +56,7 @@
                 label="可组合数量"
                 v-if="modalType == 'add'"
               />
-              <el-table-column prop="groupNum" label="组合数量" min-width="150">
+              <el-table-column prop="groupNum" label="本次组合" min-width="150">
                 <template #default="{ row, $index }">
                   <el-form-item
                     :prop="'groupRecordDetailsList.' + $index + '.groupNum'"
@@ -304,13 +304,13 @@ const submitForm = () => {
       const e = list[i];
       if (e.groupNum == 0) {
         return ElMessage({
-          message: "组合数量不能为0!",
+          message: "本次组合不能为0!",
           type: "info",
         });
       }
       if (e.groupNum > e.canSum) {
         return ElMessage({
-          message: "组合数量不可大于可组合数量!",
+          message: "本次组合不可大于可组合数量!",
           type: "info",
         });
       }

+ 5 - 4
src/views/WDLY/stockManage/productSplit/index.vue

@@ -15,7 +15,7 @@
         }"
         :action-list="[
           {
-            text: '产品拆',
+            text: '产品拆',
             action: () => openModal('add'),
           },
         ]"
@@ -27,10 +27,11 @@
       </byTable>
     </div>
     <el-dialog
-      :title="modalType == 'add' ? '产品拆' : '拆详情'"
+      :title="modalType == 'add' ? '产品拆' : '拆详情'"
       v-model="dialogVisible"
       width="800"
       v-loading="loading"
+      destroy-on-close
     >
       <byForm
         :formConfig="formConfig"
@@ -47,7 +48,7 @@
               style="margin-bottom: 10px"
               v-if="modalType == 'add'"
             >
-              添加产品
+              选择产品
             </el-button>
             <el-table :data="formData.data.groupRecordDetailsList">
               <el-table-column prop="productName" label="产品名称" />
@@ -148,7 +149,7 @@ let rules = ref({
   groupWarehouseId: [
     { required: true, message: "请选择组合后放置仓库", trigger: "change" },
   ],
-  groupNum: [{ required: true, message: "请输入拆数量", trigger: "blur" }],
+  groupNum: [{ required: true, message: "请输入拆数量", trigger: "blur" }],
 });
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([]);

+ 137 - 22
src/views/WDLY/stockManage/query/index.vue

@@ -87,7 +87,7 @@ let rules = ref({
   quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
 });
 const { proxy } = getCurrentInstance();
-const selectConfig = reactive([
+const selectConfig = ref([
   {
     label: "仓库名称",
     prop: "id",
@@ -109,6 +109,46 @@ const selectConfig = reactive([
   },
 ]);
 
+const selectConfigData = [
+  [
+    {
+      label: "仓库名称",
+      prop: "type",
+      data: [],
+    },
+    {
+      label: "物品类型",
+      prop: "definition",
+      data: [
+        {
+          label: "产品",
+          value: "1",
+        },
+        {
+          label: "物料",
+          value: "2",
+        },
+      ],
+    },
+  ],
+  [
+    {
+      label: "物品类型",
+      prop: "definition",
+      data: [
+        {
+          label: "产品",
+          value: "1",
+        },
+        {
+          label: "物料",
+          value: "2",
+        },
+      ],
+    },
+  ],
+];
+
 const config = ref([]);
 
 const configData = [
@@ -205,6 +245,90 @@ const configData = [
   [
     {
       attrs: {
+        label: "所属分类",
+        prop: "productClassifyName",
+      },
+    },
+    {
+      attrs: {
+        label: "物品编码",
+        prop: "productCode",
+      },
+    },
+    {
+      attrs: {
+        label: "物品名称",
+        prop: "productName",
+      },
+    },
+    {
+      attrs: {
+        label: "规格",
+        prop: "productSpec",
+      },
+    },
+    {
+      attrs: {
+        label: "单位",
+        prop: "productUnit",
+      },
+    },
+    {
+      attrs: {
+        label: "可用库存",
+        prop: "quantity",
+      },
+    },
+    {
+      attrs: {
+        label: "冻结库存",
+        prop: "frozenQuantity",
+      },
+    },
+    {
+      attrs: {
+        label: "次品库存",
+        prop: "defectiveQuantity",
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "良转次",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row, "add");
+            },
+          },
+          {
+            attrs: {
+              label: "次转良",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row, "edit");
+            },
+          },
+        ];
+      },
+    },
+  ],
+  [
+    {
+      attrs: {
         label: "spu编码",
         prop: "warehouseName",
       },
@@ -270,6 +394,7 @@ const getList = async (req) => {
     sourceList.value.data = message.rows.map((x) => ({
       ...x,
       ...JSON.parse(x.victoriatouristJson),
+      quantity: x.quantity,
     }));
     sourceList.value.pagination.total = message.total;
     setTimeout(() => {
@@ -281,8 +406,8 @@ const getList = async (req) => {
 const submitForm = () => {
   let submitAddress =
     modalType.value === "add"
-      ? "/stock/defectiveToQualified"
-      : "/stock/quantityToDefective";
+      ? "/stock/qualifiedToDefective"
+      : "/stock/defectiveToQualified";
   byform.value.handleSubmit((valid) => {
     if (Number(formData.data.quantity) > Number(formData.data.canSum)) {
       return ElMessage({
@@ -323,30 +448,20 @@ const handleChange = () => {
   sourceList.value.pagination.pageNum = 1;
   if (activeName.value === "first") {
     requestUrl = "/stock/pageByWarehouse";
+    selectConfig.value = selectConfigData[0];
+    selectConfig.value[0].data = warehouseList.value.map((x) => ({
+      label: x.name,
+      value: x.id,
+    }));
     config.value = configData[0];
-    config.value.unshift({
-      attrs: {
-        label: "仓库名称",
-        prop: "warehouseName",
-      },
-    });
-    selectConfig.unshift({
-      label: "仓库名称",
-      prop: "type",
-      data: warehouseList.value.map((x) => ({
-        label: x.name,
-        value: x.id,
-      })),
-    });
   } else if (activeName.value === "second") {
     requestUrl = "/stock/pageByProduct";
-    config.value = configData[0];
-    if (selectConfig.length > 1) selectConfig.shift();
-    config.value.shift();
+    selectConfig.value = selectConfigData[1];
+    config.value = configData[1];
   } else {
     requestUrl = "/stock/pageByProduct";
-    config.value = configData[1];
-    if (selectConfig.length > 1) selectConfig.shift();
+    selectConfig.value = selectConfigData[1];
+    config.value = configData[2];
   }
   getList();
 };

+ 13 - 3
src/views/purchaseManage/supplier/supplyPrice/index.vue

@@ -229,8 +229,8 @@ const config = computed(() => {
         label: "供应商类型",
         prop: "supplierType",
       },
-      render(supplierType) {
-        return supplierType === 1 ? "贸易商" : supplierType === 2 ? "工厂" : "";
+      render(type) {
+        return proxy.dictDataEcho(type, supplierType.value);
       },
     },
     {
@@ -534,7 +534,17 @@ const pushGoods = (goods) => {
     type: "success",
   });
 };
-
+const supplierType = ref([]);
+const getDict = () => {
+  proxy.getDict(["supplier_type"]).then((res) => {
+    supplierType.value = res["supplier_type"];
+    selectConfig[0].data = supplierType.value.map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
+getDict();
 getList();
 </script>
   

+ 20 - 4
src/views/purchaseSales/outAndInWarehouse/inventoryInquiry/index.vue

@@ -16,11 +16,20 @@
                 action: () => deriveExcel(),
               },
         ]"
-        @get-list="getList">
+        @get-list="getList"
+      >
         <template #btn="{ item }">
           <div style="width: 100%; text-align: center">
-            <el-button type="primary" @click="checkTheFlow(item)" v-if="!selectStatus" text>查看流水</el-button>
-            <el-button type="primary" @click="clickSelect(item)" v-else text>选择</el-button>
+            <el-button
+              type="primary"
+              @click="checkTheFlow(item)"
+              v-if="!selectStatus"
+              text
+              >查看流水</el-button
+            >
+            <el-button type="primary" @click="clickSelect(item)" v-else text
+              >选择</el-button
+            >
           </div>
         </template>
       </byTable>
@@ -49,6 +58,7 @@ const sourceList = ref({
     id: "",
   },
 });
+const productUnit = ref([]);
 const definition = ref([
   {
     label: "产品",
@@ -87,7 +97,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "物品类型",
-        prop: "definition",
+        prop: "productDefinition",
         width: 140,
       },
       render(type) {
@@ -128,6 +138,9 @@ const config = computed(() => {
         prop: "productUnit",
         width: 120,
       },
+      render(unit) {
+        return proxy.dictDataEcho(unit, productUnit.value);
+      },
     },
     {
       attrs: {
@@ -158,6 +171,9 @@ const getDict = () => {
       });
     }
   });
+  proxy.getDict(["unit"]).then((res) => {
+    productUnit.value = res["unit"];
+  });
   // proxy
   //   .post("/dictTenantData/page", {
   //     pageNum: 1,

+ 194 - 77
src/views/salesMange/shipmentMange/packing/index.vue

@@ -86,9 +86,12 @@
           </el-select>
         </el-form-item>
         <el-form-item label="合同明细" prop="contractProductData">
-          <el-table :data="contractProductData" @select="handleSelectProduct">
+          <el-table
+            :data="formData.data.contractProductData"
+            @select="handleSelectProduct"
+          >
             <el-table-column type="selection" label="" width="50" />
-            <el-table-column prop="code" label="合同编码" />
+            <el-table-column prop="contractCode" label="合同编码" />
             <el-table-column prop="productName" label="产品名称" />
             <el-table-column prop="cpQuantity" label="合同数量" />
             <el-table-column prop="waitQuantity" label="待装箱数量" />
@@ -96,7 +99,6 @@
               <template #default="{ row, $index }">
                 <el-form-item
                   :prop="'contractProductData.' + $index + '.quantity'"
-                  :rules="rules.quantity"
                   :inline-message="true"
                 >
                   <el-input-number
@@ -118,30 +120,47 @@
           </el-button>
         </el-form-item>
 
-        <el-form-item label="装箱明细">
-          <div class="box">
+        <el-form-item label="装箱明细" prop="packDetailList">
+          <div
+            class="box"
+            v-for="(item, index) in formData.data.packDetailList"
+            :key="index"
+          >
             <div ref="">箱规</div>
             <el-row :gutter="10">
               <el-col :span="5">
-                <el-form-item label="箱数" prop="supplyId">
+                <el-form-item
+                  label="箱数"
+                  :prop="'packDetailList.' + index + '.packQuantity'"
+                  :rules="rules.packQuantity"
+                >
                   <el-input
-                    v-model="formData.data.a"
+                    v-model="item.packQuantity"
                     placeholder="请输入"
                   ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="5">
-                <el-form-item label="净重(kg)" prop="supplyId">
+                <el-form-item
+                  label="净重(kg)"
+                  :prop="'packDetailList.' + index + '.netWeight'"
+                  :rules="rules.netWeight"
+                >
                   <el-input
-                    v-model="formData.data.a"
+                    v-model="item.netWeight"
                     placeholder="请输入"
                   ></el-input>
                 </el-form-item>
               </el-col>
+
               <el-col :span="5">
-                <el-form-item label="毛重(kg)" prop="supplyId">
+                <el-form-item
+                  label="毛重(kg)"
+                  :prop="'packDetailList.' + index + '.roughWeight'"
+                  :rules="rules.roughWeight"
+                >
                   <el-input
-                    v-model="formData.data.a"
+                    v-model="item.roughWeight"
                     placeholder="请输入"
                   ></el-input>
                 </el-form-item>
@@ -151,24 +170,42 @@
                   <el-form-item label="尺寸(cm³)" required>
                     <el-col :span="1"></el-col>
                     <el-col :span="7">
-                      <el-input
-                        v-model="formData.data.a"
-                        placeholder="长"
-                      ></el-input>
+                      <el-form-item
+                        label=""
+                        :prop="'packDetailList.' + index + '.boxLong'"
+                        :rules="rules.boxLong"
+                      >
+                        <el-input
+                          v-model="item.boxLong"
+                          placeholder="长"
+                        ></el-input>
+                      </el-form-item>
                     </el-col>
                     <el-col :span="1" style="text-align: center"> * </el-col>
                     <el-col :span="7">
-                      <el-input
-                        v-model="formData.data.a"
-                        placeholder="宽"
-                      ></el-input>
+                      <el-form-item
+                        label=""
+                        :prop="'packDetailList.' + index + '.boxWide'"
+                        :rules="rules.boxWide"
+                      >
+                        <el-input
+                          v-model="item.boxWide"
+                          placeholder="宽"
+                        ></el-input>
+                      </el-form-item>
                     </el-col>
                     <el-col :span="1" style="text-align: center"> * </el-col>
                     <el-col :span="7">
-                      <el-input
-                        v-model="formData.data.a"
-                        placeholder="高"
-                      ></el-input>
+                      <el-form-item
+                        label=""
+                        :prop="'packDetailList.' + index + '.boxHigh'"
+                        :rules="rules.boxHigh"
+                      >
+                        <el-input
+                          v-model="item.boxHigh"
+                          placeholder="高"
+                        ></el-input>
+                      </el-form-item>
                     </el-col>
                   </el-form-item>
                 </el-row>
@@ -177,46 +214,74 @@
             <div class="line"></div>
             <el-form-item label="关联合同产品">
               <div class="flex-box">
-                <div class="item">
-                  <div>合同编码:PO-2301-001</div>
-                  <div>产品名称:PO-2301-001</div>
-                  <div>每箱数量:PO-2301-001</div>
+                <div
+                  class="item"
+                  v-for="(product, j) in item.packDetailProductList"
+                  :key="j"
+                >
+                  <div>合同编码:{{ product.code }}</div>
+                  <div>产品名称:{{ product.name }}</div>
+                  <div>每箱数量:{{ product.quantity }}</div>
                 </div>
               </div>
             </el-form-item>
-            <div class="bottom-arrow" v-show="fade">
+            <div
+              class="bottom-arrow"
+              v-show="!item.isShow"
+              @click="item.isShow = !item.isShow"
+            >
               <span style="margin-right: 5px"> 自定义装箱明细</span>
               <el-icon><ArrowDownBold /></el-icon>
             </div>
-            <div class="bottom-arrow" v-show="true">
+            <div
+              class="bottom-arrow"
+              v-show="item.isShow"
+              @click="item.isShow = !item.isShow"
+            >
               <span style="margin-right: 5px"> 收起</span>
               <el-icon><ArrowUpBold /></el-icon>
             </div>
-            <el-form-item prop="自定义装箱">
-              <el-button type="primary" style="margin-bottom: 10px">
+            <el-form-item prop="packDetailGoodsList" v-show="item.isShow">
+              <el-button
+                type="primary"
+                style="margin-bottom: 10px"
+                @click="handleCustomPush(index)"
+              >
                 添加行
               </el-button>
-              <el-table :data="formData.data.purchaseDetailList">
-                <el-table-column prop="count" label="货物描述">
+              <el-table :data="item.packDetailGoodsList">
+                <el-table-column label="货物描述">
                   <template #default="{ row, $index }">
                     <el-form-item
-                      :prop="'purchaseDetailList.' + $index + '.count'"
-                      :rules="rules.count"
+                      :prop="[
+                        'packDetailList',
+                        index,
+                        'packDetailGoodsList',
+                        $index,
+                        'remark',
+                      ]"
+                      :rules="rules.remark"
                       :inline-message="true"
                     >
-                      <el-input v-model="row.count" placeholder="请输入" />
+                      <el-input v-model="row.remark" placeholder="请输入" />
                     </el-form-item>
                   </template>
                 </el-table-column>
-                <el-table-column prop="count" label="单位" width="150">
+                <el-table-column label="单位" width="150">
                   <template #default="{ row, $index }">
                     <el-form-item
-                      :prop="'purchaseDetailList.' + $index + '.count'"
-                      :rules="rules.count"
+                      :prop="[
+                        'packDetailList',
+                        index,
+                        'packDetailGoodsList',
+                        $index,
+                        'unit',
+                      ]"
+                      :rules="rules.unit"
                       :inline-message="true"
                     >
                       <el-input-number
-                        v-model="row.count"
+                        v-model="row.unit"
                         :precision="4"
                         :controls="false"
                         :min="0"
@@ -224,15 +289,21 @@
                     </el-form-item>
                   </template>
                 </el-table-column>
-                <el-table-column prop="count" label="数量" width="150">
+                <el-table-column label="数量" width="150">
                   <template #default="{ row, $index }">
                     <el-form-item
-                      :prop="'purchaseDetailList.' + $index + '.count'"
-                      :rules="rules.count"
+                      :prop="[
+                        'packDetailList',
+                        index,
+                        'packDetailGoodsList',
+                        $index,
+                        'quantity',
+                      ]"
+                      :rules="rules.quantityOne"
                       :inline-message="true"
                     >
                       <el-input-number
-                        v-model="row.count"
+                        v-model="row.quantity"
                         :precision="4"
                         :controls="false"
                         :min="0"
@@ -242,7 +313,10 @@
                 </el-table-column>
                 <el-table-column prop="zip" label="操作" width="100">
                   <template #default="{ $index }">
-                    <el-button type="primary" link @click="handleRemove($index)"
+                    <el-button
+                      type="primary"
+                      link
+                      @click="handleCustomRemove(index, $index)"
                       >删除</el-button
                     >
                   </template>
@@ -256,7 +330,7 @@
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
         <el-button
           type="primary"
-          @click="submitForm('byform')"
+          @click="submitForm()"
           size="large"
           :loading="submitLoading"
         >
@@ -294,7 +368,16 @@ let dialogVisible = ref(false);
 let modalType = ref("add");
 let fileList = ref([]);
 let rules = ref({
+  packQuantity: [{ required: true, message: "请输入箱数", trigger: "blur" }],
+  netWeight: [{ required: true, message: "请输入净重", trigger: "blur" }],
+  roughWeight: [{ required: true, message: "请输入毛重", trigger: "blur" }],
+  boxLong: [{ required: true, message: "请输入长", trigger: "blur" }],
+  boxWide: [{ required: true, message: "请输入宽", trigger: "blur" }],
+  boxHigh: [{ required: true, message: "请输入高", trigger: "blur" }],
   quantity: [{ required: true, message: "请输入装箱数量", trigger: "blur" }],
+  quantityOne: [{ required: true, message: "请输入数量", trigger: "blur" }],
+  unit: [{ required: true, message: "请输入单位", trigger: "blur" }],
+  remark: [{ required: true, message: "请输入货物描述", trigger: "blur" }],
 });
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
@@ -448,7 +531,7 @@ const config = computed(() => {
     },
   ];
 });
-
+const formDom = ref(null);
 let formData = reactive({
   data: {},
 });
@@ -472,31 +555,37 @@ const getList = async (req) => {
 };
 
 const openModal = () => {
-  formData.data = {};
+  formData.data = {
+    packDetailList: [],
+  };
   dialogVisible.value = true;
-  handleChangeCustomer("");
+  // handleChangeCustomer("");
 };
 
 const submitForm = () => {
-  byform.value.handleSubmit((valid) => {
-    formData.data.fileList = fileList.value;
-    submitLoading.value = true;
-    proxy.post("/productionProcesses/" + modalType.value, formData.data).then(
-      (res) => {
-        ElMessage({
-          message: modalType.value == "add" ? "添加成功" : "编辑成功",
-          type: "success",
-        });
-        fileList.value = [];
-        dialogVisible.value = false;
-        submitLoading.value = false;
-        getList();
-      },
-      (err) => {
-        console.log(err, "aswwwww");
-        submitLoading.value = false;
-      }
-    );
+  console.log(formData.data, "qwdads");
+
+  formDom.value.validate((vaild) => {
+    if (vaild) {
+      console.log(formData.data, "qwdads");
+      submitLoading.value = true;
+      proxy.post("/productionProcesses/" + modalType.value, formData.data).then(
+        (res) => {
+          ElMessage({
+            message: modalType.value == "add" ? "添加成功" : "编辑成功",
+            type: "success",
+          });
+          fileList.value = [];
+          dialogVisible.value = false;
+          submitLoading.value = false;
+          getList();
+        },
+        (err) => {
+          console.log(err, "aswwwww");
+          submitLoading.value = false;
+        }
+      );
+    }
   });
 };
 
@@ -510,12 +599,26 @@ const handleSelectProduct = (data) => {
 };
 const handleClickPacking = () => {
   if (selectProductData.value.length > 0) {
-    const packDetailProductList = selectProductData.value.map((x) => ({
-      contractId: "",
-      contractProductId: "",
-      quantity: "",
+    const list = selectProductData.value;
+    for (let i = 0; i < list.length; i++) {
+      const e = list[i];
+      if (!e.quantity) {
+        return ElMessage({
+          message: "请输入装箱数量",
+          type: "info",
+        });
+      }
+    }
+    const packDetailProductList = list.map((x) => ({
+      contractId: x.id,
+      contractProductId: x.contractProductId,
+      quantity: x.quantity,
+      productId: x.contractProductId,
+      productName: "",
+      productModel: "",
+      remark: "",
     }));
-    this.formData.packDetailList.push({
+    formData.data.packDetailList.push({
       customerId: "",
       contractIds: "",
       packQuantity: "",
@@ -527,8 +630,10 @@ const handleClickPacking = () => {
       bomVolume: "",
       remark: "",
       packDetailGoodsList: [],
-      packDetailProductList: [],
+      packDetailProductList: packDetailProductList,
+      isShow: false,
     });
+    console.log(formData.data.packDetailList, "qsda");
   } else {
     return ElMessage({
       message: "请选择产品 !",
@@ -536,6 +641,18 @@ const handleClickPacking = () => {
     });
   }
 };
+
+const handleCustomPush = (index) => {
+  formData.data.packDetailList[index].packDetailGoodsList.push({
+    unit: "",
+    quantity: "",
+    remark: "",
+  });
+};
+
+const handleCustomRemove = (index, sonIndex) => {
+  formData.data.packDetailList[index].packDetailGoodsList.splice(sonIndex, 1);
+};
 const customerList = ref([]);
 const getSelectData = () => {
   proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
@@ -557,14 +674,13 @@ const handleChangeCustomer = (val) => {
       formData.data.contractIds = "";
     });
 };
-const contractProductData = ref([]);
 const handleChangeContract = (val) => {
   proxy
     .get(
-      `/contract/getNoPackContractProductById?customerId=${formData.data.customerId}&contractId=${val}`
+      `/contractProduct/getNoPackContractProductById?customerId=${formData.data.customerId}&contractIds=${val}`
     )
     .then((res) => {
-      contractProductData.value = res.data.map((x) => ({
+      formData.data.contractProductData = res.data.map((x) => ({
         ...x,
         waitQuantity: Number(x.cpQuantity) - Number(x.sumPackQuantity),
       }));
@@ -591,6 +707,7 @@ getList();
   padding: 15px;
   background: #fde6c8;
   border: 1px solid #7fb5e3;
+  margin-bottom: 10px;
   .flex-box {
     width: 100%;
     display: flex;