|
@@ -55,13 +55,13 @@
|
|
|
</el-header>
|
|
|
<el-main>
|
|
|
<el-table ref="spiderTable" :data="listState.list" stripe :row-style="getRowStyle" v-loading="listState.loading">
|
|
|
- <el-table-column prop="code" label="代码" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="site" label="网站" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="channel" label="栏目" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="stateText" label="爬虫状态" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="claimText" label="认领状态" show-overflow-tooltip></el-table-column>
|
|
|
+ <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>
|
|
|
+ <el-table-column prop="stateText" label="爬虫状态" width="80" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="claimText" label="认领状态" width="100" align="center" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column prop="href" label="栏目地址" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="modifyuser" label="维护人" width="80" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="modifyuser" label="维护人" width="120" align="center" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column label="操作" width="160" align="center">
|
|
|
<template #default="scope">
|
|
|
<!-- <el-tooltip content="标注" placement="top">
|
|
@@ -88,18 +88,33 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="功能" width="120" align="center">
|
|
|
<template #default="scope">
|
|
|
- <el-tooltip content="提交" placement="top" v-if="showListDevelopeButton">
|
|
|
- <!-- 爬虫状态是待完成,才可点击提交 -->
|
|
|
- <el-button size="small" :disabled="scope.row.state !== 0" :class="{ active: scope.row._action_clicked_submit }" @click="tableEvents.handleSubmit(scope.$index, scope.row)">
|
|
|
- <el-icon><Promotion /></el-icon>
|
|
|
- </el-button>
|
|
|
- </el-tooltip>
|
|
|
- <el-tooltip content="回退" placement="top" v-if="showListRollbackButton">
|
|
|
- <!-- 爬虫状态是待完成,才可点击回退 -->
|
|
|
- <el-button size="small" :disabled="scope.row.state !== 0" :class="{ active: scope.row._action_clicked_rollback }" @click="tableEvents.handleRollback(scope.$index, scope.row)">
|
|
|
- <el-icon><DArrowLeft /></el-icon>
|
|
|
- </el-button>
|
|
|
- </el-tooltip>
|
|
|
+ <!-- 审核人员:打回和通过 -->
|
|
|
+ <div v-if="isReviewer">
|
|
|
+ <el-tooltip content="通过" placement="top">
|
|
|
+ <el-button size="small" :class="{ active: scope.row._action_clicked_submit }" @click="tableEvents.reviewerSubmit(scope.$index, scope.row)">
|
|
|
+ <el-icon><CircleCheck /></el-icon>
|
|
|
+ </el-button>
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip content="打回" placement="top">
|
|
|
+ <el-button size="small" :class="{ active: scope.row._action_clicked_rollback }" @click="tableEvents.reviewerRollback(scope.$index, scope.row)">
|
|
|
+ <el-icon><CircleClose /></el-icon>
|
|
|
+ </el-button>
|
|
|
+ </el-tooltip>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <!-- 管理员:上线和退回 -->
|
|
|
+ <div v-if="isAdmin">
|
|
|
+ <el-tooltip content="上线" placement="top">
|
|
|
+ <el-button size="small" :class="{ active: scope.row._action_clicked_submit }" @click="tableEvents.adminSubmit(scope.$index, scope.row)">
|
|
|
+ <el-icon><UploadFilled /></el-icon>
|
|
|
+ </el-button>
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip content="退回" placement="top">
|
|
|
+ <el-button size="small" :class="{ active: scope.row._action_clicked_rollback }" @click="tableEvents.adminRollback(scope.$index, scope.row)">
|
|
|
+ <el-icon><DArrowLeft /></el-icon>
|
|
|
+ </el-button>
|
|
|
+ </el-tooltip>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -215,29 +230,27 @@ const prevClickedRow = ref({})
|
|
|
const userRole = computed(() => store.getters.userRole)
|
|
|
// 是否展示维护人模块(管理员和审核员展示)
|
|
|
const showModifyUserFilter = computed(() => [USER_ROLE_ADMIN, USER_ROLE_REVIEWER].includes(userRole.value))
|
|
|
-// 是否展示提交按钮(仅开发人员展示)
|
|
|
-const showListDevelopeButton = computed(() => [USER_ROLE_DEVELOPER].includes(userRole.value))
|
|
|
-// 是否展示回退按钮(仅开发人员展示)
|
|
|
-const showListRollbackButton = computed(() => [USER_ROLE_DEVELOPER].includes(userRole.value))
|
|
|
|
|
|
// 实现待认领不能和维护人同时筛选
|
|
|
// 是否禁用维护人模块(待认领筛选下,禁用维护人筛选模块)
|
|
|
const modifyUserSelectDisabled = computed(() => filters.claimtype === 0)
|
|
|
// 是否禁用待认领筛选(维护人不为全部,则禁用待认领的选中)
|
|
|
-const stopWatch = watch(() => filters.modifyuser, (n) => {
|
|
|
- const target = filterConfig.claimOptions.find(i => i.value === 0)
|
|
|
- if (target) {
|
|
|
- if (n === defaultFilters.modifyuser) {
|
|
|
- // 解除禁用待认领
|
|
|
- target.disabled = false
|
|
|
- } else {
|
|
|
- // 禁用待认领
|
|
|
- target.disabled = true
|
|
|
- }
|
|
|
- } else {
|
|
|
- stopWatch()
|
|
|
- }
|
|
|
-})
|
|
|
+// const stopWatch = watch(() => filters.modifyuser, (n) => {
|
|
|
+// const target = filterConfig.claimOptions.find(i => i.value === 0)
|
|
|
+// if (target) {
|
|
|
+// if (n === defaultFilters.modifyuser) {
|
|
|
+// // 解除禁用待认领
|
|
|
+// target.disabled = false
|
|
|
+// } else {
|
|
|
+// // 禁用待认领
|
|
|
+// target.disabled = true
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// stopWatch()
|
|
|
+// }
|
|
|
+// })
|
|
|
+const isReviewer = computed(() => [USER_ROLE_REVIEWER].includes(userRole.value))
|
|
|
+const isAdmin = computed(() => [USER_ROLE_ADMIN].includes(userRole.value))
|
|
|
|
|
|
const changeFilterDefaultValue = () => {
|
|
|
// 根据用户身份
|
|
@@ -572,83 +585,114 @@ const tableEvents = {
|
|
|
loading.value = false
|
|
|
})
|
|
|
},
|
|
|
- handleSubmit(index, row) {
|
|
|
- onlyClickHighlight(row, '_action_clicked_submit')
|
|
|
+ // 操作按钮-----
|
|
|
+ updateCodeStateAction(row, info) {
|
|
|
const lua = getLuaParams(row)
|
|
|
- lua.state = 1
|
|
|
+ lua.state = info.state
|
|
|
+ lua.reason = info.reason
|
|
|
ServerActionUpdateCodeState({ lua: lua }).then(r => {
|
|
|
if (r.err === 1) {
|
|
|
ElMessage({
|
|
|
- message: '提交成功',
|
|
|
+ message: r.msg || info.successTip,
|
|
|
type: 'success',
|
|
|
duration: 3000,
|
|
|
})
|
|
|
getTableList()
|
|
|
} else {
|
|
|
return ElMessage({
|
|
|
- message: r.msg || '提交失败',
|
|
|
+ message: r.msg || info.errorTip,
|
|
|
type: 'error',
|
|
|
duration: 3000,
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- handleRollback(_, row) {
|
|
|
+ // 审核打回
|
|
|
+ reviewerRollback(_, row) {
|
|
|
+ console.log('审核打回', row)
|
|
|
onlyClickHighlight(row, '_action_clicked_rollback')
|
|
|
- ElMessageBox.alert('确定回退?', '提示', {
|
|
|
- customClass: 'j-confirm-message-box',
|
|
|
- confirmButtonText: '确定',
|
|
|
- callback: (action) => {
|
|
|
- if (action === 'confirm') {
|
|
|
- this.confirmRollback(row)
|
|
|
- }
|
|
|
- },
|
|
|
+ ElMessageBox.prompt('请输入打回原因', '审核打回', {
|
|
|
+ confirmButtonText: '确认打回',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ inputPattern: /^.+$/, // 非空
|
|
|
+ inputErrorMessage: '不能为空',
|
|
|
+ })
|
|
|
+ .then(({ value }) => {
|
|
|
+ this.updateCodeStateAction(row, {
|
|
|
+ reason: value,
|
|
|
+ state: 2,
|
|
|
+ successTip: '打回成功',
|
|
|
+ errorTip: '打回失败',
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
- confirmRollback(row) {
|
|
|
- const lua = getLuaParams(row)
|
|
|
- lua.state = 12
|
|
|
- ServerActionUpdateCodeState({ lua: lua }).then(r => {
|
|
|
- if (r.err === 1) {
|
|
|
- ElMessage({
|
|
|
- message: '回退成功',
|
|
|
- type: 'success',
|
|
|
- duration: 3000,
|
|
|
- })
|
|
|
- getTableList()
|
|
|
- } else {
|
|
|
- return ElMessage({
|
|
|
- message: r.msg || '回退失败',
|
|
|
- type: 'error',
|
|
|
- duration: 3000,
|
|
|
- })
|
|
|
+ // 审核提交
|
|
|
+ reviewerSubmit(_, row) {
|
|
|
+ console.log('审核提交', row)
|
|
|
+ onlyClickHighlight(row, '_action_clicked_submit')
|
|
|
+ ElMessageBox.confirm('确认提交?', '提示',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }
|
|
|
+ ).then(() => {
|
|
|
+ this.updateCodeStateAction(row, {
|
|
|
+ state: 3,
|
|
|
+ successTip: '提交成功',
|
|
|
+ errorTip: '提交失败',
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 管理上线
|
|
|
+ adminSubmit(_, row) {
|
|
|
+ console.log('管理上线', row)
|
|
|
+ onlyClickHighlight(row, '_action_clicked_submit')
|
|
|
+ ElMessageBox.confirm('确认上线?', '提示',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
}
|
|
|
+ ).then(() => {
|
|
|
+ this.updateCodeStateAction(row, {
|
|
|
+ state: 11,
|
|
|
+ successTip: '上线成功',
|
|
|
+ errorTip: '上线失败',
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 管理退回
|
|
|
+ adminRollback(_, row) {
|
|
|
+ console.log('管理退回', row)
|
|
|
+ onlyClickHighlight(row, '_action_clicked_rollback')
|
|
|
+ ElMessageBox.confirm('确认退回?', '提示',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }
|
|
|
+ ).then(() => {
|
|
|
+ this.updateCodeStateAction(row, {
|
|
|
+ state: 12,
|
|
|
+ successTip: '退回成功',
|
|
|
+ errorTip: '退回失败',
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
}
|
|
|
|
|
|
//Wails事件绑定
|
|
|
-EventsOn("spiderConfigChange", data => {
|
|
|
- console.log(data)
|
|
|
- const { key, css, url } = data
|
|
|
- refreshAndAsyncEditDialog(key, css)
|
|
|
- // 当触发修改时候,同步给客服端一份
|
|
|
- if (currentEditRow.value && Object.keys(currentEditRow.value).length <= 0) {
|
|
|
- const mark = getMarkWithRow(currentEditRow.value)
|
|
|
- ServerActionCurrentOpenTab(mark)
|
|
|
- }
|
|
|
- // 判断标注url和编辑url是否相同
|
|
|
- // const editUrl = currentEditRow.href
|
|
|
- // if (url === editUrl) {
|
|
|
- // refreshAndAsyncEditDialog(key, css[key])
|
|
|
- // } else {
|
|
|
- // ElMessage({
|
|
|
- // message: `标注url和编辑url不匹配,此次更新取消。当前标注url: ${url},当前编辑url: ${editUrl}`,
|
|
|
- // type: 'warn',
|
|
|
- // duration: 4000,
|
|
|
- // })
|
|
|
- // }
|
|
|
-})
|
|
|
+// EventsOn("spiderConfigChange", data => {
|
|
|
+// console.log(data)
|
|
|
+// const { key, css, url } = data
|
|
|
+// refreshAndAsyncEditDialog(key, css)
|
|
|
+// // 当触发修改时候,同步给客服端一份
|
|
|
+// if (currentEditRow.value && Object.keys(currentEditRow.value).length <= 0) {
|
|
|
+// const mark = getMarkWithRow(currentEditRow.value)
|
|
|
+// ServerActionCurrentOpenTab(mark)
|
|
|
+// }
|
|
|
+// })
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|