index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <script setup>
  2. import { ref } from "vue";
  3. import { userInfo } from "~/store/user";
  4. const {uo_type,user_id,uo_id,user_realname} = userInfo
  5. import { queryApi,editApi,org_users } from "./apiItem";
  6. import { showNotify,showToast } from 'vant';
  7. const router = useRouter();
  8. const isBureau = ref(false); // 当前用户是否局端
  9. isBureau.value = uo_type === "1";
  10. //外出管理-返回
  11. // const onClickLeft = () => history.back();
  12. const tabActive = ref(0);
  13. const applyPerson = ref();
  14. //头部确定按钮
  15. const onConfirm = (markLabel) => {
  16. onLoad();
  17. }
  18. const onClickTab = () => {
  19. applyPerson.value = "";
  20. onLoad();
  21. }
  22. const tableList = ref([])
  23. const loading = ref(false)
  24. const finished = ref(false)
  25. const onLoad = () => {
  26. let transObjs = {
  27. page: 1,
  28. limit:20,
  29. xxw_qjr:applyPerson.value
  30. }
  31. queryApi(transObjs)
  32. .then(res => {
  33. if (res.code == "1") {
  34. tableList.value = res.data.page_data;
  35. if (tableList.value.length >= res.data.total_rows) {
  36. finished.value = true;
  37. }
  38. loading.value = false;
  39. showToast(res.msg);
  40. }
  41. })
  42. .catch(error => {
  43. console.log(error)
  44. })
  45. };
  46. //上拉刷新
  47. const onRefresh = () => {
  48. onLoad();
  49. };
  50. //跳转
  51. const linkTo = () => {
  52. router.push({
  53. path: "/administrativeService/outManagement/add",
  54. // query: { xsxk_id },
  55. });
  56. }
  57. const onFailed = (errorInfo) => {
  58. console.log('failed', errorInfo);
  59. };
  60. const userLIST = ref([]);
  61. //获取用户列表
  62. const getUserList=()=> {
  63. let transObjs = {
  64. dept_id: uo_id,
  65. page: 1,
  66. limit: 99999,
  67. };
  68. org_users(transObjs).then((res) => {
  69. if (res.code == 1) {
  70. let tempArr = [];
  71. res.data.page_data.forEach(item => {
  72. tempArr.push({
  73. text: item.user_realname,
  74. value:item.user_id,
  75. })
  76. })
  77. userLIST.value = tempArr;
  78. }
  79. });
  80. }
  81. getUserList();
  82. const dialogCheckVisible = ref(false);
  83. const currentXxwId = ref();
  84. const handleCheckDialog = (item) => {
  85. currentXxwId.value = item.xxw_id;
  86. if (user_realname == item.xxw_spr) {
  87. currentXxwId.value = item.xxw_id;
  88. dialogCheckVisible.value = true;
  89. } else {
  90. showNotify({ type: 'warning', message: '此条申请,您无法审核~' });
  91. return
  92. }
  93. }
  94. const checkedValue = ref('2');
  95. const checkSubmitForm = () => {
  96. let transParams = { xxw_zt: checkedValue.value };
  97. editApi(currentXxwId.value, transParams)
  98. .then(res => {
  99. if (res.code == 1) {
  100. showNotify({ type: 'success', message: res.msg });
  101. dialogCheckVisible.value = false;
  102. onLoad();
  103. }
  104. })
  105. .catch(error => {
  106. console.log(error);
  107. })
  108. }
  109. </script>
  110. <template>
  111. <div class="outMag">
  112. <div v-show="isBureau">
  113. <div style="width: 100%; text-align: center">
  114. <span style="font-size: 20px">本功能仅对校端用户开放</span>
  115. </div>
  116. </div>
  117. <div class="index" v-show="!isBureau">
  118. <!-- <van-nav-bar title="外出管理" left-text="返回" left-arrow @click-left="onClickLeft"/> -->
  119. <van-tabs v-model:active="tabActive" @click-tab="onClickTab">
  120. <van-tab title="外出申请">
  121. <van-dropdown-menu v-if="false">
  122. <van-dropdown-item title="请假人">
  123. <van-cell-group inset>
  124. <van-field v-model="applyPerson" placeholder="请输入请假人" />
  125. </van-cell-group>
  126. <div style="padding: 5px 16px;">
  127. <van-button type="primary" block round @click="onConfirm()">
  128. 确认
  129. </van-button>
  130. </div>
  131. </van-dropdown-item>
  132. </van-dropdown-menu>
  133. <van-pull-refresh v-model="loading" @refresh="onRefresh">
  134. <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
  135. <van-cell v-for="(item,index ) in tableList" :key="index" :title="item.xxq_spr" >
  136. <template #title>
  137. <div>申请时间:{{ item.xxw_sqsj }}</div>
  138. <div>请假人:{{ item.xxw_qjr }}</div>
  139. </template>
  140. <template #label>
  141. <div>外出目的:{{ item.xxw_wcmd }}</div>
  142. <div>开始时间:{{ item.xxw_kssj }}</div>
  143. <div>预计返回时间:{{ item.xxw_yjfhsj }}</div>
  144. <div>实际返回时间:{{ item.xxw_sjfhsj }}</div>
  145. <div>状态:
  146. <span :class="item.xxw_zt_option_k=='1' ? 'greenText' : (item.xxw_zt_option_k=='2' ? '' : 'redText') " >{{ item.xxw_zt }}</span>
  147. </div>
  148. </template>
  149. </van-cell>
  150. </van-list>
  151. </van-pull-refresh>
  152. <van-submit-bar button-type="primary" button-text="外出申请" @submit="linkTo()" />
  153. </van-tab>
  154. <van-tab title="外出审批">
  155. <van-dropdown-menu>
  156. <van-dropdown-item title="请假人">
  157. <van-cell-group inset>
  158. <van-field v-model="applyPerson" placeholder="请输入请假人" />
  159. </van-cell-group>
  160. <div style="padding: 5px 16px;">
  161. <van-button type="primary" block round @click="onConfirm()">
  162. 确认
  163. </van-button>
  164. </div>
  165. </van-dropdown-item>
  166. </van-dropdown-menu>
  167. <van-pull-refresh v-model="loading" @refresh="onRefresh">
  168. <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
  169. <van-cell v-for="(item,index) in tableList" :key="index" :title="item.xxq_spr" >
  170. <template #title>
  171. <div>申请时间:{{ item.xxw_sqsj }}</div>
  172. <div>请假人:{{ item.xxw_qjr }}</div>
  173. </template>
  174. <template #label>
  175. <div>外出目的:{{ item.xxw_wcmd }}</div>
  176. <div>开始时间:{{ item.xxw_kssj }}</div>
  177. <div>预计返回时间:{{ item.xxw_yjfhsj }}</div>
  178. <div>实际返回时间:{{ item.xxw_sjfhsj }}</div>
  179. </template>
  180. <template #right-icon>
  181. <van-button type="primary" size="small" v-if="item.xxw_zt_option_k == 1" @click="handleCheckDialog(item)">审核</van-button>
  182. <van-button type="text" :class="{'greenText':item.xxw_zt_option_k=='2'}" v-else-if="item.xxw_zt_option_k=='2'" >{{ item.xxw_zt }}</van-button>
  183. <van-button type="text" :class="{'redText':item.xxw_zt_option_k=='3'}" v-else="item.xxw_zt_option_k=='3'" >{{ item.xxw_zt }}</van-button>
  184. </template>
  185. </van-cell>
  186. </van-list>
  187. </van-pull-refresh>
  188. <!-- 请假审批弹出框 -->
  189. <van-popup v-model:show="dialogCheckVisible" round position="bottom" :style="{ height: '15%' }">
  190. <div>
  191. <van-form @submit="checkSubmitForm">
  192. <van-field label="审核结果:" name="radio" >
  193. <template #input>
  194. <van-radio-group v-model="checkedValue" direction="horizontal">
  195. <van-radio name="2">同意</van-radio>
  196. <van-radio name="3">不同意</van-radio>
  197. </van-radio-group>
  198. </template>
  199. </van-field>
  200. <div style="margin: 16px;">
  201. <van-button round block type="primary" native-type="submit">提交</van-button>
  202. </div>
  203. </van-form>
  204. </div>
  205. </van-popup>
  206. </van-tab>
  207. </van-tabs>
  208. </div>
  209. </div>
  210. </template>
  211. <style lang="scss" scoped>
  212. .greenText{
  213. color: green;
  214. }
  215. .redText{
  216. color: red;
  217. }
  218. </style>