Browse Source

流程详情页面用组件打开

cz 1 year ago
parent
commit
22c432b9fb

+ 41 - 14
src/components/contractCom/contractDetails.vue

@@ -32,12 +32,16 @@
             style="text-align: right; margin-bottom: 20px"
             style="text-align: right; margin-bottom: 20px"
             v-if="activeName === 'first'"
             v-if="activeName === 'first'"
           >
           >
-            <el-button type="primary" @click="pushProcessApproval(currentItem)"
+            <!-- <el-button type="primary" @click="pushProcessApproval(currentItem)"
               >查看详情</el-button
               >查看详情</el-button
+            > -->
+            <el-button type="primary" @click="openPDF(currentItem)"
+              >查看PDF</el-button
             >
             >
           </div>
           </div>
           <div v-if="activeName === 'first'">
           <div v-if="activeName === 'first'">
-            <ContractPDFOne :rowData="rowData"></ContractPDFOne>
+            <!-- <ContractPDFOne :rowData="rowData"></ContractPDFOne> -->
+            <ApprovalDetails :query="approvalData"></ApprovalDetails>
           </div>
           </div>
           <div v-if="activeName === 'second'">
           <div v-if="activeName === 'second'">
             <PurchasePDFOne :rowData="rowDataOne"></PurchasePDFOne>
             <PurchasePDFOne :rowData="rowDataOne"></PurchasePDFOne>
@@ -67,12 +71,20 @@
         </template>
         </template>
       </byTable>
       </byTable>
     </div>
     </div>
+
+    <el-dialog title="PDF查看" v-if="pdfDialog" v-model="pdfDialog" width="920">
+      <ContractPDFOne :rowData="rowData"></ContractPDFOne>
+      <template #footer>
+        <el-button @click="pdfDialog = false" size="large">关闭</el-button>
+      </template>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
 <script setup  >
 <script setup  >
 import PurchasePDFOne from "@/components/PDF/purchasePDFOne.vue";
 import PurchasePDFOne from "@/components/PDF/purchasePDFOne.vue";
 import ContractPDFOne from "@/components/PDF/contractPDFOne.vue";
 import ContractPDFOne from "@/components/PDF/contractPDFOne.vue";
+import ApprovalDetails from "@/views/process/processApproval/index.vue";
 
 
 import byTable from "@/components/byTable/index";
 import byTable from "@/components/byTable/index";
 const { proxy } = getCurrentInstance();
 const { proxy } = getCurrentInstance();
@@ -83,6 +95,7 @@ const props = defineProps({
 });
 });
 const activeName = ref("first");
 const activeName = ref("first");
 const currentItem = ref({});
 const currentItem = ref({});
+const approvalData = ref({});
 const rowData = ref({});
 const rowData = ref({});
 const rowDataOne = ref({});
 const rowDataOne = ref({});
 const leftList = ref([]);
 const leftList = ref([]);
