瀏覽代碼

新功能

cz 1 年之前
父節點
當前提交
48a20346fc

+ 8 - 0
src/components/process/EHSD/Contract.vue

@@ -608,6 +608,7 @@ import useUserStore from "@/store/modules/user";
 import { nextTick, watch } from "vue";
 import { v4 as uuidv4 } from "uuid";
 import * as echarts from "echarts";
+import $bus from "@/bus/index.js";
 
 const userInfo = useUserStore();
 
@@ -1614,6 +1615,9 @@ onMounted(() => {
         // res=proxy.deepClone()
         // res.contractProductList = JSON.parse(res.dataJson).contractProductList;
       }
+      if (res.grossProfitInfoList && res.grossProfitInfoList.length > 0) {
+        $bus.emit("getGrossData", res.grossProfitInfoList);
+      }
       if (!res.fileList) {
         res.fileList = [];
       }
@@ -1791,6 +1795,9 @@ watch(
           // res=proxy.deepClone()
           // res.contractProductList = JSON.parse(res.dataJson).contractProductList;
         }
+        if (res.grossProfitInfoList && res.grossProfitInfoList.length > 0) {
+          $bus.emit("getGrossData", res.grossProfitInfoList);
+        }
         if (!res.fileList) {
           res.fileList = [];
         }
@@ -1905,6 +1912,7 @@ const selectContract = (businessId) => {
               }));
             });
         }
+
         if (!res.fileList) {
           res.fileList = [];
         }

+ 7 - 0
src/components/process/EHSD/ContractChange.vue

@@ -592,6 +592,7 @@ import { useRoute } from "vue-router";
 import useUserStore from "@/store/modules/user";
 import { v4 as uuidv4 } from "uuid";
 import * as echarts from "echarts";
+import $bus from "@/bus/index.js";
 
 const userInfo = useUserStore();
 const showAllData = ref(true);
