kqdetail.vue 8.3 KB

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