the_clock_record.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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(item)' 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. this.getList()
  122. },
  123. getData() {
  124. this.isLoadMore = true
  125. this.$api.doRequest('get', '/clockInfo/selectClockInfo', {
  126. pageSize: this.pageSize,
  127. currentPage: this.currentPage,
  128. pcFlag: 0,
  129. // phone:uni.getStorageSync('pcUserInfo').userMobilePhone,
  130. compId: uni.getStorageSync('pcUserInfo').compId,
  131. commonId: uni.getStorageSync('pcUserInfo').userId,
  132. }).then(res => {
  133. if (res.data.code == 200) {
  134. this.isLoadMore = false
  135. this.tableData = this.tableData.concat(res.data.data.records)
  136. }
  137. })
  138. },
  139. getList() {
  140. this.isLoadMore = true
  141. this.$api.doRequest('get', '/clockInfo/selectClockInfo', {
  142. pageSize: this.pageSize,
  143. currentPage: this.currentPage,
  144. pcFlag: 0,
  145. yearMonth: this.createDate,
  146. compId: uni.getStorageSync('pcUserInfo').compId,
  147. commonId: uni.getStorageSync('pcUserInfo').userId,
  148. }).then(res => {
  149. if (res.data.code == 200) {
  150. this.isLoadMore = false
  151. this.tableData = res.data.data.records
  152. }
  153. })
  154. },
  155. close() {
  156. this.show1 = false
  157. },
  158. // 驳回
  159. rejectSubmit() {
  160. var that = this
  161. this.show1 = false
  162. uni.showModal({
  163. content: "是否确定驳回?",
  164. showCancel: true,
  165. confirmText: '确定',
  166. success: function(res) {
  167. if (res.confirm) {
  168. that.$api.doRequest('post', '/clockInfo/api/examineClock', {
  169. examineFlag: "2",
  170. id: that.id
  171. })
  172. .then(res => {
  173. if (res.data.code == 200) {
  174. that.$api.msg('提交成功')
  175. that.getList()
  176. } else {
  177. that.$api.msg('提交失败')
  178. }
  179. })
  180. }
  181. }
  182. })
  183. },
  184. //通过
  185. passSubmit() {
  186. var that = this
  187. this.show1 = false
  188. uni.showModal({
  189. content: "是否确定通过?",
  190. showCancel: true,
  191. confirmText: '确定',
  192. success: function(res) {
  193. if (res.confirm) {
  194. that.$api.doRequest('post', '/clockInfo/api/examineClock', {
  195. examineFlag: "1",
  196. id: that.id
  197. })
  198. .then(res => {
  199. if (res.data.code == 200) {
  200. that.$api.msg('提交成功')
  201. that.getList()
  202. } else {
  203. that.$api.msg('提交失败')
  204. }
  205. })
  206. }
  207. }
  208. })
  209. },
  210. supp(item) {
  211. uni.navigateTo({
  212. url: '/pages/clock/supp_clock' + `?id=${item.id}`,
  213. // url: item.url + `?companyId=${that.companyId}`
  214. })
  215. },
  216. }
  217. }
  218. </script>
  219. <style scoped lang="scss">
  220. uni-page-body {
  221. overflow: hidden;
  222. }
  223. .uni-container {
  224. margin: 10rpx;
  225. padding: 10rpx 10rpx 300rpx 10rpx;
  226. .top {
  227. border-radius: 20rpx;
  228. background: white;
  229. padding: 20rpx;
  230. display: flex;
  231. margin-bottom: 20rpx;
  232. align-items: center;
  233. .center {
  234. margin-right: 50rpx;
  235. }
  236. }
  237. }
  238. .listitemStatus.audit {
  239. color: #ffffff;
  240. margin-top: 6rpx;
  241. }
  242. .listitemStatus.notPass {
  243. color: #ffffff;
  244. margin-top: 6rpx;
  245. }
  246. .listitemStatus.pass {
  247. color: #ffffff;
  248. margin-top: 6rpx;
  249. }
  250. .row {
  251. display: flex;
  252. justify-content: space-between;
  253. border-bottom: 1px solid #EEEEEE;
  254. padding: 21rpx 0;
  255. .right,
  256. input {
  257. font-size: 28rpx;
  258. color: #333333;
  259. }
  260. }
  261. .uni-button {
  262. margin-top: 6rpx;
  263. }
  264. .shade {
  265. position: fixed;
  266. top: 0;
  267. left: 0;
  268. height: 100%;
  269. width: 100%;
  270. background: rgba(0, 0, 0, 0.4);
  271. z-index: 3;
  272. .wrap {
  273. position: absolute;
  274. left: 0;
  275. top: 0;
  276. right: 0;
  277. bottom: 0;
  278. margin: auto;
  279. background: #fff;
  280. width: calc(100% - 198rpx);
  281. height: 250px;
  282. border-radius: 20rpx;
  283. .alert-top {
  284. padding: 33rpx;
  285. display: flex;
  286. justify-content: center;
  287. align-items: center;
  288. position: relative;
  289. }
  290. .title {
  291. font-size: 32rpx;
  292. font-weight: 600;
  293. color: #333333;
  294. }
  295. .close {
  296. position: absolute;
  297. right: 33rpx;
  298. }
  299. }
  300. .u-textarea-style {
  301. margin: 20rpx;
  302. background: #F9F9FA;
  303. border-radius: 10px;
  304. border: 1px solid #EEEEEE;
  305. padding: 10rpx 20rpx;
  306. height: 113px;
  307. .right-bottom {
  308. // position: absolute;
  309. right: 20rpx;
  310. bottom: 20rpx;
  311. color: #AFB3BF;
  312. }
  313. }
  314. .cancel {
  315. position: absolute;
  316. display: inline-block;
  317. width: 50%;
  318. text-align: center;
  319. bottom: 0;
  320. padding: 10px;
  321. border-top: 1px solid #eee;
  322. font-size: 34rpx;
  323. }
  324. .confirm {
  325. position: absolute;
  326. display: inline-block;
  327. width: 50%;
  328. text-align: center;
  329. bottom: 0;
  330. padding: 10px;
  331. border-top: 1px solid #eee;
  332. font-size: 34rpx;
  333. }
  334. .cancel {
  335. left: 0;
  336. border-right: 1px solid #eee;
  337. color: #ff0000;
  338. }
  339. .confirm {
  340. right: 0;
  341. color: #22C572;
  342. }
  343. .bottom-btn {
  344. width: 100%;
  345. // position: fixed;
  346. bottom: 0;
  347. display: flex;
  348. z-index: 2;
  349. left: 0;
  350. background-color: #f8f8f8;
  351. flex-direction: column;
  352. .btn1,
  353. .btn2 {
  354. width: 100%;
  355. margin-bottom: 26rpx;
  356. border-radius: 90rpx;
  357. }
  358. .btn1 {
  359. background: white;
  360. color: #00C265;
  361. }
  362. }
  363. }
  364. </style>