代码提交-glj

This commit is contained in:
glj 2023-04-21 18:24:53 +08:00
parent c634b89aa0
commit 60cec328df
5 changed files with 267 additions and 366 deletions

View File

@ -1,120 +1,83 @@
<template>
<div class="system-role-container layout-padding">
<el-config-provider :locale="en">
<el-row :gutter="22">
<el-col :span="10">
<div class="system-role-padding layout-padding-auto layout-padding-view">
<el-table :data="state.disasterData.data"
v-loading="state.disasterData.loading"
style="width: 100%"
highlight-current-row
@row-click="tableClick">
<el-table-column type="index"
label="ID"
width="50" />
<el-table-column prop="disasterType"
label="Disaster type"
show-overflow-tooltip></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>
</el-table>
<el-pagination @size-change="onHandleDisasterSizeChange"
@current-change="onHandleDisasterCurrentChange"
class="mt15"
:pager-count="5"
:page-sizes="[10, 20, 30]"
v-model:current-page="state.disasterData.param.pageNum"
background
v-model:page-size="state.disasterData.param.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="state.disasterData.total">
</el-pagination>
</div>
</el-col>
<el-col :span="14">
<div class="system-role-padding layout-padding-auto layout-padding-view">
<div class="system-user-search mb15" style="display: flex;margin-left: 10px;margin-top: 10px;">
<el-select v-model="state.searchName" placeholder="please select data type" style="max-width: 200px" size="default" clearable>
<el-option value="1" label="basic data"></el-option>
<el-option value="2" label="responded report"></el-option>
<el-option value="3" label="cartographic product"></el-option>
</el-select>
<el-button size="default" type="primary" class="ml10" @click="getTableData">
<el-icon>
<ele-Search/>
</el-icon>
search
</el-button>
<el-button size="default" type="success" class="ml10" @click="uploadData">
<el-icon>
<ele-Upload/>
</el-icon>
upload
</el-button>
<el-button size="default" type="danger" class="ml10" @click="batchDel">
<el-icon>
<ele-Delete/>
</el-icon>
batch delete
</el-button>
<el-row :gutter="22">
<el-col :span="10">
<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 type="index" label="ID" width="50" />
<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>
</el-table>
<el-pagination @size-change="onHandleDisasterSizeChange" @current-change="onHandleDisasterCurrentChange"
class="mt15" :pager-count="5" :page-sizes="[10, 20, 30]"
v-model:current-page="state.disasterData.param.pageNum" background
v-model:page-size="state.disasterData.param.pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="state.disasterData.total">
</el-pagination>
</div>
<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="uploaderName"
label="uploader Name"
show-overflow-tooltip></el-table-column>
<el-table-column prop="sourceOrganization"
label="Organization"
show-overflow-tooltip></el-table-column>
<el-table-column prop="title"
label="Professional title"
show-overflow-tooltip width="150"></el-table-column>
<el-table-column prop="size"
label="Data size"
show-overflow-tooltip>
<template #default="scope">
{{formatSizeUnits(scope.row.size)}}
</template>
</el-table-column>
<el-table-column prop="uploadTime"
label="Upload time"
show-overflow-tooltip></el-table-column>
<el-table-column prop="Operate"
label="Operate"
show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="del(scope.row)">Delete</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="onHandleSizeChange"
@current-change="onHandleCurrentChange"
class="mt15"
:pager-count="5"
:page-sizes="[10, 20, 30]"
v-model:current-page="state.tableData.param.pageNum"
background
v-model:page-size="state.tableData.param.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</div>
</el-col>
</el-row>
</el-col>
<el-col :span="14">
<div class="system-role-padding layout-padding-auto layout-padding-view">
<div class="system-user-search mb15" style="display: flex;margin-left: 10px;margin-top: 10px;">
<el-select v-model="state.searchName" placeholder="please select data type" style="max-width: 200px"
size="default" clearable>
<el-option value="0" label="basic data"></el-option>
<el-option value="1" label="responded report"></el-option>
<el-option value="2" label="cartographic product"></el-option>
</el-select>
<el-button size="default" type="primary" class="ml10" @click="getTableData">
<el-icon>
<ele-Search />
</el-icon>
search
</el-button>
<el-button size="default" type="success" class="ml10" @click="uploadData">
<el-icon>
<ele-Upload />
</el-icon>
upload
</el-button>
<el-button size="default" type="danger" class="ml10" @click="batchDel">
<el-icon>
<ele-Delete />
</el-icon>
batch delete
</el-button>
</div>
<el-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="uploaderName" label="uploader Name" show-overflow-tooltip></el-table-column>
<el-table-column prop="sourceOrganization" label="Organization" show-overflow-tooltip></el-table-column>
<el-table-column prop="title" label="Professional title" show-overflow-tooltip
width="150"></el-table-column>
<el-table-column prop="size" label="Data size" show-overflow-tooltip>
<template #default="scope">
{{ formatSizeUnits(scope.row.size) }}
</template>
</el-table-column>
<el-table-column prop="uploadTime" label="Upload time" show-overflow-tooltip></el-table-column>
<el-table-column prop="Operate" label="Operate" show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="del(scope.row)">Delete</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
:pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="state.tableData.param.pageNum" background
v-model:page-size="state.tableData.param.pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</div>
</el-col>
</el-row>
</el-config-provider>
<RoleDialog ref="roleDialogRef"
@refresh="getTableData()" />
<Upload ref="uploadRef" @callback="getTableData"/>
<RoleDialog ref="roleDialogRef" @refresh="getTableData()" />
<Upload ref="uploadRef" @callback="getTableData" />
</div>
</template>
@ -122,7 +85,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 } from '/@/api/data/otherData.js'
const activeName = ref('first');
//
@ -135,9 +98,9 @@ const uploadRef = ref();
//
const roleDialogRef = ref();
const state = reactive({
multipleSelection:[],
searchName:'',
disasterId:null,
multipleSelection: [],
searchName: '',
disasterId: null,
disasterData: {
data: [],
total: 0,
@ -164,7 +127,7 @@ const handleSelectionChange = (val) => {
}
const auditData = (row) => {
let id = row.id
auditRef.value.openDialog([{"id":id}]);
auditRef.value.openDialog([{ "id": id }]);
}
//
const formatSize = (size) => {
@ -189,8 +152,8 @@ const formatSize = (size) => {
const formatSizeUnits = (size) => {
if (size === 0) return '0 B';
var k = 1000, // or 1024
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(size) / Math.log(k));
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(size) / Math.log(k));
return (size / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
}
@ -202,7 +165,7 @@ const tableClick = (row, column, event) => {
//
const getDisasterData = () => {
state.disasterData.loading = true;
getDisasterPage(state.disasterData.param.pageNum,state.disasterData.param.pageSize,{}).then(res=>{
getDisasterPage(state.disasterData.param.pageNum, state.disasterData.param.pageSize, {}).then(res => {
state.disasterData.data = res.records;
state.disasterData.total = res.total;
state.disasterData.loading = false;
@ -212,7 +175,9 @@ const getDisasterData = () => {
//
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=>{
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;
})
@ -224,7 +189,7 @@ const getTableData = () => {
};
//
const uploadData = () => {
if(state.disasterId == null){
if (state.disasterId == null) {
ElMessage.warning("Please select the disaster first")
return false;
}
@ -236,23 +201,23 @@ const onOpenEditRole = (type, row) => {
};
//
const batchDel = () => {
if(state.multipleSelection.length == 0){
if (state.multipleSelection.length == 0) {
ElMessage.warning("Select the data to be operated first");
return false;
}
ElMessageBox.confirm(`This action batch deletes the other dataWhether to continue?`, 'tip', {
ElMessageBox.confirm(`This action batch deletes the other dataWhether to continue?`, 'tip', {
confirmButtonText: 'confirm',
cancelButtonText: 'cancel',
type: 'warning',
})
.then(() => {
let id = state.multipleSelection.map(item=>item.id)
deleteData(id.join()).then(res=>{
getTableData();
ElMessage.success('delete successfully');
})
.then(() => {
let id = state.multipleSelection.map(item => item.id)
deleteData(id.join()).then(res => {
getTableData();
ElMessage.success('delete successfully');
})
.catch(() => {});
})
.catch(() => { });
}
//
const del = (row) => {
@ -261,13 +226,13 @@ const del = (row) => {
cancelButtonText: 'cancel',
type: 'warning',
})
.then(() => {
deleteData(row.id).then(res=>{
getTableData();
ElMessage.success('delete successfully');
})
.then(() => {
deleteData(row.id).then(res => {
getTableData();
ElMessage.success('delete successfully');
})
.catch(() => {});
})
.catch(() => { });
};
//
const onHandleDisasterSizeChange = (val) => {
@ -296,7 +261,7 @@ onMounted(() => {
});
</script>
<style>
.demo-tabs > .el-tabs__content {
.demo-tabs>.el-tabs__content {
padding: 32px;
color: #6b778c;
font-size: 32px;
@ -306,6 +271,7 @@ onMounted(() => {
.system-role-container {
.system-role-padding {
padding: 15px;
.el-table {
flex: 1;
}

View File

@ -14,8 +14,8 @@
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="checked">
<el-select size="default" v-model="state.query.status" clearable
<el-form-item label="checked" style="margin-left: 10px;">
<el-select size="default" v-model="state.query.status" clearable style="max-width: 180px"
placeholder="Replied">
<el-option label="UnReplied" :value="0"></el-option>
<el-option label="Replied" :value="1"></el-option>

View File

@ -1,115 +1,76 @@
<template>
<div class="system-role-container layout-padding">
<el-config-provider :locale="en">
<el-row :gutter="22">
<el-col :span="10">
<div class="system-role-padding layout-padding-auto layout-padding-view">
<el-table :data="state.disasterData.data"
v-loading="state.disasterData.loading"
style="width: 100%"
highlight-current-row
@row-click="tableClick">
<el-table-column type="index"
label="ID"
width="50" />
<el-table-column prop="disasterType"
label="Disaster type"
show-overflow-tooltip></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>
</el-table>
<el-pagination @size-change="onHandleDisasterSizeChange"
@current-change="onHandleDisasterCurrentChange"
class="mt15"
:pager-count="5"
:page-sizes="[10, 20, 30]"
v-model:current-page="state.disasterData.param.pageNum"
background
v-model:page-size="state.disasterData.param.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="state.disasterData.total">
</el-pagination>
</div>
</el-col>
<el-col :span="14">
<div class="system-role-padding layout-padding-auto layout-padding-view">
<div class="system-user-search mb15" style="display: flex;margin-left: 10px;margin-top: 10px;">
<el-button size="default" type="primary" class="ml10" @click="batchAudit">
<el-icon>
<ele-EditPen/>
</el-icon>
batch audit
</el-button>
<el-row :gutter="22">
<el-col :span="10">
<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 type="index" label="ID" width="50" />
<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>
</el-table>
<el-pagination @size-change="onHandleDisasterSizeChange" @current-change="onHandleDisasterCurrentChange"
class="mt15" :pager-count="5" :page-sizes="[10, 20, 30]"
v-model:current-page="state.disasterData.param.pageNum" background
v-model:page-size="state.disasterData.param.pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="state.disasterData.total">
</el-pagination>
</div>
<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="uploaderName"
label="uploader Name"
show-overflow-tooltip></el-table-column>
<el-table-column prop="sourceOrganization"
label="Organization"
show-overflow-tooltip></el-table-column>
<el-table-column prop="title"
label="Professional title"
show-overflow-tooltip
width="150"></el-table-column>
<el-table-column prop="size"
label="Data size"
show-overflow-tooltip>
<template #default="scope">
{{formatSizeUnits(scope.row.size)}}
</template>
</el-table-column>
<el-table-column prop="uploadTime"
label="Upload time"
show-overflow-tooltip></el-table-column>
<el-table-column prop="Operate"
label="Operate"
show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="auditData(scope.row)">Audit</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="onHandleSizeChange"
@current-change="onHandleCurrentChange"
class="mt15"
:pager-count="5"
:page-sizes="[10, 20, 30]"
v-model:current-page="state.tableData.param.pageNum"
background
v-model:page-size="state.tableData.param.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</div>
</el-col>
</el-row>
</el-col>
<el-col :span="14">
<div class="system-role-padding layout-padding-auto layout-padding-view">
<div class="system-user-search mb15" style="display: flex;margin-left: 10px;margin-top: 10px;">
<el-button size="default" type="primary" class="ml10" @click="batchAudit">
<el-icon>
<ele-EditPen />
</el-icon>
batch audit
</el-button>
</div>
<el-table :data="state.tableData.data" v-loading="state.tableData.loading"
@selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" width="55" />
<el-table-column type="index" label="ID" width="50" />
<el-table-column prop="uploaderName" label="uploader Name" show-overflow-tooltip></el-table-column>
<el-table-column prop="sourceOrganization" label="Organization" show-overflow-tooltip></el-table-column>
<el-table-column prop="title" label="Professional title" show-overflow-tooltip
width="150"></el-table-column>
<el-table-column prop="size" label="Data size" show-overflow-tooltip>
<template #default="scope">
{{ formatSizeUnits(scope.row.size) }}
</template>
</el-table-column>
<el-table-column prop="uploadTime" label="Upload time" show-overflow-tooltip></el-table-column>
<el-table-column prop="Operate" label="Operate" show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="auditData(scope.row)">Audit</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
:pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="state.tableData.param.pageNum" background
v-model:page-size="state.tableData.param.pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</div>
</el-col>
</el-row>
</el-config-provider>
<RoleDialog ref="roleDialogRef"
@refresh="getTableData()" />
<Audit ref="auditRef" @callback="getTableData"/>
<RoleDialog ref="roleDialogRef" @refresh="getTableData()" />
<Audit ref="auditRef" @callback="getTableData" />
</div>
</template>
<script lang="ts" setup name="systemRole">
import en from 'element-plus/dist/locale/en.mjs'
import type { TabsPaneContext } from 'element-plus';
import {getDataUploadPage,getDisasterPage} from '/@/api/response/dataUpload.js'
import { getDataUploadPage, getDisasterPage } from '/@/api/response/dataUpload.js'
const activeName = ref('first');
const handleClick = (tab: TabsPaneContext, event: Event) => {
console.log(tab, event);
console.log(tab, event);
};
//
@ -122,8 +83,8 @@ const auditRef = ref();
//
const roleDialogRef = ref();
const state = reactive({
multipleSelection:[],
disasterId:null,
multipleSelection: [],
disasterId: null,
disasterData: {
data: [],
total: 0,
@ -134,23 +95,23 @@ const state = reactive({
pageSize: 10,
},
},
tableData: {
data: [],
total: 0,
loading: false,
param: {
search: '',
pageNum: 1,
pageSize: 10,
},
},
tableData: {
data: [],
total: 0,
loading: false,
param: {
search: '',
pageNum: 1,
pageSize: 10,
},
},
});
const handleSelectionChange = (val) => {
state.multipleSelection = val
}
//
const batchAudit = () => {
if(state.multipleSelection.length == 0){
if (state.multipleSelection.length == 0) {
ElMessage.warning("Select the data to be operated first");
return false;
}
@ -158,7 +119,7 @@ const batchAudit = () => {
}
const auditData = (row) => {
let id = row.id
auditRef.value.openDialog([{"id":id}]);
auditRef.value.openDialog([{ "id": id }]);
}
//
const formatSize = (size) => {
@ -183,8 +144,8 @@ const formatSize = (size) => {
const formatSizeUnits = (size) => {
if (size === 0) return '0 B';
var k = 1000, // or 1024
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(size) / Math.log(k));
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(size) / Math.log(k));
return (size / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
}
@ -196,7 +157,7 @@ const tableClick = (row, column, event) => {
//
const getDisasterData = () => {
state.disasterData.loading = true;
getDisasterPage(state.disasterData.param.pageNum,state.disasterData.param.pageSize,{}).then(res=>{
getDisasterPage(state.disasterData.param.pageNum, state.disasterData.param.pageSize, {}).then(res => {
state.disasterData.data = res.records;
state.disasterData.total = res.total;
state.disasterData.loading = false;
@ -205,37 +166,37 @@ const getDisasterData = () => {
//
const getTableData = () => {
state.tableData.loading = true;
getDataUploadPage(state.tableData.param.pageNum,state.tableData.param.pageSize,{"disasterId":state.disasterId}).then(res=>{
state.tableData.loading = true;
getDataUploadPage(state.tableData.param.pageNum, state.tableData.param.pageSize, { "disasterId": state.disasterId }).then(res => {
state.tableData.data = res.records;
state.tableData.total = res.total;
})
/* state.tableData.data = data;
state.tableData.total = state.tableData.data.length;*/
setTimeout(() => {
state.tableData.loading = false;
}, 500);
/* state.tableData.data = data;
state.tableData.total = state.tableData.data.length;*/
setTimeout(() => {
state.tableData.loading = false;
}, 500);
};
//
const onOpenAddRole = (type) => {
roleDialogRef.value.openDialog(type);
roleDialogRef.value.openDialog(type);
};
//
const onOpenEditRole = (type, row) => {
roleDialogRef.value.openDialog(type, row);
roleDialogRef.value.openDialog(type, row);
};
//
const onRowDel = (row) => {
ElMessageBox.confirm(`此操作将永久删除角色名称:“${row.roleName}”,是否继续?`, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
getTableData();
ElMessage.success('删除成功');
})
.catch(() => {});
ElMessageBox.confirm(`此操作将永久删除角色名称:“${row.roleName}”,是否继续?`, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
getTableData();
ElMessage.success('删除成功');
})
.catch(() => { });
};
//
const onHandleDisasterSizeChange = (val) => {
@ -249,34 +210,35 @@ const onHandleDisasterCurrentChange = (val) => {
};
//
const onHandleSizeChange = (val) => {
state.tableData.param.pageSize = val;
getTableData();
state.tableData.param.pageSize = val;
getTableData();
};
//
const onHandleCurrentChange = (val) => {
state.tableData.param.pageNum = val;
getTableData();
state.tableData.param.pageNum = val;
getTableData();
};
//
onMounted(() => {
getDisasterData();
getTableData();
getTableData();
});
</script>
<style>
.demo-tabs > .el-tabs__content {
padding: 32px;
color: #6b778c;
font-size: 32px;
font-weight: 600;
.demo-tabs>.el-tabs__content {
padding: 32px;
color: #6b778c;
font-size: 32px;
font-weight: 600;
}
.system-role-container {
.system-role-padding {
padding: 15px;
.el-table {
flex: 1;
}
}
.system-role-padding {
padding: 15px;
.el-table {
flex: 1;
}
}
}
</style>

View File

@ -14,7 +14,7 @@
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="checked">
<el-form-item label="checked" style="margin-left: 10px;">
<el-select size="default" v-model="state.query.checked" clearable
placeholder="Please select">
<el-option label="checked" value="0"></el-option>

View File

@ -78,14 +78,13 @@
<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">
<!-- 格式化去除时分秒 -->
{{ dateFormat(scope.row.disasterTime) }}
</template>
</el-table-column>
<el-table-column prop="chiefName" label="Answer" 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="Operate" label="Operate" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="respondStatus" label="Response status" show-overflow-tooltip>
@ -97,11 +96,24 @@
</el-table-column>
<el-table-column prop="Operate" label="Operate" show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="onAllocation(scope.row)">Allocation</el-button>
</template>
</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>
<template #default="scope">
<el-tag type="success" v-if="scope.row.status">启用</el-tag>
<el-tag type="info" v-else>禁用</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template #default="scope">
<el-button :disabled="scope.row.roleName === '超级管理员'" size="small" text type="primary" @click="onOpenEditRole('edit', scope.row)"
>修改</el-button
>
<el-button :disabled="scope.row.roleName === '超级管理员'" size="small" text type="primary" @click="onRowDel(scope.row)"
>删除</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
@ -111,19 +123,19 @@
</el-tab-pane>
</el-tabs>
</div>
<el-dialog v-model="state.dialogVisible" title="Review" width="30%">
<el-dialog v-model="state.dialogVisible" title="Review" width="30%" :before-close="handleClose">
<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='1'>Point</el-radio>
<el-radio v-model="state.radio" label='2'>Area</el-radio>
<el-button type="primary" style="margin-left: 5%;">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>
<el-input placeholder="请输入内容" style="height:35px;margin-right: 1%;" v-model="state.dislat"></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-input placeholder="请输入内容" style="height:35px;" ></el-input>
</el-container>
<Map style="height:350px ; width:100% ;margin-bottom: 10px;" ref="mapRef"></Map>
<Map style="height:350px ; width:100% ;margin-bottom: 10px;" ref="map"></Map>
<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" />
@ -141,40 +153,30 @@
</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 '@geoman-io/leaflet-geoman-free';
import '@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css';
import { reactive, onMounted, ref, nextTick,watchEffect } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { getList, review } from '/@/api/disasterInfo/index';
import { getDictionary } from '/@/api/system/dictbiz';
import { useVariableStore } from '/@/stores/index.ts'
//
import Map from '/@/components/Map.vue';
import { useDateFormat } from '@vueuse/shared';
import selectUser from './component/selectUser.vue';
import L from "leaflet";
import "leaflet/dist/leaflet.css";
import 'leaflet-draw/dist/leaflet.draw'
import 'leaflet-draw/dist/leaflet.draw.css'
import { map } from 'lodash';
const variableStore = useVariableStore();
const mapRef = ref();
const map = ref();
const activeName = ref('first');
const select = ref();
const handleClick = (tab, event) => {
state.selectName = tab.props.name;
getTableData();
};
const onAllocation = (row) => {
select.value.openDialog(row)
};
const dateFormat = (date) => {
return useDateFormat(date, 'YYYY-MM-DD').value;
}
@ -198,8 +200,7 @@ const state = reactive({
edit: {},
radio:null,
dislat:'',
dislon:'',
wktPoint:undefined
dislon:''
});
//
const getTableData = () => {
@ -210,6 +211,7 @@ const getTableData = () => {
} else {
state.tableData.param.respondStatus = 2;
}
console.log(activeName.value);
getList(state.tableData.param).then((res) => {
state.tableData.data = res.records;
state.tableData.total = res.total;
@ -223,55 +225,25 @@ const onHandleSizeChange = (val) => {
const onOpenEditRole = (type, row) => {
//
state.edit = JSON.parse(JSON.stringify(row));
state.dialogVisible = true;
nextTick(() => {
state.radio = "1"
// mapRef.value.mapOperations.removeAll()
//
if(state.wktPoint){
mapRef.value.mapOperations.removeLayer( state.wktPoint)
}
state.wktPoint= mapRef.value.mapOperations.wktParseToMap(row.geometry)
// mapRef.value.mapOperations.on("click", (res)=>{
// mapRef.value.mapOperations.clearPolygon()
// mapRef.value.mapOperations.removeLayer( state.wktPoint)
// mapRef.value.mapOperations.addInteractMarker(res.latlng.lat, res.latlng.lng)
// })
mapEvents('1')
console.log(map.value);
//
//TODO
map.mapOperations.wktParseToMap(row.geometry)
});
state.dialogVisible = true;
};
const mapEvents = (ev)=>{
if(ev == '1'){
mapRef.value.mapOperations.clearPolygon()
mapRef.value.mapOperations.on("click", mapClick)
mapRef.value.mapOperations.on("mousemove", changelatlon)
}else{
mapRef.value.mapOperations.off("click",mapClick);
mapRef.value.mapOperations.drawPolygon()
mapRef.value.mapOperations.drawCreated()
}
};
const mapClick=(res)=>{
mapRef.value.mapOperations.removeLayer( state.wktPoint)
changelatlon(res);
mapRef.value.mapOperations.addInteractMarker(res.latlng.lat.toFixed(3),res.latlng.lng.toFixed(3))
}
const reviews = (index) => {
//state.edit.geometry
//TODO
//state.edit.geometry = map.mapOperations.getWkt();
//index
if (index === 1) {
state.edit.respondStatus = 1;
} else {
state.edit.respondStatus = 2;
}
state.edit.geometry = variableStore.layerGroupPoint === null ? variableStore.layerGroupPoly : variableStore.layerGroupPoint;
//
state.edit.disasterTime = useDateFormat(state.edit.disasterTime, 'YYYY-MM-DD').value + " 00:00:00";
review(state.edit).then((res) => {
@ -282,19 +254,20 @@ const reviews = (index) => {
}
//
const onHandleCurrentChange = (val) => {
console.log(val);
state.tableData.param.pageNum = val;
getTableData();
};
const onMapClick = (e) => {
state.lat = e.latlng.lat.toFixed(3);
state.lon = e.latlng.lng.toFixed(3);
mapRef.value.mapOperations.addInteractMarker(state.lat, state.lon)
map.value.mapOperations.addInteractMarker(state.lat, state.lon)
}
const changelatlon = (e) => {
//e
state.dislat = e.latlng.lat.toFixed(3);
state.dislon= e.latlng.lng.toFixed(3);
state.dislat = e.latlng.lat.toFixed(3);
state.dislon = e.latlng.lng.toFixed(3);
// state.lon = state.lon % 360;
// if (state.lon < 0) {
// state.lon = state.lon + 360;
// }
@ -342,13 +315,13 @@ onMounted(() => {
});
watchEffect(() => {
if (state.radio== "1") {
// mapRef.value.mapOperations.on("click", onMapClick)
// map.value.mapOperations.on("click", onMapClick)
// map.value.mapOperations.clearPolygon()
// map.value.mapOperations.on("mousemove", changelatlon)
// variableStore.polygoncontrol = "option1"
}
else {
// mapRef.value.mapOperations.off("click", onMapClick)
// map.value.mapOperations.off("click", onMapClick)
// map.value.mapOperations.drawPolygon()
// map.value.mapOperations.drawCreated()
// variableStore.polygoncontrol = "option2"