@@ -1684,6 +1685,9 @@ onMounted(() => {
       // if (res && res.dataJson) {
       //   res = { ...res, ...JSON.parse(res.dataJson) };
       // }
+      if (res.grossProfitInfoList && res.grossProfitInfoList.length > 0) {
+        $bus.emit("getGrossData", res.grossProfitInfoList);
+      }
       if (!res.fileList) {
         res.fileList = [];
       }
@@ -1774,6 +1778,9 @@ onMounted(() => {
       // if (res && res.dataJson) {
       //   res = { ...res, ...JSON.parse(res.dataJson) };
       // }
+      if (res.grossProfitInfoList && res.grossProfitInfoList.length > 0) {
+        $bus.emit("getGrossData", res.grossProfitInfoList);
+      }
       if (res && res.buyCorporationName) {
         proxy
           .post("/customer/selPage", {

+ 4 - 1
src/components/process/EHSD/Purchase.vue

@@ -523,6 +523,7 @@ import Editor from "@/components/Editor/index.vue";
 import { useRoute } from "vue-router";
 import useUserStore from "@/store/modules/user";
 import * as echarts from "echarts";
+import $bus from "@/bus/index.js";
 
 const alreadySelectData = ref([]);
 const userInfo = useUserStore();
@@ -1417,7 +1418,9 @@ onMounted(() => {
             });
           });
       }
-
+      if (res.grossProfitInfoList && res.grossProfitInfoList.length > 0) {
+        $bus.emit("getGrossData", res.grossProfitInfoList);
+      }
       res.purchaseProductList = res.ehsdPurchaseProductList || [];
       if (!res.fileList) {
         res.fileList = [];

+ 7 - 0
src/components/process/EHSD/PurchaseChange.vue

@@ -502,6 +502,7 @@ import Editor from "@/components/Editor/index.vue";
 import { useRoute } from "vue-router";
 import useUserStore from "@/store/modules/user";
 import * as echarts from "echarts";
+import $bus from "@/bus/index.js";
 const alreadySelectData = ref([]);
 const userInfo = useUserStore();
 const route = useRoute();
@@ -1369,6 +1370,9 @@ onMounted(() => {
   if (route.query && route.query.processType) {
     let businessId = route.query.businessId;
     proxy.post("/ehsdPurchase/detail", { id: businessId }).then((res) => {
+      if (res.grossProfitInfoList && res.grossProfitInfoList.length > 0) {
+        $bus.emit("getGrossData", res.grossProfitInfoList);
+      }
       res.purchaseProductList = res.ehsdPurchaseProductList || [];
       if (!res.fileList) {
         res.fileList = [];
@@ -1441,6 +1445,9 @@ onMounted(() => {
   ) {
     let businessId = route.query.businessId;
     proxy.post("/ehsdPurchase/detail", { id: businessId }).then((res) => {
+      if (res.grossProfitInfoList && res.grossProfitInfoList.length > 0) {
+        $bus.emit("getGrossData", res.grossProfitInfoList);
+      }
       res.purchaseProductList = res.ehsdPurchaseProductList || [];
       if (!res.fileList) {
         res.fileList = [];

+ 118 - 6
src/views/EHSD/procurement/profitBudgetEHSD/index.vue

@@ -10,8 +10,12 @@
       ]" @get-list="getList">
     </byTable>
     <div style="padding: 0 20px 0px 20px; background-color: white" v-if="rateStatus">
-      <el-table :data="sourceList.data" v-loading="loading" :height="tableHeight">
-        <el-table-column label="合同编号" prop="code" width="140" fixed />
+      <el-table :data="sourceList.data" v-loading="loading" :height="tableHeight" :row-style="changeStyle">
+        <el-table-column label="合同编号" prop="code" width="140" fixed>
+          <template #default="{ row }">
+            <div style="color: #409eff; cursor: pointer; word-break: break-all" @click="openDetails(row)"> {{ ( row.code) }}</div>
+          </template>
+        </el-table-column>
         <el-table-column label="合同金额" width="140" fixed>
           <template #default="{ row }">
             <div>{{ row.currency }} {{ moneyFormat( row.amount,2) }}</div>
@@ -48,8 +52,50 @@
               <el-popover placement="top-start" :width="600" trigger="hover" @show="showEcharts(row,$index)">
                 <template #default>
                   <div>
-                    <div :ref="row.contractId+$index" style="height:320px">
+                    <div :ref="row.contractId+$index" style="height:250px">
                     </div>
+                    <el-table :data="row.grossProfitInfoListOne" style="width: 100%;margin-top:10px">
+                      <el-table-column prop="createTime" label="时间" width="160" />
+                      <el-table-column label="毛利">
+                        <template #default="scope">
+                          <div>
+                            <span>{{ moneyFormat(scope.row.gross,2) }}</span>
+                          </div>
+                        </template>
+                      </el-table-column>
+                      <el-table-column label="销售合同金额">
+                        <template #default="scope">
+                          <div>
+                            <span v-if="scope.$index>0 && getIsTop(row.grossProfitInfoListOne,scope,'contractAmount')"
+                                  style="position:relative;top:3px">
+                              <el-icon color="#f54a45" :size="18" v-if="getColor(row.grossProfitInfoListOne,scope,'contractAmount')">
+                                <Top />
+                              </el-icon>
+                              <el-icon v-else color="#90d562" :size="18">
+                                <Bottom />
+                              </el-icon>
+                            </span>
+                            {{scope.row.contractCurrency}} {{ moneyFormat(scope.row.contractAmount ,2)}}
+                          </div>
+                        </template>
+                      </el-table-column>
+                      <el-table-column label="采购合同金额">
+                        <template #default="scope">
+                          <div>
+                            <span v-if="scope.$index>0 && getIsTop(row.grossProfitInfoListOne,scope,'purchaseAmount')"
+                                  style="position:relative;top:3px">
+                              <el-icon color="#f54a45" :size="18" v-if="getColor(row.grossProfitInfoListOne,scope,'purchaseAmount')">
+                                <Top />
+                              </el-icon>
+                              <el-icon v-else color="#90d562" :size="18">
+                                <Bottom />
+                              </el-icon>
+                            </span>
+                            CNY {{ moneyFormat(scope.row.purchaseAmount ,2)}}
+                          </div>
+                        </template>
+                      </el-table-column>
+                    </el-table>
                   </div>
                 </template>
                 <template #reference>
@@ -70,7 +116,6 @@
         </el-table-column>
         <el-table-column label="客户名称" prop="customerName" min-width="200" />
         <el-table-column label="业务员" prop="userName" width="120" />
-
         <el-table-column label="应付货款" width="120">
           <template #default="{ row }">
             <div>
@@ -342,6 +387,16 @@ const isSettled = ref([
     value: "0",
   },
 ]);
+const isLoss = ref([
+  {
+    label: "亏",
+    value: "1",
+  },
+  {
+    label: "盈",
+    value: "0",
+  },
+]);
 const selectConfig = computed(() => {
   return [
     {
@@ -354,6 +409,11 @@ const selectConfig = computed(() => {
       prop: "isSettled",
       data: isSettled.value,
     },
+    {
+      label: "盈亏",
+      prop: "isLoss",
+      data: isLoss.value,
+    },
   ];
 });
 const config = computed(() => {
@@ -517,7 +577,15 @@ const getList = async (req) => {
   proxy
     .post("/contract/getProfitBudgetPage", sourceList.value.pagination)
     .then((res) => {
-      sourceList.value.data = res.rows;
+      sourceList.value.data = res.rows.map((x) => {
+        return {
+          ...x,
+          grossProfitInfoListOne: x.grossProfitInfoList.slice(
+            1,
+            x.grossProfitInfoList.length
+          ),
+        };
+      });
       sourceList.value.pagination.total = res.total;
       setTimeout(() => {
         loading.value = false;
@@ -926,9 +994,12 @@ const optionTwo = reactive({
         ${params[0].seriesName}:${params[0].data} 
         <br/> 销售合同金额:${
           showRowData.value.grossProfitInfoList[params[0].dataIndex + 1]
+            .contractCurrency
+        } ${
+          showRowData.value.grossProfitInfoList[params[0].dataIndex + 1]
             .contractAmount
         }
-        <br/> 采购合同金额:${
+        <br/> 采购合同金额:CNY ${
           showRowData.value.grossProfitInfoList[params[0].dataIndex + 1]
             .purchaseAmount
         }`;
@@ -982,6 +1053,47 @@ const showEcharts = (row, index) => {
   myChart.setOption(optionTwo.data);
   myChart.resize();
 };
+
+const openDetails = (row) => {
+  proxy.$router.push({
+    name: "contractDetails",
+    query: {
+      currentContractId: row.contractId,
+    },
+  });
+};
+
+const changeStyle = ({ row }) => {
+  if (row.gross < 0) {
+    return {
+      color: "#f54a45",
+    };
+  }
+};
+
+const getIsTop = (data, sonRow, att) => {
+  // 上一行
+  const row1 = data[sonRow.$index - 1];
+  // 当前行
+  const row2 = sonRow.row;
+  if (Number(row1[att]) == Number(row2[att])) {
+    return false;
+  } else {
+    return true;
+  }
+};
+
+const getColor = (data, sonRow, att) => {
+  // 上一行
+  const row1 = data[sonRow.$index - 1];
+  // 当前行
+  const row2 = sonRow.row;
+  if (Number(row2[att]) > Number(row1[att])) {
+    return true;
+  } else {
+    return false;
+  }
+};
 </script>
 
 <style lang="scss" scoped>

+ 38 - 2
src/views/EHSD/procurement/profitSettlementEHSD/index.vue

@@ -4,8 +4,12 @@
              :selectConfig="selectConfig" highlight-current-row :onMoreSearch="true" @moreSearch="clickMoreSearch" @get-list="getList">
     </byTable>
     <div style="padding: 0 20px 0px 20px; background-color: white">
-      <el-table v-loading="loading" :data="sourceList.data" :height="tableHeight">
-        <el-table-column label="合同编号" prop="code" width="130" fixed />
+      <el-table v-loading="loading" :data="sourceList.data" :height="tableHeight" :row-style="changeStyle">
+        <el-table-column label="合同编号" prop="code" width="140" fixed>
+          <template #default="{ row }">
+            <div style="color: #409eff; cursor: pointer; word-break: break-all" @click="openDetails(row)"> {{ ( row.code) }}</div>
+          </template>
+        </el-table-column>
         <el-table-column label="合同金额" width="140" fixed="">
           <template #default="{ row }">
             <div>{{ row.currency }} {{ moneyFormat( row.amount,2) }}</div>
@@ -237,6 +241,16 @@ const isSettled = ref([
     value: "0",
   },
 ]);
+const isLoss = ref([
+  {
+    label: "亏",
+    value: "1",
+  },
+  {
+    label: "盈",
+    value: "0",
+  },
+]);
 const selectConfig = computed(() => {
   return [
     {
@@ -244,6 +258,11 @@ const selectConfig = computed(() => {
       prop: "isSettled",
       data: isSettled.value,
     },
+    {
+      label: "盈亏",
+      prop: "isLoss",
+      data: isLoss.value,
+    },
   ];
 });
 
@@ -423,6 +442,23 @@ const moreSearchReset = () => {
   };
   moreSearchQuery();
 };
+
+const openDetails = (row) => {
+  proxy.$router.push({
+    name: "contractDetails",
+    query: {
+      currentContractId: row.contractId,
+    },
+  });
+};
+
+const changeStyle = ({ row }) => {
+  if (row.gross < 0) {
+    return {
+      color: "#f54a45",
+    };
+  }
+};
 </script>
 
 <style lang="scss" scoped>

+ 116 - 7
src/views/process/processApproval/index.vue

@@ -111,10 +111,22 @@
     <div class="right-card">
       <el-tabs v-model="activeName" class="demo-tabs">
         <el-tab-pane label="处理意见" name="first" v-if="isShowSubmitDom">
-          <div style="overflow: auto; height: calc(100vh - 240px)">
+          <div style="overflow: auto; height: calc(100vh - 200px)">
+            <div style="padding-bottom:50px"
+                 v-if="(userInfo.roles.includes('ceo') || userInfo.roles.includes('salesDirector') ||
+                 userInfo.roles.includes('financeOfficer') || userInfo.roles.includes('approve_ accountant')) && (route.query.processType==10 || route.query.processType==30) &&(chartData && chartData.length>0)">
+              <div style="margin-bottom:10px;">
+                <TitleInfo :content="'利润预算波动'"></TitleInfo>
+              </div>
+              <div ref="chartDom" style="height:150px"></div>
+            </div>
+
+            <div style="margin-bottom:10px">
+              <TitleInfo :content="'办理'"></TitleInfo>
+            </div>
             <el-form :model="flowForm" :rules="flowRules" ref="flowFormDom">
               <el-form-item prop="remark" label-width="0px" label="">
-                <el-input type="textarea" placeholder="请输入" :rows="10" v-model="flowForm.remark">
+                <el-input type="textarea" placeholder="请输入" :rows="3" v-model="flowForm.remark">
                 </el-input>
               </el-form-item>
               <el-form-item prop="remark" label-width="80px" label="附件上传">
@@ -132,6 +144,7 @@
                            @click="handleSubmit(i.type)" style="margin-bottom:10px">{{ i.name }}</el-button>
               </el-form-item>
             </el-form>
+
           </div>
 
         </el-tab-pane>
@@ -169,11 +182,11 @@
             </li>
           </ul>
         </el-tab-pane>
-        <el-tab-pane label="决策辅助" name="three" v-if="auxiliaryData.length > 0">
+        <!-- <el-tab-pane label="决策辅助" name="three" v-if="auxiliaryData.length > 0">
           <div style="overflow: auto; height: calc(100vh - 200px)">
             <auxiliary :data="auxiliaryData"></auxiliary>
           </div>
-        </el-tab-pane>
+        </el-tab-pane> -->
       </el-tabs>
     </div>
 
@@ -231,6 +244,12 @@ import PurchasePayment from "@/components/process/PurchasePayment";
 
 import { computed, ref, watch } from "vue";
 
+import useUserStore from "@/store/modules/user";
+const userInfo = useUserStore();
+import $bus from "@/bus/index.js";
+import * as echarts from "echarts";
+import TitleInfo from "@/components/TitleInfo/index.vue";
+
 const router = useRouter();
 const route = useRoute();
 // 传参
@@ -646,6 +665,69 @@ const getRecords = (_id) => {
   }
 };
 const isShowSubmitDom = ref(true);
+const chartDom = ref(null);
+const chartData = ref([]);
+let myChart = null;
+const optionTwo = reactive({
+  data: {
+    tooltip: {
+      trigger: "axis",
+    },
+    // legend: {
+    //   data: ["价格"],
+    // },
+    grid: {
+      left: "3%",
+      right: "6%",
+      top: "10%",
+      bottom: "3%",
+      containLabel: true,
+    },
+    tooltip: {
+      show: true,
+      trigger: "axis",
+      // 格式化函数
+      // valueFormatter: (val) => {
+      //   return val + "aaa";
+      // },
+      formatter: (params, ticket, callback) => {
+        return `
+        ${params[0].axisValue}
+        <br/> 
+        ${params[0].seriesName}:${params[0].data} 
+        <br/> 销售合同金额:${
+          chartData.value[params[0].dataIndex].contractCurrency
+        } ${chartData.value[params[0].dataIndex].contractAmount}
+        <br/> 采购合同金额:CNY ${
+          chartData.value[params[0].dataIndex].purchaseAmount
+        }`;
+      },
+      textStyle: {
+        fontSize: 12,
+      },
+    },
+    // toolbox: {
+    //   feature: {
+    //     saveAsImage: {},
+    //   },
+    // },
+    xAxis: {
+      type: "category",
+      boundaryGap: false,
+      data: [],
+    },
+    yAxis: {
+      type: "value",
+    },
+    series: [
+      {
+        name: "毛利",
+        type: "line",
+        data: [],
+      },
+    ],
+  },
+});
 onMounted(async () => {
   // 路由进入
   if (route.query && route.query.flowKey) {
@@ -673,7 +755,33 @@ onMounted(async () => {
     flowForm.submitType = route.query.submitType;
     getRecords(route.query.id);
   }
+
+  $bus.on("getGrossData", (data) => {
+    // if (data && data.length > 1) {
+    //   myChart = echarts.init(chartDom.value);
+    //   window.addEventListener("resize", () => {
+    //     myChart.resize();
+    //   });
+    //   chartData.value = data.slice(1, data.length);
+    //   optionTwo.data.xAxis.data = chartData.value.map((item) => {
+    //     return item.createTime.slice(0, 10);
+    //   });
+    //   optionTwo.data.series[0].data = chartData.value.map((item) => {
+    //     return item.gross;
+    //   });
+    //   myChart.setOption(optionTwo.data);
+    //   myChart.resize();
+    // } else {
+    //   return;
+    // }
+  });
 });
+
+onBeforeUnmount(() => {
+  // 取消订阅特定事件
+  $bus.off("getGrossData");
+});
+
 watch(
   () => props.query,
   () => {
@@ -742,8 +850,8 @@ const getFlowName = () => {
     border-radius: 4px;
     // padding: 20px;
     // flex: 1;
-    width: calc(100% - 350px - 20px);
-    margin-right: 20px;
+    width: calc(100% - 350px - 10px);
+    margin-right: 10px;
     display: flex;
     flex-direction: column;
     .top {
@@ -769,7 +877,8 @@ const getFlowName = () => {
   .right-card {
     background: #fff;
     border-radius: 4px;
-    padding: 0 20px 20px;
+    // padding: 0 20px 20px;
+    padding: 0 20px 5px;
     width: 350px;
     box-sizing: border-box;
     .flow-chart {