|
@@ -87,8 +87,14 @@
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="功能" width="120" align="center">
|
|
|
|
|
|
+ <el-table-column label="功能" width="160" align="center">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
|
+ <el-tooltip content="复制" placement="top" v-if="showListCopyButton">
|
|
|
|
+ <el-button size="small" :disabled="tableActionDisabled.copyDisabled(scope.row)" :class="{ active: scope.row._action_clicked_copy }" @click="tableEvents.handleCopy(scope.$index, scope.row)">
|
|
|
|
+ <!-- <el-icon><CopyDocument /></el-icon> -->
|
|
|
|
+ <el-icon><DocumentCopy /></el-icon>
|
|
|
|
+ </el-button>
|
|
|
|
+ </el-tooltip>
|
|
<el-tooltip content="提交" placement="top" v-if="showListDevelopeButton">
|
|
<el-tooltip content="提交" placement="top" v-if="showListDevelopeButton">
|
|
<!-- 爬虫状态是待完成,才可点击提交 -->
|
|
<!-- 爬虫状态是待完成,才可点击提交 -->
|
|
<el-button size="small" :disabled="tableActionDisabled.submitDisabled(scope.row)" :class="{ active: scope.row._action_clicked_submit }" @click="tableEvents.handleSubmit(scope.$index, scope.row)">
|
|
<el-button size="small" :disabled="tableActionDisabled.submitDisabled(scope.row)" :class="{ active: scope.row._action_clicked_submit }" @click="tableEvents.handleSubmit(scope.$index, scope.row)">
|
|
@@ -127,7 +133,7 @@ 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 { BrowserOpenURL, EventsOn } from "../../wailsjs/runtime"
|
|
import { BrowserOpenURL, EventsOn } from "../../wailsjs/runtime"
|
|
-import { VerifySpiderConfig, ServerActionUpdateCodeState, ServerActionCurrentOpenTab } from "../../wailsjs/go/main/App"
|
|
|
|
|
|
+import { VerifySpiderConfig, ServerActionUpdateCodeState, ServerActionCurrentOpenTab, ServerActionCopyCode } from "../../wailsjs/go/main/App"
|
|
import Breadcrumb from "../components/Breadcrumb.vue"
|
|
import Breadcrumb from "../components/Breadcrumb.vue"
|
|
import EditSpider from "../components/spider/EditSpider.vue"
|
|
import EditSpider from "../components/spider/EditSpider.vue"
|
|
import RunSpiderDialog from "../components/spider/RunSpiderDialog.vue"
|
|
import RunSpiderDialog from "../components/spider/RunSpiderDialog.vue"
|
|
@@ -216,14 +222,18 @@ const prevClickedRow = ref({})
|
|
|
|
|
|
// 用户身份标识
|
|
// 用户身份标识
|
|
const userRole = computed(() => store.getters.userRole)
|
|
const userRole = computed(() => store.getters.userRole)
|
|
|
|
+// 是否为开发人员
|
|
|
|
+const isDeveloper = computed(() => [USER_ROLE_DEVELOPER].includes(userRole.value))
|
|
// 是否展示维护人模块(管理员和审核员展示)
|
|
// 是否展示维护人模块(管理员和审核员展示)
|
|
const showModifyUserFilter = computed(() => [USER_ROLE_ADMIN, USER_ROLE_REVIEWER].includes(userRole.value))
|
|
const showModifyUserFilter = computed(() => [USER_ROLE_ADMIN, USER_ROLE_REVIEWER].includes(userRole.value))
|
|
// 是否展示认领按钮(仅开发人员展示)
|
|
// 是否展示认领按钮(仅开发人员展示)
|
|
-const showRenLingButton = computed(() => [USER_ROLE_DEVELOPER].includes(userRole.value))
|
|
|
|
|
|
+const showRenLingButton = computed(() => isDeveloper.value)
|
|
|
|
+// 是否展示复制爬虫按钮(仅开发人员展示)
|
|
|
|
+const showListCopyButton = computed(() => isDeveloper.value)
|
|
// 是否展示提交按钮(仅开发人员展示)
|
|
// 是否展示提交按钮(仅开发人员展示)
|
|
-const showListDevelopeButton = computed(() => [USER_ROLE_DEVELOPER].includes(userRole.value))
|
|
|
|
|
|
+const showListDevelopeButton = computed(() => isDeveloper.value)
|
|
// 是否展示退回按钮(仅开发人员展示)
|
|
// 是否展示退回按钮(仅开发人员展示)
|
|
-const showListRollbackButton = computed(() => [USER_ROLE_DEVELOPER].includes(userRole.value))
|
|
|
|
|
|
+const showListRollbackButton = computed(() => isDeveloper.value)
|
|
|
|
|
|
// 实现待认领不能和维护人同时筛选
|
|
// 实现待认领不能和维护人同时筛选
|
|
// 是否禁用维护人模块(待认领筛选下,禁用维护人筛选模块)
|
|
// 是否禁用维护人模块(待认领筛选下,禁用维护人筛选模块)
|
|
@@ -321,6 +331,7 @@ async function getTableList() {
|
|
_action_clicked_edit: false,
|
|
_action_clicked_edit: false,
|
|
_action_clicked_debug: false,
|
|
_action_clicked_debug: false,
|
|
_action_clicked_verify: false,
|
|
_action_clicked_verify: false,
|
|
|
|
+ _action_clicked_copy: false,
|
|
_action_clicked_submit: false,
|
|
_action_clicked_submit: false,
|
|
_action_clicked_rollback: false,
|
|
_action_clicked_rollback: false,
|
|
}
|
|
}
|
|
@@ -683,6 +694,41 @@ const tableEvents = {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ copyAction(row, value) {
|
|
|
|
+ console.log(row, value)
|
|
|
|
+ const params = {
|
|
|
|
+ code: row.code,
|
|
|
|
+ copycode: value,
|
|
|
|
+ }
|
|
|
|
+ ServerActionCopyCode(params).then(r => {
|
|
|
|
+ if (r.err === 1) {
|
|
|
|
+ ElMessage({
|
|
|
|
+ message: r.msg || '复制成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ duration: 3000,
|
|
|
|
+ })
|
|
|
|
+ getTableList()
|
|
|
|
+ } else {
|
|
|
|
+ return ElMessage({
|
|
|
|
+ message: r.msg || '复制失败',
|
|
|
|
+ type: 'error',
|
|
|
|
+ duration: 3000,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ handleCopy(index, row) {
|
|
|
|
+ onlyClickHighlight(row, '_action_clicked_copy')
|
|
|
|
+ ElMessageBox.prompt('请输入爬虫代码', '复制爬虫', {
|
|
|
|
+ confirmButtonText: '确认复制',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ inputPattern: /^.+$/, // 非空
|
|
|
|
+ inputErrorMessage: '不能为空',
|
|
|
|
+ })
|
|
|
|
+ .then(({ value }) => {
|
|
|
|
+ this.copyAction(row, value)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// 表格按钮是否可用
|
|
// 表格按钮是否可用
|
|
@@ -695,7 +741,13 @@ const tableActionDisabled = {
|
|
const notPass = row.state === 2
|
|
const notPass = row.state === 2
|
|
const canSubmit = waitingComplete || notPass
|
|
const canSubmit = waitingComplete || notPass
|
|
return !canSubmit
|
|
return !canSubmit
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ // 开发者才会展示
|
|
|
|
+ // 只有爬虫状态为待完成或未通过时能点(state=0||state=2)
|
|
|
|
+ copyDisabled(row) {
|
|
|
|
+ const canClick = row.state === 0 || row.state === 2
|
|
|
|
+ return !canClick
|
|
|
|
+ },
|
|
}
|
|
}
|
|
|
|
|
|
//Wails事件绑定
|
|
//Wails事件绑定
|
|
@@ -703,7 +755,7 @@ EventsOn("spiderConfigChange", data => {
|
|
console.log(data)
|
|
console.log(data)
|
|
const { key, css, url } = data
|
|
const { key, css, url } = data
|
|
refreshAndAsyncEditDialog(key, css)
|
|
refreshAndAsyncEditDialog(key, css)
|
|
- // 当触发修改时候,同步给客服端一份
|
|
|
|
|
|
+ // 当触发修改时候,同步给客户端一份
|
|
if (currentEditRow.value && Object.keys(currentEditRow.value).length <= 0) {
|
|
if (currentEditRow.value && Object.keys(currentEditRow.value).length <= 0) {
|
|
const mark = getMarkWithRow(currentEditRow.value)
|
|
const mark = getMarkWithRow(currentEditRow.value)
|
|
ServerActionCurrentOpenTab(mark)
|
|
ServerActionCurrentOpenTab(mark)
|