logDetail.uvue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <!-- #ifdef APP -->
  3. <scroll-view style="flex:1">
  4. <!-- #endif -->
  5. <!-- 报告基础信息 -->
  6. <view class="section">
  7. <view class="info-item">
  8. <text class="label">日志内容</text>
  9. <text class="value">{{ log.content}}</text>
  10. </view>
  11. <view class="info-item">
  12. <text class="label">日志模块</text>
  13. <text class="value">{{ log.module}}</text>
  14. </view>
  15. </view>
  16. <view class="section">
  17. <uni-table>
  18. <uni-tr class="section-title" v-for="(item,index) in titleList" :key="index">
  19. <uni-td class="grid-text">{{item.title1}}</uni-td>
  20. <uni-td class="grid-text">{{item.title2}}</uni-td>
  21. <uni-td class="grid-text">{{item.title3}}</uni-td>
  22. </uni-tr>
  23. <uni-tr class="section-title" >
  24. <uni-td class="grid-text">{{log.dataid ===0 ? "新增":"变更"}}</uni-td>
  25. <uni-td class="grid-text">
  26. <text :class="{
  27. 'bg-green bg-text': log.status === 1,
  28. 'bg-red bg-text': log.status === 0
  29. }">
  30. {{log.status===1?"操作成功":"操作失败"}}
  31. </text>
  32. </uni-td>
  33. <uni-td class="grid-text">
  34. {{ log.dataid===0? log.createtime:log.updatetime }}
  35. </uni-td>
  36. </uni-tr>
  37. </uni-table>
  38. </view>
  39. <view class="section">
  40. <view class="info-item">
  41. <text class="label">日志传参</text>
  42. <text class="value">{{ log.params}}</text>
  43. </view>
  44. </view>
  45. <!-- #ifdef APP -->
  46. </scroll-view>
  47. <!-- #endif -->
  48. </template>
  49. <script setup>
  50. import {
  51. ref,
  52. onMounted
  53. } from 'vue'
  54. import { getList, Download, TaskProcess, getRecordCalculate, RecordCalculate, statusDict } from '@/api/work';
  55. //自定义返回行为,覆盖系统默认返回按钮
  56. const backPressOptions = reactive({
  57. from: 'backbutton'
  58. } as OnBackPressOptions)
  59. const titleList = [{
  60. title1: "类型", title2: "操作结果", title3: "操作时间"
  61. }];
  62. type Log = {
  63. id : number,
  64. module : string,
  65. dataid : number,
  66. content : string,
  67. status : number,
  68. params : string,
  69. updatetime : string,
  70. createtime: string
  71. }
  72. const log = ref<Log>({
  73. id: 0,
  74. module: "",
  75. dataid: 0,
  76. content: "",
  77. status: 0,
  78. params: "",
  79. updatetime: "",
  80. createtime: "",
  81. })
  82. // #ifdef H5
  83. log.value = {
  84. id: 1,
  85. module: "app_media_info",
  86. dataid: 0,
  87. content : "新增数据成功",
  88. params: "1CFA1040-00#S",
  89. createtime: "2025-06-23",
  90. updatetime: "2025-06-23",
  91. status: 1
  92. }
  93. // #endif
  94. onLoad((options) => {
  95. const logId = options?.id ?? ""
  96. // 模拟数据加载,建议替换为后端接口请求
  97. // #ifdef APP-ANDROID
  98. //获取下载产品数据
  99. getList('app_log', 'id', logId, null, null, null).then((res : UTSJSONObject) => {
  100. console.log(res)
  101. let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
  102. if (dataList != null && dataList.length > 0) {
  103. dataList.forEach(item => {
  104. if (item != null) {
  105. let data = JSON.parse<Log>(item.toJSONString());
  106. if (data != null) {
  107. log.value = data
  108. }
  109. }
  110. });
  111. }
  112. })
  113. // #endif
  114. })
  115. const goBack = () => {
  116. uni.navigateBack()
  117. }
  118. defineExpose({
  119. backPressOptions
  120. })
  121. </script>
  122. <style scoped>
  123. .container {
  124. padding: 40rpx;
  125. background-color: #f5f7fa;
  126. flex: 1;
  127. box-sizing: border-box;
  128. }
  129. .banner {
  130. background: linear-gradient(135deg, #2193b0, #6dd5ed);
  131. border-radius: 24rpx;
  132. padding: 40rpx 30rpx;
  133. margin-bottom: 40rpx;
  134. box-shadow: 0 8rpx 16rpx rgba(33, 147, 176, 0.3);
  135. }
  136. .banner-title {
  137. color: white;
  138. font-size: 36rpx;
  139. font-weight: bold;
  140. text-align: center;
  141. }
  142. .section {
  143. background-color: #fff;
  144. border-radius: 20rpx;
  145. padding: 30rpx;
  146. margin-bottom: 30rpx;
  147. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.05);
  148. }
  149. .section-title {
  150. display: flex;
  151. flex-direction: row;
  152. flex: 1;
  153. }
  154. .info-item {
  155. display: flex;
  156. justify-content: space-between;
  157. /* #ifdef APP-NVUE */
  158. font-size: 28rpx;
  159. color: #666;
  160. /* #endif */
  161. margin-bottom: 18rpx;
  162. flex-direction: row;
  163. }
  164. .section-content {
  165. font-size: 28rpx;
  166. color: #444;
  167. line-height: 1.8;
  168. white-space: normal;
  169. }
  170. .grid-text {
  171. /* #ifdef APP-NVUE */
  172. font-size: 24rpx;
  173. color: #000;
  174. /* #endif */
  175. padding: 10rpx 0 10rpx 0rpx;
  176. box-sizing: border-box;
  177. margin: 5rpx 5rpx;
  178. min-width: 200rpx;
  179. }
  180. .footer-btn {
  181. margin-top: 40rpx;
  182. display: flex;
  183. justify-content: center;
  184. }
  185. .main-btn {
  186. width: 80%;
  187. padding: 28rpx 0;
  188. font-size: 30rpx;
  189. color: #fff;
  190. border: none;
  191. border-radius: 100rpx;
  192. background: linear-gradient(to right, #36d1dc, #5b86e5);
  193. box-shadow: 0 10rpx 24rpx rgba(91, 134, 229, 0.3);
  194. }
  195. .label {
  196. font-weight: bold;
  197. color: #102a43;
  198. min-width: 150rpx;
  199. margin-right: 30rpx;
  200. }
  201. .value {
  202. flex: 1;
  203. /* #ifdef APP-NVUE */
  204. white-space: nowrap;
  205. text-overflow: ellipsis;
  206. /* #endif */
  207. overflow: hidden;
  208. margin-left: 30rpx;
  209. }
  210. .my-radius {
  211. border-radius: 10rpx;
  212. }
  213. .bg-text {
  214. width: 150rpx;
  215. min-width: 150rpx;
  216. border-radius: 10rpx;
  217. text-align: center;
  218. }
  219. .bg-green {
  220. background-color: seagreen;
  221. color: #fff;
  222. }
  223. .bg-yellow {
  224. background-color: yellow;
  225. }
  226. .bg-black {
  227. background-color: #102a43;
  228. color: #fff;
  229. }
  230. .bg-red {
  231. background-color: red;
  232. color: #fff;
  233. }
  234. .ft-red {
  235. color: red;
  236. }
  237. </style>