调整前端代码格式符合ESLint规范

This commit is contained in:
zer0Black
2023-02-28 22:43:03 +08:00
parent f5e5990a3b
commit 77b1ca8f0d
48 changed files with 3199 additions and 3179 deletions
+170 -170
View File
@@ -163,180 +163,180 @@
</template>
<script>
import {downloadFile} from "@/utils/downloadFile";
import {formatDate} from '@/utils/date'
import { downloadFile } from '@/utils/downloadFile'
import { formatDate } from '@/utils/date'
export default {
name: "ReportList",
data() {
return {
watermarkText: '', // 水印
fullscreen: false,
q: {
keyContent: '',
year: [],
labelOneId: [],
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10,
},
total: 0,
tableData: [],
yearList: [],
tagData: {
1: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false,
},
2: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false,
},
3: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false,
},
},
dialogPreview: false, // 预览
content: '',
name: 'ReportList',
data () {
return {
watermarkText: '', // 水印
fullscreen: false,
q: {
keyContent: '',
year: [],
labelOneId: [],
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10
},
total: 0,
tableData: [],
yearList: [],
tagData: {
1: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false
},
2: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false
},
3: {
name: '',
tagShow: false,
tags: [],
isIndeterminate: true,
checkAll: false
}
},
methods: {
init() {
this.labelList();
this.reportDateList();
this.reportList();
},
// 标签列表
labelList() {
this.$api.report.labelList().then(({data}) => {
this.tagData[1].name = data.labelOne.name;
this.tagData[2].name = data.labelTwo.name;
this.tagData[3].name = data.labelThree.name;
this.tagData[1].tags = data.labelOne.childList;
this.tagData[2].tags = data.labelTwo.childList;
this.tagData[3].tags = data.labelThree.childList;
})
},
search(){
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;
if(!data.records.length && this.q.pageNo !== 1){
this.q.pageNo = 1;
this.reportList();
}
})
},
// 监听全选按钮
handleCheckAllChange(val, type) {
switch (type) {
case 1:
this.q.labelOneId = val ? this.tagData[type].tags.map(item => item.id) : [];
break;
case 2:
this.q.labelTwoId = val ? this.tagData[type].tags.map(item => item.id) : [];
break;
case 3:
this.q.labelThreeId = val ? this.tagData[type].tags.map(item => item.id) : [];
break;
}
this.tagData[type].isIndeterminate = !val;
},
// 监听group checkbox
handleCheckedTagsChange(val, type) {
this.tagData[type].checkAll = (val.length === this.tagData[type].tags.length);
this.tagData[type].isIndeterminate = val.length < this.tagData[type].tags.length;
},
// 切换展开隐藏
switchTagShow(type) {
this.tagData[type].tagShow = !this.tagData[type].tagShow;
},
// 日期列表
reportDateList() {
this.$api.report.reportDateList().then(({data}) => {
this.yearList = data.list;
})
},
// 单页数据量
handleSizeChange(val) {
this.q.pageSize = val;
this.q.pageNo = 1;
this.reportList();
},
// 第几页
handleCurrentChange(val) {
this.q.pageNo = val;
this.reportList();
},
// 预览
previewRow(row) {
this.fullscreen = false;
// 更新预览水印的时间戳
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;
})
},
// 重置
reset() {
this.q = {
keyContent: '',
year: [],
labelOneId: [],
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10,
};
this.total = 0;
this.tableData = [];
this.tagData[1].checkAll = false;
this.tagData[1].isIndeterminate = true;
this.tagData[2].checkAll = false;
this.tagData[2].isIndeterminate = true;
this.tagData[3].checkAll = false;
this.tagData[3].isIndeterminate = true;
this.reportList();
},
// 下载
downloadRow(row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
this.$api.report.reportDownload({fileId: row.fileId}).then(res => {
downloadFile(res);
})
// })
},
// 跳转到详情
goReportDetail(row) {
this.$router.push({path: '/report/detail', query: {id: this.$route.query.id, row: JSON.stringify(row)}});
}
},
created() {
this.init();
},
dialogPreview: false, // 预览
content: ''
}
},
methods: {
init () {
this.labelList()
this.reportDateList()
this.reportList()
},
// 标签列表
labelList () {
this.$api.report.labelList().then(({ data }) => {
this.tagData[1].name = data.labelOne.name
this.tagData[2].name = data.labelTwo.name
this.tagData[3].name = data.labelThree.name
this.tagData[1].tags = data.labelOne.childList
this.tagData[2].tags = data.labelTwo.childList
this.tagData[3].tags = data.labelThree.childList
})
},
search () {
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
if (!data.records.length && this.q.pageNo !== 1) {
this.q.pageNo = 1
this.reportList()
}
})
},
// 监听全选按钮
handleCheckAllChange (val, type) {
switch (type) {
case 1:
this.q.labelOneId = val ? this.tagData[type].tags.map(item => item.id) : []
break
case 2:
this.q.labelTwoId = val ? this.tagData[type].tags.map(item => item.id) : []
break
case 3:
this.q.labelThreeId = val ? this.tagData[type].tags.map(item => item.id) : []
break
}
this.tagData[type].isIndeterminate = !val
},
// 监听group checkbox
handleCheckedTagsChange (val, type) {
this.tagData[type].checkAll = (val.length === this.tagData[type].tags.length)
this.tagData[type].isIndeterminate = val.length < this.tagData[type].tags.length
},
// 切换展开隐藏
switchTagShow (type) {
this.tagData[type].tagShow = !this.tagData[type].tagShow
},
// 日期列表
reportDateList () {
this.$api.report.reportDateList().then(({ data }) => {
this.yearList = data.list
})
},
// 单页数据量
handleSizeChange (val) {
this.q.pageSize = val
this.q.pageNo = 1
this.reportList()
},
// 第几页
handleCurrentChange (val) {
this.q.pageNo = val
this.reportList()
},
// 预览
previewRow (row) {
this.fullscreen = false
// 更新预览水印的时间戳
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
})
},
// 重置
reset () {
this.q = {
keyContent: '',
year: [],
labelOneId: [],
labelTwoId: [],
labelThreeId: [],
pageNo: 1,
pageSize: 10
}
this.total = 0
this.tableData = []
this.tagData[1].checkAll = false
this.tagData[1].isIndeterminate = true
this.tagData[2].checkAll = false
this.tagData[2].isIndeterminate = true
this.tagData[3].checkAll = false
this.tagData[3].isIndeterminate = true
this.reportList()
},
// 下载
downloadRow (row) {
// this.$confirm('此操作将下载所选数据文件, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
this.$api.report.reportDownload({ fileId: row.fileId }).then(res => {
downloadFile(res)
})
// })
},
// 跳转到详情
goReportDetail (row) {
this.$router.push({ path: '/report/detail', query: { id: this.$route.query.id, row: JSON.stringify(row) } })
}
},
created () {
this.init()
}
}
</script>