Explorar o código

组织机构编码

2213980799@qq.com hai 1 ano
pai
achega
371c7fa3fc

+ 21 - 15
src/api/system/organization/index.js

@@ -4,7 +4,7 @@ import request from '@/utils/request';
  * 查询机构列表
  * @param params 查询条件
  */
-export async function listOrganizations (params) {
+export async function listOrganizations(params) {
   const res = await request.get('/main/group/getGroupList', params);
   if (res.data.code == 0) {
     return res.data.data;
@@ -15,8 +15,8 @@ export async function listOrganizations (params) {
  * 查询机构详情
  * @param params 查询条件
  */
-export async function getById (params) {
-  const res = await request.get('/main/group/getById/'+params, {});
+export async function getById(params) {
+  const res = await request.get('/main/group/getById/' + params, {});
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -27,7 +27,7 @@ export async function getById (params) {
  * 查询人员列表
  * @param params 查询条件
  */
-export async function getUserPage (params) {
+export async function getUserPage(params) {
   let par = new URLSearchParams(params);
   const res = await request.get(`/main/user/getUserPage?` + par, {});
   if (res.data.code == 0) {
@@ -35,12 +35,18 @@ export async function getUserPage (params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
-
+//获取组织机构 code
+export async function getCode() {
+  const res = await request.get(`/main/codemanage/getCode/group_code`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+}
 /**
  * 添加机构
  * @param data 机构信息
  */
-export async function addOrganization (data) {
+export async function addOrganization(data) {
   const res = await request.post('/main/group/save', data);
   if (res.data.code == 0) {
     return res.data.message;
@@ -52,7 +58,7 @@ export async function addOrganization (data) {
  * 修改机构
  * @param data 机构信息
  */
-export async function updateOrganization (data) {
+export async function updateOrganization(data) {
   const res = await request.put('/main/group/update', data);
   if (res.data.code == 0) {
     return res.data.message;
@@ -64,7 +70,7 @@ export async function updateOrganization (data) {
  * 删除机构
  * @param data
  */
-export async function removeOrganization (data) {
+export async function removeOrganization(data) {
   const res = await request.post('/main/group/delete', data);
   if (res.data.code == 0) {
     return res.data.message;
@@ -76,7 +82,7 @@ export async function removeOrganization (data) {
  * 获取人员详情
  * @param id 人员id
  */
-export async function getUserDetail (id) {
+export async function getUserDetail(id) {
   const res = await request.get(`/main/user/getById/` + id);
   if (res.data.code == 0) {
     return res.data.data;
@@ -88,7 +94,7 @@ export async function getUserDetail (id) {
  * 新增或修改人员信息
  * @param params 人员信息
  */
-export async function saveOrUpdateUser (params) {
+export async function saveOrUpdateUser(params) {
   const res = await request.post('/main/user/saveNew', params);
   if (res.data.code == 0) {
     return res.data.data;
@@ -100,7 +106,7 @@ export async function saveOrUpdateUser (params) {
  * 删除人员
  * @param params 人员信息
  */
-export async function removePersonnel (params) {
+export async function removePersonnel(params) {
   const res = await request.post('/main/user/removeById', params);
   if (res.data.code == 0) {
     return res.data;
@@ -112,7 +118,7 @@ export async function removePersonnel (params) {
  * 检查工号是否存在
  * @param jobNumber 工号
  */
-export async function checkExistence (jobNumber) {
+export async function checkExistence(jobNumber) {
   const res = await request.get('/main/user/getByJobNumber/' + jobNumber);
   if (res.data.code == 0) {
     return res.data.data;
@@ -125,7 +131,7 @@ export async function checkExistence (jobNumber) {
  * 解除绑定用户账号
  * @param id 人员id
  */
-export async function unbindLoginName (id) {
+export async function unbindLoginName(id) {
   const res = await request.get('/main/user/unbind/' + id);
   if (res.data.code == 0) {
     return res.data.data;
@@ -137,7 +143,7 @@ export async function unbindLoginName (id) {
  * 解除绑定用户账号
  * @param id 人员id
  */
-export async function listAllUserBind () {
+export async function listAllUserBind() {
   const res = await request.get('/main/user/listAllUserBind');
   if (res.data.code == 0) {
     return res.data.data;
@@ -149,7 +155,7 @@ export async function listAllUserBind () {
  * 获取当前登陆用户数据权限部门数据
  * @param
  */
-export async function getCurrentUserAuthorityDeptAPI () {
+export async function getCurrentUserAuthorityDeptAPI() {
   const res = await request.post('/main/user/getCurrentUserAuthorityDepts');
   if (res.data.code == 0) {
     return res.data.data;

+ 34 - 13
src/views/enterpriseModel/dept/components/org-edit.vue

@@ -10,6 +10,16 @@
   >
     <el-form ref="form" :model="form" :rules="rules" label-width="140px">
       <el-row :gutter="15">
+        <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
+          <el-form-item label="编码:">
+            <el-input
+              clearable
+              :maxlength="20"
+              v-model="form.groupCode"
+              :disabled="true"
+            />
+          </el-form-item>
+        </el-col>
         <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
           <el-form-item label="上级机构:">
             <org-select
@@ -184,7 +194,7 @@
         </el-col>
       </el-row>
     </el-form>
-    <headerTitle
+    <!-- <headerTitle
       title="工厂信息"
       style="margin-top: 30px"
       v-if="['40'].includes(form.type)"
@@ -218,7 +228,7 @@
             />
           </el-form-item>
         </el-col>
-        <!-- <el-col :span="12">
+        <el-col :span="12">
           <el-form-item label="所属公司:" prop="groupId">
             <org-select
               v-model="factoryForm.groupId"
@@ -236,9 +246,9 @@
               </el-select>
             </div>
           </el-form-item>
-        </el-col> -->
+        </el-col>
 
-        <!-- <el-col :span="12">
+        <el-col :span="12">
           <el-form-item label="负责人:" prop="leaderId">
             <el-input
               @click.native="openStaffSelection"
@@ -248,7 +258,7 @@
             ></el-input>
       
           </el-form-item>
-        </el-col> -->
+        </el-col>
         <el-col :span="24">
           <el-form-item label="所属区域:" prop="location_city">
             <area-select
@@ -279,7 +289,7 @@
           </el-form-item>
         </el-col>
       </el-row>
-    </el-form>
+    </el-form> -->
     <template v-slot:footer>
       <el-button @click="updateVisible(false)">取消</el-button>
       <el-button type="primary" :loading="loading" @click="save">
@@ -298,7 +308,7 @@ import OrgSelect from './org-select.vue';
 import OrgTypeSelect from './org-type-select.vue';
 import staffSelection from './staffSelection.vue';
 import fileUpload from '@/components/upload/fileUpload';
-import AreaSelect from "@/views/enterpriseModel/regionalManage/components/area-cascader.vue";
+import AreaSelect from '@/views/enterpriseModel/regionalManage/components/area-cascader.vue';
 
 const defEnterprise = {
   businessLicenseFile: [],
@@ -333,13 +343,20 @@ const defFactoryForm = {
 import {
   addOrganization,
   updateOrganization,
-  getById
+  getById,
+  getCode
 } from '@/api/system/organization';
 import { basicAreaPageAPI } from '@/api/regionalManage';
-import {cityDataLabel} from 'ele-admin/packages/utils/regions';
+import { cityDataLabel } from 'ele-admin/packages/utils/regions';
 
 export default {
-  components: { OrgSelect, OrgTypeSelect, staffSelection, fileUpload,AreaSelect },
+  components: {
+    OrgSelect,
+    OrgTypeSelect,
+    staffSelection,
+    fileUpload,
+    AreaSelect
+  },
   props: {
     // 弹窗是否打开
     visible: Boolean,
@@ -358,7 +375,8 @@ export default {
       type: '',
       sort: null,
       status: 1,
-      manager: []
+      manager: [],
+      groupCode:''
     };
     return {
       defaultForm,
@@ -448,8 +466,8 @@ export default {
       });
     },
     getAreaInfo(nodeInfo) {
-      this.factoryForm.areaName = nodeInfo[0]?.pathLabels.join('/') || ''
-      this.factoryForm.areaId = this.factoryForm.areaId || ''
+      this.factoryForm.areaName = nodeInfo[0]?.pathLabels.join('/') || '';
+      this.factoryForm.areaId = this.factoryForm.areaId || '';
     },
     enterpriseValidate() {
       return new Promise((resolve, reject) => {
@@ -522,6 +540,9 @@ export default {
           this.isUpdate = true;
         } else {
           this.form.parentId = this.parentId;
+          getCode().then((res) => {
+            this.form.groupCode = res;
+          });
           this.isUpdate = false;
         }
       } else {

+ 7 - 0
src/views/enterpriseModel/dept/index.vue

@@ -152,6 +152,13 @@ export default {
           showOverflowTooltip: true,
           fixed: 'left'
         },
+        {
+          prop: 'groupCode',
+          label: '编码',
+          showOverflowTooltip: true,
+          minWidth: 150,
+          slot: 'groupCode'
+        },
         {
           prop: 'name',
           label: '部门名称',