소스 검색

组件修改

cz 2 년 전
부모
커밋
8343368314

+ 5 - 1
src/components/byForm/index.vue

@@ -43,6 +43,7 @@
           :placeholder="i.placeholder || '请选择'"
           @change="(e) => commonsEmit(e, i)"
           :disabled="i.disabled ? i.disabled : false"
+          :filterable="i.filterable ? true : false"
           :style="i.style"
         >
           <el-option
@@ -89,7 +90,7 @@
           <el-checkbox
             v-for="j in i.data"
             :key="j.id || j.value"
-            :label="j.id  || j.value"
+            :label="j.id || j.value"
             name="type"
           >
             {{ j.name || j.label }}
@@ -119,6 +120,9 @@
           :min="i.min ? i.min : 0"
           :max="i.max ? i.max : 100"
           :step="i.step ? i.step : 1"
+          :precision="i.precision !== '' ? i.precision : 2"
+          :controls="i.controls === false ? false : true"
+          :style="i.style"
         >
         </el-input-number>
         <el-tree

+ 5 - 3
src/views/WDLY/basic/supplier/index.vue

@@ -303,7 +303,7 @@ const config = computed(() => {
     },
     {
       attrs: {
-        label: "备注",
+        label: "退换货期限",
         prop: "returnPeriod",
       },
     },
@@ -434,10 +434,12 @@ const formConfig = computed(() => {
       prop: "victoriatouristJson",
       json: [
         {
-          type: "input",
+          type: "number",
           prop: "accountPeriod",
           label: "账期",
           itemWidth: 33,
+          controls: false,
+          precision: 0,
           style: {
             width: "100%",
             "margin-right": "10px",
@@ -543,7 +545,7 @@ const getDtl = (row) => {
     proxy
       .post("/fileInfo/getList", { businessIdList: [row.id] })
       .then((fileObj) => {
-        fileList.value = fileObj[row.id];
+        fileList.value = fileObj[row.id] || [];
         fileListCopy.value = [...fileList.value];
         getCityData(res.countryId, "20");
         getCityData(res.provinceId, "30");

+ 80 - 47
src/views/WDLY/purchaseManage/alreadyPurchase/index.vue

@@ -42,7 +42,9 @@
           <div style="width: 100%">
             <el-table
               :data="
-                modalType === 'add' ? formData.data.deliverGoodsDetailsList : []
+                modalType === 'add'
+                  ? formData.data.deliverGoodsDetailsList
+                  : formData.data.arrivalDetailList
               "
             >
               <el-table-column
@@ -86,31 +88,15 @@
                 </template>
               </el-table-column>
               <el-table-column
-                prop="sumArrivalCount"
+                prop="transitQuantity"
                 label="剩余在途"
                 v-if="modalType === 'edit'"
               />
               <el-table-column
-                prop="count"
+                prop="deliverGoodsQuantity"
                 label="本次到货"
-                min-width="150"
                 v-if="modalType === 'edit'"
-              >
-                <template #default="{ row, $index }">
-                  <el-form-item
-                    :prop="'arrivalDetailList.' + $index + '.count'"
-                    :rules="rules.count"
-                    :inline-message="true"
-                  >
-                    <el-input-number
-                      v-model="row.count"
-                      :precision="4"
-                      :controls="false"
-                      :min="0"
-                    />
-                  </el-form-item>
-                </template>
-              </el-table-column>
+              />
             </el-table>
           </div>
         </template>
@@ -135,6 +121,7 @@
 import { ElMessage, ElMessageBox } from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
+import { watch } from "vue";
 
 const loading = ref(false);
 const submitLoading = ref(false);
@@ -149,6 +136,9 @@ const sourceList = ref({
 let dialogVisible = ref(false);
 let modalType = ref("add");
 let rules = ref({
+  deliverGoodsId: [
+    { required: true, message: "请选择快递单号", trigger: "change" },
+  ],
   logisticsCompanyCode: [
     { required: true, message: "请选择物流公司", trigger: "change" },
   ],
@@ -378,14 +368,14 @@ const configData = [
   [
     {
       type: "input",
-      prop: "name",
+      prop: "supplyName",
       label: "供应商",
       disabled: true,
       itemWidth: 50,
     },
     {
       type: "input",
-      prop: "name",
+      prop: "purchaseCode",
       label: "采购单号",
       disabled: true,
       itemWidth: 50,
@@ -393,7 +383,7 @@ const configData = [
     {
       type: "select",
       label: "物流/快递单号",
-      prop: "name",
+      prop: "deliverGoodsId",
       itemWidth: 50,
       style: {
         width: "100%",
@@ -407,6 +397,7 @@ const configData = [
   ],
 ];
 
+const deliverData = ref([]);
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
@@ -422,6 +413,7 @@ const getList = async (req) => {
 
 const submitForm = () => {
   byform.value.handleSubmit((valid) => {
+    loading.value = true;
     if (modalType.value === "add") {
       const list = formData.data.deliverGoodsDetailsList;
       const total = list.reduce(
@@ -457,15 +449,31 @@ const submitForm = () => {
           type: "success",
         });
         dialogVisible.value = false;
+        loading.value = false;
         getList();
       });
     } else if (modalType.value === "edit") {
-      proxy.post("/arrival/add", formData.data).then((res) => {
+      formData.data.arrivalDetailList = formData.data.arrivalDetailList.map(
+        (x) => ({
+          bussinessId: x.bussinessId,
+          purchaseDetailId: x.purchaseDetailId,
+          deliverGoodsDetailsId: x.deliverGoodsDetailsId,
+          count: x.deliverGoodsQuantity,
+        })
+      );
+      const victoriatouristJson = {
+        deliverGoodsId: formData.data.deliverGoodsId,
+        logisticsCompanyCode: formData.data.logisticsCompanyCode,
+        code: formData.data.code,
+      };
+      formData.victoriatouristJson = JSON.stringify(victoriatouristJson);
+      proxy.post("/arrival/addByWdly", formData.data).then((res) => {
         ElMessage({
           message: `操作成功!`,
           type: "success",
         });
         dialogVisible.value = false;
+        loading.value = false;
         getList();
       });
     }
@@ -494,17 +502,13 @@ const handleEdit = (row, status) => {
     }
   ).then(() => {
     // 删除
-    proxy
-      .post("/purchase/edit", {
-        data,
-      })
-      .then((res) => {
-        ElMessage({
-          message: `${purchaseStatusName}成功`,
-          type: "success",
-        });
-        getList();
+    proxy.post("/purchase/edit", data).then((res) => {
+      ElMessage({
+        message: `${purchaseStatusName}成功`,
+        type: "success",
       });
+      getList();
+    });
   });
 };
 
@@ -553,27 +557,56 @@ const handleArrival = (row, type) => {
   } else if (type === "edit") {
     formConfig = configData[1];
     proxy.post("/deliverGoods/list", { id: row.id }).then((res) => {
-      console.log(res, "wss");
-    });
-    proxy.post("/deliverGoods/detail", { id: row.id }).then((res) => {
-      console.log(res, "wss");
+      deliverData.value = res;
+      formConfig[2].data = res.map((x) => ({
+        ...x,
+        label: x.code,
+        value: x.id,
+      }));
       formData.data = {
         purchaseId: row.id,
-        code: res.code,
-        supplyId: res.supplyId,
-        arrivalDetailList: res.purchaseDetailList.map((x) => ({
-          ...x,
-          purchaseDetailId: x.id,
-          purchaseCount: x.count,
-          count: 0,
-        })),
-        arrivalStatus: "",
+        supplyName: row.supplyName,
+        purchaseCode: row.code,
+        supplyId: row.supplyId,
+        code: "",
+        logisticsCompanyCode: "",
+        deliverGoodsId: "",
+        arrivalDetailList: [],
       };
       dialogVisible.value = true;
     });
   }
 };
 
+watch(
+  () => formData.data.deliverGoodsId,
+  (val) => {
+    if (val) {
+      const current = deliverData.value.find((x) => x.id === val);
+      formData.data.logisticsCompanyCode = current
+        ? current.logisticsCompanyCode
+        : "";
+      formData.data.code = current ? current.code : "";
+      // formData.data.logisticsCompanyName = current ? current.logisticsCompanyCode : "";
+      proxy.post("/deliverGoods/detail", { id: val }).then((res) => {
+        formData.data.arrivalDetailList = res.map((x) => ({
+          count: x.count,
+          productName: x.name,
+          productSpec: x.spec,
+          productUnit: x.unit,
+          productType: x.type,
+          productCode: x.code,
+          bussinessId: x.id,
+          purchaseDetailId: x.purchaseDetailId,
+          deliverGoodsDetailsId: x.deliverGoodsId,
+          transitQuantity: x.transitQuantity,
+          deliverGoodsQuantity: x.deliverGoodsQuantity,
+        }));
+      });
+    }
+  }
+);
+
 getList();
 getLogisticsData();
 </script>

+ 6 - 10
src/views/purchaseManage/purchaseManage/alreadyPurchase/index.vue

@@ -426,17 +426,13 @@ const handleEdit = (row, status) => {
     }
   ).then(() => {
     // 删除
-    proxy
-      .post("/purchase/edit", {
-        data,
-      })
-      .then((res) => {
-        ElMessage({
-          message: `${purchaseStatusName}成功`,
-          type: "success",
-        });
-        getList();
+    proxy.post("/purchase/edit", data).then((res) => {
+      ElMessage({
+        message: `${purchaseStatusName}成功`,
+        type: "success",
       });
+      getList();
+    });
   });
 };