index.vue 7.8 KB

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