@@ -157,8 +170,17 @@ const handleClick = () => {};
 const handleItemClick = (item) => {
 const handleItemClick = (item) => {
   currentItem.value = item;
   currentItem.value = item;
   if (activeName.value === "first") {
   if (activeName.value === "first") {
-    rowData.value = {
-      id: item.id,
+    // rowData.value = {
+    //   id: item.id,
+    // };
+    approvalData.value = {
+      flowKey: "contract_flow",
+      id: currentItem.value.flowId,
+      processType: 20,
+      random: proxy.random(),
+      flowName: "销售合同详情",
+      tenantType: "EHSD",
+      businessId: currentItem.value.id,
     };
     };
   } else if (activeName.value === "second") {
   } else if (activeName.value === "second") {
     rowDataOne.value = {
     rowDataOne.value = {
@@ -166,6 +188,13 @@ const handleItemClick = (item) => {
     };
     };
   }
   }
 };
 };
+const pdfDialog = ref(false);
+const openPDF = (row) => {
+  rowData.value = {
+    id: row.id,
+  };
+  pdfDialog.value = true;
+};
 
 
 const pushProcessApproval = (row) => {
 const pushProcessApproval = (row) => {
   proxy.$router.push({
   proxy.$router.push({
@@ -212,15 +241,13 @@ const handleChange = (val) => {
   }
   }
 };
 };
 const getDetailsData = (id) => {
 const getDetailsData = (id) => {
-  proxy
-    .post("/contract/getVersionList", { id: id })
-    .then((res) => {
-      contractDataList.value = res;
-      leftList.value = contractDataList.value;
-      if (contractDataList.value && contractDataList.value.length > 0) {
-        handleItemClick(contractDataList.value[0]);
-      }
-    });
+  proxy.post("/contract/getVersionList", { id: id }).then((res) => {
+    contractDataList.value = res;
+    leftList.value = contractDataList.value;
+    if (contractDataList.value && contractDataList.value.length > 0) {
+      handleItemClick(contractDataList.value[0]);
+    }
+  });
   proxy
   proxy
     .post("/contract/getPurchaseListByContractId", { id: id })
     .post("/contract/getPurchaseListByContractId", { id: id })
     .then((res) => {
     .then((res) => {
@@ -235,7 +262,7 @@ const getDetailsData = (id) => {
       tableData.value = res;
       tableData.value = res;
     });
     });
 };
 };
-if(props.contractId){
+if (props.contractId) {
   getDetailsData(props.contractId);
   getDetailsData(props.contractId);
 }
 }
 if (route.query.currentContractId) {
 if (route.query.currentContractId) {

+ 34 - 4
src/components/contractCom/contractDetailsOne.vue

@@ -35,12 +35,16 @@
             style="text-align: right; margin-bottom: 20px"
             style="text-align: right; margin-bottom: 20px"
             v-if="activeName === 'first'"
             v-if="activeName === 'first'"
           >
           >
-            <el-button type="primary" @click="pushProcessApproval(currentItem)"
+            <!-- <el-button type="primary" @click="pushProcessApproval(currentItem)"
               >查看详情</el-button
               >查看详情</el-button
+            > -->
+            <el-button type="primary" @click="openPDF(currentItem)"
+              >查看PDF</el-button
             >
             >
           </div>
           </div>
           <div v-if="activeName === 'first'">
           <div v-if="activeName === 'first'">
-            <SamplePDF :rowData="rowData"></SamplePDF>
+            <!-- <SamplePDF :rowData="rowData"></SamplePDF> -->
+            <ApprovalDetails :query="approvalData"></ApprovalDetails>
           </div>
           </div>
           <div v-if="activeName === 'second'">
           <div v-if="activeName === 'second'">
             <PurchasePDFOne :rowData="rowDataOne"></PurchasePDFOne>
             <PurchasePDFOne :rowData="rowDataOne"></PurchasePDFOne>
@@ -70,6 +74,12 @@
         </template>
         </template>
       </byTable>
       </byTable>
     </div>
     </div>
+    <el-dialog title="PDF查看" v-if="pdfDialog" v-model="pdfDialog" width="920">
+      <SamplePDF :rowData="rowData"></SamplePDF>
+      <template #footer>
+        <el-button @click="pdfDialog = false" size="large">关闭</el-button>
+      </template>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -77,6 +87,8 @@
 import PurchasePDFOne from "@/components/PDF/purchasePDFOne.vue";
 import PurchasePDFOne from "@/components/PDF/purchasePDFOne.vue";
 import SamplePDF from "@/components/PDF/samplePDF.vue";
 import SamplePDF from "@/components/PDF/samplePDF.vue";
 import byTable from "@/components/byTable/index";
 import byTable from "@/components/byTable/index";
+import ApprovalDetails from "@/views/process/processApproval/index.vue";
+
 const { proxy } = getCurrentInstance();
 const { proxy } = getCurrentInstance();
 import { useRoute } from "vue-router";
 import { useRoute } from "vue-router";
 const route = useRoute();
 const route = useRoute();
@@ -86,6 +98,7 @@ const props = defineProps({
 });
 });
 const activeName = ref("first");
 const activeName = ref("first");
 const currentItem = ref({});
 const currentItem = ref({});
+const approvalData = ref({});
 const rowData = ref({});
 const rowData = ref({});
 const rowDataOne = ref({});
 const rowDataOne = ref({});
 const leftList = ref([]);
 const leftList = ref([]);
@@ -160,9 +173,18 @@ const handleClick = () => {};
 const handleItemClick = (item) => {
 const handleItemClick = (item) => {
   currentItem.value = item;
   currentItem.value = item;
   if (activeName.value === "first") {
   if (activeName.value === "first") {
-    rowData.value = {
-      id: item.id,
+    approvalData.value = {
+      flowKey: "sample_flow",
+      id: currentItem.value.flowId,
+      processType: 20,
+      random: proxy.random(),
+      flowName: "样品单详情",
+      tenantType: "EHSD",
+      businessId: currentItem.value.id,
     };
     };
+    // rowData.value = {
+    //   id: item.id,
+    // };
   } else if (activeName.value === "second") {
   } else if (activeName.value === "second") {
     rowDataOne.value = {
     rowDataOne.value = {
       id: item.id,
       id: item.id,
@@ -186,6 +208,14 @@ const pushProcessApproval = (row) => {
   return;
   return;
 };
 };
 
 
+const pdfDialog = ref(false);
+const openPDF = (row) => {
+  rowData.value = {
+    id: row.id,
+  };
+  pdfDialog.value = true;
+};
+
 // const pushProcessApproval = (row) => {
 // const pushProcessApproval = (row) => {
 //   const page = proxy.$router.resolve({
 //   const page = proxy.$router.resolve({
 //     path: "/platform_manage/process/processApproval",
 //     path: "/platform_manage/process/processApproval",

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

@@ -862,6 +862,7 @@ import selectCity from "@/components/selectCity/index.vue";
 import { useRoute } from "vue-router";
 import { useRoute } from "vue-router";
 import SelectContract from "@/components/contractCom/selectContract.vue";
 import SelectContract from "@/components/contractCom/selectContract.vue";
 import useUserStore from "@/store/modules/user";
 import useUserStore from "@/store/modules/user";
+import { watch } from "vue";
 const userInfo = useUserStore();
 const userInfo = useUserStore();
 
 
 const route = useRoute();
 const route = useRoute();
@@ -1825,6 +1826,107 @@ onMounted(() => {
     });
     });
   }
   }
 });
 });
+const judgeStatusOne = () => {
+  if (props.queryData.processType == 20 || props.queryData.processType == 10) {
+    return true;
+  }
+  if (props.queryData.recordList && props.queryData.recordList.length > 0) {
+    let data = props.queryData.recordList.filter(
+      (item) => item.status === 2 && item.nodeType !== 1
+    );
+    if (data && data.length > 0) {
+      return true;
+    }
+  }
+  return false;
+};
+watch(
+  () => props.queryData,
+  (val) => {
+    formOption.disabled = judgeStatusOne();
+    if (val.businessId && val.processType) {
+      let businessId = val.businessId;
+      proxy.post("/contract/detail", { id: businessId }).then((res) => {
+        if (res && res.dataJson) {
+          // res = { ...res, ...JSON.parse(res.dataJson) };
+          // res=proxy.deepClone()
+          // res.contractProductList = JSON.parse(res.dataJson).contractProductList;
+        }
+        if (!res.fileList) {
+          res.fileList = [];
+        }
+        if (!res.packageFileList) {
+          res.packageFileList = [];
+        }
+        res.countryId = res.buyCountryId;
+        res.provinceId = res.buyProvinceId;
+        res.cityId = res.buyCityId;
+        for (const key in res) {
+          formData.data[key] = res[key];
+        }
+        proxy
+          .post("/fileInfo/getList", {
+            businessIdList: [businessId],
+          })
+          .then((fileObj) => {
+            if (fileObj[businessId] && fileObj[businessId].length > 0) {
+              formData.data.fileList = fileObj[businessId]
+                .filter((x) => x.businessType === "1")
+                .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
+              formData.data.packageFileList = fileObj[businessId]
+                .filter((x) => x.businessType === "2")
+                .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
+            }
+          });
+        if (
+          formData.data.contractProductList &&
+          formData.data.contractProductList.length > 0
+        ) {
+          for (let i = 0; i < formData.data.contractProductList.length; i++) {
+            const e = formData.data.contractProductList[i];
+            if (e.ehsdJson) {
+              let obj = JSON.parse(e.ehsdJson);
+              e.packMethod = obj.packMethod;
+              e.tradeMethods = obj.tradeMethods;
+            }
+          }
+          let ids = formData.data.contractProductList.map((x) => x.productId);
+          proxy
+            .post("/fileInfo/getList", {
+              businessIdList: ids,
+            })
+            .then((fileObj) => {
+              for (
+                let i = 0;
+                i < formData.data.contractProductList.length;
+                i++
+              ) {
+                const e = formData.data.contractProductList[i];
+                for (const key in fileObj) {
+                  if (e.productId === key) {
+                    e.fileList = fileObj[key] || [];
+                    if (e.fileList && e.fileList.length > 0) {
+                      e.fileUrl = e.fileList[0].fileUrl;
+                    }
+                  }
+                }
+              }
+            });
+        }
+        if (formData.data.countryId) {
+          getCityData(formData.data.countryId, "20");
+        }
+        if (formData.data.provinceId) {
+          getCityData(formData.data.provinceId, "30");
+        }
+        getDecisionAids();
+      });
+    }
+  },
+  {
+    deep: true,
+  }
+);
 
 
 const clickCopy = () => {
 const clickCopy = () => {
   copyContract.value = true;
   copyContract.value = true;

+ 97 - 0
src/components/process/EHSD/Sample.vue

@@ -1694,6 +1694,103 @@ onMounted(() => {
     });
     });
   }
   }
 });
 });
