研发图纸文件管理系统-前端项目
he wei
2023-09-20 c0e36244c61614b5fd21eb73be1ceca09b2f7afb
src/pages/components/filesTable.vue
@@ -16,7 +16,7 @@
          <a v-if="!record.lockFlag && ((record.fileType == 'dwg' && canViewDoc) || (record.fileType != 'dwg' && canViewOther))" @click="view(record)">预览</a>
          <template v-if="((record.fileType == 'dwg' && canDownloadDoc) || (record.fileType != 'dwg' && canDownloadOther)) && !record.lockFlag">
            <a-divider type="vertical"></a-divider>
            <a @click="downloadLog(record)">下载</a>
            <a @click="downloadReason(record)">下载</a>
          </template>
          <template v-if="canLockOther && (id || productId)">
            <a-divider v-if="!record.lockFlag" type="vertical"></a-divider>
@@ -50,6 +50,7 @@
        />
      </a-form-model-item>
    </a-modal>
    <download-reason :reason-visible.sync="downloadReasonVisible" v-if="downloadReasonVisible" @ok="downloadReasonOk"></download-reason>
  </div>
</template>
@@ -61,10 +62,14 @@
import { updateAttachLock } from "@/pages/resourceManage/materialsCenter/apis";
import { updateProductLock } from "@/pages/resourceManage/product/details/apis";
import checkPermit from "@/assets/js/tools/checkPermit";
import DownloadReason from '@/pages/components/downloadReason';
import PERMITS from "@/assets/js/const/const_permits";
import { mapGetters } from "vuex";
export default {
  name: "",
  components: {
    DownloadReason,
  },
  props: {
    list: {
      type: Array,
@@ -78,6 +83,15 @@
        return null;
      },
    },
    // 类型 产品12 物料13
    type: {
      type: Number,
      required: true,
    },
    oprateVersion: {
      type: Number,
      default: 0
    }
  },
  data() {
    const columns = [
@@ -108,6 +122,8 @@
      },
    ];
    return {
      downloadUrl: '',
      downloadReasonVisible: false,
      reason: "",
      reasonVisible: false,
      currObj: null,
@@ -165,11 +181,17 @@
          this.$layer.close(loading);
        });
    },
    downloadLog(record) {
      const { parentModel, subModel, url } = record;
    downloadReason(record) {
      this.downloadUrl = record.url;
      this.downloadReasonVisible = true;
    },
    downloadReasonOk(data) {
      this.downloadLog(this.downloadUrl, data);
    },
    downloadLog(url, reason) {
      let reg = /(.*\\+)*(.*)$/;
      let fileName = url.match(reg)[2];
      downLoadFileByFilePath(url).then((res) => {
      downLoadFileByFilePath(url, reason, this.info.oprateInfo, this.oprateVersion, this.type).then((res) => {
        let { data, status } = res;
        if (200 == status && data) {
          let url = window.URL.createObjectURL(data);