glj-代码提交

This commit is contained in:
glj 2023-07-10 10:53:13 +08:00
parent ce8f57b50d
commit 2d92ca1eca
3 changed files with 121 additions and 76 deletions

View File

@ -2,7 +2,7 @@ import axios from 'axios';
import { ElMessage, ElMessageBox } from 'element-plus';
import qs from 'qs';
import { Session } from '/@/utils/storage';
export const moduleName = 'yyhouc-biz-vordm';
export const moduleName = 'biz-vordm';
export const crawlModule = 'vordm-crawl';
export const twitterModule = "vordm-twitter";
const service = axios.create({

View File

@ -42,6 +42,7 @@ const options = [
const emit = defineEmits(['callback']);
const adminAddFormRef = ref();
const state = reactive({
source:0,
isShowDialog: false,
isLoading:false,
ruleForm: {
@ -77,7 +78,8 @@ const resetField = () => {
//
const openDialog = (row) => {
state.isShowDialog = true;
state.disasterId = row;
state.disasterId = row.disasterId;
state.source = row.source;
};
//
const closeDialog = () => {
@ -97,6 +99,7 @@ const onSubmit = () => {
state.isLoading = true;
state.ruleForm.type = 2;
state.ruleForm.disasterId = state.disasterId;
state.ruleForm.source = state.source;
uploadData(state.ruleForm).then(res => {
ElMessage.success("Submit successfully");
emit('callback');

View File

@ -1,15 +1,15 @@
<template>
<div class="system-role-container layout-padding">
<el-row :gutter="22">
<el-col :span="10">
<div class="system-role-padding layout-padding-auto layout-padding-view" style="height: 85vh;">
<disasterTable @childClick="tableClick"></disasterTable>
</div>
</el-col>
<el-col :span="14">
<div class="system-role-padding layout-padding-auto layout-padding-view" style="height: 85vh;">
<div class="system-user-search mb15" style="display: flex;margin-left: 10px;margin-top: 10px;">
<!-- <el-input size="default" placeholder="please enter username" style="max-width: 180px" v-model="state.searchName"
<el-row :gutter="22">
<el-col :span="10">
<div class="system-role-padding layout-padding-auto layout-padding-view" style="height: 85vh;">
<disasterTable @childClick="tableClick"></disasterTable>
</div>
</el-col>
<el-col :span="14">
<div class="system-role-padding layout-padding-auto layout-padding-view" style="height: 85vh;">
<div class="system-user-search mb15" style="display: flex;margin-left: 10px;margin-top: 10px;">
<!-- <el-input size="default" placeholder="please enter username" style="max-width: 180px" v-model="state.searchName"
clearable></el-input>
<el-button size="default" type="primary" class="ml10" @click="getTableData">
<el-icon>
@ -17,69 +17,93 @@
</el-icon>
search
</el-button>-->
<el-button v-if="!state.nameNew" size="default" type="success" class="ml10" @click="generateData">
Generate
</el-button>
<el-button v-if="state.nameNew" size="default" type="success" class="ml10" @click="uploadData">
<el-icon>
<ele-Upload />
</el-icon>
Upload
</el-button>
<el-button size="default" type="danger" class="ml10" @click="batchDel">
<el-icon>
<ele-Delete />
</el-icon>
Batch delete
</el-button>
</div>
<el-tabs v-model="activeName" class="demo-tabs" @tab-change="handleClick" type="card">
<el-tab-pane label="Word cloud" name="first">
<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="date" label="Time" show-overflow-tooltip></el-table-column>
<el-table-column prop="frequency" label="Frequency" show-overflow-tooltip></el-table-column>
<el-table-column prop="word" label="Words" 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" @click="editWordCloud(scope.row)">Edit</el-button>
<el-button size="small" text type="primary" @click="delWordCloud(scope.row)">Delete</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
:pager-count="3" :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"
:total="state.tableData.total">
</el-pagination>
</el-tab-pane>
<el-tab-pane label="Hotspot area" name="second">
<el-table :data="state.tableData.data" v-loading="state.tableData.loading"
@selection-change="handleSelectionHotspotChange" style="width: 100%">
<el-table-column type="selection" width="55" />
<el-table-column type="index" label="ID" width="50" />
<el-table-column prop="areaCn" label="Area cn" show-overflow-tooltip></el-table-column>
<el-table-column prop="areaEn" label="Area en" show-overflow-tooltip></el-table-column>
<el-table-column prop="frequency" label="Frequency" 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" @click="editHotspot(scope.row)">Edit</el-button>
<el-button size="small" text type="primary" @click="delHotspot(scope.row)">Delete</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
:pager-count="3" :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"
:total="state.tableData.total">
</el-pagination>
</el-tab-pane>
</el-tabs>
<el-button v-if="!state.nameNew" size="default" type="success" class="ml10" @click="generateData">
Generate
</el-button>
<el-button v-if="state.nameNew" size="default" type="success" class="ml10" @click="uploadData">
<el-icon>
<ele-Upload />
</el-icon>
Upload
</el-button>
<el-button size="default" type="danger" class="ml10" @click="batchDel">
<el-icon>
<ele-Delete />
</el-icon>
Batch delete
</el-button>
</div>
</el-col>
</el-row>
<el-tabs v-model="activeName" class="demo-tabs" @tab-change="handleClick" type="card">
<el-tab-pane label="Word cloud" name="first">
<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="date" label="Time" show-overflow-tooltip></el-table-column>
<el-table-column prop="frequency" label="Frequency" show-overflow-tooltip></el-table-column>
<el-table-column prop="word" label="Words" 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" @click="editWordCloud(scope.row)">Edit</el-button>
<el-button size="small" text type="primary" @click="delWordCloud(scope.row)">Delete</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
:pager-count="3" :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"
:total="state.tableData.total">
</el-pagination>
</el-tab-pane>
<el-tab-pane label="Hotspot area" name="second">
<el-tabs v-model="activeNameNew" class="demo-tabs" @tab-change="handleClickNew" type="card">
<el-tab-pane label="NEWs" name="firstNew">
<el-table :data="state.tableData.data" v-loading="state.tableData.loading"
@selection-change="handleSelectionHotspotChange" style="width: 100%">
<el-table-column type="selection" width="55" />
<el-table-column type="index" label="ID" width="50" />
<el-table-column prop="areaCn" label="Area cn" show-overflow-tooltip></el-table-column>
<el-table-column prop="areaEn" label="Area en" show-overflow-tooltip></el-table-column>
<el-table-column prop="frequency" label="Frequency" 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" @click="editHotspot(scope.row)">Edit</el-button>
<el-button size="small" text type="primary" @click="delHotspot(scope.row)">Delete</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
:pager-count="3" :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"
:total="state.tableData.total">
</el-pagination>
</el-tab-pane>
<el-tab-pane label="GDACS" name="secondNew">
<el-table :data="state.tableData.data" v-loading="state.tableData.loading"
@selection-change="handleSelectionHotspotChange" style="width: 100%">
<el-table-column type="selection" width="55" />
<el-table-column type="index" label="ID" width="50" />
<el-table-column prop="areaCn" label="Area cn" show-overflow-tooltip></el-table-column>
<el-table-column prop="areaEn" label="Area en" 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" @click="editHotspot(scope.row)">Edit</el-button>
<el-button size="small" text type="primary" @click="delHotspot(scope.row)">Delete</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
:pager-count="3" :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"
:total="state.tableData.total">
</el-pagination>
</el-tab-pane>
</el-tabs>
</el-tab-pane>
</el-tabs>
</div>
</el-col>
</el-row>
<RoleDialog ref="roleDialogRef" @refresh="getTableData()" />
<HotspotForm ref="hotspotRef" @callback="getTableData" />
<WordClouds ref="wordCloudsRef" @callback="getTableData" />
@ -95,6 +119,7 @@ import EditHotspotForm from './component/editHotspotForm.vue';
import EditWordCloudsForm from './component/editWordCloudForm.vue';
import { getWordClouds, getHotspot, getDisasterPage, delData } from '/@/api/data/visualData.js';
const activeName = ref('first');
const activeNameNew = ref('firstNew');
const hotspotRef = ref();
const wordCloudsRef = ref();
const editHotspotRef = ref();
@ -115,6 +140,7 @@ const uploadRef = ref();
//
const roleDialogRef = ref();
const state = reactive({
source: 0,
nameNew: false,
multipleWord: [],
multipleHotspot: [],
@ -169,6 +195,18 @@ const handleClick = (tab) => {
}
getTableData();
};
const handleClickNew = (tab) => {
console.log( tab,"tabtabtab");
console.log( state.source);
if (tab === "secondNew") {
state.source = 1;
} else {
state.source = 0;
}
getTableData();
};
const auditData = (row) => {
let id = row.id
auditRef.value.openDialog([{ "id": id }]);
@ -229,7 +267,7 @@ const getTableData = () => {
state.tableData.total = res.total;
})
} else {
getHotspot(state.tableData.param.pageNum, state.tableData.param.pageSize, { "disasterId_equal": state.disasterId, "isDeleted_equal": 0 }).then(res => {
getHotspot(state.tableData.param.pageNum, state.tableData.param.pageSize, { "disasterId_equal": state.disasterId, "isDeleted_equal": 0, "source": state.source }).then(res => {
state.tableData.data = res.records;
state.tableData.total = res.total;
})
@ -240,11 +278,15 @@ const getTableData = () => {
};
//
const uploadData = () => {
if (state.disasterId == null) {
ElMessage.warning("Please select the disaster first")
return false;
}
state.tabVal == 'first' ? wordCloudsRef.value.openDialog(state.disasterId) : hotspotRef.value.openDialog(state.disasterId);
let dataRow = {};
dataRow.disasterId = state.disasterId;
dataRow.source = state.source;
state.tabVal == 'first' ? wordCloudsRef.value.openDialog(state.disasterId) : hotspotRef.value.openDialog(dataRow);
};
//
const generateData = () => {