detail.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="page-detail">
  3. <view class="page-center">
  4. <uni-section title="清单名称" type="line" style="margin-top: 0" />
  5. <text style="padding-left: 20rpx">{{ detail.name }}</text>
  6. <!-- 表单数据 -->
  7. <template v-if="formList.length > 0">
  8. <uni-section title="表单数据" type="line" />
  9. <uni-forms class="form" label-align="right" :labelWidth="100">
  10. <uni-forms-item
  11. v-for="item in formList"
  12. :label="item.name"
  13. name="email"
  14. >
  15. <view class="content">{{ item.value.join(",") }}</view>
  16. </uni-forms-item>
  17. </uni-forms>
  18. </template>
  19. <!-- 附件信息 -->
  20. <template v-if="attachments.length > 0">
  21. <uni-section title="附件信息" type="line" />
  22. <view class="attachment" v-for="item in attachments" :key="item.id">
  23. <!-- {{item.name}} -->
  24. <previewFile :src="item.url" :name="item.name" />
  25. </view>
  26. </template>
  27. <!-- 审批信息 -->
  28. <uni-section title="审批信息" type="line" />
  29. <uni-steps
  30. :options="auditList"
  31. :active="currentStep"
  32. direction="column"
  33. />
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import { getOAAuditDetail } from "@/services/oa";
  39. export default {
  40. data() {
  41. return {
  42. id: -1,
  43. detail: {},
  44. auditList: [],
  45. currentStep: 0,
  46. };
  47. },
  48. computed: {
  49. formList() {
  50. const form = this.detail?.form;
  51. if (!form) {
  52. return [];
  53. }
  54. try {
  55. const formDatas = JSON.parse(form);
  56. if (formDatas && formDatas.length) {
  57. return formDatas.filter((item) => item.type !== "DIYTable");
  58. }
  59. return [];
  60. } catch {
  61. return [];
  62. }
  63. },
  64. attachments() {
  65. if (this.detail?.Files?.length) {
  66. return this.detail.Files;
  67. }
  68. return [];
  69. },
  70. },
  71. onLoad(query) {
  72. if (query?.id !== undefined) {
  73. this.id = Number(query.id);
  74. } else {
  75. return;
  76. }
  77. this.getDetail();
  78. },
  79. methods: {
  80. getDetail() {
  81. getOAAuditDetail(this.id)
  82. .then((result) => {
  83. this.detail = result;
  84. this.getAuditList(result.OaAuditList, result.AuditorInfo);
  85. })
  86. .catch((err) => {
  87. console.log(err);
  88. });
  89. },
  90. getAuditList(list, currentAuditor) {
  91. // 填充审核人列表
  92. if (list && list.length) {
  93. this.auditList = list.map((item, index) => {
  94. if (currentAuditor.ID === item.auditor) {
  95. this.currentStep = index;
  96. }
  97. return {
  98. title: item.seq_name,
  99. desc: `审核人:${item.AuditorUser.CName || "-"}`,
  100. };
  101. });
  102. }
  103. },
  104. },
  105. };
  106. </script>
  107. <style lang="less" scoped>
  108. .page-detail {
  109. min-height: 100vh;
  110. padding: 20rpx 30rpx 40rpx;
  111. background: url("~@/static/index/bg.png") no-repeat center;
  112. background-size: cover;
  113. background-attachment: fixed;
  114. .page-center {
  115. padding: 30rpx;
  116. padding-top: 0;
  117. background-color: #fff;
  118. }
  119. }
  120. .btns {
  121. display: flex;
  122. margin-top: 40rpx;
  123. }
  124. .excel-detail {
  125. color: #2f42ca;
  126. text-decoration: underline;
  127. padding-left: 20rpx;
  128. }
  129. .form {
  130. width: 90%;
  131. margin: 0 auto;
  132. .content {
  133. line-height: 44rpx;
  134. padding: 14rpx;
  135. word-break: break-all;
  136. }
  137. }
  138. .attachment {
  139. padding-left: 20rpx;
  140. margin-bottom: 20rpx;
  141. }
  142. </style>