浏览代码

行政办公-请假 外出

AlvisLiu 1 年之前
父节点
当前提交
56ca24e2c9

+ 240 - 0
src/pages/administrativeService/leaveManagement/add.vue

@@ -0,0 +1,240 @@
+<script setup>
+import { ref, computed } from 'vue';
+import {userInfo} from '~/store/user';
+
+const {
+  uo_type,
+  user_id,
+  uo_id
+} = userInfo
+import {
+  addApi,
+  org_users
+} from './apiItem';
+import { showNotify } from 'vant';
+const router = useRouter();
+
+
+const onclickBack = () => {
+  router.push("/administrativeService/leaveManagement");
+}
+
+const holidayType = ref();
+const holidayType_value = ref();
+const showPicker_holidayType = ref(false);
+const holidayTypeList = ref([
+  { text: '事假', value: '1' },
+  { text: '病假', value: '2' },
+  { text: '婚假', value: '3' },
+  { text: '丧假', value: '4' },
+  { text: '产假', value: '5' },
+  { text: '年休假', value: '6' },
+  { text: '调休', value: '7' },
+  { text: '其他', value: '8' },
+])
+const onConfirm_holidayType = ({ selectedOptions }) => {
+  holidayType.value = selectedOptions[0]?.text;
+  holidayType_value.value=selectedOptions[0]?.value;
+  showPicker_holidayType.value = false;
+};
+
+
+
+const applyTime = ref('');
+const showPicker_applyTime = ref(false);
+const onConfirm_applyTime = ({
+  selectedValues
+}) => {
+  applyTime.value = selectedValues.join('/');
+  showPicker_applyTime.value = false;
+};
+
+/******请假人********/
+const userLIST = ref([]);
+const columns = ref([]);
+//获取用户列表
+const getUserList=()=> {
+  let transObjs = {
+    dept_id: uo_id,
+    page: 1,
+    limit: 99999,
+  };
+  org_users(transObjs).then((res) => {
+    if (res.code == 1) {
+      let tempArr = [];
+      res.data.page_data.forEach(item => {
+        tempArr.push({
+          text: item.user_realname,
+          value:item.user_id,
+        })
+      })
+      userLIST.value = tempArr;
+      columns.value = userLIST.value;
+    }
+  });
+}
+getUserList();
+
+const applyPerson = ref('');
+const applyPerson_id = ref('');
+const showPicker_applyPerson = ref(false);
+const onConfirm_applyPerson = ({ selectedOptions }) => {
+  applyPerson.value = selectedOptions[0]?.text;
+  applyPerson_id.value = selectedOptions[0]?.value;
+  showPicker_applyPerson.value = false;
+};
+
+
+const startTimeForm = ref('');
+const showPicker_startTimeForm = ref(false);
+const onConfirm_startTimeForm = ({
+  selectedValues
+}) => {
+  startTimeForm.value = selectedValues.join('/');
+  showPicker_startTimeForm.value = false;
+};
+
+/***********结束时间*****/
+const endTimeForm = ref('');
+const showPicker_endTimeForm = ref(false);
+const onConfirm_endTimeForm = ({
+  selectedValues
+}) => {
+  endTimeForm.value = selectedValues.join('/');
+  showPicker_endTimeForm.value = false;
+
+  // duration.value = computed(() => {
+  //   const start = new Date(startTimeForm.value);
+  //   const end = new Date(endTimeForm.value);
+  //   let d = end.getTime() - start.getTime();
+  //   return `${Math.floor(d / 1000)} seconds`;
+  //   return 1;
+  // })
+
+};
+
+
+const duration = ref();
+const reason = ref();
+
+
+/************工作交接人*/
+const jobTransferPerson = ref('');
+const jobTransferPerson_id = ref('');
+const showPicker_jobTransferPerson = ref(false);
+const onConfirm_jobTransferPerson = ({ selectedOptions }) => {
+  jobTransferPerson.value = selectedOptions[0]?.text;
+  jobTransferPerson_id.value = selectedOptions[0]?.value;
+  showPicker_jobTransferPerson.value = false;
+};
+
+/****审批人****/
+const checker = ref('');
+const checker_id = ref('');
+const showPicker_checker = ref(false);
+const onConfirm_checker = ({ selectedOptions }) => {
+  checker.value = selectedOptions[0]?.text;
+  checker_id.value=selectedOptions[0]?.value;
+  showPicker_checker.value = false;
+};
+
+
+// 提交按钮
+const onFailed = (errorInfo) => {
+  console.log('failed', errorInfo);
+};
+const onSubmit = () => {
+  var transParams = {
+    xxq_qjlx: holidayType_value.value,
+    xxq_sqsj: applyTime.value,
+    xxq_qjr: applyPerson.value,//请假人
+    xxq_qjr_user_id: applyPerson_id.value,////请假人id
+    xxq_qjsy: reason.value,
+    xxq_kssj: startTimeForm.value,//开始时间
+    xxq_jssj: endTimeForm.value,//结束时间
+    // xxq_qjsc: duration.value,
+    xxq_qjsc: 1,
+    xxq_gzjjr: jobTransferPerson.value,//工作交接人
+    xxq_gzjjr_user_id: jobTransferPerson_id.value,//工作交接人id
+    xxq_spr: checker.value,//审批人
+    xxq_spr_user_id: checker_id.value,//审批人id
+  }
+  console.log('transParams',transParams);
+
+  if ( checker_id.value == applyPerson_id.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/leaveManagement");
+        },1000)
+      }
+    });
+  }
+
+}
+</script>
+
+<template>
+<div class="addApplyHoliday">
+  <van-nav-bar title="请假管理" left-text="返回" left-arrow @click-left="onclickBack" />
+
+  <van-form @failed="onFailed"  ref="ApplyHolidyFormRef"  @submit="onSubmit()" >
+    <van-cell-group inset>
+
+      <van-field v-model="holidayType" prop="holidayType" is-link readonly name="picker" label="请假类型" placeholder="点击选择请假类型" @click="showPicker_holidayType = true" />
+      <van-popup v-model:show="showPicker_holidayType" position="bottom">
+        <van-picker :columns="holidayTypeList" @confirm="onConfirm_holidayType" @cancel="showPicker_holidayType = false" />
+      </van-popup>
+
+      <van-field v-model="applyTime" prop="applyTime" is-link readonly name="datePicker" label="申请时间" placeholder="点击选择申请时间" @click="showPicker_applyTime = true" />
+      <van-popup v-model:show="showPicker_applyTime" position="bottom">
+        <van-date-picker @confirm="onConfirm_applyTime" @cancel="showPicker_applyTime = false" />
+      </van-popup>
+
+      <van-field v-model="applyPerson" is-link readonly name="picker" label="请假人" placeholder="点击选择请假人" @click="showPicker_applyPerson = true" />
+      <van-popup v-model:show="showPicker_applyPerson" position="bottom">
+        <van-picker :columns="columns" @confirm="onConfirm_applyPerson" @cancel="showPicker_applyPerson = false" />
+      </van-popup>
+
+      <van-field v-model="startTimeForm" is-link readonly name="datePicker" label="开始时间" placeholder="点击选择开始时间" @click="showPicker_startTimeForm = true" />
+      <van-popup v-model:show="showPicker_startTimeForm" position="bottom">
+        <van-date-picker @confirm="onConfirm_startTimeForm" @cancel="showPicker_startTimeForm = false" />
+      </van-popup>
+
+      <van-field v-model="endTimeForm" is-link readonly name="datePicker" label="结束时间" placeholder="点击选择结束时间" @click="showPicker_endTimeForm = true" />
+      <van-popup v-model:show="showPicker_endTimeForm" position="bottom">
+        <van-date-picker @confirm="onConfirm_endTimeForm" @cancel="showPicker_endTimeForm = false" />
+      </van-popup>
+
+      <van-field v-model="duration" name="请假时长(天)" label="请假时长(天)" placeholder="自动计算" disabled="false" />
+
+      <van-field v-model="reason" rows="2" autosize label="请假原因" type="textarea" maxlength="150" placeholder="请输入请假原因" show-word-limit/>
+
+      <van-field v-model="jobTransferPerson" is-link readonly name="picker" label="工作交接人" placeholder="点击选择工作交接人" @click="showPicker_jobTransferPerson = true" />
+      <van-popup v-model:show="showPicker_jobTransferPerson" position="bottom">
+        <van-picker :columns="columns" @confirm="onConfirm_jobTransferPerson" @cancel="showPicker_jobTransferPerson = false" />
+      </van-popup>
+
+      <van-field v-model="checker" is-link readonly name="picker" label="审批人" placeholder="点击选择审批人" @click="showPicker_checker = true" />
+      <van-popup v-model:show="showPicker_checker" position="bottom">
+        <van-picker :columns="columns" @confirm="onConfirm_checker" @cancel="showPicker_checker = false" />
+      </van-popup>
+
+
+    </van-cell-group>
+    <div style="margin: 16px;">
+      <van-button round block type="primary" native-type="submit">提交</van-button>
+    </div>
+  </van-form>
+
+</div>
+</template>
+
+<style lang="scss" scoped>
+
+</style>

