Files
huangguo_admin/src/views/comicsManagement/comicNotUpList/index.vue
T
2025-06-10 17:11:41 +07:00

141 lines
4.1 KiB
Vue

<template>
<div class="pf-warpper">
<el-row class="table-form" type="flex" justify="space-between">
<el-col :span="10">
<!-- 查询条件 -->
<el-form :inline="true" :model="searchData" class="form-inline" label-width="80px" size="mini">
<el-form-item>
<el-input
placeholder="请输入页数"
clearable
v-model.number="searchData.pageNum"
@clear="onClear('pageNum')"/>
</el-form-item>
<el-form-item>
<el-button :loading="loading" @click="onSearch" icon="el-icon-search" plain type="primary">搜索</el-button>
<el-button @click="toUpdate" icon="el-icon-plus" plain type="primary">更新漫画</el-button>
</el-form-item>
</el-form>
</el-col>
<el-col span="2">
<el-button size="mini">更新数量: {{ total }}</el-button>
</el-col>
</el-row>
<el-row>
<el-col>
<!-- 展示列表 -->
<el-table ref="table" v-loading="loading" :data="tableData" border height="750" style="width: 100%">
<el-table-column align="center" label="唯一标识" width="200">
<template slot-scope="scope">{{ scope.row.jmId }}</template>
</el-table-column>
<el-table-column align="center" label="标题" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.title }}</template>
</el-table-column>
<el-table-column align="center" label="已经更新章节数量" width="200">
<template slot-scope="scope">{{ scope.row.updateNum }}</template>
</el-table-column>
<el-table-column align="center" label="网址" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.url }}</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="200">
<template slot-scope="scope">
<el-button @click="addComic(scope.row)" size="mini" type="success">手动爬取漫画</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<AddComic :data="addComicData" v-if="addComicVisible" @close="closeEdit" @cancel="cancel"/>
</div>
</template>
<script>
import { getComicsNotUpList } from '@/api/comicsManagement/comicsNotUpList'
import AddComic from '@/views/comicsManagement/comicNotUpList/components/addComic.vue'
export default {
name: 'ComicNotUpList',
components: {
AddComic
},
data() {
return {
// 请求列表筛选参数
searchData: {
pageNum: 1
},
tableData: [],
total: 0,
loading: true,
addComicVisible: false,
addComicData: {
type: '',
data: null
}
}
},
mounted() {
this.getData()
},
activated() {
this.$nextTick(() => {
this.$refs.table.doLayout()
})
},
methods: {
// TODO:请求漫画列表数据
getData() {
this.loading = true
getComicsNotUpList(this.searchData).then((res) => {
this.loading = false
if (res.code === 200) {
this.tableData = res.data.list
this.total = res.data.total
} else {
this.tableData = []
this.total = 0
this.$message.error('请求每日更新列表数据失败')
}
})
},
onSearch() {
this.getData()
},
onClear(key) {
this.searchData[key] = undefined
if (key === 'pageNum') this.searchData.pageNum = 1
this.getData()
},
closeEdit() {
this.addComicVisible = false
this.addComicData = null
this.getData()
},
cancel() {
this.addComicVisible = false
this.addComicData = null
},
addComic(row) {
this.addComicData = {
type: 'A',
title: '手动爬取漫画',
data: {
jmId: row.jmId
}
}
this.addComicVisible = true
},
toUpdate() {
this.addComicData = {
type: 'B',
title: '更新漫画',
data: null
}
this.addComicVisible = true
}
}
}
</script>