detail.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="expenseManagementDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="expenseManagementDetail-cont">
  5. <template slot="subTitle">
  6. <a href="javascript:;" @click="handleBack">
  7. <a-icon type="left"></a-icon>
  8. 返回列表
  9. </a>
  10. </template>
  11. <!-- 操作区,位于 title 行的行尾 -->
  12. <template slot="extra">
  13. <a-button
  14. :disabled="detailData==null"
  15. key="1"
  16. type="default"
  17. id="expenseManagementDetail-print-btn"
  18. @click="handlePrint('preview')">打印预览</a-button>
  19. <a-button
  20. :disabled="detailData==null"
  21. key="2"
  22. type="primary"
  23. class="button-error"
  24. id="expenseManagementDetail-print-btn"
  25. @click="handlePrint('print')">快捷打印</a-button>
  26. </template>
  27. </a-page-header>
  28. <!-- 基础信息 -->
  29. <a-card size="small" :bordered="false" class="expenseManagementDetail-cont" v-if="detailData">
  30. <a-collapse :activeKey="['1']">
  31. <a-collapse-panel key="1" header="基础信息">
  32. <a-descriptions size="small" :column="{ xs: 2, sm: 3, md: 4}">
  33. <a-descriptions-item label="费用单号">{{ detailData&&detailData.expenseAccountNo || '--' }}</a-descriptions-item>
  34. <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
  35. <a-descriptions-item label="申请部门">{{ detailData&&detailData.applyDepartmentName || '--' }}</a-descriptions-item>
  36. <a-descriptions-item label="费用类型">{{ detailData&&detailData.expenseTypeDictValue || '--' }}</a-descriptions-item>
  37. <a-descriptions-item label="费用发生月份">{{ detailData&&detailData.expenseDate?detailData.expenseDate.substring(0, 7) : '--' }}</a-descriptions-item>
  38. <a-descriptions-item label="合计金额">{{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? detailData.applyExpenseTotal+' 元' : '--' }}</a-descriptions-item>
  39. <a-descriptions-item label="状态">{{ detailData&&detailData.stateDictValue || '--' }}</a-descriptions-item>
  40. <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
  41. <a-descriptions-item label="审核时间">{{ detailData&&detailData.finishDate || '--' }}</a-descriptions-item>
  42. <a-descriptions-item label="主题" :span="3">{{ detailData&&detailData.title || '--' }}</a-descriptions-item>
  43. <a-descriptions-item label="详细说明" :span="4">
  44. {{ detailData.content.join(';')||'' }}
  45. </a-descriptions-item>
  46. <a-descriptions-item label="附件" :span="4">
  47. <a target="_blank" style="color: #00aaff;text-decoration: underline;margin-right: 15px;" :href="item.filePath" v-for="item in detailData.expenseAccountFilesList" :key="item.id">
  48. {{ item.fileName }}
  49. </a>
  50. </a-descriptions-item>
  51. </a-descriptions>
  52. </a-collapse-panel>
  53. </a-collapse>
  54. </a-card>
  55. <a-card size="small" :bordered="false" class="pages-wrap">
  56. <a-alert type="info" style="margin-bottom:10px">
  57. <div slot="message">
  58. 共<strong> {{ count }} </strong> 条费用明细,合计金额¥<strong v-if="detailData"> {{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? detailData.applyExpenseTotal+' 元' : '--' }} </strong>
  59. </div>
  60. </a-alert>
  61. <!-- 列表 -->
  62. <s-table
  63. class="sTable"
  64. ref="table"
  65. size="small"
  66. :rowKey="record => record.id"
  67. :columns="columns"
  68. :data="loadData"
  69. :showPagination="false"
  70. :defaultLoadData="true"
  71. bordered>
  72. <!-- 费用承担方 -->
  73. <template slot="fycdf" slot-scope="text,record">
  74. <div v-for="(item,index) in record.detailSplitList" :key="item.id+'-'+index">
  75. {{ item.splitObjName }}
  76. <span v-if="item.childDetailSplit&&item.childDetailSplit.splitObjName">/</span>
  77. {{ item.childDetailSplit?item.childDetailSplit.splitObjName:'' }}: ¥{{ item.childDetailSplit?item.childDetailSplit.splitAmount:item.splitAmount }}
  78. </div>
  79. </template>
  80. <!-- 产品信息 -->
  81. <template slot="cpxx" slot-scope="text,record">
  82. <div v-for="item in record.detailProductsList" :key="item.id">
  83. <div v-if="item.productCode">{{ item.productCode }}: ¥{{ item.expense }}</div>
  84. <div v-else-if="item.productBrandName">{{ item.productBrandName }}<span v-if="item.productTypeShowName">/</span>{{ item.productTypeShowName }}: ¥{{ item.expense }}</div>
  85. <div v-else>{{ item.productTypeShowName }}: ¥{{ item.expense }}</div>
  86. </div>
  87. <span v-if="!record.detailProductsList||record.detailProductsList.length==0">--</span>
  88. </template>
  89. </s-table>
  90. </a-card>
  91. </a-spin>
  92. <!-- 打印预览 -->
  93. <previewModal :showModal="showModal" @close="showModal=false" :detailSn="$route.params.sn" :detailData="detailData"></previewModal>
  94. <iframe id="printfsqd" name="printfsqd" hidden></iframe>
  95. </div>
  96. </template>
  97. <script>
  98. import { STable } from '@/components'
  99. import { expenseAccountDetail, expenseAcctDetailFindList } from '@/api/expenseManagement'
  100. import previewModal from './previewModal.vue'
  101. import { jGPrint } from '@/libs/JGPrint.js'
  102. export default {
  103. name: 'ExpenseReimbursementDetail',
  104. components: { STable, previewModal },
  105. data () {
  106. return {
  107. spinning: false,
  108. disabled: false,
  109. showModal: false, // 打印弹窗初始状态
  110. baseData: null,
  111. count: 0,
  112. // 加载数据方法 必须为 Promise 对象
  113. loadData: parameter => {
  114. this.spinning = true
  115. const params = Object.assign({ expenseAccountSn: this.$route.params.sn })
  116. return expenseAcctDetailFindList(params).then(res => {
  117. let data
  118. if (res.status == 200) {
  119. data = res.data
  120. this.count = res.data.length
  121. const no = 0
  122. for (var i = 0; i < data.length; i++) {
  123. data[i].no = no + i + 1
  124. }
  125. }
  126. this.spinning = false
  127. return data
  128. })
  129. },
  130. columns: [
  131. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  132. { title: '记账类型', dataIndex: 'accountTypeDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  133. { title: '记账名称', dataIndex: 'accountName', align: 'center', width: '14%', customRender: function (text) { return text || '--' } },
  134. { title: '所属区域', dataIndex: 'subareaName ', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  135. { title: '所属省份', dataIndex: 'provinceName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  136. { title: '所属城市', dataIndex: 'cityName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  137. { title: '记账费用', dataIndex: 'expense', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
  138. { title: '费用承担方', scopedSlots: { customRender: 'fycdf' }, align: 'center', width: '15%' },
  139. { title: '产品信息', scopedSlots: { customRender: 'cpxx' }, align: 'center', width: '15%' },
  140. { title: '备注', dataIndex: 'remarks', align: 'center', width: '10%', customRender: function (text) { return text || '--' } }
  141. ],
  142. chooseLoadData: [],
  143. detailData: null, // 详情数据
  144. total: 0
  145. }
  146. },
  147. methods: {
  148. // 返回
  149. handleBack () {
  150. this.$router.push({ name: 'expenseReimbursementList' })
  151. },
  152. // 打印
  153. handlePrint (type) {
  154. const html = document.getElementById('printTest').innerHTML
  155. // var iframe = document.getElementById('printfsqd')
  156. // var iframedoc = iframe.contentDocument || iframe.contentWindow.document
  157. // iframedoc.body.innerHTML = html
  158. // window.frames['printfsqd'].focus()
  159. // window.frames['printfsqd'].print()
  160. jGPrint(html, type)
  161. },
  162. // 详情
  163. getDetail () {
  164. this.spinning = true
  165. expenseAccountDetail({ expenseAccountSn: this.$route.params.sn }).then(res => {
  166. if (res.status == 200) {
  167. this.spinning = false
  168. this.detailData = res.data
  169. this.detailData.content = res.data.content.split('\n')
  170. this.$refs.table.refresh()
  171. } else {
  172. this.detailData = null
  173. }
  174. })
  175. }
  176. },
  177. mounted () {
  178. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  179. this.getDetail()
  180. }
  181. },
  182. activated () {
  183. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  184. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  185. this.getDetail()
  186. }
  187. },
  188. beforeRouteEnter (to, from, next) {
  189. next(vm => {})
  190. }
  191. }
  192. </script>
  193. <style lang="less">
  194. .expenseManagementDetail-wrap {
  195. .expenseManagementDetail-cont {
  196. margin-bottom: 10px;
  197. }
  198. .footer-cont{
  199. margin-top: 5px;
  200. text-align: center;
  201. }
  202. }
  203. </style>