代码提交-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

@ -4,33 +4,17 @@
<el-row :gutter="22"> <el-row :gutter="22">
<el-col :span="10"> <el-col :span="10">
<div class="system-role-padding layout-padding-auto layout-padding-view"> <div class="system-role-padding layout-padding-auto layout-padding-view">
<el-table :data="state.disasterData.data" <el-table :data="state.disasterData.data" v-loading="state.disasterData.loading" style="width: 100%"
v-loading="state.disasterData.loading" highlight-current-row @row-click="tableClick">
style="width: 100%" <el-table-column type="index" label="ID" width="50" />
highlight-current-row <el-table-column prop="disasterType" label="Disaster type" show-overflow-tooltip></el-table-column>
@row-click="tableClick"> <el-table-column prop="disasterCountry" label="disaster country" show-overflow-tooltip></el-table-column>
<el-table-column type="index" <el-table-column prop="disasterTime" label="disaster time" show-overflow-tooltip></el-table-column>
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-table>
<el-pagination @size-change="onHandleDisasterSizeChange" <el-pagination @size-change="onHandleDisasterSizeChange" @current-change="onHandleDisasterCurrentChange"
@current-change="onHandleDisasterCurrentChange" class="mt15" :pager-count="5" :page-sizes="[10, 20, 30]"
class="mt15" v-model:current-page="state.disasterData.param.pageNum" background
:pager-count="5" v-model:page-size="state.disasterData.param.pageSize" layout="total, sizes, prev, pager, next, jumper"
: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"> :total="state.disasterData.total">
</el-pagination> </el-pagination>
</div> </div>
@ -38,83 +22,62 @@
<el-col :span="14"> <el-col :span="14">
<div class="system-role-padding layout-padding-auto layout-padding-view"> <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;"> <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-select v-model="state.searchName" placeholder="please select data type" style="max-width: 200px"
<el-option value="1" label="basic data"></el-option> size="default" clearable>
<el-option value="2" label="responded report"></el-option> <el-option value="0" label="basic data"></el-option>
<el-option value="3" label="cartographic product"></el-option> <el-option value="1" label="responded report"></el-option>
<el-option value="2" label="cartographic product"></el-option>
</el-select> </el-select>
<el-button size="default" type="primary" class="ml10" @click="getTableData"> <el-button size="default" type="primary" class="ml10" @click="getTableData">
<el-icon> <el-icon>
<ele-Search/> <ele-Search />
</el-icon> </el-icon>
search search
</el-button> </el-button>
<el-button size="default" type="success" class="ml10" @click="uploadData"> <el-button size="default" type="success" class="ml10" @click="uploadData">
<el-icon> <el-icon>
<ele-Upload/> <ele-Upload />
</el-icon> </el-icon>
upload upload
</el-button> </el-button>
<el-button size="default" type="danger" class="ml10" @click="batchDel"> <el-button size="default" type="danger" class="ml10" @click="batchDel">
<el-icon> <el-icon>
<ele-Delete/> <ele-Delete />
</el-icon> </el-icon>
batch delete batch delete
</el-button> </el-button>
</div> </div>
<el-table :data="state.tableData.data" <el-table :data="state.tableData.data" v-loading="state.tableData.loading"
v-loading="state.tableData.loading" @selection-change="handleSelectionChange" style="width: 100%">
@selection-change="handleSelectionChange"
style="width: 100%">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column type="index" <el-table-column type="index" label="ID" width="50" />
label="ID" <el-table-column prop="uploaderName" label="uploader Name" show-overflow-tooltip></el-table-column>
width="50" /> <el-table-column prop="sourceOrganization" label="Organization" show-overflow-tooltip></el-table-column>
<el-table-column prop="uploaderName" <el-table-column prop="title" label="Professional title" show-overflow-tooltip
label="uploader Name" width="150"></el-table-column>
show-overflow-tooltip></el-table-column> <el-table-column prop="size" label="Data size" show-overflow-tooltip>
<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"> <template #default="scope">
{{formatSizeUnits(scope.row.size)}} {{ formatSizeUnits(scope.row.size) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="uploadTime" <el-table-column prop="uploadTime" label="Upload time" show-overflow-tooltip></el-table-column>
label="Upload time" <el-table-column prop="Operate" label="Operate" show-overflow-tooltip>
show-overflow-tooltip></el-table-column>
<el-table-column prop="Operate"
label="Operate"
show-overflow-tooltip>
<template #default="scope"> <template #default="scope">
<el-button size="small" text type="primary" @click="del(scope.row)">Delete</el-button> <el-button size="small" text type="primary" @click="del(scope.row)">Delete</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination @size-change="onHandleSizeChange" <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
@current-change="onHandleCurrentChange" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="state.tableData.param.pageNum" background
class="mt15" v-model:page-size="state.tableData.param.pageSize" layout="total, sizes, prev, pager, next, jumper"
: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"> :total="state.tableData.total">
</el-pagination> </el-pagination>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
</el-config-provider> </el-config-provider>
<RoleDialog ref="roleDialogRef" <RoleDialog ref="roleDialogRef" @refresh="getTableData()" />
@refresh="getTableData()" /> <Upload ref="uploadRef" @callback="getTableData" />
<Upload ref="uploadRef" @callback="getTableData"/>
</div> </div>
</template> </template>
@ -122,7 +85,7 @@
import en from 'element-plus/dist/locale/en.mjs' import en from 'element-plus/dist/locale/en.mjs'
import type { TabsPaneContext } from 'element-plus'; import type { TabsPaneContext } from 'element-plus';
import Upload from './component/upload.vue'; 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'); const activeName = ref('first');
// //
@ -135,9 +98,9 @@ const uploadRef = ref();
// //
const roleDialogRef = ref(); const roleDialogRef = ref();
const state = reactive({ const state = reactive({
multipleSelection:[], multipleSelection: [],
searchName:'', searchName: '',
disasterId:null, disasterId: null,
disasterData: { disasterData: {
data: [], data: [],
total: 0, total: 0,
@ -164,7 +127,7 @@ const handleSelectionChange = (val) => {
} }
const auditData = (row) => { const auditData = (row) => {
let id = row.id let id = row.id
auditRef.value.openDialog([{"id":id}]); auditRef.value.openDialog([{ "id": id }]);
} }
// //
const formatSize = (size) => { const formatSize = (size) => {
@ -202,7 +165,7 @@ const tableClick = (row, column, event) => {
// //
const getDisasterData = () => { const getDisasterData = () => {
state.disasterData.loading = true; 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.data = res.records;
state.disasterData.total = res.total; state.disasterData.total = res.total;
state.disasterData.loading = false; state.disasterData.loading = false;
@ -212,7 +175,9 @@ const getDisasterData = () => {
// //
const getTableData = () => { const getTableData = () => {
state.tableData.loading = true; 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.data = res.records;
state.tableData.total = res.total; state.tableData.total = res.total;
}) })
@ -224,7 +189,7 @@ const getTableData = () => {
}; };
// //
const uploadData = () => { const uploadData = () => {
if(state.disasterId == null){ if (state.disasterId == null) {
ElMessage.warning("Please select the disaster first") ElMessage.warning("Please select the disaster first")
return false; return false;
} }
@ -236,7 +201,7 @@ const onOpenEditRole = (type, row) => {
}; };
// //
const batchDel = () => { const batchDel = () => {
if(state.multipleSelection.length == 0){ if (state.multipleSelection.length == 0) {
ElMessage.warning("Select the data to be operated first"); ElMessage.warning("Select the data to be operated first");
return false; return false;
} }
@ -246,13 +211,13 @@ const batchDel = () => {
type: 'warning', type: 'warning',
}) })
.then(() => { .then(() => {
let id = state.multipleSelection.map(item=>item.id) let id = state.multipleSelection.map(item => item.id)
deleteData(id.join()).then(res=>{ deleteData(id.join()).then(res => {
getTableData(); getTableData();
ElMessage.success('delete successfully'); ElMessage.success('delete successfully');
}) })
}) })
.catch(() => {}); .catch(() => { });
} }
// //
const del = (row) => { const del = (row) => {
@ -262,12 +227,12 @@ const del = (row) => {
type: 'warning', type: 'warning',
}) })
.then(() => { .then(() => {
deleteData(row.id).then(res=>{ deleteData(row.id).then(res => {
getTableData(); getTableData();
ElMessage.success('delete successfully'); ElMessage.success('delete successfully');
}) })
}) })
.catch(() => {}); .catch(() => { });
}; };
// //
const onHandleDisasterSizeChange = (val) => { const onHandleDisasterSizeChange = (val) => {
@ -296,7 +261,7 @@ onMounted(() => {
}); });
</script> </script>
<style> <style>
.demo-tabs > .el-tabs__content { .demo-tabs>.el-tabs__content {
padding: 32px; padding: 32px;
color: #6b778c; color: #6b778c;
font-size: 32px; font-size: 32px;
@ -306,6 +271,7 @@ onMounted(() => {
.system-role-container { .system-role-container {
.system-role-padding { .system-role-padding {
padding: 15px; padding: 15px;
.el-table { .el-table {
flex: 1; flex: 1;
} }

View File

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

View File

@ -4,33 +4,17 @@
<el-row :gutter="22"> <el-row :gutter="22">
<el-col :span="10"> <el-col :span="10">
<div class="system-role-padding layout-padding-auto layout-padding-view"> <div class="system-role-padding layout-padding-auto layout-padding-view">
<el-table :data="state.disasterData.data" <el-table :data="state.disasterData.data" v-loading="state.disasterData.loading" style="width: 100%"
v-loading="state.disasterData.loading" highlight-current-row @row-click="tableClick">
style="width: 100%" <el-table-column type="index" label="ID" width="50" />
highlight-current-row <el-table-column prop="disasterType" label="Disaster type" show-overflow-tooltip></el-table-column>
@row-click="tableClick"> <el-table-column prop="disasterCountry" label="disaster country" show-overflow-tooltip></el-table-column>
<el-table-column type="index" <el-table-column prop="disasterTime" label="disaster time" show-overflow-tooltip></el-table-column>
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-table>
<el-pagination @size-change="onHandleDisasterSizeChange" <el-pagination @size-change="onHandleDisasterSizeChange" @current-change="onHandleDisasterCurrentChange"
@current-change="onHandleDisasterCurrentChange" class="mt15" :pager-count="5" :page-sizes="[10, 20, 30]"
class="mt15" v-model:current-page="state.disasterData.param.pageNum" background
:pager-count="5" v-model:page-size="state.disasterData.param.pageSize" layout="total, sizes, prev, pager, next, jumper"
: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"> :total="state.disasterData.total">
</el-pagination> </el-pagination>
</div> </div>
@ -40,72 +24,49 @@
<div class="system-user-search mb15" style="display: flex;margin-left: 10px;margin-top: 10px;"> <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-button size="default" type="primary" class="ml10" @click="batchAudit">
<el-icon> <el-icon>
<ele-EditPen/> <ele-EditPen />
</el-icon> </el-icon>
batch audit batch audit
</el-button> </el-button>
</div> </div>
<el-table :data="state.tableData.data" <el-table :data="state.tableData.data" v-loading="state.tableData.loading"
v-loading="state.tableData.loading" @selection-change="handleSelectionChange" style="width: 100%">
@selection-change="handleSelectionChange"
style="width: 100%">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column type="index" <el-table-column type="index" label="ID" width="50" />
label="ID" <el-table-column prop="uploaderName" label="uploader Name" show-overflow-tooltip></el-table-column>
width="50" /> <el-table-column prop="sourceOrganization" label="Organization" show-overflow-tooltip></el-table-column>
<el-table-column prop="uploaderName" <el-table-column prop="title" label="Professional title" show-overflow-tooltip
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> width="150"></el-table-column>
<el-table-column prop="size" <el-table-column prop="size" label="Data size" show-overflow-tooltip>
label="Data size"
show-overflow-tooltip>
<template #default="scope"> <template #default="scope">
{{formatSizeUnits(scope.row.size)}} {{ formatSizeUnits(scope.row.size) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="uploadTime" <el-table-column prop="uploadTime" label="Upload time" show-overflow-tooltip></el-table-column>
label="Upload time" <el-table-column prop="Operate" label="Operate" show-overflow-tooltip>
show-overflow-tooltip></el-table-column>
<el-table-column prop="Operate"
label="Operate"
show-overflow-tooltip>
<template #default="scope"> <template #default="scope">
<el-button size="small" text type="primary" @click="auditData(scope.row)">Audit</el-button> <el-button size="small" text type="primary" @click="auditData(scope.row)">Audit</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination @size-change="onHandleSizeChange" <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
@current-change="onHandleCurrentChange" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="state.tableData.param.pageNum" background
class="mt15" v-model:page-size="state.tableData.param.pageSize" layout="total, sizes, prev, pager, next, jumper"
: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"> :total="state.tableData.total">
</el-pagination> </el-pagination>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
</el-config-provider> </el-config-provider>
<RoleDialog ref="roleDialogRef" <RoleDialog ref="roleDialogRef" @refresh="getTableData()" />
@refresh="getTableData()" /> <Audit ref="auditRef" @callback="getTableData" />
<Audit ref="auditRef" @callback="getTableData"/>
</div> </div>
</template> </template>
<script lang="ts" setup name="systemRole"> <script lang="ts" setup name="systemRole">
import en from 'element-plus/dist/locale/en.mjs' import en from 'element-plus/dist/locale/en.mjs'
import type { TabsPaneContext } from 'element-plus'; 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 activeName = ref('first');
const handleClick = (tab: TabsPaneContext, event: Event) => { const handleClick = (tab: TabsPaneContext, event: Event) => {
@ -122,8 +83,8 @@ const auditRef = ref();
// //
const roleDialogRef = ref(); const roleDialogRef = ref();
const state = reactive({ const state = reactive({
multipleSelection:[], multipleSelection: [],
disasterId:null, disasterId: null,
disasterData: { disasterData: {
data: [], data: [],
total: 0, total: 0,
@ -150,7 +111,7 @@ const handleSelectionChange = (val) => {
} }
// //
const batchAudit = () => { const batchAudit = () => {
if(state.multipleSelection.length == 0){ if (state.multipleSelection.length == 0) {
ElMessage.warning("Select the data to be operated first"); ElMessage.warning("Select the data to be operated first");
return false; return false;
} }
@ -158,7 +119,7 @@ const batchAudit = () => {
} }
const auditData = (row) => { const auditData = (row) => {
let id = row.id let id = row.id
auditRef.value.openDialog([{"id":id}]); auditRef.value.openDialog([{ "id": id }]);
} }
// //
const formatSize = (size) => { const formatSize = (size) => {
@ -196,7 +157,7 @@ const tableClick = (row, column, event) => {
// //
const getDisasterData = () => { const getDisasterData = () => {
state.disasterData.loading = true; 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.data = res.records;
state.disasterData.total = res.total; state.disasterData.total = res.total;
state.disasterData.loading = false; state.disasterData.loading = false;
@ -206,11 +167,11 @@ const getDisasterData = () => {
// //
const getTableData = () => { const getTableData = () => {
state.tableData.loading = true; state.tableData.loading = true;
getDataUploadPage(state.tableData.param.pageNum,state.tableData.param.pageSize,{"disasterId":state.disasterId}).then(res=>{ getDataUploadPage(state.tableData.param.pageNum, state.tableData.param.pageSize, { "disasterId": state.disasterId }).then(res => {
state.tableData.data = res.records; state.tableData.data = res.records;
state.tableData.total = res.total; state.tableData.total = res.total;
}) })
/* state.tableData.data = data; /* state.tableData.data = data;
state.tableData.total = state.tableData.data.length;*/ state.tableData.total = state.tableData.data.length;*/
setTimeout(() => { setTimeout(() => {
state.tableData.loading = false; state.tableData.loading = false;
@ -235,7 +196,7 @@ const onRowDel = (row) => {
getTableData(); getTableData();
ElMessage.success('删除成功'); ElMessage.success('删除成功');
}) })
.catch(() => {}); .catch(() => { });
}; };
// //
const onHandleDisasterSizeChange = (val) => { const onHandleDisasterSizeChange = (val) => {
@ -264,7 +225,7 @@ onMounted(() => {
}); });
</script> </script>
<style> <style>
.demo-tabs > .el-tabs__content { .demo-tabs>.el-tabs__content {
padding: 32px; padding: 32px;
color: #6b778c; color: #6b778c;
font-size: 32px; font-size: 32px;
@ -274,6 +235,7 @@ onMounted(() => {
.system-role-container { .system-role-container {
.system-role-padding { .system-role-padding {
padding: 15px; padding: 15px;
.el-table { .el-table {
flex: 1; flex: 1;
} }

View File

@ -14,7 +14,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <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 <el-select size="default" v-model="state.query.checked" clearable
placeholder="Please select"> placeholder="Please select">
<el-option label="checked" value="0"></el-option> <el-option label="checked" value="0"></el-option>

View File

@ -85,7 +85,6 @@
{{ dateFormat(scope.row.disasterTime) }} {{ dateFormat(scope.row.disasterTime) }}
</template> </template>
</el-table-column> </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="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="Operate" label="Operate" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="respondStatus" label="Response status" show-overflow-tooltip> <el-table-column prop="respondStatus" label="Response status" show-overflow-tooltip>
@ -97,11 +96,24 @@
</el-table-column> </el-table-column>
<el-table-column prop="Operate" label="Operate" show-overflow-tooltip> <!-- <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"> <template #default="scope">
<el-button size="small" text type="primary" @click="onAllocation(scope.row)">Allocation</el-button> <el-tag type="success" v-if="scope.row.status">启用</el-tag>
<el-tag type="info" v-else>禁用</el-tag>
</template> </template>
</el-table-column> </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-table>
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15" <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 :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-tab-pane>
</el-tabs> </el-tabs>
</div> </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-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='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='2'>Area</el-radio>
<el-button type="primary" style="margin-left: 5%;">Clear</el-button> <el-button type="primary" style="margin-left: 5%;">Clear</el-button>
</el-container> </el-container>
<el-container style="margin-top: 2%;margin-bottom: 2%;" v-if="state.radio==='1'?true:false"> <el-container style="margin-top: 2%;margin-bottom: 2%;" v-if="state.radio==='1'?true:false">
<span style="line-height: 35px;"> Latitude</span> <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> <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> </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-form-item label="Disaster Time">
<el-date-picker v-model="state.edit.disasterTime" type="date" value-format="YYYY-MM-DD" <el-date-picker v-model="state.edit.disasterTime" type="date" value-format="YYYY-MM-DD"
placeholder="Select date and time" /> placeholder="Select date and time" />
@ -141,40 +153,30 @@
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
<selectUser ref ="select" @callback="getTableData"></selectUser>
</el-config-provider> </el-config-provider>
</div> </div>
</template> </template>
<script setup name="userResponse"> <script setup name="userResponse">
import en from 'element-plus/dist/locale/en.mjs' 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 { reactive, onMounted, ref, nextTick,watchEffect } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus'; import { ElMessageBox, ElMessage } from 'element-plus';
import { getList, review } from '/@/api/disasterInfo/index'; import { getList, review } from '/@/api/disasterInfo/index';
import { getDictionary } from '/@/api/system/dictbiz'; import { getDictionary } from '/@/api/system/dictbiz';
import { useVariableStore } from '/@/stores/index.ts'
// //
import Map from '/@/components/Map.vue'; import Map from '/@/components/Map.vue';
import { useDateFormat } from '@vueuse/shared'; import { useDateFormat } from '@vueuse/shared';
import selectUser from './component/selectUser.vue';
import L from "leaflet"; import L from "leaflet";
import "leaflet/dist/leaflet.css"; import "leaflet/dist/leaflet.css";
import 'leaflet-draw/dist/leaflet.draw' import 'leaflet-draw/dist/leaflet.draw'
import 'leaflet-draw/dist/leaflet.draw.css' import 'leaflet-draw/dist/leaflet.draw.css'
import { map } from 'lodash'; const map = ref();
const variableStore = useVariableStore();
const mapRef = ref();
const activeName = ref('first'); const activeName = ref('first');
const select = ref();
const handleClick = (tab, event) => { const handleClick = (tab, event) => {
state.selectName = tab.props.name; state.selectName = tab.props.name;
getTableData(); getTableData();
}; };
const onAllocation = (row) => {
select.value.openDialog(row)
};
const dateFormat = (date) => { const dateFormat = (date) => {
return useDateFormat(date, 'YYYY-MM-DD').value; return useDateFormat(date, 'YYYY-MM-DD').value;
} }
@ -198,8 +200,7 @@ const state = reactive({
edit: {}, edit: {},
radio:null, radio:null,
dislat:'', dislat:'',
dislon:'', dislon:''
wktPoint:undefined
}); });
// //
const getTableData = () => { const getTableData = () => {
@ -210,6 +211,7 @@ const getTableData = () => {
} else { } else {
state.tableData.param.respondStatus = 2; state.tableData.param.respondStatus = 2;
} }
console.log(activeName.value);
getList(state.tableData.param).then((res) => { getList(state.tableData.param).then((res) => {
state.tableData.data = res.records; state.tableData.data = res.records;
state.tableData.total = res.total; state.tableData.total = res.total;
@ -223,55 +225,25 @@ const onHandleSizeChange = (val) => {
const onOpenEditRole = (type, row) => { const onOpenEditRole = (type, row) => {
// //
state.edit = JSON.parse(JSON.stringify(row)); state.edit = JSON.parse(JSON.stringify(row));
state.dialogVisible = true;
nextTick(() => { nextTick(() => {
state.radio = "1" console.log(map.value);
// mapRef.value.mapOperations.removeAll()
// //
if(state.wktPoint){ //TODO
mapRef.value.mapOperations.removeLayer( state.wktPoint) map.mapOperations.wktParseToMap(row.geometry)
}
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')
}); });
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) => { const reviews = (index) => {
//state.edit.geometry //state.edit.geometry
//TODO //TODO
//state.edit.geometry = map.mapOperations.getWkt(); //state.edit.geometry = map.mapOperations.getWkt();
//index //index
if (index === 1) { if (index === 1) {
state.edit.respondStatus = 1; state.edit.respondStatus = 1;
} else { } else {
state.edit.respondStatus = 2; 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"; state.edit.disasterTime = useDateFormat(state.edit.disasterTime, 'YYYY-MM-DD').value + " 00:00:00";
review(state.edit).then((res) => { review(state.edit).then((res) => {
@ -282,19 +254,20 @@ const reviews = (index) => {
} }
// //
const onHandleCurrentChange = (val) => { const onHandleCurrentChange = (val) => {
console.log(val);
state.tableData.param.pageNum = val; state.tableData.param.pageNum = val;
getTableData(); getTableData();
}; };
const onMapClick = (e) => { const onMapClick = (e) => {
state.lat = e.latlng.lat.toFixed(3); state.lat = e.latlng.lat.toFixed(3);
state.lon = e.latlng.lng.toFixed(3); state.lon = e.latlng.lng.toFixed(3);
map.value.mapOperations.addInteractMarker(state.lat, state.lon)
mapRef.value.mapOperations.addInteractMarker(state.lat, state.lon)
} }
const changelatlon = (e) => { const changelatlon = (e) => {
//e
state.dislat = e.latlng.lat.toFixed(3); state.dislat = e.latlng.lat.toFixed(3);
state.dislon= e.latlng.lng.toFixed(3); state.dislon = e.latlng.lng.toFixed(3);
// state.lon = state.lon % 360;
// if (state.lon < 0) { // if (state.lon < 0) {
// state.lon = state.lon + 360; // state.lon = state.lon + 360;
// } // }
@ -342,13 +315,13 @@ onMounted(() => {
}); });
watchEffect(() => { watchEffect(() => {
if (state.radio== "1") { if (state.radio== "1") {
// mapRef.value.mapOperations.on("click", onMapClick) // map.value.mapOperations.on("click", onMapClick)
// map.value.mapOperations.clearPolygon() // map.value.mapOperations.clearPolygon()
// map.value.mapOperations.on("mousemove", changelatlon) // map.value.mapOperations.on("mousemove", changelatlon)
// variableStore.polygoncontrol = "option1" // variableStore.polygoncontrol = "option1"
} }
else { else {
// mapRef.value.mapOperations.off("click", onMapClick) // map.value.mapOperations.off("click", onMapClick)
// map.value.mapOperations.drawPolygon() // map.value.mapOperations.drawPolygon()
// map.value.mapOperations.drawCreated() // map.value.mapOperations.drawCreated()
// variableStore.polygoncontrol = "option2" // variableStore.polygoncontrol = "option2"