detail.vue 9.8 KB

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