glj-代码提交

This commit is contained in:
glj 2023-11-17 17:17:57 +08:00
parent 2065fb080d
commit 40569ec5f0
4 changed files with 20 additions and 123 deletions

View File

@ -209,20 +209,28 @@ const state = reactive({
pageSize: 10, pageSize: 10,
}, },
}, },
selectList: [],
selectListId: null, selectListId: null,
}); });
const openDialog = async (row, bool) => { const openDialog = async (row, bool) => {
// if (row || state.multipleSelection) {
// if (state.disasterId == null) {
// ElMessage.warning('Please select the disaster first');
// return false;
// }
// }
state.selectListId = row.id; state.selectListId = row.id;
state.dialogVisible = true; state.dialogVisible = true;
}; };
const reviews = async (status) => { const reviews = async (status) => {
let ids = state.selectList.map((item) => item.id); let ids = state.multipleSelection.map((item) => item.id);
//ids 使 //ids 使
ids = ids.join(','); ids = ids.join(',');
let res = await review(state.selectListId, status, state.searchName == '1' ? true : false); if (state.multipleSelection) {
ids = state.selectListId;
}
let res = await review(ids, status, state.searchName == '1' ? true : false);
if (res) { if (res) {
state.dialogVisible = false; state.dialogVisible = false;
ElMessage.success('success'); ElMessage.success('success');

View File

@ -128,26 +128,7 @@ const auditData = (row) => {
let id = row.id let id = row.id
auditRef.value.openDialog([{ "id": id }]); auditRef.value.openDialog([{ "id": id }]);
} }
//
const formatSize = (size) => {
var data = "";
if (size < 0.1 * 1024) { //0.1KBB
data = size.toFixed(2) + "B";
} else if (size < 0.1 * 1024 * 1024) {//0.1MBKB
data = (size / 1024).toFixed(2) + "KB";
} else if (size < 0.1 * 1024 * 1024 * 1024) { //0.1GBMB
data = (size / (1024 * 1024)).toFixed(2) + "MB";
} else { //GB
data = (size / (1024 * 1024 * 1024)).toFixed(2) + "GB";
}
var sizestr = data + "";
var len = sizestr.indexOf("\.");
var dec = sizestr.substr(len + 1, 2);
if (dec == "00") {//00
return sizestr.substring(0, len) + sizestr.substr(len + 3, 2);
}
return sizestr;
}
const formatSizeUnits = (size) => { const formatSizeUnits = (size) => {
if (size === 0) return '0 B'; if (size === 0) return '0 B';
var k = 1000, // or 1024 var k = 1000, // or 1024

View File

@ -10,14 +10,6 @@
<el-col :span="14"> <el-col :span="14">
<div class="system-role-padding layout-padding-auto layout-padding-view" style="height: 85vh;"> <div class="system-role-padding layout-padding-auto layout-padding-view" style="height: 85vh;">
<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-input size="default" placeholder="please enter username" style="max-width: 180px" v-model="state.searchName"
clearable></el-input>
<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-button size="default" type="success" class="ml10" @click="uploadData">
<el-icon> <el-icon>
<ele-Upload /> <ele-Upload />
@ -88,14 +80,12 @@ import { defineAsyncComponent, reactive, onMounted, ref } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus'; import { ElMessageBox, ElMessage } from 'element-plus';
// //
const RoleDialog = defineAsyncComponent(() => import('/@/views/system/role/dialog.vue')); const RoleDialog = defineAsyncComponent(() => import('/@/views/system/role/dialog.vue'));
const auditRef = ref();
const uploadRef = ref(); const uploadRef = ref();
const editUploadRef = ref(); const editUploadRef = ref();
// //
const roleDialogRef = ref(); const roleDialogRef = ref();
const state = reactive({ const state = reactive({
multipleSelection: [], multipleSelection: [],
tabVal: 'first',
disasterId: null, disasterId: null,
disasterData: { disasterData: {
data: [], data: [],
@ -121,66 +111,19 @@ const state = reactive({
const handleSelectionChange = (val) => { const handleSelectionChange = (val) => {
state.multipleSelection = val; state.multipleSelection = val;
}; };
// //
const formatName = (name) => { const formatName = (name) => {
return name; return name;
}; };
const auditData = (row) => {
let id = row.id;
auditRef.value.openDialog([{ id: id }]);
};
//
const formatSize = (size) => {
var data = '';
if (size < 0.1 * 1024) {
//0.1KBB
data = size.toFixed(2) + 'B';
} else if (size < 0.1 * 1024 * 1024) {
//0.1MBKB
data = (size / 1024).toFixed(2) + 'KB';
} else if (size < 0.1 * 1024 * 1024 * 1024) {
//0.1GBMB
data = (size / (1024 * 1024)).toFixed(2) + 'MB';
} else {
//GB
data = (size / (1024 * 1024 * 1024)).toFixed(2) + 'GB';
}
var sizestr = data + '';
var len = sizestr.indexOf('.');
var dec = sizestr.substr(len + 1, 2);
if (dec == '00') {
//00
return sizestr.substring(0, len) + sizestr.substr(len + 3, 2);
}
return sizestr;
};
const formatSizeUnits = (size) => {
if (size === 0 || size === -1) 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));
return (size / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
};
// //
const tableClick = (i) => { const tableClick = (i) => {
state.disasterId = i.disasterId; state.disasterId = i.disasterId;
getTableData(); getTableData();
}; };
//
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);
item.disasterTime = date;
})
state.disasterData.total = res.total;
state.disasterData.loading = false;
});
};
// //
const getTableData = () => { const getTableData = () => {
@ -242,16 +185,7 @@ const del = (row) => {
}) })
.catch(() => { }); .catch(() => { });
}; };
//
const onHandleDisasterSizeChange = (val) => {
state.disasterData.param.pageSize = val;
getDisasterData();
};
//
const onHandleDisasterCurrentChange = (val) => {
state.disasterData.param.pageNum = val;
getDisasterData();
};
// //
const onHandleSizeChange = (val) => { const onHandleSizeChange = (val) => {
state.tableData.param.pageSize = val; state.tableData.param.pageSize = val;
@ -264,7 +198,6 @@ const onHandleCurrentChange = (val) => {
}; };
// //
onMounted(() => { onMounted(() => {
getDisasterData();
//getTableData(); //getTableData();
}); });
</script> </script>

View File

@ -204,10 +204,7 @@ const handleClickNew = (tab) => {
} }
getTableData(); getTableData();
}; };
const auditData = (row) => {
let id = row.id
auditRef.value.openDialog([{ "id": id }]);
}
// //
const formatSize = (size) => { const formatSize = (size) => {
var data = ""; var data = "";
@ -241,19 +238,7 @@ const tableClick = (i) => {
state.disasterId = i.disasterId; state.disasterId = i.disasterId;
getTableData(); getTableData();
} }
//
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);
item.disasterTime = date;
})
state.disasterData.total = res.total;
state.disasterData.loading = false;
})
}
// //
const getTableData = () => { const getTableData = () => {
@ -385,16 +370,7 @@ const delHotspot = (row) => {
}) })
.catch(() => { }); .catch(() => { });
}; };
//
const onHandleDisasterSizeChange = (val) => {
state.disasterData.param.pageSize = val;
getDisasterData();
};
//
const onHandleDisasterCurrentChange = (val) => {
state.disasterData.param.pageNum = val;
getDisasterData();
};
// //
const onHandleSizeChange = (val) => { const onHandleSizeChange = (val) => {
state.tableData.param.pageSize = val; state.tableData.param.pageSize = val;
@ -407,8 +383,7 @@ const onHandleCurrentChange = (val) => {
}; };
// //
onMounted(() => { onMounted(() => {
getDisasterData(); getTableData();
//getTableData();
}); });
</script> </script>
<style> <style>