liuyg
2021-08-19 0c35e05ca9c90883e5073ea35232ea100f866a8f
src/views/resource/attach.vue
@@ -1,6 +1,7 @@
<template>
    <basic-container class="hasButTwo">
        <avue-crud :option="option"
    <avue-crud
      :option="option"
                   :table-loading="loading"
                   :data="data"
                   :page.sync="page"
@@ -15,66 +16,73 @@
                   @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)">下载222
          @click="handleDownload(scope.row)"
          >下载222
                </el-button>
                <el-button type="text"
        <el-button
          type="text"
                           icon="el-icon-picture-outline-round"
                           size="small"
                           v-show="!fileFormat(scope.row)"
                           @click="seeImages(scope.row)">预览
          @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>
        <el-dialog title="预览"
    <el-dialog
      title="预览"
                   append-to-body
                   :visible.sync="imgSee"
                   class="see-img-box">
            <div class="img"
                 :style="{background: imgUrl}">
            </div>
      class="see-img-box"
    >
      <div class="img" :style="{ background: imgUrl }"></div>
        </el-dialog>
    </basic-container>
</template>
@@ -104,7 +112,7 @@
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: false,
        border: true, //liu
                index: true,
                stripe: true,
                viewBtn: true,
@@ -208,7 +216,7 @@
                ],
            },
            imgSee: false,
            imgUrl: ""
      imgUrl: "",
        };
    },
    computed: {
@@ -360,10 +368,20 @@
            var index = row.link.lastIndexOf(".");
            var ext = row.link.substr(index + 1);
            return [
                'png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].
                indexOf(ext.toLowerCase()) == -1;
        }
      return (
        [
          "png",
          "jpg",
          "jpeg",
          "bmp",
          "gif",
          "webp",
          "psd",
          "svg",
          "tiff",
        ].indexOf(ext.toLowerCase()) == -1
      );
    },
    },
};
</script>