glj-代码提交
This commit is contained in:
parent
5059788282
commit
89ca75b0be
|
@ -1,6 +1,6 @@
|
|||
import request from '/@/utils/request';
|
||||
|
||||
const moduleName = 'biz-vordm'
|
||||
const moduleName = 'biz-vordm-glj'
|
||||
|
||||
export const uploadFile = (row) => {
|
||||
return request({
|
||||
|
|
|
@ -61,7 +61,7 @@ export const update = (row) => {
|
|||
|
||||
export const getRole = (roleIds) => {
|
||||
return request({
|
||||
url: '/api/' + moduleName + '/ui/menu/role-tree-keys-new',
|
||||
url: '/api/' + moduleName + '/ui/menu/role-tree-keys',
|
||||
method: 'get',
|
||||
params: {
|
||||
roleIds,
|
||||
|
|
|
@ -2,7 +2,7 @@ import axios from 'axios';
|
|||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import qs from 'qs';
|
||||
import { Session } from '/@/utils/storage';
|
||||
export const moduleName = 'biz-vordm';
|
||||
export const moduleName = 'biz-vordm-glj';
|
||||
export const crawlModule = 'vordm-crawl';
|
||||
export const twitterModule = "vordm-twitter";
|
||||
const service = axios.create({
|
||||
|
|
|
@ -1,280 +0,0 @@
|
|||
<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" style="height: 85vh;">
|
||||
<disasterTable @childClick="tableClick"></disasterTable>
|
||||
</div>
|
||||
</el-col>
|
||||
<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-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="title" label="Name" width="120" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ formatName(scope.row.title) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="link" label="Link" width="450" 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>
|
||||
<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="3" :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"
|
||||
:total="state.tableData.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-config-provider>
|
||||
<Upload ref="uploadRef" @callback="getTableData" />
|
||||
<EditPicture ref="editUploadRef" @callback="getTableData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="systemRole">
|
||||
import type { TabsPaneContext } from 'element-plus';
|
||||
import Upload from './component/upload.vue';
|
||||
import EditPicture from './component/editPicture.vue';
|
||||
import { getDisasterPage } from '/@/api/data/pictureInfo.js';
|
||||
import { websitesPage, delWebsites } from '/@/api/websites/websites.js';
|
||||
import en from 'element-plus/dist/locale/en.mjs';
|
||||
const activeName = ref('first');
|
||||
import disasterTable from "/@/components/table/DisasterTable.vue";
|
||||
//复制内容
|
||||
import { defineAsyncComponent, reactive, onMounted, ref } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
// 引入组件
|
||||
const auditRef = ref();
|
||||
const uploadRef = ref();
|
||||
const editUploadRef = ref();
|
||||
// 定义变量内容
|
||||
const state = reactive({
|
||||
multipleSelection: [],
|
||||
tabVal: 'first',
|
||||
disasterId: null,
|
||||
disasterData: {
|
||||
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 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 = () => {
|
||||
state.tableData.loading = true;
|
||||
|
||||
websitesPage(state.tableData.param.pageNum, state.tableData.param.pageSize, { disasterId: state.disasterId}).then(
|
||||
(res) => {
|
||||
state.tableData.data = res.records;
|
||||
state.tableData.total = res.total;
|
||||
}
|
||||
);
|
||||
setTimeout(() => {
|
||||
state.tableData.loading = false;
|
||||
}, 500);
|
||||
};
|
||||
// 打开上传弹窗
|
||||
const uploadData = () => {
|
||||
if (state.disasterId == null) {
|
||||
ElMessage.warning('Please select the disaster first');
|
||||
return false;
|
||||
}
|
||||
uploadRef.value.openDialog(state.disasterId);
|
||||
};
|
||||
// 打开修改角色弹窗
|
||||
const editData = (row) => {
|
||||
editUploadRef.value.openDialog(row);
|
||||
};
|
||||
//批量删除图片数据
|
||||
const batchDel = () => {
|
||||
if (state.multipleSelection.length == 0) {
|
||||
ElMessage.warning('Select the data to be operated first');
|
||||
return false;
|
||||
}
|
||||
ElMessageBox.confirm(`This action batch deletes the data,Whether to continue?`, 'tip', {
|
||||
confirmButtonText: 'confirm',
|
||||
cancelButtonText: 'cancel',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
let id = state.multipleSelection.map((item) => item.id);
|
||||
delWebsites(id.join()).then((res) => {
|
||||
getTableData();
|
||||
ElMessage.success('delete successfully');
|
||||
});
|
||||
})
|
||||
.catch(() => { });
|
||||
};
|
||||
// 删除图片信息
|
||||
const del = (row) => {
|
||||
ElMessageBox.confirm(`This action will delete the picture:“${row.title}”,,Whether to continue?`, 'tip', {
|
||||
confirmButtonText: 'confirm',
|
||||
cancelButtonText: 'cancel',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
delWebsites(row.id).then((res) => {
|
||||
getTableData();
|
||||
ElMessage.success('delete successfully');
|
||||
});
|
||||
})
|
||||
.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;
|
||||
getTableData();
|
||||
};
|
||||
// 分页改变
|
||||
const onHandleCurrentChange = (val) => {
|
||||
state.tableData.param.pageNum = val;
|
||||
getTableData();
|
||||
};
|
||||
// 页面加载时
|
||||
onMounted(() => {
|
||||
getDisasterData();
|
||||
//getTableData();
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.mt15 {
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.demo-tabs>.el-tabs__content {
|
||||
padding: 32px;
|
||||
color: #6b778c;
|
||||
font-size: 32px;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
|
@ -58,7 +58,6 @@ import { addInstall } from '/@/api/install/install';
|
|||
import { Plus } from '@element-plus/icons-vue';
|
||||
import { uploadFile } from '/@/api/file/file';
|
||||
|
||||
const imageUrl = ref('');
|
||||
const roleRef = ref();
|
||||
// const menuTree = ref();
|
||||
const state = reactive({
|
||||
|
|
Loading…
Reference in New Issue