Kaynağa Gözat

更新工作审批

libushang 6 ay önce
ebeveyn
işleme
f5639b9cec

+ 17 - 0
src/api/InformationReception/InformationReception.ts

@@ -62,3 +62,20 @@ export function WorkApprovalConfirm(data) {
     data: data
   });
 }
+
+// 转交
+export function WorkApprovalRedirect(data) {
+  return request({
+      url: "/api/info_publish/me/work_approval/redirect",
+      method: 'post',
+      data: data
+  });
+}
+
+// 通讯录
+export function getPhoneList() {
+  return request({
+      url: '/api/info_publish/addressbook/alldepts',
+      method: 'get'
+  });
+}

+ 9 - 0
src/router/routes.ts

@@ -306,6 +306,15 @@ export const constantRoutes: Array<RouteRecordRaw> = [
       title: "审批详情"
     }
   },
+  {
+    path: "/workApproval/redirect",
+    name: "workApprovalRedirect",
+    component: () =>
+      import("@/views/workApproval/approvalRedirect.vue"),
+    meta: {
+      title: "转交"
+    }
+  },
   {
     path: "/rollCallDetails",
     name: "RollCallDetails",

+ 182 - 0
src/views/workApproval/approvalRedirect.vue

@@ -0,0 +1,182 @@
+<template>
+    <div class="container">
+      <van-search
+          v-model="keyword"
+          class="common-search"
+          :left-icon="searchImg"
+          :right-icon="closeImg"
+          :clearable="false"
+          @search="onSearchKeyword"
+          @click-right-icon.stop="onSearchCancel"
+      />
+      <div class="content">
+        <el-tree
+            ref="treeRef"
+            class="filter-tree"
+            :data="treeData"
+            show-checkbox
+            :props="defaultProps"
+            :filter-node-method="filterNode"
+            node-key="uuid"
+            default-expand-all
+            @check-change="handleCheckChange"
+        />
+      </div>
+      <div class="footer">
+        <div class="cancel-btn" @click="handleCancel">取消</div>
+        <div class="confirm-btn" @click="handleConfirm">确认转交</div>
+      </div>
+    </div>
+  </template>
+  
+  <script lang="ts" setup name="spotCheckUnits">
+  import { ElTree } from 'element-plus';
+  import {onMounted, reactive, ref, watch} from "vue";
+  import {useRoute, useRouter} from "vue-router";
+  import searchImg from "@/assets/images/search.png";
+  import closeImg from "@/assets/images/close.png";
+  import { getPhoneList, WorkApprovalRedirect } from "@/api/InformationReception/InformationReception";
+  import {showFailToast, showToast, showConfirmDialog} from "vant";
+  
+  const route = useRoute();
+  const router = useRouter();
+  const infoId = ref<string | string[]>('');
+  let defaultProps = reactive({
+    children: 'children',
+    label: 'label'
+  });
+  let keyword = ref('');
+  
+  const onSearchKeyword = (val) => {
+    keyword.value = val;
+    getList();
+  }
+  
+  const onSearchCancel = () => {
+    keyword.value = '';
+    getList();
+  }
+  let treeRef = ref();
+  let treeData = ref([]);
+  let checkData = ref([]);
+  const getList = () => {
+    getPhoneList().then((res) => {
+      treeData.value = res.data;
+    })
+  }
+  watch(keyword, (val) => {
+    treeRef.value!.filter(val)
+  })
+  const filterNode = (value, data) => {
+    if (!value) return true;
+    return data.label.indexOf(value) !== -1;
+  };
+  const handleCheckChange = () => {
+    const data = [];
+    const treeData = treeRef.value.getCheckedNodes(false, false);
+    treeData.forEach((item) => {
+      if (!item.deptType) {
+        if (!data.some((obj) => obj.id === item.id)) {
+          data.push(item);
+        }
+      }
+    });
+    checkData.value = data;
+  };
+  
+  const handleCancel = () => {
+    router.push({ name : 'DistrictCountyRollCall'})
+  }
+  const handleConfirm = () => {
+    if (checkData.value.length > 1) {
+        showFailToast('只能勾选一个审批人员');
+        return;
+    }
+    if (checkData.value.length > 0) {
+      showConfirmDialog({
+        title: '提示',
+        message: '确认转交到' + checkData.value[0].label+"?"
+      })
+      .then(() => {
+        WorkApprovalRedirect({info_id: infoId.value, redirect_id: checkData.value[0].id}).then((res) => {
+          showToast({type: 'success', message: res.msg, onClose:()=>{
+            router.back(-1);
+          }});
+        })
+      })
+    } else {
+      showFailToast('请先选择审批人员')
+    }
+  }
+  onMounted(() => {
+    infoId.value = route.query.id;
+    getList();
+  })
+  </script>
+  
+  <style lang="scss" scoped>
+  .container {
+    padding: 16px;
+    background-color: #F4F8FA;
+  }
+  
+  .content {
+    height: calc(100vh - 167px);
+    overflow-y: auto;
+    position: relative;
+    background-color: #ffffff;
+    padding: 16px;
+    .btn {
+      position: absolute;
+      top: 16px;
+      right: 16px;
+      width: 90px;
+      height: 24px;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      border: 1px solid #2C81FF;
+      border-radius: 2px;
+      font-weight: 400;
+      font-size: 12px;
+      color: #2C81FF;
+      letter-spacing: 0;
+      line-height: 26px;
+    }
+  }
+  .footer {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    width: 100%;
+    height: 81px;
+    background: #FFFFFF;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    .cancel-btn {
+      width: 90px;
+      height: 40px;
+      border: 1px solid #D1D1D1;
+      border-radius: 2px;
+      font-size: 16px;
+      color: #B3B3B3;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+    }
+    .confirm-btn {
+      width: 110px;
+      height: 40px;
+      background: #2C81FF;
+      border-radius: 2px;
+      font-size: 16px;
+      color: #FFFFFF;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      margin-left: 24px;
+    }
+  }
+  </style>
+  

+ 2 - 1
src/views/workApproval/detail.vue

@@ -128,6 +128,7 @@ const opt_info_type = [
 const { infoDetail } = toRefs(data);
 
 const route = useRoute();
+const router = useRouter();
 
 const refreshData = () => {
     infoId.value = route.query.id as string;
@@ -175,7 +176,7 @@ const handleReject = () => {
 };
 
 const handleRedirect = () => {
-
+  router.push("/workApproval/redirect?id=" + infoId.value);
 }
 
 onMounted(() => {