|
@@ -7,6 +7,7 @@
|
|
|
<el-space class="action-bar-item-container action-bar-action-left">
|
|
|
<el-button-group class="ml-4">
|
|
|
<el-button type="primary" :icon="Refresh" @click="resetFilterAndRefreshTableList">刷新</el-button>
|
|
|
+ <el-button type="primary" :icon="Box" @click="doBatchListing">批量上线</el-button>
|
|
|
</el-button-group>
|
|
|
</el-space>
|
|
|
<el-space class="action-bar-item-container action-bar-action-right">
|
|
@@ -54,7 +55,8 @@
|
|
|
</div>
|
|
|
</el-header>
|
|
|
<el-main>
|
|
|
- <el-table ref="spiderTable" :data="listState.list" stripe :row-style="getRowStyle" v-loading="listState.loading">
|
|
|
+ <el-table ref="spiderTable" :data="listState.list" stripe :row-style="getRowStyle" @selection-change="handleSelectionChange" v-loading="listState.loading">
|
|
|
+ <el-table-column type="selection" width="55" />
|
|
|
<el-table-column prop="code" label="代码" align="center" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column prop="site" label="网站" align="center" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column prop="channel" label="栏目" align="center" show-overflow-tooltip></el-table-column>
|
|
@@ -210,6 +212,8 @@ const listState = reactive({
|
|
|
// _id: 'asfasf',
|
|
|
// },
|
|
|
],
|
|
|
+ // 已选中列表
|
|
|
+ selected: [],
|
|
|
})
|
|
|
// 列表默认数据(用来重置)
|
|
|
const defaultListState = {
|
|
@@ -286,6 +290,10 @@ const getRowStyle = ({ row }) => {
|
|
|
return row.selected ? { backgroundColor: '#F7F7F7' } : {};
|
|
|
};
|
|
|
|
|
|
+const handleSelectionChange = (r) => {
|
|
|
+ listState.selected = r
|
|
|
+}
|
|
|
+
|
|
|
// 计算爬虫状态
|
|
|
const calcStateText = (state) => {
|
|
|
const target = filterConfig.stateOptions.find(r => r.value === state)
|
|
@@ -630,6 +638,41 @@ const tableEvents = {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 上线和批量上线操作
|
|
|
+ batchListing(list = []) {
|
|
|
+ let info = {
|
|
|
+ successTip: '上线成功',
|
|
|
+ errorTip: '上线失败',
|
|
|
+ }
|
|
|
+ if (!Array.isArray(list)) return
|
|
|
+ if (list.length > 1) {
|
|
|
+ info = {
|
|
|
+ successTip: '批量上线成功',
|
|
|
+ errorTip: '批量上线失败',
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const codeList = list.map(r => r.code)
|
|
|
+ const lua = {
|
|
|
+ code: codeList.join(','),
|
|
|
+ state: 11
|
|
|
+ }
|
|
|
+ ServerActionUpdateCodeState({ lua: lua }).then(r => {
|
|
|
+ if (r.err === 1) {
|
|
|
+ ElMessage({
|
|
|
+ message: r.msg || info.successTip,
|
|
|
+ type: 'success',
|
|
|
+ duration: 3000,
|
|
|
+ })
|
|
|
+ getTableList()
|
|
|
+ } else {
|
|
|
+ return ElMessage({
|
|
|
+ message: r.msg || info.errorTip,
|
|
|
+ type: 'error',
|
|
|
+ duration: 3000,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 审核打回
|
|
|
reviewerRollback(_, row) {
|
|
|
console.log('审核打回', row)
|
|
@@ -680,11 +723,7 @@ const tableEvents = {
|
|
|
showCancelButton: false,
|
|
|
}
|
|
|
).then(() => {
|
|
|
- this.updateCodeStateAction(row, {
|
|
|
- state: 11,
|
|
|
- successTip: '上线成功',
|
|
|
- errorTip: '上线失败',
|
|
|
- })
|
|
|
+ this.batchListing([row])
|
|
|
})
|
|
|
},
|
|
|
// 管理退回
|
|
@@ -708,6 +747,18 @@ const tableEvents = {
|
|
|
},
|
|
|
}
|
|
|
|
|
|
+// 执行批量上线
|
|
|
+const doBatchListing = () => {
|
|
|
+ if (listState.selected.length <= 0) {
|
|
|
+ return ElMessage({
|
|
|
+ message: '至少要选中1条数据',
|
|
|
+ type: 'error',
|
|
|
+ duration: 3000,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ tableEvents.batchListing(listState.selected)
|
|
|
+}
|
|
|
+
|
|
|
//Wails事件绑定
|
|
|
// EventsOn("spiderConfigChange", data => {
|
|
|
// console.log(data)
|