glj-代码提交
This commit is contained in:
parent
2065fb080d
commit
40569ec5f0
|
@ -209,20 +209,28 @@ const state = reactive({
|
|||
pageSize: 10,
|
||||
},
|
||||
},
|
||||
selectList: [],
|
||||
selectListId: null,
|
||||
});
|
||||
|
||||
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.dialogVisible = true;
|
||||
};
|
||||
|
||||
const reviews = async (status) => {
|
||||
let ids = state.selectList.map((item) => item.id);
|
||||
let ids = state.multipleSelection.map((item) => item.id);
|
||||
//将ids 转为字符串 使用逗号分隔
|
||||
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) {
|
||||
state.dialogVisible = false;
|
||||
ElMessage.success('success');
|
||||
|
|
|
@ -128,26 +128,7 @@ const auditData = (row) => {
|
|||
let id = row.id
|
||||
auditRef.value.openDialog([{ "id": id }]);
|
||||
}
|
||||
//格式化字节
|
||||
const formatSize = (size) => {
|
||||
var data = "";
|
||||
if (size < 0.1 * 1024) { //如果小于0.1KB转化成B
|
||||
data = size.toFixed(2) + "B";
|
||||
} else if (size < 0.1 * 1024 * 1024) {//如果小于0.1MB转化成KB
|
||||
data = (size / 1024).toFixed(2) + "KB";
|
||||
} else if (size < 0.1 * 1024 * 1024 * 1024) { //如果小于0.1GB转化成MB
|
||||
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) return '0 B';
|
||||
var k = 1000, // or 1024
|
||||
|
|
|
@ -10,14 +10,6 @@
|
|||
<el-col :span="14">
|
||||
<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;">
|
||||
<!-- <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-icon>
|
||||
<ele-Upload />
|
||||
|
@ -88,14 +80,12 @@ import { defineAsyncComponent, reactive, onMounted, ref } from 'vue';
|
|||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
// 引入组件
|
||||
const RoleDialog = defineAsyncComponent(() => import('/@/views/system/role/dialog.vue'));
|
||||
const auditRef = ref();
|
||||
const uploadRef = ref();
|
||||
const editUploadRef = ref();
|
||||
// 定义变量内容
|
||||
const roleDialogRef = ref();
|
||||
const state = reactive({
|
||||
multipleSelection: [],
|
||||
tabVal: 'first',
|
||||
disasterId: null,
|
||||
disasterData: {
|
||||
data: [],
|
||||
|
@ -121,66 +111,19 @@ const state = reactive({
|
|||
const handleSelectionChange = (val) => {
|
||||
state.multipleSelection = val;
|
||||
};
|
||||
|
||||
//格式化图片名称
|
||||
const formatName = (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.1KB转化成B
|
||||
data = size.toFixed(2) + 'B';
|
||||
} else if (size < 0.1 * 1024 * 1024) {
|
||||
//如果小于0.1MB转化成KB
|
||||
data = (size / 1024).toFixed(2) + 'KB';
|
||||
} else if (size < 0.1 * 1024 * 1024 * 1024) {
|
||||
//如果小于0.1GB转化成MB
|
||||
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) => {
|
||||
state.disasterId = i.disasterId;
|
||||
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 = () => {
|
||||
|
@ -242,16 +185,7 @@ const del = (row) => {
|
|||
})
|
||||
.catch(() => { });
|
||||
};
|
||||
// 分页改变
|
||||
const onHandleDisasterSizeChange = (val) => {
|
||||
state.disasterData.param.pageSize = val;
|
||||
getDisasterData();
|
||||
};
|
||||
// 分页改变
|
||||
const onHandleDisasterCurrentChange = (val) => {
|
||||
state.disasterData.param.pageNum = val;
|
||||
getDisasterData();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const onHandleSizeChange = (val) => {
|
||||
state.tableData.param.pageSize = val;
|
||||
|
@ -264,7 +198,6 @@ const onHandleCurrentChange = (val) => {
|
|||
};
|
||||
// 页面加载时
|
||||
onMounted(() => {
|
||||
getDisasterData();
|
||||
//getTableData();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -204,10 +204,7 @@ const handleClickNew = (tab) => {
|
|||
}
|
||||
getTableData();
|
||||
};
|
||||
const auditData = (row) => {
|
||||
let id = row.id
|
||||
auditRef.value.openDialog([{ "id": id }]);
|
||||
}
|
||||
|
||||
//格式化字节
|
||||
const formatSize = (size) => {
|
||||
var data = "";
|
||||
|
@ -241,19 +238,7 @@ const tableClick = (i) => {
|
|||
state.disasterId = i.disasterId;
|
||||
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 = () => {
|
||||
|
@ -385,16 +370,7 @@ const delHotspot = (row) => {
|
|||
})
|
||||
.catch(() => { });
|
||||
};
|
||||
// 分页改变
|
||||
const onHandleDisasterSizeChange = (val) => {
|
||||
state.disasterData.param.pageSize = val;
|
||||
getDisasterData();
|
||||
};
|
||||
// 分页改变
|
||||
const onHandleDisasterCurrentChange = (val) => {
|
||||
state.disasterData.param.pageNum = val;
|
||||
getDisasterData();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const onHandleSizeChange = (val) => {
|
||||
state.tableData.param.pageSize = val;
|
||||
|
@ -407,8 +383,7 @@ const onHandleCurrentChange = (val) => {
|
|||
};
|
||||
// 页面加载时
|
||||
onMounted(() => {
|
||||
getDisasterData();
|
||||
//getTableData();
|
||||
getTableData();
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
|
|
Loading…
Reference in New Issue