123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- <template>
- <div class="expenseManagementDetail-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-page-header :ghost="false" :backIcon="false" class="expenseManagementDetail-cont">
- <template slot="subTitle">
- <a href="javascript:;" @click="handleBack">
- <a-icon type="left"></a-icon>
- 返回列表
- </a>
- </template>
- <!-- 操作区,位于 title 行的行尾 -->
- <template slot="extra">
- <a-button
- :disabled="detailData==null"
- key="1"
- type="default"
- v-if="$hasPermissions('B_eRPrint')"
- id="expenseManagementDetail-print-btn"
- @click="handlePrint('preview')">打印预览</a-button>
- <a-button
- :disabled="detailData==null"
- key="2"
- type="primary"
- class="button-error"
- v-if="$hasPermissions('B_eRPrint')"
- id="expenseManagementDetail-print-btn"
- @click="handlePrint('print')">快捷打印</a-button>
- </template>
- </a-page-header>
- <!-- 基础信息 -->
- <a-card size="small" :bordered="false" class="expenseManagementDetail-cont" v-if="detailData">
- <a-collapse :activeKey="['1']">
- <a-collapse-panel key="1" header="基础信息">
- <a-descriptions size="small" :column="{ xs: 2, sm: 3, md: 4}">
- <a-descriptions-item label="费用单号">{{ detailData&&detailData.expenseAccountNo || '--' }}</a-descriptions-item>
- <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
- <a-descriptions-item label="申请部门">{{ detailData&&detailData.applyDepartmentName || '--' }}</a-descriptions-item>
- <a-descriptions-item label="费用类型">{{ detailData&&detailData.expenseTypeName || '--' }}<span v-if="detailData&&detailData.expenseType2">/{{ detailData&&detailData.expenseTypeName2 || '--' }}</span></a-descriptions-item>
- <a-descriptions-item label="费用发生月份">{{ detailData&&detailData.expenseDate?detailData.expenseDate.substring(0, 7) : '--' }}</a-descriptions-item>
- <a-descriptions-item label="合计金额">{{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? toThousands(detailData.applyExpenseTotal)+' 元' : '--' }}</a-descriptions-item>
- <a-descriptions-item label="状态">{{ detailData&&detailData.stateDictValue || '--' }}</a-descriptions-item>
- <a-descriptions-item label="打印状态">{{ detailData&&detailData.printStatusDictValue || '--' }}</a-descriptions-item>
- <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
- <a-descriptions-item label="审核时间">{{ detailData&&detailData.finishDate || '--' }}</a-descriptions-item>
- <a-descriptions-item label="关联单号" v-if="detailData&&detailData.bizNo">{{ detailData&&detailData.bizNo || '--' }}</a-descriptions-item>
- <a-descriptions-item label="主题" :span="3">{{ detailData&&detailData.title || '--' }}</a-descriptions-item>
-
- <a-descriptions-item label="详细说明" :span="4">
- {{ detailData.content.join(',')||'' }}
- </a-descriptions-item>
- <a-descriptions-item label="附件" :span="4">
- <a target="_blank" style="color: #00aaff;text-decoration: underline;margin-right: 15px;" :href="item.filePath" v-for="item in detailData.expenseAccountFilesList" :key="item.id">
- {{ item.fileName }}
- </a>
- </a-descriptions-item>
- </a-descriptions>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <a-card size="small" :bordered="false" class="pages-wrap">
- <a-alert type="info" style="margin-bottom:10px">
- <div slot="message">
- 共<strong> {{ count }} </strong> 条费用明细,合计金额¥<strong v-if="detailData"> {{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? toThousands(detailData.applyExpenseTotal)+' 元' : '--' }} </strong>
- </div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="record => record.id"
- :columns="columns"
- :data="loadData"
- :showPagination="false"
- :defaultLoadData="true"
- bordered>
- <!-- 记账名称 -->
- <template slot="jzname" slot-scope="text,record">
- <div>{{ text }}</div>
- <div v-if="record.accountNameFnumber">({{ record.accountNameFnumber }})</div>
- </template>
- <!-- 费用承担方 -->
- <template slot="fycdf" slot-scope="text,record">
- <div v-for="(item,index) in record.detailSplitList" :key="item.id+'-'+index">
- {{ item.splitObjName }}
- <span v-if="item.splitObjFnumber">({{ item.splitObjFnumber }})</span>
- <span v-if="item.childDetailSplit&&item.childDetailSplit.splitObjName">/</span>
- {{ item.childDetailSplit?item.childDetailSplit.splitObjName:'' }}: ¥{{ item.childDetailSplit?item.childDetailSplit.splitAmount:item.splitAmount }}
- </div>
- </template>
- <!-- 产品信息 -->
- <template slot="cpxx" slot-scope="text,record">
- <div v-for="item in record.detailProductsList" :key="item.id">
- <div v-if="item.productCode">{{ item.productCode }}</div>
- <div v-else-if="item.productBrandName">{{ item.productBrandName }}<span v-if="item.productTypeShowName">/</span>{{ item.productTypeShowName }}</div>
- <div v-else>{{ item.productTypeShowName }}</div>
- </div>
- <span v-if="!record.detailProductsList||record.detailProductsList.length==0">--</span>
- </template>
- </s-table>
- </a-card>
- </a-spin>
- <!-- 打印预览 -->
- <commonModal modalTit="费用报销单打印预览" width="700pt" okText="立即打印" :openModal="showTipModal" @cancel="showTipModal=false" @ok="$refs.printModal.prints()">
- <previewModal v-if="printType=='preview'" ref="printModal" @printOk="printOk"></previewModal>
- </commonModal>
- <!-- 快捷打印 -->
- <div style="height:0;overflow: hidden;">
- <previewModal v-if="printType=='print'" ref="printModal" @printOk="printOk"></previewModal>
- </div>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable } from '@/components'
- import commonModal from '@/views/common/commonModal.vue'
- import { expenseAccountDetail, expenseAcctDetailFindList, getProcessInstance, expenseAccountUpdateBatch } from '@/api/expenseManagement'
- import previewModal from './previewModal.vue'
- export default {
- name: 'ExpenseReimbursementListDetail',
- mixins: [commonMixin],
- components: { STable, previewModal, commonModal },
- data () {
- let _this=this
- return {
- spinning: false,
- disabled: false,
- baseData: null,
- showTipModal: false,
- printType:'',
- count: 0,
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.spinning = true
- const params = Object.assign({ expenseAccountSn: this.$route.params.sn })
- return expenseAcctDetailFindList(params).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- this.count = res.data.length
- const no = 0
- for (var i = 0; i < data.length; i++) {
- data[i].no = no + i + 1
- }
- }
- this.spinning = false
- return data
- })
- },
- columns: [
- { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
- { title: '记账类型', dataIndex: 'accountTypeDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
- { title: '记账名称', dataIndex: 'accountName', scopedSlots: { customRender: 'jzname' }, align: 'center', width: '14%' },
- { title: '所属区域', dataIndex: 'subareaNames', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '所属分区', dataIndex: 'subareaAreaName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '所属省份', dataIndex: 'provinceName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
- { title: '所属城市', dataIndex: 'cityName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
- { title: '记账费用', dataIndex: 'expense', align: 'right', width: '10%', customRender: function (text) { return (text||text==0)?_this.toThousands(text):'--' } },
- { title: '费用承担方', scopedSlots: { customRender: 'fycdf' }, align: 'center', width: '15%' },
- { title: '产品信息', scopedSlots: { customRender: 'cpxx' }, align: 'center', width: '15%' },
- { title: '备注', dataIndex: 'remarks', align: 'center', width: '10%', customRender: function (text) { return text || '--' } }
- ],
- chooseLoadData: [],
- detailData: null, // 详情数据
- total: 0
- }
- },
- methods: {
- // 返回
- handleBack () {
- this.$router.push({ name: 'expenseReimbursementList' })
- },
- // 打印
- async handlePrint (type) {
- this.printType = type
- this.spinning = true
- // 费用明细
- const fyListData = await expenseAcctDetailFindList({ expenseAccountSn: this.$route.params.sn }).then(res => res.data)
- // 审核明细,待提交状态不获取
- const spListData = this.detailData.state != 'WAIT_SUBMIT' ? await getProcessInstance({ businessType: 'EXPENSES', businessSn: this.$route.params.sn }).then(res => res.data) : null
- // 打印预览弹框
- if(type == 'preview'){
- this.showTipModal = true
- }
- this.$nextTick(()=>{
- this.$refs.printModal.setData([{
- expenseInfo: this.detailData,
- fyListData,
- spListData:spListData||[]
- }])
- // 立即打印
- if(type == 'print'){
- setTimeout(()=>{
- this.$refs.printModal.prints()
- },500)
- }
- this.spinning = false
- })
- },
- printOk(data){
- if(data&&data.status == 200){
- expenseAccountUpdateBatch([{
- id: this.detailData.id,
- printStatus:"PRINT"
- }]).then(res => {
- if(res.status == 200){
- this.getDetail()
- }
- this.spinning = false
- this.showTipModal = false
- })
- }else{
- this.spinning = false
- }
- },
- // 详情
- getDetail () {
- this.spinning = true
- this.detailData = null
- expenseAccountDetail({ expenseAccountSn: this.$route.params.sn }).then(res => {
- if (res.status == 200) {
- this.spinning = false
- this.detailData = res.data
- this.detailData.content = res.data.content.replace(/\n+/, '\n').split('\n')
- this.$refs.table.refresh()
- } else {
- this.detailData = null
- }
- })
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.getDetail()
- }
- },
- activated () {
- // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
- if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
- this.getDetail()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .expenseManagementDetail-wrap {
- .expenseManagementDetail-cont {
- margin-bottom: 10px;
- }
- .footer-cont{
- margin-top: 5px;
- text-align: center;
- }
- }
- </style>
|