浏览代码

更改code码查询

Limengbo 5 年之前
父节点
当前提交
846770fa1d
共有 2 个文件被更改,包括 101 次插入154 次删除
  1. 3 2
      src/store/modules/list.js
  2. 98 152
      src/views/allFile/index.vue

+ 3 - 2
src/store/modules/list.js

@@ -74,8 +74,9 @@ const user = {
     CodeFile({ commit, state }, code) {
       return new Promise((resolve, reject) => {
         codeFile(code).then(response => {
-          const data = response.data.data
-          commit('SET_CODELIST', data)
+          const data = response.data
+          commit('SET_JOINUSERLIST', data)
+          // commit('SET_TOTALSIZE', data.totalSize)
           resolve(data)
         }).catch(error => {
           reject(error)

+ 98 - 152
src/views/allFile/index.vue

@@ -2,36 +2,27 @@
   <div class="app-container">
     <div class="empower">
       <el-input v-model="input" placeholder="输入授权码获取最新会议资料" @keyup.enter.native="findByCode" />
-      <el-button v-if="joinUserList.length !== 0" :disabled="delect" class="btn" type="primary" @click="deleteList">删除</el-button>
-    </div>
-    <div v-if="joinUserList.length !== 0">
-      <el-table
-        ref="multipleTable"
-        :data="joinUserList"
-        :row-class-name="tableRowClassName"
-        tooltip-effect="dark"
-        style="width: 100%"
-        @selection-change="handleSelectionChange"
-        @row-click="detail">
-        <el-table-column
-          :selectable="select"
-          type="selection"
-          width="55"/>
-        <el-table-column
-          :label=" '选中' +multipleSelection.length.toString() + '文件/文件夹'">
-          <template slot-scope="scope">
-            <img src="@/icons/image/file_icon.png" alt="file_icon" style="vertical-align: middle; margin-right: 10px">
-            <span>{{ scope.row.task.title }}</span>
-          </template>
-        </el-table-column>
-        <el-table-column
-          label="日期"
-          width="160"
-          show-overflow-tooltip>
-          <template slot-scope="scope">{{ scope.row.task.gmtCreated }}</template>
-        </el-table-column>
-      </el-table>
     </div>
+    <el-table
+      ref="multipleTable"
+      :data="joinUserList"
+      tooltip-effect="dark"
+      style="width: 100%">
+      <el-table-column
+        label="文件/文件夹">
+        <template slot-scope="scope">
+          <img src="@/icons/image/file_icon.png" alt="file_icon" style="vertical-align: middle; margin-right: 10px">
+          <span>{{ scope.row.title }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        label="日期"
+        width="160"
+        show-overflow-tooltip>
+        <template slot-scope="scope">{{ scope.row.gmtCreated }}</template>
+      </el-table-column>
+    </el-table>
+    <!--
     <div v-if="joinUserList.length !== 0" class="page">
       <el-pagination
         :total="totalSize"
@@ -40,44 +31,14 @@
         @size-change="handleSizeChange"
         @current-change="handleCurrentChange"/>
     </div>
-    <div v-if="codeList.length !== 0">
-      <el-table
-        ref="multipleTable"
-        :data="codeList"
-        tooltip-effect="dark"
-        style="width: 100%"
-        @selection-change="handleSelectionChange">
-        <el-table-column
-          type="selection"
-          width="55"/>
-        <el-table-column
-          label="资料">
-          <template slot-scope="scope">
-            <img :src="(scope.row.fileType == 'png' || scope.row.fileType == 'jpg') ? scope.row.path : imgUrl(scope.row)" alt="file_icon" style="vertical-align: middle; margin-right: 10px">
-            <span>{{ scope.row.fileName }}</span>
-          </template>
-        </el-table-column>
-        <el-table-column
-          label="日期"
-          width="160"
-          show-overflow-tooltip>
-          <template slot-scope="scope">{{ scope.row.gmtCreated }}</template>
-        </el-table-column>
-        <el-table-column
-          label="操作"
-          width="80">
-          <template slot-scope="scope"><i class="el-icon-download" @click="detailUpload(scope.row)"/></template>
-        </el-table-column>
-      </el-table>
-    </div>
+    -->
   </div>
 </template>
 
 <script>
 import { mapGetters } from 'vuex'
 import { parseTime } from '@/utils/index'
-import { deleteList } from '@/api/table'
-import { addViewLog } from '@/api/table'
+// import { deleteList } from '@/api/table'
 
 export default {
   data() {
@@ -90,111 +51,96 @@ export default {
   computed: {
     ...mapGetters([
       'joinUserList',
-      'totalSize',
-      'codeList'
+      'totalSize'
     ])
   },
   created() {
-    this.getList()
+    // this.getList()
   },
   methods: {
-    getList() {
-      this.$store.dispatch('JoinUser', 1, 10).then((res) => {
-        console.log(res.list)
-        // 格式化时间
-        res.list.forEach((item, index) => {
-          this.joinUserList[index].task.gmtCreated = parseTime(item.task.gmtCreated)
-        })
-      })
-    },
-    handleSelectionChange(val) {
-      this.multipleSelection = val
-      console.log(val.length)
-      if (val.length === 0) {
-        this.delect = true
-      } else {
-        this.delect = false
-      }
-    },
-    detail(row, event) {
-      const taskId = row.task.id
-      const title = row.task.title
-      const name = event.target.classList[0]
-      if (row.taskJoinUser.fileStatus === 'CLOSE') {
-        return false
-      }
-      if (name === 'el-checkbox__inner' || name === 'el-checkbox__original') {
-        return false
-      }
-      this.$router.push({ path: `/fileDetail/fileDetail`, query: { 'taskId': taskId, 'title': title }})
-    },
-    handleSizeChange(page) {
-      console.log(page)
-    },
-    handleCurrentChange(page) {
-      this.$store.dispatch('JoinUser', page).then((res) => {
-        console.log(res.list)
-        // 格式化时间
-        res.list.forEach((item, index) => {
-          this.joinUserList[index].task.gmtCreated = parseTime(item.task.gmtCreated)
-        })
-      })
-    },
-    deleteList() {
-      const joinUser = []
-      this.multipleSelection.forEach(item => {
-        joinUser.push(item.taskJoinUser.id)
-      })
-      deleteList(joinUser).then(res => {
-        this.joinUserList.forEach((item, index) => {
-          joinUser.forEach(id => {
-            if (item.taskJoinUser.id === id) {
-              this.joinUserList[index].taskJoinUser.fileStatus = 'CLOSE'
-            }
-          })
-        })
-      })
-    },
-    // 更改删除的样式
-    tableRowClassName(row) {
-      if (row.taskJoinUser.fileStatus === 'CLOSE') {
-        return 'warning-row'
-      }
-      return ''
-    },
-    select(row) {
-      if (row.taskJoinUser.fileStatus === 'CLOSE') {
-        return false
-      }
-      return true
-    },
+    // getList() {
+    //   this.$store.dispatch('JoinUser', 1, 10).then((res) => {
+    //     console.log(res.list)
+    //     // 格式化时间
+    //     res.list.forEach((item, index) => {
+    //       this.joinUserList[index].task.gmtCreated = parseTime(item.task.gmtCreated)
+    //     })
+    //   })
+    // },
+    // 输入验证码
     findByCode() {
       if (!this.input) {
         alert('请输入授权码')
         return false
       }
       this.$store.dispatch('CodeFile', this.input).then((res) => {
-        // 格式化时间和文件格式
-        this.codeList.forEach((item, index) => {
-          this.codeList[index].gmtCreated = parseTime(item.gmtCreated)
-          this.codeList[index].fileType = item.path.slice(item.path.lastIndexOf('.') + 1)
+        // 格式化时间
+        res.forEach((item, index) => {
+          this.joinUserList[index].gmtCreated = parseTime(item.gmtCreated)
         })
       })
-    },
-    detailUpload(row) {
-      const link = document.createElement('a')
-      link.style.display = 'none'
-      link.href = `https://whiteboardtest.ai160.com/download?path=${row.path}&fileName=${row.fileName}`
-      link.setAttribute('download', 'excel.xlsx')
-      document.body.appendChild(link)
-      link.click()
-      addViewLog(row.id, row.taskId)
-    },
-    imgUrl(url) {
-      if (url.fileType) {
-        return require(`@/assets/fileimg/${url.fileType}.png`)
-      }
     }
+    // handleSelectionChange(val) {
+    //   this.multipleSelection = val
+    //   console.log(val.length)
+    //   if (val.length === 0) {
+    //     this.delect = true
+    //   } else {
+    //     this.delect = false
+    //   }
+    // },
+    // detail(row, event) {
+    //   const taskId = row.task.id
+    //   const title = row.task.title
+    //   const name = event.target.classList[0]
+    //   if (row.taskJoinUser.fileStatus === 'CLOSE') {
+    //     return false
+    //   }
+    //   if (name === 'el-checkbox__inner' || name === 'el-checkbox__original') {
+    //     return false
+    //   }
+    //   this.$router.push({ path: `/fileDetail/fileDetail`, query: { 'taskId': taskId, 'title': title }})
+    // },
+    // handleSizeChange(page) {
+    //   console.log(page)
+    // },
+    // handleCurrentChange(page) {
+    //   this.$store.dispatch('JoinUser', page).then((res) => {
+    //     console.log(res.list)
+    //     // 格式化时间
+    //     res.list.forEach((item, index) => {
+    //       this.joinUserList[index].task.gmtCreated = parseTime(item.task.gmtCreated)
+    //     })
+    //   })
+    // },
+    // deleteList() {
+    //   const joinUser = []
+    //   this.multipleSelection.forEach(item => {
+    //     joinUser.push(item.taskJoinUser.id)
+    //   })
+    //   deleteList(joinUser).then(res => {
+    //     this.joinUserList.forEach((item, index) => {
+    //       joinUser.forEach(id => {
+    //         if (item.taskJoinUser.id === id) {
+    //           this.joinUserList[index].taskJoinUser.fileStatus = 'CLOSE'
+    //         }
+    //       })
+    //     })
+    //   })
+    // },
+    // 更改删除的样式
+    // tableRowClassName(row) {
+    //   if (row.taskJoinUser.fileStatus === 'CLOSE') {
+    //     return 'warning-row'
+    //   }
+    //   return ''
+    // },
+    // select(row) {
+    //   if (row.taskJoinUser.fileStatus === 'CLOSE') {
+    //     return false
+    //   }
+    //   return true
+    // }
   }
 }
 </script>