Browse Source

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

lxf 2 years ago
parent
commit
ac455927ac

+ 4 - 4
src/views/WDLY/purchaseManage/alreadyPurchase/index.vue

@@ -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: {

+ 1 - 1
src/views/WDLY/purchaseManage/purchase/index.vue

@@ -181,7 +181,7 @@ const selectConfig = reactive([
     ],
   },
   {
-    label: "收仓库",
+    label: "收仓库",
     prop: "receiptWarehouseId",
     data: [],
   },

+ 78 - 188
src/views/salesMange/shipmentMange/packing/index.vue

@@ -76,32 +76,31 @@
             @change="handleChangeContract"
             filterable
             style="width: 100%"
-            multiple
           >
             <el-option
-              v-for="item in customerList"
-              :label="item.name"
+              v-for="item in contractData"
+              :label="item.code"
               :value="item.id"
             >
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="合同明细" prop="purchaseContent">
-          <el-table :data="formData.data.purchaseDetailList">
+        <el-form-item label="合同明细" prop="contractProductData">
+          <el-table :data="contractProductData" @select="handleSelectProduct">
             <el-table-column type="selection" label="" width="50" />
-            <el-table-column prop="productCode" label="合同编码" />
+            <el-table-column prop="code" label="合同编码" />
             <el-table-column prop="productName" label="产品名称" />
-            <el-table-column prop="productSpec" label="合同数量" />
-            <el-table-column prop="productUnit" label="待装箱数量" />
-            <el-table-column prop="count" label="装箱数量" min-width="150">
+            <el-table-column prop="cpQuantity" label="合同数量" />
+            <el-table-column prop="waitQuantity" label="待装箱数量" />
+            <el-table-column prop="quantity" label="装箱数量" min-width="150">
               <template #default="{ row, $index }">
                 <el-form-item
-                  :prop="'purchaseDetailList.' + $index + '.count'"
-                  :rules="rules.count"
+                  :prop="'contractProductData.' + $index + '.quantity'"
+                  :rules="rules.quantity"
                   :inline-message="true"
                 >
                   <el-input-number
-                    v-model="row.count"
+                    v-model="row.quantity"
                     :precision="4"
                     :controls="false"
                     :min="0"
@@ -109,19 +108,11 @@
                 </el-form-item>
               </template>
             </el-table-column>
-
-            <!-- <el-table-column prop="zip" label="操作" width="100">
-              <template #default="{ $index }">
-                <el-button type="primary" link @click="handleRemove($index)"
-                  >删除</el-button
-                >
-              </template>
-            </el-table-column> -->
           </el-table>
           <el-button
             type="primary"
-            @click="openProduct = true"
             style="margin-top: 10px; width: 100%"
+            @click="handleClickPacking"
           >
             装箱
           </el-button>
@@ -202,11 +193,7 @@
               <el-icon><ArrowUpBold /></el-icon>
             </div>
             <el-form-item prop="自定义装箱">
-              <el-button
-                type="primary"
-                @click="openProduct = true"
-                style="margin-bottom: 10px"
-              >
+              <el-button type="primary" style="margin-bottom: 10px">
                 添加行
               </el-button>
               <el-table :data="formData.data.purchaseDetailList">
@@ -307,7 +294,7 @@ let dialogVisible = ref(false);
 let modalType = ref("add");
 let fileList = ref([]);
 let rules = ref({
-  name: [{ required: true, message: "请输入供应商名称", trigger: "blur" }],
+  quantity: [{ required: true, message: "请输入装箱数量", trigger: "blur" }],
 });
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
@@ -463,61 +450,9 @@ const config = computed(() => {
 });
 
 let formData = reactive({
-  data: {
-    type: "1",
-  },
-});
-const formOption = reactive({
-  inline: true,
-  labelWidth: 100,
-  itemWidth: 100,
-  rules: [],
-});
-const byform = ref(null);
-const formConfig = computed(() => {
-  return [
-    {
-      type: "radio",
-      prop: "name",
-      label: "供应商类型",
-      required: true,
-      border: true,
-      data: [
-        { label: "贸易商", value: "1" },
-        { label: "工厂", value: "2" },
-      ],
-    },
-    {
-      type: "input",
-      prop: "name",
-      label: "供应商名称",
-      required: true,
-    },
-    {
-      type: "slot",
-      slotName: "address",
-      label: "地址",
-      required: true,
-    },
-    {
-      type: "slot",
-      slotName: "contact",
-      label: "联系信息",
-      required: true,
-    },
-    {
-      type: "slot",
-      slotName: "fileSlot",
-      label: "上传附件",
-    },
-    {
-      type: "input",
-      label: "备注",
-      prop: "remakes",
-      itemType: "textarea",
-    },
-  ];
+  data: {},
 });
+
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
@@ -537,119 +472,71 @@ const getList = async (req) => {
 };
 
 const openModal = () => {
+  formData.data = {};
   dialogVisible.value = true;
   handleChangeCustomer("");
 };
 
 const submitForm = () => {
-  if (fileList.value.length > 0) {
-    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;
-        }
-      );
-    });
-  } else {
-    return ElMessage({
-      message: "请上传附件!",
-      type: "info",
-    });
-  }
-};
-
-const getDtl = (row) => {
-  modalType.value = "edit";
-  proxy.post("/productionProcesses/detail", { id: row.id }).then((res) => {
-    fileList.value = [
-      {
-        id: "",
-        fileName: res.fileName,
-        path: "",
+  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();
       },
-    ];
-    formData.data = res;
-    dialogVisible.value = true;
-  });
-};
-const handleBeforeUpload = async (file) => {
-  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
-  uploadData.value = res.uploadBody;
-  fileList.value = [
-    {
-      id: res.id,
-      fileName: res.fileName,
-      path: res.fileUrl,
-    },
-  ];
-};
-const handleClickFile = (row) => {
-  ElMessage({
-    message: "数据请求中,请稍后!",
-    type: "success",
-  });
-  let id = row.id;
-  proxy.post("/fileInfo/getList", { businessIdList: [id] }).then((res) => {
-    const file = res[id][0];
-    window.open(file.fileUrl, "_blank");
+      (err) => {
+        console.log(err, "aswwwww");
+        submitLoading.value = false;
+      }
+    );
   });
 };
 
