addRules.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <view class="container">
  3. <!-- 每一个选项区域 -->
  4. <view class="box">
  5. <view class="name">
  6. 规则名称:
  7. </view>
  8. <view class="val" @click="goPageRuleName">
  9. <view class="ele" v-if="ruleName=='未设置'">
  10. {{ruleName}}
  11. </view>
  12. <view class="ele black" v-else>
  13. {{ruleName}}
  14. </view>
  15. <view class="right">
  16. <img src="../../static/right.png">
  17. </view>
  18. </view>
  19. </view>
  20. <view class="box">
  21. <view class="name">
  22. 考 勤 组:
  23. </view>
  24. <view class="val" @click="goPageGroup">
  25. <view class="ele" v-if="group=='未设置'">
  26. {{group}}
  27. </view>
  28. <view class="ele black" v-else>
  29. {{group}}
  30. </view>
  31. <view class="right">
  32. <img src="../../static/right.png">
  33. </view>
  34. </view>
  35. </view>
  36. <view class="box">
  37. <view class="name">
  38. 打卡时间:
  39. </view>
  40. <view class="val" @click="goPagePunchTime">
  41. <view class="ele" v-if="time=='未设置'">
  42. {{time}}
  43. </view>
  44. <view class="ele black" v-else>
  45. {{time}}
  46. </view>
  47. <view class="right">
  48. <img src="../../static/right.png">
  49. </view>
  50. </view>
  51. </view>
  52. <view class="box">
  53. <view class="name">
  54. 打卡地点:
  55. </view>
  56. <view class="val" @click="goPagePunchLocation">
  57. <view class="ele" v-if="place=='未设置'">
  58. {{place}}
  59. </view>
  60. <view class="ele black" v-else>
  61. {{place}}
  62. </view>
  63. <view class="right">
  64. <img src="../../static/right.png">
  65. </view>
  66. </view>
  67. </view>
  68. <view class="box">
  69. <view class="name">
  70. 提前通知:
  71. </view>
  72. <picker :value="index" :range="array" @change="changeSelect">
  73. <view class="val">
  74. <view class="ele" v-if="value=='未设置'">
  75. {{value}}
  76. </view>
  77. <view class="ele black" v-else>
  78. {{value}}
  79. </view>
  80. <view class="right">
  81. <img src="../../static/right.png">
  82. </view>
  83. </view>
  84. </picker>
  85. </view>
  86. <!-- 确认按钮区域 -->
  87. <view class="button" @click="handleConfirm">
  88. 确认
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. // 规则名称
  97. ruleName: "未设置",
  98. // 考勤组
  99. group: "未设置",
  100. // 打卡时间
  101. time: "未设置",
  102. // 打卡地点
  103. place: "未设置",
  104. // 提前通知
  105. value: "未设置",
  106. array: ['5分钟', '10分钟', '15分钟', '20分钟'],
  107. index: 0,
  108. };
  109. },
  110. onLoad() {
  111. uni.$on('update', (data) => {
  112. this.ruleName = data
  113. })
  114. },
  115. onUnload() {
  116. uni.$off('update')
  117. },
  118. methods: {
  119. // 点击确认按钮回调
  120. handleConfirm() {
  121. if (this.ruleName == '未设置') {
  122. uni.showToast({
  123. title: "请设置规则名称",
  124. icon: 'none'
  125. })
  126. return
  127. }
  128. if (this.group == '未设置') {
  129. uni.showToast({
  130. title: "请设置考勤组",
  131. icon: 'none'
  132. })
  133. return
  134. }
  135. if (this.time == '未设置') {
  136. uni.showToast({
  137. title: "请设置打卡时间",
  138. icon: 'none'
  139. })
  140. return
  141. }
  142. if (this.place == '未设置') {
  143. uni.showToast({
  144. title: "请设置打卡地点",
  145. icon: 'none'
  146. })
  147. return
  148. }
  149. if (this.value == '未设置') {
  150. uni.showToast({
  151. title: "请设置提前通知时间",
  152. icon: 'none'
  153. })
  154. return
  155. }
  156. uni.showModal({
  157. title: '提示',
  158. content: '确定新增吗?',
  159. success: function(res) {
  160. if (res.confirm) {
  161. console.log('用户点击确定');
  162. } else if (res.cancel) {
  163. console.log('用户点击取消');
  164. }
  165. }
  166. });
  167. },
  168. // 提前通知选择框点击回调
  169. changeSelect(e) {
  170. let index = e.detail.value
  171. this.value = this.array[index]
  172. },
  173. // 点击规则名称跳转回调
  174. goPageRuleName() {
  175. uni.navigateTo({
  176. url: "/pages/ruleName/ruleName"
  177. })
  178. },
  179. // 点击考勤组跳转回调
  180. goPageGroup() {
  181. uni.navigateTo({
  182. url: `/pages/group/group?flag=2`
  183. })
  184. },
  185. // 点击打卡时间跳转回调
  186. goPagePunchTime() {
  187. uni.navigateTo({
  188. url: "/pages/punchTime/punchTime"
  189. })
  190. },
  191. // 点击打卡地点跳转回调
  192. goPagePunchLocation() {
  193. uni.navigateTo({
  194. url: "/pages/punchLocation/punchLocation"
  195. })
  196. }
  197. }
  198. }
  199. </script>
  200. <style lang="scss" scoped>
  201. .container {
  202. height: 100vh;
  203. background-color: #fff;
  204. .box {
  205. display: flex;
  206. align-items: center;
  207. margin: 0 30rpx;
  208. width: 690rpx;
  209. height: 90rpx;
  210. font-size: 30rpx;
  211. border-bottom: 1rpx solid #CCCCCC;
  212. .name {
  213. flex: 1;
  214. }
  215. .val {
  216. flex: 3;
  217. display: flex;
  218. align-items: center;
  219. .ele {
  220. margin-right: 20rpx;
  221. display: inline-block;
  222. width: 460rpx;
  223. text-align: end;
  224. color: #A6A6A6;
  225. overflow: hidden;
  226. white-space: nowrap;
  227. text-overflow: ellipsis;
  228. }
  229. .black {
  230. color: #000;
  231. }
  232. .right {
  233. width: 40rpx;
  234. display: inline-flex;
  235. justify-content: center;
  236. align-items: center;
  237. img {
  238. width: 16rpx;
  239. height: 25rpx;
  240. }
  241. }
  242. }
  243. }
  244. .button {
  245. margin: auto;
  246. margin-top: 52rpx;
  247. width: 690rpx;
  248. height: 80rpx;
  249. line-height: 80rpx;
  250. text-align: center;
  251. font-size: 32rpx;
  252. font-weight: 500;
  253. color: #fff;
  254. border-radius: 16rpx;
  255. background-color: #3396FB;
  256. }
  257. }
  258. </style>