+const judgeStatusOne = () => {
+  if (props.queryData.processType == 20 || props.queryData.processType == 10) {
+    return true;
+  }
+  if (props.queryData.recordList && props.queryData.recordList.length > 0) {
+    let data = props.queryData.recordList.filter(
+      (item) => item.status === 2 && item.nodeType !== 1
+    );
+    if (data && data.length > 0) {
+      return true;
+    }
+  }
+  return false;
+};
+
+watch(
+  () => props.queryData,
+  (val) => {
+    formOption.disabled = judgeStatusOne();
+    if (val && val.processType) {
+      let businessId = val.businessId;
+      proxy.post("/sample/detail", { id: businessId }).then((res) => {
+        if (res && res.dataJson) {
+          res = { ...res, ...JSON.parse(res.dataJson) };
+        }
+        res.sampleShipmentList = res.sampleShipmentLists;
+        res.countryId = res.buyCountryId;
+        res.provinceId = res.buyProvinceId;
+        res.cityId = res.buyCityId;
+        if (!res.fileList) {
+          res.fileList = [];
+        }
+        if (!res.packageFileList) {
+          res.packageFileList = [];
+        }
+        for (const key in res) {
+          formData.data[key] = res[key];
+        }
+        proxy
+          .post("/fileInfo/getList", {
+            businessIdList: [businessId],
+          })
+          .then((fileObj) => {
+            if (fileObj[businessId] && fileObj[businessId].length > 0) {
+              formData.data.fileList = fileObj[businessId]
+                .filter((x) => x.businessType === "1")
+                .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
+              formData.data.packageFileList = fileObj[businessId]
+                .filter((x) => x.businessType === "2")
+                .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
+            }
+          });
+        if (
+          formData.data.sampleProductList &&
+          formData.data.sampleProductList.length > 0
+        ) {
+          for (let i = 0; i < formData.data.sampleProductList.length; i++) {
+            const e = formData.data.sampleProductList[i];
+            if (e.ehsdJson) {
+              let obj = JSON.parse(e.ehsdJson);
+              e.packMethod = obj.packMethod;
+              e.tradeMethods = obj.tradeMethods;
+            }
+          }
+          let ids = formData.data.sampleProductList.map((x) => x.productId);
+          proxy
+            .post("/fileInfo/getList", {
+              businessIdList: ids,
+            })
+            .then((fileObj) => {
+              for (let i = 0; i < formData.data.sampleProductList.length; i++) {
+                const e = formData.data.sampleProductList[i];
+                for (const key in fileObj) {
+                  if (e.productId === key) {
+                    e.fileList = fileObj[key] || [];
+
+                    if (e.fileList && e.fileList.length > 0) {
+                      e.fileUrl = e.fileList[0].fileUrl;
+                    }
+                  }
+                }
+              }
+            });
+        }
+        if (formData.data.countryId) {
+          getCityData(formData.data.countryId, "20");
+        }
+        if (formData.data.provinceId) {
+          getCityData(formData.data.provinceId, "30");
+        }
+      });
+    }
+  },
+  {
+    deep: true,
+  }
+);
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>

