glj-代码提交

This commit is contained in:
glj 2023-05-08 09:09:20 +08:00
parent 4f7fea6259
commit 105feccee5
4 changed files with 356 additions and 192 deletions

View File

@ -16,85 +16,121 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="3" style="text-align:center ;"> <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)"> <el-icon :size="40" style="cursor:pointer ;" :title="state.baidu.status == 0 ? 'Waiting in queue……' : 'start'"
<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> :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>
<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"> <el-icon :size="40" style="cursor:pointer ;" title="Data collection in progress, please wait……"
<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> 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>
<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"> <el-icon :size="40" style="cursor:pointer ;" title="once more start" color="#4f4" @click="start('baidu')"
<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> 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> </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-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="3" style="text-align:center ;"> <el-col :span="3" style="text-align:center ;">
<el-image style="height:40px ; width:100px!" src="/bing.webp"></el-image> <el-image style="height:40px ; width:100px!" src="/bing.webp"></el-image>
</el-col> </el-col>
<el-col :span="12" > <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.bing.keywords"></el-input> <el-input v-model="state.bing.keywords"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="3" > <el-col :span="3">
<el-form-item label="page" style="text-align:center; margin-left: 10px;"> <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-form-item>
</el-col> </el-col>
<el-col :span="3" style="text-align:center ;"> <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)"> <el-icon :size="40" style="cursor:pointer ;" :title="state.bing.status == 0 ? 'Waiting in queue……' : 'start'"
<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> :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>
<el-icon :size="40" style="cursor:pointer ;" title="Data collection in progress, please wait……" color="#131313" v-if="state.buttonIs&&state.bing.status==1"> <el-icon :size="40" style="cursor:pointer ;" title="Data collection in progress, please wait……"
<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> 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>
<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"> <el-icon :size="40" style="cursor:pointer ;" title="once more start" color="#4f4" @click="start('bing')"
<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> 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> </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-col>
</el-row> </el-row>
<template #footer> <template #footer>
<span class="dialog-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> </span>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
<script setup > <script setup >
import { ElMessage,ElMessageBox} from 'element-plus'; import { ElMessage, ElMessageBox } from 'element-plus';
import {reactive,defineExpose} from 'vue'; import { reactive, defineExpose } from 'vue';
import {news,submit,getList} from '/@/api/crawl/index'; import { news, submit, getList } from '/@/api/crawl/index';
import { useUserInfo } from '/@/stores/userInfo'; import { useUserInfo } from '/@/stores/userInfo';
const userInfo = useUserInfo(); const userInfo = useUserInfo();
const state = reactive({ const state = reactive({
isShowDialog:false, isShowDialog: false,
data:{}, data: {},
table:[], table: [],
baidu:{ baidu: {
keywords:"", keywords: "",
page:5, page: 5,
disaster_id:undefined disaster_id: undefined
}, },
bing:{ bing: {
keywords:"", keywords: "",
page:10, page: 10,
disaster_id:undefined disaster_id: undefined
}, },
baiduOption:{ baiduOption: {
buttonIs:true, buttonIs: true,
runTitle:"" runTitle: ""
}, },
bingOption:{ bingOption: {
buttonIs:true, buttonIs: true,
runTitle:"" runTitle: ""
} }
}) })
const confirmBox = (text)=>{ const confirmBox = (text) => {
ElMessageBox.confirm( ElMessageBox.confirm(
'Already in queue, continue to start?', 'Already in queue, continue to start?',
'Warning', 'Warning',
@ -119,77 +155,76 @@ const confirmBox = (text)=>{
}) })
} }
const openDialog = (row) => { const openDialog = (row) => {
state.baidu={}; state.baidu = {};
state.bing={}; state.bing = {};
state.data = row; state.data = row;
state.baidu.keywords = row.disasterKeyword; state.baidu.keywords = row.disasterKeyword;
state.baidu.disaster_id = row.id state.baidu.disaster_id = row.id
state.bing.keywords=row.disasterKeyword; state.bing.keywords = row.disasterKeyword;
state.bing.disaster_id = row.id state.bing.disaster_id = row.id
getDate(); getDate();
state.isShowDialog = true; state.isShowDialog = true;
} }
const getDate = ()=>{ const getDate = () => {
getList(1,10,{disasterId:state.data.id}).then(res=>{ getList(1, 10, { disasterId: state.data.id }).then(res => {
let data = res.records; let data = res.records;
for (let index = 0; index < data.length; index++) { for (let index = 0; index < data.length; index++) {
const element = data[index]; const element = data[index];
if(element.type == 2){ if (element.type == 2) {
state.baidu = element; state.baidu = element;
} }
if(element.type == 1){ if (element.type == 1) {
state.bing = element; state.bing = element;
} }
} }
state.baidu.page=10; state.baidu.page = 10;
state.bing.page=10; state.bing.page = 10;
}) })
} }
const start = (text)=>{ const start = (text) => {
state.baiduOption.runTitle="start(5s)"; state.baiduOption.runTitle = "start(5s)";
let count = 4; let count = 4;
const countdown = setInterval(function() { const countdown = setInterval(function () {
if(text=='baidu'){ if (text == 'baidu') {
state.baiduOption.runTitle="start("+count+"s)"; state.baiduOption.runTitle = "start(" + count + "s)";
}else{ } else {
state.bingOption.runTitle="start("+count+"s)"; state.bingOption.runTitle = "start(" + count + "s)";
} }
count -= 1; count -= 1;
if (count < 0) { if (count < 0) {
if(text=='baidu'){ if (text == 'baidu') {
state.baiduOption.buttonIs= true ; state.baiduOption.buttonIs = true;
}else{ } else {
state.bingOption.buttonIs= true ; state.bingOption.buttonIs = true;
} }
clearInterval(countdown); clearInterval(countdown);
console.log('倒计时结束'); console.log('倒计时结束');
} }
}, 1000); }, 1000);
let keywords = (text=='baidu'?state.baidu.keywords:state.bing.keywords); let keywords = (text == 'baidu' ? state.baidu.keywords : state.bing.keywords);
let page = (text=='baidu'?state.baidu.page:state.bing.page); let page = (text == 'baidu' ? state.baidu.page : state.bing.page);
let id = (text=='baidu'?state.baidu.id:state.bing.id); let id = (text == 'baidu' ? state.baidu.id : state.bing.id);
submit( submit(
{ {
type:text=='baidu'?2:1, type: text == 'baidu' ? 2 : 1,
manageId:userInfo.userInfos.id, manageId: userInfo.userInfos.id,
status:0, status: 0,
disasterId:state.data.id, disasterId: state.data.id,
keywords:keywords, keywords: keywords,
id:(id?id:null) id: (id ? id : null)
} }
).then(ret=>{ ).then(ret => {
if(ret == 1042){ if (ret == 1042) {
ElMessage.error("error") ElMessage.error("error")
}else{ } else {
news(ret.disasterId, keywords, page,(text=="baidu"),ret.id).then(res=>{ news(ret.disasterId, keywords, page, (text == "baidu"), ret.id).then(res => {
getData(); getData();
ElMessage.success("success")
}) })
ElMessage.success("Data is being acquired!")
} }
}) })
} }
@ -198,9 +233,6 @@ defineExpose({
}) })
</script> </script>
<style > <style >.inline-block {
.inline-block {
display: inline-block; display: inline-block;
} }</style>
</style>

