editRules.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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. <!-- 删除按钮区域 -->
  91. <view class="button2" @click="handleDelete">
  92. 删除
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. export default {
  98. data() {
  99. return {
  100. info: {},
  101. // 规则名称
  102. ruleName: "未设置",
  103. // 考勤组
  104. group: "未设置",
  105. // 打卡时间
  106. time: "未设置",
  107. // 打卡地点
  108. place: "未设置",
  109. // 提前通知
  110. value: "未设置",
  111. // 提前通知选项
  112. array: ['5分钟', '10分钟', '15分钟', '20分钟'],
  113. index: 0,
  114. };
  115. },
  116. onLoad(option) {
  117. this.info = JSON.parse(option.info)
  118. this.ruleName = this.info.ruleName
  119. this.group = this.info.group
  120. this.time = this.info.time
  121. this.place = this.info.place
  122. this.value = this.info.notes
  123. uni.$on('update', (data) => {
  124. this.ruleName = data
  125. })
  126. },
  127. onUnload() {
  128. uni.$off('update')
  129. },
  130. methods: {
  131. // 点击确认按钮回调
  132. handleConfirm() {
  133. uni.showModal({
  134. title: '提示',
  135. content: '确定修改吗?',
  136. success: function(res) {
  137. if (res.confirm) {
  138. console.log('用户点击确定');
  139. } else if (res.cancel) {
  140. console.log('用户点击取消');
  141. }
  142. }
  143. });
  144. },
  145. // 点击删除按钮回调
  146. handleDelete() {
  147. uni.showModal({
  148. title: '提示',
  149. content: '确定删除吗?',
  150. success: function(res) {
  151. if (res.confirm) {
  152. console.log('用户点击确定');
  153. } else if (res.cancel) {
  154. console.log('用户点击取消');
  155. }
  156. }
  157. });
  158. },
  159. // 提前通知选择框点击回调
  160. changeSelect(e) {
  161. let index = e.detail.value
  162. this.value = this.array[index]
  163. },
  164. // 点击规则名称跳转回调
  165. goPageRuleName() {
  166. uni.navigateTo({
  167. url: "/pages/ruleName/ruleName"
  168. })
  169. },
  170. // 点击考勤组跳转回调
  171. goPageGroup() {
  172. uni.navigateTo({
  173. url: `/pages/group/group?flag=2`
  174. })
  175. },
  176. // 点击打卡时间跳转回调
  177. goPagePunchTime() {
  178. uni.navigateTo({
  179. url: "/pages/punchTime/punchTime"
  180. })
  181. },
  182. // 点击打卡地点跳转回调
  183. goPagePunchLocation() {
  184. uni.navigateTo({
  185. url: "/pages/punchLocation/punchLocation"
  186. })
  187. }
  188. }
  189. }
  190. </script>
  191. <style lang="scss" scoped>
  192. .container {
  193. height: 100vh;
  194. background-color: #fff;
  195. .box {
  196. display: flex;
  197. align-items: center;
  198. margin: 0 30rpx;
  199. width: 690rpx;
  200. height: 90rpx;
  201. font-size: 30rpx;
  202. border-bottom: 1rpx solid #CCCCCC;
  203. background-color: #fff;
  204. .name {
  205. flex: 1;
  206. }
  207. .val {
  208. flex: 3;
  209. display: flex;
  210. align-items: center;
  211. .ele {
  212. display: inline-block;
  213. width: 460rpx;
  214. text-align: end;
  215. color: #A6A6A6;
  216. overflow: hidden;
  217. white-space: nowrap;
  218. text-overflow: ellipsis;
  219. }
  220. .black {
  221. color: #000;
  222. }
  223. .right {
  224. margin-left: 20rpx;
  225. width: 40rpx;
  226. display: inline-flex;
  227. justify-content: center;
  228. align-items: center;
  229. img {
  230. width: 16rpx;
  231. height: 25rpx;
  232. }
  233. }
  234. }
  235. }
  236. .button {
  237. margin: auto;
  238. margin-top: 52rpx;
  239. width: 690rpx;
  240. height: 80rpx;
  241. line-height: 80rpx;
  242. text-align: center;
  243. font-size: 32rpx;
  244. font-weight: 500;
  245. color: #fff;
  246. border-radius: 16rpx;
  247. background-color: #3396FB;
  248. }
  249. .button2 {
  250. margin: auto;
  251. margin-top: 30rpx;
  252. width: 690rpx;
  253. height: 80rpx;
  254. line-height: 80rpx;
  255. text-align: center;
  256. font-size: 32rpx;
  257. font-weight: 500;
  258. color: #FF5733;
  259. border-radius: 16rpx;
  260. background-color: #fff;
  261. }
  262. }
  263. </style>