yhjz_vue/src/views/business/businessoutlayincome.vue

297 lines
8.8 KiB
Vue
Raw Normal View History

2024-02-28 14:44:44 +08:00
<template>
<div class="mod-config">
<div style="text-align: center;padding: 1%;font-size: 18px;font-weight: bold">{{ sysYear }}收支总结表</div>
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="开始时间" prop="start">
<el-date-picker
v-model="dataForm.start"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="start">
<el-date-picker
v-model="dataForm.end"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button @click="onExport()">导出</el-button>
<el-button v-if="isAuth('business:businessoutlayincome:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="index"
header-align="center"
align="center"
label="序号"
width="50">
</el-table-column>
<el-table-column
prop="outinDate"
header-align="center"
align="center"
label="日期">
</el-table-column>
<el-table-column
prop="outinYdayBalance"
header-align="center"
align="center"
label="昨日余额">
</el-table-column>
<el-table-column
prop="outinTdayIncome"
header-align="center"
align="center"
label="今日收入">
</el-table-column>
<el-table-column
prop="outinTdayOut"
header-align="center"
align="center"
label="今日支出">
</el-table-column>
<el-table-column
prop="outinTdayBalance"
header-align="center"
align="center"
label="今日余额">
</el-table-column>
<el-table-column
prop="outinCreditingWay"
header-align="center"
align="center"
label="收款方式">
<template slot-scope="scope">
<template v-for="item in payList" v-if="item.dictId === scope.row.outinCreditingWay">
{{ item.name }}
</template>
</template>
</el-table-column>
2024-03-15 10:02:15 +08:00
<el-table-column
prop="outType"
header-align="center"
align="center"
label="收入类型">
<template slot-scope="scope">
<template v-for="item in expenseList" v-if="item.dictId === scope.row.outType">
{{ item.name }}
</template>
</template>
</el-table-column>
2024-02-28 14:44:44 +08:00
<el-table-column
prop="outinRemark"
header-align="center"
align="center"
label="备注">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" v-if="scope.row.approval != 2" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
</template>
</el-table-column>
</el-table>
2024-03-15 10:02:15 +08:00
<el-pagination
2024-02-28 14:44:44 +08:00
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
2024-03-15 10:02:15 +08:00
</el-pagination>
2024-02-28 14:44:44 +08:00
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
2024-04-16 11:34:24 +08:00
/* eslint-disable spaced-comment */
2024-02-28 14:44:44 +08:00
2024-04-16 11:34:24 +08:00
import AddOrUpdate from './businessoutlayincome-add-or-update'
export default {
data () {
return {
dataForm: {
key: '',
start: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
payList: [], // 收款方式
expenseList: [], // 收入类别
addOrUpdateVisible: false,
userId: '',
authenticName: '',
sysYear: ''
}
},
components: {
AddOrUpdate
},
async mounted () {
if (new Date().getMonth() + 1 === 1 || new Date().getMonth() + 1 === 2) {
this.sysYear = new Date().getFullYear() - 1
} else {
this.sysYear = new Date().getFullYear()
}
await this.$http.request({
url: this.$http.adornUrl('/sys/user/info'),
method: 'get'
}).then(({data}) => {
if (data && data.code === 0) {
this.userId = data.user.userId
this.authenticName = data.user.authenticName
2024-02-28 14:44:44 +08:00
}
2024-04-16 11:34:24 +08:00
})
await this.$http.request({
url: this.$http.adornUrl('/business/businessoutlay/dictList'),
method: 'get'
}).then(({data}) => {
// console.log(data);
if (data && data.code === 0) {
data.data.forEach((item) => {
if (item.dictCode === 'pay_type') {
this.payList = item.children
}
if (item.dictCode === 'expense_type') {
this.expenseList = item.children
}
})
2024-02-28 14:44:44 +08:00
}
2024-04-16 11:34:24 +08:00
})
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
// eslint-disable-next-line eqeqeq
if (!(this.authenticName == '管理员' || this.authenticName == '侯德生' || this.authenticName == '侯吉庆' || this.authenticName == '李现举' || this.authenticName === '侯吉光' || this.authenticName === '肖爽')) {
return
}
this.dataListLoading = true
// 获取系统用户信息
/*this.$http.request({
url: this.$http.adornUrl('/sys/user/listNoPage'),
2024-02-28 14:44:44 +08:00
method: 'get'
}).then(({data}) => {
// console.log(data);
if (data && data.code === 0) {
2024-04-16 11:34:24 +08:00
data.page.forEach((item) => {
if (item.authenticName == '侯德生' || item.authenticName == '侯吉庆' || item.authenticName == '李现举' || item.authenticName === '侯吉光') {
this.userId = item.userId
this.authenticName = item.authenticName
2024-02-28 14:44:44 +08:00
}
2024-04-16 11:34:24 +08:00
})
}
})*/
this.dataList = []
this.$http({
url: this.$http.adornUrl('/business/businessoutlayincome/pcListPage'),
method: 'get',
params: this.$http.adornParams({
'start': this.dataForm.start,
'end': this.dataForm.end,
'writeUserId': this.userId,
'page': this.pageIndex,
'limit': this.pageSize
})
}).then(({data}) => {
this.totalPage = data.page.totalCount
if (this.authenticName === '管理员') {
this.dataList = data.page.list
} else {
data.page.list.forEach((item) => {
if (item.writeUserId === this.userId) { // 谁登陆查找谁的信息
this.dataList.push(item)
2024-03-15 10:02:15 +08:00
}
2024-02-28 14:44:44 +08:00
})
}
})
2024-04-16 11:34:24 +08:00
this.dataListLoading = false
},
onExport () {
if (this.authenticName === '管理员') {
window.open(this.$http.adornUrl('/business/businessoutlayincome/export'))
} else {
window.open(this.$http.adornUrl('/business/businessoutlayincome/export?writeUserId=' + this.userId))
}
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
2024-02-28 14:44:44 +08:00
this.getDataList()
},
2024-04-16 11:34:24 +08:00
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/business/businessoutlayincome/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
2024-02-28 14:44:44 +08:00
}).then(({data}) => {
if (data && data.code === 0) {
2024-04-16 11:34:24 +08:00
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
2024-02-28 14:44:44 +08:00
}
})
} else {
2024-04-16 11:34:24 +08:00
this.$message.error(data.msg)
2024-02-28 14:44:44 +08:00
}
})
2024-04-16 11:34:24 +08:00
})
2024-02-28 14:44:44 +08:00
}
}
2024-04-16 11:34:24 +08:00
}
2024-02-28 14:44:44 +08:00
</script>