detail.vue 13 KB

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