index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view>
  3. <uni-card>
  4. <uni-list>
  5. <uni-list-item v-for="(elem, index) in formElements" :key="index">
  6. <template v-slot:header>
  7. <text class="element_name">{{ elem.elementName }}</text>
  8. </template>
  9. <template v-slot:footer>
  10. <text class="element_value">{{ elem.defaultValue }}</text>
  11. </template>
  12. </uni-list-item>
  13. </uni-list>
  14. </uni-card>
  15. <uni-card v-if="repeatingTable.elementItem.length > 0">
  16. <button @click="handleRepeatingTable" type="primary">查看重复表</button>
  17. </uni-card >
  18. <uni-card v-if="fileList.length > 0" v-for="(item, index) in fileList" :key="index">
  19. <view>
  20. <attachment-list :attachments="item.files" ></attachment-list>
  21. </view>
  22. </uni-card>
  23. <uni-popup ref="repeatingTablePopup">
  24. <uni-card margin="0px" spacing="0px" padding="0px">
  25. <view class="repeating_table_container">
  26. <uni-table :border="true" stripe>
  27. <uni-tr>
  28. <uni-th align="center" v-for="(item, index) in repeatingTable.elementItem" :key="index">{{ item.elementName.slice(3, 5) }}</uni-th>
  29. </uni-tr>
  30. <uni-tr v-for="(item, index) in (repeatingTable.elements.length / repeatingTable.elementItem.length)" :key="index">
  31. <uni-td align="center" v-for="col in repeatingTable.elementItem.length" :key="col">
  32. <!-- (列数 - 1) * 总行数 + 当前行数 -->
  33. {{repeatingTable.elements[(col-1)*(repeatingTable.elements.length / repeatingTable.elementItem.length) + index]!.defaultValue}}
  34. </uni-td>
  35. </uni-tr>
  36. </uni-table>
  37. </view>
  38. </uni-card>
  39. </uni-popup>
  40. </view>
  41. </template>
  42. <script setup lang="ts">
  43. import { onMounted, reactive, ref } from 'vue'
  44. import { onLoad } from '@dcloudio/uni-app'
  45. import attachmentList from '@/components/ygoa/attachmentList.vue'
  46. import { getProcessInfo } from '@/api/process.js'
  47. import { useUserStore } from '@/store/user.js'
  48. const userStore = useUserStore()
  49. const processInfo = reactive({
  50. insId: '',
  51. insName: ''
  52. })
  53. onLoad(({insId, insName}) => {
  54. // 获取传入的标题参数
  55. const title = insName || '流程信息';
  56. processInfo.insId = insId
  57. processInfo.insName = insName
  58. // 设置导航栏标题
  59. uni.setNavigationBarTitle({
  60. title: title
  61. });
  62. })
  63. onMounted(() => {
  64. initProcessInfo()
  65. })
  66. const formElements = ref([])
  67. const repeatingTable = ref({
  68. elements: [],
  69. elementItem: [],
  70. })
  71. const fileList = ref([])
  72. function initProcessInfo() {
  73. getProcessInfo(userStore.user.useId, processInfo.insId).then(({ returnParams }) => {
  74. formElements.value = returnParams.formElements
  75. repeatingTable.value = returnParams.repeatingTable
  76. fileList.value = returnParams.fileList
  77. console.log('fileList', fileList.value);
  78. })
  79. }
  80. const repeatingTablePopup = ref(null)
  81. function handleRepeatingTable() {
  82. console.log('handleRepeatingTable', repeatingTable);
  83. repeatingTablePopup.value.open()
  84. }
  85. </script>
  86. <style lang="scss">
  87. .element_name {
  88. width: 10rem;
  89. }
  90. .element_value {
  91. width: 100%;
  92. }
  93. .repeating_table_container {
  94. width: 98vw;
  95. .uni-table-scroll {
  96. max-height: 80vh;
  97. .uni-table {
  98. min-width: 100% !important;
  99. .uni-table-th {
  100. min-width: 50px;
  101. background-color: #2979ff;
  102. font-weight: bold;
  103. color: #fcfcfc;
  104. }
  105. }
  106. }
  107. }
  108. </style>