detail.vue 12 KB

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