index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="content">
  3. <Nav :title="title" isBack isRight @goBack="handelBack" />
  4. <view id="luckysheet"
  5. style="margin:0px;padding:0px;position:absolute;width:100%;height:87%;left: 0px;top: 80rpx;">
  6. </view>
  7. <view class="btn">
  8. <u-button type="primary" size="middle" text="运行记录" @click="openRecord" hoverStayTime="0"></u-button>
  9. </view> -->
  10. <!-- 运行记录弹框 -->
  11. <u-popup :show="show" mode="center" :customStyle="{'padding':'10rpx','width':'80%'}">
  12. <uni-table stripe emptyText="暂无更多数据">
  13. <!-- 表头行 -->
  14. <uni-tr>
  15. <uni-th align="center">运行记录</uni-th>
  16. </uni-tr>
  17. <!-- 表格数据行 -->
  18. <view v-for="item in recordList" :key="item.id" @click="recordDetail(item.id)">
  19. <uni-tr>
  20. <uni-td class="uni-td" align="center">{{item.reportTableName}}</uni-td>
  21. </uni-tr>
  22. </view>
  23. </uni-table>
  24. <u-button size="middle" type="primary" text="关闭" @click="show=false" style="margin-top:10rpx"
  25. hoverStayTime="0">
  26. </u-button>
  27. </u-popup>
  28. <u-empty mode="data" icon="../../../static/data.png" v-if="!option">
  29. </u-empty>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. id: null,
  37. title: null,
  38. option: {},
  39. show: false,
  40. page: 1,
  41. limit: 10,
  42. recordList: [],
  43. }
  44. },
  45. onLoad(options) {
  46. this.id = options.id
  47. },
  48. onReady() {
  49. if (this.id) {
  50. this.getReportDetail()
  51. }
  52. },
  53. methods: {
  54. //返回按钮
  55. handelBack() {
  56. uni.switchTab({
  57. url: '/pages/reportForm/index'
  58. });
  59. },
  60. //表格详情接口
  61. getReportDetail() {
  62. uni.$http.get('/reportTable/getReportTableById/' + this.id).then(res => {
  63. const data = res.data
  64. if (data.code === 200) {
  65. this.title = data.data.reportTableName
  66. const tableData = JSON.parse(data.data.reportTableData)
  67. this.option = tableData.option
  68. if (this.option) {
  69. tableData.option.allowEdit = false
  70. this.showToolbar(tableData)
  71. luckysheet.create(this.option)
  72. }
  73. }
  74. })
  75. },
  76. showToolbar(tableData) {
  77. tableData.showtoolbar = false
  78. this.option.enableAddRow = false
  79. this.option.enableAddBackTop = false
  80. let data = tableData.option.showtoolbarConfig
  81. for (let item in data) {
  82. data[item] = false
  83. }
  84. },
  85. //查看记录按钮
  86. openRecord() {
  87. this.show = true
  88. this.getRecord()
  89. },
  90. //获取运行记录接口
  91. getRecord() {
  92. uni.$http.get('/reportTable/getAutoChReportTable', {
  93. page: this.page,
  94. limit: this.limit,
  95. autoTableId: this.id
  96. }).then(({
  97. data
  98. }) => {
  99. if (data.code === 200) {
  100. this.recordList = data.data.reportTableList
  101. }
  102. })
  103. },
  104. //运行记录详情
  105. recordDetail(id) {
  106. uni.navigateTo({
  107. url: '/pages/reportForm/report-detail/recordDetail?id=' + id
  108. })
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. ::v-deep .luckysheet_info_detail_back {
  115. display: none !important;
  116. }
  117. ::v-deep .u-button {
  118. width: 160rpx;
  119. height: 60rpx
  120. }
  121. .btn {
  122. position: absolute;
  123. left: 50%;
  124. bottom: 2%;
  125. margin-left: -80rpx;
  126. }
  127. .uni-td {
  128. width: 600rpx;
  129. overflow: hidden;
  130. text-overflow: ellipsis;
  131. }
  132. </style>