kqdetail.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <view style="padding-bottom: 140rpx;background-color: #fff;overflow: hidden;">
  3. <uni-table ref="table" border stripe emptyText="暂无更多数据">
  4. <uni-tr>
  5. <uni-th width="300rpx" align="center">日期</uni-th>
  6. <uni-th align="center">考勤</uni-th>
  7. </uni-tr>
  8. <uni-tr>
  9. <uni-td align="center">
  10. <view class="name">
  11. <view>
  12. 星期一
  13. </view>
  14. <view>
  15. {{weekList[0]}}
  16. </view>
  17. </view>
  18. </uni-td>
  19. <uni-td align="center" width="200rpx">
  20. <view class="select">
  21. 上午:
  22. <uni-data-select v-model="list.mondayMorning" :localdata="range" @change="change"
  23. :clear="false"></uni-data-select>
  24. </view>
  25. <view class="select" style="margin-top: 40rpx;">
  26. 下午:
  27. <uni-data-select v-model="list.mondayAfternoon" :localdata="range" @change="change"
  28. :clear="false"></uni-data-select>
  29. </view>
  30. </uni-td>
  31. </uni-tr>
  32. <uni-tr>
  33. <uni-td align="center">
  34. <view class="name">
  35. <view>
  36. 星期二
  37. </view>
  38. <view>
  39. {{weekList[1]}}
  40. </view>
  41. </view>
  42. </uni-td>
  43. <uni-td align="center" width="200rpx">
  44. <view class="select">
  45. 上午:
  46. <uni-data-select v-model="list.tuesdayMorning" :localdata="range" @change="change"
  47. :clear="false"></uni-data-select>
  48. </view>
  49. <view class="select" style="margin-top: 40rpx;">
  50. 下午:
  51. <uni-data-select v-model="list.tuesdayAfternoon" :localdata="range" @change="change"
  52. :clear="false"></uni-data-select>
  53. </view>
  54. </uni-td>
  55. </uni-tr>
  56. <uni-tr>
  57. <uni-td align="center">
  58. <view class="name">
  59. <view>
  60. 星期三
  61. </view>
  62. <view>
  63. {{weekList[2]}}
  64. </view>
  65. </view>
  66. </uni-td>
  67. <uni-td align="center" width="200rpx">
  68. <view class="select">
  69. 上午:
  70. <uni-data-select v-model="list.wednesdayMorning" :localdata="range" @change="change"
  71. :clear="false"></uni-data-select>
  72. </view>
  73. <view class="select" style="margin-top: 40rpx;">
  74. 下午:
  75. <uni-data-select v-model="list.wednesdayAfternoon" :localdata="range" @change="change"
  76. :clear="false"></uni-data-select>
  77. </view>
  78. </uni-td>
  79. </uni-tr>
  80. <uni-tr>
  81. <uni-td align="center">
  82. <view class="name">
  83. <view>
  84. 星期四
  85. </view>
  86. <view>
  87. {{weekList[3]}}
  88. </view>
  89. </view>
  90. </uni-td>
  91. <uni-td align="center" width="200rpx">
  92. <view class="select">
  93. 上午:
  94. <uni-data-select v-model="list.thursdayMorning" :localdata="range" @change="change"
  95. :clear="false"></uni-data-select>
  96. </view>
  97. <view class="select" style="margin-top: 40rpx;">
  98. 下午:
  99. <uni-data-select v-model="list.thursdayAfternoon" :localdata="range" @change="change"
  100. :clear="false"></uni-data-select>
  101. </view>
  102. </uni-td>
  103. </uni-tr>
  104. <uni-tr>
  105. <uni-td align="center">
  106. <view class="name">
  107. <view>
  108. 星期五
  109. </view>
  110. <view>
  111. {{weekList[4]}}
  112. </view>
  113. </view>
  114. </uni-td>
  115. <uni-td align="center" width="200rpx">
  116. <view class="select">
  117. 上午:
  118. <uni-data-select v-model="list.fridayMorning" :localdata="range" @change="change"
  119. :clear="false"></uni-data-select>
  120. </view>
  121. <view class="select" style="margin-top: 40rpx;">
  122. 下午:
  123. <uni-data-select v-model="list.fridayAfternoon" :localdata="range" @change="change"
  124. :clear="false"></uni-data-select>
  125. </view>
  126. </uni-td>
  127. </uni-tr>
  128. <uni-tr>
  129. <uni-td align="center">
  130. <view class="name">
  131. <view>
  132. 星期六
  133. </view>
  134. <view>
  135. {{weekList[5]}}
  136. </view>
  137. </view>
  138. </uni-td>
  139. <uni-td align="center" width="200rpx">
  140. <view class="select">
  141. 上午:
  142. <uni-data-select v-model="list.saturdayMorning" :localdata="range" @change="change"
  143. :clear="false"></uni-data-select>
  144. </view>
  145. <view class="select" style="margin-top: 40rpx;">
  146. 下午:
  147. <uni-data-select v-model="list.saturdayAfternoon" :localdata="range" @change="change"
  148. :clear="false"></uni-data-select>
  149. </view>
  150. </uni-td>
  151. </uni-tr>
  152. <uni-tr>
  153. <uni-td align="center">
  154. <view class="name">
  155. <view>
  156. 星期日
  157. </view>
  158. <view>
  159. {{weekList[6]}}
  160. </view>
  161. </view>
  162. </uni-td>
  163. <uni-td align="center" width="200rpx">
  164. <view class="select">
  165. 上午:
  166. <uni-data-select v-model="list.sundayMorning" :localdata="range" @change="change"
  167. :clear="false"></uni-data-select>
  168. </view>
  169. <view class="select" style="margin-top: 40rpx;">
  170. 下午:
  171. <uni-data-select v-model="list.sundayAfternoon" :localdata="range" @change="change"
  172. :clear="false"></uni-data-select>
  173. </view>
  174. </uni-td>
  175. </uni-tr>
  176. </uni-table>
  177. <view style="width: 100vw;position: fixed;bottom: 0;left: 0;padding: 20rpx;background-color: #fff;box-sizing: border-box;z-index: 999;">
  178. <u-button type="primary" text="保存" @click="save"></u-button>
  179. </view>
  180. </view>
  181. </template>
  182. <script>
  183. import {
  184. getNowWeekList
  185. } from "@/utils/wjw.js"
  186. export default {
  187. data() {
  188. return {
  189. list: {
  190. beginTime: null,
  191. createBy: null,
  192. createTime: null,
  193. deptId: null,
  194. endTime: null,
  195. fridayAfternoon: "0",
  196. fridayMorning: "0",
  197. fullName: null,
  198. id: null,
  199. isSave: null,
  200. loginDeptId: null,
  201. mondayAfternoon: "0",
  202. mondayMorning: "0",
  203. remark: null,
  204. saturdayAfternoon: "11",
  205. saturdayMorning: "11",
  206. sumTableDate: null,
  207. sundayAfternoon: "11",
  208. sundayMorning: "11",
  209. thursdayAfternoon: "0",
  210. thursdayMorning: "0",
  211. tuesdayAfternoon: "0",
  212. tuesdayMorning: "0",
  213. updateBy: null,
  214. updateTime: null,
  215. userId: null,
  216. wednesdayAfternoon: "0",
  217. wednesdayMorning: "0",
  218. weekEnd: null,
  219. weekNumber: null,
  220. weekStart: null,
  221. },
  222. //本周日期列表
  223. weekList: [],
  224. //下拉框
  225. range: []
  226. }
  227. },
  228. onLoad(options) {
  229. this.list.userId = options.id
  230. this.list.deptId = options.deptId
  231. this.list.fullName = options.name
  232. this.list.weekNumber = options.weekNumber
  233. uni.setNavigationBarTitle({
  234. title:options.name+'本周考勤列表',
  235. color:'#fff'
  236. })
  237. this.getDay()
  238. this.getDicts('info_kq')
  239. // setTimeout(() => {
  240. this.getDk(options.id, options.weekNumber)
  241. // }, 1500)
  242. },
  243. methods: {
  244. getDay() {
  245. let day = uni.$u.timeFormat(new Date().toLocaleDateString(), 'yyyy-mm-dd')
  246. this.weekList = getNowWeekList(day)
  247. },
  248. // 查询字典数据详细
  249. getDicts(dictType) {
  250. uni.$u.http.get('/system/dict/data/type/' + dictType).then(res => {
  251. // console.log(res)
  252. this.range = res.data.map(item => {
  253. let obj = {
  254. value: item.dictValue,
  255. text: item.dictLabel
  256. }
  257. return obj
  258. })
  259. })
  260. },
  261. //查询打卡记录
  262. getDk(id, num) {
  263. uni.$u.http.post('/oa/attendance/selectOnePerson', {
  264. userId: id,
  265. weekNumber: num
  266. }).then(res => {
  267. console.log(res == '')
  268. if (res == '') {
  269. } else {
  270. this.list = res
  271. }
  272. })
  273. },
  274. //选择打卡
  275. change(e) {
  276. },
  277. //提交保存打卡
  278. save(){
  279. uni.showLoading({
  280. title:"保存中...",
  281. mask:true
  282. })
  283. this.list.weekStart = this.weekList[0]
  284. this.list.weekEnd = this.weekList[6]
  285. uni.$u.http.post('/oa/attendance/dtkq',this.list).then(res=>{
  286. uni.hideLoading()
  287. uni.showToast({
  288. title:"保存成功",
  289. mask:true
  290. })
  291. setTimeout(()=>{
  292. uni.$emit('query' , {a : 1});
  293. uni.navigateBack()
  294. },1800)
  295. }).catch(res=>{
  296. uni.hideLoading()
  297. })
  298. }
  299. }
  300. }
  301. </script>
  302. <style lang="scss">
  303. .select {
  304. display: flex;
  305. align-items: center;
  306. }
  307. // ::v-deep .uni-select__selector{
  308. // height: 200px;
  309. // overflow: auto;
  310. // }
  311. </style>