+ 88 - 137
src/pages/administrativeService/leaveManagement/index.vue

@@ -1,29 +1,18 @@
-<<<<<<< HEAD
-<template>
-  <div>
-2222
-  </div>
-</template>
-
-<script setup>
-
-</script>
-
-<style lang="scss" scoped>
-
-=======
 <script setup >
 import {ref} from 'vue';
 import {userInfo} from '~/store/user';
 const {uo_type,user_id,uo_id} = userInfo
-import {queryApi,org_users} from './apiItem';
+import {queryApi,editApi,org_users} from './apiItem';
+
+import { showNotify } from 'vant';
+const router = useRouter();
 
 const isBureau = ref(false) // 当前用户是否局端
 isBureau.value = uo_type === '1'
 /***************************请假管理*******************************************/
 
 //外出管理-返回
-const onClickLeft = () => history.back();
+const onclickBack = () => history.back();
 
 const tabActive = ref(0);
 
@@ -35,36 +24,41 @@ const applyTypeOption = ref([
   { text: '婚假', value: 3 },
   { text: '丧假', value: 4 },
   { text: '产假', value: 5 },
-  { text: '年休假', value: 6 },
+  { text: '年休假', value: 6},
   { text: '调休', value: 7 },
   { text: '其他', value: 8 },
 ]);
 const applyReason = ref();
 
