|
@@ -15,18 +15,20 @@
|
|
</el-header>
|
|
</el-header>
|
|
<el-main>
|
|
<el-main>
|
|
<el-table ref="spiderTable" :data="listState.list" border stripe :row-style="getRowStyle" v-loading="listState.loading">
|
|
<el-table ref="spiderTable" :data="listState.list" border stripe :row-style="getRowStyle" v-loading="listState.loading">
|
|
|
|
+ <el-table-column prop="comeintimeText" label="日期" width="110" align="left" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="proxyText" label="代理" align="left" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="proxyText" label="代理" align="left" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="headlessText" label="浏览器" align="left" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="headlessText" label="浏览器" align="left" show-overflow-tooltip></el-table-column>
|
|
|
|
+ <el-table-column prop="imageText" label="图像" align="left" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="listdatanum" label="列表量" align="left" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="listdatanum" label="列表量" align="left" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="needdownloadnum" label="待采量" align="center" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="needdownloadnum" label="待采量" align="center" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="detaildatanum" label="成功量" align="center" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="detaildatanum" label="成功量" align="center" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="pushnum" label="推送量" show-overflow-tooltip></el-table-column>
|
|
<el-table-column prop="pushnum" label="推送量" show-overflow-tooltip></el-table-column>
|
|
- <el-table-column prop="stateText" label="处理状态" show-overflow-tooltip>
|
|
|
|
|
|
+ <el-table-column prop="stateText" label="处理状态" width="100" show-overflow-tooltip>
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <div class="highlight-main">{{scope.stateText}}</div>
|
|
|
|
|
|
+ <div class="highlight-main">{{scope.row.stateText}}</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="功能" width="160" align="center">
|
|
|
|
|
|
+ <el-table-column label="功能" min-width="260" align="center">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<el-tooltip content="列表页采集" placement="top">
|
|
<el-tooltip content="列表页采集" placement="top">
|
|
<el-button size="small" :class="{ active: scope.row._action_clicked_list_collect }" @click="tableEvents.handleListCollect(scope.$index, scope.row)">
|
|
<el-button size="small" :class="{ active: scope.row._action_clicked_list_collect }" @click="tableEvents.handleListCollect(scope.$index, scope.row)">
|
|
@@ -80,7 +82,7 @@
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="显示图像" label-width="100px">
|
|
<el-form-item label="显示图像" label-width="100px">
|
|
- <el-radio-group v-model="addNewRecord.form.headless">
|
|
|
|
|
|
+ <el-radio-group v-model="addNewRecord.form.image">
|
|
<el-radio :value="true">显示</el-radio>
|
|
<el-radio :value="true">显示</el-radio>
|
|
<el-radio :value="false">不显示</el-radio>
|
|
<el-radio :value="false">不显示</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
@@ -89,6 +91,7 @@
|
|
<template #footer>
|
|
<template #footer>
|
|
<div class="dialog-footer">
|
|
<div class="dialog-footer">
|
|
<el-button type="primary" :loading="false" @click="addNewRecordConfirm">确定</el-button>
|
|
<el-button type="primary" :loading="false" @click="addNewRecordConfirm">确定</el-button>
|
|
|
|
+ <el-button @click="addNewRecord.dialog = false">取消</el-button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
@@ -97,13 +100,13 @@
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import { ref, computed, reactive, watch } from 'vue'
|
|
import { ref, computed, reactive, watch } from 'vue'
|
|
-import { useRouter } from 'vue-router';
|
|
|
|
import { useStore } from 'vuex';
|
|
import { useStore } from 'vuex';
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
-import { ServerActionQlmRecordList, QlmListDownload, QlmDetailDownload, ServerActionQlmRemoveRepeat, ServerActionQlmPushData, ServerActionQlmClearData } from "../../wailsjs/go/main/App"
|
|
|
|
|
|
+import { ServerActionQlmAddRecord, QlmListDataDownload, QlmDetailDataDownload, ServerActionQlmRemoveRepeat, ServerActionQlmPushData, ServerActionQlmClearData } from "../../wailsjs/go/main/App"
|
|
import Breadcrumb from "../components/Breadcrumb.vue"
|
|
import Breadcrumb from "../components/Breadcrumb.vue"
|
|
import { USER_ROLE_ADMIN, USER_ROLE_DEVELOPER, USER_ROLE_REVIEWER } from '../data/user'
|
|
import { USER_ROLE_ADMIN, USER_ROLE_DEVELOPER, USER_ROLE_REVIEWER } from '../data/user'
|
|
import { Refresh, DocumentAdd, Search, Box } from '@element-plus/icons-vue'
|
|
import { Refresh, DocumentAdd, Search, Box } from '@element-plus/icons-vue'
|
|
|
|
+import { dateFormatter } from "../utils/index.js";
|
|
|
|
|
|
const store = useStore();
|
|
const store = useStore();
|
|
const spiderTable = ref(null)
|
|
const spiderTable = ref(null)
|
|
@@ -161,9 +164,9 @@ const addNewRecord = reactive({
|
|
dialog: false,
|
|
dialog: false,
|
|
loading: false,
|
|
loading: false,
|
|
form: {
|
|
form: {
|
|
- proxy: true,
|
|
|
|
- headless: true,
|
|
|
|
- image: false,
|
|
|
|
|
|
+ proxy: false,
|
|
|
|
+ headless: false,
|
|
|
|
+ image: true,
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
@@ -196,11 +199,12 @@ const getRowStyle = ({ row }) => {
|
|
|
|
|
|
const pushStateMap = {
|
|
const pushStateMap = {
|
|
0: '未处理',
|
|
0: '未处理',
|
|
- 1: '未判重',
|
|
|
|
- 2: '判重结束',
|
|
|
|
- 3: '详情采集中',
|
|
|
|
- 4: '未推送',
|
|
|
|
- 5: '已完成',
|
|
|
|
|
|
+ 1: '列表采集中',
|
|
|
|
+ 2: '未判重',
|
|
|
|
+ 3: '判重结束',
|
|
|
|
+ 4: '详情采集中',
|
|
|
|
+ 5: '未推送',
|
|
|
|
+ 6: '已完成',
|
|
}
|
|
}
|
|
const calcStateText = (state) => {
|
|
const calcStateText = (state) => {
|
|
return pushStateMap[state] || ''
|
|
return pushStateMap[state] || ''
|
|
@@ -209,7 +213,10 @@ const calcStateText = (state) => {
|
|
async function getTableList() {
|
|
async function getTableList() {
|
|
listState.loading = true
|
|
listState.loading = true
|
|
try {
|
|
try {
|
|
- const r = await ServerActionQlmRecordList()
|
|
|
|
|
|
+ const r = await store.dispatch('rulesList/getQlmRecordList', {
|
|
|
|
+ pageSize: listState.pageSize,
|
|
|
|
+ pageNum: listState.pageNum
|
|
|
|
+ })
|
|
const { data, err, msg } = r
|
|
const { data, err, msg } = r
|
|
if (data) {
|
|
if (data) {
|
|
console.log(data)
|
|
console.log(data)
|
|
@@ -220,7 +227,9 @@ async function getTableList() {
|
|
...t,
|
|
...t,
|
|
proxyText: t.proxy ? '使用' : '不使用',
|
|
proxyText: t.proxy ? '使用' : '不使用',
|
|
headlessText: t.headless ? '无头' : '显示',
|
|
headlessText: t.headless ? '无头' : '显示',
|
|
|
|
+ imageText: t.image ? '显示' : '不显示',
|
|
stateText: calcStateText(t.state),
|
|
stateText: calcStateText(t.state),
|
|
|
|
+ comeintimeText: t.comeintime ? dateFormatter(t.comeintime * 1000, 'yyyy-MM-dd') : '',
|
|
// 操作按钮是否点击过
|
|
// 操作按钮是否点击过
|
|
_action_clicked_list_collect: false,
|
|
_action_clicked_list_collect: false,
|
|
_action_clicked_duplicate_remove: false,
|
|
_action_clicked_duplicate_remove: false,
|
|
@@ -235,7 +244,6 @@ async function getTableList() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- console.log(error)
|
|
|
|
listState.loaded = true
|
|
listState.loaded = true
|
|
} finally {
|
|
} finally {
|
|
listState.loading = false
|
|
listState.loading = false
|
|
@@ -284,28 +292,30 @@ const addNewRecordConfirm = () => {
|
|
...addNewRecord.form,
|
|
...addNewRecord.form,
|
|
}
|
|
}
|
|
addNewRecord.loading = true
|
|
addNewRecord.loading = true
|
|
|
|
+ console.log(payload)
|
|
ServerActionQlmAddRecord(payload).then(r => {
|
|
ServerActionQlmAddRecord(payload).then(r => {
|
|
- if (r.err === 1) {
|
|
|
|
- ElMessage({
|
|
|
|
- message: '新增成功',
|
|
|
|
- type: 'success',
|
|
|
|
- duration: 3000,
|
|
|
|
- })
|
|
|
|
- addNewRecord.dialog = false
|
|
|
|
- } else {
|
|
|
|
- return ElMessage({
|
|
|
|
- message: r.msg || '新增失败',
|
|
|
|
- type: 'error',
|
|
|
|
- duration: 3000,
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }).finally(() => {
|
|
|
|
- addNewRecord.loading = false
|
|
|
|
- })
|
|
|
|
|
|
+ if (r.err === 1) {
|
|
|
|
+ ElMessage({
|
|
|
|
+ message: '新增成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ duration: 3000,
|
|
|
|
+ })
|
|
|
|
+ addNewRecord.dialog = false
|
|
|
|
+ refreshTableList()
|
|
|
|
+ } else {
|
|
|
|
+ return ElMessage({
|
|
|
|
+ message: r.msg || '新增失败',
|
|
|
|
+ type: 'error',
|
|
|
|
+ duration: 3000,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ addNewRecord.loading = false
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
const getActionCommonParams = row => {
|
|
const getActionCommonParams = row => {
|
|
- const params = {
|
|
|
|
|
|
+ const param = {
|
|
id: row._id,
|
|
id: row._id,
|
|
state: row.state
|
|
state: row.state
|
|
}
|
|
}
|
|
@@ -313,12 +323,29 @@ const getActionCommonParams = row => {
|
|
headless: row.headless,
|
|
headless: row.headless,
|
|
showImage: row.image,
|
|
showImage: row.image,
|
|
proxyServer: row.proxy,
|
|
proxyServer: row.proxy,
|
|
|
|
+ id: row._id,
|
|
}
|
|
}
|
|
return {
|
|
return {
|
|
- params,
|
|
|
|
|
|
+ param,
|
|
other
|
|
other
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+const confirmDialog = (conf = {}) => {
|
|
|
|
+ if (!conf) return
|
|
|
|
+ ElMessageBox.confirm(conf.content || '确认操作', '提示',
|
|
|
|
+ {
|
|
|
|
+ customClass: conf.customClass || 'j-confirm-message-box',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ confirmButtonText: conf.confirmButtonText || '确定',
|
|
|
|
+ cancelButtonText: conf.cancelButtonText || '取消',
|
|
|
|
+ showCancelButton: conf.showCancelButton || false,
|
|
|
|
+ }
|
|
|
|
+ ).then(() => {
|
|
|
|
+ conf.success && conf.success()
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
// table的按钮事件集合
|
|
// table的按钮事件集合
|
|
const tableEvents = {
|
|
const tableEvents = {
|
|
handleListCollect: (index, row) => {
|
|
handleListCollect: (index, row) => {
|
|
@@ -332,13 +359,9 @@ const tableEvents = {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
loading.value = true
|
|
loading.value = true
|
|
- const { params, other } = getActionCommonParams(row)
|
|
|
|
- params.state = 1
|
|
|
|
- const payload = {
|
|
|
|
- params,
|
|
|
|
- ...other
|
|
|
|
- }
|
|
|
|
- QlmListDownload(payload).then(r => {
|
|
|
|
|
|
+ const { param, other } = getActionCommonParams(row)
|
|
|
|
+ param.state = 1
|
|
|
|
+ QlmListDataDownload(param, other).then(r => {
|
|
if (r.err === 1) {
|
|
if (r.err === 1) {
|
|
ElMessage({
|
|
ElMessage({
|
|
message: '操作成功',
|
|
message: '操作成功',
|
|
@@ -367,29 +390,30 @@ const tableEvents = {
|
|
duration: 3000,
|
|
duration: 3000,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- loading.value = true
|
|
|
|
- const { params } = getActionCommonParams(row)
|
|
|
|
- params.state = 2
|
|
|
|
- const payload = {
|
|
|
|
- ...params
|
|
|
|
- }
|
|
|
|
- ServerActionQlmRemoveRepeat(payload).then(r => {
|
|
|
|
- if (r.err === 1) {
|
|
|
|
|
|
+ confirmDialog({
|
|
|
|
+ success: () => {
|
|
|
|
+ loading.value = true
|
|
|
|
+ const { param } = getActionCommonParams(row)
|
|
|
|
+ param.state = 2
|
|
|
|
+ ServerActionQlmRemoveRepeat(param).then(r => {
|
|
|
|
+ if (r.err === 1) {
|
|
ElMessage({
|
|
ElMessage({
|
|
- message: '操作成功',
|
|
|
|
- type: 'success',
|
|
|
|
- duration: 3000,
|
|
|
|
|
|
+ message: '操作成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ duration: 3000,
|
|
})
|
|
})
|
|
getTableList()
|
|
getTableList()
|
|
- } else {
|
|
|
|
|
|
+ } else {
|
|
return ElMessage({
|
|
return ElMessage({
|
|
- message: r.msg || '操作失败',
|
|
|
|
- type: 'error',
|
|
|
|
- duration: 3000,
|
|
|
|
|
|
+ message: r.msg || '操作失败',
|
|
|
|
+ type: 'error',
|
|
|
|
+ duration: 3000,
|
|
})
|
|
})
|
|
- }
|
|
|
|
- }).finally(() => {
|
|
|
|
- loading.value = false
|
|
|
|
|
|
+ }
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ loading.value = false
|
|
|
|
+ })
|
|
|
|
+ },
|
|
})
|
|
})
|
|
},
|
|
},
|
|
handleDetailCollect(index, row) {
|
|
handleDetailCollect(index, row) {
|
|
@@ -403,13 +427,9 @@ const tableEvents = {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
loading.value = true
|
|
loading.value = true
|
|
- const { params, other } = getActionCommonParams(row)
|
|
|
|
- params.state = 4
|
|
|
|
- const payload = {
|
|
|
|
- params,
|
|
|
|
- ...other
|
|
|
|
- }
|
|
|
|
- QlmDetailDownload(payload).then(r => {
|
|
|
|
|
|
+ const { param, other } = getActionCommonParams(row)
|
|
|
|
+ param.state = 4
|
|
|
|
+ QlmDetailDataDownload(param, other).then(r => {
|
|
if (r.err === 1) {
|
|
if (r.err === 1) {
|
|
ElMessage({
|
|
ElMessage({
|
|
message: '操作成功',
|
|
message: '操作成功',
|
|
@@ -438,54 +458,63 @@ const tableEvents = {
|
|
duration: 3000,
|
|
duration: 3000,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- loading.value = true
|
|
|
|
- const { params } = getActionCommonParams(row)
|
|
|
|
- params.state = 5
|
|
|
|
- const payload = {
|
|
|
|
- ...params
|
|
|
|
- }
|
|
|
|
- ServerActionQlmPushData(payload).then(r => {
|
|
|
|
- if (r.err === 1) {
|
|
|
|
|
|
+ confirmDialog({
|
|
|
|
+ success: () => {
|
|
|
|
+ loading.value = true
|
|
|
|
+ const { param } = getActionCommonParams(row)
|
|
|
|
+ param.state = 5
|
|
|
|
+ const payload = {
|
|
|
|
+ ...param
|
|
|
|
+ }
|
|
|
|
+ ServerActionQlmPushData(payload).then(r => {
|
|
|
|
+ if (r.err === 1) {
|
|
ElMessage({
|
|
ElMessage({
|
|
- message: '操作成功',
|
|
|
|
- type: 'success',
|
|
|
|
- duration: 3000,
|
|
|
|
|
|
+ message: '操作成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ duration: 3000,
|
|
})
|
|
})
|
|
getTableList()
|
|
getTableList()
|
|
- } else {
|
|
|
|
|
|
+ } else {
|
|
return ElMessage({
|
|
return ElMessage({
|
|
- message: r.msg || '操作失败',
|
|
|
|
- type: 'error',
|
|
|
|
- duration: 3000,
|
|
|
|
|
|
+ message: r.msg || '操作失败',
|
|
|
|
+ type: 'error',
|
|
|
|
+ duration: 3000,
|
|
})
|
|
})
|
|
- }
|
|
|
|
- }).finally(() => {
|
|
|
|
- loading.value = false
|
|
|
|
|
|
+ }
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ loading.value = false
|
|
|
|
+ })
|
|
|
|
+ },
|
|
})
|
|
})
|
|
},
|
|
},
|
|
handleRemoveHistory(_, row) {
|
|
handleRemoveHistory(_, row) {
|
|
onlyClickHighlight(row, '_action_clicked_remove_history')
|
|
onlyClickHighlight(row, '_action_clicked_remove_history')
|
|
- loading.value = true
|
|
|
|
- const payload = {
|
|
|
|
- id: row._id,
|
|
|
|
- }
|
|
|
|
- ServerActionQlmClearData(payload).then(r => {
|
|
|
|
- if (r.err === 1) {
|
|
|
|
|
|
+
|
|
|
|
+ confirmDialog({
|
|
|
|
+ success: () => {
|
|
|
|
+ loading.value = true
|
|
|
|
+ const payload = {
|
|
|
|
+ id: row._id,
|
|
|
|
+ }
|
|
|
|
+ ServerActionQlmClearData(payload).then(r => {
|
|
|
|
+ if (r.err === 1) {
|
|
ElMessage({
|
|
ElMessage({
|
|
- message: '操作成功',
|
|
|
|
- type: 'success',
|
|
|
|
- duration: 3000,
|
|
|
|
|
|
+ message: '操作成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ duration: 3000,
|
|
})
|
|
})
|
|
getTableList()
|
|
getTableList()
|
|
- } else {
|
|
|
|
|
|
+ } else {
|
|
return ElMessage({
|
|
return ElMessage({
|
|
- message: r.msg || '操作失败',
|
|
|
|
- type: 'error',
|
|
|
|
- duration: 3000,
|
|
|
|
|
|
+ message: r.msg || '操作失败',
|
|
|
|
+ type: 'error',
|
|
|
|
+ duration: 3000,
|
|
})
|
|
})
|
|
- }
|
|
|
|
- }).finally(() => {
|
|
|
|
- loading.value = false
|
|
|
|
|
|
+ }
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ loading.value = false
|
|
|
|
+ })
|
|
|
|
+ },
|
|
})
|
|
})
|
|
},
|
|
},
|
|
}
|
|
}
|
|
@@ -534,6 +563,6 @@ const tableActionDisabled = {
|
|
white-space: nowrap;
|
|
white-space: nowrap;
|
|
}
|
|
}
|
|
.highlight-main {
|
|
.highlight-main {
|
|
- color: var(--el-color-primary);
|
|
|
|
|
|
+ color: var(--el-color-success);
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|