研发图纸文件管理系统-前端项目
longyvfengyun
2022-07-22 895fbb2a36b02a2e19a9675a55a8730821b15632
预览
2个文件已修改
64 ■■■■ 已修改文件
src/pages/components/drawUpload/DrawUpload.vue 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/workplace/apis.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/components/drawUpload/DrawUpload.vue
@@ -1,5 +1,6 @@
<template>
  <div class="draw-upload">
    <a-spin :spinning="spinning" tip="拼命加载中...">
    <a-card>
      <a-row>
        <a-col :span="8">
@@ -29,18 +30,20 @@
      </template>
      <template slot="action" slot-scope="text, record">
        <div v-if="record.dwgUrl">
          <a>预览</a>
            <a @click="dwgReview(record.dwgUrl)">预览</a>
          <a-divider type="vertical"></a-divider>
          <a :href="webUrl+record.dwgUrl" download>下载</a>
        </div>
      </template>
    </a-table>
    </a-spin>
  </div>
</template>
<script>
import getWebUrl from "@/assets/js/tools/getWebUrl";
import ImageView from "@/pages/components/ImageView";
import {dwgReview} from "@/pages/workplace/apis";
export default {
  name: "DrawUpload",
  components: {ImageView},
@@ -85,23 +88,23 @@
        align: 'center',
        ellipsis: true,
      },
      {
        title: '基本单位',
        dataIndex: 'unit',
        align: 'center',
        ellipsis: true,
      },
      // {
      //   title: '基本单位',
      //   dataIndex: 'unit',
      //   align: 'center',
      //   ellipsis: true,
      // },
      {
        title: '子件数量',
        dataIndex: 'quantity',
        align: 'center'
      },
      {
        title: '生产商',
        dataIndex: 'producer',
        align: 'center',
        ellipsis: true,
      },
      // {
      //   title: '生产商',
      //   dataIndex: 'producer',
      //   align: 'center',
      //   ellipsis: true,
      // },
      {
        title: '封装类型/材质',
        dataIndex: 'material',
@@ -152,6 +155,7 @@
      columns: columns,
      webUrl: getWebUrl(),
      y: 500,
      spinning: false
    }
  },
  methods: {
@@ -159,6 +163,21 @@
      this.y++;
      this.$nextTick(()=>{
        this.y--;
      });
    },
    dwgReview(url) {
      this.spinning = true;
      dwgReview(url).then(res=>{
        this.spinning = false;
        let rs = res.data;
        if(rs.code == 1 && rs.data) {
          window.open(this.webUrl+rs.data);
        }else {
          this.$message.error(rs.msg);
        }
      }).catch(error=>{
        this.spinning = false;
        console.log(error);
      });
    }
  },
@@ -174,7 +193,7 @@
        parentModel: "",
        parentName: "",
      };
      if(this.list.length != 0) {
      if(this.list.length !== 0) {
        let item = this.list[0];
        info.parentCode = item.parentCode;
        info.parentModel = item.parentModel;
@@ -184,7 +203,7 @@
    }
  },
  mounted() {
    console.log(this.$refs.aTable);
  }
}
</script>
src/pages/workplace/apis.js
@@ -25,3 +25,18 @@
    data
  });
}
/**
 *
 * @param dwgUrl
 * @returns {AxiosPromise}
 */
export const dwgReview = (dwgUrl)=>{
  return axios({
    method: "GET",
    url: "bomApproving/dwgReview",
    params: {
      dwgUrl,
    }
  });
}