editRules.vue 5.3 KB

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