+ 65 - 20
src/views/process/processApproval/index.vue

@@ -3,7 +3,9 @@
     <div class="left-card">
     <div class="left-card">
       <div class="top">
       <div class="top">
         <div class="commons-title title">
         <div class="commons-title title">
-          {{ route.query.flowName || "流程标题(发起)" }}
+          {{
+            route.query.flowName || props.query.flowName || "流程标题(发起)"
+          }}
         </div>
         </div>
         <div class="line"></div>
         <div class="line"></div>
         <!-- 报价单 -->
         <!-- 报价单 -->
@@ -91,7 +93,7 @@
           :queryData="queryData.data"
           :queryData="queryData.data"
         ></SendFunds>
         ></SendFunds>
       </div>
       </div>
-      <div class="bottom" v-if="route.query.processType != 20">
+      <div class="bottom" v-if="isShowSubmitDom">
         <div class="commons-title title">处理意见</div>
         <div class="commons-title title">处理意见</div>
         <el-form :model="flowForm" :rules="flowRules" ref="flowFormDom">
         <el-form :model="flowForm" :rules="flowRules" ref="flowFormDom">
           <el-form-item prop="remark" label-width="0px" label="">
           <el-form-item prop="remark" label-width="0px" label="">
@@ -258,10 +260,14 @@ import SendFunds from "@/components/process/SendFunds";
 // 采购付款
 // 采购付款
 import PurchasePayment from "@/components/process/PurchasePayment";
 import PurchasePayment from "@/components/process/PurchasePayment";
 
 
