glj-代码提交

This commit is contained in:
glj 2023-04-25 18:30:08 +08:00
parent b370c7cc01
commit 0d8bc1921a
7 changed files with 307 additions and 261 deletions

View File

@ -81,4 +81,17 @@ export const deleteData = (id) => {
id
}
});
};
};
/**
* 修改实体数据
* @param data
* @returns {Promise<AxiosResponse<any>>}
*/
export const updateEntityData = (data) => {
return request({
url: '/api/' + moduleName + '/ui/EntityData/updateEntityData',
method: 'post',
data: data
});
};

View File

@ -1,6 +1,6 @@
<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-dialog title="upload" v-model="state.isShowDialog" width="500px">
<el-form :model="state.ruleForm" size="default" label-width="120px" :rules="rules" ref="adminAddFormRef" style="margin-left: 6%;">
<el-form-item label="upload picture" prop="img">
<el-upload ref="upFileRef" class="upload-demo" drag accept="image/*" action="#" multiple :http-request="uploadPic"
:on-remove="removePic" :before-upload="beforeUpload">
@ -15,6 +15,10 @@
</template>
</el-upload>
</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 prop="type" label="data type">
<el-select v-model="state.ruleForm.type" class="m-2" placeholder="please select data type">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
@ -149,6 +153,7 @@ const onSubmit = () => {
state.dataForm.append('remark', state.ruleForm.remark);
state.dataForm.append('disasterId', state.disasterId);
state.dataForm.append('visualFlag', state.ruleForm.visualFlag);
state.dataForm.append('title', state.ruleForm.title);
for (let [a, b] of state.dataForm.entries()) {
console.log(a, b, '--------------');
}

View File

@ -6,7 +6,7 @@
<div class="system-role-padding layout-padding-auto layout-padding-view">
<el-table :data="state.disasterData.data" v-loading="state.disasterData.loading" style="width: 100%"
highlight-current-row @row-click="tableClick">
<el-table-column prop="vordmId" label="ID" width="118" />
<el-table-column prop="vordmId" label="VoRDM ID" width="118" />
<el-table-column prop="disasterType" label="Disaster type" show-overflow-tooltip></el-table-column>
<el-table-column prop="disasterCountry" label="Disaster country" show-overflow-tooltip></el-table-column>
<el-table-column prop="disasterTime" label="Disaster time" show-overflow-tooltip></el-table-column>
@ -50,8 +50,14 @@
<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 prop="uploaderName" label="Uploader name" show-overflow-tooltip></el-table-column>
<el-table-column prop="uploaderName" label="Uploader name" width="100" show-overflow-tooltip></el-table-column>
<el-table-column prop="sourceOrganization" label="Organization" show-overflow-tooltip></el-table-column>
<el-table-column prop="isPublish" label="isPublish" width="100" show-overflow-tooltip>
<template #default=" scope ">
<el-tag type="warning" v-if=" scope.row.isPublish == 0 ">NO</el-tag>
<el-tag type="success" v-if=" scope.row.isPublish == 1 ">YES</el-tag>
</template>
</el-table-column>
<el-table-column prop="title" label="Professional title" show-overflow-tooltip
width="150"></el-table-column>
<el-table-column prop="size" label="Data size" show-overflow-tooltip>
@ -63,6 +69,7 @@
<el-table-column prop="Operate" label="Operate" show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="del(scope.row)">Delete</el-button>
<el-button v-if="scope.row.visualFlag == 1" size="small" text type="primary" @click="pub(scope.row)">Publish</el-button>
</template>
</el-table-column>
</el-table>
@ -84,7 +91,7 @@
import en from 'element-plus/dist/locale/en.mjs'
import type { TabsPaneContext } from 'element-plus';
import Upload from './component/upload.vue';
import { getOtherDataPage, getDisasterPage, deleteData } from '/@/api/data/otherData.js'
import { getOtherDataPage, getDisasterPage, deleteData, updateEntityData } from '/@/api/data/otherData.js'
const activeName = ref('first');
//
@ -166,8 +173,8 @@ const getDisasterData = () => {
state.disasterData.loading = true;
getDisasterPage(state.disasterData.param.pageNum, state.disasterData.param.pageSize, {}).then(res => {
state.disasterData.data = res.records;
state.disasterData.data.forEach(item=>{
let date = item.disasterTime.slice(0,10);
state.disasterData.data.forEach(item => {
let date = item.disasterTime.slice(0, 10);
item.disasterTime = date;
})
state.disasterData.total = res.total;
@ -180,7 +187,7 @@ const getTableData = () => {
state.tableData.loading = true;
getOtherDataPage(state.tableData.param.pageNum, state.tableData.param.pageSize, { "disasterId": state.disasterId, "type": state.searchName, "isDeleted": 0 }).then(res => {
console.log(res);
state.tableData.data = res.records;
state.tableData.total = res.total;
})
@ -237,6 +244,17 @@ const del = (row) => {
})
.catch(() => { });
};
//
const pub = (row) => {
console.log(row, "发布信息");
updateEntityData().then(da => {
})
};
//
const onHandleDisasterSizeChange = (val) => {
state.disasterData.param.pageSize = val;
@ -280,6 +298,7 @@ onMounted(() => {
}
}
}
.mt15 {
display: flex;
justify-content: end;

View File

@ -2,17 +2,8 @@
<el-dialog title="upload" v-model="state.isShowDialog" width="700px">
<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"
class="upload-demo"
drag
accept="image/*"
action="#"
multiple
:http-request="uploadPic"
:on-remove="removePic"
:before-upload="beforeUpload"
>
<el-upload ref="upFileRef" class="upload-demo" drag accept="image/*" action="#" multiple :http-request="uploadPic"
:on-remove="removePic" :before-upload="beforeUpload">
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">
Drop file here or <em>click to upload</em>
@ -24,69 +15,67 @@
</template>
</el-upload>
</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 {reactive, ref} from "vue";
import {uploadData} from '/@/api/data/pictureInfo.js';
import {ElMessage} from "element-plus";
import { reactive, ref } from "vue";
import { uploadData } from '/@/api/data/pictureInfo.js';
import { ElMessage } from "element-plus";
import { UploadFilled } from '@element-plus/icons-vue'
const upFileRef = ref();
const emit = defineEmits(['callback']);
const adminAddFormRef = ref();
const state = reactive({
isShowDialog: false,
isLoading:false,
isLoading: false,
ruleForm: {
},
tableData: [],
//
dictData: [],
unitData:[],
unitData: [],
standardId: '',
detectionData: [],
disasterId:null,
dataForm:new FormData(),
fileArray:[],
disasterId: null,
dataForm: new FormData(),
fileArray: [],
})
const validImg = (rule, value, callback) => {
if(state.fileArray.length>0){
if (state.fileArray.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' }
],
})
//
@ -103,7 +92,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)
}
//
@ -134,18 +123,19 @@ const onSubmit = () => {
adminAddFormRef.value.validate((valid, fields) => {
if (valid) {
state.isLoading = true;
state.fileArray.forEach(item=>{
state.dataForm.append('file',item);
state.fileArray.forEach(item => {
state.dataForm.append('file', item);
})
state.dataForm.append('disasterId',state.disasterId);
state.dataForm.append('isMain',state.ruleForm.isMain);
for(let [a, b] of state.dataForm.entries()){
state.dataForm.append('disasterId', state.disasterId);
state.dataForm.append('isMain', state.ruleForm.isMain);
state.dataForm.append('title', state.ruleForm.title);
for (let [a, b] of state.dataForm.entries()) {
console.log(a, b, '--------------');
}
uploadData(state.dataForm).then(res => {
ElMessage.success("Upload successfully");
emit('callback');
}).finally(()=>{
}).finally(() => {
state.isLoading = false;
})
closeDialog();
@ -160,6 +150,4 @@ defineExpose({
});
</script>
<style scoped>
</style>
<style scoped></style>

View File

@ -65,16 +65,6 @@
</el-popover>
</template>
</el-table-column>
<!-- <el-table-column prop="size"
label="size"
show-overflow-tooltip>
<template #default="scope">
{{formatSizeUnits(scope.row.size)}}
</template>
</el-table-column>
<el-table-column prop="type"
label="type"
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="editData(scope.row)">Edit</el-button>
@ -146,9 +136,7 @@ const handleSelectionChange = (val) => {
};
//
const formatName = (name) => {
if (name) {
return name.substr(0, name.indexOf('.'));
}
return name;
};
const auditData = (row) => {

View File

@ -1,45 +1,45 @@
<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="Unapproved" name="first">
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
<el-table-column type="index" label="ID" width="50" />
<el-table-column prop="username" label="User name" show-overflow-tooltip></el-table-column>
<el-table-column prop="organization" label="Organization" show-overflow-tooltip></el-table-column>
<el-table-column prop="disasterType" label="Disaster type" show-overflow-tooltip>
<!-- 在disasterType中获取dictKey 对应的dictValue -->
<template #default="scope">
<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="affectedCountry" label="Affected country" show-overflow-tooltip></el-table-column> -->
<!-- <el-table-column prop="Longitude" label="Longitude" show-overflow-tooltip></el-table-column>
<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="Unapproved" name="first">
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
<el-table-column prop="username" label="User name" show-overflow-tooltip></el-table-column>
<el-table-column prop="organization" label="Organization" show-overflow-tooltip></el-table-column>
<el-table-column prop="disasterType" label="Disaster type" show-overflow-tooltip>
<!-- 在disasterType中获取dictKey 对应的dictValue -->
<template #default="scope">
<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="affectedCountry" label="Affected country" show-overflow-tooltip></el-table-column> -->
<!-- <el-table-column prop="Longitude" label="Longitude" show-overflow-tooltip></el-table-column>
<el-table-column prop="Latitude" label="Latitude" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="disasterTime" label="Disaster time" show-overflow-tooltip>
<template #default="scope">
<!-- 格式化去除时分秒 -->
{{ dateFormat(scope.row.disasterTime) }}
</template>
</el-table-column>
<!-- <el-table-column prop="responseTime" label="Response time" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="respondStatus" label="Response status" show-overflow-tooltip>
<template #default="scope">
<el-tag type="info" v-if="scope.row.respondStatus === 0">Awaiting approval</el-tag>
<el-tag type="info" v-if="scope.row.respondStatus === 1">Rejected</el-tag>
</template>
</el-table-column>
<el-table-column prop="Operate" label="Operate" show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="onOpenEditRole('edit', scope.row)">Approve</el-button>
</template>
</el-table-column>
<el-table-column prop="disasterTime" label="Disaster time" show-overflow-tooltip>
<template #default="scope">
<!-- 格式化去除时分秒 -->
{{ dateFormat(scope.row.disasterTime) }}
</template>
</el-table-column>
<!-- <el-table-column prop="responseTime" label="Response time" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="respondStatus" label="Response status" show-overflow-tooltip>
<template #default="scope">
<el-tag type="info" v-if="scope.row.respondStatus === 0">Awaiting approval</el-tag>
<el-tag type="info" v-if="scope.row.respondStatus === 1">Rejected</el-tag>
</template>
</el-table-column>
<el-table-column prop="Operate" label="Operate" show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary"
@click="onOpenEditRole('edit', scope.row)">Approve</el-button>
</template>
</el-table-column>
<!-- <el-table-column prop="describe" label="角色描述" show-overflow-tooltip></el-table-column>
<!-- <el-table-column prop="describe" label="角色描述" show-overflow-tooltip></el-table-column>
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip></el-table-column> -->
<!-- <el-table-column prop="status" label="角色状态" show-overflow-tooltip>
<!-- <el-table-column prop="status" label="角色状态" show-overflow-tooltip>
<template #default="scope">
<el-tag type="success" v-if="scope.row.status">启用</el-tag>
<el-tag type="info" v-else>禁用</el-tag>
@ -55,29 +55,29 @@
>
</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.current" background
v-model:page-size="state.tableData.param.size" layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</el-tab-pane>
<el-tab-pane label="Approved | Rejected" name="second">
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
<el-table-column type="index" label="ID" width="50" />
<el-table-column prop="username" label="User name" show-overflow-tooltip></el-table-column>
<!-- <el-table-column prop="Administrator" label="Administrator" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="organization" label="Organization" show-overflow-tooltip></el-table-column>
<el-table-column prop="email" label="Email" show-overflow-tooltip></el-table-column>
<el-table-column prop="disasterType" label="Disaster type" show-overflow-tooltip>
<!-- 在disasterType中获取dictKey 对应的dictValue -->
<template #default="scope">
<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="Affected country" label="Affected country" show-overflow-tooltip></el-table-column> -->
<!-- <el-table-column prop="Longitude" label="Longitude" show-overflow-tooltip></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.current" background
v-model:page-size="state.tableData.param.size" layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</el-tab-pane>
<el-tab-pane label="Approved | Rejected" name="second">
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
<el-table-column prop="username" label="User name" show-overflow-tooltip></el-table-column>
<!-- <el-table-column prop="Administrator" label="Administrator" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="organization" label="Organization" show-overflow-tooltip></el-table-column>
<el-table-column prop="email" label="Email" show-overflow-tooltip></el-table-column>
<el-table-column prop="disasterType" label="Disaster type" show-overflow-tooltip>
<!-- 在disasterType中获取dictKey 对应的dictValue -->
<template #default="scope">
<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="Affected country" label="Affected country" show-overflow-tooltip></el-table-column> -->
<!-- <el-table-column prop="Longitude" label="Longitude" show-overflow-tooltip></el-table-column>
<el-table-column prop="Latitude" label="Latitude" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="disasterTime" label="Disaster time" show-overflow-tooltip>
<template #default="scope">
@ -86,72 +86,78 @@
</template>
</el-table-column>
<el-table-column prop="chiefName" label="Answer" show-overflow-tooltip></el-table-column>
<!-- <el-table-column prop="responseTime" label="Response time" show-overflow-tooltip></el-table-column> -->
<!-- <el-table-column prop="Operate" label="Operate" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="respondStatus" label="Response status" show-overflow-tooltip>
<el-table-column prop="reviewTime" label="reviewTime" show-overflow-tooltip />
<template #default="scope">
<el-tag type="info" v-if="scope.row.respondStatus === 2">Approved</el-tag>
<el-tag type="info" v-if="scope.row.respondStatus === 1">Rejected</el-tag>
</template>
</el-table-column>
<!-- <el-table-column prop="responseTime" label="Response time" show-overflow-tooltip></el-table-column> -->
<!-- <el-table-column prop="Operate" label="Operate" show-overflow-tooltip></el-table-column> -->
<el-table-column width="170" prop="respondStatus" label="Response status" show-overflow-tooltip>
<el-table-column prop="Operate" label="Operate" show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="onAllocation(scope.row)">Allocate</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.current" background
v-model:page-size="state.tableData.param.size" layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</el-tab-pane>
</el-tabs>
</div>
<el-dialog v-model="state.dialogVisible" title="Review" width="30%">
<el-container style="margin-top: -2%;margin-bottom: 2%;">
<el-radio v-model="state.radio" label='1' @click="mapEvents('1')">Point</el-radio>
<el-radio v-model="state.radio" label='2' @click="mapEvents('2')">Area</el-radio>
<el-radio v-model="state.radio" label='3' @click="mapEvents('3')">Edit</el-radio>
<el-button type="primary" style="margin-left: 5%;" @click="ClearSubmit">Clear</el-button>
</el-container>
<el-container style="margin-top: 2%;margin-bottom: 2%;" v-if="state.radio==='1'?true:false">
<span style="line-height: 35px;"> Latitude</span>
<el-input placeholder="wait……" style="height:35px;margin-right: 1%;" v-model="state.dislat" readonly="readonly"> </el-input>
<span style="line-height: 35px;">Longitude</span>
<el-input placeholder="wait……" style="height:35px;" v-model="state.dislon" readonly="readonly"></el-input>
</el-container>
<MapPage style="height:350px ; width:100% ;margin-bottom: 10px;" ref="mapRef"></MapPage>
<el-form-item label="Disaster Time">
<el-date-picker v-model="state.edit.disasterTime" type="date" value-format="YYYY-MM-DD"
placeholder="Select date and time" />
</el-form-item>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">Cancel</el-button>
<el-button type="danger" @click="reviews(1)">
Reject
</el-button>
<el-button type="primary" @click="reviews(2)">
Approve
</el-button>
</span>
</template>
</el-dialog>
<selectUser ref ="select" @callback="getTableData"></selectUser>
<template #default="scope">
<el-tag type="info" v-if="scope.row.respondStatus === 2">Approved</el-tag>
<el-tag type="info" v-if="scope.row.respondStatus === 1">Rejected</el-tag>
<el-tag type="success" v-if="scope.row.respondStatus === 3">Complete response</el-tag>
</template>
</el-table-column>
<el-table-column width="200" prop="Operate" label="Operate" show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="onAllocation(scope.row)">Allocation</el-button>
<el-button size="small" text type="danger" @click="responseEnded(scope.row)">Response ended</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.current" background
v-model:page-size="state.tableData.param.size" layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</el-tab-pane>
</el-tabs>
</div>
<el-dialog v-model="state.dialogVisible" title="Approval" width="30%">
<el-container style="margin-top: -2%;margin-bottom: 2%;">
<el-radio v-model="state.radio" label='1' @click="mapEvents('1')">Point</el-radio>
<el-radio v-model="state.radio" label='2' @click="mapEvents('2')">Area</el-radio>
<el-radio v-model="state.radio" label='3' @click="mapEvents('3')">Edit</el-radio>
<el-button type="primary" style="margin-left: 5%;" @click="ClearSubmit">Clear</el-button>
</el-container>
<el-container style="margin-top: 2%;margin-bottom: 2%;" v-if="state.radio === '1' ? true : false">
<span style="line-height: 35px;"> Latitude</span>
<el-input placeholder="wait……" style="height:35px;margin-right: 1%;" v-model="state.dislat" readonly="readonly">
</el-input>
<span style="line-height: 35px;">Longitude</span>
<el-input placeholder="wait……" style="height:35px;" v-model="state.dislon" readonly="readonly"></el-input>
</el-container>
<MapPage style="height:350px ; width:100% ;margin-bottom: 10px;" ref="mapRef"></MapPage>
<el-form-item label="Disaster Time">
<el-date-picker v-model="state.edit.disasterTime" type="date" value-format="YYYY-MM-DD"
placeholder="Select date and time" />
</el-form-item>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">Cancel</el-button>
<el-button type="danger" @click="reviews(1)">
Reject
</el-button>
<el-button type="primary" @click="reviews(2)">
Approve
</el-button>
</span>
</template>
</el-dialog>
<selectUser ref="select" @callback="getTableData"></selectUser>
</el-config-provider>
</div>
</template>
<script setup name="userResponse">
import en from 'element-plus/dist/locale/en.mjs'
import { reactive, onMounted, ref, nextTick,watchEffect,defineAsyncComponent } from 'vue';
import { reactive, onMounted, ref, nextTick, watchEffect, defineAsyncComponent } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { getList, review } from '/@/api/disasterInfo/index';
import { getList, review, responseEndedDisasterInfo } from '/@/api/disasterInfo/index';
import { getDictionary } from '/@/api/system/dictbiz';
import { useVariableStore } from '/@/stores/index.ts'
//
@ -159,8 +165,8 @@ import Map from '/@/components/Map.vue';
import { useDateFormat } from '@vueuse/shared';
import selectUser from './component/selectUser.vue';
import L from "leaflet";
import '@geoman-io/leaflet-geoman-free';
import '@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css';
import '@geoman-io/leaflet-geoman-free';
import '@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css';
import "leaflet/dist/leaflet.css";
import 'leaflet-draw/dist/leaflet.draw'
import 'leaflet-draw/dist/leaflet.draw.css'
@ -175,12 +181,30 @@ const handleClick = (tab, event) => {
getTableData();
};
const MapPage = defineAsyncComponent({
loader:() =>import('/@/components/Map.vue'),
loader: () => import('/@/components/Map.vue'),
delay: 200,
})
const onAllocation = (row) => {
select.value.openDialog(row)
};
const responseEnded = (row) => {
ElMessageBox.confirm(`Confirm completion of response?`, 'Prompt', {
confirmButtonText: 'Yes',
cancelButtonText: 'No',
type: 'warning',
})
.then(() => {
responseEndedDisasterInfo(row.id).then((da) => {
getTableData();
ElMessage.success('Operation successful');
})
})
.catch(() => { });
};
const dateFormat = (date) => {
return useDateFormat(date, 'YYYY-MM-DD').value;
}
@ -202,10 +226,10 @@ const state = reactive({
disasterTypeList: [],
selectName: 'first',
edit: {},
radio:null,
dislat:'',
dislon:'',
wktPoint_Poly:undefined
radio: null,
dislat: '',
dislon: '',
wktPoint_Poly: undefined
});
//
const getTableData = () => {
@ -214,7 +238,7 @@ const getTableData = () => {
if (state.selectName === 'first') {
state.tableData.param.respondStatus = 0;
} else {
state.tableData.param.respondStatus = 2;
state.tableData.param.respondStatus = 3;
}
getList(state.tableData.param).then((res) => {
state.tableData.data = res.records;
@ -227,41 +251,41 @@ const onHandleSizeChange = (val) => {
getTableData();
};
const onOpenEditRole = (type, row) => {
//
state.edit = JSON.parse(JSON.stringify(row));
state.dialogVisible = true;
setTimeout(() => {
state.radio = "1"
// mapRef.value.mapOperations.removeAll()
//
if(state.wktPoint_Poly){
mapRef.value.mapOperations.removeLayer(state.wktPoint_Poly)
}
state.wktPoint_Poly= mapRef.value.mapOperations.wktParseToMap(row.geometry)
// mapRef.value.mapOperations.on("click", (res)=>{
// mapRef.value.mapOperations.clearPolygon()
// mapRef.value.mapOperations.removeLayer( state.wktPoint_Poly)
// mapRef.value.mapOperations.addInteractMarker(res.latlng.lat, res.latlng.lng)
// })
mapEvents('1')
},100);
state.radio = "1"
// mapRef.value.mapOperations.removeAll()
//
if (state.wktPoint_Poly) {
mapRef.value.mapOperations.removeLayer(state.wktPoint_Poly)
}
state.wktPoint_Poly = mapRef.value.mapOperations.wktParseToMap(row.geometry)
// mapRef.value.mapOperations.on("click", (res)=>{
// mapRef.value.mapOperations.clearPolygon()
// mapRef.value.mapOperations.removeLayer( state.wktPoint_Poly)
// mapRef.value.mapOperations.addInteractMarker(res.latlng.lat, res.latlng.lng)
// })
mapEvents('1')
}, 100);
};
const mapEvents = (ev)=>{
if(ev == '1'){
const mapEvents = (ev) => {
if (ev == '1') {
// mapRef.value.mapOperations.clearPolygon()
mapRef.value.mapOperations.on("click", mapClick)
mapRef.value.mapOperations.on("mousemove", changelatlon)
mapRef.value.mapOperations.clearPolygon()
}else if(ev == '2'){
mapRef.value.mapOperations.off("click",mapClick);
} else if (ev == '2') {
mapRef.value.mapOperations.off("click", mapClick);
mapRef.value.mapOperations.drawPolygon()
// mapRef.value.mapOperations.drawPolygon()
// mapRef.value.mapOperations.drawCreated()
}
else{
else {
mapRef.value.mapOperations.Edit()
}
};
@ -269,14 +293,14 @@ const ClearSubmit = () => {
setTimeout(() => {
mapRef.value.mapOperations.removeAll()
variableStore.wktdata = null
variableStore.layerGroupPoint=null;
layerGroupPoly=null;
variableStore.layerGroupPoint = null;
layerGroupPoly = null;
}, 100)
}
const mapClick=(res)=>{
mapRef.value.mapOperations.removeLayer( state.wktPoint_Poly )
const mapClick = (res) => {
// mapRef.value.mapOperations.removeLayer( state.wktPoint_Poly )
changelatlon(res);
state.wktPoint_Poly=mapRef.value.mapOperations.addInteractMarker(res.latlng.lat.toFixed(3),res.latlng.lng.toFixed(3))
mapRef.value.mapOperations.addInteractMarker(res.latlng.lat.toFixed(3), res.latlng.lng.toFixed(3))
// console.log(state.wktPoint_Poly)
}
const reviews = (index) => {
@ -291,7 +315,7 @@ const reviews = (index) => {
if (index === 1) {
state.edit.respondStatus = 1;
} else {
state.edit.respondStatus = 2;
state.edit.respondStatus = 3;
}
state.edit.geometry = variableStore.layerGroupPoint === null ? variableStore.layerGroupPoly : variableStore.layerGroupPoint;
//
@ -310,44 +334,44 @@ const onHandleCurrentChange = (val) => {
const changelatlon = (e) => {
//e
state.dislat = e.latlng.lat.toFixed(3);
state.dislon= e.latlng.lng.toFixed(3);
// if (state.lon < 0) {
// state.lon = state.lon + 360;
// }
// state.lon = state.lon.toFixed(3);
if (state.dislat < 0) {
state.dislat = String(Math.abs(state.dislat)) + "°S"
}
else {
state.dislat = String(state.dislat) + "°N"
}
state.dislon = e.latlng.lng.toFixed(3);
// if (state.lon < 0) {
// state.lon = state.lon + 360;
// }
// state.lon = state.lon.toFixed(3);
if (state.dislat < 0) {
state.dislat = String(Math.abs(state.dislat)) + "°S"
}
else {
state.dislat = String(state.dislat) + "°N"
}
if (state.dislon <= 180 && state.dislon >= 0) {
state.dislon = String(Math.abs(state.dislon)) + "°E"
}
else if (state.dislon > 180 && state.dislon <= 360) {
state.dislon = String((360 - state.dislon).toFixed(3)) + "°W"
}
else if (state.dislon < 0) {
let n = Math.floor(state.dislon / 360)
state.dislon = (state.dislon - n * 360).toFixed(3)
if (state.dislon <= 180 && state.dislon >= 0) {
state.dislon = String(Math.abs(state.dislon)) + "°E"
}
else if (state.dislon > 180 && state.dislon <= 360) {
state.dislon = String((360 - state.dislon).toFixed(3)) + "°W"
}
}
else if (state.dislon > 360) {
let n = Math.floor(state.dislon / 360)
state.dislon = (state.dislon - n * 360).toFixed(3)
if (state.dislon <= 180 && state.dislon >= 0) {
state.dislon = String(Math.abs(state.dislon)) + "°E"
else if (state.dislon < 0) {
let n = Math.floor(state.dislon / 360)
state.dislon = (state.dislon - n * 360).toFixed(3)
if (state.dislon <= 180 && state.dislon >= 0) {
state.dislon = String(Math.abs(state.dislon)) + "°E"
}
else if (state.dislon > 180 && state.dislon <= 360) {
state.dislon = String((360 - state.dislon).toFixed(3)) + "°W"
}
}
else if (state.dislon > 180 && state.dislon <= 360) {
state.dislon = String((360 - state.dislon).toFixed(3)) + "°W"
else if (state.dislon > 360) {
let n = Math.floor(state.dislon / 360)
state.dislon = (state.dislon - n * 360).toFixed(3)
if (state.dislon <= 180 && state.dislon >= 0) {
state.dislon = String(Math.abs(state.dislon)) + "°E"
}
else if (state.dislon > 180 && state.dislon <= 360) {
state.dislon = String((360 - state.dislon).toFixed(3)) + "°W"
}
}
}
}
//
@ -356,14 +380,14 @@ onMounted(() => {
getDictionary({ code: 'disaster' }).then((res) => {
state.disasterTypeList = res;
});
});
const getValue = (key) => {
//state.disasterTypeLis value
return state.disasterTypeList.find((item) => item.dictKey === key)?.dictValue;
};
</script>
<style>
<style lang="scss">
.demo-tabs>.el-tabs__content {
padding: 0px;
color: #6b778c;
@ -380,4 +404,11 @@ const getValue = (key) => {
}
}
}
.mt15 {
display: flex;
justify-content: end;
float: right;
margin-bottom: 15px;
}
</style>

View File

@ -25,17 +25,15 @@
</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="disasterType" label="DisasterType" show-overflow-tooltip></el-table-column>
<el-table-column prop="disasterCountry" label="DisasterCountry" show-overflow-tooltip></el-table-column>
<el-table-column prop="disasterKeyword" label="DisasterKeyword" show-overflow-tooltip></el-table-column>
<el-table-column prop="managerName" label="ManagerName" show-overflow-tooltip></el-table-column>
<el-table-column prop="sponsorOrganization" label="SponsorOrganization" show-overflow-tooltip></el-table-column>
<el-table-column prop="researchField" label="ResearchField" show-overflow-tooltip></el-table-column>
<el-table-column prop="occupation" label="occupation" show-overflow-tooltip></el-table-column>
<el-table-column prop="applyTime" label="applyTime" show-overflow-tooltip></el-table-column>
<el-table-column v-if="state.status == '1'" prop="reviewTime" label="reviewTime" show-overflow-tooltip></el-table-column>
<el-table-column prop="disasterType" label="DisasterType" show-overflow-tooltip sortable></el-table-column>
<el-table-column prop="disasterCountry" label="DisasterCountry" show-overflow-tooltip sortable></el-table-column>
<el-table-column prop="disasterTime" label="disasterTime" show-overflow-tooltip sortable></el-table-column>
<el-table-column prop="managerName" label="ManagerName" show-overflow-tooltip sortable></el-table-column>
<el-table-column prop="sponsorOrganization" label="SponsorOrganization" show-overflow-tooltip sortable></el-table-column>
<el-table-column prop="researchField" label="ResearchField" show-overflow-tooltip sortable></el-table-column>
<el-table-column prop="occupation" label="occupation" show-overflow-tooltip sortable></el-table-column>
<el-table-column prop="applyTime" label="applyTime" show-overflow-tooltip sortable></el-table-column>
<el-table-column v-if="state.status == '1'" prop="reviewTime" label="reviewTime" show-overflow-tooltip sortable></el-table-column>
<el-table-column v-if="state.status == '0'" prop="Operate" label="Operate" show-overflow-tooltip>
<template #default="scope">
<!-- <el-button link type="primary" size="small" @click="handleClick">Detail</el-button>-->
@ -113,6 +111,10 @@ const getTableData = () => {
state.tableData.loading = true;
getAdminManagerPage(state.tableData.param.pageNum, state.tableData.param.pageSize, { "managerName": state.searchName,"status": state.status}).then(res => {
state.tableData.data = res.records;
state.tableData.data.forEach(item => {
let date = item.disasterTime.slice(0, 10);
item.disasterTime = date;
})
state.tableData.total = res.total;
})