index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <script setup>
  2. import { closeToast, showLoadingToast, showToast } from "vant";
  3. import { userInfo } from '~/store/user'
  4. const { uo_type } = userInfo
  5. const isBureau = ref(false)// 当前用户是否局端
  6. isBureau.value = uo_type === '1'
  7. const list = ref([])
  8. const loading = ref(false)
  9. const finished = ref(false)
  10. let page = 1
  11. const param = $ref({
  12. keyword: '',
  13. xhz_cdmc: '',
  14. xhz_ssbm: '',
  15. xhz_jyr: '',
  16. xhz_pzr: '',
  17. xhz_zt: ''
  18. })
  19. function onLoad() {
  20. loading.value = true
  21. request({
  22. url: '/xdhq/hqgl_zyyy/index',
  23. method: 'post',
  24. data: {
  25. ...param,
  26. page,
  27. limit: 20,
  28. },
  29. }).then((res) => {
  30. const data = res.data
  31. list.value = [...list.value, ...data.page_data]
  32. finished.value = data.total_page === page
  33. page++
  34. loading.value = false
  35. })
  36. }
  37. function onClickSearch() {
  38. reGetList()
  39. }
  40. const itemRef1 = ref(null)
  41. const itemRef2 = ref(null)
  42. const itemRef3 = ref(null)
  43. const itemRef4 = ref(null)
  44. function onConfirm(num) {
  45. let temp = [itemRef1, itemRef2, itemRef3, itemRef4]
  46. temp[num].value.toggle()
  47. reGetList()
  48. }
  49. function reGetList() {
  50. page = 1
  51. list.value = []
  52. finished.value = false
  53. onLoad()
  54. }
  55. const statusOption = $ref([{ text: '状态', value: '' }, { text: '通过', value: '1' }, { text: '未通过', value: '2' }, { text: '待审核', value: '3' }])
  56. function dropItemChange() {
  57. reGetList()
  58. }
  59. const auditDialogShow = ref(false);
  60. const auditchecked = ref("");
  61. const xhz_yy = ref('')
  62. let operaItem = {}
  63. function audit(item) {
  64. operaItem = item
  65. auditDialogShow.value = true
  66. }
  67. function beforeCloseDialog(action) {
  68. if (action == "confirm") {
  69. if (auditchecked.value == "") {
  70. showToast("请选择审核结果");
  71. return false;
  72. } else if (auditchecked.value === "2" && xhz_yy.value == "") {
  73. showToast("请填写意见");
  74. return false;
  75. } else {
  76. dialogSubmit();
  77. return true;
  78. }
  79. } else {
  80. return true;
  81. }
  82. }
  83. function dialogSubmit() {
  84. const transObj = {
  85. xhz_id: operaItem.xhz_id,
  86. xdhq_hqgl_zyyy: {
  87. xhz_zt: auditchecked.value, // 待审核 1通过 2驳回
  88. xhz_yy: xhz_yy.value, // 处理意见
  89. },
  90. };
  91. showLoadingToast({
  92. message: "提交中...",
  93. forbidClick: true,
  94. });
  95. request({
  96. url: "/xdhq/hqgl_zyyy/edit",
  97. data: transObj,
  98. }).then((res) => {
  99. closeToast();
  100. if (res.code == 1) {
  101. showToast(res.msg);
  102. list.value = [];
  103. page = 1;
  104. onLoad();
  105. }
  106. });
  107. }
  108. </script>
  109. <template>
  110. <div v-show="isBureau">
  111. <div style="width: 100%;text-align: center;"><span style="font-size: 20px;">本功能仅对校端用户开放</span></div>
  112. </div>
  113. <div class="index" v-show="!isBureau">
  114. <van-search v-model="param.keyword" :clearable="false" show-action placeholder="请输入搜索关键词" @search="onClickSearch">
  115. <template #action>
  116. <div @click="onClickSearch">
  117. 搜索
  118. </div>
  119. </template>
  120. </van-search>
  121. <van-dropdown-menu>
  122. <van-dropdown-item ref="itemRef1" title="场地名称">
  123. <van-cell-group inset>
  124. <van-field v-model="param.xhz_cdmc" placeholder="请输入场地名称" />
  125. </van-cell-group>
  126. <div style="padding: 5px 16px;">
  127. <van-button type="primary" block round @click="onConfirm(0)">
  128. 确认
  129. </van-button>
  130. </div>
  131. </van-dropdown-item>
  132. <van-dropdown-item ref="itemRef2" title="所属部门">
  133. <van-cell-group inset>
  134. <van-field v-model="param.xhz_ssbm" placeholder="请输入所属部门" />
  135. </van-cell-group>
  136. <div style="padding: 5px 16px;">
  137. <van-button type="primary" block round @click="onConfirm(1)">
  138. 确认
  139. </van-button>
  140. </div>
  141. </van-dropdown-item>
  142. <van-dropdown-item ref="itemRef3" title="借用人">
  143. <van-cell-group inset>
  144. <van-field v-model="param.xhz_jyr" placeholder="请输入借用人" />
  145. </van-cell-group>
  146. <div style="padding: 5px 16px;">
  147. <van-button type="primary" block round @click="onConfirm(2)">
  148. 确认
  149. </van-button>
  150. </div>
  151. </van-dropdown-item>
  152. <van-dropdown-item ref="itemRef4" title="批准人">
  153. <van-cell-group inset>
  154. <van-field v-model="param.xhz_pzr" placeholder="请输入批准人" />
  155. </van-cell-group>
  156. <div style="padding: 5px 16px;">
  157. <van-button type="primary" block round @click="onConfirm(3)">
  158. 确认
  159. </van-button>
  160. </div>
  161. </van-dropdown-item>
  162. <van-dropdown-item v-model="param.xhz_zt" :options="statusOption" @change="dropItemChange" />
  163. </van-dropdown-menu>
  164. <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
  165. <van-cell v-for="item in list" :key="item">
  166. <template #title>
  167. <span>{{ `${item.xhz_cdmc}` }}</span>
  168. </template>
  169. <template #value>
  170. <div>
  171. <van-button class="w-60px" type="primary" size="small" @click="audit(item)"
  172. v-show="item.xhz_zt_option_k == 3">审核</van-button>
  173. </div>
  174. </template>
  175. <template #label>
  176. <div><span>{{ `所属部门:${item.xhz_ssbm}\u00A0\u00A0\u00A0状态:${item.xhz_zt}` }}</span></div>
  177. <div style="color: black;">
  178. <div><span>{{ `借用人:${item.xhz_jyr}\u00A0\u00A0\u00A0批准人:${item.xhz_pzr}` }}</span>
  179. </div>
  180. <div><span>借用时间:{{ item.xhz_jysj_ks + '至' + item.xhz_jysj_js }}</span></div>
  181. </div>
  182. </template>
  183. </van-cell>
  184. </van-list>
  185. <van-dialog v-model:show="auditDialogShow" title="审核" confirm-button-text="提交" show-cancel-button
  186. :before-close="beforeCloseDialog">
  187. <div class="dialogDiv">
  188. <van-radio-group v-model="auditchecked">
  189. <van-cell-group inset>
  190. <van-cell title="通过" clickable @click="auditchecked = '1'">
  191. <template #right-icon>
  192. <van-radio name="1" />
  193. </template>
  194. </van-cell>
  195. <van-cell title="不通过" clickable @click="auditchecked = '2'">
  196. <template #right-icon>
  197. <van-radio name="2" />
  198. </template>
  199. </van-cell>
  200. </van-cell-group>
  201. </van-radio-group>
  202. <van-field v-if="auditchecked === '2'" v-model="xhz_yy" rows="3" autosize type="textarea" placeholder="填写原因" />
  203. </div>
  204. </van-dialog>
  205. </div>
  206. </template>
  207. <style lang="scss" scoped>
  208. :deep(.van-cell__title) {
  209. width: 70% !important;
  210. flex: auto
  211. }
  212. :deep(.van-cell__value) {
  213. width: 30% !important;
  214. flex: auto
  215. }
  216. :deep(.van-ellipsis) {
  217. font-size: 14px !important;
  218. }
  219. </style>