|
@@ -1,46 +1,60 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
+ <el-button :disabled="delect" class="btn" type="primary" @click="deleteList">删除</el-button>
|
|
|
<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">
|
|
|
+ <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
|
|
|
- prop="task.title"/>
|
|
|
- <el-table-column
|
|
|
label="日期"
|
|
|
width="160"
|
|
|
show-overflow-tooltip>
|
|
|
<template slot-scope="scope">{{ scope.row.task.gmtCreated }}</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
+ <div class="page">
|
|
|
+ <el-pagination
|
|
|
+ :total="totalSize"
|
|
|
+ background
|
|
|
+ layout="prev, pager, next"
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"/>
|
|
|
+ </div>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { mapGetters } from 'vuex'
|
|
|
import { parseTime } from '@/utils/index'
|
|
|
+import { deleteList } from '@/api/table'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- multipleSelection: []
|
|
|
+ multipleSelection: [],
|
|
|
+ delect: true
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters([
|
|
|
- 'joinUserList'
|
|
|
+ 'joinUserList',
|
|
|
+ 'totalSize'
|
|
|
])
|
|
|
},
|
|
|
created() {
|
|
@@ -48,7 +62,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
getList() {
|
|
|
- this.$store.dispatch('JoinUser').then((res) => {
|
|
|
+ this.$store.dispatch('JoinUser', 1, 10).then((res) => {
|
|
|
console.log(res.list)
|
|
|
// 格式化时间
|
|
|
res.list.forEach((item, index) => {
|
|
@@ -58,23 +72,86 @@ export default {
|
|
|
},
|
|
|
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>
|
|
|
|
|
|
-<style scoped>
|
|
|
+<style>
|
|
|
.line{
|
|
|
text-align: center;
|
|
|
}
|
|
|
+
|
|
|
+.btn {
|
|
|
+ float: right;
|
|
|
+ margin-right: 20px;
|
|
|
+}
|
|
|
+
|
|
|
+.page {
|
|
|
+ margin: 20px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
+.el-table .warning-row {
|
|
|
+ background: #FAFAFA;
|
|
|
+}
|
|
|
</style>
|
|
|
|