detail.vue 14 KB

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