tangzy
2021-07-14 b335b70701457f247b292540cb7e9680f3c4d4ff
src/views/resource/attach.vue
@@ -8,6 +8,7 @@
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               @row-click="rowClick"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
@@ -17,18 +18,18 @@
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-button type="primary"
                   size="small"
                   plain
                   icon="el-icon-upload2"
                   @click="handleUpload">上 传
        </el-button>
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   plain
                   @click="handleDelete">删 除
        </el-button>
        <!--        <el-button type="primary"-->
        <!--                   size="small"-->
        <!--                   plain-->
        <!--                   icon="el-icon-upload2"-->
        <!--                   @click="handleUpload">上 传-->
        <!--        </el-button>-->
        <!--        <el-button type="danger"-->
        <!--                   size="small"-->
        <!--                   icon="el-icon-delete"-->
        <!--                   plain-->
        <!--                   @click="handleDelete">删 除-->
        <!--        </el-button>-->
      </template>
      <template slot-scope="scope" slot="menu">
        <el-button type="text"
@@ -55,13 +56,17 @@
<script>
import {getList, getDetail, remove} from "@/api/resource/attach";
import {mapGetters} from "vuex";
import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
export default {
  components: { ElImageViewer },
  data() {
    return {
      form: {},
      query: {},
      loading: true,
      imgUrl: '',
      showViewer: false, // 显示查看器
      page: {
        pageSize: 10,
        currentPage: 1,
@@ -75,6 +80,7 @@
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        headerAlign: 'center',
        border: true,
        index: true,
        viewBtn: true,
@@ -153,6 +159,7 @@
            label: "类型",
            prop: "type",
            addDisplay: false,
            width: 80,
            type: "select",
            dicData: [
              {
@@ -191,25 +198,25 @@
            propsHttp: {
              res: 'data'
            },
             action: "/api/blade-resource/oss/endpoint/put-file-attach?deptid="
            action: "/api/blade-resource/oss/endpoint/put-file-attach?deptid="
          }
        ]
      }
    };
  },
  created() {
    var flag = false,i=0,ind=null
    this.$store.state.tags.tagList.forEach((item,index)=>{
      if(item.label=="附件上传"){
          if(flag==false){
          ind=index
          flag=true
    var flag = false, i = 0, ind = null
    this.$store.state.tags.tagList.forEach((item, index) => {
      if (item.label == "附件上传") {
        if (flag == false) {
          ind = index
          flag = true
        }
        i++
      }
    })
    if(i>1){
      this.$store.state.tags.tagList.splice(ind,1)
    if (i > 1) {
      this.$store.state.tags.tagList.splice(ind, 1)
    }
    var deptid = this.$route.query.deptid;
@@ -236,6 +243,11 @@
    }
  },
  methods: {
    rowClick(row) {
      var that = this;
      that.imgUrl = row.link
      this.showViewer = true
    },
    handleUpload() {
      this.attachBox = true;
    },
@@ -323,14 +335,14 @@
    },
    onLoad(page, params = {}) {
      this.loading = true;
      getList(page.currentPage, page.pageSize, Object.assign(params, this.query),this.$route.query.deptid,this.$route.query.type).then(res => {
      getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.$route.query.deptid, this.$route.query.type).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        this.selectionClear();
      });
    }
    },
  }
};
</script>