-import { ref } from "vue";
+import { computed, ref, watch } from "vue";
 
 
 const router = useRouter();
 const router = useRouter();
 const route = useRoute();
 const route = useRoute();
+// 传参
+const props = defineProps({
+  query: Object,
+});
 // tab切换逻辑
 // tab切换逻辑
 const activeName = ref("first");
 const activeName = ref("first");
 let auxiliaryData = ref([]);
 let auxiliaryData = ref([]);
@@ -660,26 +666,65 @@ const getRecords = (_id) => {
       });
       });
   }
   }
 };
 };
+const isShowSubmitDom = ref(true);
 onMounted(async () => {
 onMounted(async () => {
-  //processType 10 为修改 20为查看 30回退发起
-  if (
-    route.query.processType == 10 ||
-    route.query.processType == 20 ||
-    route.query.processType == 30
-  ) {
-    // await proxy
-    //   .post("/flowProcess/getStartData", { flowId: route.query.id })
-    //   .then((res) => {
-    //     queryData.data = { ...res };
-    //   });
-  } else {
-    queryData.data = { ...route.query };
+  // 路由进入
+  if (route.query && route.query.flowKey) {
+    //processType 10 为修改 20为查看 30回退发起
+    if (route.query.processType == 20) {
+      isShowSubmitDom.value = false;
+    }
+    if (
+      route.query.processType == 10 ||
+      route.query.processType == 20 ||
+      route.query.processType == 30
+    ) {
+      // await proxy
+      //   .post("/flowProcess/getStartData", { flowId: route.query.id })
+      //   .then((res) => {
+      //     queryData.data = { ...res };
+      //   });
+    } else {
+      queryData.data = { ...route.query };
+    }
+    flowForm.flowKey = route.query.flowKey;
+    flowForm.tenantType = route.query.tenantType;
+    flowForm.submitType = route.query.submitType;
+    getRecords(route.query.id);
   }
   }
-  flowForm.flowKey = route.query.flowKey;
-  flowForm.tenantType = route.query.tenantType;
-  flowForm.submitType = route.query.submitType;
-  getRecords(route.query.id);
 });
 });
+watch(
+  () => props.query,
+  () => {
+    if (props.query) {
+      if (props.query.processType == 20) {
+        isShowSubmitDom.value = false;
+      }
+      if (
+        props.query.processType == 10 ||
+        props.query.processType == 20 ||
+        props.query.processType == 30
+      ) {
+        // await proxy
+        //   .post("/flowProcess/getStartData", { flowId: props.query.id })
+        //   .then((res) => {
+        //     queryData.data = { ...res };
+        //   });
+        queryData.data = { ...props.query };
+      } else {
+        queryData.data = { ...props.query };
+      }
+      flowForm.flowKey = props.query.flowKey;
+      flowForm.tenantType = props.query.tenantType;
+      flowForm.submitType = props.query.submitType;
+      getRecords(props.query.id);
+    }
+  },
+  {
+    deep: true,
+    immediate: true,
+  }
+);
 </script>
 </script>
 <style>
 <style>
 .el-upload-list {
 .el-upload-list {