set.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <view class="set">
  3. <!-- 年级区域 -->
  4. <view class="box">
  5. 年级
  6. <!-- <picker @change="bindPickerChange" :value="gradeCurrentIndex" :range="gradeArray">
  7. <view class="box_select">
  8. {{ gradeArray[gradeCurrentIndex] }}
  9. <img class="img" src="@/static/images/bottom.png" alt="" />
  10. </view>
  11. </picker> -->
  12. <view class="box_select">{{ configInfo.gradeName }}</view>
  13. </view>
  14. <!-- 班级区域 -->
  15. <view class="box">
  16. 班级
  17. <!-- <picker @change="bindPickerChange" :value="classCurrentIndex" :range="classArray">
  18. <view class="box_select">
  19. {{ classArray[classCurrentIndex] }}
  20. <img class="img" src="@/static/images/bottom.png" alt="" />
  21. </view>
  22. </picker> -->
  23. <view class="box_select">{{ configInfo.className }}</view>
  24. </view>
  25. <!-- 设置区域 -->
  26. <view class="setBox">
  27. <view class="title">
  28. <view class="circle"></view>
  29. 访客预约小程序审批流程设置
  30. </view>
  31. <!-- 小程序是否需要审核 -->
  32. <checkbox-group class="checkbox_group">
  33. <label class="checkbox" v-for="item in checkItems" :key="item.value" @click="checkboxChange(checkItems, item)">
  34. <view>
  35. <checkbox color="#3464FF" :value="item.value" :checked="item.checked" />
  36. </view>
  37. <view>{{ item.name }}</view>
  38. </label>
  39. </checkbox-group>
  40. <!-- 小程序是否需要推送 -->
  41. <checkbox-group class="checkbox_group">
  42. <label class="checkbox" v-for="item in pushItems" :key="item.value" @click="checkboxChange(pushItems, item)">
  43. <view>
  44. <checkbox color="#3464FF" :value="item.value" :checked="item.checked" />
  45. </view>
  46. <view>{{ item.name }}</view>
  47. </label>
  48. </checkbox-group>
  49. <!-- 小程序是否需要核销区域 -->
  50. <checkbox-group class="checkbox_group">
  51. <label class="checkbox" v-for="item in cancelItems" :key="item.value" @click="checkboxChange(cancelItems, item)">
  52. <view>
  53. <checkbox color="#3464FF" :value="item.value" :checked="item.checked" />
  54. </view>
  55. <view>{{ item.name }}</view>
  56. </label>
  57. </checkbox-group>
  58. <view class="title">
  59. <view class="circle"></view>
  60. 访客预约终端审批流程设置
  61. </view>
  62. <!-- 大屏是否需要审核 -->
  63. <checkbox-group class="checkbox_group">
  64. <label class="checkbox" v-for="item in checkItems_screen" :key="item.value" @click="checkboxChange(checkItems_screen, item)">
  65. <view>
  66. <checkbox color="#3464FF" :value="item.value" :checked="item.checked" />
  67. </view>
  68. <view>{{ item.name }}</view>
  69. </label>
  70. </checkbox-group>
  71. <!-- 大屏是否需要推送 -->
  72. <checkbox-group class="checkbox_group">
  73. <label class="checkbox" v-for="item in pushItems_screen" :key="item.value" @click="checkboxChange(pushItems_screen, item)">
  74. <view>
  75. <checkbox color="#3464FF" :value="item.value" :checked="item.checked" />
  76. </view>
  77. <view>{{ item.name }}</view>
  78. </label>
  79. </checkbox-group>
  80. <!-- 大屏是否需要核销区域 -->
  81. <checkbox-group class="checkbox_group">
  82. <label class="checkbox" v-for="item in cancelItems_screen" :key="item.value" @click="checkboxChange(cancelItems_screen, item)">
  83. <view>
  84. <checkbox color="#3464FF" :value="item.value" :checked="item.checked" />
  85. </view>
  86. <view>{{ item.name }}</view>
  87. </label>
  88. </checkbox-group>
  89. <view class="title">
  90. <view class="circle"></view>
  91. 门禁设置
  92. </view>
  93. <!-- 门禁是否需要联动区域 -->
  94. <checkbox-group class="checkbox_group">
  95. <label class="checkbox" v-for="item in doorItems" :key="item.value" @click="checkboxChange(doorItems, item)">
  96. <view>
  97. <checkbox color="#3464FF" :value="item.value" :checked="item.checked" />
  98. </view>
  99. <view>{{ item.name }}</view>
  100. </label>
  101. </checkbox-group>
  102. <view class="title">
  103. <view class="circle"></view>
  104. 车闸设置
  105. </view>
  106. <!-- 车闸是否需要联动区域 -->
  107. <checkbox-group class="checkbox_group">
  108. <label class="checkbox" v-for="item in carItems" :key="item.value" @click="checkboxChange(carItems, item)">
  109. <view>
  110. <checkbox color="#3464FF" :value="item.value" :checked="item.checked" />
  111. </view>
  112. <view>{{ item.name }}</view>
  113. </label>
  114. </checkbox-group>
  115. </view>
  116. <!-- 按钮区域 -->
  117. <view class="btns">
  118. <view class="btn cancel" @click="handleCancle">取消</view>
  119. <view class="btn save" @click="handleSave">保存</view>
  120. </view>
  121. </view>
  122. </template>
  123. <script setup>
  124. import { ref, nextTick } from 'vue'
  125. import backlogVue from '../backlog/backlog.vue'
  126. import { onLoad } from '@dcloudio/uni-app'
  127. import { myRequest } from '../../utils/api'
  128. // 年级数组
  129. // const gradeArray = ref(['2022', '2023', '2024', '2025'])
  130. // 当前选择的年级索引
  131. // const gradeCurrentIndex = ref(0)
  132. // 班级数组
  133. // const classArray = ref(['1班', '2班', '3班', '4班'])
  134. // 当前选择的班级索引
  135. // const classCurrentIndex = ref(0)
  136. // 小程序审核数组
  137. const checkItems = ref([
  138. {
  139. value: 1,
  140. name: '需要审核',
  141. checked: false
  142. },
  143. {
  144. value: 4,
  145. name: '不需要审核',
  146. checked: false
  147. }
  148. ])
  149. // 小程序推送数组
  150. const pushItems = ref([
  151. {
  152. value: 5,
  153. name: '需要推送',
  154. checked: false
  155. },
  156. {
  157. value: 3,
  158. name: '不需要推送',
  159. checked: false
  160. }
  161. ])
  162. // 小程序核销数组
  163. const cancelItems = ref([
  164. {
  165. value: 6,
  166. name: '需要核销',
  167. checked: false
  168. },
  169. {
  170. value: 9,
  171. name: '不需要核销',
  172. checked: false
  173. }
  174. ])
  175. // 大屏审核数组
  176. const checkItems_screen = ref([
  177. {
  178. value: 1,
  179. name: '需要审核',
  180. checked: false
  181. },
  182. {
  183. value: 4,
  184. name: '不需要审核',
  185. checked: false
  186. }
  187. ])
  188. // 大屏推送数组
  189. const pushItems_screen = ref([
  190. {
  191. value: 5,
  192. name: '需要推送',
  193. checked: false
  194. },
  195. {
  196. value: 3,
  197. name: '不需要推送',
  198. checked: false
  199. }
  200. ])
  201. // 大屏核销数组
  202. const cancelItems_screen = ref([
  203. {
  204. value: 6,
  205. name: '需要核销',
  206. checked: false
  207. },
  208. {
  209. value: 9,
  210. name: '不需要核销',
  211. checked: false
  212. }
  213. ])
  214. // 门禁数组
  215. const doorItems = ref([
  216. {
  217. value: 0,
  218. name: '需要联动',
  219. checked: false
  220. },
  221. {
  222. value: 1,
  223. name: '不需要联动',
  224. checked: false
  225. }
  226. ])
  227. // 车闸数组
  228. const carItems = ref([
  229. {
  230. value: 0,
  231. name: '需要联动',
  232. checked: false
  233. },
  234. {
  235. value: 1,
  236. name: '不需要联动',
  237. checked: false
  238. }
  239. ])
  240. // 配置信息
  241. const configInfo = ref({})
  242. onLoad((options) => {
  243. configInfo.value = JSON.parse(options.info)
  244. // console.log(configInfo.value)
  245. handleMatch(checkItems.value, configInfo.value.appAuditConfig)
  246. handleMatch(pushItems.value, configInfo.value.appPushConfig)
  247. handleMatch(cancelItems.value, configInfo.value.appCancelConfig)
  248. handleMatch(checkItems_screen.value, configInfo.value.screenAuditConfig)
  249. handleMatch(pushItems_screen.value, configInfo.value.screenPushConfig)
  250. handleMatch(cancelItems_screen.value, configInfo.value.screenCancelConfig)
  251. handleMatch(doorItems.value, configInfo.value.accessConfig)
  252. handleMatch(carItems.value, configInfo.value.carConfig)
  253. })
  254. // 勾选时的回调
  255. const checkboxChange = (list, item) => {
  256. list.forEach((ele) => {
  257. ele.checked = false
  258. })
  259. nextTick(() => {
  260. item.checked = true
  261. })
  262. }
  263. // 取消按钮回调
  264. const handleCancle = () => {
  265. uni.navigateBack(1)
  266. }
  267. // 保存按钮回调
  268. const handleSave = async () => {
  269. let appAuditConfig = handleMatchValue(checkItems.value)
  270. let appPushConfig = handleMatchValue(pushItems.value)
  271. let appCancelConfig = handleMatchValue(cancelItems.value)
  272. let screenAuditConfig = handleMatchValue(checkItems_screen.value)
  273. let screenPushConfig = handleMatchValue(pushItems_screen.value)
  274. let screenCancelConfig = handleMatchValue(cancelItems_screen.value)
  275. let accessConfig = handleMatchValue(doorItems.value)
  276. let carConfig = handleMatchValue(carItems.value)
  277. const res = await myRequest({
  278. url: '/wanzai/api/smartVisitorParentsConfig/update',
  279. method: 'post',
  280. data: {
  281. id: configInfo.value.id,
  282. classId: configInfo.value.classId,
  283. appAuditConfig,
  284. appPushConfig,
  285. appCancelConfig,
  286. screenAuditConfig,
  287. screenPushConfig,
  288. screenCancelConfig,
  289. accessConfig,
  290. carConfig
  291. }
  292. })
  293. // console.log(res)
  294. if (res.code == 200) {
  295. uni.showToast({
  296. title: res.message,
  297. icon: 'none',
  298. duration: 2000
  299. })
  300. setTimeout(() => {
  301. uni.redirectTo({
  302. url: '/pagesReservation/backlog/backlog'
  303. })
  304. }, 2000)
  305. }
  306. }
  307. // 匹配出哪个是勾选上的
  308. const handleMatch = (list, v) => {
  309. list.forEach((ele) => {
  310. if (ele.value == v) {
  311. ele.checked = true
  312. }
  313. })
  314. }
  315. // 匹配出当前勾选上的值
  316. const handleMatchValue = (list) => {
  317. let Obj = list.find((ele) => ele.checked)
  318. return Obj.value
  319. }
  320. </script>
  321. <style lang="scss" scoped>
  322. .set {
  323. box-sizing: border-box;
  324. padding: 30rpx 20rpx 150rpx;
  325. min-height: 100vh;
  326. background-color: #f1f6fe;
  327. .box {
  328. display: flex;
  329. justify-content: space-between;
  330. align-items: center;
  331. margin-bottom: 20rpx;
  332. height: 90rpx;
  333. font-size: 28rpx;
  334. .box_select {
  335. display: flex;
  336. justify-content: space-between;
  337. align-items: center;
  338. padding: 0 20rpx;
  339. box-sizing: border-box;
  340. width: 628rpx;
  341. height: 90rpx;
  342. border-radius: 15rpx;
  343. background-color: #fff;
  344. .img {
  345. width: 33rpx;
  346. height: 33rpx;
  347. }
  348. }
  349. }
  350. .setBox {
  351. box-sizing: border-box;
  352. padding: 0 30rpx;
  353. width: 710rpx;
  354. height: 1065rpx;
  355. background-color: #fff;
  356. .title {
  357. display: flex;
  358. align-items: center;
  359. height: 90rpx;
  360. font-size: 28rpx;
  361. font-weight: bold;
  362. .circle {
  363. margin-right: 20rpx;
  364. width: 20rpx;
  365. height: 20rpx;
  366. border-radius: 50%;
  367. background-color: #3464ff;
  368. }
  369. }
  370. .checkbox_group {
  371. display: flex;
  372. align-items: center;
  373. margin-bottom: 35rpx;
  374. .checkbox {
  375. display: flex;
  376. align-items: center;
  377. margin-right: 70rpx;
  378. }
  379. }
  380. }
  381. .btns {
  382. display: flex;
  383. justify-content: space-around;
  384. align-items: center;
  385. margin-top: 100rpx;
  386. height: 100rpx;
  387. .btn {
  388. display: flex;
  389. justify-content: center;
  390. align-items: center;
  391. width: 297rpx;
  392. height: 100rpx;
  393. font-size: 32rpx;
  394. border-radius: 8rpx;
  395. }
  396. .cancel {
  397. color: #0061ff;
  398. border: 2rpx solid #0061ff;
  399. }
  400. .save {
  401. color: #fff;
  402. background-color: #0061ff;
  403. }
  404. }
  405. }
  406. </style>