internshipReport.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view style="padding: 20rpx 30rpx;">
  3. <view class="d-flex align-center">
  4. <uni-section title="企业:"></uni-section>
  5. <uni-data-picker v-model="enterpriseId" class="picker" :localdata="companyList" placeholder="请选择要查看的企业" popup-title="选择企业" @change="getList" :map="{ text: 'enterpriseName', value: 'id' }"></uni-data-picker>
  6. <button type="primary" size="mini" @click="getList" style="height: 35px; line-height: 35px; margin: 0;">刷新</button>
  7. </view>
  8. <view class="line ss-m-y-20"></view>
  9. <view v-if="items.length > 0" class="wrapper">
  10. <view v-for="(item,index) in items" :key="index" style="margin: 0 0 50rpx 0;">
  11. <uni-section :title="item.date" type="line"></uni-section>
  12. <view>
  13. <image v-for="(url, i) in item.arr" :key="i" class="img" :src="url" mode="scaleToFill" @click="previewImage(item.arr,i)"></image>
  14. </view>
  15. </view>
  16. </view>
  17. <view v-else class="nodata-img-parent">
  18. <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" class="nodata-img-child"></image>
  19. </view>
  20. <view class="bottom-sticky">
  21. <button type="primary" size="default" class="recomm-button" @click="addReport">新增实习报告</button>
  22. </view>
  23. </view>
  24. </template>
  25. <script setup>
  26. import { ref } from 'vue'
  27. import { getStudentReportList, getStudentPracticeCompanyList } from '@/api/student.js'
  28. import { onLoad, onShow } from '@dcloudio/uni-app'
  29. import { formatName } from '@/utils/getText'
  30. const enterpriseId = ref(null)
  31. const items = ref([])
  32. const companyList = ref([])
  33. const getCompanyList = async () => {
  34. try {
  35. const { data } = await getStudentPracticeCompanyList()
  36. data?.length && data.forEach(e => {
  37. e.id = e.id.toString()
  38. e.enterpriseName = formatName(e.anotherName || e.name)
  39. })
  40. companyList.value = data || []
  41. } catch {}
  42. }
  43. // 实习报告列表
  44. const getList = async () => {
  45. try {
  46. const { data } = await getStudentReportList(enterpriseId.value ? { enterpriseId: enterpriseId.value } : {})
  47. items.value = []
  48. if (!data || !Object.keys(data).length) return
  49. for (let item in data) {
  50. items.value.push({ date: item, arr: data[item].map(e => e.url) })
  51. }
  52. } catch {}
  53. }
  54. onShow(() => {
  55. console.log('onShow:', 789)
  56. getCompanyList()
  57. getList()
  58. })
  59. onLoad((options) => {
  60. console.log('onLoad:', 789)
  61. if (options.enterpriseId) {
  62. enterpriseId.value = options.enterpriseId
  63. }
  64. getList()
  65. })
  66. const addReport = () => {
  67. if (!companyList.value?.length) {
  68. uni.showToast({
  69. title: '没有查到实习企业记录!',
  70. icon: 'none'
  71. })
  72. return
  73. }
  74. const list = JSON.stringify(companyList.value)
  75. uni.navigateTo({ url: `/pagesA/student/addReport?companyList=${list}` })
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .img{
  80. width: 28%;
  81. height: 200rpx;
  82. margin: 10rpx;
  83. border: 1px solid #f4f4f4;
  84. }
  85. .wrapper{
  86. height: 84vh;
  87. overflow: auto;
  88. }
  89. :deep(.uni-section .uni-section-header__decoration) {
  90. background-color: #00B760 !important;
  91. }
  92. .line {
  93. border-top: 1px solid #ccc;
  94. }
  95. .picker {
  96. flex: 1;
  97. overflow: hidden;
  98. margin-right: 12px;
  99. }
  100. .reportPopup {
  101. width: 96vw;
  102. .uploadTip {
  103. color: #00B760;
  104. margin-bottom: 20px;
  105. font-size: 13px;
  106. }
  107. .dialog-title {
  108. display: flex;
  109. justify-content: space-between;
  110. align-items: center;
  111. color:#767a82;
  112. padding: 20rpx;
  113. .title {
  114. font-weight: bold;
  115. margin-left: 10rpx;
  116. }
  117. }
  118. .dialog-content{
  119. padding: 20rpx;
  120. padding-bottom: 50rpx;
  121. }
  122. .dialog-bottom{
  123. width: 100%;
  124. height: 44px;
  125. line-height: 44px;
  126. text-align: center;
  127. color: #fff !important;
  128. background-color: #00B760 !important;
  129. }
  130. }
  131. .upload-img{
  132. position: relative;
  133. width: 200rpx;
  134. height: 200rpx;
  135. border: 1px solid #f1f1f1;
  136. margin: 10rpx;
  137. }
  138. .upload-file{
  139. width: 200rpx;
  140. height: 200rpx;
  141. border: 1px solid #f1f1f1;
  142. margin: 10rpx;
  143. display: flex;
  144. justify-content: center;
  145. align-items: center;
  146. border-radius: 10rpx;
  147. }
  148. </style>