the_clock_record.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <view>
  3. <view class="uni-container">
  4. <view class="top">
  5. <view class="center">月份</view>
  6. <view @click='show=true'>{{createDate}}</view>
  7. <u-picker v-model="show" mode="time" @confirm='dateChange($event)' :params="params"></u-picker>
  8. </view>
  9. <uni-table border stripe emptyText="暂无更多数据">
  10. <!-- 表头行 -->
  11. <uni-tr>
  12. <uni-th align="center" width="50">日期</uni-th>
  13. <uni-th align="center" width="50">上班时间</uni-th>
  14. <uni-th align="center" width="50">下班时间</uni-th>
  15. </uni-tr>
  16. <!-- 表格数据行 -->
  17. <uni-tr v-for="(item, index) in tableData" :key="index">
  18. <uni-td align="center" style="height: 30px;">{{ item.createDate.split(" ")[0] }}</uni-td>
  19. <uni-td align="center">
  20. <view class="toClockDate" v-if="item.toClockDate">{{ item.toClockDate.split(" ")[1] }}</view>
  21. <view class="toClockDate" v-else-if="!item.toClockDate">
  22. <button v-if='item.status ==null' @click='supp(item)' class="uni-button" size="mini"
  23. type="primary" align="center" style="height: 30px;">补卡</button>
  24. <button @click='examine(item)' v-if='item.status=="审核中"'
  25. class='listitemStatus audit Regular' size="mini" type="primary" align="center"
  26. style="height: 30px;">审核中</button>
  27. <button v-if='item.status=="补卡失败"' class='listitemStatus notPass Regular' size="mini"
  28. type="primary" align="center" style="height: 30px;">补卡失败</button>
  29. <button v-if='item.status=="补卡成功"' class='listitemStatus pass Regular' size="mini"
  30. type="primary" align="center" style="height: 30px;">补卡成功</button>
  31. </view>
  32. </uni-td>
  33. <uni-td align="center">
  34. <view class="offClockDate" v-if="item.offClockDate">{{ item.offClockDate.split(" ")[1] }}</view>
  35. <view class="offClockDate" v-else-if="!item.offClockDate">
  36. <button v-if='item.status ==null' @click='supp' class="uni-button" size="mini"
  37. type="primary" align="center" style="height: 30px;">补卡</button>
  38. <button @click='examine(item)' v-if='item.status=="审核中"'
  39. class='listitemStatus audit Regular' size="mini" type="primary" align="center"
  40. style="height: 30px;">审核中</button>
  41. <button v-if='item.status=="补卡失败"' class='listitemStatus notPass Regular' size="mini"
  42. type="primary" align="center" style="height: 30px;">补卡失败</button>
  43. <button v-if='item.status=="补卡成功"' class='listitemStatus pass Regular' size="mini"
  44. type="primary" align="center" style="height: 30px;">补卡成功</button>
  45. </view>
  46. </uni-td>
  47. </uni-tr>
  48. </uni-table>
  49. <view v-if='show1' class="shade">
  50. <view class="wrap">
  51. <view class="alert-top">
  52. <view class="title">
  53. {{title}}
  54. </view>
  55. <u-icon name="close" class="close" color="#8890B1" @click="close()"></u-icon>
  56. </view>
  57. <view class="u-textarea-style">
  58. {{reasonForApplication}}
  59. </view>
  60. <view @click='rejectSubmit()' class="cancel">驳回</view>
  61. <view @click='passSubmit()' class="confirm">通过</view>
  62. </view>
  63. </view>
  64. <!-- <u-toast ref="uToast" />
  65. <view style='padding:10px;' class='flex bottom-btn'>
  66. <u-button v-if='isSHowBtn' @click='reject' type="error" class="btn1" hover-class='none'>驳回</u-button>
  67. <u-button v-if='isSHowBtn' @click='pass' type="success" class="btn2">通过</u-button>
  68. </view> -->
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. export default {
  74. data() {
  75. return {
  76. isSHowBtn: true,
  77. show1: false,
  78. show: false,
  79. tableData: [],
  80. pageSize: 10,
  81. reasonForApplication: '',
  82. currentPage: 1,
  83. params: {
  84. year: true,
  85. month: true
  86. },
  87. isLoadMore: false,
  88. title: "补卡申请",
  89. auditMind: "",
  90. }
  91. },
  92. onPullDownRefresh() {
  93. this.getList()
  94. setTimeout(function() {
  95. uni.stopPullDownRefresh(); //关闭下拉刷新
  96. }, 1000);
  97. },
  98. onShow() {
  99. this.getList()
  100. },
  101. onLoad(options) {
  102. let _day = new Date();
  103. _day.setTime(_day.getTime());
  104. this.createDate = _day.getFullYear() + "-" + (_day.getMonth() + 1);
  105. },
  106. onReachBottom() { //上拉触底函数
  107. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  108. this.currentPage += 1
  109. }
  110. this.getData()
  111. },
  112. methods: {
  113. examine(item) {
  114. this.show1 = true
  115. this.id = item.id
  116. this.reasonForApplication = item.reasonForApplication
  117. },
  118. dateChange(e) {
  119. console.log(e)
  120. this.createDate = e.year + "-" + e.month
  121. },
  122. getData() {
  123. this.isLoadMore = true
  124. this.$api.doRequest('get', '/clockInfo/selectClockInfo', {
  125. pageSize: this.pageSize,
  126. currentPage: this.currentPage,
  127. pcFlag: 0,
  128. // phone:uni.getStorageSync('pcUserInfo').userMobilePhone,
  129. compId: uni.getStorageSync('pcUserInfo').compId,
  130. commonId: uni.getStorageSync('pcUserInfo').userId,
  131. }).then(res => {
  132. if (res.data.code == 200) {
  133. this.isLoadMore = false
  134. this.tableData = this.tableData.concat(res.data.data.records)
  135. }
  136. })
  137. },
  138. getList() {
  139. this.isLoadMore = true
  140. this.$api.doRequest('get', '/clockInfo/selectClockInfo', {
  141. pageSize: this.pageSize,
  142. currentPage: this.currentPage,
  143. pcFlag: 0,
  144. compId: uni.getStorageSync('pcUserInfo').compId,
  145. commonId: uni.getStorageSync('pcUserInfo').userId,
  146. }).then(res => {
  147. if (res.data.code == 200) {
  148. this.isLoadMore = false
  149. this.tableData = res.data.data.records
  150. }
  151. })
  152. },
  153. close() {
  154. this.show1 = false
  155. },
  156. // 驳回
  157. rejectSubmit() {
  158. var that = this
  159. this.show1 = false
  160. uni.showModal({
  161. content: "是否确定驳回?",
  162. showCancel: true,
  163. confirmText: '确定',
  164. success: function(res) {
  165. if (res.confirm) {
  166. that.$api.doRequest('post', '/clockInfo/api/examineClock', {
  167. examineFlag: "2",
  168. id: that.id
  169. })
  170. .then(res => {
  171. if (res.data.code == 200) {
  172. that.$api.msg('提交成功')
  173. that.getList()
  174. } else {
  175. that.$api.msg('提交失败')
  176. }
  177. })
  178. }
  179. }
  180. })
  181. },
  182. //通过
  183. passSubmit() {
  184. var that = this
  185. this.show1 = false
  186. uni.showModal({
  187. content: "是否确定通过?",
  188. showCancel: true,
  189. confirmText: '确定',
  190. success: function(res) {
  191. if (res.confirm) {
  192. that.$api.doRequest('post', '/clockInfo/api/examineClock', {
  193. examineFlag: "1",
  194. id: that.id
  195. })
  196. .then(res => {
  197. if (res.data.code == 200) {
  198. that.$api.msg('提交成功')
  199. that.getList()
  200. } else {
  201. that.$api.msg('提交失败')
  202. }
  203. })
  204. }
  205. }
  206. })
  207. },
  208. supp(item) {
  209. uni.navigateTo({
  210. url: '/pages/clock/supp_clock' + `?id=${item.id}`,
  211. // url: item.url + `?companyId=${that.companyId}`
  212. })
  213. },
  214. }
  215. }
  216. </script>
  217. <style scoped lang="scss">
  218. uni-page-body {
  219. overflow: hidden;
  220. }
  221. .uni-container {
  222. margin: 10rpx;
  223. padding: 10rpx 10rpx 300rpx 10rpx;
  224. .top {
  225. border-radius: 20rpx;
  226. background: white;
  227. padding: 20rpx;
  228. display: flex;
  229. margin-bottom: 20rpx;
  230. align-items: center;
  231. .center {
  232. margin-right: 50rpx;
  233. }
  234. }
  235. }
  236. .listitemStatus.audit {
  237. color: #ffffff;
  238. margin-top: 6rpx;
  239. }
  240. .listitemStatus.notPass {
  241. color: #ffffff;
  242. margin-top: 6rpx;
  243. }
  244. .listitemStatus.pass {
  245. color: #ffffff;
  246. margin-top: 6rpx;
  247. }
  248. .row {
  249. display: flex;
  250. justify-content: space-between;
  251. border-bottom: 1px solid #EEEEEE;
  252. padding: 21rpx 0;
  253. .right,
  254. input {
  255. font-size: 28rpx;
  256. color: #333333;
  257. }
  258. }
  259. .uni-button {
  260. margin-top: 6rpx;
  261. }
  262. .shade {
  263. position: fixed;
  264. top: 0;
  265. left: 0;
  266. height: 100%;
  267. width: 100%;
  268. background: rgba(0, 0, 0, 0.4);
  269. z-index: 3;
  270. .wrap {
  271. position: absolute;
  272. left: 0;
  273. top: 0;
  274. right: 0;
  275. bottom: 0;
  276. margin: auto;
  277. background: #fff;
  278. width: calc(100% - 198rpx);
  279. height: 250px;
  280. border-radius: 20rpx;
  281. .alert-top {
  282. padding: 33rpx;
  283. display: flex;
  284. justify-content: center;
  285. align-items: center;
  286. position: relative;
  287. }
  288. .title {
  289. font-size: 32rpx;
  290. font-weight: 600;
  291. color: #333333;
  292. }
  293. .close {
  294. position: absolute;
  295. right: 33rpx;
  296. }
  297. }
  298. .u-textarea-style {
  299. margin: 20rpx;
  300. background: #F9F9FA;
  301. border-radius: 10px;
  302. border: 1px solid #EEEEEE;
  303. padding: 10rpx 20rpx;
  304. position: relative;
  305. height: 113px;
  306. .right-bottom {
  307. position: absolute;
  308. right: 20rpx;
  309. bottom: 20rpx;
  310. color: #AFB3BF;
  311. }
  312. }
  313. .cancel {
  314. position: absolute;
  315. display: inline-block;
  316. width: 50%;
  317. text-align: center;
  318. bottom: 0;
  319. padding: 10px;
  320. border-top: 1px solid #eee;
  321. font-size: 34rpx;
  322. }
  323. .confirm {
  324. position: absolute;
  325. display: inline-block;
  326. width: 50%;
  327. text-align: center;
  328. bottom: 0;
  329. padding: 10px;
  330. border-top: 1px solid #eee;
  331. font-size: 34rpx;
  332. }
  333. .cancel {
  334. left: 0;
  335. border-right: 1px solid #eee;
  336. color: #ff0000;
  337. }
  338. .confirm {
  339. right: 0;
  340. color: #22C572;
  341. }
  342. .bottom-btn {
  343. width: 100%;
  344. position: fixed;
  345. bottom: 0;
  346. display: flex;
  347. z-index: 2;
  348. left: 0;
  349. background-color: #f8f8f8;
  350. flex-direction: column;
  351. .btn1,
  352. .btn2 {
  353. width: 100%;
  354. margin-bottom: 26rpx;
  355. border-radius: 90rpx;
  356. }
  357. .btn1 {
  358. background: white;
  359. color: #00C265;
  360. }
  361. }
  362. }
  363. </style>