zuozhengqing
2023-12-01 bbc5a0a0eb523d0277d55224f303088ebceb5f90
概述-入库跳转参数调整,将localStorage存储修改为query传参
5个文件已修改
40 ■■■■■ 已修改文件
src/router/index.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/overview/AddOverviewDialog.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/overview/OverviewListView.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/overview/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/overview/previewExcel.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js
@@ -119,12 +119,6 @@
    // document.title = to.meta.title
  }
})
router.beforeEach((to, from, next) => {
  if(from.name==="overview"){
    localStorage.removeItem('pdfParams');
  }
  next();
});
// router.beforeEach((to, from, next) => {
// must call `next`
// console.log(to, from)
src/views/overview/AddOverviewDialog.vue
@@ -371,7 +371,6 @@
  },
  methods: {
    setStatusList() {
      console.log(this.editConfig.infomation, "edit")
      if (this.editConfig.infomation.status === 5) {
        this.list = [
          { label: "草稿", status: "todo", value: 1 },
@@ -804,15 +803,17 @@
            baseOperationType: this.editConfig.infomation.baseOperationType || undefined,
            cutAfterWidth: this.editConfig.infomation.baseOperationType === 2 ? 50.8 : 53.3
          };
          localStorage.setItem('pdfParams', JSON.stringify(pdfParams));
          var { href } = this.$router.resolve({
              path: '/overview/previewExcel',
              query:{
                ...pdfParams
              }
          });
          window.open(href, '_blank');
        }
      } catch (error) {
        console.error(error);
      } finally {
        var { href } = this.$router.resolve({
            name: 'previewExcel',
        });
        window.open(href, '_blank');
      }
    }
  }
src/views/overview/OverviewListView.vue
@@ -234,7 +234,7 @@
    async getData() {
      await getOperation({
        number: this.keyword,
        operationTypeId: this.params.id,
        operationTypeId: this.$route.params.id,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize,
        status: this.params.status
src/views/overview/index.vue
@@ -104,7 +104,6 @@
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      }).then((res) => {
        console.log(res.data)
        if (res.code === 200) {
          const list = res.data.map((item) => {
            return {
src/views/overview/previewExcel.vue
@@ -1,11 +1,11 @@
<template>
  <div>
    
    <button @click="cropAndDownload">截取图片</button>
    <!-- <button @click="cropAndDownload">截取图片</button> -->
    <!-- 显示裁剪后的图片 -->
    <div style="width: 800px;">
    <!-- <div style="width: 800px;">
      <img style="width: 100%;" id="export-pdf" v-if="croppedImage" :src="croppedImage" alt="Cropped Image" />
    </div>
    </div> -->
    <div ref="elementToCrop" >
      <div style="width: 100%;">
        <vue-office-excel :minRowLength="0"  :src="excel" @rendered="rendered"/>
@@ -27,14 +27,14 @@
    return {
      excel:'',
      cutAfterWidth:0,
      croppedImage: null, // 图片
      // croppedImage: null, // 图片
    };
  },
  computed: {
  },
  created() {
    this.excel=JSON.parse(localStorage.getItem('pdfParams', '[]')).url
    this.cutAfterWidth=JSON.parse(localStorage.getItem('pdfParams', '[]')).cutAfterWidth
    this.excel=this.$route.query.url
    this.cutAfterWidth=this.$route.query.cutAfterWidth
  },
  mounted() {
  },
@@ -43,8 +43,8 @@
  methods: {
    rendered(){
      console.log("渲染完成")
      if(JSON.parse(localStorage.getItem('pdfParams', '[]')).url){
        this.excel=JSON.parse(localStorage.getItem('pdfParams', '[]')).url
      if(this.$route.query.url){
        this.excel=this.$route.query.url
        this.cropAndDownload()
      }
    },