rule.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view class="safe-area-inset-bottom" @click="tooltipShow=false">
  3. <view class="card">
  4. <view class="flex">
  5. <view class="avatar">
  6. <open-data style="width: 120rpx;height: 120rpx; " type="userAvatarUrl"></open-data>
  7. </view>
  8. <view class="name">
  9. <text>{{userInfo.realName || '黄明潘'}}</text>
  10. </view>
  11. </view>
  12. <view class="desc">
  13. <text>打卡规则:{{ruleTimes[0].workTime}} 至 {{ruleTimes[0].offWorkTime}}</text>
  14. </view>
  15. </view>
  16. <view class="card" style="padding-top: 20rpx;">
  17. <view class="title">
  18. <text>打卡时间</text>
  19. </view>
  20. <view class="padding-top-20">
  21. <text class="text-bold">上下班时间</text>
  22. </view>
  23. <view class="tag-time" >
  24. <view class="left">
  25. <view class="margin-10" v-for="(item,index) in weeks" :key="index">
  26. <u-tag mode="plain" :text="switchWeek(item)" type="success" />
  27. </view>
  28. </view>
  29. <view class="right">
  30. <text>{{ruleTimes[0].workTime}} ~ {{ruleTimes[0].offWorkTime}}</text>
  31. </view>
  32. </view>
  33. <view class="padding-top-30">
  34. <text class="text-bold">特殊日期</text>
  35. </view>
  36. <view class="tag-time " style="border-bottom: 1rpx dashed #DEDEDE;padding:20rpx 0 10rpx;">
  37. <view class="left" style="width: 80%;">
  38. <view v-if="item.isMust==1" class="margin-10" @click.stop="showTips(item,1)" :id="'id'+item.id" v-for="(item,index) in ruleSpecTimes" :key="index">
  39. <u-tag mode="plain" :text="item.date" type="primary" />
  40. </view>
  41. </view>
  42. <view class="right" style="width: 20%;">
  43. <text>必须打卡</text>
  44. </view>
  45. </view>
  46. <view class="tag-time " style="padding:10rpx 0 10rpx;">
  47. <view class="left" style="width: 80%;" >
  48. <view v-if="item.isMust==0" class="margin-10" v-for="(item,index) in ruleSpecTimes" :key="index">
  49. <u-tag mode="plain" :text="item.date" type="error" />
  50. </view>
  51. </view>
  52. <view class="right" style="width: 20%;">
  53. <text>无须打卡</text>
  54. </view>
  55. </view>
  56. <view class="padding-top-20" v-if="ruleTimes[0].allowFlex==1">
  57. <view class="">
  58. <text class="text-bold">弹性时间</text>
  59. </view>
  60. <view style="margin: 20rpx 10rpx;" >
  61. <text class="cuIcon-title margin-right-10"></text>
  62. <text>允许迟到{{ruleTimes[0].flexOnDutyTime}}分钟</text>
  63. </view>
  64. <view style="margin: 20rpx 10rpx;" >
  65. <text class="cuIcon-title margin-right-10"></text>
  66. <text>允许早退{{ruleTimes[0].flexOffDutyTime}}分钟</text>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="card" style="padding-top: 20rpx;">
  71. <view class="title">
  72. <text>打卡范围</text>
  73. </view>
  74. <view class="padding-top-20" v-if="!$isEmpty(locations)">
  75. <view class="">
  76. <text class="text-bold">打卡地点</text>
  77. </view>
  78. <view class="tag-time">
  79. <view class="left" style="width: 100%;">
  80. <view class="cu-tag line-green round" :id="'id'+item.id" @click.stop="showTips(item,2)" style="margin: 10rpx 10rpx 10rpx 0;" v-for="(item,index) in locations" :key="index">
  81. <u-icon name="map-fill"></u-icon>
  82. <text class="margin-left-10">{{item.address}}</text>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="padding-top-20" v-if="!$isEmpty(wifiList)">
  88. <view class="">
  89. <text class="text-bold">打卡WiFi</text>
  90. </view>
  91. <view class="tag-time" >
  92. <view class="left" style="width: 100%;">
  93. <view class="cu-tag line-blue round" style="margin: 10rpx 20rpx 10rpx 0;" v-for="(item,index) in wifiList" :key="index">
  94. <u-icon name="wifi"></u-icon>
  95. <text class="margin-left-10">{{item.name}}</text>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="card" style="padding-top: 20rpx;">
  102. <view class="title" style="padding-bottom: 20rpx;">
  103. <text>其他规则</text>
  104. </view>
  105. <view v-if="vuex_punch_rules.needPhone==1" style="margin: 20rpx 10rpx;" >
  106. <text class="cuIcon-title margin-right-10"></text>
  107. <text>员工打卡必须拍照</text>
  108. </view>
  109. <view v-if="vuex_punch_rules.useFaceDetect==1" style="margin: 20rpx 10rpx;" >
  110. <text class="cuIcon-title margin-right-10"></text>
  111. <text>员工打卡必须进行人脸识别验证</text>
  112. </view>
  113. <view v-if="vuex_punch_rules.noteCanUseLocalPic==1" style="margin: 20rpx 10rpx;" >
  114. <text class="cuIcon-title margin-right-10"></text>
  115. <text>备注允许上传图片</text>
  116. </view>
  117. <view style="margin: 20rpx 10rpx;" >
  118. <text class="cuIcon-title margin-right-10"></text>
  119. <text v-if="vuex_punch_rules.optionOutRange==0">允许范围外打卡,记录为地点异常</text>
  120. <text v-if="vuex_punch_rules.optionOutRange==1">允许范围外打卡,记录为正常外勤</text>
  121. <text v-if="vuex_punch_rules.optionOutRange==2">不允许范围外打卡</text>
  122. </view>
  123. </view>
  124. <view class="statistical">
  125. <view class="tag" @click="jump('/punch/pages/statistical/statistical')">
  126. 打卡统计
  127. </view>
  128. </view>
  129. <tooltips
  130. gravity="top"
  131. :tooltipShow="tooltipShow"
  132. :btns="tooltipBtns"
  133. :eleId="eleId"
  134. @btnClick="sortTooltipClick"></tooltips>
  135. </view>
  136. </template>
  137. <script>
  138. import tooltips from '@/components/tooltips/tooltips.vue'
  139. export default {
  140. components:{
  141. tooltips
  142. },
  143. data() {
  144. return {
  145. userInfo:{},
  146. //是否显示
  147. tooltipShow:false,
  148. tooltipBtns:['...'],
  149. //点击元素
  150. eleId:"",
  151. ruleSpecTimes:[],
  152. ruleTimes:[],
  153. locations:[],
  154. wifiList:[],
  155. weeks:[]
  156. }
  157. },
  158. onShow() {
  159. this.userInfo=getApp().globalData.userInfo
  160. },
  161. onLoad() {
  162. this.init()
  163. },
  164. methods: {
  165. jump(url){
  166. if (!this.$isEmpty(url)) {
  167. uni.navigateTo({
  168. url
  169. })
  170. }
  171. },
  172. init(){
  173. this.ruleTimes=this.vuex_punch_rules.ruleTimes
  174. this.ruleSpecTimes=this.vuex_punch_rules.ruleSpecTimes
  175. this.locations=this.vuex_punch_rules.locations
  176. this.wifiList=this.vuex_punch_rules.wifiList
  177. this.weeks=this.ruleTimes[0].workDays.split(",")
  178. },
  179. showTips(item,type){
  180. this.tooltipBtns=[]
  181. if (type==1) {
  182. this.tooltipBtns.push(item.beginTime)
  183. this.tooltipBtns.push(item.endTime)
  184. }else if (type==2) {
  185. this.tooltipBtns.push('打卡范围'+item.area+'米')
  186. }
  187. this.tooltipShow = true;
  188. this.eleId ='id'+item.id;
  189. },
  190. sortTooltipClick(e){
  191. console.log(e);
  192. }
  193. },
  194. computed:{
  195. switchWeek(){
  196. return (val)=>{
  197. val=parseInt(val)
  198. let week=''
  199. switch (val){
  200. case 0:
  201. week='星期日'
  202. break;
  203. case 1:
  204. week='星期一'
  205. break;
  206. case 2:
  207. week='星期二'
  208. break;
  209. case 3:
  210. week='星期三'
  211. break;
  212. case 4:
  213. week='星期四'
  214. break;
  215. case 5:
  216. week='星期五'
  217. break;
  218. case 6:
  219. week='星期六'
  220. break;
  221. default:
  222. week='未知'
  223. break;
  224. }
  225. return week
  226. }
  227. }
  228. },
  229. }
  230. </script>
  231. <style lang="scss">
  232. page{
  233. background-color: #f7f7f9;
  234. }
  235. .card{
  236. margin: 20rpx;
  237. border-radius: 20rpx;
  238. padding: 30rpx;
  239. background-color: #FFFFFF;
  240. .avatar{
  241. display: block;
  242. overflow:hidden;
  243. width: 60rpx;
  244. height: 60rpx;
  245. left: 50%;
  246. border-radius: 50%;
  247. }
  248. .name{
  249. padding-left: 15rpx;
  250. font-size: 34rpx;
  251. font-weight: 800;
  252. display: flex;
  253. justify-content: center;
  254. align-items: center;
  255. }
  256. .desc{
  257. padding-top: 10rpx;
  258. font-size: 28rpx;
  259. color: #717171;
  260. text{
  261. padding-top: 10rpx;
  262. display: block;
  263. }
  264. }
  265. .title{
  266. font-size: 32rpx;
  267. padding-bottom: 20rpx;
  268. font-weight: 800;
  269. color: $base-color;
  270. border-bottom: 1rpx solid $dt-border-color-sm;
  271. }
  272. .tag-time{
  273. padding-top: 30rpx;
  274. display: flex;
  275. .left{
  276. display: flex;
  277. flex-wrap: wrap;
  278. width: 70%;
  279. }
  280. .right{
  281. width: 30%;
  282. display: flex;
  283. justify-content: center;
  284. align-items: center;
  285. }
  286. }
  287. }
  288. .statistical{
  289. position: fixed;
  290. bottom: 30%;
  291. right: -25rpx;
  292. .tag{
  293. background-color: $base-color;
  294. color: #FFFFFF;
  295. padding: 15rpx 40rpx;
  296. border-radius: 5000upx;
  297. }
  298. }
  299. </style>