研发图纸文件管理系统-前端项目
longyvfengyun
2022-07-22 895fbb2a36b02a2e19a9675a55a8730821b15632
预览
2个文件已修改
132 ■■■■■ 已修改文件
src/pages/components/drawUpload/DrawUpload.vue 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/workplace/apis.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/components/drawUpload/DrawUpload.vue
@@ -1,46 +1,49 @@
<template>
  <div class="draw-upload">
    <a-card>
      <a-row>
        <a-col :span="8">
          <span class="content-label">母物料编号:</span>
          <span class="content-value">{{ parentInfo.parentCode }}</span>
        </a-col>
        <a-col :span="8">
          <span class="content-label">母物料名称:</span>
          <span class="content-value">{{ parentInfo.parentName }}</span>
        </a-col>
        <a-col :span="8">
          <span class="content-label">母物料型号:</span>
          <span class="content-value">{{ parentInfo.parentModel }}</span>
        </a-col>
      </a-row>
    </a-card>
    <a-table
        ref="aTable"
        size="small" :scroll="{ x: 1920, y: y}" bordered
        :columns="columns" :data-source="dataSource"
        :pagination="false" rowKey="subCode">
      <template slot="pictureUrl" slot-scope="text">
        <image-view v-if="text" :url="webUrl+text" @load="imageLoad"></image-view>
      </template>
      <template slot="dwgExist" slot-scope="text">
        <a-tag :color="text?'blue':'red'">{{text?"已上传":"未上传"}}</a-tag>
      </template>
      <template slot="action" slot-scope="text, record">
        <div v-if="record.dwgUrl">
          <a>预览</a>
          <a-divider type="vertical"></a-divider>
          <a :href="webUrl+record.dwgUrl" download>下载</a>
        </div>
      </template>
    </a-table>
    <a-spin :spinning="spinning" tip="拼命加载中...">
      <a-card>
        <a-row>
          <a-col :span="8">
            <span class="content-label">母物料编号:</span>
            <span class="content-value">{{ parentInfo.parentCode }}</span>
          </a-col>
          <a-col :span="8">
            <span class="content-label">母物料名称:</span>
            <span class="content-value">{{ parentInfo.parentName }}</span>
          </a-col>
          <a-col :span="8">
            <span class="content-label">母物料型号:</span>
            <span class="content-value">{{ parentInfo.parentModel }}</span>
          </a-col>
        </a-row>
      </a-card>
      <a-table
          ref="aTable"
          size="small" :scroll="{ x: 1920, y: y}" bordered
          :columns="columns" :data-source="dataSource"
          :pagination="false" rowKey="subCode">
        <template slot="pictureUrl" slot-scope="text">
          <image-view v-if="text" :url="webUrl+text" @load="imageLoad"></image-view>
        </template>
        <template slot="dwgExist" slot-scope="text">
          <a-tag :color="text?'blue':'red'">{{text?"已上传":"未上传"}}</a-tag>
        </template>
        <template slot="action" slot-scope="text, record">
          <div v-if="record.dwgUrl">
            <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,
    }
  });
}