Selaa lähdekoodia

采购付款流程增加“决策辅助”

lxf 1 vuosi sitten
vanhempi
commit
d19a6bbd5a

+ 128 - 3
src/components/process/PurchasePayment.vue

@@ -38,7 +38,7 @@
               <template #default="{ row, $index }">
                 <div style="width: 100%">
                   <el-form-item :prop="'payDetailList.' + $index + '.purchaseId'" :rules="rules.purchaseId" :inline-message="true">
-                    <el-select v-model="row.purchaseId" placeholder="请选择采购合同" style="width: 100%" @change="changePurchaseId(row)">
+                    <el-select v-model="row.purchaseId" placeholder="请选择采购合同" style="width: 100%" @change="changePurchaseId(row, true)">
                       <el-option v-for="item in contractList" :key="item.value" :label="item.label" :value="item.value" />
                     </el-select>
                   </el-form-item>
@@ -128,7 +128,7 @@ const judgeStatus = () => {
     }
   }
   return false;
-};;
+};
 const formOption = reactive({
   inline: true,
   labelWidth: 100,
@@ -353,6 +353,8 @@ const changeSupply = async (val) => {
   } else {
     contractList.value = [];
   }
+  formData.data.payDetailList = [];
+  getDecisionAids();
 };
 const clickAdd = () => {
   if (formData.data.payDetailList && formData.data.payDetailList.length > 0) {
@@ -367,6 +369,7 @@ const clickAdd = () => {
 };
 const handleRemove = (index) => {
   formData.data.payDetailList.splice(index, 1);
+  getDecisionAids();
 };
 const changeAccount = (val) => {
   if (val) {
@@ -379,7 +382,7 @@ const changeAccount = (val) => {
     }
   }
 };
-const changePurchaseId = (row) => {
+const changePurchaseId = (row, status) => {
   let data = contractList.value.filter((item) => item.value === row.purchaseId);
   if (data && data.length > 0) {
     row.amount = data[0].amount;
@@ -388,6 +391,9 @@ const changePurchaseId = (row) => {
     row.amount = "";
     row.sumPayMoney = "";
   }
+  if (status) {
+    getDecisionAids();
+  }
 };
 const changeMoney = () => {
   let money = 0;
@@ -475,6 +481,7 @@ onMounted(async () => {
           for (let i = 0; i < formData.data.payDetailList.length; i++) {
             changePurchaseId(formData.data.payDetailList[i]);
           }
+          getDecisionAids();
         }
       }
     }
@@ -488,6 +495,124 @@ defineExpose({
   getFormData,
   handleSubmit,
 });
+let auxiliaryData = ref([
+  {
+    label: "关联销售合同",
+    data: [],
+  },
+  {
+    label: "到货数据",
+    data: [],
+  },
+  {
+    label: "质检数据",
+    data: [],
+  },
+]);
+const emit = defineEmits(["auxiliaryChange"]);
+const getDecisionAids = () => {
+  let data = {
+    purchaseIdList: [],
+  };
+  if (formData.data.payDetailList && formData.data.payDetailList.length > 0) {
+    data.purchaseIdList = formData.data.payDetailList.map((item) => item.purchaseId);
+  }
+  proxy.post("/contract/payDecisionAid", data).then((res) => {
+    if (res.contractList && res.contractList.length > 0) {
+      auxiliaryData.value[0].data = res.contractList.map((item) => {
+        return [
+          {
+            label: "合同编号",
+            value: item.code,
+            style: {
+              color: "#0084FF",
+            },
+            id: item.id,
+            num: 1,
+          },
+          {
+            label: "下单日期",
+            value: item.createTime,
+            id: item.id,
+            num: 1,
+          },
+        ];
+      });
+    } else {
+      auxiliaryData.value[0].data = [];
+    }
+    if (res.purchaseInfoList && res.purchaseInfoList.length > 0) {
+      auxiliaryData.value[1].data = res.purchaseInfoList.map((item) => {
+        return [
+          {
+            label: "物品编码",
+            value: item.productCode,
+            id: item.productId,
+            num: 1,
+          },
+          {
+            label: "物品名称",
+            value: item.productName,
+            id: item.productId,
+            num: 1,
+          },
+          {
+            label: "采购数量",
+            value: item.purchaseQuantity,
+            id: item.productId,
+            num: 1,
+          },
+          {
+            label: "到货数量",
+            value: item.invoiceQuantity,
+            id: item.productId,
+            num: 1,
+          },
+        ];
+      });
+      auxiliaryData.value[2].data = res.purchaseInfoList.map((item) => {
+        let odds = 0;
+        if (item.invoiceQuantity && item.qualifiedCount) {
+          odds = parseFloat((Number(item.qualifiedCount) / Number(item.invoiceQuantity)) * 100).toFixed(2);
+        }
+        return [
+          {
+            label: "物品编码",
+            value: item.productCode,
+            id: item.productId,
+            num: 1,
+          },
+          {
+            label: "物品名称",
+            value: item.productName,
+            id: item.productId,
+            num: 1,
+          },
+          {
+            label: "到货数量",
+            value: item.invoiceQuantity,
+            id: item.productId,
+            num: 1,
+          },
+          {
+            label: "合格率",
+            value: odds + "%",
+            id: item.productId,
+            num: 1,
+          },
+        ];
+      });
+    } else {
+      auxiliaryData.value[1].data = [];
+      auxiliaryData.value[2].data = [];
+    }
+    let list = proxy.deepClone(auxiliaryData.value);
+    if (!(list[0].data && list[0].data.length > 0)) {
+      list.splice(0, 1);
+    }
+    emit("auxiliaryChange", list);
+  });
+};
 </script>
 
 <style lang="scss" scoped>

+ 1 - 1
src/views/process/processApproval/index.vue

@@ -11,7 +11,7 @@
         <SendFunds ref="makeDom" v-else-if="flowForm.flowKey == 'account_request_funds_flow'" :queryData="queryData.data"></SendFunds>
         <ReturnGood ref="makeDom" v-else-if="flowForm.flowKey == 'sales_return_flow'" :queryData="queryData.data"></ReturnGood>
         <PurchaseRefund ref="makeDom" v-else-if="flowForm.flowKey == 'refund_flow'" :queryData="queryData.data"></PurchaseRefund>
-        <PurchasePayment ref="makeDom" v-else-if="flowForm.flowKey == 'pay_flow'" :queryData="queryData.data"></PurchasePayment>
+        <PurchasePayment ref="makeDom"  @auxiliaryChange='(e) => getAuxiliaryData(e)' v-else-if="flowForm.flowKey == 'pay_flow'" :queryData="queryData.data"></PurchasePayment>
         <template v-else-if="flowForm.flowKey == 'sale_quotation_flow'">
           <PriceSheetEHSD ref="makeDom" v-if="flowForm.tenantType === 'EHSD'" :queryData="queryData.data"></PriceSheetEHSD>
           <PriceSheet ref="makeDom" v-else :queryData="queryData.data"></PriceSheet>