check.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template>
  2. <view class="container">
  3. <!-- 搜索框区域 -->
  4. <common-search placeholder="请输入关键词" @change="handleChange"></common-search>
  5. <!-- 分段器区域 -->
  6. <view class="control">
  7. <common-controlTag :tagList="tagList" @change="changeIndex"></common-controlTag>
  8. </view>
  9. <!-- 模块选择区域 -->
  10. <view class="setion">
  11. <view class="setion_box" :class="{ active: currentIndex_mode == index }" v-for="(item, index) in modeList" :key="item.id" @click="changeModeIndex(index)">
  12. {{ item.name }}
  13. </view>
  14. </view>
  15. <!-- 列表区域 -->
  16. <view class="list">
  17. <!-- 每一个申请区域 -->
  18. <view class="list_box" v-for="item in dataList" :key="item.id">
  19. <!-- 状态区域 -->
  20. <view class="box_status ing" v-if="item.passName == '待审核'">{{ item.passName }}</view>
  21. <view class="box_status pass" v-if="item.passName == '已通过'">{{ item.passName }}</view>
  22. <view class="box_status nopass" v-if="item.passName == '已拒绝'">{{ item.passName }}</view>
  23. <view class="box_title">{{ item.modelName }}</view>
  24. <view class="box_msg" v-if="item.orgName">
  25. <view class="msg_key">组织名称:</view>
  26. <view class="msg_value">{{ item.orgName }}</view>
  27. </view>
  28. <view class="box_msg">
  29. <view class="msg_key">联系人方式:</view>
  30. <view class="msg_value">{{ item.phone }}</view>
  31. </view>
  32. <view class="box_msg">
  33. <view class="msg_key">联系人:</view>
  34. <view class="msg_value">{{ item.userName }}</view>
  35. </view>
  36. <view class="box_msg">
  37. <view class="msg_key">发起时间:</view>
  38. <view class="msg_value">{{ item.createTime }}</view>
  39. </view>
  40. <!-- 按钮区域 -->
  41. <view class="btns" v-if="currentIndex == 1 && item.passName == '待审核'">
  42. <view class="btn reject" @click="clickReject(item.id)">拒绝</view>
  43. <view class="btn agree" @click="clickAgree(item.id)">同意</view>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- 没有数据时展示的页面 -->
  48. <noData v-if="!dataList.length"></noData>
  49. </view>
  50. </template>
  51. <script setup>
  52. import { onLoad } from '@dcloudio/uni-app'
  53. import { ref } from 'vue'
  54. import { getApplyTypes, getIinitiatedApply, getIapproveApply, getExamineData } from '@/api/index.js'
  55. // 输入框绑定数据
  56. const inputValue = ref('')
  57. // 状态分段器数组
  58. const tagList = ['我发起的', '待我审核']
  59. // 状态分段器当前索引
  60. const currentIndex = ref(0)
  61. // 审批模块列表数据
  62. const modeList = ref([])
  63. // 模块分段器当前索引
  64. const currentIndex_mode = ref(0)
  65. // 当前页
  66. const currentPage = ref(1)
  67. // 每页多少条
  68. const pageCount = ref(6)
  69. // 总条数
  70. const total = ref(0)
  71. // 列表数据
  72. const dataList = ref([])
  73. onLoad(() => {
  74. // 获取审批模块列表数据
  75. getModeData()
  76. })
  77. // 获取审批模块列表数据
  78. const getModeData = async () => {
  79. const res = await getApplyTypes()
  80. // console.log(res)
  81. modeList.value = res.data
  82. if (currentIndex.value == 0) {
  83. // 获取我发起的数据
  84. getData_launch()
  85. } else {
  86. // 获取待我审核的数据
  87. getData_check()
  88. }
  89. }
  90. // 获取我发起的审核分页数据
  91. const getData_launch = async () => {
  92. let data = {
  93. currentPage: currentPage.value,
  94. pageCount: pageCount.value,
  95. typeId: modeList.value[currentIndex_mode.value].id,
  96. keyword: inputValue.value
  97. }
  98. const res = await getIinitiatedApply(data)
  99. // console.log(res)
  100. dataList.value = [...dataList.value, ...res.data.list]
  101. total.value = res.data.totalCount
  102. }
  103. // 获取待我审核的审核分页数据
  104. const getData_check = async () => {
  105. let data = {
  106. currentPage: currentPage.value,
  107. pageCount: pageCount.value,
  108. typeId: modeList.value[currentIndex_mode.value].id,
  109. keyword: inputValue.value
  110. }
  111. const res = await getIapproveApply(data)
  112. // console.log(res)
  113. dataList.value = [...dataList.value, ...res.data.list]
  114. total.value = res.data.totalCount
  115. }
  116. // 搜索框搜索回调
  117. const handleChange = (e) => {
  118. // console.log(e)
  119. inputValue.value = e
  120. currentPage.value = 1
  121. dataList.value = []
  122. if (currentIndex.value == 0) {
  123. // 获取我发起的数据
  124. getData_launch()
  125. } else {
  126. // 获取待我审核的数据
  127. getData_check()
  128. }
  129. }
  130. // 状态分段器切换时的回调
  131. const changeIndex = (e) => {
  132. if (currentIndex.value != e) {
  133. currentIndex.value = e
  134. currentIndex_mode.value = 0
  135. currentPage.value = 1
  136. dataList.value = []
  137. if (currentIndex.value == 0) {
  138. // 获取我发起的数据
  139. getData_launch()
  140. } else {
  141. // 获取待我审核的数据
  142. getData_check()
  143. }
  144. }
  145. }
  146. // 模块分段器切换时的回调
  147. const changeModeIndex = (e) => {
  148. if (currentIndex_mode.value != e) {
  149. currentIndex_mode.value = e
  150. currentPage.value = 1
  151. dataList.value = []
  152. if (currentIndex.value == 0) {
  153. // 获取我发起的数据
  154. getData_launch()
  155. } else {
  156. // 获取待我审核的数据
  157. getData_check()
  158. }
  159. }
  160. }
  161. // 拒绝按钮回调
  162. const clickReject = (id) => {
  163. uni.showModal({
  164. title: '提示',
  165. placeholderText: `请输入拒绝的原因`,
  166. editable: true,
  167. success: (res) => {
  168. if (res.confirm) {
  169. // console.log(res)
  170. if (!res.content) {
  171. uni.showToast({
  172. title: '拒绝原因为必填',
  173. icon: 'none'
  174. })
  175. setTimeout(() => {
  176. clickReject(id)
  177. }, 1500)
  178. } else {
  179. auditReq(id, 3, res.content)
  180. }
  181. }
  182. }
  183. })
  184. }
  185. // 同意按钮回调
  186. const clickAgree = (id) => {
  187. uni.showModal({
  188. title: '提示',
  189. content: `确定同意该申请吗?`,
  190. success: (res) => {
  191. if (res.confirm) {
  192. auditReq(id, 2)
  193. }
  194. }
  195. })
  196. }
  197. // 审核请求 2 通过 3 拒绝
  198. const auditReq = async (id, isPass, passValue = '') => {
  199. let data = {
  200. id,
  201. isPass,
  202. typeId: modeList.value[currentIndex_mode.value].id,
  203. passValue
  204. }
  205. const res = await getExamineData(data)
  206. // console.log(res)
  207. if (res.code == 200) {
  208. uni.showToast({
  209. title: '操作成功',
  210. icon: 'none'
  211. })
  212. setTimeout(() => {
  213. currentPage.value = 1
  214. dataList.value = []
  215. getData_check()
  216. }, 1500)
  217. }
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. .container {
  222. padding: 20rpx 18rpx;
  223. min-height: 100vh;
  224. .control {
  225. margin-top: 20rpx;
  226. }
  227. .setion {
  228. margin-top: 20rpx;
  229. height: 90rpx;
  230. font-size: 28rpx;
  231. border-radius: 8rpx;
  232. background-color: #f2f7ff;
  233. white-space: nowrap;
  234. overflow-x: auto;
  235. .setion_box {
  236. display: inline-block;
  237. width: 211rpx;
  238. line-height: 71rpx;
  239. text-align: center;
  240. border-radius: 8rpx;
  241. }
  242. .active {
  243. font-size: 30rpx;
  244. color: #0061ff;
  245. border: 2rpx solid #0061ff;
  246. background-color: rgba(0, 97, 255, 0.1);
  247. }
  248. }
  249. .list {
  250. margin-top: 20rpx;
  251. .list_box {
  252. position: relative;
  253. padding: 30rpx;
  254. margin-bottom: 20rpx;
  255. width: 714rpx;
  256. font-size: 28rpx;
  257. border-radius: 28rpx;
  258. box-shadow: 0 4rpx 34rpx rgba(211, 211, 211, 0.32);
  259. .box_status {
  260. position: absolute;
  261. top: 32rpx;
  262. right: 28rpx;
  263. display: flex;
  264. justify-content: center;
  265. align-items: center;
  266. width: 128rpx;
  267. height: 55rpx;
  268. color: #fff;
  269. border-radius: 70rpx 40rpx 0 70rpx;
  270. }
  271. .ing {
  272. background: linear-gradient(90deg, rgba(255, 112, 69, 1) 0%, rgba(247, 161, 114, 1) 100%);
  273. }
  274. .pass {
  275. background: linear-gradient(90deg, #366fff 0%, #5da0fc 100%);
  276. }
  277. .nopass {
  278. background: linear-gradient(90deg, rgba(212, 48, 48, 1) 0%, rgba(245, 108, 108, 1) 100%);
  279. }
  280. .box_title {
  281. margin-bottom: 20rpx;
  282. font-size: 32rpx;
  283. font-weight: bold;
  284. }
  285. .box_msg {
  286. display: flex;
  287. align-items: center;
  288. margin-bottom: 20rpx;
  289. .msg_key {
  290. font-weight: bold;
  291. }
  292. .msg_value {
  293. color: #666666;
  294. }
  295. }
  296. .btns {
  297. display: flex;
  298. justify-content: flex-end;
  299. margin-top: 30rpx;
  300. .btn {
  301. display: flex;
  302. justify-content: center;
  303. align-items: center;
  304. margin-left: 15rpx;
  305. width: 151rpx;
  306. height: 70rpx;
  307. border-radius: 8rpx;
  308. }
  309. .reject {
  310. color: #007aff;
  311. border: 2rpx solid #007aff;
  312. }
  313. .agree {
  314. color: #fff;
  315. background-color: #007aff;
  316. }
  317. }
  318. }
  319. }
  320. }
  321. </style>