+//select请求
+const dropItemChange = (fromA) => {
+  if (fromA == "qjlx") {
+  console.log(fromA);
+  } else {
+    console.log('44');
+  }
+  onLoad();
+}
+//头部确定按钮
+const onConfirm = (markLabel) => {
+  onLoad();
+}
+
+const onClickTab = () => {
+  applyType.value = "";
+  applyReason.value = "";
+  onLoad();
+ }
 
 const tableList = ref([])
 const loading = ref(false)
 const finished = ref(false)
 
 const onLoad = () => {
-  // 异步更新数据
-  // setTimeout 仅做示例,真实场景中一般为 ajax 请求
-  setTimeout(() => {
-    for (let i = 0; i < 10; i++) {
-      list.value.push(list.value.length + 1);
-    }
-
-    // 加载状态结束
-    loading.value = false;
-
-    // 数据全部加载完成
-    if (list.value.length >= 40) {
-      finished.value = true;
-    }
-  }, 1000);
-
   let transObjs = {
-    page:1
+    page: 1,
+    xxq_qjlx: applyType.value,
+    xxq_qjsy: applyReason.value
   }
   queryApi(transObjs)
   .then(res => {
@@ -79,34 +73,13 @@ const onLoad = () => {
   })
 };
 
-const onSubmit = () => {
-  show.value = true;
-}
-
-const show = ref(false);
-
-const value1 = ref('');
-const value2 = ref('');
-const value3 = ref('abc');
-const value4 = ref('');
-const pattern = /\d{6}/;
-
-// 校验函数返回 true 表示校验通过,false 表示不通过
-const validator = (val) => /1\d{10}/.test(val);
-
-// 校验函数可以直接返回一段错误提示
-const validatorMessage = (val) => `${val} 不合法,请重新输入`;
-
-// 校验函数可以返回 Promise,实现异步校验
-const asyncValidator = (val) =>
-  new Promise((resolve) => {
-    showLoadingToast('验证中...');
-
-    setTimeout(() => {
-      closeToast();
-      resolve(val === '1234');
-    }, 1000);
+//跳转
+const linkTo = () => {
+  router.push({
+    path: "/administrativeService/leaveManagement/add",
+    // query: { xsxk_id },
   });
+}
 
 const onFailed = (errorInfo) => {
   console.log('failed', errorInfo);
@@ -138,17 +111,34 @@ const getUserList=()=> {
 }
 getUserList();
 
-
+const dialogCheckVisible = ref(false);
+const currentXxqId = ref();
 const handleCheckDialog = (item) => {
   if (user_id == item.xxq_spr_user_id) {
-    this.dialogCheckVisible = true;
-    this.curCheckId = row.xxq_id;
+    currentXxqId.value = item.xxq_id;
+    dialogCheckVisible.value = true;
   } else {
     showNotify({ type: 'warning', message: '此条申请,您无法审核~' });
     return
   }
 }
 
+const checkedValue = ref('2');
+const checkSubmitForm = () => {
+  let transParams = { xxq_zt: checkedValue.value }
+  editApi(currentXxqId.value, transParams)
+  .then(res => {
+    if (res.code == 1) {
+      dialogCheckVisible.value = false;
+      showNotify({ type: 'success', message: res.msg });
+      onLoad();
+    }
+  })
+  .catch(error => {
+    console.log(error);
+  })
+
+}
 
 </script>
 
@@ -158,19 +148,19 @@ const handleCheckDialog = (item) => {
     <div style="width: 100%;text-align: center;"><span style="font-size: 20px;">本功能仅对校端用户开放</span></div>
   </div>
   <div class="index" v-show="!isBureau">
-    <van-nav-bar title="请假管理" left-text="返回" left-arrow @click-left="onClickLeft"/>
+    <van-nav-bar title="请假管理" left-text="返回" left-arrow @click-left="onclickBack"/>
 
-    <van-tabs v-model:active="tabActive">
+    <van-tabs v-model:active="tabActive" @click-tab="onClickTab">
       <van-tab title="请假管理">
 
         <van-dropdown-menu>
-          <van-dropdown-item v-model="applyType" title="请假类型" :options="applyTypeOption"  @change="dropItemChange" />
-          <van-dropdown-item ref="itemRef2" title="请假事由">
+          <van-dropdown-item v-model="applyType" title="请假类型" :options="applyTypeOption"  @change="dropItemChange('qjlx')" />
+          <van-dropdown-item  title="请假事由">
             <van-cell-group inset>
               <van-field v-model="applyReason" placeholder="请输入请假事由" />
             </van-cell-group>
             <div style="padding: 5px 16px;">
-              <van-button type="primary" block round @click="onConfirm(0)">
+              <van-button type="primary" block round @click="onConfirm('qjgl')">
                 确认
               </van-button>
             </div>
@@ -178,7 +168,7 @@ const handleCheckDialog = (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" >
+          <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>
@@ -195,62 +185,20 @@ const handleCheckDialog = (item) => {
           </van-cell>
         </van-list>
 
-        <van-submit-bar  button-text="请假申请" @submit="onSubmit" />
-
-        <van-dialog v-model:show="show" title="请假申请" confirmButtonDisabled="false">
-          <van-form @failed="onFailed">
-            <van-cell-group inset>
-              <!-- 通过 pattern 进行正则校验 -->
-              <van-field
-                v-model="value1"
-                name="申请时间"
-                label="申请时间"
-                placeholder="正则校验"
-                :rules="[{ pattern, message: '请输入正确内容' }]"
-              />
-              <!-- 通过 validator 进行函数校验 -->
-              <van-field
-                v-model="value2"
-                name="请假人:"
-                label="请假人:"
-                placeholder="函数校验"
-                :rules="[{ validator, message: '请输入正确内容' }]"
-              />
-              <!-- 通过 validator 返回错误提示 -->
-              <van-field
-                v-model="value3"
-                name="validatorMessage"
-                placeholder="校验函数返回错误提示"
-                :rules="[{ validator: validatorMessage }]"
-              />
-              <!-- 通过 validator 进行异步函数校验 -->
-              <van-field
-                v-model="value4"
-                name="asyncValidator"
-                placeholder="异步函数校验"
-                :rules="[{ validator: asyncValidator, message: '请输入正确内容' }]"
-              />
-            </van-cell-group>
-            <div style="margin: 16px;">
-              <van-button round block type="primary" native-type="submit">
-                提交
-              </van-button>
-            </div>
-          </van-form>
+        <van-submit-bar button-type="primary"  button-text="请假申请" @submit="linkTo()" />
 
-        </van-dialog>
 
       </van-tab>
       <van-tab title="请假审批">
         <van-dropdown-menu>
-          <van-dropdown-item v-model="applyType" title="请假类型" :options="applyTypeOption"  />
-          <van-dropdown-item v-model="applyPerson" title="申请人" :options="userLIST"  />
-          <van-dropdown-item ref="itemRef2" title="请假事由">
+          <van-dropdown-item v-model="applyType" title="请假类型" :options="applyTypeOption"  @change="dropItemChange('qjsp')" />
+          <van-dropdown-item v-model="applyPerson" title="申请人" :options="userLIST" @change="dropItemChange('qjsp')" />
+          <van-dropdown-item  title="请假事由">
             <van-cell-group inset>
               <van-field v-model="applyReason" placeholder="请输入请假事由" />
             </van-cell-group>
             <div style="padding: 5px 16px;">
-              <van-button type="primary" block round @click="onConfirm(0)">
+              <van-button type="primary" block round @click="onConfirm('qjsp')">
                 确认
               </van-button>
             </div>
@@ -258,7 +206,7 @@ const handleCheckDialog = (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" >
+          <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>
@@ -272,17 +220,34 @@ const handleCheckDialog = (item) => {
             </template>
 
             <template #right-icon>
-              <van-button type="primary" size="small" @click="handleCheckDialog(item)">审核</van-button>
+              <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-tab>
-    </van-tabs>
-
-
+        <!-- 请假审批弹出框 -->
+          <van-popup v-model:show="dialogCheckVisible" round position="bottom" :style="{ height: '15%' }">
+            <div>
+              <van-form @submit="checkSubmitForm">
+                <van-field label="审核结果:" name="radio"  >
+                  <template #input>
+                    <van-radio-group v-model="checkedValue" direction="horizontal">
+                      <van-radio name="2">同意</van-radio>
+                      <van-radio name="3">不同意</van-radio>
+                    </van-radio-group>
+                  </template>
+                </van-field>
+                <div style="margin: 16px;">
+                  <van-button round block type="primary" native-type="submit">提交</van-button>
+                </div>
+              </van-form>
+            </div>
 
+          </van-popup>
 
+      </van-tab>
+    </van-tabs>
 
 
   </div>
@@ -290,24 +255,10 @@ const handleCheckDialog = (item) => {
 </template>
 
 <style lang="scss" scoped>
-.vant-table-container {
-  width: 100%;
-  padding: 20px;
-  box-sizing: border-box;
-}
-
-.even-row {
-  background-color: #f7f7f7;
-}
-
-.odd-row {
-  background-color: #ffffff;
-}
 .greenText{
   color: green;
 }
 .redText{
   color: red;
 }
->>>>>>> liua
 </style>

+ 224 - 0
src/pages/administrativeService/outManagement/add.vue

@@ -0,0 +1,224 @@
+<script setup>
+import {
+  ref
+} from 'vue';
+import {
+  userInfo
+} from '~/store/user';
+const {
+  uo_type,
+  user_id,
+  uo_id
+} = userInfo
+import {
+  addApi,
+  org_users
+} from './apiItem';
+const router = useRouter();
+import { showNotify } from 'vant';
+const onclickBack = () => {
+  router.push("/administrativeService/outManagement");
+}
+
+
+const applyTime = ref('');
+const showPicker_applyTime = ref(false);
+const onConfirm_applyTime = ({
+  selectedValues
+}) => {
+  applyTime.value = selectedValues.join('/');
+  showPicker_applyTime.value = false;
+};
+
+/******请假人********/
+const userLIST = ref([]);
+const columns = ref([]);
+//获取用户列表
+const getUserList=()=> {
+  let transObjs = {
+    dept_id: uo_id,
+    page: 1,
+    limit: 99999,
+  };
+  org_users(transObjs).then((res) => {
+    if (res.code == 1) {
+      let tempArr = [];
+      res.data.page_data.forEach(item => {
+        tempArr.push({
+          text: item.user_realname,
+          value:item.user_id,
+        })
+      })
+      userLIST.value = tempArr;
+      columns.value = userLIST.value;
+    }
+  });
+}
+getUserList();
+
+const applyPerson = ref('');
+const applyPerson_id = ref('');
+const showPicker_applyPerson = ref(false);
+const onConfirm_applyPerson = ({ selectedOptions }) => {
+  applyPerson.value = selectedOptions[0]?.text;
+  applyPerson_id.value = selectedOptions[0]?.value;
+  showPicker_applyPerson.value = false;
+};
+
+
+const begainTime = ref('');
+const showPicker_begainTime = ref(false);
+const onConfirm_begainTime = ({
+  selectedValues
+}) => {
+  begainTime.value = selectedValues.join('/');
+  showPicker_begainTime.value = false;
+};
+
+/***********结束时间*****/
+const backTime = ref('');
+const showPicker_backTime = ref(false);
+const onConfirm_backTime = ({
+  selectedValues
+}) => {
+  backTime.value = selectedValues.join('/');
+  showPicker_backTime.value = false;
+
+  // duration.value = computed(() => {
+  //   const start = new Date(startTimeForm.value);
+  //   const end = new Date(endTimeForm.value);
+  //   let d = end.getTime() - start.getTime();
+  //   return `${Math.floor(d / 1000)} seconds`;
+  //   return 1;
+  // })
+
+};
+
+const actualTime = ref('');
+const showPicker_actualTime = ref(false);
+const onConfirm_actualTime = ({
+  selectedValues
+}) => {
+  actualTime.value = selectedValues.join('/');
+  showPicker_actualTime.value = false;
+};
+
+const outDestination = ref();
+const remark = ref();
+
+
+
+/****审批人****/
+const Approver = ref('');
+const Approver_id = ref('');
+const showPicker_Approver = ref(false);
+const onConfirm_Approver = ({ selectedOptions }) => {
+  Approver.value = selectedOptions[0]?.text;
+  Approver_id.value=selectedOptions[0]?.value;
+  showPicker_Approver.value = false;
+};
+
+
+// 提交按钮
+const onFailed = (errorInfo) => {
+  console.log('failed', errorInfo);
+};
+const onSubmit = () => {
+  var transParams = {
+    xxw_sqsj:applyTime.value,
+    xxw_qjr:applyPerson.value,//请假人
+    xxw_wcmd:outDestination.value,
+    xxw_kssj:begainTime.value,
+    xxw_yjfhsj:backTime.value,
+    xxw_sjfhsj:actualTime.value,
+    xxw_spr:Approver.value,//审批人
+    xxw_bz:remark.value,
+  }
+  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)
+
+      }
+    });
+  }
+
+}
+
+</script>
+
+<template>
+  <div class="outAdd">
+    <van-nav-bar title="外出管理" left-text="返回" left-arrow @click-left="onclickBack" />
+    <!-- @failed=""onFailed -->
+    <van-form   @submit="onSubmit()" >
+    <van-cell-group inset>
+
+      <van-field v-model="applyTime" prop="applyTime" is-link readonly name="datePicker" label="申请时间" placeholder="点击选择申请时间" @click="showPicker_applyTime = true" />
+      <van-popup v-model:show="showPicker_applyTime" position="bottom">
+        <van-date-picker @confirm="onConfirm_applyTime" @cancel="showPicker_applyTime = false" />
+      </van-popup>
+
+      <van-field v-model="applyPerson" is-link readonly name="picker" label="请假人" placeholder="点击选择请假人" @click="showPicker_applyPerson = true" />
+      <van-popup v-model:show="showPicker_applyPerson" position="bottom">
+        <van-picker :columns="columns" @confirm="onConfirm_applyPerson" @cancel="showPicker_applyPerson = false" />
+      </van-popup>
+
+      <van-field v-model="begainTime" is-link readonly name="datePicker" label="开始时间" placeholder="点击选择开始时间" @click="showPicker_begainTime = true" />
+      <van-popup v-model:show="showPicker_begainTime" position="bottom">
+        <van-date-picker @confirm="onConfirm_begainTime" @cancel="showPicker_begainTime = false" />
+      </van-popup>
+
+      <van-field v-model="backTime" is-link readonly name="datePicker" label="预计返回时间" placeholder="点击选择预计返回时间" @click="showPicker_backTime = true" />
+      <van-popup v-model:show="showPicker_backTime" position="bottom">
+        <van-date-picker @confirm="onConfirm_backTime" @cancel="showPicker_backTime = false" />
+      </van-popup>
+
+      <van-field v-model="actualTime" is-link readonly name="datePicker" label="实际返回时间" placeholder="点击选择实际返回时间" @click="showPicker_actualTime = true" />
+      <van-popup v-model:show="showPicker_actualTime" position="bottom">
+        <van-date-picker @confirm="onConfirm_actualTime" @cancel="showPicker_actualTime = false" />
+      </van-popup>
+
+      <van-field v-model="outDestination" rows="2" autosize label="外出目的" type="textarea" maxlength="150" placeholder="请输入外出目的" show-word-limit/>
+
+      <van-field v-model="remark" rows="2" autosize label="备注" type="textarea" maxlength="150" placeholder="请输入备注" show-word-limit/>
+
+
+      <van-field v-model="Approver" is-link readonly name="picker" label="审批人" placeholder="点击选择审批人" @click="showPicker_Approver = true" />
+      <van-popup v-model:show="showPicker_Approver" position="bottom">
+        <van-picker :columns="columns" @confirm="onConfirm_Approver" @cancel="showPicker_Approver = false" />
+      </van-popup>
+
+
+    </van-cell-group>
+    <div style="margin: 16px;">
+      <van-button round block type="primary" native-type="submit">提交</van-button>
+    </div>
+  </van-form>
+
+
+  </div>
+</template>
+
+
+
+<style lang="scss" scoped>
+
+</style>

+ 3 - 3
src/pages/administrativeService/outManagement/apiItem.js

@@ -1,9 +1,9 @@
-import request from '@/utils/request';
+import request from '~/utils/request';
 //列表数据
-export const queryApi = (choosePage, data = {}) =>
+export const queryApi = (data = {}) =>
   request({
     url: '/xdbg/xzfw_wcgl/index',
-    data: { limit: 10, page: choosePage },
+    data
   });
 // 添加接口
 export const addApi = (data = {}) => request({

+ 199 - 18
src/pages/administrativeService/outManagement/index.vue

@@ -1,23 +1,10 @@
-<<<<<<< HEAD
-<template>
-  <div>
-1111333333
-  </div>
-</template>
-
 <script setup>
-
-</script>
-
-<style lang="scss" scoped>
-
-</style>
-=======
-<script>
 import { ref } from "vue";
 import { userInfo } from "~/store/user";
-const { uo_type } = userInfo;
-import { queryApi } from "./apiItem";
+const {uo_type,user_id,uo_id} = userInfo
+import { queryApi,editApi,org_users } from "./apiItem";
+import { showNotify } from 'vant';
+const router = useRouter();
 
 const isBureau = ref(false); // 当前用户是否局端
 isBureau.value = uo_type === "1";
@@ -25,7 +12,106 @@ isBureau.value = uo_type === "1";
 //外出管理-返回
 const onClickLeft = () => history.back();
 
+const applyPerson = ref("");
+//头部确定按钮
+const onConfirm = (markLabel) => {
+  onLoad();
+}
+
+const onClickTab = () => {
+  applyType.value = "";
+  applyReason.value = "";
+  onLoad();
+ }
+
+const tableList = ref([])
+const loading = ref(false)
+const finished = ref(false)
+
+const onLoad = () => {
+  let transObjs = {
+    page: 1,
+    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;
+    }
+
+  })
+  .catch(error => {
+    console.log(error)
+  })
+};
+
+//跳转
+const linkTo = () => {
+  router.push({
+    path: "/administrativeService/outManagement/add",
+    // query: { xsxk_id },
+  });
+}
+
+const onFailed = (errorInfo) => {
+  console.log('failed', errorInfo);
+};
+
 
+const userLIST = ref([]);
+//获取用户列表
+const getUserList=()=> {
+  let transObjs = {
+    dept_id: uo_id,
+    page: 1,
+    limit: 99999,
+  };
+  org_users(transObjs).then((res) => {
+    if (res.code == 1) {
+      let tempArr = [];
+      res.data.page_data.forEach(item => {
+        tempArr.push({
+          text: item.user_realname,
+          value:item.user_id,
+        })
+      })
+      userLIST.value = tempArr;
+    }
+  });
+}
+getUserList();
+
+const dialogCheckVisible = ref(false);
+const currentXxwId = ref();
+const handleCheckDialog = (item) => {
+  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
+  // }
+}
+
+const checkedValue = ref('2');
+const checkSubmitForm = () => {
+  let transParams = { xxw_zt: checkedValue.value }
+  editApi(currentXxwId.value, transParams)
+  .then(res => {
+    if (res.code == 1) {
+      showNotify({ type: 'success', message: res.msg });
+      dialogCheckVisible.value = false;
+      onLoad();
+    }
+  })
+  .catch(error => {
+    console.log(error);
+  })
+
+}
 </script>
 
 <template>
@@ -37,10 +123,105 @@ const onClickLeft = () => history.back();
     </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-tab title="外出申请">
+
+          <van-dropdown-menu>
+          <van-dropdown-item  title="请假人">
+            <van-cell-group inset>
+              <van-field v-model="applyPerson" placeholder="请输入请假人" />
+            </van-cell-group>
+            <div style="padding: 5px 16px;">
+              <van-button type="primary" block round @click="onConfirm()">
+                确认
+              </van-button>
+            </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>
+              <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-submit-bar button-type="primary"  button-text="外出申请" @submit="linkTo()" />
+
+        </van-tab>
+        <van-tab title="外出审批">
+
+          <van-dropdown-menu>
+          <van-dropdown-item  title="请假人">
+            <van-cell-group inset>
+              <van-field v-model="applyPerson" placeholder="请输入请假人" />
+            </van-cell-group>
+            <div style="padding: 5px 16px;">
+              <van-button type="primary" block round @click="onConfirm()">
+                确认
+              </van-button>
+            </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-popup v-model:show="dialogCheckVisible" round position="bottom" :style="{ height: '15%' }">
+            <div>
+              <van-form @submit="checkSubmitForm">
+                <van-field label="审核结果:" name="radio"  >
+                  <template #input>
+                    <van-radio-group v-model="checkedValue" direction="horizontal">
+                      <van-radio name="2">同意</van-radio>
+                      <van-radio name="3">不同意</van-radio>
+                    </van-radio-group>
+                  </template>
+                </van-field>
+                <div style="margin: 16px;">
+                  <van-button round block type="primary" native-type="submit">提交</van-button>
+                </div>
+              </van-form>
+            </div>
+
+          </van-popup>
 
+        </van-tab>
+      </van-tabs>
     </div>
   </div>
 </template>
 
 <style lang="scss" scoped></style>
->>>>>>> liua