glj-代码提交

This commit is contained in:
管李杰 2024-07-09 11:47:18 +08:00
parent 5059788282
commit 89ca75b0be
5 changed files with 3 additions and 284 deletions

View File

@ -1,6 +1,6 @@
import request from '/@/utils/request';
const moduleName = 'biz-vordm'
const moduleName = 'biz-vordm-glj'
export const uploadFile = (row) => {
return request({

View File

@ -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,

View File

@ -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({

View File

@ -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.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) => {
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 dataWhether 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>

View File

@ -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({