提交Data数据审核

This commit is contained in:
yyhouc 2023-04-17 09:07:52 +08:00
parent 50e319c45c
commit ed94dcf10b
4 changed files with 345 additions and 204 deletions

26
src/api/news/index.js Normal file
View File

@ -0,0 +1,26 @@
import request from '/@/utils/request';
import {moduleName} from '/@/utils/request';
export const getList = (current, size, param ,type) => {
let params = {
current,
size,
};
if(param){
params = Object.assign(params, param);
}
return request({
url: '/api/'+moduleName+'/ui/'+(type?'news':'socialMedia')+'/list',
method: 'get',
params: params,
});
}
export const review = (ids,status,type) => {
return request({
url: '/api/'+moduleName+'/ui/'+(type?'news':'socialMedia')+'/review',
method: 'post',
params:{
ids,
status
}
})
}

View File

@ -1,192 +1,180 @@
<template>
<div class="system-role-container layout-padding">
<el-config-provider :locale="en">
<el-row :gutter="22">
<el-col :span="10">
<div class="system-role-padding layout-padding-auto layout-padding-view">
<div class="system-user-search mb15">
<!-- 选择灾害类型下拉框 -->
<el-select v-model="value_disastertype"
size="default"
placeholder="Select disaster type">
<el-option v-for="item in options_disastertype"
:key="item.value"
:label="item.label"
:value="item.value" />
</el-select>
<!-- 选择灾害时间下拉框 -->
<el-date-picker v-model="value_disastertime"
type="date"
placeholder="Select disaster time"
class="ml10"
size="default" />
<!-- 选择灾害事件下拉框 -->
<el-select v-model="value_disasterevent"
size="default"
placeholder="Select disaster event"
class="ml10">
<el-option v-for="item in options_disasterevent"
:key="item.value"
:label="item.label"
:value="item.value" />
</el-select>
<!-- 选择爬虫类型下拉框 -->
<el-select v-model="value_crawlertype"
size="default"
placeholder="Select crawler type"
class="ml10">
<el-option v-for="item in options_crawlertype"
:key="item.value"
:label="item.label"
:value="item.value" />
</el-select>
<!-- 选择爬虫状态下拉框 -->
<!-- <el-select v-model="value_crawlerstatus" size="default" placeholder="Select crawler status" class="ml10">
<el-option v-for="item in options_crawlerstatus" :key="item.value" :label="item.label" :value="item.value" />
</el-select> -->
<!-- <el-input v-model="state.tableData.param.search" size="default" placeholder="请输入角色名称" style="max-width: 180px"> </el-input> -->
<el-button size="default"
type="primary"
class="ml10">
<el-icon>
<ele-Search />
</el-icon>
Search
</el-button>
<el-button size="default"
type="success"
class="ml10">
<el-icon>
<ele-Search />
</el-icon>
Start crawling
</el-button>
<el-button size="default"
type="warning"
class="ml10">
<el-icon>
<ele-Search />
</el-icon>
Stop crawling
</el-button>
<!-- <el-button size="default" type="success" class="ml10" @click="onOpenAddRole('add')">
<el-icon>
<ele-FolderAdd />
</el-icon>
新增角色
</el-button> -->
</div>
<!-- <el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
<el-table-column type="vordmId" label="VoRDM ID" show-overflow-tooltip />
<el-table-column prop="disasterKeyword" label="Disaster keyword" show-overflow-tooltip></el-table-column>
<el-table-column prop="disasterTime" label="Disaster time" show-overflow-tooltip></el-table-column>
<el-table-column prop="crawlertype" label="Crawler type" show-overflow-tooltip></el-table-column>
<el-table-column prop="crawlerStatus" label="Crawler status" show-overflow-tooltip></el-table-column> -->
<!-- 需修改弹出框页面 -->
<!-- <el-table-column label="Crawler operation" width="100">
<el-table :data="state.disasterData.data" v-loading="state.disasterData.loading" style="width: 100%"
highlight-current-row @row-click="tableClick">
<el-table-column type="index" label="ID" width="50" />
<el-table-column prop="disasterType" label="Disaster type" show-overflow-tooltip>
<!-- 在disasterType中获取dictKey 对应的dictValue -->
<template #default="scope">
<el-button size="small" text type="primary" @click="onOpenEditRole('edit', scope.row)">Start</el-button>
<el-button size="small" text type="primary" @click="onRowDel(scope.row)">Stop</el-button>
<el-tag type="info">{{ getValue(scope.row.disasterType) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="disasterKeyword" label="Disaster keyword" show-overflow-tooltip></el-table-column>
<el-table-column prop="disasterTime" label="disaster time" show-overflow-tooltip></el-table-column>
<el-table-column prop="Operate" label="Operate" show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" v-if="scope.row.respondStatus == 2"
@click="ElMessage.info('start')">start</el-button>
<el-tag type="info" v-if="scope.row.respondStatus == 3">complete</el-tag>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="onHandleSizeChange"
@current-change="onHandleCurrentChange"
class="mt15"
:pager-count="5"
:page-sizes="[10, 20, 30]"
v-model:current-page="state.tableData.param.pageNum"
background
v-model:page-size="state.tableData.param.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total"
>
</el-pagination> -->
<el-pagination @size-change="onHandleDisasterSizeChange" @current-change="onHandleDisasterCurrentChange"
class="mt15" :pager-count="5" :page-sizes="[10, 20, 30]"
v-model:current-page="state.disasterData.param.pageNum" background
v-model:page-size="state.disasterData.param.pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="state.disasterData.total">
</el-pagination>
</div>
<RoleDialog ref="roleDialogRef"
@refresh="getTableData()" />
</el-col>
<el-col :span="14">
<div class="system-role-padding layout-padding-auto layout-padding-view">
<div class="system-user-search mb15" style="display: flex;margin-left: 10px;margin-top: 10px;">
<el-form-item label="type" label-width="100px">
<el-select v-model="state.searchName" placeholder="please select data type" style="max-width: 200px"
size="default" clearable>
<el-option value="1" label="news"></el-option>
<el-option value="2" label="socialMedia"></el-option>
</el-select>
</el-form-item>
<el-form-item label="stateus" label-width="100px">
<el-select v-model="state.srarchType" placeholder="please select data type" style="max-width: 200px"
size="default" clearable>
<el-option value="0" label="No review"></el-option>
<el-option value="1" label="reserve"></el-option>
<el-option value="2" label="not retain"></el-option>
</el-select>
</el-form-item>
<el-button size="default" type="primary" class="ml10" @click="getTableData">
<el-icon>
<ele-Search />
</el-icon>
search
</el-button>
<el-button size="default" type="success" class="ml10" @click="openDialog">
<el-icon>
<ele-Upload />
</el-icon>
review
</el-button>
</div>
<el-table :data="state.tableData.data" v-loading="state.tableData.loading"
@selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" width="55" />
<el-table-column type="index" label="ID" width="50" />
<el-table-column prop="content" label="content" show-overflow-tooltip></el-table-column>
<el-table-column prop="type" label="type" show-overflow-tooltip >
<template #default="scope">
<el-tag type="info" v-if="state.searchName=='1' && scope.row.type == 0">baidu(中文)</el-tag>
<el-tag type="info" v-if="state.searchName=='1' && scope.row.type == 1">bing</el-tag>
<el-tag type="info" v-if="state.searchName=='2' && scope.row.type == 0">twitter</el-tag>
<el-tag type="info" v-if="state.searchName=='2' && scope.row.type == 1">weibo</el-tag>
</template>
</el-table-column>
<el-table-column prop="content" label="link" show-overflow-tooltip>
<template #default="scope">
<a :href="scope.row.link" target="_blank">goto link</a>
</template>
</el-table-column>
<!-- <el-table-column prop="sourceOrganization" label="Organization" show-overflow-tooltip></el-table-column>
<el-table-column prop="title" label="Professional title" show-overflow-tooltip></el-table-column>
<el-table-column prop="size" label="Data size" show-overflow-tooltip>
<template #default="scope">
{{ formatSizeUnits(scope.row.size) }}
</template>
</el-table-column>
<el-table-column prop="uploadTime" label="Upload time" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="Operate" label="Operate" show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="info" v-if="scope.row.status == 0" @click="openDialog(scope.row,true)">review</el-button>
<el-button size="small" text type="success" v-if="scope.row.status == 1" @click="openDialog(scope.row,false)">review</el-button>
<el-button size="small" text type="danger" v-if="scope.row.status == 2" @click="openDialog(scope.row,false)">review</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
:pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="state.tableData.param.pageNum" background
v-model:page-size="state.tableData.param.pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</div>
</el-col>
</el-row>
<el-dialog v-model="state.dialogVisible" title="Review" width="30%" :before-close="handleClose">
<!-- <el-form-item label="status">
<el-select v-model="state.edit.status" placeholder="please select data type" style="max-width: 200px"
size="default" clearable>
<el-option value="1" label="reserve"></el-option>
<el-option value="2" label="not reserve"></el-option>
</el-select>
</el-form-item> -->
Do you want to keep this data as response data?
<template #footer>
<span class="dialog-footer">
<el-button @click="state.dialogVisible = false">Cancel</el-button>
<el-button type=" primary" @click="reviews(1)">
reserve
</el-button>
<el-button type="danger" @click="reviews(2)">
not retain
</el-button>
</span>
</template>
</el-dialog>
</el-config-provider>
<Upload ref="uploadRef" @callback="getTableData" />
</div>
</template>
<script setup name="systemRole">
<script lang="ts" setup name="systemRole">
import en from 'element-plus/dist/locale/en.mjs'
import type { TabsPaneContext } from 'element-plus';
import { getOtherDataPage, getDisasterPage, deleteData } from '/@/api/data/otherData.js'
import { getList } from '/@/api/disasterInfo/index';
import { getList as getNewsList, review } from '/@/api/news/index';
import { getDictionary } from '/@/api/system/dictbiz';
//
import { defineAsyncComponent, reactive, onMounted, ref } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
//
const RoleDialog = defineAsyncComponent(() => import('/@/views/system/role/dialog.vue'));
const value_disastertype = ref('');
const value_disastertime = ref('');
const value_crawlertype = ref('');
// const value_crawlerstatus = ref('');
const auditRef = ref();
const uploadRef = ref();
//
const options_disastertype = [
{
value: 'Earthquake',
label: 'Earthquake',
},
{
value: 'Hurricane',
label: 'Hurricane',
},
{
value: 'Flood',
label: 'Flood',
},
{
value: 'Volcano',
label: 'Volcano',
},
{
value: 'Drought',
label: 'Drought',
},
{
value: 'Landslide',
label: 'Landslide',
},
];
//
const options_crawlertype = [
{
value: 'Bing',
label: 'Bing',
},
{
value: 'Twitter',
label: 'Twitter',
},
{
value: 'Baidu',
label: 'Baidu',
},
{
value: 'Weibo',
label: 'Weibo',
},
];
//
// const options_crawlerstatus = [
// {
// value: 'Not crawled',
// label: 'Not crawled',
// },
// {
// value: 'Crawled',
// label: 'Crawled',
// },
// ];
//
const roleDialogRef = ref();
const getValue = (key) => {
//state.disasterTypeLis value
return state.disasterTypeList.find((item) => item.dictKey === key)?.dictValue;
};
const state = reactive({
dialogVisible: false,
multipleSelection: [],
searchName: '1',
disasterId: null,
edit: {
status: 0,
},
srarchType:"0",
disasterData: {
data: [],
total: 0,
loading: false,
param: {
search: '',
pageNum: 1,
pageSize: 10,
},
},
disasterTypeList: [],
tableData: {
data: [],
total: 0,
@ -197,47 +185,158 @@ const state = reactive({
pageSize: 10,
},
},
selectList :[],
});
const openDialog = async (row,bool) => {
if(bool){
state.selectList = [row]
}else{
state.selectList = state.multipleSelection
}
state.dialogVisible = true;
};
const reviews = async (status) => {
let ids = state.selectList.map((item) => item.id);
//ids 使
ids = ids.join(',');
let res = await review(ids,status,state.searchName=='1'?true:false);
if (res) {
state.dialogVisible = false;
ElMessage.success('success');
getTableData();
}
};
const handleSelectionChange = (val) => {
state.multipleSelection = val
}
const auditData = (row) => {
let id = row.id
auditRef.value.openDialog([{ "id": id }]);
}
//
const formatSize = (size) => {
var data = "";
if (size < 0.1 * 1024) { //0.1KBB
data = size.toFixed(2) + "B";
} else if (size < 0.1 * 1024 * 1024) {//0.1MBKB
data = (size / 1024).toFixed(2) + "KB";
} else if (size < 0.1 * 1024 * 1024 * 1024) { //0.1GBMB
data = (size / (1024 * 1024)).toFixed(2) + "MB";
} else { //GB
data = (size / (1024 * 1024 * 1024)).toFixed(2) + "GB";
}
var sizestr = data + "";
var len = sizestr.indexOf("\.");
var dec = sizestr.substr(len + 1, 2);
if (dec == "00") {//00
return sizestr.substring(0, len) + sizestr.substr(len + 3, 2);
}
return sizestr;
}
const formatSizeUnits = (size) => {
if (size === 0) return '0 B';
var k = 1000, // or 1024
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(size) / Math.log(k));
return (size / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
}
//
const tableClick = (row, column, event) => {
state.disasterId = row.id;
getTableData();
}
//
const getDisasterData = () => {
state.disasterData.loading = true;
// param: {
// search: '',
// current: 1,
// size: 10,
// respondStatus: 0,
// },
let param = {
"search": state.disasterData.param.search,
"current": state.disasterData.param.pageNum,
"size": state.disasterData.param.pageSize,
"respondStatus": 3,
}
getList(param).then(res => {
state.disasterData.data = res.records;
state.disasterData.total = res.total;
state.disasterData.loading = false;
})
}
//
const getTableData = () => {
state.tableData.loading = true;
const data = [];
for (let i = 0; i < 20; i++) {
data.push({
roleName: i === 0 ? '超级管理员' : '主要管理员',
roleSign: i === 0 ? 'admin' : 'chief',
describe: `测试角色${i + 1}`,
sort: i,
status: true,
createTime: new Date().toLocaleString(),
});
}
state.tableData.data = data;
state.tableData.total = state.tableData.data.length;
getNewsList(state.tableData.param.pageNum, state.tableData.param.pageSize, { "disasterId": state.disasterId, "isDeleted": 0,status :state.srarchType }, state.searchName == '1' ? true : false).then(res => {
state.tableData.data = res.records;
state.tableData.total = res.total;
})
/* state.tableData.data = data;
state.tableData.total = state.tableData.data.length;*/
setTimeout(() => {
state.tableData.loading = false;
}, 500);
};
//
const onOpenAddRole = (type) => {
roleDialogRef.value.openDialog(type);
//
const uploadData = () => {
if (state.disasterId == null) {
ElMessage.warning("Please select the disaster first")
return false;
}
uploadRef.value.openDialog(state.disasterId);
};
//
const onOpenEditRole = (type, row) => {
roleDialogRef.value.openDialog(type, row);
};
//
const onRowDel = (row) => {
ElMessageBox.confirm(`此操作将永久删除角色名称:“${row.roleName}”,是否继续?`, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
//
const batchDel = () => {
if (state.multipleSelection.length == 0) {
ElMessage.warning("Select the data to be operated first");
return false;
}
ElMessageBox.confirm(`This action batch deletes the other dataWhether to continue?`, 'tip', {
confirmButtonText: 'confirm',
cancelButtonText: 'cancel',
type: 'warning',
})
.then(() => {
let id = state.multipleSelection.map(item => item.id)
deleteData(id.join()).then(res => {
getTableData();
ElMessage.success('删除成功');
ElMessage.success('delete successfully');
})
})
.catch(() => { });
}
//
const del = (row) => {
ElMessageBox.confirm(`This action deletes the other data${row.title}Whether to continue?`, 'tip', {
confirmButtonText: 'confirm',
cancelButtonText: 'cancel',
type: 'warning',
})
.then(() => {
deleteData(row.id).then(res => {
getTableData();
ElMessage.success('delete successfully');
})
})
.catch(() => { });
};
//
const onHandleDisasterSizeChange = (val) => {
state.disasterData.param.pageSize = val;
getDisasterData();
};
//
const onHandleDisasterCurrentChange = (val) => {
state.disasterData.param.pageNum = val;
getDisasterData();
};
//
const onHandleSizeChange = (val) => {
@ -251,14 +350,25 @@ const onHandleCurrentChange = (val) => {
};
//
onMounted(() => {
getDisasterData();
getTableData();
getDictionary({ code: 'disaster' }).then((res) => {
state.disasterTypeList = res;
});
});
</script>
<style>
.demo-tabs>.el-tabs__content {
padding: 32px;
color: #6b778c;
font-size: 32px;
font-weight: 600;
}
<style scoped lang="scss">
.system-role-container {
.system-role-padding {
padding: 15px;
.el-table {
flex: 1;
}

View File

@ -1,5 +1,6 @@
<template>
<div class="system-user-container" style="width:calc(100% - 10px) !important ;">
<el-config-provider :locale="en">
<el-row :gutter="10">
<el-col :span="24">
<el-card shadow="hover">
@ -87,6 +88,7 @@
</span>
</template>
</el-dialog>
</el-config-provider>
</div>
</template>

View File

@ -1,5 +1,6 @@
<template>
<div class="system-role-container layout-padding">
<el-config-provider :locale="en">
<div class="system-role-padding layout-padding-auto layout-padding-view">
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" style="margin-left: 20px">
<el-tab-pane label="unchecked" name="first">
@ -152,10 +153,12 @@
</span>
</template>
</el-dialog>
</el-config-provider>
</div>
</template>
<script setup name="userResponse">
import en from 'element-plus/dist/locale/en.mjs'
import { reactive, onMounted, ref, nextTick,watchEffect } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { getList, review } from '/@/api/disasterInfo/index';