Browse Source

fix: 🐛 修复仓库bug

@sun-chaoqun 2 years ago
parent
commit
0442add401

+ 0 - 1
components.d.ts

@@ -58,7 +58,6 @@ declare module '@vue/runtime-core' {
     ElTag: typeof import('element-plus/es')['ElTag']
     ElText: typeof import('element-plus/es')['ElText']
     ElTooltip: typeof import('element-plus/es')['ElTooltip']
-    ElTree: typeof import('element-plus/es')['ElTree']
     ElUpload: typeof import('element-plus/es')['ElUpload']
     Loading: typeof import('./src/components/Loading/index.vue')['default']
     Pagination: typeof import('./src/components/TableBase/components/Pagination.vue')['default']

+ 35 - 7
src/layouts/Header/Breadcrumb.vue

@@ -3,20 +3,48 @@ import { computed } from 'vue'
 import { icons } from '@/utils/common'
 import { ArrowRight } from '@element-plus/icons-vue'
 import { useRoute, useRouter } from 'vue-router'
-// import { GlobalStore } from '@/stores/index'
+import { GlobalStore } from '@/stores/index'
 
 const route = useRoute()
 const router = useRouter()
-// const globalStore = GlobalStore()
+const globalStore = GlobalStore()
 
 const breadcrumbList: any = computed(() => {
-  return route.matched.reduce((all: any, next: any) => {
-    return all.some((item: any) => item['path'] == next['path']) ? all : [...all, next]
-  }, [])
-  // const { path } = route
-  // return globalStore.GET_AllBreadcrumbList[path]
+  // return route.matched.reduce((all: any, next: any) => {
+  //   return all.some((item: any) => item['path'] == next['path']) ? all : [...all, next]
+  // }, [])
+  const { path, name } = route
+  const BreadcrumbList = getExtraBreadcrumb(name as string)
+  if (BreadcrumbList) return BreadcrumbList
+  return globalStore.GET_AllBreadcrumbList[path]
 })
 // console.log(globalStore.GET_AllBreadcrumbList, route)
+/**
+ * 获取额外的面包屑
+ * @param name 路由名称
+ */
+const getExtraBreadcrumb = (name: string) => {
+  switch (name) {
+    case 'ContractDetail':
+      return getBreadcrumb('/contractDetail', 'ue628', '/contract')
+    case 'InStorageDetail':
+      return getBreadcrumb('/inStorageDetail', 'ue60f', '/inStorage')
+    case 'ReceiveOutStock':
+      return getBreadcrumb('/receiveOutStock', 'ue7ec', '/outStock')
+    case 'SaleOutStock':
+      return getBreadcrumb('/saleOutStock', 'ue7e8', '/outStock')
+    case 'OutStockDetail':
+      return getBreadcrumb('/outStockDetail', 'ue72c', '/outStock')
+  }
+}
+/**
+ * 获取面包屑
+ */
+const getBreadcrumb = (path: string, icon: string, view: string) => {
+  const routerList = [...globalStore.GET_AllBreadcrumbList[view]]
+  routerList.push({ meta: { ...route.meta, icon }, path })
+  return routerList
+}
 
 const isUnicode = (val: string | undefined) => {
   if (!val) return false

+ 33 - 49
src/layouts/Header/Notice.vue

@@ -1,88 +1,72 @@
 <script setup lang="ts">
-import { ref, onMounted } from 'vue'
+import { ref, onMounted, computed } from 'vue'
+import { ElMessage } from 'element-plus'
+import { useRouter } from 'vue-router'
 import { GlobalStore } from '@/stores/index'
-import { User_News_List, User_News_See } from '@/api/user/index'
 import type { TabsPaneContext } from 'element-plus'
-import { ElMessage, ElMessageBox } from 'element-plus'
+import { User_News_See } from '@/api/user/index'
 
 interface NoticeType {
   CreateTime: string
   Id: number
   T_Tag: number
   T_Title: string
+  T_Url: string
   T_uuid: string
 }
 
-const page = ref(1)
-let total = 0
+const router = useRouter()
 const globalStore = GlobalStore()
 const activeName = ref('first')
-const newsList = ref<NoticeType[]>([])
+const newsList = computed<NoticeType[]>(() => {
+  return globalStore.noticeList
+})
 
-const getUserNewsList = async (tag?: number) => {
-  const params = {
-    User_tokey: globalStore.GET_User_tokey,
-    T_Tag: tag,
-    page: page.value,
-    page_z: 10
-  }
-  const res: any = await User_News_List(params)
-  newsList.value.push(...res.Data.Data)
-  total = res.Data.Num
-}
 /**
  * 查看通知消息
  */
-const previewNotice = (item: NoticeType) => {
-  ElMessageBox.confirm(item.T_Title, '消息通知', {
-    confirmButtonText: '确认',
-    cancelButtonText: '取消',
-    type: 'success',
-    draggable: true
-  })
-    .then(async () => {
-      const res: any = await User_News_See({ User_tokey: globalStore.GET_User_tokey, Id: item.Id })
-      if (res.Code) {
-        ElMessage({
-          type: 'success',
-          message: '确认查看消息!'
-        })
-        newsList.value.filter((notice: NoticeType) => item.Id !== notice.Id)
-      }
-    })
-    .catch(() => {
-      ElMessage({
-        type: 'info',
-        message: '取消确认消息!'
-      })
+const previewNotice = async (item: NoticeType) => {
+  router.push(item.T_Url)
+  const res: any = await User_News_See({ User_tokey: globalStore.GET_User_tokey, Id: item.Id })
+  if (res.Code) {
+    ElMessage({
+      type: 'success',
+      message: '确认查看消息!'
     })
+    newsList.value.filter((notice: NoticeType) => item.Id !== notice.Id)
+  }
 }
 
 const handleClick = (tab: TabsPaneContext) => {
   const { props } = tab
-  newsList.value = []
-  page.value = 1
+  globalStore.SET_NoticeList([], true)
+  globalStore.SET_NoticePage(1)
   switch (props.name) {
     case 'first':
-      getUserNewsList()
+      globalStore.SET_User_News_List()
       break
     case 'second':
-      getUserNewsList(1)
+      globalStore.SET_User_News_List(1)
       break
   }
 }
 
 onMounted(() => {
-  const tabs__content = document.getElementsByClassName('el-tabs__content')[0]
+  const tabs__content = document.querySelector('#notice')?.getElementsByClassName('el-tabs__content')[0]
+
   tabs__content?.addEventListener('scroll', (e: any) => {
     const { target } = e
-    if (target.scrollHeight - target.scrollTop === target.clientHeight && total !== newsList.value.length) {
-      page.value++
-      getUserNewsList()
+    if (
+      target.scrollHeight - target.scrollTop === target.clientHeight &&
+      globalStore.noticeTotal !== newsList.value.length
+    ) {
+      console.log('/notice')
+      globalStore.SET_NoticePage()
+      globalStore.SET_User_News_List()
     }
   })
 
-  getUserNewsList()
+  globalStore.SET_User_News_List()
 })
 
 defineExpose({
@@ -91,7 +75,7 @@ defineExpose({
 </script>
 <template>
   <div class="notice">
-    <el-tabs v-model="activeName" @tab-click="handleClick">
+    <el-tabs v-model="activeName" @tab-click="handleClick" id="notice">
       <transition-group
         appear
         leave-active-class="animate__animated animate__fadeInLeft"

+ 46 - 4
src/stores/index.ts

@@ -1,9 +1,10 @@
 import { defineStore, createPinia } from 'pinia'
-import { GlobalState, DepotType } from './interface/index'
+import { GlobalState, DepotType, NoticeType } from './interface/index'
 import { Menu_User_List } from '@/api/role/index'
 import { User_Info } from '@/api/user/index'
 import { isEmptyObject } from '@/utils/common'
 import { User_Dept_List } from '@/api/user/index'
+import { User_News_List } from '@/api/user/index'
 import { flatMenuListGet, AddRouterMeta, getAllBreadcrumbList } from '@/utils/common'
 
 export const GlobalStore = defineStore({
@@ -21,7 +22,10 @@ export const GlobalStore = defineStore({
     MenuList: [], // 保存原始菜单
     allBreadcrumbList: [], // 用作面包屑
     expandMenuList: [], // 扩展菜单属性
-    flatMenu: [] // 扁平化的数组
+    flatMenu: [], // 扁平化的数组
+    noticeTotal: 0,
+    noticePage: 1,
+    noticeList: []
   }),
   getters: {
     GET_isloading: state => state.isloading,
@@ -67,6 +71,19 @@ export const GlobalStore = defineStore({
     SET_Flat_Menu(payload: any) {
       this.flatMenu = payload
     },
+    SET_NoticeList(list: NoticeType[], clear?: boolean) {
+      if (Array.isArray(list)) {
+        if (clear) this.noticeList = list
+        else this.noticeList.push(...list)
+      }
+    },
+    SET_NoticeTotal(num: number) {
+      this.noticeTotal = num
+    },
+    SET_NoticePage(page?: number) {
+      if (page) return (this.noticePage = page)
+      this.noticePage++
+    },
     async SET_User_Dept_List() {
       const res: any = await User_Dept_List()
       this.UserDeptList = res.Data
@@ -85,11 +102,36 @@ export const GlobalStore = defineStore({
       if (res.Code === 200) {
         this.MenuList = res.Data.Data // 保存所有菜单
         this.expandMenuList = AddRouterMeta(res.Data.Data) // 扩展菜单属性
-
+        // 添加上首页
+        this.expandMenuList.unshift({
+          Children: null,
+          Id: 0,
+          T_State: 1,
+          T_permission: '/home',
+          component: '/home/Home',
+          meta: { icon: 'HomeFilled', title: '首页', isKeepAlive: true },
+          name: 'home',
+          path: '/home'
+        })
+        // 侧边栏
         this.SET_Flat_Menu(flatMenuListGet(this.expandMenuList)) // 接收扁平化菜单
-
+        // 面包屑
         this.allBreadcrumbList = getAllBreadcrumbList(this.expandMenuList)
       }
+    },
+    /**
+     * 获取消息通知
+     */
+    async SET_User_News_List(tag?: number) {
+      const params = {
+        User_tokey: this.User_tokey,
+        T_Tag: tag,
+        page: this.noticePage,
+        page_z: 10
+      }
+      const res: any = await User_News_List(params)
+      this.SET_NoticeList(res.Data.Data)
+      this.SET_NoticeTotal(res.Data.Num)
     }
   }
 })

+ 12 - 0
src/stores/interface/index.ts

@@ -14,6 +14,9 @@ export interface GlobalState {
   path: string
   allBreadcrumbList: any
   flatMenu: any
+  noticeTotal: number
+  noticePage: number
+  noticeList: NoticeType[]
 }
 
 export interface DepotType {
@@ -21,6 +24,15 @@ export interface DepotType {
   Id: number
 }
 
+export interface NoticeType {
+  CreateTime: string
+  Id: number
+  T_Tag: number
+  T_Title: string
+  T_Url: string
+  T_uuid: string
+}
+
 // export interface MenuType {
 //   Children?: MenuType[]
 //   Id: number

+ 4 - 4
src/utils/common.ts

@@ -38,7 +38,7 @@ export const getAllBreadcrumbList = (menuList: any, result: { [key: string]: any
 }
 
 const path = {
-  home: ['/home'],
+  // home: ['/home'],
   roles: ['/roles'],
   users: ['/users'],
   salary: ['/salary'],
@@ -51,7 +51,7 @@ const path = {
   sales: ['/contract', '/contractSale']
 }
 
-const permissionPath = (permission: string): string => {
+const permissionPath = (permission: string) => {
   if (path.roles.includes(permission)) {
     return '/account/roles'
   } else if (path.users.includes(permission)) {
@@ -73,7 +73,7 @@ const permissionPath = (permission: string): string => {
   } else if (path.sales.includes(permission)) {
     return '/storehouse/sales'
   }
-  return '/home'
+  // return '/home'
 }
 
 const get_name = (name: string): string => {
@@ -89,7 +89,7 @@ const functionucFirst = (str: string) => str[0].toUpperCase() + str.slice(1)
  * 将扁平化的数组转换成带有meta component字段的新数组
  * @param menuList []
  */
-export const AddRouterMeta = (menuList: any) => {
+export const AddRouterMeta = (menuList: any[]) => {
   let reg = /^[a-zA-Z]+$/
   menuList.forEach((menu: any) => {
     if (menu?.Children) {

+ 153 - 177
src/views/home/Home.vue

@@ -1,22 +1,112 @@
-<script setup lang="ts"></script>
+<script setup lang="ts">
+import { ref, onMounted, computed, onUnmounted } from 'vue'
+import { ElMessage } from 'element-plus'
+import { useRouter } from 'vue-router'
+import { GlobalStore } from '@/stores/index'
+import type { TabsPaneContext } from 'element-plus'
+import { User_News_See } from '@/api/user/index'
+
+interface NoticeType {
+  CreateTime: string
+  Id: number
+  T_Tag: number
+  T_Title: string
+  T_Url: string
+  T_uuid: string
+}
+
+let tabs__content: HTMLDivElement
+const router = useRouter()
+const globalStore = GlobalStore()
+const activeName = ref('first')
+const newsList = computed<NoticeType[]>(() => {
+  return globalStore.noticeList
+})
+console.log(newsList.value)
+const handleClick = (tab: TabsPaneContext) => {
+  const { props } = tab
+  globalStore.SET_NoticeList([], true)
+  globalStore.SET_NoticePage(1)
+  switch (props.name) {
+    case 'first':
+      globalStore.SET_User_News_List()
+      break
+    case 'second':
+      globalStore.SET_User_News_List(1)
+      break
+  }
+}
+
+/**
+ * 查看通知消息
+ */
+const previewNotice = async (item: NoticeType) => {
+  router.push(item.T_Url)
+  const res: any = await User_News_See({ User_tokey: globalStore.GET_User_tokey, Id: item.Id })
+  if (res.Code) {
+    ElMessage({
+      type: 'success',
+      message: '确认查看消息!'
+    })
+    newsList.value.filter((notice: NoticeType) => item.Id !== notice.Id)
+  }
+}
+
+const ScrollHandle = (e: any) => {
+  const { target } = e
+  if (
+    target.scrollHeight - target.scrollTop === target.clientHeight &&
+    globalStore.noticeTotal !== newsList.value.length
+  ) {
+    console.log('/home')
+    globalStore.SET_NoticePage()
+    globalStore.SET_User_News_List()
+  }
+}
+
+onMounted(() => {
+  tabs__content = document.querySelector('#home')?.getElementsByClassName('el-tabs__content')[0] as HTMLDivElement
+
+  tabs__content?.addEventListener('scroll', ScrollHandle)
+
+  if (globalStore.noticeList.length <= 0) {
+    globalStore.SET_User_News_List()
+  }
+})
+onUnmounted(() => {
+  console.log('组件销毁')
+  tabs__content.removeEventListener('scroll', ScrollHandle)
+})
+</script>
 
 <template>
   <div class="home">
-    <!-- <img class="img" src="@/assets/images/1.jpg" /> -->
-    <h1>welcome</h1>
-    <div class="wrap">
-      <ul>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-      </ul>
+    <div class="notice">
+      <h1>消息通知</h1>
+      <el-tabs v-model="activeName" @tab-click="handleClick" id="home">
+        <transition-group
+          appear
+          leave-active-class="animate__animated animate__fadeInLeft"
+          enter-active-class="animate__animated animate__fadeInLeft"
+        >
+          <el-tab-pane label="未读" name="first" key="first">
+            <div class="item" v-for="item in newsList" :key="item.T_uuid" @click="previewNotice(item)">
+              <div class="item-box">
+                <el-badge :value="item.T_Tag === 0 ? 'new' : ''">{{ item.T_Title }}</el-badge>
+              </div>
+              <span>{{ item.CreateTime.split(' ')[0] }}</span>
+            </div>
+          </el-tab-pane>
+          <el-tab-pane label="全部" name="second" key="second">
+            <div class="item" v-for="item in newsList" :key="item.T_uuid" @click="previewNotice(item)">
+              <div class="item-box">
+                <el-badge :value="item.T_Tag === 0 ? 'new' : ''">{{ item.T_Title }}</el-badge>
+              </div>
+              <span>{{ item.CreateTime.split(' ')[0] }}</span>
+            </div>
+          </el-tab-pane>
+        </transition-group>
+      </el-tabs>
     </div>
   </div>
 </template>
@@ -25,172 +115,58 @@
 .home {
   width: 100%;
   height: 100%;
+  padding-top: 50px;
   display: flex;
   justify-content: center;
-  align-items: center;
-  h1 {
-    z-index: 10;
-    font-size: 4rem;
-    position: absolute;
-    text-shadow: 0px 0px 2px #000;
-  }
-  .wrap {
-    width: 100%;
-    height: 20%;
-    padding: 40px 0;
-    // position: fixed;
-    position: relative;
-    // top: 50%;
-    opacity: 0.8;
-    background: linear-gradient(to bottom right, #50a3a2, #53e3a6);
-    background: -webkit-linear-gradient(to bottom right, #50a3a2, #53e3a6);
-  }
-  .wrap ul {
-    position: absolute;
-    top: 0;
-    left: 0;
-    width: 100%;
-    height: 100%;
-    z-index: -10;
-  }
-  .wrap ul li {
-    list-style-type: none;
-    display: block;
-    position: absolute;
-    bottom: -120px;
-    width: 15px;
-    height: 15px;
-    z-index: -8;
-    background-color: rgba(255, 255, 255, 0.15);
-    // background: linear-gradient(to bottom right, #50a3a2, #53e3a6);
-    // background: -webkit-linear-gradient(to bottom right, #50a3a2, #53e3a6);
-    animotion: square 25s infinite;
-    -webkit-animation: square 25s infinite;
-  }
-  .wrap ul li:nth-child(1) {
-    left: 0;
-    animation-duration: 10s;
-    -moz-animation-duration: 10s;
-    -o-animation-duration: 10s;
-    -webkit-animation-duration: 10s;
-  }
-  .wrap ul li:nth-child(2) {
-    width: 40px;
-    height: 40px;
-    left: 10%;
-    animation-duration: 15s;
-    -moz-animation-duration: 15s;
-    -o-animation-duration: 15s;
-    -webkit-animation-duration: 15s;
-  }
-  .wrap ul li:nth-child(3) {
-    left: 20%;
-    width: 25px;
-    height: 25px;
-    animation-duration: 12s;
-    -moz-animation-duration: 12s;
-    -o-animation-duration: 12s;
-    -webkit-animation-duration: 12s;
-  }
-  .wrap ul li:nth-child(4) {
-    width: 50px;
-    height: 50px;
-    left: 30%;
-    -webkit-animation-delay: 3s;
-    -moz-animation-delay: 3s;
-    -o-animation-delay: 3s;
-    animation-delay: 3s;
-    animation-duration: 12s;
-    -moz-animation-duration: 12s;
-    -o-animation-duration: 12s;
-    -webkit-animation-duration: 12s;
-  }
-  .wrap ul li:nth-child(5) {
-    width: 60px;
-    height: 60px;
-    left: 40%;
-    animation-duration: 10s;
-    -moz-animation-duration: 10s;
-    -o-animation-duration: 10s;
-    -webkit-animation-duration: 10s;
-  }
-  .wrap ul li:nth-child(6) {
-    width: 75px;
-    height: 75px;
-    left: 50%;
-    -webkit-animation-delay: 7s;
-    -moz-animation-delay: 7s;
-    -o-animation-delay: 7s;
-    animation-delay: 7s;
-  }
-  .wrap ul li:nth-child(7) {
-    left: 60%;
-    animation-duration: 8s;
-    -moz-animation-duration: 8s;
-    -o-animation-duration: 8s;
-    -webkit-animation-duration: 8s;
-  }
-  .wrap ul li:nth-child(8) {
-    width: 90px;
-    height: 90px;
-    left: 70%;
-    -webkit-animation-delay: 4s;
-    -moz-animation-delay: 4s;
-    -o-animation-delay: 4s;
-    animation-delay: 4s;
-  }
-  .wrap ul li:nth-child(9) {
-    width: 100px;
-    height: 100px;
-    left: 80%;
-    animation-duration: 20s;
-    -moz-animation-duration: 20s;
-    -o-animation-duration: 20s;
-    -webkit-animation-duration: 20s;
-  }
-  .wrap ul li:nth-child(10) {
-    width: 120px;
-    height: 120px;
-    left: 90%;
-    -webkit-animation-delay: 6s;
-    -moz-animation-delay: 6s;
-    -o-animation-delay: 6s;
-    animation-delay: 6s;
-    animation-duration: 30s;
-    -moz-animation-duration: 30s;
-    -o-animation-duration: 30s;
-    -webkit-animation-duration: 30s;
-  }
-
-  @keyframes square {
-    0% {
-      -webkit-transform: translateY(0);
-      transform: translateY(0);
+  // align-items: center;
+  .notice {
+    width: 50%;
+    height: 50%;
+    padding: 15px;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    box-shadow: 0px 0px 6px #ccc;
+    .el-tabs {
+      width: 100%;
+      height: calc(100% - 25px);
+      :deep(.el-tabs__content) {
+        padding-top: 10px;
+        height: calc(100% - 80px);
+        overflow-y: scroll;
+      }
     }
-    100% {
-      bottom: 400px;
-      transform: rotate(600deg);
-      -webit-transform: rotate(600deg);
-      -webkit-transform: translateY(-800);
-      transform: translateY(-800);
+    .item {
+      width: 100%;
+      display: flex;
+      padding: 5px 16px;
+      cursor: pointer;
+      justify-content: space-between;
+      &:hover {
+        background-color: #ecf5ff;
+        color: #409eff;
+      }
+      .item-box {
+        width: 80%;
+        .el-badge {
+          max-width: 100%;
+          .item-content {
+            overflow: hidden;
+            white-space: nowrap;
+            text-overflow: ellipsis;
+            max-width: 100%;
+            display: inline-block;
+          }
+        }
+      }
+      span {
+        white-space: nowrap;
+      }
     }
   }
-  @-webkit-keyframes square {
-    0% {
-      -webkit-transform: translateY(0);
-      transform: translateY(0);
-    }
-    100% {
-      bottom: 400px;
-      transform: rotate(600deg);
-      -webit-transform: rotate(600deg);
-      -webkit-transform: translateY(-800);
-      transform: translateY(-800);
-    }
+  h1 {
+    font-size: 2rem;
+    margin-bottom: 20px;
   }
 }
-.img {
-  width: 100%;
-  height: 100%;
-}
 </style>

+ 3 - 0
src/views/salary/SalaryCount.vue

@@ -245,6 +245,9 @@ getSalary_List()
     }
   }
 }
+.demonstration {
+  margin-left: 8px;
+}
 .d-flex {
   display: flex;
   justify-content: start;

+ 4 - 2
src/views/salary/SalaryMy.vue

@@ -57,7 +57,7 @@ const getMySalary = async () => {
       }
     }
   })
-  if (res.Code === 200) {
+  if (res?.Code === 200) {
     for (let item of salaryData) {
       item.salary = res.Data[item.field]
     }
@@ -184,7 +184,9 @@ getMySalary()
 }
 .salary-content {
   overflow-y: auto;
-  // max-height: calc(100% - 60px - 72px - 24px);
   flex: 1;
 }
+.demonstration {
+  margin-left: 8px;
+}
 </style>

+ 3 - 6
src/views/salary/salary/Salary.vue

@@ -130,23 +130,20 @@ const tableRowClassName = (data: any): any => {
     </div>
     <el-row class="h-100 f-1 margin-left-3">
       <el-col :span="24" class="h-100" style="overflow: hidden; display: flex; flex-direction: column">
-        <el-card class="m-b-3">
+        <el-card class="b-r m-b-3">
           <h3 class="title m-b-5">员工基本信息</h3>
           <div class="info-content">
             <el-avatar shape="square" size="large" :src="userInfo.squareUrl" />
             <div class="info-name">
-              <h4 class="m-b-3">名字:{{ userInfo.name }}</h4>
+              <h4>名字:{{ userInfo.name }}</h4>
               <h4>
                 <span>部门:{{ userInfo.T_dept }}</span>
                 <span>岗位:{{ userInfo.T_post }}</span>
               </h4>
             </div>
           </div>
-          <!-- <el-icon size="42">
-            <CircleCheck color="#67C23A" />
-          </el-icon> -->
         </el-card>
-        <el-card class="m-b-3">
+        <el-card class="b-r m-b-3">
           <el-row :gutter="20">
             <el-col :xl="10" :lg="12" :md="14" class="d-flex justify-start">
               <span class="demonstration">年:</span>

+ 8 - 0
src/views/salary/salary/SalaryFrom.vue

@@ -58,6 +58,14 @@ const submitSalary = (formEl: FormInstance | undefined) => {
 const DataEcho = (data: any) => {
   form.value = { ...data }
 }
+
+interface PropsType {
+  T_uuid: string
+  year: string
+  month: string
+}
+const props = defineProps<PropsType>()
+
 defineExpose({
   DataEcho
 })

+ 9 - 0
src/views/salary/salary/index.scss

@@ -63,3 +63,12 @@
     }
   }
 }
+
+.b-r,
+.form-card {
+  border-radius: 8px;
+}
+
+.demonstration {
+  margin-left: 8px;
+}

+ 4 - 1
src/views/storehouse/inventory/InStorageProduct.vue

@@ -29,7 +29,7 @@ const initParam = reactive({
   T_name: '',
   T_model: '',
   T_class: '',
-  page: 0,
+  page: 1,
   page_z: 20
 })
 const callbackProductDrawer = (done: Fn) => done()
@@ -109,6 +109,7 @@ const getProductClassList = async () => {
 }
 
 onMounted(() => {
+  getProductList()
   !classOptions.value.length && getProductClassList()
 })
 
@@ -190,6 +191,8 @@ defineExpose({
           height: '50px'
         }"
         v-el-table-infinite-scroll="load"
+        :infinite-scroll-immediate="false"
+        infinite-scroll-distance="'50px'"
         @select="ProductselectionChange"
         @select-all="ProductSelectionAllChange"
       >

+ 7 - 1
src/views/storehouse/outStock/OutStockProduct.vue

@@ -29,7 +29,7 @@ const initParam = reactive({
   T_product_name: '',
   T_product_model: '',
   T_product_class: '',
-  page: 0,
+  page: 1,
   page_z: 20
 })
 const callbackProductDrawer = (done: Fn) => done()
@@ -74,6 +74,8 @@ const getRowKey = (row: any) => {
 
 // 加载第二个抽屉数据
 const load = () => {
+  console.log(initParam.page, total, tableProductData.value.length)
+
   if (initParam.page && total === tableProductData.value.length) {
     ElMessage.warning('没有更多数据了!!')
     return
@@ -109,6 +111,7 @@ const getProductClassList = async () => {
 }
 
 onMounted(() => {
+  getProductList()
   !classOptions.value.length && getProductClassList()
 })
 
@@ -189,6 +192,8 @@ defineExpose({
           height: '50px'
         }"
         v-el-table-infinite-scroll="load"
+        :infinite-scroll-immediate="false"
+        infinite-scroll-distance="'50px'"
         @select="ProductselectionChange"
         @select-all="ProductSelectionAllChange"
       >
@@ -244,6 +249,7 @@ defineExpose({
   max-width: 500px;
   overflow-y: auto;
 }
+
 .box-card {
   height: 100%;
   :deep(.el-card__body) {

+ 1 - 1
src/views/storehouse/outStock/ReceiveOutStock.vue

@@ -29,7 +29,7 @@ const formLabelWidth = ref('120px')
 const ruleFormRef = ref<FormInstance>()
 const receiveUserdialog = ref<InstanceType<typeof ReceiveUser> | null>(null)
 const drawerSnRef = ref<InstanceType<typeof InStorageSn> | null>(null)
-const drawerProductRef = ref<InstanceType<typeof InStorageProduct> | null>(null)
+const drawerProductRef = ref<InstanceType<typeof OutStockProduct> | null>(null)
 
 const form = reactive<FormType>({
   T_type: 1,

+ 35 - 30
src/views/storehouse/outStock/SaleOutStock.vue

@@ -36,7 +36,7 @@ const ruleFormRef = ref<FormInstance>()
 const drawerSnRef = ref<InstanceType<typeof InStorageSn> | null>(null)
 const receiveUserdialog = ref<InstanceType<typeof ReceiveUser> | null>(null)
 const contractNumberRef = ref<InstanceType<typeof ContractNumber> | null>(null)
-const form = reactive<FormType>({
+const form = ref<FormType>({
   T_type: 2,
   T_uuid: '',
   T_receive: '',
@@ -88,14 +88,14 @@ const validate_T_product = (rule: any, value: any, callback: any) => {
 
 const rules = reactive<FormRules>({
   T_product: [{ required: true, validator: validate_T_product, trigger: 'blur' }],
-  T_receive: [{ required: true, message: '请选择经办人', trigger: 'blur' }],
+  T_receive: [{ required: true, message: '请选择经办人', trigger: 'change' }],
   T_depot_id: [{ required: true, message: '请选择仓库', trigger: 'blur' }],
   T_date: [{ required: true, message: '请选择出库日期', trigger: 'blur' }],
-  T_contract_number: [{ required: true, message: '请选择合同编号', trigger: 'blur' }]
+  T_contract_number: [{ required: true, message: '请选择合同编号', trigger: 'change' }]
 })
 
 const countBlurHandle = () => {
-  form.T_product = tableData.value.map(item => {
+  form.value.T_product = tableData.value.map(item => {
     if (!item.count && item.T_product_relation_sn !== 1) return undefined
     return `${item.T_product_id},${item.count}|`
   })
@@ -156,24 +156,41 @@ const autoGetCount = (length: number, id: number) => {
  */
 const selectApprover = () => receiveUserdialog.value?.openDrawer()
 const getReceiveInfo = ({ T_uuid, T_name }: { T_uuid: string; T_name: string }) => {
-  form.T_receive = T_name
-  form.T_uuid = T_uuid
+  form.value.T_receive = T_name
+  form.value.T_uuid = T_uuid
+}
+/**
+ * 选择仓库
+ */
+const selectDepot = (val: any) => {
+  form.value.T_depot_id = val
+
+  if (form.value.T_depot_id && form.value.T_contract_number) {
+    getProductList()
+  }
 }
 /**
  * 选择合同
  */
+const inputContractRef = ref()
 const selectContract = () => contractNumberRef.value?.openDrawer()
 const getContactInfo = ({ T_number }: { T_number: string }) => {
-  if (form.T_contract_number === T_number) return
-  form.T_contract_number = T_number
-  getProductList(T_number)
+  if (form.value.T_contract_number === T_number) return
+  form.value.T_contract_number = T_number
+  if (form.value.T_depot_id && form.value.T_contract_number) {
+    getProductList()
+    // inputContractRef.value.focus()
+  }
 }
 /**
  * 通过合同获取产品
  */
-const getProductList = async (T_number: string) => {
-  const res: any = await Storehouse_Contract_Product_List({ User_tokey: globalStore.GET_User_tokey, T_number })
-  console.log(res)
+const getProductList = async () => {
+  const res: any = await Storehouse_Contract_Product_List({
+    User_tokey: globalStore.GET_User_tokey,
+    T_number: form.value.T_contract_number,
+    T_depot_id: form.value.T_depot_id
+  })
   if (res.Code === 200 && res.Data.length) {
     tableData.value = res.Data
   }
@@ -209,14 +226,14 @@ const closeSaleOutStock = () => {
  */
 const AddSaleOutStock = (formEl: FormInstance | undefined) => {
   if (!formEl) return
-  form.T_product = getDeviceSnToProduct()
+  form.value.T_product = getDeviceSnToProduct()
   formEl.validate(async valid => {
     if (valid) {
       const res: any = await Storehouse_StockOut_Add({
         User_tokey: globalStore.GET_User_tokey,
         ...form,
-        T_product: form.T_product.join(''),
-        T_receive: form.T_uuid
+        T_product: form.value.T_product.join(''),
+        T_receive: form.value.T_uuid
       })
       console.log(res)
       if (res.Code === 200) {
@@ -242,16 +259,10 @@ const options = globalStore.GET_depotList
         <el-input v-model="form.T_number" disabled type="text" placeholder="系统自动生成" class="w-50" />
       </el-form-item>
       <el-form-item label="合同编号:" :label-width="formLabelWidth" prop="T_contract_number">
-        <el-input
-          v-model="form.T_contract_number"
-          type="text"
-          placeholder="请选择合同编号"
-          class="w-50"
-          @click="selectContract"
-        />
+        <el-input v-model="form.T_contract_number" placeholder="请选择合同编号" class="w-50" @focus="selectContract" />
       </el-form-item>
       <el-form-item label="出库仓库:" :label-width="formLabelWidth" prop="T_depot_id">
-        <el-select v-model="form.T_depot_id" class="w-50" clearable placeholder="请选择入库仓库~">
+        <el-select v-model="form.T_depot_id" class="w-50" clearable placeholder="请选择入库仓库~" @change="selectDepot">
           <el-option v-for="item in options" :key="item.Id" :label="item.T_name" :value="item.Id" />
         </el-select>
       </el-form-item>
@@ -267,13 +278,7 @@ const options = globalStore.GET_depotList
         />
       </el-form-item>
       <el-form-item label="经办人:" :label-width="formLabelWidth" prop="T_receive">
-        <el-input
-          v-model="form.T_receive"
-          type="text"
-          placeholder="请选择经办人"
-          class="w-50"
-          @click="selectApprover"
-        />
+        <el-input v-model="form.T_receive" placeholder="请选择经办人" class="w-50" @focus="selectApprover" />
       </el-form-item>
       <el-form-item label="出库明细:" :label-width="formLabelWidth" prop="T_product">
         <el-table

+ 5 - 1
src/views/storehouse/outStock/receiveUser.vue

@@ -27,6 +27,7 @@ const searchHandle = () => {
  */
 const getApproverInfo = (row: any) => {
   emit('onUserInfo', row)
+  console.log('colse')
   drawerRef.value?.closeDrawer()
 }
 const callbackDrawer = (done: () => void) => {
@@ -35,7 +36,10 @@ const callbackDrawer = (done: () => void) => {
 
 const emit = defineEmits<{ (event: 'onUserInfo', value: any): void }>()
 
-const openDrawer = () => drawerRef.value?.openDrawer()
+const openDrawer = () => {
+  console.log('open')
+  drawerRef.value?.openDrawer()
+}
 defineExpose({
   openDrawer
 })

+ 1 - 3
src/views/workAttendance/MyLeave.vue

@@ -164,9 +164,7 @@ const searchHandle = () => {
   approverInitParam.T_name = search.value
   tableApproverRef.value.searchTable()
 }
-const selectApprover = () => {
-  dialog.value.DialogOpen()
-}
+const selectApprover = () => dialog.value.DialogOpen()
 const getApproverInfo = (row: any) => {
   uuid = row.T_uuid
   form.value.T_approver = row.T_name