shuishen
2021-08-13 886cbde08e0d87ffa3b77b8e3dcb393009d28294
附件
1 files modified
64 ■■■■■ changed files
src/views/resource/attach.vue 64 ●●●●● patch | view | raw | blame | history
src/views/resource/attach.vue
@@ -1,7 +1,6 @@
<template>
  <basic-container class="hasButTwo">
    <avue-crud
      :option="option"
        <avue-crud :option="option"
      :table-loading="loading"
      :data="data"
      :page.sync="page"
@@ -16,54 +15,50 @@
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
                   @on-load="onLoad">
      <template slot="menuLeft">
        <el-button
          type="primary"
                <el-button type="primary"
          size="small"
          plain
          v-if="permission.attach_upload"
          icon="el-icon-upload2"
          @click="handleUpload"
          >上 传
                           @click="handleUpload">上 传
        </el-button>
        <el-button
          type="danger"
                <el-button type="danger"
          size="small"
          icon="el-icon-delete"
          plain
          v-if="permission.attach_delete"
          @click="handleDelete"
          >删 除
                           @click="handleDelete">删 除
        </el-button>
      </template>
      <template slot-scope="scope" slot="menu">
        <el-button
          type="text"
            <template slot-scope="scope"
                      slot="menu">
                <el-button type="text"
          icon="el-icon-download"
          size="small"
          v-if="permission.attach_download"
          @click="handleDownload(scope.row)"
          >下载
                           @click="handleDownload(scope.row)">下载222
                </el-button>
                <el-button type="text"
                           icon="el-icon-download"
                           size="small"
                           @click="seeImages(scope.row)">图片预览
        </el-button>
      </template>
      <template slot-scope="{ row }" slot="attachSize">
            <template slot-scope="{ row }"
                      slot="attachSize">
        <el-tag>{{ `${row.attachSize} KB` }}</el-tag>
      </template>
    </avue-crud>
    <el-dialog
      title="附件管理"
        <el-dialog title="附件管理"
      append-to-body
      :visible.sync="attachBox"
      width="555px"
    >
      <avue-form
        ref="form"
                   width="555px">
            <avue-form ref="form"
        :option="attachOption"
        v-model="attachForm"
        :upload-after="uploadAfter"
      >
                       :upload-after="uploadAfter">
      </avue-form>
    </el-dialog>
  </basic-container>
@@ -337,6 +332,23 @@
        this.selectionClear();
      });
    },
        seeImages (row) {
            var index = row.link.lastIndexOf(".");
            var ext = row.link.substr(index + 1);
            console.log(ext)
            console.log("该文件是否为图片:" + isAssetTypeAnImage(ext));
            function isAssetTypeAnImage (ext) {
                return [
                    'png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].
                    indexOf(ext.toLowerCase()) == -1;
            }
        }
  },
};
</script>