index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view class="container">
  3. <cu-custom id="custom"
  4. bgImage="https://yostest175549.obs.cn-east-2.myhuaweicloud.com:443/202306151686796745663B52544232.png"
  5. :isBack="true">
  6. <block slot="backText">返回</block>
  7. <block slot="content">
  8. 签到记录
  9. </block>
  10. </cu-custom>
  11. <My_listbox ref="List" :pullDown="false">
  12. <view class="box">
  13. <uni-calendar :insert="true" :lunar="true" :selected="selected" @change="calendarOnChange"
  14. @monthSwitch="monthSwitch" />
  15. </view>
  16. <view class="item" v-for="item in list" :key="item.sys_signinid">
  17. <view class="time">
  18. {{ item.signintime || '' }}
  19. </view>
  20. <view class="address">
  21. <text class="iconfont icon-a-wodemendianxinxidizhi" /> {{ item.address || '' }}
  22. </view>
  23. <view class="remarks">
  24. 设备:{{ item.devicename || '--' }}
  25. </view>
  26. <view class="remarks">
  27. 说明:{{ item.remarks || '--' }}
  28. </view>
  29. <block v-if="item.attinfos">
  30. <view style="height: 6px;" />
  31. <my_files :attinfos="item.attinfos" />
  32. </block>
  33. </view>
  34. <view style="height: 22vw;" />
  35. </My_listbox>
  36. <view class="but-box">
  37. <view style="width: 75vw;">
  38. <u-button type="primary" text="签到" color="rgba(42,106,242,.7)" @click="toSignIn" />
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import my_files from "../../components/My_Files.vue";
  45. import { formatTime } from "../../utils/getTime"
  46. export default {
  47. name: "SignInIndex",
  48. components: { my_files },
  49. data() {
  50. return {
  51. signindate: '',
  52. year: "",
  53. month: "",
  54. selected: [],
  55. list: []
  56. }
  57. },
  58. onLoad() {
  59. this.init(formatTime().split(" ")[0])
  60. setTimeout(() => {
  61. this.$refs.List.setHeight();
  62. }, 350)
  63. },
  64. methods: {
  65. init(date) {
  66. this.queryDayList(date)
  67. let arr = date.split("-");
  68. this.queryMonthList(arr[0], arr[1]);
  69. },
  70. queryDayList(signindate, init = false) {
  71. if (this.signindate == signindate & !init) return;
  72. this.$Http.basic({
  73. "id": 20221229150101,
  74. "content": {
  75. signindate,
  76. "pageSize": 999,
  77. "querysubhr": 0 //是否查看下属
  78. }
  79. }).then(res => {
  80. console.log("查询日打卡记录", res)
  81. this.signindate = signindate;
  82. this.list = res.data
  83. })
  84. },
  85. queryMonthList(year, month, init = false) {
  86. if (this.year == year && this.month == month && !init) return;
  87. this.$Http.basic({
  88. "id": 20221229150001,
  89. "content": {
  90. year,
  91. month
  92. }
  93. }).then(res => {
  94. console.log("查询月份打卡记录", res)
  95. this.year = year;
  96. this.month = month;
  97. this.selected = res.data.map(v => {
  98. return {
  99. date: v,
  100. info: '打卡'
  101. }
  102. })
  103. })
  104. },
  105. /* 切换日期 */
  106. calendarOnChange(e) {
  107. this.init(e.fulldate)
  108. },
  109. /* 切换年月 */
  110. monthSwitch({ year, month }) {
  111. if (this.year == year && this.month == month) return;
  112. this.queryMonthList(year, month)
  113. },
  114. toSignIn() {
  115. uni.navigateTo({
  116. url: "./update"
  117. });
  118. this.$Http.signInUpdate = this.update.bind(this)
  119. },
  120. update() {
  121. this.queryDayList(this.signindate, true)
  122. this.queryMonthList(this.year, this.month, true)
  123. },
  124. }
  125. }
  126. </script>
  127. <style lang="scss" scoped>
  128. .box {
  129. width: 355px;
  130. margin: 10px auto 0;
  131. box-sizing: border-box;
  132. border-radius: 8px;
  133. overflow: hidden;
  134. }
  135. .item {
  136. width: 355px;
  137. margin: 10px auto;
  138. background: #fff;
  139. border-radius: 4px;
  140. padding: 10px;
  141. box-sizing: border-box;
  142. .time {
  143. font-size: 12px;
  144. }
  145. .address {
  146. font-size: 13px;
  147. .iconfont {
  148. font-size: 13px;
  149. color: #333;
  150. }
  151. margin-top: 4px;
  152. }
  153. .remarks {
  154. font-size: 12px;
  155. color: #333;
  156. margin-top: 4px;
  157. }
  158. }
  159. .but-box {
  160. position: absolute;
  161. width: 100vw;
  162. bottom: 30px;
  163. display: flex;
  164. justify-content: center;
  165. /deep/ .u-button__text,
  166. /deep/.u-button__loading-text {
  167. font-size: 14px !important;
  168. }
  169. /deep/.u-loading-icon__spinner {
  170. width: 17.25px !important;
  171. height: 17.25px !important;
  172. }
  173. }
  174. </style>