detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. <span style="margin: 0 15px;color: #666;font-weight: bold;">单号:{{ detailData&&detailData.expenseAccountNo || '--' }}</span>
  11. <span style="margin: 0 10px;color: #666;">申请人:{{ detailData&&detailData.applyPersonName }}</span>
  12. <a-button type="link" size="small" class="button-default" @click="showDetail=!showDetail">
  13. <a-icon :type="showDetail ? 'eye-invisible' : 'eye'"/> {{ showDetail?'隐藏':'查看' }}信息
  14. </a-button>
  15. </template>
  16. <!-- 操作区,位于 title 行的行尾 -->
  17. <template slot="extra">
  18. <a-button
  19. :disabled="detailData==null"
  20. key="1"
  21. type="default"
  22. v-if="$hasPermissions('B_eRPrint')"
  23. id="expenseManagementDetail-print-btn"
  24. @click="handlePrint('preview')">打印预览</a-button>
  25. <a-button
  26. :disabled="detailData==null"
  27. key="2"
  28. type="primary"
  29. class="button-info"
  30. v-if="$hasPermissions('B_eRPrint')"
  31. id="expenseManagementDetail-print-btn"
  32. @click="handlePrint('print')">快捷打印</a-button>
  33. </template>
  34. </a-page-header>
  35. <!-- 基础信息 -->
  36. <a-card size="small" :bordered="false" class="expenseManagementDetail-cont" v-show="showDetail">
  37. <a-descriptions size="small" :column="{ xs: 2, sm: 3, md: 4}" v-if="detailData">
  38. <a-descriptions-item label="费用单号">{{ detailData&&detailData.expenseAccountNo || '--' }}</a-descriptions-item>
  39. <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
  40. <a-descriptions-item label="申请部门">{{ detailData&&detailData.applyDepartmentName || '--' }}</a-descriptions-item>
  41. <a-descriptions-item label="费用类型">{{ detailData&&detailData.expenseTypeName || '--' }}<span v-if="detailData&&detailData.expenseType2">/{{ detailData&&detailData.expenseTypeName2 || '--' }}</span></a-descriptions-item>
  42. <a-descriptions-item label="费用发生月份">{{ detailData&&detailData.expenseDate?detailData.expenseDate.substring(0, 7) : '--' }}</a-descriptions-item>
  43. <a-descriptions-item label="合计金额">{{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? toThousands(detailData.applyExpenseTotal)+' 元' : '--' }}</a-descriptions-item>
  44. <a-descriptions-item label="状态">{{ detailData&&detailData.stateDictValue || '--' }}</a-descriptions-item>
  45. <a-descriptions-item label="打印状态">{{ detailData&&detailData.printStatusDictValue || '--' }}</a-descriptions-item>
  46. <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
  47. <a-descriptions-item label="审核时间">{{ detailData&&detailData.finishDate || '--' }}</a-descriptions-item>
  48. <a-descriptions-item label="关联单号" v-if="detailData&&detailData.bizNo">{{ detailData&&detailData.bizNo || '--' }}</a-descriptions-item>
  49. <a-descriptions-item label="主题" :span="3">{{ detailData&&detailData.title || '--' }}</a-descriptions-item>
  50. <a-descriptions-item label="详细说明" :span="4">
  51. {{ detailData.content.join(',')||'' }}
  52. </a-descriptions-item>
  53. <a-descriptions-item label="附件" :span="4">
  54. <a target="_blank" style="color: #00aaff;text-decoration: underline;margin-right: 15px;" :href="item.filePath" v-for="item in detailData.expenseAccountFilesList" :key="item.id">
  55. {{ item.fileName }}
  56. </a>
  57. </a-descriptions-item>
  58. </a-descriptions>
  59. </a-card>
  60. <a-card size="small" :bordered="false" class="pages-wrap">
  61. <a-alert type="info" style="margin-bottom:10px">
  62. <div slot="message">
  63. 共<strong> {{ count }} </strong> 条费用明细,合计金额¥<strong v-if="detailData"> {{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? toThousands(detailData.applyExpenseTotal)+' 元' : '--' }} </strong>
  64. </div>
  65. </a-alert>
  66. <!-- 列表 -->
  67. <s-table
  68. class="sTable"
  69. ref="table"
  70. size="small"
  71. :rowKey="record => record.id"
  72. :columns="columns"
  73. :data="loadData"
  74. :showPagination="false"
  75. :defaultLoadData="false"
  76. bordered>
  77. <!-- 记账名称 -->
  78. <template slot="jzname" slot-scope="text,record">
  79. <div>{{ text }}</div>
  80. <div v-if="record.accountNameFnumber">({{ record.accountNameFnumber }})</div>
  81. </template>
  82. <!-- 费用承担方 -->
  83. <template slot="fycdf" slot-scope="text,record">
  84. <div v-for="(item,index) in record.detailSplitList" :key="item.id+'-'+index">
  85. {{ item.splitObjName }}
  86. <span v-if="item.splitObjFnumber">({{ item.splitObjFnumber }})</span>
  87. <span v-if="item.childDetailSplit&&item.childDetailSplit.splitObjName">/</span>
  88. {{ item.childDetailSplit?item.childDetailSplit.splitObjName:'' }}: ¥{{ item.childDetailSplit?item.childDetailSplit.splitAmount:item.splitAmount }}
  89. </div>
  90. </template>
  91. <!-- 产品信息 -->
  92. <template slot="cpxx" slot-scope="text,record">
  93. <div v-for="item in record.detailProductsList" :key="item.id">
  94. <div v-if="item.productCode">{{ item.productCode }}</div>
  95. <div v-else-if="item.productBrandName">{{ item.productBrandName }}<span v-if="item.productTypeShowName">/</span>{{ item.productTypeShowName }}</div>
  96. <div v-else>{{ item.productTypeShowName }}</div>
  97. </div>
  98. <span v-if="!record.detailProductsList||record.detailProductsList.length==0">--</span>
  99. </template>
  100. </s-table>
  101. </a-card>
  102. </a-spin>
  103. <!-- 打印预览 -->
  104. <commonModal
  105. modalTit="费用报销单打印预览"
  106. width="700pt"
  107. okText="立即打印"
  108. :openModal="showTipModal"
  109. @cancel="showTipModal=false"
  110. @ok="$refs.printModal.prints()">
  111. <previewModal v-if="printType=='preview'" ref="printModal" @printOk="printOk"></previewModal>
  112. </commonModal>
  113. <!-- 快捷打印 -->
  114. <div style="height:0;overflow: hidden;">
  115. <previewModal v-if="printType=='print'" ref="printModal" @printOk="printOk"></previewModal>
  116. </div>
  117. </div>
  118. </template>
  119. <script>
  120. import { commonMixin } from '@/utils/mixin'
  121. import { STable } from '@/components'
  122. import commonModal from '@/views/common/commonModal.vue'
  123. import { expenseAccountDetail, expenseAcctDetailFindList, getProcessInstance, expenseAccountUpdateBatch } from '@/api/expenseManagement'
  124. import previewModal from './previewModal.vue'
  125. export default {
  126. name: 'ExpenseReimbursementListDetail',
  127. mixins: [commonMixin],
  128. components: { STable, previewModal, commonModal },
  129. data () {
  130. const _this = this
  131. return {
  132. spinning: false,
  133. disabled: false,
  134. baseData: null,
  135. showTipModal: false,
  136. showDetail: false,
  137. printType:'',
  138. count: 0,
  139. columns: [
  140. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  141. { title: '记账类型', dataIndex: 'accountTypeDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  142. { title: '记账名称', dataIndex: 'accountName', scopedSlots: { customRender: 'jzname' }, align: 'center', width: '14%' },
  143. { title: '所属区域', dataIndex: 'subareaNames', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  144. { title: '所属分区', dataIndex: 'subareaAreaName', width: '6%', align: 'center', 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: 'right', width: '10%', customRender: function (text) { return (text || text == 0) ? _this.toThousands(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. // 加载数据方法 必须为 Promise 对象
  153. loadData: parameter => {
  154. this.spinning = true
  155. const params = Object.assign({ expenseAccountSn: this.$route.params.sn })
  156. return expenseAcctDetailFindList(params).then(res => {
  157. let data
  158. if (res.status == 200) {
  159. data = res.data
  160. this.count = res.data.length
  161. const no = 0
  162. for (var i = 0; i < data.length; i++) {
  163. data[i].no = no + i + 1
  164. }
  165. }
  166. this.spinning = false
  167. return data
  168. })
  169. },
  170. chooseLoadData: [],
  171. detailData: null, // 详情数据
  172. total: 0
  173. }
  174. },
  175. methods: {
  176. // 返回
  177. handleBack () {
  178. this.$router.push({ name: 'expenseReimbursementList' })
  179. },
  180. // 打印
  181. async handlePrint (type) {
  182. this.printType = type
  183. this.spinning = true
  184. // 费用明细
  185. const fyListData = await expenseAcctDetailFindList({ expenseAccountSn: this.$route.params.sn }).then(res => res.data)
  186. // 审核明细,待提交状态不获取
  187. const spListData = this.detailData.state != 'WAIT_SUBMIT' ? await getProcessInstance({ businessType: 'EXPENSES', businessSn: this.$route.params.sn }).then(res => res.data) : null
  188. // 打印预览弹框
  189. if (type == 'preview') {
  190. this.showTipModal = true
  191. }
  192. this.$nextTick(() => {
  193. this.$refs.printModal.setData([{
  194. expenseInfo: this.detailData,
  195. fyListData,
  196. spListData: spListData || []
  197. }])
  198. // 立即打印
  199. if (type == 'print') {
  200. setTimeout(() => {
  201. this.$refs.printModal.prints()
  202. }, 500)
  203. }
  204. this.spinning = false
  205. })
  206. },
  207. printOk (data) {
  208. if (data && data.status == 200) {
  209. expenseAccountUpdateBatch([{
  210. id: this.detailData.id,
  211. printStatus: 'PRINT'
  212. }]).then(res => {
  213. if (res.status == 200) {
  214. this.getDetail()
  215. }
  216. this.spinning = false
  217. this.showTipModal = false
  218. })
  219. } else {
  220. this.spinning = false
  221. }
  222. },
  223. // 详情
  224. getDetail () {
  225. this.spinning = true
  226. this.detailData = null
  227. expenseAccountDetail({ expenseAccountSn: this.$route.params.sn }).then(res => {
  228. if (res.status == 200) {
  229. this.spinning = false
  230. this.detailData = res.data
  231. this.detailData.content = res.data.content.replace(/\n+/, '\n').split('\n')
  232. this.$nextTick(() => {
  233. this.$refs.table.refresh()
  234. })
  235. } else {
  236. this.detailData = null
  237. }
  238. })
  239. }
  240. },
  241. mounted () {
  242. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  243. this.getDetail()
  244. }
  245. },
  246. activated () {
  247. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  248. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  249. this.getDetail()
  250. }
  251. },
  252. beforeRouteEnter (to, from, next) {
  253. next(vm => {})
  254. }
  255. }
  256. </script>
  257. <style lang="less">
  258. .expenseManagementDetail-wrap {
  259. .expenseManagementDetail-cont {
  260. margin-bottom: 6px;
  261. }
  262. .pages-wrap{
  263. min-height: calc(100vh - 140px);
  264. }
  265. .footer-cont{
  266. margin-top: 5px;
  267. text-align: center;
  268. }
  269. }
  270. </style>