123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- <template>
- <div class="page">
- <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
- <el-form-item prop="businessCode">
- <el-input size="small" v-model="searchForm.businessCode" placeholder="业务编号" clearable></el-input>
- </el-form-item>
- <el-form-item prop="invoiceNumber">
- <el-input size="small" v-model="searchForm.invoiceNumber" placeholder="发票号码" clearable></el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="refreshList()" size="small" icon="el-icon-search">查询</el-button>
- <el-button @click="resetSearch()" size="small" icon="el-icon-refresh-right">重置</el-button>
- </el-form-item>
- </el-form>
- <div class="bg-white top">
- <vxe-toolbar :refresh="{query: refreshList}" export print custom>
- <template #buttons>
- <el-row>
- <el-upload style="float: left"
- class="upload-demo"
- :on-success="uploadSuccess"
- :show-file-list="false"
- :before-upload="beforeUpload"
- :action="`${$http.BASE_URL}/reimbursement/uploadFile`"
- multiple
- list-type="picture">
- <el-button size="small"
- icon="el-icon-upload"
- type="primary">点击上传</el-button>
- </el-upload>
- <el-button style="margin-left: 10px" v-if="hasPermission('reimbursement:del')" :disabled="$refs.xTree && $refs.xTree.getCheckboxRecords().length === 0" type="danger" size="small" icon="el-icon-delete" @click="del()" plain>删除</el-button>
- <el-button style="margin-left: 10px" v-if="hasPermission('reimbursement:edit')" :disabled="$refs.xTree && $refs.xTree.getCheckboxRecords().length === 0" type="primary" size="small" icon="el-icon-edit" @click="editInvoiceGatheringTime()" plain>批量收款</el-button>
- </el-row>
- </template>
- </vxe-toolbar>
- <div style="height: calc(100% - 80px);">
- <vxe-table
- ref="xTree"
- border="inner"
- auto-resize
- resizable
- height="auto"
- row-id="id"
- size="small"
- show-header-overflow
- show-overflow
- highlight-hover-row
- :print-config="{}"
- :export-config="{}"
- :tree-config="{expandAll: true}"
- :loading="loading"
- :checkbox-config="{labelField: ''}"
- :data="dataList">
- <vxe-column type="checkbox" width="40px"> </vxe-column>
- <vxe-column width="140px" title="业务编号" field="businessCode" align="left" tree-node >
- <template slot-scope="scope">
- <el-link type="primary" :underline="false" v-if="scope.row.parentId == '0'" @click="view(scope.row.id)">{{scope.row.businessCode}}</el-link>
- <span v-else></span>
- </template>
- </vxe-column>
- <vxe-column width="100px" title="发票代码" field="invoiceCode" align="center" ></vxe-column>
- <vxe-column width="100px" title="发票号码" field="invoiceNumber" align="center">
- <template slot-scope="scope">
- <el-link type="primary" :underline="false" v-if="hasPermission('reimbursement:view') && scope.row.parentId !== '0'" @click="viewInvoice(scope.row.id)">{{scope.row.invoiceNumber}}</el-link>
- <span v-else></span>
- </template>
- </vxe-column>
- <vxe-column width="100px" title="金额" field="money" align="center"></vxe-column>
- <vxe-column width="100px" title="税额" field="tax" align="center"></vxe-column>
- <vxe-column width="100px" title="收入" field="income" align="center"></vxe-column>
- <vxe-column width="100px" title="报销比例%" field="reimbursementRatio" align="center"></vxe-column>
- <vxe-column width="200px" title="购方企业名称" field="firmName" align="center"></vxe-column>
- <vxe-column width="100px" title="开票日期" field="makeTime" align="center"></vxe-column>
- <vxe-column width="150px" title="商品名称" field="name" align="center"></vxe-column>
- <vxe-column width="100px" title="项目经理" field="proposer" align="center"></vxe-column>
- <vxe-column width="100px" title="部门" field="partner" align="center"></vxe-column>
- <vxe-column width="100px" title="业务类型" field="businessType" align="center"></vxe-column>
- <vxe-column width="100px" title="收款日期" field="gatheringTime" align="center"></vxe-column>
- <vxe-column title="操作" width="300px" fixed="right" align="center">
- <template slot-scope="scope">
- <el-button v-if="hasPermission('reimbursement:edit') && scope.row.businessCode==='' && scope.row.parentId === '0'" type="text" icon="el-icon-edit" size="small" @click="editBusiness(scope.row.id)">新增业务编码</el-button>
- <el-button v-if="hasPermission('reimbursement:edit') && scope.row.businessCode !== '' && !scope.row.reimbursementRatio && scope.row.parentId === '0'" type="text" icon="el-icon-edit" size="small" @click="editBusinessRatio(scope.row.id)">报销比例</el-button>
- <el-button v-if="hasPermission('reimbursementBusiness:add') && scope.row.businessCode !== '' && scope.row.reimbursementRatio && scope.row.parentId === '0'" type="text" icon="el-icon-plus" size="small" @click="addBusinessInfo(scope.row.id, scope.row.businessCode)">业务报销</el-button>
- <el-button v-if="hasPermission('reimbursementBusiness:view') && scope.row.businessCode !== '' && scope.row.reimbursementRatio && scope.row.parentId === '0'" type="text" icon="el-icon-view" size="small" @click="viewBusinessInfo(scope.row.id)">业务报销详情</el-button>
- <el-button v-if="hasPermission('reimbursement:edit') && scope.row.parentId !== '0' && !scope.row.gatheringTime" type="text" icon="el-icon-edit" size="small" @click="editInvoice(scope.row.id)">收款</el-button>
- <el-button v-if="hasPermission('reimbursement:del') && scope.row.parentId === '0'" type="text" icon="el-icon-delete" size="small" @click="delBusiness(scope.row.id)">删除</el-button>
- <el-button v-if="hasPermission('reimbursement:del') && scope.row.parentId !== '0'" type="text" icon="el-icon-delete" size="small" @click="delInvoice(scope.row.id)">删除</el-button>
- </template>
- </vxe-column>
- </vxe-table>
- <vxe-pager
- background
- size="small"
- :current-page="tablePage.currentPage"
- :page-size="tablePage.pageSize"
- :total="tablePage.total"
- :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
- :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
- @page-change="currentChangeHandle">
- </vxe-pager>
- </div>
- </div>
- <!-- 弹窗, 新增 / 修改 -->
- <reimbursementForm ref="reimbursementForm" @refreshDataList="refreshList"></reimbursementForm>
- <reimbursementGatheringTimeForm ref="reimbursementGatheringTimeForm" @refreshDataList="refreshList"></reimbursementGatheringTimeForm>
- <reimbursementRatioForm ref="reimbursementRatioForm" @refreshDataList="refreshList"></reimbursementRatioForm>
- <reimbursementBusinessForm ref="reimbursementBusinessForm" @refreshDataList="refreshList"></reimbursementBusinessForm>
- <reimbursementBusinessList ref="reimbursementBusinessList" @refreshDataList="refreshList"></reimbursementBusinessList>
- <reimbursementInvoiceForm ref="reimbursementInvoiceForm" @refreshDataList="refreshList"></reimbursementInvoiceForm>
- </div>
- </template>
- <script>
- import ReimbursementSys from '@/api/reimbursementSys/reimbursementSysService'
- import XEUtils from 'xe-utils'
- import reimbursementForm from './reimbursementForm'
- import reimbursementGatheringTimeForm from './reimbursementGatheringTimeForm'
- import reimbursementRatioForm from './reimbursementRatioForm'
- import reimbursementInvoiceForm from './reimbursementInvoiceForm'
- import reimbursementBusinessForm from './reimbursementBusinessForm'
- export default {
- data () {
- return {
- dataList: [],
- searchForm: {
- businessCode: '',
- invoiceNumber: '',
- reimbursementRatio: ''
- },
- tablePage: {
- total: 0,
- currentPage: 1,
- pageSize: 10,
- orders: [{column: 'a.create_date', asc: false}]
- },
- loading: false
- }
- },
- components: {
- reimbursementForm,
- reimbursementGatheringTimeForm,
- reimbursementRatioForm,
- reimbursementInvoiceForm,
- reimbursementBusinessForm
- },
- ReimbursementSys: null,
- created () {
- this.reimbursementSys = new ReimbursementSys()
- },
- activated () {
- this.refreshList()
- },
- methods: {
- // 获取数据列表
- refreshList () {
- this.loading = true
- this.reimbursementSys.treeData({
- 'current': this.tablePage.currentPage,
- 'size': this.tablePage.pageSize,
- 'orders': this.tablePage.orders,
- ...this.searchForm
- }).then(({data}) => {
- this.dataList = data
- this.tablePage.total = data.total
- this.handleSearch()
- this.loading = false
- })
- },
- beforeUpload (file) {
- const isExcel = file.name.indexOf('.xls') >= 0 || file.name.indexOf('.xlsx') >= 0
- const isLt2M = file.size / 1024 / 1024 < 1
- if (!isExcel) {
- this.$message.error('只能上传xls、xlsx文件!')
- return false
- }
- if (!isLt2M) {
- this.$message.error('上传文件大小不能超过 10MB!')
- return false
- }
- this.loading = true
- return true
- },
- handleSearch () {
- let name = XEUtils.toValueString(this.searchForm.businessCode).trim()
- let options = { children: 'children' }
- let searchProps = ['name']
- this.dataList = XEUtils.searchTree(
- this.dataList.records, item => searchProps.some(key => XEUtils.toValueString(item[key]).indexOf(name) >= -1), options)
- this.$nextTick(() => {
- this.$refs.xTree.setAllTreeExpand(true)
- })
- },
- resetSearch () {
- this.$refs.searchForm.resetFields()
- this.refreshList()
- },
- uploadSuccess (res, file) {
- if (res.success) {
- this.$message.success({dangerouslyUseHTMLString: true,
- message: res.message})
- this.refreshList()
- } else {
- this.$message.error(res.message)
- this.refreshList()
- }
- },
- // 当前页
- currentChangeHandle ({ currentPage, pageSize }) {
- this.tablePage.currentPage = currentPage
- this.tablePage.pageSize = pageSize
- this.refreshList()
- },
- // 修改
- editBusiness (id) {
- this.$refs.reimbursementForm.init('editBusiness', {id: id, parent: {id: '', name: ''}})
- },
- // 修改
- editBusinessRatio (id) {
- this.$refs.reimbursementRatioForm.init('editBusinessRatio', {id: id, parent: {id: '', name: ''}})
- },
- // 修改
- addBusinessInfo (id, businessCode) {
- this.$refs.reimbursementBusinessForm.init('addBusinessInfo', {id: '', businessCodeId: id, businessCode: businessCode, parent: {id: '', name: ''}})
- },
- // 查看业务报销详情
- viewBusinessInfo (id) {
- this.$router.push({path: `/reimbursementSys/reimbursementBusinessList`, query: {id: id, title: '业务报销详情'}})
- },
- // 修改发票收款日期
- editInvoiceGatheringTime (id) {
- let ids = id || this.$refs.xTree.getCheckboxRecords().map(item => {
- return item.id
- }).join(',')
- this.$refs.reimbursementGatheringTimeForm.init('edit', {id: ids, parent: {id: '', name: ''}})
- },
- // 修改发票信息
- editInvoice (id) {
- this.$refs.reimbursementInvoiceForm.init('editInvoice', {id: id, parent: {id: '', name: ''}})
- },
- // 查看
- view (id) {
- this.$refs.reimbursementForm.init('view', {id: id, parent: {id: '', name: ''}})
- },
- // 查看发票信息
- viewInvoice (id) {
- this.$refs.reimbursementInvoiceForm.init('viewInvoice', {id: id, parent: {id: '', name: ''}})
- },
- // 删除
- delBusiness (id) {
- let ids = id || this.$refs.xTree.getCheckboxRecords().map(item => {
- return item.id
- }).join(',')
- this.$confirm(`确定删除该记录吗?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.loading = true
- this.reimbursementSys.deleteBusiness(ids).then(({data}) => {
- this.loading = false
- this.$message({
- message: data,
- type: 'success',
- duration: 1500
- })
- this.refreshList()
- })
- })
- },
- // 删除
- delInvoice (id) {
- let ids = id || this.$refs.xTree.getCheckboxRecords().map(item => {
- return item.id
- }).join(',')
- this.$confirm(`确定删除该记录吗?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.loading = true
- this.reimbursementSys.deleteInvoice(ids).then(({data}) => {
- this.loading = false
- this.$message({
- message: data,
- type: 'success',
- duration: 1500
- })
- this.refreshList()
- })
- })
- },
- // 删除
- del (id) {
- let ids = id || this.$refs.xTree.getCheckboxRecords().map(item => {
- return item.id
- }).join(',')
- this.$confirm(`确定删除该记录吗?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.loading = true
- this.reimbursementSys.delete(ids).then(({data}) => {
- this.loading = false
- this.$message({
- message: data,
- type: 'success',
- duration: 1500
- })
- this.refreshList()
- })
- })
- }
- }
- }
- </script>
|