Jelajahi Sumber

组织架构

qymljy 2 tahun lalu
induk
melakukan
235127767d

+ 70 - 20
src/operation/moduleNormal/depManage/detail/index.vue

@@ -1,12 +1,20 @@
 <template>
   <div>
-    <detail-template :headData="mainAreaData" :title="userData.name" :tabs="[]" ownertable="sys_hr" :delParam="{id:'20221102090403',content:{hrids:[router.currentRoute.value.query.id]}}">
+    <detail-template :headData="mainAreaData" :title="userData.name" :tabs="['详细信息']" ownertable="sys_hr" :delParam="{id:'20221102090403',content:{hrids:[router.currentRoute.value.query.id]}}">
       <template #operation>
         <edit :data="userData" @onSuccess="mianData"></edit>
         <bindUserToAccount :data="userData" @onSuccess="mianData"/>
         <ceateAccount :data="userData" :hrid="router.currentRoute.value.query.id" @onSuccess="mianData"/>
       </template>
       <template #tab0>
+        <div class="defaultInfo">
+          <span >基本信息</span>
+        </div>
+        <defaultInfo :data="basicData"></defaultInfo>
+        <div class="defaultInfo-sys">
+          <span >系统信息</span>
+        </div>
+        <defaultInfo :data="systemData"></defaultInfo>
       </template>
     </detail-template>
   </div>
@@ -15,16 +23,18 @@
 <script setup>
 import Api from '@/api/api'
 import utils  from '@/utils/utils'
-
 import productList from '@/template/normalTable/index.vue'
 import detailTemplate from '@/components/detailTemplate/index.vue'
 import edit from './modules/edit.vue'
 import ceateAccount from './modules/ceateAccount.vue'
 import bindUserToAccount from './modules/bindUserToAccount.vue'
+import defaultInfo from '@/template/defaultInfo/index.vue'
 import { useRouter } from "vue-router";
 import { onMounted,ref } from "vue";
 const router = useRouter()
 const mainAreaData = ref([])
+const basicData = ref([])
+const systemData = ref([])
 const param = ref({
   "id": 20221109093902,
   "content": {
@@ -52,45 +62,85 @@ const mianData = async ()=>{
 const changeDataStructure = (data) => {
   mainAreaData.value = [
     {
-      label:'电话',
-      value:data.accountno !== ''?data.userphonenumber:data.phonenumber
+      label:'编号',
+      value:data.hrcode
+    },
+    {
+      label:'姓名',
+      value:data.name
+    },
+    {
+      label:'手机号',
+      value:data.phonenumber
+    },
+    {
+      label:'是否部门负责人',
+      value:data.isleader === 1?'是':'否'
+    },
+    {
+      label:'状态',
+      value:data.status == 1?'在职':'离职'
+    },
+  ]
+  basicData.value = [
+    {
+      label:'编号',
+      value:data.hrcode
+    },
+    {
+      label:'账号',
+      value:data.hrcode
+    },
+    {
+      label:'姓名',
+      value:data.hrcode
+    },
+    {
+      label:'账号类型',
+      value:data.hrcode
     },
     {
-      label:'办公电话',
-      value:data.officetelephone
+      label:'授权角色',
+      value:data.hrcode
+    },
+    {
+      label:'手机号',
+      value:data.hrcode
     },
     {
       label:'部门',
-      value:data.depname
+      value:data.hrcode
     },
     {
       label:'职位',
-      value:data.position
+      value:data.hrcode
     },
     {
       label:'是否部门负责人',
-      value:data.isleader === 1?'是':'否'
+      value:data.hrcode
     },
     {
-      label:'电子邮箱',
-      value:data.email
+      label:'状态',
+      value:data.hrcode
     },
+  ]
+  systemData.value = [
     {
-      label:'汇报对象',
-      value:data.reporthrname
+      label:'创建时间',
+      value:data.hrcode
     },
     {
-      label:'身份证号',
-      value:data.idcard
+      label:'创建人',
+      value:data.hrcode
     },
     {
-      label:'性别',
-      value:data.sex
+      label:'最近编辑时间',
+      value:data.hrcode
     },
     {
-      label:'是否服务人员',
-      value:data.isworker === 1?'是':'否'
-    }
+      label:'最近编辑人',
+      value:data.hrcode
+    },
   ]
 }
 const onSelectChange = (val) =>{

+ 25 - 13
src/operation/moduleNormal/depManage/detail/modules/edit.vue

@@ -17,6 +17,13 @@
               <a-input v-model:value="form.hrcode" placeholder="输入人员编号"></a-input>
             </a-form-item>
           </a-col>
+          <a-col :span="8">
+            <a-form-item label="人员性别" name="name">
+              <a-select v-model:value="form.sex" style="width: 100%" placeholder="选择人员性别">
+                <a-select-option v-for="item in sexOptions" :key="item.index" :value="item.value">{{item.value}}</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
           <a-col :span="8">
             <a-form-item label="人员姓名" name="name" :rules="[{ required: true, message: '请输入姓名' }]">
               <a-input v-model:value="form.name" placeholder="输入姓名"></a-input>
@@ -27,28 +34,22 @@
               <a-cascader v-model:value="form.departmentids" :options="depOptions" placeholder="选择所属部门" :fieldNames="{label:'depname',value:'departmentid',children:'subdep'}" :multiple="false" change-on-select clear @change="onChange"/>
             </a-form-item>
           </a-col>
-          <a-col :span="8">
+<!--          <a-col :span="8">
             <a-form-item label="手机号码" name="phonenumber">
               <a-input v-model:value="form.phonenumber" placeholder="输入手机号码"></a-input>
             </a-form-item>
-          </a-col>
+          </a-col>-->
           <a-col :span="8">
             <a-form-item label="职位" name="position">
               <a-input v-model:value="form.position" placeholder="输入职位"></a-input>
             </a-form-item>
           </a-col>
-          <a-col :span="8">
+<!--          <a-col :span="8">
             <a-form-item label="身份证号" name="idcard">
               <a-input v-model:value="form.idcard" placeholder="输入身份证号"></a-input>
             </a-form-item>
           </a-col>
-          <a-col :span="8">
-            <a-form-item label="人员性别" name="name">
-              <a-select v-model:value="form.sex" style="width: 100%" placeholder="选择人员性别">
-                <a-select-option v-for="item in sexOptions" :key="item.index" :value="item.value">{{item.value}}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
+
           <a-col :span="8">
             <a-form-item label="电子邮箱" name="email">
               <a-input v-model:value="form.email" placeholder="输入姓名"></a-input>
@@ -58,7 +59,7 @@
             <a-form-item label="办公电话" name="officetelephone">
               <a-input v-model:value="form.officetelephone" placeholder="输入办公电话"></a-input>
             </a-form-item>
-          </a-col>
+          </a-col>-->
           <!-- <a-col :span="8">
             <a-form-item label="汇报对象" name="reporthrid">
               <a-input v-model:value="form.reporthrid" placeholder="输入汇报对象"></a-input>
@@ -80,6 +81,14 @@
             </a-select>
           </a-form-item>
         </a-col>
+          <a-col :span="12">
+            <a-form-item label="状态">
+              <a-select v-model:value="form.status">
+                <a-select-option :value="1">在职</a-select-option>
+                <a-select-option :value="0">离职</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
         </a-row>
       </a-form>
       <template #extra>
@@ -115,13 +124,16 @@ const form = ref({
   hrcode:"",
   isleader:1,
   isworker:0,
-  remarks:''
+  remarks:'',
+  status:1
 })
 const Provinces = ref([])
 const formRef = ref()
 const showDrawer = async ()=>{
   form.value = Object.assign({},form.value,props.data)
-  form.value.departmentids = [form.value.departmentid]
+  form.value.departmentids = form.value.depfullid.split('/').map(Number)
+  console.log(form.value.status)
+  form.value.status == 1?form.value.status =1:form.value.status = 0
   visible.value = true
   sexData()
   depData()

+ 19 - 3
src/operation/moduleNormal/depManage/index.vue

@@ -1,10 +1,21 @@
 <template>
   <div class="flex">
     <main-area class="mainAreaPanel" @onTreeSelect="onTreeSelect"></main-area>
-    <listTemp keyRouteName="name" class="listPanel" ref="list" :columns="columns" :param="param"  :tableName="'staffTable'" :searchType="searchType" :detailPage="{name:'userDetail',idname:'hrid'}">
+    <listTemp :noAutoQuery="true"  keyRouteName="name" class="listPanel" ref="list" :dataSource="dataSource" :columns="columns" :param="param"  :tableName="'staffTable'" :searchType="searchType" :detailPage="{name:'userDetail',idname:'hrid'}">
       <template #operation>
         <add-worker :id="param.content.sa_saleareaid" @onSuccess="list.tableData()"></add-worker>
       </template>
+      <template #tb_cell="{data}">
+        <template v-if="data.column.dataIndex === 'isleader'">
+          {{data.record.isleader == 1?'是':'否'}}
+        </template>
+        <template v-else-if="data.column.dataIndex === 'staffStatus'">
+          <a-tag color="#333">{{data.record.status == 1?'在职':'离职'}}</a-tag>
+        </template>
+        <template v-else-if="data.column.dataIndex === 'operation'">
+          <a-button type="link" @click="toDetailPage(data.record)">详 情</a-button>
+        </template>
+      </template>
     </listTemp>
   </div>
 </template>
@@ -37,10 +48,15 @@
     "id": 20221102090303,
   })
   const list = ref()
-  const onTreeSelect = (id)=>{
+  const onTreeSelect =  (id)=>{
     param.value.content.departmentids = [id]
     list.value.tableData()
   }
+  const toDetailPage = (record)=>{
+    // 跳转到详情
+    router.push({name:'userDetail',query:{id:record.hrid}})
+  }
+
 </script>
 <style scoped>
 .mainAreaPanel{
@@ -54,4 +70,4 @@
   flex: 1 1 auto;
   width: calc(100% - 280px);
 }
-</style>
+</style>

+ 25 - 5
src/operation/moduleNormal/depManage/modules/addMainDep.vue

@@ -33,6 +33,11 @@
             <a-input v-model:value="form.sequence" placeholder="请输入部门排序号" autocomplete="off"></a-input>
           </a-form-item>
         </a-col>
+        <a-col :span="12">
+          <a-form-item label="上级部门" name="depfullids" :rules="[{ required: false, message: '请选择所属部门' }]">
+            <a-cascader v-model:value="form.depfullids" :options="depOptions" placeholder="选择所属部门" :fieldNames="{label:'depname',value:'departmentid',children:'subdep'}" :multiple="false" change-on-select clear @change="onChange"/>
+          </a-form-item>
+        </a-col>
         <a-col :span="12">
           <a-form-item label="是否启用">
             <a-select v-model:value="form.isused">
@@ -53,15 +58,16 @@
 </template>
 
 <script setup>
-import {ref,defineEmits,defineProps,defineExpose} from 'vue'
+import {ref,defineEmits,defineProps,defineExpose,onMounted} from 'vue'
 import {PlusOutlined} from '@ant-design/icons-vue';
 import Api from '@/api/api'
 import utils from '@/utils/utils'
 const emit = defineEmits(['onSuccess'])
-let props = defineProps(['parentid'])
+let props = defineProps(['parentid','depfullid'])
 const visible = ref(false)
 const form = ref({
   "departmentid":0,
+  "depfullids":[],
   "depname":"",
   "isused":1,
   "depno":'',
@@ -71,17 +77,28 @@ const form = ref({
 })
 const showDrawer = ()=>{
   visible.value = true
+  form.value.depfullids = props.depfullid.split('/').map(Number)
 }
 const onClose = () => {
   visible.value = false;
   formRef.value.resetFields();
 };
 const formRef = ref()
+const depOptions = ref([])
+const depData = async ()=>{
+  const res = await Api.requested({
+    id:20230608101802,
+    content:{
+      nocache:true
+    }
+  })
+  depOptions.value = res.data
+}
 
 const submit = async ()=>{
   try {
     const values = await formRef.value.validateFields();
-    form.value.parentid = props.parentid
+    form.value.parentid = form.value.depfullids[form.value.depfullids.length -1]
     const res = await Api.requested({
      "id":20230608102002,
       "content": form.value
@@ -94,9 +111,12 @@ const submit = async ()=>{
     console.log('Failed:', errorInfo);
   }
 }
-
+onMounted(()=>{
+  depData()
+})
 defineExpose({
-  visible
+  /*visible*/
+  showDrawer
 })
 </script>
 <style>

+ 21 - 40
src/operation/moduleNormal/depManage/modules/addWorker.vue

@@ -6,65 +6,45 @@
       class="custom-class"
       title="员工信息"
       placement="right"
-      width="900"
+      width="600"
       :closable="false"
       @close="onClose"
     >
       <a-form ref="formRef" :model="form"  size="small" layout="vertical">
         <a-row :gutter="16">
-          <a-col :span="8">
+          <a-col :span="12">
             <a-form-item label="人员编号" name="hrcode" :rules="[{ required: true, message: '请输入人员编号' }]">
               <a-input v-model:value="form.hrcode" placeholder="输入人员编号"></a-input>
             </a-form-item>
           </a-col>
-          <a-col :span="8">
+          <a-col :span="12">
+            <a-form-item label="人员性别" name="name">
+              <a-select v-model:value="form.sex" style="width: 100%" placeholder="选择人员性别">
+                <a-select-option v-for="item in sexOptions" :key="item.index" :value="item.value">{{item.value}}</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
             <a-form-item label="人员姓名" name="name" :rules="[{ required: true, message: '请输入姓名' }]">
               <a-input v-model:value="form.name" placeholder="输入姓名"></a-input>
             </a-form-item>
           </a-col>
-          <a-col :span="8">
+          <a-col :span="12">
             <a-form-item label="所属部门" name="departmentids" :rules="[{ required: true, message: '请选择所属部门' }]">
               <a-cascader v-model:value="form.departmentids" :options="depOptions" placeholder="选择所属部门" :fieldNames="{label:'depname',value:'departmentid',children:'subdep'}" :multiple="false" change-on-select clear @change="onChange"/>
             </a-form-item>
           </a-col>
-          <a-col :span="8">
-            <a-form-item label="手机号码" name="phonenumber">
-              <a-input v-model:value="form.phonenumber" placeholder="输入手机号码"></a-input>
-            </a-form-item>
-          </a-col>
-          <a-col :span="8">
+          <a-col :span="12">
             <a-form-item label="职位" name="position">
               <a-input v-model:value="form.position" placeholder="输入职位"></a-input>
             </a-form-item>
           </a-col>
-          <a-col :span="8">
-            <a-form-item label="身份证号" name="idcard">
-              <a-input v-model:value="form.idcard" placeholder="输入身份证号"></a-input>
-            </a-form-item>
-          </a-col>
-          <a-col :span="8">
-            <a-form-item label="人员性别" name="name">
-              <a-select v-model:value="form.sex" style="width: 100%" placeholder="选择人员性别">
-                <a-select-option v-for="item in sexOptions" :key="item.index" :value="item.value">{{item.value}}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="8">
-            <a-form-item label="电子邮箱" name="email">
-              <a-input v-model:value="form.email" placeholder="输入姓名"></a-input>
-            </a-form-item>
-          </a-col>
-          <a-col :span="8">
-            <a-form-item label="办公电话" name="officetelephone">
-              <a-input v-model:value="form.officetelephone" placeholder="输入办公电话"></a-input>
-            </a-form-item>
-          </a-col>
           <!-- <a-col :span="8">
             <a-form-item label="汇报对象" name="reporthrid">
               <a-input v-model:value="form.reporthrid" placeholder="输入汇报对象"></a-input>
             </a-form-item>
           </a-col> -->
-          <a-col :span="8">
+          <a-col :span="12">
           <a-form-item label="是否部门负责人">
             <a-select v-model:value="form.isleader">
               <a-select-option :value="1">是</a-select-option>
@@ -72,11 +52,11 @@
             </a-select>
           </a-form-item>
         </a-col>
-        <a-col :span="8">
-          <a-form-item label="是否服务人员">
-            <a-select v-model:value="form.isworker">
-              <a-select-option :value="1"></a-select-option>
-              <a-select-option :value="0"></a-select-option>
+        <a-col :span="12">
+          <a-form-item label="状态">
+            <a-select v-model:value="form.status">
+              <a-select-option :value="1">在职</a-select-option>
+              <a-select-option :value="0">离职</a-select-option>
             </a-select>
           </a-form-item>
         </a-col>
@@ -114,9 +94,10 @@ const form = ref({
   birthday:'',
   hrcode:"",
   isleader:1,
-  isworker:0,
+  isworker:1,
   position:'',
-  remarks:''
+  remarks:'',
+  status:1
 })
 const Provinces = ref([])
 const formRef = ref()

+ 24 - 3
src/operation/moduleNormal/depManage/modules/editMainDep.vue

@@ -31,6 +31,11 @@
             <a-input v-model:value="form.sequence" placeholder="请输入部门排序号" autocomplete="off"></a-input>
           </a-form-item>
         </a-col>
+        <a-col :span="12">
+          <a-form-item label="上级部门" name="depfullids" :rules="[{ required: false, message: '请选择所属部门' }]">
+            <a-cascader v-model:value="form.depfullids" :options="depOptions" placeholder="选择所属部门" :fieldNames="{label:'depname',value:'departmentid',children:'subdep'}" :multiple="false" change-on-select clear @change="onChange"/>
+          </a-form-item>
+        </a-col>
         <a-col :span="12">
           <a-form-item label="是否启用">
             <a-select v-model:value="form.isused">
@@ -43,8 +48,8 @@
     </a-form>
     <template #extra>
       <a-space>
-        <a-button @click="onClose">关闭</a-button>
-        <a-button type="primary" @click="onDelete" danger>删除</a-button>
+        <a-button @click="onClose">取消</a-button>
+<!--        <a-button type="primary" @click="onDelete" danger>删除</a-button>-->
         <a-button type="primary" @click="submit">保存</a-button>
       </a-space>
     </template>
@@ -69,6 +74,7 @@ const form = ref({
   "sequence":""
 })
 const showDrawer = ()=>{
+  console.log(props.data,'props')
   let obj = {
     departmentid:props.data.key,
     parentid:props.data.parentid,
@@ -76,11 +82,25 @@ const showDrawer = ()=>{
     isused:props.data.isused,
     remarks:props.data.remarks,
     depno:props.data.depno,
-    sequence:props.data.sequence
+    sequence:props.data.sequence,
+    depfullids:props.data.depfullid
   }
+  depData()
+  console.log(obj)
   form.value = Object.assign({},form.value,obj)
+  form.value.depfullids = form.value.depfullids.split('/').map(Number)
   visible.value = true
 }
+const depOptions = ref([])
+const depData = async ()=>{
+  const res = await Api.requested({
+    id:20230608101802,
+    content:{
+      nocache:true
+    }
+  })
+  depOptions.value = res.data
+}
 const onClose = () => {
   visible.value = false;
   emit('onClose')
@@ -91,6 +111,7 @@ const formRef = ref()
 const submit = async ()=>{
   try {
     const values = await formRef.value.validateFields();
+    form.value.parentid = form.value.depfullids[form.value.depfullids.length -1]
     const res = await Api.requested({
      "id":20230608102002,
       "content": form.value

+ 28 - 2
src/operation/moduleNormal/depManage/modules/mainDep.vue

@@ -43,7 +43,7 @@
         </template>
       </template>
     </a-tree>
-    <add-main-area ref="add" :parentid="parentid" @onSuccess="getMainClass"></add-main-area>
+    <add-main-area ref="add" :parentid="parentid" :depfullid="depfullid" @onSuccess="getMainClass"></add-main-area>
     <edit-main-area ref="edit" :data="node" @onSuccess="getMainClass" @onClose="onClose"></edit-main-area>
   </div>
 </template>
@@ -56,6 +56,10 @@
   import { EditOutlined ,PlusOutlined,DeleteOutlined} from '@ant-design/icons-vue';
   import { ref,defineEmits } from 'vue'
   import { onMounted,computed } from "vue";
+  import { Modal } from 'ant-design-vue';
+  import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
+  import { createVNode, defineComponent } from 'vue';
+  import {re} from "mathjs";
   const emit = defineEmits(['onTreeSelect'])
   const treeData = ref([])
   const getHeight = computed(()=>{
@@ -78,6 +82,7 @@
       var elNode = {
         title: node["depname"],
         parentid:node['parentid'],
+        depfullid:node['depfullid'],
         departmentid:node["departmentid"],
         key:node["departmentid"],
         remarks:node["remarks"],
@@ -106,9 +111,13 @@
     return arr
   }
   let parentid = ref(0)
+  let departmentid = ref(0)
   const node = ref({})
+  let depfullid = ref(0)
   const handleButtonClick = e => {
+    console.log(e,'333')
     parentid.value = e.key
+    depfullid.value = e.depfullid
     node.value = e
   };
   const add = ref()
@@ -116,7 +125,9 @@
   const handleMenuClick = e => {
     switch (e.key) {
       case 'add':
-        add.value.visible = true
+        /*add.value.visible = true
+        add.value.form.value.parentid = '123'*/
+          add.value.showDrawer()
         break;
       case 'edit':
         edit.value.showDrawer()
@@ -132,6 +143,21 @@
   }
   const deleteArea = async (node)=>{
     console.log(node)
+    Modal.confirm({
+      title: '删除部门',
+      icon: createVNode(ExclamationCircleOutlined),
+      content: '确定删除此部门吗?',
+      okText: '是',
+      okType: 'danger',
+      cancelText: '否',
+      onOk() {
+        onDel(node)
+      },
+      onCancel() {
+      },
+    });
+  }
+  const onDel = async(node)=>{
     const res = await Api.requested({
       "id":20230608102102,
       "content":{

+ 9 - 0
src/style.less

@@ -113,3 +113,12 @@ button:focus-visible {
 .inline-block{
   display: inline-block !important;
 }
+.defaultInfo{
+  font-weight: bold;
+  margin-bottom: 10px !important;
+}
+.defaultInfo-sys{
+  font-weight: bold;
+  margin-bottom: 10px !important;
+  margin-top: 10px !important;
+}