cz hace 1 año
padre
commit
60d0d7cab8

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

@@ -1760,6 +1760,9 @@ onMounted(() => {
   if (route.query && route.query.businessId && route.query.processType) {
     let businessId = route.query.businessId;
     proxy.post("/contract/detail", { id: businessId }).then((res) => {
+      if (res && res.dataJson) {
+        res = { ...res, ...JSON.parse(res.dataJson) };
+      }
       if (!res.fileList) {
         res.fileList = [];
       }
@@ -1834,6 +1837,9 @@ const clickCopy = () => {
 const selectContract = (businessId) => {
   if (businessId) {
     proxy.post("/contract/detail", { id: businessId }).then((res) => {
+      if (res && res.dataJson) {
+        res = { ...res, ...JSON.parse(res.dataJson) };
+      }
       if (res && res.buyCorporationName) {
         proxy
           .post("/customer/selPage", { keyword: res.buyCorporationName })

+ 31 - 5
src/components/process/EHSD/ContractChange.vue

@@ -390,7 +390,7 @@
       <template #delivery>
         <div style="width: 100%">
           <el-row style="margin-top: 20px; width: 100%">
-            <el-col :span="6">
+            <el-col :span="6" v-show="showAllData">
               <el-form-item label="报价有效期 (天)" prop="effective">
                 <el-input-number
                   onmousewheel="return false;"
@@ -537,7 +537,7 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column label="单价" width="140">
+            <el-table-column label="单价" width="140" v-if="showAllData">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
                   <el-form-item
@@ -560,7 +560,7 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column label="贸易方式" width="140">
+            <el-table-column label="贸易方式" width="140" v-if="showAllData">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
                   <el-form-item
@@ -590,6 +590,7 @@
               prop="amount"
               :label="'金额 ( ' + formData.data.currency + ' )'"
               width="130"
+              v-if="showAllData"
             />
             <el-table-column
               label="操作"
@@ -838,7 +839,9 @@ import CustomerProduct from "@/views/EHSD/productLibrary/customerProduct/index";
 import { ElMessage } from "element-plus";
 import selectCity from "@/components/selectCity/index.vue";
 import { useRoute } from "vue-router";
-
+import useUserStore from "@/store/modules/user";
+const userInfo = useUserStore();
+const showAllData = ref(true);
 const route = useRoute();
 const { proxy } = getCurrentInstance();
 const innerMethod = ref([]);
@@ -899,6 +902,7 @@ const formConfig = computed(() => {
       type: "title",
       title: "合同模板",
       label: "",
+      isShow: showAllData.value,
     },
     {
       type: "select",
@@ -908,23 +912,27 @@ const formConfig = computed(() => {
       fn: (val) => {
         changeTemplate(val);
       },
+      isShow: showAllData.value,
     },
     {
       type: "slot",
       slotName: "seller",
       label: "卖方信息",
       itemWidth: 50,
+      isShow: showAllData.value,
     },
     {
       type: "slot",
       slotName: "buyer",
       label: "买方信息",
       itemWidth: 50,
+      isShow: showAllData.value,
     },
     {
       type: "slot",
       slotName: "payment",
       label: "付款信息",
+      isShow: showAllData.value,
     },
     {
       type: "slot",
@@ -950,10 +958,12 @@ const formConfig = computed(() => {
       type: "slot",
       slotName: "otherCharge",
       label: "其他收费项目",
+      isShow: showAllData.value,
     },
     {
       type: "slot",
       slotName: "offerMoney",
+      isShow: showAllData.value,
     },
     {
       type: "slot",
@@ -1719,11 +1729,14 @@ watch(
 );
 
 onMounted(() => {
+  checkShow();
   formOption.disabled = judgeStatus();
-  console.log(route.query, "qqda");
   if (route.query && route.query.businessId && route.query.processType) {
     let businessId = route.query.businessId;
     proxy.post("/contract/detail", { id: businessId }).then((res) => {
+      if (res && res.dataJson) {
+        res = { ...res, ...JSON.parse(res.dataJson) };
+      }
       if (!res.fileList) {
         res.fileList = [];
       }
@@ -1795,6 +1808,9 @@ onMounted(() => {
   ) {
     let businessId = route.query.businessId;
     proxy.post("/contract/detail", { id: businessId }).then((res) => {
+      if (res && res.dataJson) {
+        res = { ...res, ...JSON.parse(res.dataJson) };
+      }
       if (res && res.buyCorporationName) {
         proxy
           .post("/customer/selPage", { keyword: res.buyCorporationName })
@@ -1895,6 +1911,16 @@ onMounted(() => {
     });
   }
 });
+
+const checkShow = () => {
+  if (
+    userInfo.roles.includes("purchasingOfficer") &&
+    route.query.flowKey == "contract_update_flow" &&
+    route.query.processType
+  ) {
+    showAllData.value = false;
+  }
+};
 </script>
 
 <style lang="scss" scoped>

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

@@ -1645,6 +1645,9 @@ onMounted(() => {
   if (route.query && route.query.processType) {
     let businessId = route.query.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;

+ 24 - 3
src/components/process/EHSD/SampleChange.vue

@@ -390,7 +390,7 @@
       <template #delivery>
         <div style="width: 100%">
           <el-row style="margin-top: 20px; width: 100%">
-            <el-col :span="6">
+            <el-col :span="6" v-show="showAllData">
               <el-form-item label="报价有效期 (天)" prop="effective">
                 <el-input-number
                   onmousewheel="return false;"
@@ -523,7 +523,7 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column label="单价" width="140">
+            <el-table-column label="单价" width="140" v-if="showAllData">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
                   <el-form-item
@@ -546,7 +546,7 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column label="贸易方式" width="140">
+            <el-table-column label="贸易方式" width="140" v-if="showAllData">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
                   <el-form-item
@@ -589,6 +589,7 @@
               prop="amount"
               :label="'金额 ( ' + formData.data.currency + ' )'"
               width="130"
+              v-if="showAllData"
             />
             <el-table-column
               label="操作"
@@ -838,6 +839,9 @@ import { ElMessage } from "element-plus";
 import selectCity from "@/components/selectCity/index.vue";
 import { useRoute } from "vue-router";
 import { onMounted } from "vue";
+import useUserStore from "@/store/modules/user";
+const userInfo = useUserStore();
+const showAllData = ref(true);
 
 const route = useRoute();
 const { proxy } = getCurrentInstance();
@@ -901,6 +905,7 @@ const formConfig = computed(() => {
       type: "title",
       title: "合同模板",
       label: "",
+      isShow: showAllData.value,
     },
     {
       type: "select",
@@ -910,23 +915,27 @@ const formConfig = computed(() => {
       fn: (val) => {
         changeTemplate(val);
       },
+      isShow: showAllData.value,
     },
     {
       type: "slot",
       slotName: "seller",
       label: "卖方信息",
       itemWidth: 50,
+      isShow: showAllData.value,
     },
     {
       type: "slot",
       slotName: "buyer",
       label: "买方信息",
       itemWidth: 50,
+      isShow: showAllData.value,
     },
     {
       type: "slot",
       slotName: "payment",
       label: "付款信息",
+      isShow: showAllData.value,
     },
     {
       type: "slot",
@@ -952,10 +961,12 @@ const formConfig = computed(() => {
       type: "slot",
       slotName: "otherCharge",
       label: "其他收费项目",
+      isShow: showAllData.value,
     },
     {
       type: "slot",
       slotName: "offerMoney",
+      isShow: showAllData.value,
     },
     {
       type: "slot",
@@ -1641,6 +1652,7 @@ const clickDelete = (index) => {
   formData.data.sampleShipmentList.splice(index, 1);
 };
 onMounted(() => {
+  checkShow();
   formOption.disabled = judgeStatus();
   if (route.query && route.query.processType) {
     let businessId = route.query.businessId;
@@ -1789,6 +1801,15 @@ onMounted(() => {
     });
   }
 });
+const checkShow = () => {
+  if (
+    userInfo.roles.includes("purchasingOfficer") &&
+    route.query.flowKey == "sample_update_flow" &&
+    route.query.processType
+  ) {
+    showAllData.value = false;
+  }
+};
 </script>
 
 <style lang="scss" scoped>

+ 1 - 0
src/main.js

@@ -114,6 +114,7 @@ app.config.globalProperties.getImgBase64 = getImgBase64
 
 
 
+
 // 全局组件挂载
 app.component('DictTag', DictTag)
 app.component('Pagination', Pagination)

+ 18 - 30
src/utils/request.js

@@ -153,37 +153,25 @@ service.interceptors.response.use(res => {
   }
 )
 // 通用下载方法
-export function download(url, params, filename, config) {
-  downloadLoadingInstance = ElLoading.service({
-    text: "正在下载数据,请稍候",
-    background: "rgba(0, 0, 0, 0.7)",
-  })
-  return service.post(url, params, {
-    transformRequest: [(params) => {
-      return tansParams(params)
-    }],
-    headers: {
-      'Content-Type': 'application/x-www-form-urlencoded'
-    },
-    responseType: 'blob',
-    ...config
-  }).then(async (data) => {
-    const isLogin = await blobValidate(data);
-    if (isLogin) {
-      const blob = new Blob([data])
-      saveAs(blob, filename)
-    } else {
-      const resText = await data.text();
-      const rspObj = JSON.parse(resText);
-      const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
-      ElMessage.error(errMsg);
+export function download(fileUrl, fileName) {
+  let xhr = new XMLHttpRequest();
+  //域名是华为云的
+  xhr.open("GET", `${fileUrl}`, true);
+  xhr.responseType = "blob";
+  xhr.send();
+  xhr.onreadystatechange = function () {
+    if (xhr.readyState === 4 && xhr.status === 200) {
+      let url = window.URL.createObjectURL(xhr.response);
+      const a = document.createElement("a");
+      a.href = url;
+      a.download = fileName; // 下载后文件名
+      a.style.display = "none";
+      document.body.appendChild(a);
+      a.click(); // 点击下载
+      window.URL.revokeObjectURL(a.href);
+      document.body.removeChild(a); // 下载完成移除元素
     }
-    downloadLoadingInstance.close();
-  }).catch((r) => {
-    console.error(r)
-    ElMessage.error('下载文件出现错误,请联系管理员!')
-    downloadLoadingInstance.close();
-  })
+  };
 }
 
 

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

@@ -173,7 +173,7 @@
                     v-if="fileObj[item.flowExampleDetailId]"
                   >
                     <a
-                      :href="j.fileUrl"
+                      @click="proxy.download(j.fileUrl, j.fileName)"
                       style="color: #409eff; line-height: 30px"
                       >{{ j.fileName }}</a
                     >
@@ -361,6 +361,7 @@ const handleSubmit = async (_type) => {
               );
             }
           } else if (flowForm.flowKey == "contract_flow") {
+            data.dataJson = JSON.stringify(proxy.deepClone(data));
             if (data.fileList && data.fileList.length > 0) {
               data.fileList = data.fileList.map((item) => {
                 return {
@@ -397,6 +398,7 @@ const handleSubmit = async (_type) => {
               };
             });
           } else if (flowForm.flowKey == "contract_update_flow") {
+            data.dataJson = JSON.stringify(proxy.deepClone(data));
             if (data.fileList && data.fileList.length > 0) {
               data.fileList = data.fileList.map((item) => {
                 return {
@@ -433,6 +435,7 @@ const handleSubmit = async (_type) => {
               };
             });
           } else if (flowForm.flowKey == "sample_flow") {
+            data.dataJson = JSON.stringify(proxy.deepClone(data));
             if (data.fileList && data.fileList.length > 0) {
               data.fileList = data.fileList.map((item) => {
                 return {