系统-基础-统计报表

This commit is contained in:
2022-10-20 14:14:25 +08:00
parent 7a935886d9
commit 989c1fa25f
14 changed files with 2271 additions and 14 deletions

View File

@@ -1,8 +1,239 @@
<!--/*
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditTime: 2022-04-15
* @LastEditors: juzi
* @Description: 拆分了搜索区和功能按钮区增加了toptitle
*/
-->
<template>
<div>goodsAreaData</div>
<div class="app-container">
<head-form :form-config="headFormConfig" @headBtnClick="btnClick" />
<base-table
:top-btn-config="topBtnConfig"
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
@clickTopBtn="clickTopBtn"
>
<method-btn
slot="handleBtn"
:width="calculateWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<data-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>
import DataAdd from './components/goodsAreaData-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
import i18n from '@/lang'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const topBtnConfig = [
{
type: 'add',
btnName: 'btn.add'
}
]
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter
},
{
prop: 'name1',
label: '所属库区'
},
{
prop: 'name2',
label: '货位编号'
},
{
prop: 'name3',
label: '货位名称'
},
{
prop: 'name4',
label: '货位状态'
},
{
prop: 'name5',
label: '入库锁'
},
{
prop: 'name6',
label: '出库锁'
}
]
export default {
name: 'GoodsAreaData'
name: 'GoodsAreaData',
components: { Pagination, BaseTable, MethodBtn, HeadForm, DataAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
topBtnConfig,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 20,
key: ''
},
headFormConfig: [
{
type: 'input',
label: i18n.t('module.basicData.visual.keyword'),
placeholder: this.$t('module.basicData.factory.placeholderName'),
param: 'name'
},
{
type: 'button',
btnName: 'btn.search',
name: 'search',
color: 'primary'
}
],
headFormValue: {}
}
},
computed: {
calculateWidth() {
return this.tableBtn.length * 40 // 操作列的每个按钮宽度40
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(
`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`,
this.$t('module.basicData.visual.Tips'),
{
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}
)
.then(() => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
.catch(() => {})
} else {
this.addNew(raw.data)
}
},
getList() {
this.listLoading = false
this.listQuery.key = this.headFormValue.name
this.list = [
{
id: 1,
name1: 'A区',
name2: '2022040696',
name3: '成品',
name4: '空闲',
name5: '开',
name6: '关'
}
]
},
btnClick(val) {
this.headFormValue = val
// 如果点击的是搜索栏的其他按钮在这里继续写判断
if (this.headFormValue.btnName === 'search') {
this.getList()
}
},
clickTopBtn(val) {
if (val === 'add') {
this.addNew()
}
},
// 新增 / 修改
addNew(row) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>