index.vue 8.2 KB

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