View File

@ -1,37 +1,28 @@
<template> <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 :model="state.ruleForm" size="default" label-width="150px" :rules="rules" ref="adminAddFormRef">
<el-form-item label="upload picture" prop="img"> <el-form-item label="upload picture" prop="img">
<el-upload <el-upload ref="upFileRef" v-model:file-list="state.fileList" action="#" list-type="picture-card" accept="image/*"
ref="upFileRef" :on-preview="handlePictureCardPreview" :on-remove="handleRemove" :on-change="changeUpload" :limit="1"
v-model:file-list="state.fileList" :auto-upload="false" :class="{ hide: state.hideUpload }">
action="#" <el-icon>
list-type="picture-card" <Plus />
accept="image/*" </el-icon>
: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-upload>
<el-dialog v-model="state.dialogVisible"> <el-dialog v-model="state.dialogVisible">
<img w-full :src="state.dialogImageUrl" alt="Preview Image" /> <img w-full :src="state.dialogImageUrl" alt="Preview Image" />
</el-dialog> </el-dialog>
</el-form-item> </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-form-item label="Home page show" prop="isMain">
<el-select v-model="state.ruleForm.isMain" class="m-2" placeholder="please select home show"> <el-select v-model="state.ruleForm.isMain" class="m-2" placeholder="please select home show">
<el-option <el-option label="show" value="1"></el-option>
label="show" <el-option label="not show" value="0"></el-option>
value="1"
></el-option>
<el-option
label="not show"
value="0"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -46,34 +37,34 @@
<script setup> <script setup>
import { Plus } from '@element-plus/icons-vue' import { Plus } from '@element-plus/icons-vue'
import {reactive, ref} from "vue"; import { reactive, ref } from "vue";
import {updatePicture} from '/@/api/data/pictureInfo.js'; import { updatePicture } from '/@/api/data/pictureInfo.js';
import {ElMessage} from "element-plus"; import { ElMessage } from "element-plus";
import { UploadFilled } from '@element-plus/icons-vue' import { UploadFilled } from '@element-plus/icons-vue'
import {computed} from "@vue/reactivity"; import { computed } from "@vue/reactivity";
const upFileRef = ref(); const upFileRef = ref();
const emit = defineEmits(['callback']); const emit = defineEmits(['callback']);
const adminAddFormRef = ref(); const adminAddFormRef = ref();
const state = reactive({ const state = reactive({
dialogVisible:false, dialogVisible: false,
dialogImageUrl:'', dialogImageUrl: '',
disabled:false, disabled: false,
hideUpload:false, hideUpload: false,
fileList:[], fileList: [],
isShowDialog: false, isShowDialog: false,
isLoading:false, isLoading: false,
ruleForm: { ruleForm: {
}, },
tableData: [], tableData: [],
// //
dictData: [], dictData: [],
unitData:[], unitData: [],
standardId: '', standardId: '',
detectionData: [], detectionData: [],
disasterId:null, disasterId: null,
dataForm:new FormData(), dataForm: new FormData(),
fileArray:[], fileArray: [],
id:null, id: null,
}) })
// //
const changeUpload = (file, fileList) => { const changeUpload = (file, fileList) => {
@ -82,23 +73,23 @@ const changeUpload = (file, fileList) => {
} }
// //
const validImg = (rule, value, callback) => { const validImg = (rule, value, callback) => {
if(state.fileList.length>0){ if (state.fileList.length > 0) {
adminAddFormRef.value.clearValidate('img') adminAddFormRef.value.clearValidate('img')
callback(); callback();
}else{ } else {
return callback(new Error('please upload image')); return callback(new Error('please upload image'));
} }
} }
// //
const rules = reactive({ const rules = reactive({
img: [ img: [
{required: true,trigger: 'change',validator:validImg} { required: true, trigger: 'change', validator: validImg }
], ],
isMain: [ isMain: [
{required: true, message: 'please select home page show', trigger: 'change'} { required: true, message: 'please select home page show', trigger: 'change' }
], ],
remark:[ remark: [
{required: true, message: 'please select data details', trigger: 'blur'} { required: true, message: 'please select data details', trigger: 'blur' }
], ],
}) })
// //
@ -125,7 +116,7 @@ const uploadPic = (data) => {
} }
// //
const removePic = (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) console.log(state.fileArray)
} }
// //
@ -139,10 +130,11 @@ const resetField = () => {
const openDialog = (row) => { const openDialog = (row) => {
state.isShowDialog = true; 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.hideUpload = state.fileList.length >= 1
//state.dialogImageUrl = row.link; //state.dialogImageUrl = row.link;
state.ruleForm.isMain = row.isMain+""; state.ruleForm.isMain = row.isMain + "";
state.ruleForm.title = row.name;
state.id = row.id state.id = row.id
}; };
// //
@ -162,18 +154,24 @@ const onSubmit = () => {
if (valid) { if (valid) {
console.log(state.fileList); console.log(state.fileList);
state.isLoading = true; 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('isMain', state.ruleForm.isMain);
state.dataForm.append('id',state.id); state.dataForm.append('id', state.id);
for(let [a, b] of state.dataForm.entries()){ state.dataForm.append('name', state.ruleForm.title);
for (let [a, b] of state.dataForm.entries()) {
console.log(a, b, '--------------'); console.log(a, b, '--------------');
} }
updatePicture(state.dataForm).then(res => { updatePicture(state.dataForm).then(res => {
ElMessage.success("Upload successfully"); ElMessage.success("Upload successfully");
emit('callback'); emit('callback');
}).finally(()=>{ }).finally(() => {
state.isLoading = false; state.isLoading = false;
}) })
closeDialog(); closeDialog();

View File

@ -43,29 +43,35 @@
<!-- id卫星类型生产日期产品谱段产品分辨率云覆盖量景中心经纬度元数据下载链接缩略图 支撑单位 --> <!-- id卫星类型生产日期产品谱段产品分辨率云覆盖量景中心经纬度元数据下载链接缩略图 支撑单位 -->
<el-table :data="state.requestData" style="width: 1000Px;"> <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 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
show-overflow-tooltip sortable></el-table-column> sortable></el-table-column>
<el-table-column prop="productTime" label="Product time" width="170" align="center" <el-table-column prop="productTime" label="Product time" width="170" align="center" show-overflow-tooltip
show-overflow-tooltip sortable></el-table-column> sortable></el-table-column>
<el-table-column prop="productBandsNum" label="Product bands num" width="200" align="center" <el-table-column prop="productBandsNum" label="Product bands num" width="200" align="center"
show-overflow-tooltip sortable></el-table-column> show-overflow-tooltip sortable></el-table-column>
<el-table-column prop="productResolution" label="Product resolution(m)" width="220" align="center" <el-table-column prop="productResolution" label="Product resolution(m)" width="220" align="center"
show-overflow-tooltip sortable></el-table-column> show-overflow-tooltip sortable></el-table-column>
<el-table-column prop="cloudCover" label="Cloud cover(%)" align="center" width="180" <el-table-column prop="cloudCover" label="Cloud cover(%)" align="center" width="180" show-overflow-tooltip
show-overflow-tooltip sortable></el-table-column> sortable></el-table-column>
<el-table-column prop="sourceOrganization" label="Source organization" width="200" align="center" <el-table-column prop="sourceOrganization" label="Source organization" width="200" align="center"
show-overflow-tooltip sortable></el-table-column> 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>
<!-- <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-table>
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15" <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" style="margin-right: 20px;" :page-sizes="[10, 20, 30]" background
v-model:page-size="state.tableData.param.pageSize" layout="total, sizes, prev, pager, next" v-model:current-page="state.tableData.param.pageNum" v-model:page-size="state.tableData.param.pageSize"
:total="state.tableData.total"> layout="total, sizes, prev, pager, next" :total="state.tableData.total">
</el-pagination> </el-pagination>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<reviseDownloadUrl ref="reviseDownloadUrlRef" @callback="getTableData"/>
</div> </div>
</template> </template>
@ -74,9 +80,10 @@ import { ref, reactive, onMounted } from 'vue';
import { getRemoteSensingSourceData, getRemoteSensingSourceDataByCondition, getPagesRemoteSensingSourceData } from "/@/api/remoteSensingSourceData/remoteSensingSourceData.js"; import { getRemoteSensingSourceData, getRemoteSensingSourceDataByCondition, getPagesRemoteSensingSourceData } from "/@/api/remoteSensingSourceData/remoteSensingSourceData.js";
import { getDisasterPage } from '/@/api/data/otherData.js' import { getDisasterPage } from '/@/api/data/otherData.js'
import disasterTable from "/@/components/table/DisasterTable.vue"; import disasterTable from "/@/components/table/DisasterTable.vue";
import reviseDownloadUrl from "./reviseDownloadUrl.vue";
// import { getList as getDisasterPage } from '/@/api/disasterInfo/index'; // import { getList as getDisasterPage } from '/@/api/disasterInfo/index';
const reviseDownloadUrlRef = ref();
const state = reactive({ const state = reactive({
disasterData: { disasterData: {
data: [], data: [],
@ -146,7 +153,7 @@ const state = reactive({
requestSatellite: [] requestSatellite: []
}) })
const emit = defineEmits(['response']); const emit = defineEmits(['response']);
const startBot=(row)=>{ const startBot = (row) => {
emit('response', row); emit('response', row);
} }
// //
@ -268,6 +275,12 @@ const searchRemoteSensingSourceData = () => {
getDataByCondition(state.tableData.param.pageNum, state.tableData.param.pageSize, dataNew) getDataByCondition(state.tableData.param.pageNum, state.tableData.param.pageSize, dataNew)
} }
const reviseDownload = (row) =>{
console.log(row,"rowrowrow");
}
// //
const getDataByCondition = (current, size, dataNew) => { const getDataByCondition = (current, size, dataNew) => {
console.log('传过来的数据:', state.tableData.param.pageNum); console.log('传过来的数据:', state.tableData.param.pageNum);

View File

@ -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>