addRules.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. <picker class="val" :value="index_group" :range="array_group" @change="changeSelect_group">
  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. </picker>
  35. </view>
  36. <view class="box">
  37. <view class="name">
  38. 打卡时间:
  39. </view>
  40. <view class="val">
  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">
  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 class="val" :value="index" :range="array" @change="changeSelect">
  73. <view class="ele" v-if="value=='未设置'">
  74. {{value}}
  75. </view>
  76. <view class="ele black" v-else>
  77. {{value}}
  78. </view>
  79. <view class="right">
  80. <img src="../../static/right.png">
  81. </view>
  82. </picker>
  83. </view>
  84. <!-- 确认按钮区域 -->
  85. <view class="button" @click="handleConfirm">
  86. 确认
  87. </view>
  88. </view>
  89. </template>
  90. <script>
  91. export default {
  92. data() {
  93. return {
  94. // 规则名称
  95. ruleName: "未设置",
  96. // 考勤组
  97. group: "未设置",
  98. // 打卡时间
  99. time: "未设置",
  100. // 打卡地点
  101. place: "未设置",
  102. // 提前通知
  103. value: "未设置",
  104. array: ['5分钟', '10分钟', '15分钟', '20分钟'],
  105. array_group: ['分组一分组一分组一分组一分组一分组一', '分组二', '分组三', '分组四'],
  106. index: 0,
  107. index_group: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. changeSelect_group(e){
  175. let index = e.detail.value
  176. this.group = this.array_group[index]
  177. },
  178. // 点击规则名称跳转回调
  179. goPageRuleName() {
  180. uni.navigateTo({
  181. url: "/pages/ruleName/ruleName"
  182. })
  183. }
  184. }
  185. }
  186. </script>
  187. <style lang="scss" scoped>
  188. .container {
  189. height: 100vh;
  190. background-color: #fff;
  191. .box {
  192. display: flex;
  193. align-items: center;
  194. margin: 0 30rpx;
  195. width: 690rpx;
  196. height: 90rpx;
  197. font-size: 30rpx;
  198. border-bottom: 1rpx solid #CCCCCC;
  199. .name {
  200. flex: 1;
  201. }
  202. .val {
  203. flex: 3;
  204. display: flex;
  205. align-items: center;
  206. .ele {
  207. margin-right: 20rpx;
  208. display: inline-block;
  209. width: 460rpx;
  210. text-align: end;
  211. color: #A6A6A6;
  212. overflow: hidden;
  213. white-space: nowrap;
  214. text-overflow: ellipsis;
  215. }
  216. .black {
  217. color: #000;
  218. }
  219. .right {
  220. width: 40rpx;
  221. display: inline-flex;
  222. justify-content: center;
  223. align-items: center;
  224. img {
  225. width: 16rpx;
  226. height: 25rpx;
  227. }
  228. }
  229. }
  230. }
  231. .button {
  232. margin: auto;
  233. margin-top: 52rpx;
  234. width: 690rpx;
  235. height: 80rpx;
  236. line-height: 80rpx;
  237. text-align: center;
  238. font-size: 32rpx;
  239. font-weight: 500;
  240. color: #fff;
  241. border-radius: 16rpx;
  242. background-color: #3396FB;
  243. }
  244. }
  245. </style>