Commit cec12ca5 authored by daywrite's avatar daywrite

费用报销View

parent f4c1999d
<template>
<section>
<div class="content">
<div>
<el-row :gutter="10" class="header-title">
<el-col :span="12">
<h2>客户名称:{{ result.list[0] && result.list[0].client.name }}</h2>
</el-col>
</el-row>
</div>
<div class="page-body-content">
<div class="mb10">
<countArr
:list="result.countArr">
</countArr>
</div>
<ReimItem
v-for="item in result.list"
:item="item"
:key="item.id">
<span slot="opearate" class="obear-opearate-button">
<el-button type="primary" size="mini" @click.prevent.stop="leaveMessageSch(item)"><span class="badge" v-if="item.commentCount.comment">{{ item.commentCount.comment ? item.commentCount.comment : '' }}</span><i class="fa fa-commenting"></i>留言</el-button>
<el-button type="primary" size="mini" @click.prevent.stop="editSch(item)" :disabled="!item.can_update"><i class="fa fa-edit animated"></i>编辑</el-button>
<el-button type="primary" size="mini" @click.prevent.stop="deleteSch(item.id)" :disabled="!item.can_delete"><i class="fa fa-trash-o animated-hove"></i>删除</el-button>
</span>
</ReimItem>
<Pagenation
@update:pager="pager => {updatePage(pager)}"
:total="result.pagenation.totalcount">
</Pagenation>
<leave-message
v-click-outside="lmClose"
ref="leaveMessage"
:lmTemplate="lmTemplate"
:type="20">
</leave-message>
</div>
</div>
<ReimModal
ref="reimModal">
<!-- v-click-outside="scheduleClose" -->
</ReimModal>
</section>
</template>
<script>
import ReimItem from './reimbursementItem'
import ReimModal from '../reimbursement/reimbursementModal'
import CountArr from './countArr'
import Pagenation from './reimbursementPagenation'
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'reimbursementHome',
components: {
ReimItem,
ReimModal,
CountArr,
Pagenation
},
data () {
return {
lmTemplate: [
{
name: '报销类型',
value: 'type.name',
default: ''
},
{
name: '费用金额',
value: 'amount'
},
{
name: '报销状态',
value: 'status_display'
},
{
name: '发生时间',
value: 'occurrence_at'
},
{
name: '费用说明',
value: 'description'
},
{
name: '费用类型',
value: 'costType.name'
},
{
name: '录入人',
value: 'createdBy.name'
}
],
// reimTypeArray: [],
pagenation: {
thispage: 1,
pagesize: 10
},
result: {
list: [],
countArr: [],
navCount: [],
pagenation: {
totalcount: 1,
thispage: 1,
pagesize: 10
},
thisUser: {
id: '',
name: '',
sex: ''
}
}
}
},
mounted () {
this.init()
},
methods: {
init () {
let id = this.id = this.$route.params.id
this.getList({
id,
page: this.pagenation.thispage
})
},
_reload () {
let params = this.setParams({
...this.form,
page: this.pagenation.thispage
}, {})
this.getList(params)
},
updatePage (pager) {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, {page: pager.thispage})
this.getList(ret)
},
leaveMessageSch (item) {
this.$refs.leaveMessage.btnShow(item)
},
lmClose () {
this.$refs.leaveMessage &&
this.$refs.leaveMessage.btnClose()
},
scheduleClose () {
this.$refs.reimModal &&
this.$refs.reimModal.handleClose()
},
addSch () {
this.$refs.reimModal.show()
},
editSch (item) {
this.$refs.reimModal.show(item)
},
deleteSch (id) {
this.$confirm('删除该待办事项?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api.deleteReim, { id })
.then((res) => {
this._reload()
this.$message.success('删除成功')
})
}).catch(() => {
this.$message.info('取消删除')
})
},
getList (params) {
requestAPI(api.getReimList, params).then((res) => {
const {
list = [],
countArr = [],
navCount = [],
pagenation = {},
thisUser = {}
} = res
this.result.list = list
this.result.countArr = countArr
this.result.navCount = navCount
// this.reimType = navCount[0].key
this.result.pagenation = pagenation
this.result.thisUser = thisUser
})
}
}
}
</script>
<style scoped lang="scss">
@include c('opearate-button') {
> .el-button {
margin-right:0px;
}
& .btn-primary .badge {
color: #333744;
background-color: #fff;
}
& .badge {
position: relative;
top: 0px;
left: -5px;
display: inline-block;
padding: 0px 5px;
font-size: 12px;
font-weight: 700;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25rem;
background: white;
color: black;
}
i {
display: inline-block;
padding-right: 3px;
}
}
</style>
import ReimbursementHome from '../components/reimbursement_list/reimbursementHome'
import ReimbursementView from '../components/reimbursement_list/reimbursementView'
const routes = [{
path: '/reimbursement',
name: 'reimbursementHome',
component: ReimbursementHome
}, {
path: '/ofClient/:id',
name: 'reimbursementView',
component: ReimbursementView
}]
export default routes
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment