소스 검색

机构合并调整

zhengnaiwen_citu 3 달 전
부모
커밋
501d74f383

+ 2 - 0
src/App.vue

@@ -7,6 +7,8 @@ import autoRefresh from './update'
 export default {
   name: 'App',
   created () {
+    // 更新机构树
+    this.$store.dispatch('system/getOrganizationTree')
     if (process.env.NODE_ENV !== 'production') {
       return
     }

+ 10 - 5
src/api/system.js

@@ -158,11 +158,6 @@ export function exportRosterVersion (params) {
 //   return http.post('/organization/employee/atlas', params)
 // }
 
-// 机构人员 树状结构
-export function getOrganizationAndEmployeeTree (params) {
-  return http.post('/digitizationData/employee/organization/tree/all', params)
-}
-
 // 机构图钻取岗位图例
 // export function getOrganizationAtlasPostName (params) {
 //   return http.post('/digitizationData/employee/postName/atlas', params)
@@ -178,6 +173,16 @@ export function getOrganizationAtlasAll (params) {
   return http.post('/digitizationData/employee/organization/tree/all', params)
 }
 
+// 组织机构 合并同级机构
+export function margeOrganization (params) {
+  return http.post('/organization/marge', params)
+}
+
+// 组织机构 根据机构类型检索
+export function getOrganizationByType (params) {
+  return http.post('/organization/page', params)
+}
+
 // 组织结构 导入
 export function importOrganization (params) {
   return http.upload('/organization/upload', params)

+ 13 - 4
src/views/humanResources/organizationStructure/index.vue

@@ -19,15 +19,16 @@
     </div>
     <OrganizationEdit ref="organizationEditRefs" @refresh="onRefresh"></OrganizationEdit>
     <OrganizationAdd ref="organizationAddRefs" @refresh="onRefresh"></OrganizationAdd>
+    <OrganizationMerge ref="organizationMergeRefs" @refresh="onRefresh"></OrganizationMerge>
   </div>
 </template>
 
 <script>
 import OrganizationEdit from './organizationEdit.vue'
 import OrganizationAdd from './organizationAdd.vue'
-
+import OrganizationMerge from './organizationMerge.vue'
 import {
-  getOrganizationAndEmployeeTree,
+  getOrganizationAtlasAll,
   // getOrganizationAtlasEmployee,
   // importOrganization,
   exportOrganization,
@@ -42,13 +43,15 @@ export default {
   name: 'organization-structure',
   components: {
     OrganizationEdit,
-    OrganizationAdd
+    OrganizationAdd,
+    OrganizationMerge
   },
   data () {
     return {
       contextMenuShow: false,
       menus: [
         { label: '编辑', prop: 'edit' },
+        { label: '合并机构', prop: 'merge' },
         { label: '删除', prop: 'delete' }
       ],
       nodes: null,
@@ -166,7 +169,7 @@ export default {
     async onInit () {
       this.graph.showLoading()
       try {
-        const { data } = await getOrganizationAndEmployeeTree({})
+        const { data } = await getOrganizationAtlasAll({})
         return changeChildToChildren(data)
         function changeChildToChildren (obj, currentDepth = 1, maxDepth = 2) {
           const { child, ..._obj } = obj
@@ -226,6 +229,12 @@ export default {
       if (prop === 'delete') {
         this.onDelete(this.nodes)
       }
+      if (prop === 'merge') {
+        this.onMerge(this.nodes)
+      }
+    },
+    onMerge (nodes) {
+      this.$refs.organizationMergeRefs.open(nodes)
     },
     async editTag (nodes) {
       this.$refs.organizationEditRefs.open(nodes)

+ 86 - 0
src/views/humanResources/organizationStructure/organizationMerge.vue

@@ -0,0 +1,86 @@
+<template>
+  <m-dialog title="同级机构合并" ref="dialog" @sure="onSure">
+    <m-form :items="formItems" v-model="formValues" v-loading="loading">
+      <template #organizationName>
+        <el-tag>{{ formValues.organizationName }}</el-tag>
+      </template>
+    </m-form>
+  </m-dialog>
+</template>
+
+<script>
+import { getOrganizationByType, margeOrganization } from '@/api/system'
+export default {
+  name: 'organizationMerge',
+  data () {
+    return {
+      items: [],
+      formValues: {},
+      loading: false
+    }
+  },
+  computed: {
+    formItems () {
+      return [
+        {
+          label: '当前机构',
+          prop: 'organizationName'
+        },
+        {
+          label: '目标机构',
+          prop: 'slaveOrganizationNos',
+          type: 'select',
+          options: {
+            placeholder: '请选择被合并的机构',
+            multiple: true,
+            items: this.items,
+            labelText: 'organizationName',
+            labelValue: 'organizationNo'
+          }
+        }
+      ]
+    }
+  },
+  methods: {
+    async open (item) {
+      this.formValues.organizationName = item.name
+      this.formValues.masterOrganizationNo = item.value
+      this.$refs.dialog.open()
+      try {
+        const { data } = await getOrganizationByType({
+          entity: {
+            organizationCategory: item.organization.organizationCategory
+          },
+          page: {
+            current: 1,
+            size: 1000
+          }
+        })
+        this.items = data.records
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    },
+    async onSure () {
+      const { masterOrganizationNo, slaveOrganizationNos } = this.formValues
+      try {
+        await margeOrganization({
+          masterOrganizationNo,
+          slaveOrganizationNos
+        })
+        this.$message.success('合并成功')
+        this.$refs.dialog.close()
+        this.$emit('refresh')
+      } catch (error) {
+        this.$message.error(error)
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 0 - 1
src/views/login/index.vue

@@ -89,7 +89,6 @@ export default {
           })
           await this.$store.dispatch('user/login', query)
           await this.$store.dispatch('user/getEmployee') // 获取绑定员工信息
-          await this.$store.dispatch('system/getOrganizationTree') // 获取机构信息
           this.$route.query.redirect ? this.$router.push(this.$route.query.redirect) : this.$router.push('/')
           // this.$router.push('/')
         } catch (error) {

+ 30 - 1
src/views/payroll/performanceAnalysis/index.vue

@@ -27,7 +27,9 @@ export default {
       loading: false,
       option: {},
       searchValues: {
-        month: dateFormat('YYYY-mm', new Date())
+        month: dateFormat('YYYY-mm', new Date()),
+        type: 0,
+        avge: false
       },
       searchItems: [
         {
@@ -41,6 +43,33 @@ export default {
             valueFormat: 'yyyy-MM',
             placeholder: '选择月份'
           }
+        },
+        {
+          label: '维度',
+          prop: 'type',
+          type: 'select',
+          options: {
+            clearable: false,
+            items: [
+              { label: '绩效', value: 0 },
+              { label: '加班工资', value: 1 },
+              { label: '通讯补贴', value: 2 },
+              { label: '午餐费补贴', value: 3 },
+              { label: '网讯稿酬', value: 4 }
+            ]
+          }
+        },
+        {
+          label: '类型',
+          prop: 'avge',
+          type: 'select',
+          options: {
+            clearable: false,
+            items: [
+              { label: '总计', value: false },
+              { label: '平均值', value: true }
+            ]
+          }
         }
       ]
     }