报表模块
This commit is contained in:
@@ -223,6 +223,14 @@ export function getEqCode(data) {
|
||||
}
|
||||
|
||||
// 报表管理
|
||||
export function getReportCategorylist(data) {
|
||||
return request({
|
||||
url: '/report/report-sheet-category/list',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getReportlist(data) {
|
||||
return request({
|
||||
url: '/report/report-sheet/page',
|
||||
@@ -254,3 +262,43 @@ export function getReport(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
// 报表管理--报表分类
|
||||
export function getReportCategory(data) {
|
||||
return request({
|
||||
url: '/report/report-sheet-category/page',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function reportCategoryAdd(data) {
|
||||
return request({
|
||||
url: '/report/report-sheet-category/add',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function reportCategoryUpdate(data) {
|
||||
return request({
|
||||
url: '/report/report-sheet-category/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getReportCategoryById(data) {
|
||||
return request({
|
||||
url: '/report/report-sheet-category/get',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function reportCategoryDelete(data) {
|
||||
return request({
|
||||
url: '/report/report-sheet-category/delete',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
56
src/views/basicConfig/components/categorySelect.vue
Normal file
56
src/views/basicConfig/components/categorySelect.vue
Normal file
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-select
|
||||
v-model="categoryId"
|
||||
placeholder="请选择"
|
||||
@change="changeCategory"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in list"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'categorySelect',
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
categoryId: '',
|
||||
list: JSON.parse(localStorage.getItem('reportCategory'))
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.categoryId = this.injectData.category
|
||||
},
|
||||
changeCategory() {
|
||||
this.$emit('emitData', {
|
||||
categoryId: this.categoryId,
|
||||
injectData: this.injectData
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
injectData(newVal, oldVal) {
|
||||
if (oldVal.enabled !== newVal.enabled) {
|
||||
this.init()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -6,6 +6,11 @@
|
||||
</el-form>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
reportCategoryAdd,
|
||||
reportCategoryUpdate,
|
||||
getReportCategoryById
|
||||
} from '@/api/basicConfig'
|
||||
export default {
|
||||
name: 'ReportClassAdd',
|
||||
data() {
|
||||
@@ -25,16 +30,11 @@ export default {
|
||||
if (id) {
|
||||
this.isEdit = true
|
||||
this.form.id = id
|
||||
// getAccount({ id }).then((res) => {
|
||||
// if (res.code === 0) {
|
||||
// this.form.account = res.data.account
|
||||
// this.form.password = res.data.password
|
||||
// this.form.name = res.data.name
|
||||
// this.form.proLineId = res.data.proLineId
|
||||
// this.form.role = res.data.role
|
||||
// this.form.enabled = res.data.enabled
|
||||
// }
|
||||
// })
|
||||
getReportCategoryById({ id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.form.name = res.data.name
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.isEdit = false
|
||||
this.form.id = ''
|
||||
@@ -45,28 +45,29 @@ export default {
|
||||
if (valid) {
|
||||
if (this.isEdit) {
|
||||
//编辑
|
||||
// accountUpdate({ ...this.form }).then((res) => {
|
||||
// if (res.code === 0) {
|
||||
// this.$message({
|
||||
// message: '操作成功',
|
||||
// type: 'success',
|
||||
// duration: 1500
|
||||
// })
|
||||
// this.$emit('successSubmit')
|
||||
// }
|
||||
// })
|
||||
reportCategoryUpdate({ ...this.form }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
this.$emit('successSubmit')
|
||||
}
|
||||
})
|
||||
this.$emit('successSubmit')
|
||||
} else {
|
||||
// addAccount({ ...this.form }).then((res) => {
|
||||
// if (res.code === 0) {
|
||||
// this.$message({
|
||||
// message: '操作成功',
|
||||
// type: 'success',
|
||||
// duration: 1500
|
||||
// })
|
||||
// this.$emit('successSubmit')
|
||||
// }
|
||||
// })
|
||||
console.log(this.form)
|
||||
reportCategoryAdd({ ...this.form }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
this.$emit('successSubmit')
|
||||
}
|
||||
})
|
||||
this.$emit('successSubmit')
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,21 +1,7 @@
|
||||
<template>
|
||||
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
|
||||
<el-form-item label="报表名称" prop="name">
|
||||
<el-input v-model="form.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="报表分类" prop="category">
|
||||
<el-select
|
||||
v-model="form.category"
|
||||
placeholder="报表分类"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, i) in typeList"
|
||||
:key="i"
|
||||
:label="item.dataName"
|
||||
:value="item.dataName"
|
||||
></el-option>
|
||||
</el-select>
|
||||
<el-form-item label="报表名称" prop="fileName">
|
||||
<el-input v-model="form.fileName"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
@@ -27,18 +13,12 @@ export default {
|
||||
return {
|
||||
form: {
|
||||
id: '',
|
||||
name: '',
|
||||
category: ''
|
||||
fileName: ''
|
||||
},
|
||||
typeList: [
|
||||
{ dataName: '能源', id: 1 },
|
||||
{ dataName: '订单', id: 2 },
|
||||
{ dataName: '设备', id: 3 },
|
||||
{ dataName: '人员', id: 4 }
|
||||
],
|
||||
rules: {
|
||||
name: [{ required: true, message: '请输入报表分类名', trigger: 'blur' }]
|
||||
// category: [{ required: true, message: '请选择分类', trigger: 'change' }]
|
||||
fileName: [
|
||||
{ required: true, message: '请输入报表分类名', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -48,8 +28,7 @@ export default {
|
||||
this.form.id = id
|
||||
getReport({ id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.form.category = res.data.category
|
||||
this.form.name = res.data.name
|
||||
this.form.fileName = res.data.fileName
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<script>
|
||||
import { tableHeight } from '@/utils/index'
|
||||
import ReportClassAdd from './../components/reportClassAdd.vue'
|
||||
import { getReportCategory, reportCategoryDelete } from '@/api/basicConfig'
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'name',
|
||||
@@ -95,7 +96,8 @@ export default {
|
||||
total: 0,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 20
|
||||
size: 20,
|
||||
name: ''
|
||||
},
|
||||
centervisible: false,
|
||||
addOrEditTitle: '' //新增编辑弹出框的title
|
||||
@@ -109,18 +111,17 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
let arr = []
|
||||
for (let i = 0; i < 30; i++) {
|
||||
let obj = {}
|
||||
obj.name = '分类名' + i
|
||||
obj.id = i + 1
|
||||
arr.push(obj)
|
||||
}
|
||||
this.tableData = arr
|
||||
this.total = 30
|
||||
getReportCategory({ ...this.listQuery }).then((res) => {
|
||||
if (res.code === 0 && res.data) {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
} else {
|
||||
this.tableData = []
|
||||
this.total = 0
|
||||
}
|
||||
})
|
||||
},
|
||||
handleClick(val) {
|
||||
console.log(val)
|
||||
if (val.type === 'edit') {
|
||||
this.addOrEditTitle = '编辑'
|
||||
this.$nextTick(() => {
|
||||
@@ -132,17 +133,16 @@ export default {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
// maintainManageDelete({ id: val.data.id }).then((res) => {
|
||||
// console.log(res)
|
||||
// this.$message({
|
||||
// message: '工单删除成功',
|
||||
// type: 'success',
|
||||
// duration: 1500,
|
||||
// onClose: () => {}
|
||||
// })
|
||||
// this.listQuery.current = 1
|
||||
// this.getList()
|
||||
// })
|
||||
reportCategoryDelete({ id: val.data.id }).then(() => {
|
||||
this.$message({
|
||||
message: '工单删除成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {}
|
||||
})
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
const vm = this
|
||||
const { name } = this.$route.query
|
||||
this.url += name ? '?_u=db:' + this.$route.query.name : ''
|
||||
const { name } = this.$route.params
|
||||
this.url += name ? '?_u=db:' + this.$route.params.name : ''
|
||||
const ifream = document.getElementById('reportDesign')
|
||||
ifream.onload = function () {
|
||||
console.log('加载完成')
|
||||
|
||||
@@ -12,57 +12,63 @@
|
||||
<div class="numBox">
|
||||
<div>
|
||||
<div class="reportNum">
|
||||
<div class="num">6</div>
|
||||
<div class="num">{{ totalReports }}</div>
|
||||
<div class="text">
|
||||
<p class="font">全部报表</p>
|
||||
<p class="letter">Reports</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail" @click="toAll">了解详情</div>
|
||||
<div class="detail" @click="toDetail()">了解详情</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="reportDesc" v-for="(item, i) in reportList" :key="i">
|
||||
<div>
|
||||
<div class="reportNum">
|
||||
<div class="num">{{ item.num }}</div>
|
||||
<div class="num">{{ item.quantity }}</div>
|
||||
<div class="text">
|
||||
<p class="font">{{ item.name }}</p>
|
||||
<p class="letter">Reports</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail" @click="toDetail">了解详情</div>
|
||||
<div class="detail" @click="toDetail(item.id)">了解详情</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getReportCategorylist } from '@/api/basicConfig'
|
||||
export default {
|
||||
name: 'ReportList',
|
||||
data() {
|
||||
return {
|
||||
totalReports: 6,
|
||||
reportList: [
|
||||
{ num: 2, name: '能源报表' },
|
||||
{ num: 2, name: '订单报表' },
|
||||
{ num: 1, name: '设备报表' },
|
||||
{ num: 1, name: '人员报表' },
|
||||
{ num: 1, name: '质量报表' },
|
||||
{ num: 0, name: '产线报表' }
|
||||
]
|
||||
totalReports: 0,
|
||||
reportList: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
toAll() {
|
||||
this.$router.push({
|
||||
path: '/basicConfig/reportManagement/reportListDetail'
|
||||
getList() {
|
||||
getReportCategorylist({}).then((res) => {
|
||||
if (res.code === 0 && res.data.length > 0) {
|
||||
this.totalReports = 0
|
||||
for (let i = 0; i < res.data.length; i++) {
|
||||
this.totalReports += res.data[i].quantity
|
||||
}
|
||||
this.reportList = res.data
|
||||
} else {
|
||||
this.totalReports = 0
|
||||
this.reportList = []
|
||||
}
|
||||
})
|
||||
},
|
||||
toDetail(name) {
|
||||
// this.$router.push({ path: '/basicConfig/reportManagement/reportDesign' })
|
||||
toDetail(id) {
|
||||
this.$router.push({
|
||||
path: '/basicConfig/reportManagement/reportListDetail',
|
||||
params: { category: name }
|
||||
// path: '/basicConfig/reportManagement/reportListDetail',
|
||||
name: 'reportListDetail',
|
||||
params: { categoryId: id ? id : '' }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
:table-props="tableProps"
|
||||
:table-data="tableData"
|
||||
:max-height="tableH"
|
||||
@emitFun="categoryChange"
|
||||
>
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
@@ -41,16 +42,23 @@
|
||||
</template>
|
||||
<script>
|
||||
import ReportNameEdit from './../components/reportNameEdit.vue'
|
||||
import { getReportlist, delReportlist } from '@/api/basicConfig'
|
||||
import {
|
||||
getReportlist,
|
||||
delReportlist,
|
||||
getReportCategorylist,
|
||||
updateReportlist
|
||||
} from '@/api/basicConfig'
|
||||
import { tableHeight, timeFormatter } from '@/utils'
|
||||
import categorySelect from './../components/categorySelect.vue'
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'name',
|
||||
prop: 'fileName',
|
||||
label: '报表名称'
|
||||
},
|
||||
{
|
||||
prop: 'category',
|
||||
label: '报表分类'
|
||||
label: '报表分类',
|
||||
subcomponent: categorySelect
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
@@ -87,7 +95,17 @@ export default {
|
||||
label: '关键字',
|
||||
placeholder: '报表名称',
|
||||
param: 'name',
|
||||
width: 300
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
label: '报表分类',
|
||||
selectOptions: [],
|
||||
param: 'category',
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
defaultSelect: '',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
@@ -113,22 +131,29 @@ export default {
|
||||
total: 0,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 20
|
||||
size: 20,
|
||||
name: '',
|
||||
category: ''
|
||||
},
|
||||
typeList: [],
|
||||
centervisible: false,
|
||||
addOrEditTitle: '' //新增编辑弹出框的title
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getCategorylist()
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.tableH = tableHeight(265)
|
||||
})
|
||||
this.formConfig[1].defaultSelect = this.$route.params.categoryId || ''
|
||||
this.listQuery.category = this.$route.params.categoryId || ''
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
getReportlist({ ...this.listQuery }).then((res) => {
|
||||
console.log(res)
|
||||
if (res.code === 0 && res.data) {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
@@ -138,19 +163,30 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
getCategorylist() {
|
||||
getReportCategorylist({}).then((res) => {
|
||||
if (res.code === 0 && res.data.length > 0) {
|
||||
localStorage.setItem('reportCategory', JSON.stringify(res.data))
|
||||
this.formConfig[1].selectOptions = res.data
|
||||
} else {
|
||||
localStorage.setItem('reportCategory', '')
|
||||
}
|
||||
})
|
||||
},
|
||||
handleClick(val) {
|
||||
console.log(val.data.name)
|
||||
switch (val.type) {
|
||||
case 'view':
|
||||
this.$router.push({
|
||||
path: '/basicConfig/reportManagement/reportView',
|
||||
query: { name: val.data.name }
|
||||
// path: '/basicConfig/reportManagement/reportView',
|
||||
name: 'reportView',
|
||||
params: { name: val.data.name }
|
||||
})
|
||||
break
|
||||
case 'design':
|
||||
this.$router.push({
|
||||
path: '/basicConfig/reportManagement/reportDesign',
|
||||
query: { name: val.data.name }
|
||||
// path: '/basicConfig/reportManagement/reportDesign',
|
||||
name: 'reportDesign',
|
||||
params: { name: val.data.name }
|
||||
})
|
||||
break
|
||||
case 'edit':
|
||||
@@ -165,8 +201,7 @@ export default {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
delReportlist({ id: val.data.id }).then((res) => {
|
||||
console.log(res)
|
||||
delReportlist({ id: val.data.id }).then(() => {
|
||||
this.$message({
|
||||
message: '报表删除成功',
|
||||
type: 'success',
|
||||
@@ -184,6 +219,7 @@ export default {
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.name = val.name
|
||||
this.listQuery.category = val.category
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
break
|
||||
@@ -204,6 +240,22 @@ export default {
|
||||
successSubmit() {
|
||||
this.handleCancel()
|
||||
this.getList()
|
||||
},
|
||||
categoryChange(val) {
|
||||
updateReportlist({
|
||||
fileName: val.injectData.fileName,
|
||||
id: val.injectData.id,
|
||||
category: val.categoryId
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,16 +8,13 @@ export default {
|
||||
name: 'ReportView',
|
||||
data() {
|
||||
return {
|
||||
url: process.env.VUE_APP_REPORT_VIEW_URL,
|
||||
aa: '111'
|
||||
url: process.env.VUE_APP_REPORT_VIEW_URL
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const vm = this
|
||||
const { name } = this.$route.query
|
||||
console.log(name)
|
||||
this.url += name ? '?_u=db:' + this.$route.query.name : ''
|
||||
console.log(this.url)
|
||||
const { name } = this.$route.params
|
||||
this.url += name ? '?_u=db:' + this.$route.params.name : ''
|
||||
const ifream = document.getElementById('reportView')
|
||||
ifream.onload = function () {
|
||||
console.log('加载完成')
|
||||
|
||||
Reference in New Issue
Block a user