Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/views/Report/ReportManager.vue
This commit is contained in:
zer0Black
2023-02-28 22:43:30 +08:00
+224 -196
View File
@@ -341,10 +341,16 @@
</el-row>
</el-form-item>
<el-form-item label="权限:" required>
<el-select v-model="reportF.reportUserIdList" class="icon-auth" multiple collapse-tags
<el-select v-model="reportF.reportUserIdList"
class="icon-auth"
multiple
collapse-tags
@change="changeSelect"
@visible-change="changeSelect"
placeholder="请选择">
<el-checkbox class="check-all" v-model="checked" @change="selectAll">全选</el-checkbox>
<template v-for="item in userList">
<el-option :label="item.ACCOUNT" :value="item.USID" :key="item.USID"></el-option>
<el-option :label="item.USNAME" :value="item.USID" :key="item.USID"></el-option>
</template>
</el-select>
</el-form-item>
@@ -378,11 +384,11 @@
<script>
import {fileType} from '@/utils/fileType'
import { downloadFile } from '../../utils/downloadFile'
import {downloadFile} from "../../utils/downloadFile";
import {formatDate} from '@/utils/date'
export default {
name: 'ReportManager',
name: "ReportManager",
data() {
return {
watermarkText: '', // 水印
@@ -395,7 +401,7 @@ export default {
pageNo: 1,
pageSize: 10,
reportName: '', // 报告名称
startDate: '' // 开始时间
startDate: '', // 开始时间
},
qLogTotal: 0,
qLogDateRange: '', // 开始结束时间
@@ -430,7 +436,7 @@ export default {
childList: [
// {name: '无', type: '3', id: '', parentId: ''},
]
}
},
},
/* =============================================== 报告上传 =============================================== */
dialogReport: false, // 报告上传
@@ -448,7 +454,7 @@ export default {
labelTwoName: '', // 标签2
labelThreeId: '', // 标签3
labelThreeName: '', // 标签3
reportUserIdList: [] // 权限
reportUserIdList: [], // 权限
},
labelOne: {},
labelTwo: {},
@@ -457,8 +463,8 @@ export default {
userList: [],
pickerOptions: {
disabledDate(time) {
return time.getFullYear() > new Date().getFullYear() + 1 || time.getFullYear() < new Date().getFullYear() - 10
}
return time.getFullYear() > new Date().getFullYear() + 1 || time.getFullYear() < new Date().getFullYear() - 10;
},
},
/* =============================================== 列表展示 =============================================== */
q: {
@@ -468,100 +474,117 @@ export default {
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10
pageSize: 10,
},
total: 0,
tableData: [],
yearList: [],
dialogPreview: false,
content: ''
content: '',
/* 权限全选 */
checked: false,
mulSelecteds: [], // 已选中选项
}
},
methods: {
/* 权限全选 */
selectAll() {
this.reportF.reportUserIdList = [];
if (this.checked) {
this.userList.forEach((item) => { this.reportF.reportUserIdList.push(item.USID )});
} else {
this.reportF.reportUserIdList = [];
}
// this.$emit('update:updateMultipleSelect',this.reportF.reportUserIdList);
},
changeSelect(val) {
this.checked = (val.length || this.reportF.reportUserIdList.length) === this.userList.length;
// this.$emit('update:updateMultipleSelect',this.reportF.reportUserIdList);
},
init() {
this.labelList()
this.reset()
this.reportDateList()
this.sysUserList()
this.labelList();
this.reset();
this.reportDateList();
this.sysUserList();
},
/* =============================================== 操作日志 =============================================== */
// 操作日志
openLog() {
this.dialogLog = true
this.logReset()
this.dialogLog = true;
this.logReset();
},
// 日志重置搜索
logReset() {
this.qLogDateRange = ''
this.qLogDateRange = '';
this.qLog = {
doName: '', // 操作类型
endDate: '', // 结束时间
pageNo: 1,
pageSize: 10,
reportName: '', // 报告名称
startDate: '' // 开始时间
}
this.qLogTotal = 0
this.qLogDateRange = '' // 开始结束时间
this.logTableData = []
this.doNames = []
this.reportLogList()
startDate: '', // 开始时间
};
this.qLogTotal = 0;
this.qLogDateRange = ''; // 开始结束时间
this.logTableData = [];
this.doNames = [];
this.reportLogList();
},
// 搜索
searchLog() {
this.qLog.pageNo = 1
this.reportLogList()
this.qLog.pageNo = 1;
this.reportLogList();
},
// 报告列表
reportLogList() {
this.$api.report.reportLogList(this.qLog)
.then(({data}) => {
this.logTableData = data.records
this.qLogTotal = data.total
this.qLog.pageNo = data.current
this.qLog.pageSize = data.size
this.logTableData = data.records;
this.qLogTotal = data.total;
this.qLog.pageNo = data.current;
this.qLog.pageSize = data.size;
if (!data.records.length && this.qLog.pageNo !== 1) {
this.qLog.pageNo = 1
this.reportLogList()
this.qLog.pageNo = 1;
this.reportLogList();
}
})
},
// 单页数据量
handleLogSizeChange(val) {
this.qLog.pageSize = val
this.qLog.pageNo = 1
this.reportLogList()
this.qLog.pageSize = val;
this.qLog.pageNo = 1;
this.reportLogList();
},
// 第几页
handleLogCurrentChange(val) {
this.qLog.pageNo = val
this.reportLogList()
this.qLog.pageNo = val;
this.reportLogList();
},
// 日期
handleLogDate(val) {
if (val) {
this.qLog.startDate = val[0]
this.qLog.endDate = val[1]
this.qLog.startDate = val[0];
this.qLog.endDate = val[1];
} else {
this.qLog.startDate = ''
this.qLog.endDate = ''
this.qLog.startDate = '';
this.qLog.endDate = '';
}
},
handleTyleChange(val){
this.qLog.doName = val.join(',')
this.qLog.doName = val.join(',');
},
/* =============================================== 标签维护 =============================================== */
// 标签维护 新增
addTag(index, type) {
if (this.tagsForm['tags0' + type].childList.length >= 20) {
return this.$message.warning('最多添加20个标签')
return this.$message.warning("最多添加20个标签");
}
const itemData = { name: '', id: '', parentId: this.tagsForm['tags0' + type].id, type: String(type) }
this.tagsForm['tags0' + type].childList.splice(index + 1, 0, itemData)
let itemData = {name: '', id: "", parentId: this.tagsForm['tags0' + type].id, type: String(type)};
this.tagsForm['tags0' + type].childList.splice(index + 1, 0, itemData);
},
// 标签维护 删除
delTag(index, type) {
const { id, status } = this.tagsForm['tags0' + type].childList[index]
let {id, status} = this.tagsForm['tags0' + type].childList[index];
if(status === '1'){
this.$confirm('此标签已应用于报告, 是否删除?', '提示', {
confirmButtonText: '确定',
@@ -570,23 +593,23 @@ export default {
}).then(() => {
if (id) {
this.$api.report.labelDeleteId({id}).then(_ => {
this.$message.success('操作成功')
this.labelList()
this.$message.success('操作成功');
this.labelList();
})
} else {
this.tagsForm['tags0' + type].childList.splice(index, 1)
this.$message.success('操作成功')
this.tagsForm['tags0' + type].childList.splice(index, 1);
this.$message.success('操作成功');
}
})
}else{
if (id) {
this.$api.report.labelDeleteId({id}).then(_ => {
this.$message.success('操作成功')
this.labelList()
this.$message.success('操作成功');
this.labelList();
})
} else {
this.tagsForm['tags0' + type].childList.splice(index, 1)
this.$message.success('操作成功')
this.tagsForm['tags0' + type].childList.splice(index, 1);
this.$message.success('操作成功');
}
}
},
@@ -597,7 +620,7 @@ export default {
moveType: 'up',
type: String(type)
}).then(_=>{
this.labelList()
this.labelList();
})
},
// 下移
@@ -607,32 +630,32 @@ export default {
moveType: 'down',
type: String(type)
}).then(_=>{
this.labelList()
this.labelList();
})
},
// 标签维护
openTags() {
this.dialogTags = true
this.labelList()
this.dialogTags = true;
this.labelList();
},
// 单个标签保存
handleSaveTag(val, item, type) {
if(val === ''){
this.$message.warning('标签名称不能为空')
this.labelList()
return
this.$message.warning('标签名称不能为空');
this.labelList();
return;
}
if(val === '-'){
this.$message.warning('标签名称不能为-')
this.labelList()
return
this.$message.warning('标签名称不能为-');
this.labelList();
return;
}
if(this.tagsForm['tags0' + type].childList.filter(item => item.name === val).length > 1){
this.$message.warning('标签名称不能重复')
this.labelList()
return
this.$message.warning('标签名称不能重复');
this.labelList();
return;
}
const params = { name: val, parentId: this.tagsForm['tags0' + type].id, type: String(type), id: item.id || '' }
let params = {name: val, parentId: this.tagsForm['tags0' + type].id, type: String(type), id: item.id || ''}
if(item.status === '1'){
this.$confirm('此标签已应用于报告, 是否编辑?', '提示', {
confirmButtonText: '确定',
@@ -640,56 +663,56 @@ export default {
type: 'warning'
}).then(() => {
this.$api.report.labelAdd(params).then(_ => {
this.$message.success('操作成功')
this.labelList()
this.$message.success('操作成功');
this.labelList();
}).catch(_ => {
this.labelList()
this.labelList();
})
}).catch(_=>{
this.labelList()
this.labelList();
})
}else{
this.$api.report.labelAdd(params).then(_ => {
this.$message.success('操作成功')
this.labelList()
this.$message.success('操作成功');
this.labelList();
}).catch(_ => {
this.labelList()
this.labelList();
})
}
},
// 单个顶级标签保存
handleSaveTopTag(val, type) {
if(val === ''){
this.$message.warning('标签名称不能为空')
this.labelList()
return
this.$message.warning('标签名称不能为空');
this.labelList();
return;
}
if(val === '-'){
this.$message.warning('标签名称不能为-')
this.labelList()
return
this.$message.warning('标签名称不能为-');
this.labelList();
return;
}
if(type === 1 && (val === this.tagsForm.tags02.name || val === this.tagsForm.tags03.name)){
this.$message.warning('标签名称不能重复')
this.labelList()
return
this.$message.warning('标签名称不能重复');
this.labelList();
return;
}
if(type === 2 && (val === this.tagsForm.tags01.name || val === this.tagsForm.tags03.name)){
this.$message.warning('标签名称不能重复')
this.labelList()
return
this.$message.warning('标签名称不能重复');
this.labelList();
return;
}
if(type === 3 && (val === this.tagsForm.tags01.name || val === this.tagsForm.tags02.name)){
this.$message.warning('标签名称不能重复')
this.labelList()
return
this.$message.warning('标签名称不能重复');
this.labelList();
return;
}
const params = { name: val, id: this.tagsForm['tags0' + type].id, parentId: '0', type: String(type) }
let params = {name: val, id: this.tagsForm['tags0' + type].id, parentId: '0', type: String(type)};
this.$api.report.labelAdd(params).then(_ => {
this.$message.success('操作成功')
this.labelList()
this.$message.success('操作成功');
this.labelList();
}).catch(_ => {
this.labelList()
this.labelList();
})
},
// 标签列表
@@ -704,52 +727,53 @@ export default {
if(!data.labelThree.childList.length){
data.labelThree.childList = [{name: '', id: '', parentId: this.tagsForm.tags03.id, type: '3'}]
}
this.tagsForm.tags01 = data.labelOne
this.tagsForm.tags02 = data.labelTwo
this.tagsForm.tags03 = data.labelThree
this.tagsForm.tags01 = data.labelOne;
this.tagsForm.tags02 = data.labelTwo;
this.tagsForm.tags03 = data.labelThree;
})
},
handleTagsClose(){
this.dialogTags = false
this.labelList()
this.reset()
this.dialogTags = false;
this.labelList();
this.reset();
},
// 保存标签
saveTags() {
const tagsForm = JSON.parse(JSON.stringify(this.tagsForm))
const params = {
let tagsForm = JSON.parse(JSON.stringify(this.tagsForm));
let params = {
labelList: [
tagsForm.tags01,
tagsForm.tags02,
tagsForm.tags03
]
}
let isSave = true
let isSave = true;
params.labelList.forEach(item => {
if(!item.name || item.name === '-'){
isSave = false
isSave = false;
return
}
item.childList.forEach(ele => {
if(!ele.name || item.name === '-'){
isSave = false
isSave = false;
return
}
})
})
if(!isSave){
return this.$message.warning('标签名称不能为空')
return this.$message.warning('标签名称不能为空');
}
this.$api.report.labelSave(params).then(_ => {
this.$message.success('操作成功')
this.dialogTags = false
this.labelList()
this.reset()
this.$message.success('操作成功');
this.dialogTags = false;
this.labelList();
this.reset();
})
},
/* =============================================== 报告上传 =============================================== */
// 打开报告上传
openReportAdd() {
this.mode = 'add'
this.mode = 'add';
this.reportF = {
name: '', // 报告名称
keyContent: '', // 关键词
@@ -764,122 +788,122 @@ export default {
labelTwoName: '', // 标签2
labelThreeId: '', // 标签3
labelThreeName: '', // 标签3
reportUserIdList: [] // 权限
}
this.labelOne = {}
this.labelTwo = {}
this.labelThree = {}
this.labelList()
this.dialogReport = true
reportUserIdList: [], // 权限
};
this.labelOne = {};
this.labelTwo = {};
this.labelThree = {};
this.labelList();
this.dialogReport = true;
},
// 选择标签
handleSelectTag(val, type) {
switch (type) {
case 1:
this.reportF.labelOneId = val.id
this.reportF.labelOneName = val.name
break
this.reportF.labelOneId = val.id;
this.reportF.labelOneName = val.name;
break;
case 2:
this.reportF.labelTwoId = val.id
this.reportF.labelTwoName = val.name
break
this.reportF.labelTwoId = val.id;
this.reportF.labelTwoName = val.name;
break;
case 3:
this.reportF.labelThreeId = val.id
this.reportF.labelThreeName = val.name
break
this.reportF.labelThreeId = val.id;
this.reportF.labelThreeName = val.name;
break;
}
},
// 必填项
checkReportF() {
if (!this.reportF.name) {
return this.$message.warning('请检查报告名称') && false
return this.$message.warning('请检查报告名称') && false;
}
if (!this.reportF.fileId || !this.reportF.fileName) {
return this.$message.warning('请检查上传文件') && false
return this.$message.warning('请检查上传文件') && false;
}
if (!this.reportF.year) {
return this.$message.warning('请检查报告年份') && false
return this.$message.warning('请检查报告年份') && false;
}
if (!this.reportF.labelOneId || !this.reportF.labelOneName || this.reportF.labelOneName === '-' ) {
return this.$message.warning(`请检查${this.tagsForm.tags01.name}`) && false
return this.$message.warning(`请检查${this.tagsForm.tags01.name}`) && false;
}
if (!this.reportF.labelTwoId || !this.reportF.labelTwoName || this.reportF.labelTwoName === '-') {
return this.$message.warning(`请检查${this.tagsForm.tags02.name}`) && false
return this.$message.warning(`请检查${this.tagsForm.tags02.name}`) && false;
}
if (!this.reportF.labelThreeId || !this.reportF.labelThreeName || this.reportF.labelThreeName === '-') {
return this.$message.warning(`请检查${this.tagsForm.tags03.name}`) && false
return this.$message.warning(`请检查${this.tagsForm.tags03.name}`) && false;
}
if (!this.reportF.reportUserIdList || !this.reportF.reportUserIdList.length) {
return this.$message.warning('请检查权限') && false
return this.$message.warning('请检查权限') && false;
}
return true
return true;
},
// 新增或编辑报告
reportAdd() {
if (!this.checkReportF()) return
if (!this.checkReportF()) return;
this.$api.report.reportAdd(this.reportF).then(_ => {
this.$message.success('操作成功')
this.dialogReport = false
this.reset()
this.$message.success('操作成功');
this.dialogReport = false;
this.reset();
})
},
// 上传文件
uploadFile(params) {
const fd = new FormData()
fd.append('file', params.file)
let fd = new FormData();
fd.append('file', params.file);
this.$api.report.reportUploadFile(fd).then(({data}) => {
this.reportF.fileName = data.name
this.reportF.fileId = data.key
this.reportF.fileName = data.name;
this.reportF.fileId = data.key;
})
},
// 上传文件前
beforeUploadFile(file) {
const realFileType = file.name.split('.')[file.name.split('.').length - 1]
let realFileType = file.name.split('.')[file.name.split('.').length - 1];
const isType = (
file.type === fileType.pdf || file.type === fileType.xls || file.type === fileType.xlsx || file.type === fileType.doc || file.type === fileType.docx || file.type === fileType.ppt || file.type === fileType.pptx ||
realFileType === 'pdf' || realFileType === 'xls' || realFileType === 'xlsx' || realFileType === 'doc' || realFileType === 'docx' || realFileType === 'ppt' || realFileType === 'pptx'
)
const isSize = file.size / 1024 / 1024 < 200
file.type === fileType.pdf || file.type === fileType.xls || file.type === fileType.xlsx || file.type === fileType.doc || file.type === fileType.docx || file.type === fileType.ppt || file.type === fileType.pptx
|| realFileType === 'pdf' || realFileType === 'xls' || realFileType === 'xlsx' || realFileType === 'doc' || realFileType === 'docx' || realFileType === 'ppt' || realFileType === 'pptx'
);
const isSize = file.size / 1024 / 1024 < 200;
if (!isType) {
this.$message.error('仅能上传 pdf|xls|xlsx|doc|docx|ppt|pptx 格式文件')
this.$message.error('仅能上传 pdf|xls|xlsx|doc|docx|ppt|pptx 格式文件');
}
if (!isSize) {
this.$message.error('您最大可上传200M文件')
this.$message.error('您最大可上传200M文件');
}
return isType && isSize
return isType && isSize;
},
// 重置
resetUploadFile() {
this.reportF.fileId = ''
this.reportF.fileName = ''
this.reportF.fileId = '';
this.reportF.fileName = '';
},
// 打开报告上传
openReportModify(mode, row) {
this.mode = mode
this.labelList()
const rowData = JSON.parse(JSON.stringify(row))
this.mode = mode;
this.labelList();
let rowData = JSON.parse(JSON.stringify(row));
if(rowData.labelOneName !== '-'){
this.labelOne = { id: rowData.labelOneId, rowData: rowData.labelOneName }
this.labelOne = {id: rowData.labelOneId, rowData: rowData.labelOneName};
}else{
this.labelOne = {}
this.labelOne = {};
}
if(rowData.labelTwoName !== '-'){
this.labelTwo = { id: rowData.labelTwoId, name: rowData.labelTwoName }
this.labelTwo = {id: rowData.labelTwoId, name: rowData.labelTwoName};
}else{
this.labelTwo = {}
this.labelTwo = {};
}
if(rowData.labelThreeName !== '-'){
this.labelThree = { id: rowData.labelThreeId, name: rowData.labelThreeName }
this.labelThree = {id: rowData.labelThreeId, name: rowData.labelThreeName};
}else{
this.labelThree = {}
this.labelThree = {};
}
this.reportF = rowData
this.dialogReport = true
this.reportF = rowData;
this.dialogReport = true;
},
// 获取所有用户
sysUserList() {
this.$api.user.sysUserList({pageNo: 1, pageSize: 999999}).then(({data}) => {
this.userList = data.records
this.userList = data.records;
})
},
/* =============================================== 列表展示 =============================================== */
@@ -892,12 +916,12 @@ export default {
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10
}
this.total = 0
this.tableData = []
this.reportList()
this.reportDateList()
pageSize: 10,
};
this.total = 0;
this.tableData = [];
this.reportList();
this.reportDateList();
},
// 报告删除
reportDelete(ids) {
@@ -907,54 +931,54 @@ export default {
type: 'warning'
}).then(() => {
this.$api.report.reportDelete({ids}).then(_ => {
this.$message.success('操作成功')
this.reportList()
this.reportDateList()
this.$message.success('操作成功');
this.reportList();
this.reportDateList();
})
})
},
search() {
this.q.pageNo = 1
this.reportList()
this.q.pageNo = 1;
this.reportList();
},
// 列表
reportList() {
this.$api.report.reportList(this.q).then(({data}) => {
this.tableData = data.records
this.total = data.total
this.q.pageNo = data.current
this.q.pageSize = data.size
this.tableData = data.records;
this.total = data.total;
this.q.pageNo = data.current;
this.q.pageSize = data.size;
if (!data.records.length && this.q.pageNo !== 1) {
this.q.pageNo = 1
this.reportList()
this.q.pageNo = 1;
this.reportList();
}
})
},
// 日期列表
reportDateList() {
this.$api.report.reportDateList().then(({data}) => {
this.yearList = data.list
this.yearList = data.list;
})
},
// 单页数据量
handleSizeChange(val) {
this.q.pageSize = val
this.q.pageNo = 1
this.reportList()
this.q.pageSize = val;
this.q.pageNo = 1;
this.reportList();
},
// 第几页
handleCurrentChange(val) {
this.q.pageNo = val
this.reportList()
this.q.pageNo = val;
this.reportList();
},
// 预览
previewRow(row) {
this.fullscreen = false
this.fullscreen = false;
// 更新预览水印的时间戳
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`
this.watermarkText = `${this.$store.state.userInfo.usname} ${formatDate(+new Date(), 'yyyy年MM月dd日 hh:mm:ss')}`;
this.$api.report.reportGetReportHtmlId({id: row.id}).then(({data}) => {
this.content = data.content
this.dialogPreview = true
this.content = data.content;
this.dialogPreview = true;
})
},
// 下载
@@ -965,18 +989,22 @@ export default {
// type: 'warning'
// }).then(() => {
this.$api.report.reportDownload({fileId: row.fileId}).then(res => {
downloadFile(res)
downloadFile(res);
})
// })
}
},
},
created() {
this.init()
this.init();
}
}
</script>
<style lang="scss" scoped>
.check-all {
text-align: right;
width: 95%;
}
.report-manager {
.title {
border-bottom: 1px solid #EBEEF5;