detailModal.vue 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <a-modal
  3. centered
  4. class="expenseManagementDetail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="详情"
  8. v-model="isShow"
  9. @cancle="isShow=false"
  10. :width="600">
  11. <!-- 详情 -->
  12. <div>
  13. <a-descriptions :column="1" size="default">
  14. <a-descriptions-item label="费用单号">{{ detailsData&&detailsData.accountExpensesSn || '--' }}</a-descriptions-item>
  15. <a-descriptions-item label="费用类型">
  16. <div v-if="detailsData&&(detailsData.expensesTypeName1 || detailsData.expensesTypeName2 || detailsData.expensesTypeName3)">
  17. {{ detailsData&&detailsData.expensesTypeName1 ? detailsData.expensesTypeName1 : '' }}
  18. <span v-if="(detailsData&&detailsData.expensesTypeName1) && (detailsData&&detailsData.expensesTypeName2)"> > </span>
  19. {{ detailsData&&detailsData.expensesTypeName2 ? detailsData.expensesTypeName2 : '' }}
  20. <span v-if="(detailsData&&detailsData.expensesTypeName2) && (detailsData&&detailsData.expensesTypeName3)"> > </span>
  21. {{ detailsData&&detailsData.expensesTypeName3 ? detailsData.expensesTypeName3 : '' }}
  22. </div>
  23. <span v-else>--</span>
  24. </a-descriptions-item>
  25. <a-descriptions-item label="费用金额">¥{{ detailsData&&detailsData.settleAmount || '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="单据状态">{{ detailsData&&detailsData.stateDictValue || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="备注">{{ detailsData&&detailsData.remark || '--' }}</a-descriptions-item>
  28. </a-descriptions>
  29. <div class="btn-cont"><a-button id="expenseManagementDetail-modal-back" @click="isShow = false">返回列表</a-button></div>
  30. </div>
  31. </a-modal>
  32. </template>
  33. <script>
  34. import { findExpenseDetail } from '@/api/settleExpense'
  35. export default {
  36. name: 'ExpenseManagementDetailModal',
  37. props: {
  38. openModal: { // 弹框显示状态
  39. type: Boolean,
  40. default: false
  41. },
  42. itemId: {
  43. type: [Number, String],
  44. default: ''
  45. }
  46. },
  47. data () {
  48. return {
  49. isShow: this.openModal, // 是否打开弹框
  50. detailsData: null
  51. }
  52. },
  53. methods: {
  54. // 获取详情
  55. getDetail () {
  56. findExpenseDetail({ id: this.itemId }).then(res => {
  57. if (res.status == 200) {
  58. this.detailsData = res.data
  59. } else {
  60. this.detailsData = null
  61. }
  62. })
  63. }
  64. },
  65. watch: {
  66. // 父页面传过来的弹框状态
  67. openModal (newValue, oldValue) {
  68. this.isShow = newValue
  69. },
  70. // 重定义的弹框状态
  71. isShow (newValue, oldValue) {
  72. if (!newValue) {
  73. this.$emit('close')
  74. this.detailsData = null
  75. }
  76. },
  77. itemId (newValue, oldValue) {
  78. if (this.isShow && newValue) {
  79. this.getDetail()
  80. }
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="less">
  86. .expenseManagementDetail-modal{
  87. .ant-modal-body {
  88. padding: 40px 40px 24px;
  89. }
  90. .btn-cont {
  91. text-align: center;
  92. margin: 35px 0 10px;
  93. }
  94. }
  95. </style>