editRules.vue 5.7 KB

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