-const handlePreview = (file) => {
-  console.log(file);
-};
-const handleSuccess = (file) => {
-  console.log(file);
-};
-const handleRemove = (file) => {
-  fileList.value = [];
-};
-const handleClose = (index) => {
-  fileList.value.splice(index, 1);
-};
-const statusData = ref([
-  {
-    label: "审批中",
-    value: "10",
-  },
-  {
-    label: "待采购",
-    value: "15",
-  },
-  {
-    label: "部分采购",
-    value: "30",
-  },
-  {
-    label: "已采购",
-    value: "20",
-  },
-  {
-    label: "已作废",
-    value: "99",
-  },
-]);
-
 const selectData = ref([]);
 const selectRow = (data) => {
   selectData.value = data;
 };
-
+const selectProductData = ref([]);
+const handleSelectProduct = (data) => {
+  selectProductData.value = data;
+};
+const handleClickPacking = () => {
+  if (selectProductData.value.length > 0) {
+    const packDetailProductList = selectProductData.value.map((x) => ({
+      contractId: "",
+      contractProductId: "",
+      quantity: "",
+    }));
+    this.formData.packDetailList.push({
+      customerId: "",
+      contractIds: "",
+      packQuantity: "",
+      netWeight: "",
+      roughWeight: "",
+      boxLong: "",
+      boxWide: "",
+      boxHigh: "",
+      bomVolume: "",
+      remark: "",
+      packDetailGoodsList: [],
+      packDetailProductList: [],
+    });
+  } else {
+    return ElMessage({
+      message: "请选择产品 !",
+      type: "info",
+    });
+  }
+};
 const customerList = ref([]);
-// selectConfig[1].data = statusData.value;
 const getSelectData = () => {
   proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
     customerList.value = res.rows.map((item) => {
@@ -661,23 +548,26 @@ const getSelectData = () => {
     });
   });
 };
-
+const contractData = ref([]);
 const handleChangeCustomer = (val) => {
   proxy
     .get(`/contract/getNoPackContractByCustomerId?customerId=${val}`)
     .then((res) => {
-      console.log(res, "获取合同");
+      contractData.value = res.data;
+      formData.data.contractIds = "";
     });
 };
-
+const contractProductData = ref([]);
 const handleChangeContract = (val) => {
   proxy
-    .post(`/contract/getNoPackContractProductById`, {
-      customerId: formData.data.customerId,
-      contractId: val.join(),
-    })
+    .get(
+      `/contract/getNoPackContractProductById?customerId=${formData.data.customerId}&contractId=${val}`
+    )
     .then((res) => {
-      console.log(res, "获取产品");
+      contractProductData.value = res.data.map((x) => ({
+        ...x,
+        waitQuantity: Number(x.cpQuantity) - Number(x.sumPackQuantity),
+      }));
     });
 };
 getSelectData();