Quellcode durchsuchen

销售合同 决策辅助

lxf vor 1 Jahr
Ursprung
Commit
be2bc8913c

+ 85 - 6
src/components/process/Contract.vue

@@ -818,14 +818,93 @@ const changeCustomer = (val) => {
     formData.data.buyPostalCode = "";
     formData.data.buyAddress = "";
   }
-  getDecisionAids()
+  getDecisionAids();
 };
+let auxiliaryData = ref([
+  {
+    label: "最近合同",
+    data: [],
+  },
+  {
+    label: "产品价格",
+    data: [],
+  },
+]);
+const emit = defineEmits(["auxiliaryChange"]);
 const getDecisionAids = () => {
   let data = {
-    
+    buyCorporationId: formData.data.buyCorporationId,
+    productIdList: [],
+  };
+  if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
+    data.productIdList = formData.data.contractProductList.map((item) => item.productId);
   }
-  // Pubsub.publish("refreshDecisionAids", formData.data.buyCorporationId);
-}
+  proxy.post("/contract/decisionAid", data).then((res) => {
+    if (res.lastContractList && res.lastContractList.length > 0) {
+      auxiliaryData.value[0].data = res.lastContractList.map((item) => {
+        return [
+          {
+            label: "合同编号",
+            value: item.code,
+            style: {
+              color: "#0084FF",
+            },
+            id: item.id,
+            num: 1,
+            // fn: () => {},
+          },
+          {
+            label: "下单日期",
+            value: item.createTime,
+            id: item.id,
+            num: 1,
+          },
+          {
+            label: "合同金额",
+            value: item.currency + item.amount,
+            id: item.id,
+            num: 1,
+          },
+        ];
+      });
+    } else {
+      auxiliaryData.value[0].data = [];
+    }
+    if (res.productPriceList && res.productPriceList.length > 0) {
+      auxiliaryData.value[1].data = res.productPriceList.map((item) => {
+        return [
+          {
+            label: "产品名称",
+            value: item.name,
+            id: item.id,
+            num: 1,
+          },
+          {
+            label: "最近价格",
+            value: item.lastPrice,
+            id: item.id,
+            num: 1,
+          },
+          {
+            label: "历史最高",
+            value: item.maxPrice,
+            id: item.id,
+            num: 1,
+          },
+          {
+            label: "历史最低",
+            value: item.minPrice,
+            id: item.id,
+            num: 1,
+          },
+        ];
+      });
+    } else {
+      auxiliaryData.value[1].data = [];
+    }
+    emit("auxiliaryChange", auxiliaryData.value);
+  });
+};
 const createFilter = (queryString) => {
   return (restaurant) => {
     return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0;
@@ -904,7 +983,7 @@ const pushGoods = (goods) => {
       type: "success",
     });
     openProduct.value = false;
-    getDecisionAids()
+    getDecisionAids();
   } else {
     ElMessage("请选择至少一件商品");
   }
@@ -1028,7 +1107,7 @@ const handleRemove = async (index, row) => {
   formData.data.contractShipmentList = formData.data.contractShipmentList.filter((item) => item.productId !== row.productId);
   await formData.data.contractProductList.splice(index, 1);
   totalAmount();
-  getDecisionAids()
+  getDecisionAids();
 };
 const calculationAmount = () => {
   nextTick(() => {

+ 0 - 20
src/views/process/processApproval/decisionAids.vue

@@ -1,20 +0,0 @@
-<template>
-  <div class="tenant">1111</div>
-</template>
-
-<script setup>
-import Pubsub from "pubsub-js";
-
-onMounted(() => {
-  Pubsub.subscribe("refreshDecisionAids", changeMessage);
-});
-const changeMessage = (type, val) => {
-  console.log(type, val);
-};
-</script>
-
-<style lang="scss" scoped>
-.tenant {
-  padding: 20px;
-}
-</style>

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

@@ -18,7 +18,7 @@
         </template>
         <template v-else-if="flowForm.flowKey == 'contract_flow'">
           <ContractEHSD ref="makeDom" v-if="flowForm.tenantType === 'EHSD'" :queryData="queryData.data"></ContractEHSD>
-          <Contract ref="makeDom" v-else :queryData="queryData.data"></Contract>
+          <Contract ref="makeDom" v-else :queryData="queryData.data" @auxiliaryChange='(e) => getAuxiliaryData(e)'></Contract>
         </template>
         <template v-else-if="flowForm.flowKey == 'sample_flow'">
           <SampleEHSD ref="makeDom" :queryData="queryData.data"></SampleEHSD>
@@ -82,9 +82,6 @@
         </el-tab-pane>
         <!-- v-if="flowForm.flowKey == 'contract_flow' && flowForm.tenantType !== 'EHSD'" -->
         <el-tab-pane label="决策辅助" name="second" v-if="auxiliaryData.length > 0">
-          <!-- <div style="overflow-y: auto; max-height: calc(100vh - 200px)">
-            <DecisionAids></DecisionAids>
-          </div> -->
           <div style="overflow: auto; height: calc(100vh - 200px)">
           <auxiliary :data="auxiliaryData"></auxiliary>
 
@@ -119,7 +116,6 @@ import { useRouter, useRoute } from "vue-router";
 //决策辅助
 import auxiliary from "./auxiliary";
 import purchaseAuxiliary from "./purchaseAuxiliary";
-import DecisionAids from "./decisionAids";
 
 //申购发起
 import SendSubscribe from "@/components/process/SendSubscribe";