index.tsx 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. import OHeader from '@/components/o-header'
  2. import OSticky from '@/components/o-sticky'
  3. import { Collapse, CollapseItem } from 'vant'
  4. import { defineComponent, reactive, onMounted } from 'vue'
  5. import clockIcon from './images/clock-icon.png'
  6. import styles from './index.module.less'
  7. import request from '@/helpers/request'
  8. import { addFormMinute, reduceFormMinute } from '@/helpers/date'
  9. export default defineComponent({
  10. name: 'attendance-rule',
  11. setup() {
  12. const state = reactive({
  13. activeNames: ['1', '2', '3']
  14. })
  15. const forms = reactive({} as any)
  16. const getRules = async () => {
  17. try {
  18. const { data } = await request.post('/api-backend/sysParamConfig/page', {
  19. data: {
  20. page: 1,
  21. rows: 999,
  22. group: 'ATTENDANCE'
  23. }
  24. })
  25. if (data.rows) {
  26. data.rows.forEach((item: any) => {
  27. forms[item.id] = item.paramValue
  28. })
  29. }
  30. console.log(forms)
  31. } catch (e) {
  32. console.log(e)
  33. }
  34. }
  35. onMounted(() => {
  36. getRules()
  37. })
  38. return () => (
  39. <>
  40. <OSticky position="top" background="#F8F8F8">
  41. <OHeader></OHeader>
  42. </OSticky>
  43. <div class={styles.attCollapseWrap}>
  44. <Collapse v-model={state.activeNames}>
  45. <CollapseItem
  46. name="1"
  47. border={false}
  48. v-slots={{
  49. title: () => (
  50. <div class={styles.collapseTitle}>
  51. <span class={styles.dot}></span>
  52. 签到规则
  53. </div>
  54. )
  55. }}
  56. >
  57. <div>
  58. <div class={styles.mainMsg}>
  59. <img src={clockIcon} alt="" class={styles.clockIcon} />
  60. <p>以课程时间12:00:00 ~ 13:00:00为例</p>
  61. </div>
  62. <div class={styles.textWrap}>
  63. <h4>可签到时间范围:</h4>
  64. <p>
  65. 课程<span>开始前{forms[15] ? forms[15] : 0}分钟</span>至课程<span>结束前</span>
  66. </p>
  67. <p>时间段:{reduceFormMinute('12:00:00', forms[15])} ~13:00:00 </p>
  68. </div>
  69. <div class={styles.textWrap}>
  70. <h4>正常签到:</h4>
  71. <p>
  72. 课程<span>开始前{forms[15] ? forms[15] : 0}分钟</span>至课程
  73. <span>开始前{forms[16] ? forms[16] : 0}分钟</span>
  74. 签到 <br />
  75. GPS定位点在教学点<span>{forms[10] ? forms[10] : 0}米内</span>
  76. </p>
  77. <p>
  78. 时间段:{reduceFormMinute('12:00:00', forms[15])} ~{' '}
  79. {reduceFormMinute('12:00:00', forms[16])}
  80. </p>
  81. </div>
  82. <div class={styles.textWrap}>
  83. <h4>异常签到:</h4>
  84. <p>
  85. 课程<span>开始前{forms[17] ? forms[17] : 0}分钟</span>后至课程
  86. <span>开始前</span>
  87. 签到
  88. <br />
  89. GPS定位点在教学点<span>{forms[10] ? forms[10] : 0}米内</span>
  90. </p>
  91. <p>时间段:{reduceFormMinute('12:00:00', forms[17])} ~ 12:00:00</p>
  92. <p>
  93. 扣除训练补助:
  94. <span>
  95. -{forms[18] ? forms[18] : 0}
  96. {forms[19] == 'MONEY' ? '元' : '%'}
  97. </span>
  98. </p>
  99. </div>
  100. <div class={styles.textWrap}>
  101. <h4>迟到:</h4>
  102. <p>
  103. 课程<span>开始后{forms[20] ? forms[20] : 0}分钟</span>内签到
  104. </p>
  105. <p>时间段:12:00:00 ~ {addFormMinute('12:00:00', forms[20])}</p>
  106. <p>
  107. 扣除训练补助:
  108. <span>
  109. -{forms[21] ? forms[21] : 0}
  110. {forms[22] == 'MONEY' ? '元' : '%'}
  111. </span>
  112. </p>
  113. </div>
  114. <div class={styles.textWrap}>
  115. <h4>旷课:</h4>
  116. <p>
  117. 课程<span>开始后{forms[23] ? forms[23] : 0}分钟</span>至课程<span>结束前</span>
  118. 签到
  119. </p>
  120. <p>
  121. 时间段:{addFormMinute('12:00:00', forms[23])}后签到(含
  122. {addFormMinute('12:00:00', forms[23])})
  123. </p>
  124. <p>
  125. 扣除训练补助:
  126. <span>
  127. -{forms[24] ? forms[24] : 0}
  128. {forms[25] == 'MONEY' ? '元' : '%'}
  129. </span>
  130. </p>
  131. </div>
  132. <div class={styles.textWrap}>
  133. <h4>未签到:</h4>
  134. <p>未进行【签到】操作</p>
  135. <p>
  136. 扣除训练补助:
  137. <span>
  138. -{forms[26] ? forms[26] : 0} {forms[27] == 'MONEY' ? '元' : '%'}
  139. </span>
  140. </p>
  141. </div>
  142. </div>
  143. </CollapseItem>
  144. <CollapseItem
  145. name="2"
  146. border={false}
  147. v-slots={{
  148. title: () => (
  149. <div class={styles.collapseTitle}>
  150. <span class={styles.dot}></span>
  151. 签退规则
  152. </div>
  153. )
  154. }}
  155. >
  156. <div>
  157. <div class={styles.mainMsg}>
  158. <img src={clockIcon} alt="" class={styles.clockIcon} />
  159. <p>以课程时间12:00:00 ~ 13:00:00为例</p>
  160. </div>
  161. <div class={styles.textWrap}>
  162. <h4>可签退时间范围:</h4>
  163. <p>
  164. 课程<span>结束后</span>至课程当天24点前
  165. </p>
  166. <p>时间段:12:00:00 ~ 23:59:59</p>
  167. </div>
  168. <div class={styles.textWrap}>
  169. <h4>正常签退:</h4>
  170. <p>
  171. 课程<span>结束后</span>至课程<span>结束后{forms[28] ? forms[28] : 0}分钟</span>
  172. 签退 <br />
  173. GPS定位点在教学点<span>{forms[10] ? forms[10] : 0}米内</span>
  174. </p>
  175. <p>时间段:13:00:00 ~ {addFormMinute('13:00:00', forms[28])}</p>
  176. </div>
  177. <div class={styles.textWrap}>
  178. <h4>早退:</h4>
  179. <p>
  180. 课程<span>结束前{forms[32] ? forms[32] : 0}分钟</span>内签退
  181. </p>
  182. <p>
  183. 时间段:{reduceFormMinute('13:00:00', forms[32])}前签退(含
  184. {reduceFormMinute('13:00:00', forms[32])}){' '}
  185. </p>
  186. <p>
  187. 扣除训练补助:
  188. <span>
  189. -{forms[33] ? forms[33] : 0}
  190. {forms[34] == 'MONEY' ? '元' : '%'}
  191. </span>
  192. </p>
  193. </div>
  194. <div class={styles.textWrap}>
  195. <h4>异常签退:</h4>
  196. <p>
  197. 课程<span>结束前{forms[29] ? forms[29] : 0}分钟</span>至<span>课程结束前</span>
  198. <br /> 或GPS定位点在教学点<span> {forms[10] ? forms[10] : 0}米内</span>
  199. </p>
  200. <p>时间段:{reduceFormMinute('13:00:00', forms[29])} ~ 12:59:59</p>
  201. <p>
  202. 扣除训练补助:
  203. <span>
  204. -{forms[30] ? forms[30] : 0} {forms[31] == 'MONEY' ? '元' : '%'}
  205. </span>
  206. </p>
  207. </div>
  208. <div class={styles.textWrap}>
  209. <h4>未签退:</h4>
  210. <p>未进行【签退】操作</p>
  211. <p>
  212. 扣除训练补助:
  213. <span>
  214. -{forms[45] ? forms[45] : 0}
  215. {forms[38] == 'MONEY' ? '元' : '%'}
  216. </span>
  217. </p>
  218. </div>
  219. </div>
  220. </CollapseItem>
  221. <CollapseItem
  222. name="3"
  223. border={false}
  224. v-slots={{
  225. title: () => (
  226. <div class={styles.collapseTitle}>
  227. <span class={styles.dot}></span>
  228. GPS定位
  229. </div>
  230. )
  231. }}
  232. >
  233. <div>
  234. <div class={styles.textWrap}>
  235. <p>
  236. <span>
  237. 若签到时间在正常范围内
  238. <br /> 但同时GPS定位在教学点{forms[10] ? forms[10] : 0}
  239. 米外
  240. </span>
  241. </p>
  242. <p>
  243. 扣除训练补助:
  244. <span>
  245. - {forms[11] ? forms[11] : 0}
  246. {forms[12] == 'MONEY' ? '元' : '%'}
  247. </span>
  248. </p>
  249. </div>
  250. <div class={styles.textWrap}>
  251. <p>
  252. <span>
  253. 若签退时间在正常范围内 <br /> 但同时GPS定位在教学点{forms[10] ? forms[10] : 0}
  254. 米外
  255. </span>
  256. </p>
  257. <p>
  258. 扣除训练补助:
  259. <span>
  260. - {forms[13] ? forms[13] : 0}
  261. {forms[14] == 'MONEY' ? '元' : '%'}
  262. </span>
  263. </p>
  264. </div>
  265. </div>
  266. </CollapseItem>
  267. </Collapse>
  268. </div>
  269. </>
  270. )
  271. }
  272. })