|
@@ -8,6 +8,7 @@
|
|
|
<el-button-group class="ml-4">
|
|
|
<el-button type="primary" :icon="Refresh" @click="resetFilterAndRefreshTableList">刷新</el-button>
|
|
|
<el-button type="primary" :icon="Box" @click="doBatchListing" v-if="showBatchListing">批量上线</el-button>
|
|
|
+ <el-button type="primary" :icon="Box" @click="doUnBatchListing" v-if="showBatchListing">批量下线</el-button>
|
|
|
</el-button-group>
|
|
|
</el-space>
|
|
|
<el-space class="action-bar-item-container action-bar-action-right">
|
|
@@ -105,6 +106,11 @@
|
|
|
</div>
|
|
|
<!-- 管理员:上线和退回 -->
|
|
|
<div v-if="tableActionShow.adminGroup(scope.row)">
|
|
|
+ <el-tooltip content="下线" placement="top" v-if="tableActionShow.downCode(scope.row)">
|
|
|
+ <el-button size="small" :class="{ active: scope.row._action_clicked_down_code }" :disabled="actionButtonDisabled.adminDownCode(scope.row)" @click="tableEvents.adminDownCode(scope.$index, scope.row)">
|
|
|
+ <el-icon><Download /></el-icon>
|
|
|
+ </el-button>
|
|
|
+ </el-tooltip>
|
|
|
<el-tooltip content="上线" placement="top" v-if="tableActionShow.adminSubmit(scope.row)">
|
|
|
<el-button size="small" :class="{ active: scope.row._action_clicked_submit }" :disabled="actionButtonDisabled.adminSubmit(scope.row)" @click="tableEvents.adminSubmit(scope.$index, scope.row)">
|
|
|
<el-icon><UploadFilled /></el-icon>
|
|
@@ -339,6 +345,7 @@ async function getTableList() {
|
|
|
_action_clicked_edit: false,
|
|
|
_action_clicked_debug: false,
|
|
|
_action_clicked_verify: false,
|
|
|
+ _action_clicked_down_code: false,
|
|
|
_action_clicked_submit: false,
|
|
|
_action_clicked_rollback: false,
|
|
|
}
|
|
@@ -472,6 +479,10 @@ const tableActionShow = {
|
|
|
const canOnline = row.state === 3
|
|
|
return canOnline
|
|
|
},
|
|
|
+ downCode() {
|
|
|
+ // 下线按钮,只有已上线爬虫展示
|
|
|
+ return row.state === 11
|
|
|
+ },
|
|
|
adminRollback(row) {
|
|
|
// 只有已上线,才展示退回
|
|
|
return row.state === 11
|
|
@@ -490,6 +501,9 @@ const actionButtonDisabled = {
|
|
|
// 只有审核通过才能上线,否则不展示
|
|
|
const canOnline = row.state === 3
|
|
|
return !canOnline
|
|
|
+ },
|
|
|
+ adminDownCode(row) {
|
|
|
+ return row.state !== 11
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -661,23 +675,38 @@ const tableEvents = {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 上线和批量上线操作
|
|
|
- batchListing(list = []) {
|
|
|
+ // 上线和批量上线操作 stateText=up
|
|
|
+ // 下线和批量下线操作 stateText=down
|
|
|
+ batchListing(list = [], stateText = 'up') {
|
|
|
+ const stateMap = {
|
|
|
+ up: {
|
|
|
+ code: 11,
|
|
|
+ text: '上线',
|
|
|
+ },
|
|
|
+ down: {
|
|
|
+ code: 6,
|
|
|
+ text: '下线',
|
|
|
+ },
|
|
|
+ }
|
|
|
+ const stateInfo = stateMap[stateText]
|
|
|
+ if (!stateInfo) {
|
|
|
+ return console.error('未定义的stateText')
|
|
|
+ }
|
|
|
let info = {
|
|
|
- successTip: '上线成功',
|
|
|
- errorTip: '上线失败',
|
|
|
+ successTip: `${stateInfo.text}成功`,
|
|
|
+ errorTip: `${stateInfo.text}失败`,
|
|
|
}
|
|
|
if (!Array.isArray(list)) return
|
|
|
if (list.length > 1) {
|
|
|
info = {
|
|
|
- successTip: '批量上线成功',
|
|
|
- errorTip: '批量上线失败',
|
|
|
+ successTip: `批量${stateInfo.text}成功`,
|
|
|
+ errorTip: `批量${stateInfo.text}失败`,
|
|
|
}
|
|
|
}
|
|
|
const codeList = list.map(r => r.code)
|
|
|
const lua = {
|
|
|
code: codeList.join(','),
|
|
|
- state: 11
|
|
|
+ state: stateInfo.code
|
|
|
}
|
|
|
ServerActionUpdateCodeState({ lua: lua }).then(r => {
|
|
|
if (r.err === 1) {
|
|
@@ -717,7 +746,6 @@ const tableEvents = {
|
|
|
},
|
|
|
// 审核提交
|
|
|
reviewerSubmit(_, row) {
|
|
|
- console.log('审核提交', row)
|
|
|
onlyClickHighlight(row, '_action_clicked_submit')
|
|
|
ElMessageBox.confirm('确认通过?', '提示',
|
|
|
{
|
|
@@ -737,7 +765,6 @@ const tableEvents = {
|
|
|
},
|
|
|
// 管理上线
|
|
|
adminSubmit(_, row) {
|
|
|
- console.log('管理上线', row)
|
|
|
onlyClickHighlight(row, '_action_clicked_submit')
|
|
|
ElMessageBox.confirm('确认上线?', '提示',
|
|
|
{
|
|
@@ -748,7 +775,22 @@ const tableEvents = {
|
|
|
showCancelButton: false,
|
|
|
}
|
|
|
).then(() => {
|
|
|
- this.batchListing([row])
|
|
|
+ this.batchListing([row], 'up')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 管理控制下线
|
|
|
+ adminDownCode(_, row) {
|
|
|
+ onlyClickHighlight(row, '_action_clicked_down_code')
|
|
|
+ ElMessageBox.confirm('确认下线?', '提示',
|
|
|
+ {
|
|
|
+ customClass: 'j-confirm-message-box',
|
|
|
+ type: 'warning',
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ showCancelButton: false,
|
|
|
+ }
|
|
|
+ ).then(() => {
|
|
|
+ this.batchListing([row], 'down')
|
|
|
})
|
|
|
},
|
|
|
// 管理退回
|
|
@@ -786,7 +828,18 @@ const doBatchListing = () => {
|
|
|
duration: 3000,
|
|
|
})
|
|
|
}
|
|
|
- tableEvents.batchListing(listState.selected)
|
|
|
+ tableEvents.batchListing(listState.selected, 'up')
|
|
|
+}
|
|
|
+// 执行批量下线操作
|
|
|
+const doUnBatchListing = () => {
|
|
|
+ if (listState.selected.length <= 0) {
|
|
|
+ return ElMessage({
|
|
|
+ message: '至少要选中1条数据',
|
|
|
+ type: 'error',
|
|
|
+ duration: 3000,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ tableEvents.batchListing(listState.selected, 'down')
|
|
|
}
|
|
|
|
|
|
//Wails事件绑定
|