AlvisLiu 1 年之前
父節點
當前提交
b713bc3bf4

+ 10 - 3
src/pages/administrativeService/leaveManagement/add.vue

@@ -1,5 +1,5 @@
 <script setup>
-import { ref, computed } from 'vue';
+import { ref, computed,watch } from 'vue';
 import {userInfo} from '~/store/user';
 
 const {
@@ -113,6 +113,14 @@ const onConfirm_endTimeForm = ({
 
 };
 
+watch([startTimeForm, endTimeForm], () => {
+  // 重新计算时长
+  const start = new Date(startTimeForm.value).getTime();
+  const end = new Date(endTimeForm.value).getTime();
+  console.log('ee', Math.ceil((end - start) / (1000 * 60 * 60 * 24)));
+  duration.value=Math.ceil((end - start) / (1000 * 60 * 60 * 24));
+  // return Math.ceil((end - start) / (1000 * 60 * 60 * 24));
+})
 
 const duration = ref();
 const reason = ref();
@@ -152,8 +160,7 @@ const onSubmit = () => {
     xxq_qjsy: reason.value,
     xxq_kssj: startTimeForm.value,//开始时间
     xxq_jssj: endTimeForm.value,//结束时间
-    // xxq_qjsc: duration.value,
-    xxq_qjsc: 1,
+    xxq_qjsc: duration.value,
     xxq_gzjjr: jobTransferPerson.value,//工作交接人
     xxq_gzjjr_user_id: jobTransferPerson_id.value,//工作交接人id
     xxq_spr: checker.value,//审批人

+ 57 - 44
src/pages/administrativeService/leaveManagement/index.vue

@@ -4,7 +4,7 @@ import {userInfo} from '~/store/user';
 const {uo_type,user_id,uo_id} = userInfo
 import {queryApi,editApi,org_users} from './apiItem';
 
-import { showNotify } from 'vant';
+import { showNotify,showToast } from 'vant';
 const router = useRouter();
 
 const isBureau = ref(false) // 当前用户是否局端
@@ -57,16 +57,20 @@ const finished = ref(false)
 const onLoad = () => {
   let transObjs = {
     page: 1,
+    limit:20,
     xxq_qjlx: applyType.value,
     xxq_qjsy: applyReason.value
   }
   queryApi(transObjs)
-  .then(res => {
-    tableList.value = res.data.page_data;
-    if (tableList.value.length >= res.data.total_rows) {
-      finished.value = true;
-    }
-
+    .then(res => {
+      if (res.code == "1") {
+        tableList.value = res.data.page_data;
+        if (tableList.value.length >= res.data.total_rows) {
+          finished.value = true;
+        }
+        loading.value = false;
+        showToast(res.msg);
+      }
   })
   .catch(error => {
     console.log(error)
@@ -140,6 +144,12 @@ const checkSubmitForm = () => {
 
 }
 
+//上拉刷新
+const onRefresh = () => {
+  onLoad();
+};
+
+
 </script>
 
 <template>
@@ -167,24 +177,25 @@ const checkSubmitForm = () => {
           </van-dropdown-item>
         </van-dropdown-menu>
 
-        <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
-          <van-cell v-for="(item,index ) in tableList" :key="index" :title="item.xxq_spr" >
-            <template #title>
-              <div>申请时间:{{ item.xxq_sqsj }}</div>
-              <div>请假人:{{ item.xxq_qjr }}</div>
-            </template>
-            <template #label>
-              <div>开始时间:{{ item.xxq_kssj }}</div>
-              <div>结束时间:{{ item.xxq_jssj }}</div>
-              <div>请假时长(天):{{ item.xxq_qjsc }}</div>
-              <div>状态:
-                <span :class="item.xxq_zt_option_k == '1' ? 'greenText' : (item.xxq_zt_option_k == '3' ? 'redText' : '')" >{{ item.xxq_zt }}</span>
-              </div>
-            </template>
-
-          </van-cell>
-        </van-list>
+        <van-pull-refresh v-model="loading" @refresh="onRefresh">
+          <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
+            <van-cell v-for="(item,index ) in tableList" :key="index" :title="item.xxq_spr" >
+              <template #title>
+                <div>申请时间:{{ item.xxq_sqsj }}</div>
+                <div>请假人:{{ item.xxq_qjr }}</div>
+              </template>
+              <template #label>
+                <div>开始时间:{{ item.xxq_kssj }}</div>
+                <div>结束时间:{{ item.xxq_jssj }}</div>
+                <div>请假时长(天):{{ item.xxq_qjsc }}</div>
+                <div>状态:
+                  <span :class="item.xxq_zt_option_k == '1' ? 'greenText' : (item.xxq_zt_option_k == '3' ? 'redText' : '')" >{{ item.xxq_zt }}</span>
+                </div>
+              </template>
 
+            </van-cell>
+          </van-list>
+        </van-pull-refresh>
         <van-submit-bar button-type="primary"  button-text="请假申请" @submit="linkTo()" />
 
 
@@ -205,26 +216,28 @@ const checkSubmitForm = () => {
           </van-dropdown-item>
         </van-dropdown-menu>
 
-        <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
-          <van-cell v-for="(item,index) in tableList" :key="index" :title="item.xxq_spr" >
-            <template #title>
-              <div>申请时间:{{ item.xxq_sqsj }}</div>
-              <div>请假人:{{ item.xxq_qjr }}</div>
-            </template>
-            <template #label>
-              <div>开始时间:{{ item.xxq_kssj }}</div>
-              <div>结束时间:{{ item.xxq_jssj }}</div>
-              <div>请假时长(天):{{ item.xxq_qjsc }}</div>
-              <div>请假事由:{{ item.xxq_qjsy }}</div>
-
-            </template>
-
-            <template #right-icon>
-              <van-button type="primary" size="small" v-if="item.xxq_zt_option_k == 1" @click="handleCheckDialog(item)">审核</van-button>
-              <van-button type="text" disabled v-else>已审核</van-button>
-            </template>
-          </van-cell>
-        </van-list>
+        <van-pull-refresh v-model="loading" @refresh="onRefresh">
+          <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
+            <van-cell v-for="(item,index) in tableList" :key="index" :title="item.xxq_spr" >
+              <template #title>
+                <div>申请时间:{{ item.xxq_sqsj }}</div>
+                <div>请假人:{{ item.xxq_qjr }}</div>
+              </template>
+              <template #label>
+                <div>开始时间:{{ item.xxq_kssj }}</div>
+                <div>结束时间:{{ item.xxq_jssj }}</div>
+                <div>请假时长(天):{{ item.xxq_qjsc }}</div>
+                <div>请假事由:{{ item.xxq_qjsy }}</div>
+
+              </template>
+
+              <template #right-icon>
+                <van-button type="primary" size="small" v-if="item.xxq_zt_option_k == 1" @click="handleCheckDialog(item)">审核</van-button>
+                <van-button type="text" disabled v-else>已审核</van-button>
+              </template>
+            </van-cell>
+          </van-list>
+        </van-pull-refresh>
 
         <!-- 请假审批弹出框 -->
           <van-popup v-model:show="dialogCheckVisible" round position="bottom" :style="{ height: '15%' }">

+ 14 - 18
src/pages/administrativeService/outManagement/add.vue

@@ -137,28 +137,24 @@ const onSubmit = () => {
   addApi(transParams)
     .then((res) => {
       if (res.code == '1') {
-        showNotify({ type: 'success', message: res.msg });
-        setTimeout(() => {
-          router.push("/administrativeService/outManagement");
-        }, 1000)
-
+        if ( Approver.value == applyPerson.value) {
+          showNotify({ type: 'success', message: "审批人和请假人不能为同一人" });
+          return
+        } else {
+          addApi(transParams)
+          .then((res) => {
+            if (res.code == '1') {
+              showNotify({ type: 'success', message: res.msg });
+              setTimeout(() => {
+                router.push("/administrativeService/outManagement");
+              }, 1000)
+            }
+          });
+        }
       }
     });
 return
-  if ( xxw_qjr.value == xxw_spr.value) {
-    showNotify({ type: 'success', message: "审批人和请假人不能为同一人" });
-  } else {
-    addApi(transParams)
-    .then((res) => {
-      if (res.code == '1') {
-        showNotify({ type: 'success', message: res.msg });
-        setTimeout(() => {
-          router.push("/administrativeService/outManagement");
-        }, 1000)
 
-      }
-    });
-  }
 
 }
 

+ 79 - 63
src/pages/administrativeService/outManagement/index.vue

@@ -1,9 +1,9 @@
 <script setup>
 import { ref } from "vue";
 import { userInfo } from "~/store/user";
-const {uo_type,user_id,uo_id} = userInfo
+const {uo_type,user_id,uo_id,user_realname} = userInfo
 import { queryApi,editApi,org_users } from "./apiItem";
-import { showNotify } from 'vant';
+import { showNotify,showToast } from 'vant';
 const router = useRouter();
 
 const isBureau = ref(false); // 当前用户是否局端
@@ -11,16 +11,16 @@ isBureau.value = uo_type === "1";
 
 //外出管理-返回
 const onClickLeft = () => history.back();
+const tabActive = ref(0);
 
-const applyPerson = ref("");
+const applyPerson = ref();
 //头部确定按钮
 const onConfirm = (markLabel) => {
   onLoad();
 }
 
 const onClickTab = () => {
-  applyType.value = "";
-  applyReason.value = "";
+  applyPerson.value = "";
   onLoad();
  }
 
@@ -31,21 +31,28 @@ const finished = ref(false)
 const onLoad = () => {
   let transObjs = {
     page: 1,
+    limit:20,
     xxw_qjr:applyPerson.value
   }
   queryApi(transObjs)
-  .then(res => {
-    tableList.value = res.data.page_data;
-    if (tableList.value.length >= res.data.total_rows) {
-      finished.value = true;
-    }
-
+    .then(res => {
+      if (res.code == "1") {
+        tableList.value = res.data.page_data;
+        if (tableList.value.length >= res.data.total_rows) {
+          finished.value = true;
+        }
+        loading.value = false;
+        showToast(res.msg);
+      }
   })
   .catch(error => {
     console.log(error)
   })
 };
-
+//上拉刷新
+const onRefresh = () => {
+  onLoad();
+};
 //跳转
 const linkTo = () => {
   router.push({
@@ -86,19 +93,18 @@ const dialogCheckVisible = ref(false);
 const currentXxwId = ref();
 const handleCheckDialog = (item) => {
   currentXxwId.value = item.xxw_id;
+  if (user_realname == item.xxw_spr) {
+    currentXxwId.value = item.xxw_id;
     dialogCheckVisible.value = true;
-  // if (user_id == item.xxq_spr_user_id) {
-  //   currentXxwId.value = item.xxw_id;
-  //   dialogCheckVisible.value = true;
-  // } else {
-  //   showNotify({ type: 'warning', message: '此条申请,您无法审核~' });
-  //   return
-  // }
+  } else {
+    showNotify({ type: 'warning', message: '此条申请,您无法审核~' });
+    return
+  }
 }
 
 const checkedValue = ref('2');
 const checkSubmitForm = () => {
-  let transParams = { xxw_zt: checkedValue.value }
+  let transParams = { xxw_zt: checkedValue.value };
   editApi(currentXxwId.value, transParams)
   .then(res => {
     if (res.code == 1) {
@@ -112,6 +118,8 @@ const checkSubmitForm = () => {
   })
 
 }
+
+
 </script>
 
 <template>
@@ -123,7 +131,7 @@ const checkSubmitForm = () => {
     </div>
     <div class="index" v-show="!isBureau">
       <van-nav-bar title="外出管理" left-text="返回" left-arrow @click-left="onClickLeft"/>
-      <van-tabs v-model:active="tabActive">
+      <van-tabs v-model:active="tabActive" @click-tab="onClickTab">
         <van-tab title="外出申请">
 
           <van-dropdown-menu>
@@ -138,25 +146,26 @@ const checkSubmitForm = () => {
             </div>
           </van-dropdown-item>
         </van-dropdown-menu>
+        <van-pull-refresh v-model="loading" @refresh="onRefresh">
+          <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
+            <van-cell v-for="(item,index ) in tableList" :key="index" :title="item.xxq_spr" >
+              <template #title>
+                <div>申请时间:{{ item.xxw_sqsj }}</div>
+                <div>请假人:{{ item.xxw_qjr }}</div>
+              </template>
+              <template #label>
+                <div>外出目的:{{ item.xxw_wcmd }}</div>
+                <div>开始时间:{{ item.xxw_kssj }}</div>
+                <div>预计返回时间:{{ item.xxw_yjfhsj }}</div>
+                <div>实际返回时间:{{ item.xxw_sjfhsj }}</div>
+                <div>状态:
+                  <span :class="item.xxw_zt_option_k=='1' ? 'greenText' : (item.xxw_zt_option_k=='2' ? '' : 'redText') " >{{ item.xxw_zt }}</span>
+                </div>
+              </template>
 
-        <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
-          <van-cell v-for="(item,index ) in tableList" :key="index" :title="item.xxq_spr" >
-            <template #title>
-              <div>申请时间:{{ item.xxw_sqsj }}</div>
-              <div>请假人:{{ item.xxw_qjr }}</div>
-            </template>
-            <template #label>
-              <div>外出目的:{{ item.xxw_wcmd }}</div>
-              <div>开始时间:{{ item.xxw_kssj }}</div>
-              <div>预计返回时间:{{ item.xxw_yjfhsj }}</div>
-              <div>实际返回时间:{{ item.xxw_sjfhsj }}</div>
-              <div>状态:
-                <span :class="item.xxw_zt_option_k=='1' ? 'greenText' : (item.xxw_zt_option_k=='2' ? '' : 'redText') " >{{ item.xxw_zt }}</span>
-              </div>
-            </template>
-
-          </van-cell>
-        </van-list>
+            </van-cell>
+          </van-list>
+        </van-pull-refresh>
 
         <van-submit-bar button-type="primary"  button-text="外出申请" @submit="linkTo()" />
 
@@ -175,29 +184,29 @@ const checkSubmitForm = () => {
             </div>
           </van-dropdown-item>
         </van-dropdown-menu>
-
-        <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
-          <van-cell v-for="(item,index) in tableList" :key="index" :title="item.xxq_spr" >
-            <template #title>
-              <div>申请时间:{{ item.xxw_sqsj }}</div>
-              <div>请假人:{{ item.xxw_qjr }}</div>
-            </template>
-            <template #label>
-              <div>外出目的:{{ item.xxw_wcmd }}</div>
-              <div>开始时间:{{ item.xxw_kssj }}</div>
-              <div>预计返回时间:{{ item.xxw_yjfhsj }}</div>
-              <div>实际返回时间:{{ item.xxw_sjfhsj }}</div>
-
-            </template>
-
-            <template #right-icon>
-              <van-button type="primary" size="small" v-if="item.xxw_zt_option_k == 1" @click="handleCheckDialog(item)">审核</van-button>
-              <van-button type="text" disabled="false" :class="{'greenText':item.xxw_zt_option_k=='2'}" v-else-if="item.xxw_zt_option_k=='2'" >{{ item.xxw_zt }}</van-button>
-              <van-button type="text" disabled="false" :class="{'redText':item.xxw_zt_option_k=='3'}" v-else="item.xxw_zt_option_k=='3'" >{{ item.xxw_zt }}</van-button>
-            </template>
-          </van-cell>
-        </van-list>
-
+        <van-pull-refresh v-model="loading" @refresh="onRefresh">
+          <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
+            <van-cell v-for="(item,index) in tableList" :key="index" :title="item.xxq_spr" >
+              <template #title>
+                <div>申请时间:{{ item.xxw_sqsj }}</div>
+                <div>请假人:{{ item.xxw_qjr }}</div>
+              </template>
+              <template #label>
+                <div>外出目的:{{ item.xxw_wcmd }}</div>
+                <div>开始时间:{{ item.xxw_kssj }}</div>
+                <div>预计返回时间:{{ item.xxw_yjfhsj }}</div>
+                <div>实际返回时间:{{ item.xxw_sjfhsj }}</div>
+
+              </template>
+
+              <template #right-icon>
+                <van-button type="primary" size="small" v-if="item.xxw_zt_option_k == 1" @click="handleCheckDialog(item)">审核</van-button>
+                <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>
+                <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>
+              </template>
+            </van-cell>
+          </van-list>
+        </van-pull-refresh>
         <!-- 请假审批弹出框 -->
           <van-popup v-model:show="dialogCheckVisible" round position="bottom" :style="{ height: '15%' }">
             <div>
@@ -224,4 +233,11 @@ const checkSubmitForm = () => {
   </div>
 </template>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.greenText{
+  color: green;
+}
+.redText{
+  color: red;
+}
+</style>