glj-代码提交
This commit is contained in:
parent
4f7fea6259
commit
105feccee5
|
@ -5,191 +5,226 @@
|
|||
<el-image style="height:40px ; width:100px!" src="/baidu.jpg"></el-image>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="Confirm keywords" style="text-align:center;">
|
||||
<el-form-item label="Confirm keywords" style="text-align:center;">
|
||||
<el-input v-model="state.baidu.keywords">
|
||||
</el-input>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-form-item label="page" style="text-align:center ; margin-left: 10px;">
|
||||
<el-input v-model="state.baidu.page" type="number" style="width: 70px ;"></el-input>
|
||||
<el-form-item label="page" style="text-align:center ; margin-left: 10px;">
|
||||
<el-input v-model="state.baidu.page" type="number" style="width: 70px ;"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3" style="text-align:center ;">
|
||||
<el-icon :size="40" style="cursor:pointer ;" :title="state.baidu.status==0?'Waiting in queue……':'start'" :color="state.baidu.status==0?'#4f4':'blue'" @click="state.baidu.status==0?confirmBox('baidu'):start('baidu')" v-if="state.baiduOption.buttonIs&&(state.baidu.status==0||!state.baidu.status)">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-ea893728=""><path fill="currentColor" d="m249.6 417.088 319.744 43.072 39.168 310.272L845.12 178.88 249.6 417.088zm-129.024 47.168a32 32 0 0 1-7.68-61.44l777.792-311.04a32 32 0 0 1 41.6 41.6l-310.336 775.68a32 32 0 0 1-61.44-7.808L512 516.992l-391.424-52.736z"></path></svg>
|
||||
<el-icon :size="40" style="cursor:pointer ;" :title="state.baidu.status == 0 ? 'Waiting in queue……' : 'start'"
|
||||
:color="state.baidu.status == 0 ? '#4f4' : 'blue'"
|
||||
@click="state.baidu.status == 0 ? confirmBox('baidu') : start('baidu')"
|
||||
v-if="state.baiduOption.buttonIs && (state.baidu.status == 0 || !state.baidu.status)">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-ea893728="">
|
||||
<path fill="currentColor"
|
||||
d="m249.6 417.088 319.744 43.072 39.168 310.272L845.12 178.88 249.6 417.088zm-129.024 47.168a32 32 0 0 1-7.68-61.44l777.792-311.04a32 32 0 0 1 41.6 41.6l-310.336 775.68a32 32 0 0 1-61.44-7.808L512 516.992l-391.424-52.736z">
|
||||
</path>
|
||||
</svg>
|
||||
</el-icon>
|
||||
<el-icon :size="40" style="cursor:pointer ;" title="Data collection in progress, please wait……" color="#131313" v-if="state.baiduOption.buttonIs&&state.baidu.status==1">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-ea893728=""><path fill="currentColor" d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"></path></svg>
|
||||
<el-icon :size="40" style="cursor:pointer ;" title="Data collection in progress, please wait……"
|
||||
color="#131313" v-if="state.baiduOption.buttonIs && state.baidu.status == 1">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-ea893728="">
|
||||
<path fill="currentColor"
|
||||
d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z">
|
||||
</path>
|
||||
</svg>
|
||||
</el-icon>
|
||||
<el-icon :size="40" style="cursor:pointer ;" title="once more start" color="#4f4" @click="start('baidu')" v-if="state.baiduOption.buttonIs&&state.baidu.status==2">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-ea893728=""><path fill="currentColor" d="M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"></path></svg>
|
||||
<el-icon :size="40" style="cursor:pointer ;" title="once more start" color="#4f4" @click="start('baidu')"
|
||||
v-if="state.baiduOption.buttonIs && state.baidu.status == 2">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-ea893728="">
|
||||
<path fill="currentColor"
|
||||
d="M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z">
|
||||
</path>
|
||||
</svg>
|
||||
</el-icon>
|
||||
|
||||
<span v-if="!state.baiduOption.buttonIs" style="height: 40; line-height: 40px;">{{ state.baiduOption.runTitle }}</span>
|
||||
<span v-if="!state.baiduOption.buttonIs" style="height: 40; line-height: 40px;">{{
|
||||
state.baiduOption.runTitle }}</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="3" style="text-align:center ;">
|
||||
<el-image style="height:40px ; width:100px!" src="/bing.webp"></el-image>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="Confirm keywords" style="text-align:center ;">
|
||||
<el-input v-model="state.bing.keywords"></el-input>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="Confirm keywords" style="text-align:center ;">
|
||||
<el-input v-model="state.bing.keywords"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3" >
|
||||
<el-col :span="3">
|
||||
<el-form-item label="page" style="text-align:center; margin-left: 10px;">
|
||||
<el-input v-model="state.bing.page" type="number" style="width: 70px ;"></el-input>
|
||||
<el-input v-model="state.bing.page" type="number" style="width: 70px ;"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3" style="text-align:center ;">
|
||||
<el-icon :size="40" style="cursor:pointer ;" :title="state.bing.status==0?'Waiting in queue……':'start'" :color="state.bing.status==0?'#4f4':'blue'" @click="state.bing.status==0?confirmBox('bing'):start('bing')" v-if="state.bingOption.buttonIs&&(state.bing.status==0||!state.bing.status)">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-ea893728=""><path fill="currentColor" d="m249.6 417.088 319.744 43.072 39.168 310.272L845.12 178.88 249.6 417.088zm-129.024 47.168a32 32 0 0 1-7.68-61.44l777.792-311.04a32 32 0 0 1 41.6 41.6l-310.336 775.68a32 32 0 0 1-61.44-7.808L512 516.992l-391.424-52.736z"></path></svg>
|
||||
<el-icon :size="40" style="cursor:pointer ;" :title="state.bing.status == 0 ? 'Waiting in queue……' : 'start'"
|
||||
:color="state.bing.status == 0 ? '#4f4' : 'blue'"
|
||||
@click="state.bing.status == 0 ? confirmBox('bing') : start('bing')"
|
||||
v-if="state.bingOption.buttonIs && (state.bing.status == 0 || !state.bing.status)">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-ea893728="">
|
||||
<path fill="currentColor"
|
||||
d="m249.6 417.088 319.744 43.072 39.168 310.272L845.12 178.88 249.6 417.088zm-129.024 47.168a32 32 0 0 1-7.68-61.44l777.792-311.04a32 32 0 0 1 41.6 41.6l-310.336 775.68a32 32 0 0 1-61.44-7.808L512 516.992l-391.424-52.736z">
|
||||
</path>
|
||||
</svg>
|
||||
</el-icon>
|
||||
<el-icon :size="40" style="cursor:pointer ;" title="Data collection in progress, please wait……" color="#131313" v-if="state.buttonIs&&state.bing.status==1">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-ea893728=""><path fill="currentColor" d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"></path></svg>
|
||||
<el-icon :size="40" style="cursor:pointer ;" title="Data collection in progress, please wait……"
|
||||
color="#131313" v-if="state.buttonIs && state.bing.status == 1">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-ea893728="">
|
||||
<path fill="currentColor"
|
||||
d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z">
|
||||
</path>
|
||||
</svg>
|
||||
</el-icon>
|
||||
<el-icon :size="40" style="cursor:pointer ;" title="once more start" color="#4f4" @click="start('bing')" v-if="state.bingOption.buttonIs&&state.bing.status==2">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-ea893728=""><path fill="currentColor" d="M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"></path></svg>
|
||||
<el-icon :size="40" style="cursor:pointer ;" title="once more start" color="#4f4" @click="start('bing')"
|
||||
v-if="state.bingOption.buttonIs && state.bing.status == 2">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" data-v-ea893728="">
|
||||
<path fill="currentColor"
|
||||
d="M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z">
|
||||
</path>
|
||||
</svg>
|
||||
</el-icon>
|
||||
|
||||
<span v-if="!state.bingOption.buttonIs" style="height: 40; line-height: 40px;">{{ state.bingOption.runTitle }}</span>
|
||||
<span v-if="!state.bingOption.buttonIs" style="height: 40; line-height: 40px;">{{ state.bingOption.runTitle
|
||||
}}</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-row>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="state.isShowDialog=false" size="default">close</el-button>
|
||||
<el-button @click="state.isShowDialog = false" size="default">close</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup >
|
||||
import { ElMessage,ElMessageBox} from 'element-plus';
|
||||
import {reactive,defineExpose} from 'vue';
|
||||
import {news,submit,getList} from '/@/api/crawl/index';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { reactive, defineExpose } from 'vue';
|
||||
import { news, submit, getList } from '/@/api/crawl/index';
|
||||
import { useUserInfo } from '/@/stores/userInfo';
|
||||
const userInfo = useUserInfo();
|
||||
const state = reactive({
|
||||
isShowDialog:false,
|
||||
data:{},
|
||||
table:[],
|
||||
baidu:{
|
||||
keywords:"",
|
||||
page:5,
|
||||
disaster_id:undefined
|
||||
isShowDialog: false,
|
||||
data: {},
|
||||
table: [],
|
||||
baidu: {
|
||||
keywords: "",
|
||||
page: 5,
|
||||
disaster_id: undefined
|
||||
},
|
||||
bing:{
|
||||
keywords:"",
|
||||
page:10,
|
||||
disaster_id:undefined
|
||||
bing: {
|
||||
keywords: "",
|
||||
page: 10,
|
||||
disaster_id: undefined
|
||||
},
|
||||
baiduOption:{
|
||||
buttonIs:true,
|
||||
runTitle:""
|
||||
baiduOption: {
|
||||
buttonIs: true,
|
||||
runTitle: ""
|
||||
},
|
||||
bingOption:{
|
||||
buttonIs:true,
|
||||
runTitle:""
|
||||
bingOption: {
|
||||
buttonIs: true,
|
||||
runTitle: ""
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
const confirmBox = (text)=>{
|
||||
const confirmBox = (text) => {
|
||||
ElMessageBox.confirm(
|
||||
'Already in queue, continue to start?',
|
||||
'Warning',
|
||||
{
|
||||
confirmButtonText: 'OK',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
start(text)
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: 'restart success',
|
||||
'Already in queue, continue to start?',
|
||||
'Warning',
|
||||
{
|
||||
confirmButtonText: 'OK',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
start(text)
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: 'restart success',
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: 'Cancel restart',
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: 'Cancel restart',
|
||||
})
|
||||
})
|
||||
}
|
||||
const openDialog = (row) => {
|
||||
state.baidu={};
|
||||
state.bing={};
|
||||
state.baidu = {};
|
||||
state.bing = {};
|
||||
state.data = row;
|
||||
state.baidu.keywords = row.disasterKeyword;
|
||||
state.baidu.disaster_id = row.id
|
||||
state.bing.keywords=row.disasterKeyword;
|
||||
state.bing.keywords = row.disasterKeyword;
|
||||
state.bing.disaster_id = row.id
|
||||
getDate();
|
||||
state.isShowDialog = true;
|
||||
}
|
||||
const getDate = ()=>{
|
||||
getList(1,10,{disasterId:state.data.id}).then(res=>{
|
||||
const getDate = () => {
|
||||
getList(1, 10, { disasterId: state.data.id }).then(res => {
|
||||
let data = res.records;
|
||||
for (let index = 0; index < data.length; index++) {
|
||||
const element = data[index];
|
||||
if(element.type == 2){
|
||||
if (element.type == 2) {
|
||||
state.baidu = element;
|
||||
}
|
||||
if(element.type == 1){
|
||||
if (element.type == 1) {
|
||||
state.bing = element;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
state.baidu.page=10;
|
||||
state.bing.page=10;
|
||||
state.baidu.page = 10;
|
||||
state.bing.page = 10;
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
const start = (text)=>{
|
||||
state.baiduOption.runTitle="start(5s)";
|
||||
const start = (text) => {
|
||||
state.baiduOption.runTitle = "start(5s)";
|
||||
let count = 4;
|
||||
const countdown = setInterval(function() {
|
||||
if(text=='baidu'){
|
||||
state.baiduOption.runTitle="start("+count+"s)";
|
||||
}else{
|
||||
state.bingOption.runTitle="start("+count+"s)";
|
||||
const countdown = setInterval(function () {
|
||||
if (text == 'baidu') {
|
||||
state.baiduOption.runTitle = "start(" + count + "s)";
|
||||
} else {
|
||||
state.bingOption.runTitle = "start(" + count + "s)";
|
||||
}
|
||||
|
||||
|
||||
count -= 1;
|
||||
if (count < 0) {
|
||||
if(text=='baidu'){
|
||||
state.baiduOption.buttonIs= true ;
|
||||
}else{
|
||||
state.bingOption.buttonIs= true ;
|
||||
if (count < 0) {
|
||||
if (text == 'baidu') {
|
||||
state.baiduOption.buttonIs = true;
|
||||
} else {
|
||||
state.bingOption.buttonIs = true;
|
||||
}
|
||||
clearInterval(countdown);
|
||||
console.log('倒计时结束');
|
||||
}
|
||||
}, 1000);
|
||||
let keywords = (text=='baidu'?state.baidu.keywords:state.bing.keywords);
|
||||
let page = (text=='baidu'?state.baidu.page:state.bing.page);
|
||||
let id = (text=='baidu'?state.baidu.id:state.bing.id);
|
||||
let keywords = (text == 'baidu' ? state.baidu.keywords : state.bing.keywords);
|
||||
let page = (text == 'baidu' ? state.baidu.page : state.bing.page);
|
||||
let id = (text == 'baidu' ? state.baidu.id : state.bing.id);
|
||||
submit(
|
||||
{
|
||||
type:text=='baidu'?2:1,
|
||||
manageId:userInfo.userInfos.id,
|
||||
status:0,
|
||||
disasterId:state.data.id,
|
||||
keywords:keywords,
|
||||
id:(id?id:null)
|
||||
type: text == 'baidu' ? 2 : 1,
|
||||
manageId: userInfo.userInfos.id,
|
||||
status: 0,
|
||||
disasterId: state.data.id,
|
||||
keywords: keywords,
|
||||
id: (id ? id : null)
|
||||
}
|
||||
).then(ret=>{
|
||||
if(ret == 1042){
|
||||
).then(ret => {
|
||||
if (ret == 1042) {
|
||||
ElMessage.error("error")
|
||||
}else{
|
||||
news(ret.disasterId, keywords, page,(text=="baidu"),ret.id).then(res=>{
|
||||
} else {
|
||||
news(ret.disasterId, keywords, page, (text == "baidu"), ret.id).then(res => {
|
||||
getData();
|
||||
ElMessage.success("success")
|
||||
})
|
||||
ElMessage.success("Data is being acquired!")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -198,9 +233,6 @@ defineExpose({
|
|||
})
|
||||
|
||||
</script>
|
||||
<style >
|
||||
.inline-block {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
</style>
|
||||
<style >.inline-block {
|
||||
display: inline-block;
|
||||
}</style>
|
|
@ -1,79 +1,70 @@
|
|||
<template>
|
||||
<el-dialog title="edit picture" v-model="state.isShowDialog" width="700px" :close-on-click-modal="false" @close="closeDialog">
|
||||
<el-dialog title="edit picture" v-model="state.isShowDialog" width="700px" :close-on-click-modal="false"
|
||||
@close="closeDialog">
|
||||
<el-form :model="state.ruleForm" size="default" label-width="150px" :rules="rules" ref="adminAddFormRef">
|
||||
<el-form-item label="upload picture" prop="img">
|
||||
<el-upload
|
||||
ref="upFileRef"
|
||||
v-model:file-list="state.fileList"
|
||||
action="#"
|
||||
list-type="picture-card"
|
||||
accept="image/*"
|
||||
:on-preview="handlePictureCardPreview"
|
||||
:on-remove="handleRemove"
|
||||
:on-change="changeUpload"
|
||||
:limit="1"
|
||||
:auto-upload="false"
|
||||
:class="{hide: state.hideUpload }"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
<el-upload ref="upFileRef" v-model:file-list="state.fileList" action="#" list-type="picture-card" accept="image/*"
|
||||
:on-preview="handlePictureCardPreview" :on-remove="handleRemove" :on-change="changeUpload" :limit="1"
|
||||
:auto-upload="false" :class="{ hide: state.hideUpload }">
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>
|
||||
</el-upload>
|
||||
|
||||
<el-dialog v-model="state.dialogVisible">
|
||||
<img w-full :src="state.dialogImageUrl" alt="Preview Image" />
|
||||
</el-dialog>
|
||||
</el-form-item>
|
||||
<el-form-item prop="title" label="data title">
|
||||
<el-input v-model="state.ruleForm.title" class="m-2" placeholder="please enter data title" :rows="3" type="text"
|
||||
style="width:220px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="Home page show" prop="isMain">
|
||||
<el-select v-model="state.ruleForm.isMain" class="m-2" placeholder="please select home show">
|
||||
<el-option
|
||||
label="show"
|
||||
value="1"
|
||||
></el-option>
|
||||
<el-option
|
||||
label="not show"
|
||||
value="0"
|
||||
></el-option>
|
||||
<el-option label="show" value="1"></el-option>
|
||||
<el-option label="not show" value="0"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="onCancel" size="default">cancel</el-button>
|
||||
<el-button type="primary" @click="onSubmit" size="default" :loading="state.isLoading">upload</el-button>
|
||||
</span>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="onCancel" size="default">cancel</el-button>
|
||||
<el-button type="primary" @click="onSubmit" size="default" :loading="state.isLoading">upload</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import {reactive, ref} from "vue";
|
||||
import {updatePicture} from '/@/api/data/pictureInfo.js';
|
||||
import {ElMessage} from "element-plus";
|
||||
import { reactive, ref } from "vue";
|
||||
import { updatePicture } from '/@/api/data/pictureInfo.js';
|
||||
import { ElMessage } from "element-plus";
|
||||
import { UploadFilled } from '@element-plus/icons-vue'
|
||||
import {computed} from "@vue/reactivity";
|
||||
import { computed } from "@vue/reactivity";
|
||||
const upFileRef = ref();
|
||||
const emit = defineEmits(['callback']);
|
||||
const adminAddFormRef = ref();
|
||||
const state = reactive({
|
||||
dialogVisible:false,
|
||||
dialogImageUrl:'',
|
||||
disabled:false,
|
||||
hideUpload:false,
|
||||
fileList:[],
|
||||
dialogVisible: false,
|
||||
dialogImageUrl: '',
|
||||
disabled: false,
|
||||
hideUpload: false,
|
||||
fileList: [],
|
||||
isShowDialog: false,
|
||||
isLoading:false,
|
||||
isLoading: false,
|
||||
ruleForm: {
|
||||
},
|
||||
tableData: [],
|
||||
//字典值
|
||||
dictData: [],
|
||||
unitData:[],
|
||||
unitData: [],
|
||||
standardId: '',
|
||||
detectionData: [],
|
||||
disasterId:null,
|
||||
dataForm:new FormData(),
|
||||
fileArray:[],
|
||||
id:null,
|
||||
disasterId: null,
|
||||
dataForm: new FormData(),
|
||||
fileArray: [],
|
||||
id: null,
|
||||
})
|
||||
//上传图片改变时
|
||||
const changeUpload = (file, fileList) => {
|
||||
|
@ -82,23 +73,23 @@ const changeUpload = (file, fileList) => {
|
|||
}
|
||||
//验证图片
|
||||
const validImg = (rule, value, callback) => {
|
||||
if(state.fileList.length>0){
|
||||
if (state.fileList.length > 0) {
|
||||
adminAddFormRef.value.clearValidate('img')
|
||||
callback();
|
||||
}else{
|
||||
} else {
|
||||
return callback(new Error('please upload image'));
|
||||
}
|
||||
}
|
||||
//校验规则
|
||||
const rules = reactive({
|
||||
img: [
|
||||
{required: true,trigger: 'change',validator:validImg}
|
||||
{ required: true, trigger: 'change', validator: validImg }
|
||||
],
|
||||
isMain: [
|
||||
{required: true, message: 'please select home page show', trigger: 'change'}
|
||||
{ required: true, message: 'please select home page show', trigger: 'change' }
|
||||
],
|
||||
remark:[
|
||||
{required: true, message: 'please select data details', trigger: 'blur'}
|
||||
remark: [
|
||||
{ required: true, message: 'please select data details', trigger: 'blur' }
|
||||
],
|
||||
})
|
||||
//图片删除
|
||||
|
@ -125,7 +116,7 @@ const uploadPic = (data) => {
|
|||
}
|
||||
//移除时
|
||||
const removePic = (data) => {
|
||||
state.fileArray.splice(state.fileArray.findIndex(item=>item.uid===data.raw.uid), 1)
|
||||
state.fileArray.splice(state.fileArray.findIndex(item => item.uid === data.raw.uid), 1)
|
||||
console.log(state.fileArray)
|
||||
}
|
||||
//重置表单
|
||||
|
@ -139,10 +130,11 @@ const resetField = () => {
|
|||
const openDialog = (row) => {
|
||||
state.isShowDialog = true;
|
||||
//回显图片
|
||||
state.fileList.push({'name':row.name,'uid':row.id,'url':row.link});
|
||||
state.fileList.push({ 'name': row.name, 'uid': row.id, 'url': row.link });
|
||||
state.hideUpload = state.fileList.length >= 1
|
||||
//state.dialogImageUrl = row.link;
|
||||
state.ruleForm.isMain = row.isMain+"";
|
||||
state.ruleForm.isMain = row.isMain + "";
|
||||
state.ruleForm.title = row.name;
|
||||
state.id = row.id
|
||||
};
|
||||
// 关闭弹窗
|
||||
|
@ -162,18 +154,24 @@ const onSubmit = () => {
|
|||
if (valid) {
|
||||
console.log(state.fileList);
|
||||
state.isLoading = true;
|
||||
state.fileList.forEach(item=>{
|
||||
state.dataForm.append('file',item.raw);
|
||||
|
||||
state.fileList.forEach(item => {
|
||||
console.log(item.raw,"item.raw");
|
||||
if (item.raw) {
|
||||
console.log(1111111111111);
|
||||
state.dataForm.append('file', item.raw);
|
||||
}
|
||||
})
|
||||
state.dataForm.append('isMain',state.ruleForm.isMain);
|
||||
state.dataForm.append('id',state.id);
|
||||
for(let [a, b] of state.dataForm.entries()){
|
||||
state.dataForm.append('isMain', state.ruleForm.isMain);
|
||||
state.dataForm.append('id', state.id);
|
||||
state.dataForm.append('name', state.ruleForm.title);
|
||||
for (let [a, b] of state.dataForm.entries()) {
|
||||
console.log(a, b, '--------------');
|
||||
}
|
||||
updatePicture(state.dataForm).then(res => {
|
||||
ElMessage.success("Upload successfully");
|
||||
emit('callback');
|
||||
}).finally(()=>{
|
||||
}).finally(() => {
|
||||
state.isLoading = false;
|
||||
})
|
||||
closeDialog();
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
<div class="system-role-padding layout-padding-auto layout-padding-view" style="height: 80vh;">
|
||||
|
||||
<disasterTable @childClick="tableClick">
|
||||
<el-table-column prop="Operate" label="Operate" width="85" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-button size="small" text type="primary" @click="startBot(scope.row)">start</el-button>
|
||||
<!-- <el-tag type="info" v-if="scope.row.respondStatus == 3">complete</el-tag> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</disasterTable>
|
||||
<el-table-column prop="Operate" label="Operate" width="85" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-button size="small" text type="primary" @click="startBot(scope.row)">start</el-button>
|
||||
<!-- <el-tag type="info" v-if="scope.row.respondStatus == 3">complete</el-tag> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</disasterTable>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="14">
|
||||
|
@ -43,29 +43,35 @@
|
|||
<!-- id,卫星类型,生产日期,产品谱段,产品分辨率,云覆盖量,景中心经纬度,元数据下载链接,缩略图 支撑单位 -->
|
||||
<el-table :data="state.requestData" style="width: 1000Px;">
|
||||
<el-table-column type="index" label="Index" align="center" width="80"></el-table-column>
|
||||
<el-table-column prop="satelliteCode" label="Satellite code" width="170" align="center"
|
||||
<el-table-column prop="satelliteCode" label="Satellite code" width="170" align="center" show-overflow-tooltip
|
||||
sortable></el-table-column>
|
||||
<el-table-column prop="productTime" label="Product time" width="170" align="center" show-overflow-tooltip
|
||||
sortable></el-table-column>
|
||||
<el-table-column prop="productBandsNum" label="Product bands num" width="200" align="center"
|
||||
show-overflow-tooltip sortable></el-table-column>
|
||||
<el-table-column prop="productTime" label="Product time" width="170" align="center"
|
||||
<el-table-column prop="productResolution" label="Product resolution(m)" width="220" align="center"
|
||||
show-overflow-tooltip sortable></el-table-column>
|
||||
<el-table-column prop="productBandsNum" label="Product bands num" width="200" align="center"
|
||||
<el-table-column prop="cloudCover" label="Cloud cover(%)" align="center" width="180" show-overflow-tooltip
|
||||
sortable></el-table-column>
|
||||
<el-table-column prop="sourceOrganization" label="Source organization" width="200" align="center"
|
||||
show-overflow-tooltip sortable></el-table-column>
|
||||
<el-table-column prop="productResolution" label="Product resolution(m)" width="220" align="center"
|
||||
show-overflow-tooltip sortable></el-table-column>
|
||||
<el-table-column prop="cloudCover" label="Cloud cover(%)" align="center" width="180"
|
||||
show-overflow-tooltip sortable></el-table-column>
|
||||
<el-table-column prop="sourceOrganization" label="Source organization" width="200" align="center"
|
||||
show-overflow-tooltip sortable></el-table-column>
|
||||
<el-table-column prop="downloadUrl" label="Download url" align="center" width="200" show-overflow-tooltip>
|
||||
<el-table-column prop="downloadUrl" label="Download url" align="center" width="200" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="Operate" label="Operate" align="center" width="200" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-button size="small" text type="primary" @click="reviseDownload(scope.row)">start</el-button>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
|
||||
style="margin-right: 20px;" :page-sizes="[10, 20, 30]" background v-model:current-page="state.tableData.param.pageNum"
|
||||
v-model:page-size="state.tableData.param.pageSize" layout="total, sizes, prev, pager, next"
|
||||
:total="state.tableData.total">
|
||||
style="margin-right: 20px;" :page-sizes="[10, 20, 30]" background
|
||||
v-model:current-page="state.tableData.param.pageNum" v-model:page-size="state.tableData.param.pageSize"
|
||||
layout="total, sizes, prev, pager, next" :total="state.tableData.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<reviseDownloadUrl ref="reviseDownloadUrlRef" @callback="getTableData"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -74,9 +80,10 @@ import { ref, reactive, onMounted } from 'vue';
|
|||
import { getRemoteSensingSourceData, getRemoteSensingSourceDataByCondition, getPagesRemoteSensingSourceData } from "/@/api/remoteSensingSourceData/remoteSensingSourceData.js";
|
||||
import { getDisasterPage } from '/@/api/data/otherData.js'
|
||||
import disasterTable from "/@/components/table/DisasterTable.vue";
|
||||
import reviseDownloadUrl from "./reviseDownloadUrl.vue";
|
||||
|
||||
// import { getList as getDisasterPage } from '/@/api/disasterInfo/index';
|
||||
|
||||
const reviseDownloadUrlRef = ref();
|
||||
const state = reactive({
|
||||
disasterData: {
|
||||
data: [],
|
||||
|
@ -146,7 +153,7 @@ const state = reactive({
|
|||
requestSatellite: []
|
||||
})
|
||||
const emit = defineEmits(['response']);
|
||||
const startBot=(row)=>{
|
||||
const startBot = (row) => {
|
||||
emit('response', row);
|
||||
}
|
||||
// 初始化灾害表格数据
|
||||
|
@ -268,6 +275,12 @@ const searchRemoteSensingSourceData = () => {
|
|||
getDataByCondition(state.tableData.param.pageNum, state.tableData.param.pageSize, dataNew)
|
||||
}
|
||||
|
||||
const reviseDownload = (row) =>{
|
||||
|
||||
console.log(row,"rowrowrow");
|
||||
}
|
||||
|
||||
|
||||
// 根据检索条件检索遥感元数据
|
||||
const getDataByCondition = (current, size, dataNew) => {
|
||||
console.log('传过来的数据:', state.tableData.param.pageNum);
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
<template>
|
||||
<el-dialog title="upload" v-model="state.isShowDialog" width="700px">
|
||||
<el-form :model="state.ruleForm" size="default" label-width="120px" :rules="rules" ref="adminAddFormRef">
|
||||
<el-form-item label="area cn" prop="areaCn">
|
||||
<el-input v-model="state.ruleForm.areaCn" placeholder="please enter area cn" style="width: 300px"/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="areaEn" label="area en">
|
||||
<el-input v-model="state.ruleForm.areaEn" placeholder="please enter area en" style="width: 300px"/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="frequency" label="frequency">
|
||||
<el-input v-model="state.ruleForm.frequency" placeholder="please enter frequency" style="width: 300px"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="onCancel" size="default">cancel</el-button>
|
||||
<el-button type="primary" @click="onSubmit" size="default" :loading="state.isLoading">submit</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {reactive, ref} from "vue";
|
||||
import {uploadData} from '/@/api/data/visualData.js';
|
||||
import {ElMessage} from "element-plus";
|
||||
import { UploadFilled } from '@element-plus/icons-vue'
|
||||
const options = [
|
||||
{
|
||||
value: '0',
|
||||
label: 'basic data',
|
||||
},
|
||||
{
|
||||
value: '1',
|
||||
label: 'responded report',
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: 'cartographic product',
|
||||
}
|
||||
]
|
||||
const emit = defineEmits(['callback']);
|
||||
const adminAddFormRef = ref();
|
||||
const state = reactive({
|
||||
isShowDialog: false,
|
||||
isLoading:false,
|
||||
ruleForm: {
|
||||
},
|
||||
tableData: [],
|
||||
//字典值
|
||||
dictData: [],
|
||||
unitData:[],
|
||||
standardId: '',
|
||||
detectionData: [],
|
||||
disasterId:null,
|
||||
dataForm:new FormData(),
|
||||
fileArray:[],
|
||||
})
|
||||
const uploadPic = (data) => {
|
||||
state.fileArray.push(data.file);
|
||||
}
|
||||
//移除时
|
||||
const removePic = (data) => {
|
||||
state.fileArray.splice(state.fileArray.findIndex(item=>item.uid===data.raw.uid), 1)
|
||||
console.log(state.fileArray)
|
||||
}
|
||||
//校验规则
|
||||
const rules = reactive({
|
||||
status: [
|
||||
{required: true, message: 'please check pass or not', trigger: 'change'}
|
||||
]
|
||||
})
|
||||
//重置表单
|
||||
const resetField = () => {
|
||||
adminAddFormRef.value.resetFields();
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (row) => {
|
||||
state.isShowDialog = true;
|
||||
state.disasterId = row;
|
||||
};
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
state.isShowDialog = false;
|
||||
//重置表格数据
|
||||
state.ruleForm.tableData = [];
|
||||
resetField();
|
||||
};
|
||||
// 取消
|
||||
const onCancel = () => {
|
||||
closeDialog();
|
||||
};
|
||||
// 新增
|
||||
const onSubmit = () => {
|
||||
adminAddFormRef.value.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
state.isLoading = true;
|
||||
state.ruleForm.type = 2;
|
||||
state.ruleForm.disasterId = state.disasterId;
|
||||
uploadData(state.ruleForm).then(res => {
|
||||
ElMessage.success("Submit successfully");
|
||||
emit('callback');
|
||||
}).finally(()=>{
|
||||
state.isLoading = false;
|
||||
})
|
||||
closeDialog();
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
Loading…
Reference in New Issue