Ver Fonte

Merge remote-tracking branch 'origin/dev' into dev

Z há 1 ano atrás
pai
commit
08d6cfb41b

+ 13 - 2
src/api/layout/index.js

@@ -3,8 +3,8 @@ import request from '@/utils/request';
 /**
  * 获取当前登录的菜单、按钮权限
  */
-export async function getResourcesTree () {
-  const res = await request.get('/system/resources/getResourcesTree');
+export async function getResourcesTree ({groupId,roleId}) {
+  const res = await request.get('/system/resources/getResourcesTree?groupId='+groupId+'&roleId='+roleId);
   if (res.data.code == 0 && res.data.data) {
     return res.data.data;
   }
@@ -21,6 +21,17 @@ export async function updatePassword (data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+/**
+ * 角色切换 重新获取token
+ */
+ export async function changeRole(data) {
+  const res = await request.post('/main/user/changeRole',data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 
 /**
  * 查询未读通知

+ 3 - 4
src/api/login/index.js

@@ -4,7 +4,7 @@ import { setToken } from '@/utils/token-util';
 /**
  * 登录
  */
-export async function login (data) {
+export async function login(data) {
   const res = await request.post('/main/user/login', data);
   if (res.data.code == 0) {
     setToken(res.data.data.token, data.remember);
@@ -15,7 +15,7 @@ export async function login (data) {
 /**
  * 获取用户信息
  */
-export async function getLoginUser (data) {
+export async function getLoginUser(data) {
   const res = await request.get('/system/account/getLoginUser', data);
   if (res.data.code == 0) {
     return res.data.data;
@@ -26,7 +26,7 @@ export async function getLoginUser (data) {
 /**
  * 获取验证码
  */
-export async function getCaptcha () {
+export async function getCaptcha() {
   const res = await request.get('/captcha');
   if (res.data.code === 0) {
     return res.data.data;
@@ -35,4 +35,3 @@ export async function getCaptcha () {
 }
 
 
-

+ 13 - 2
src/api/material/BOM.js

@@ -272,10 +272,10 @@ export async function startAndStop(data) {
 
 export async function bomSubmit(data) {
   const res = await request.post(`/bpm/bom/submit`, data);
-  if (res.data.code == 0) {
+  if (res && res.data.code == 0) {
     return res.data;
   }
-  return Promise.reject(new Error(res.data.message));
+
 }
 
 // 嘉实医药提交
@@ -384,3 +384,14 @@ export async function contactList(params) {
 }
 
 
+
+// 检查bom  (里面有几个草稿)
+
+export async function hasNewVersion(data) {
+  const res = await request.post(`/main/bomCategory/hasNewVersion`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

+ 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;

+ 117 - 58
src/layout/components/header-tools.vue

@@ -17,13 +17,33 @@
     <div class="ele-admin-header-tool-item">
       <header-notice />
     </div>
+    <div class="ele-admin-header-tool-item">
+      <el-select v-model="groupId" @change="groupIdChange">
+        <el-option
+          v-for="item in loginChangeGroupVOList"
+          :key="item.groupId"
+          :label="item.groupName"
+          :value="item.groupId"
+        >
+        </el-option>
+      </el-select>
+    </div>
+    <div class="ele-admin-header-tool-item">
+      <el-select v-model="roleId" @change="roleChange">
+        <el-option
+          v-for="item in loginChangeRoleVOList"
+          :key="item.roleId"
+          :label="item.roleName"
+          :value="item.roleId"
+        >
+        </el-option>
+      </el-select>
+    </div>
     <!-- 用户信息 -->
     <div class="ele-admin-header-tool-item">
       <el-dropdown @command="onUserDropClick">
         <div class="ele-admin-header-avatar">
-          <el-avatar
-             src="@/assets/images/default-user.png"
-          />
+          <el-avatar src="@/assets/images/default-user.png" />
           <!-- <span class="hidden-xs-only">{{
             loginUser && loginUser.nickname ? loginUser.nickname : ''
           }}</span> -->
@@ -60,66 +80,105 @@
 </template>
 
 <script>
-  import HeaderNotice from './header-notice.vue';
-  import PasswordModal from './password-modal.vue';
-  import SettingDrawer from './setting-drawer.vue';
-  import I18nIcon from './i18n-icon.vue';
-  import { logout } from '@/utils/page-tab-util';
-  import { userLogout } from '@/api/system/user';
+import HeaderNotice from './header-notice.vue';
+import PasswordModal from './password-modal.vue';
+import SettingDrawer from './setting-drawer.vue';
+import I18nIcon from './i18n-icon.vue';
+import { logout } from '@/utils/page-tab-util';
+import { userLogout } from '@/api/system/user';
+
+import router from '@/router/index';
+
+export default {
+  components: { HeaderNotice, PasswordModal, SettingDrawer, I18nIcon },
+  props: {
+    // 是否是全屏
+    fullscreen: Boolean
+  },
+  data() {
+    return {
+      // 是否显示修改密码弹窗
+      passwordVisible: false,
+      // 是否显示主题设置抽屉
+      settingVisible: false,
+      groupId: '',
+      roleId: '',
+         currentUser:{
+        currentGroupId:'',
+        currentRoleId:''
+      }
+    };
+  },
+  created() {
+    this.currentUser = JSON.parse(sessionStorage['currentUser']);
+    this.groupId =  this.currentUser.currentGroupId;
+    this.roleId =  this.currentUser.currentRoleId;
+  },
 
-  export default {
-    components: { HeaderNotice, PasswordModal, SettingDrawer, I18nIcon },
-    props: {
-      // 是否是全屏
-      fullscreen: Boolean
+  computed: {
+    // 当前用户信息
+    loginUser() {
+      return this.$store.state.user?.info;
     },
-    data () {
-      return {
-        // 是否显示修改密码弹窗
-        passwordVisible: false,
-        // 是否显示主题设置抽屉
-        settingVisible: false
-      };
+    // 部门下拉
+    loginChangeGroupVOList() {
+      return this.$store.state.user?.info?.loginChangeGroupVOList;
     },
-    computed: {
-      // 当前用户信息
-      loginUser () {
-        return this.$store.state.user?.info;
-      }
+    // 角色下拉
+    loginChangeRoleVOList() {
+      return this.$store.state.user?.info?.loginChangeGroupVOList.find(
+        (item) => item.groupId == this.groupId
+      )?.loginChangeRoleVOList;
+    }
+  },
+  methods: {
+    groupIdChange(val) {
+      this.roleChange(this.loginChangeRoleVOList[0].roleId);
+    },
+    roleChange(val) {
+      this.roleId = val;
+      this.currentUser.currentGroupId = this.groupId;
+      this.currentUser.currentRoleId = val;
+      sessionStorage['currentUser']=JSON.stringify(this.currentUser)
+      this.$store
+        .dispatch('user/fetchUserInfo')
+        .then(({ menus, homePath, authoritiesRouter }) => {
+          router.roleChange({ menus, homePath, authoritiesRouter });
+        });
     },
-    methods: {
-      /* 用户信息下拉点击事件 */
-      onUserDropClick (command) {
-        if (command === 'password') {
-          this.passwordVisible = true;
-        } else if (command === 'profile') {
-          if (this.$route.fullPath !== '/user/profile') {
-            this.$router.push('/user/profile');
-          }
-        } else if (command === 'logout') {
-          // 退出登录
-          this.$confirm(
-            this.$t('layout.logout.message'),
-            this.$t('layout.logout.title'),
-            { type: 'warning' }
-          )
-            .then(() => {
-              userLogout().then((res) => {
-                localStorage.removeItem('userId');
-                logout();
-              });
-            })
-            .catch(() => {});
+
+    /* 用户信息下拉点击事件 */
+    onUserDropClick(command) {
+      if (command === 'password') {
+        this.passwordVisible = true;
+      } else if (command === 'profile') {
+        if (this.$route.fullPath !== '/user/profile') {
+          this.$router.push('/user/profile');
         }
-      },
-      /* 全屏切换 */
-      toggleFullscreen () {
-        this.$emit('fullscreen');
-      },
-      /* 打开设置抽屉 */
-      openSetting () {
-        this.settingVisible = true;
+      } else if (command === 'logout') {
+        // 退出登录
+        this.$confirm(
+          this.$t('layout.logout.message'),
+          this.$t('layout.logout.title'),
+          { type: 'warning' }
+        )
+          .then(() => {
+            userLogout().then((res) => {
+              localStorage.removeItem('userId');
+              logout();
+            });
+          })
+          .catch(() => {});
       }
+    },
+    /* 全屏切换 */
+    toggleFullscreen() {
+      this.$emit('fullscreen');
+    },
+    /* 打开设置抽屉 */
+    openSetting() {
+      this.settingVisible = true;
     }
-  };
+  }
+};
 </script>

+ 25 - 4
src/router/index.js

@@ -6,10 +6,11 @@ import NProgress from 'nprogress';
 import VueRouter from 'vue-router';
 import { WHITE_LIST, REDIRECT_PATH, LAYOUT_PATH } from '@/config/setting';
 import store from '@/store';
-import { getToken } from '@/utils/token-util';
+import { getToken, setToken } from '@/utils/token-util';
 import { routes, getMenuRoutes } from './routes';
 import { SYSTEM_NAME } from '@/config/setting';
 import { getLoginUser } from '@/api/login';
+import { changeRole } from '@/api/layout/index';
 
 Vue.use(VueRouter);
 
@@ -55,19 +56,19 @@ router.beforeEach((to, from, next) => {
                   path: '/bpm/definition',
                   component: 'bpm/definition',
                   name: '流程定义',
-                  meta: { title: '流程定义',hide:true, routePath: '/bpm/definition' }
+                  meta: { title: '流程定义', hide: true, routePath: '/bpm/definition' }
                 },
                 {
                   path: '/bpm/modelEditor',
                   component: 'bpm/model/modelEditor',
                   name: '设计流程',
-                  meta: { title: '设计流程', hide:true,routePath: '/bpm/modelEditor' }
+                  meta: { title: '设计流程', hide: true, routePath: '/bpm/modelEditor' }
                 },
                 {
                   path: '/bpm/processInstance',
                   component: 'bpm/processInstance/detail',
                   name: '流程详情',
-                  meta: { title: '流程详情', hide:true,routePath: '/bpm/processInstance' }
+                  meta: { title: '流程详情', hide: true, routePath: '/bpm/processInstance' }
                 }
               );
             }
@@ -116,5 +117,25 @@ router.afterEach((to) => {
     }, 200);
   }
 });
+router.roleChange = async ({ menus, homePath, authoritiesRouter }) => {
+  const currentUser = JSON.parse(sessionStorage['currentUser']);
 
+  if (menus && menus.length > 0) {
+    router.addRoute(
+      getMenuRoutes([...menus, ...authoritiesRouter], homePath)
+    );
+    if (router.currentRoute.path != (menus[0].redirect || menus[0].path)) {
+      await router.replace({
+        path: menus[0].redirect || menus[0].path,
+      })
+    }
+    const newToken = await changeRole({ groupId: currentUser.currentGroupId, roleId: currentUser.currentRoleId })
+    setToken(newToken)
+    setTimeout(() => {
+      window.location.reload()
+    }, 100);
+  }
+
+  // next({ ...to, replace: true });
+};
 export default router;

+ 3 - 2
src/store/modules/user.js

@@ -121,8 +121,9 @@ export default {
     //   return { menus, homePath };
     // },
     //动态路由
-    async fetchUserInfo({ commit }) {
-      const result = await getResourcesTree().catch(() => {});
+    async fetchUserInfo({ commit,state }) {
+      let currentUser=JSON.parse(sessionStorage['currentUser'])
+      const result = await getResourcesTree({groupId:currentUser.currentGroupId,roleId:currentUser.currentRoleId}).catch(() => {});
       const list = result?.filter((i) => i.path === '/page-main-data');
       if (!list?.length) {
         return {};

+ 1 - 1
src/styles/transition/common.scss

@@ -191,6 +191,6 @@ table th .is-required::before{
 }
 
 .el-input--medium .el-input__inner {
-  height: 32px  !important;
+  // height: 32px  !important;
   line-height: 32px  !important;
 }

+ 4 - 3
src/utils/request.js

@@ -3,12 +3,13 @@
  */
 import axios from 'axios';
 import router from '@/router';
-import store from '@/store';
+
 import { MessageBox, Message } from 'element-ui';
 import { API_BASE_URL, TOKEN_HEADER_NAME, LAYOUT_PATH } from '@/config/setting';
 import { getToken, setToken } from './token-util';
 import { logout } from './page-tab-util';
 import JSONBIG from 'json-bigint';
+
 const service = axios.create({
   baseURL: API_BASE_URL,
   transformResponse: [
@@ -34,7 +35,6 @@ service.interceptors.request.use(
     if (token && config.headers) {
       config.headers.common[TOKEN_HEADER_NAME] = token;
     }
-
     return config;
   },
   (error) => {
@@ -48,7 +48,7 @@ service.interceptors.request.use(
 service.interceptors.response.use(
   (res) => {
     // token 自动续期
-    if (res.data.code == -1 && res.config?.showErrorToast !== false) {
+    if (Number(res.data.code) == -1 && res.config?.showErrorToast !== false) {
       Message.error(res.data.message);
       return false;
     }
@@ -56,6 +56,7 @@ service.interceptors.response.use(
     if (token) {
       setToken(token);
     }
+
     return res;
   },
   (error) => {

+ 347 - 214
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
@@ -45,10 +55,7 @@
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item
-            label="负责人:"
-            style="margin-bottom: 22px"
-          >
+          <el-form-item label="负责人:" style="margin-bottom: 22px">
             <el-input
               @click.native="openStaffSelection"
               v-model="responsibleName"
@@ -58,30 +65,18 @@
         </el-col>
 
         <el-col :span="12">
-
-          <el-form-item
-            label="状态:"
-            style="margin-bottom: 22px"
-          >
-           <el-select v-model="form.status" style="width: 100%">
-             <el-option label="开启" :value="1"></el-option>
-             <el-option label="关闭" :value="0"></el-option>
-           </el-select>
+          <el-form-item label="状态:" style="margin-bottom: 22px">
+            <el-select v-model="form.status" style="width: 100%">
+              <el-option label="开启" :value="1"></el-option>
+              <el-option label="关闭" :value="0"></el-option>
+            </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="12">
-
-          <el-form-item
-            label="排序:"
-            style="margin-bottom: 22px"
-          >
-            <el-input
-              v-model="form.sort"
-              placeholder="请选择"
-            ></el-input>
+          <el-form-item label="排序:" style="margin-bottom: 22px">
+            <el-input v-model="form.sort" placeholder="请选择"></el-input>
           </el-form-item>
         </el-col>
-
       </el-row>
     </el-form>
     <headerTitle
@@ -199,6 +194,102 @@
         </el-col>
       </el-row>
     </el-form>
+    <!-- <headerTitle
+      title="工厂信息"
+      style="margin-top: 30px"
+      v-if="['40'].includes(form.type)"
+    ></headerTitle>
+    <el-form
+      ref="factoryFormRef"
+      :model="factoryForm"
+      :rules="factoryForm"
+      label-width="100px"
+      v-if="['40'].includes(form.type)"
+    >
+      <el-row>
+        <el-col :span="12">
+          <el-form-item label="工厂编码:" prop="code">
+            <el-input
+              clearable
+              :maxlength="20"
+              v-model="factoryForm.code"
+              placeholder="请输入"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="工厂名称:" prop="name">
+            <el-input
+              clearable
+              :maxlength="20"
+              :disabled="true"
+              v-model="factoryForm.name"
+              placeholder="请输入"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="所属公司:" prop="groupId">
+            <org-select
+              v-model="factoryForm.groupId"
+              :data="organizationList"
+              placeholder="请选择"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="状态:" prop="enabled">
+            <div class="location-warp">
+              <el-select v-model="factoryForm.enabled" style="width: 100%" disabled>
+                <el-option label="生效" :value="1"></el-option>
+                <el-option label="未生效" :value="0"></el-option>
+              </el-select>
+            </div>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="负责人:" prop="leaderId">
+            <el-input
+              @click.native="openStaffSelection"
+              v-model="factoryForm.responsibleName"
+              :disabled="true"
+              placeholder="请选择"
+            ></el-input>
+      
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="所属区域:" prop="location_city">
+            <area-select
+              v-model="factoryForm.areaId"
+              @checkedKeys="getAreaInfo"
+              :data="areaTreeList"
+              ref="tree"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="地址:" prop="location_city">
+            <div class="location-warp">
+              <el-cascader
+                clearable
+                style="width: 385px"
+                v-model="factoryForm.extInfo.location"
+                :options="cityDataLabel"
+              ></el-cascader>
+              <el-input
+                class="detail"
+                clearable
+                :maxlength="20"
+                v-model="factoryForm.extInfo.locationDetail"
+                placeholder="请输入详细地址"
+              />
+            </div>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form> -->
     <template v-slot:footer>
       <el-button @click="updateVisible(false)">取消</el-button>
       <el-button type="primary" :loading="loading" @click="save">
@@ -213,213 +304,255 @@
 </template>
 
 <script>
-  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 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';
 
+const defEnterprise = {
+  businessLicenseFile: [],
+  name: null,
+  address: null,
+  tel: '',
+  registerDate: '',
+  unifiedSocialCreditCode: '',
+  businessScope: '',
+  mainProduct: '',
+  remark: '',
+  fax: ''
+};
+const defFactoryForm = {
+  id: '',
+  code: '',
+  name: '',
+  groupId: '',
+  areaId: '',
+  areaName: '',
+  extInfo: {
+    principalDep: '', // 负责人部门
+    location: [],
+    locationDetail: ''
+  },
+  areaIdList: [],
+  enabled: 1,
+  parentId: 0,
+  leaderId: '',
+  type: 1 //  FACTORY(1, "工厂"), WORKSHOP_PLAN(2, "厂房"), WORKSHOP(3, "车间"), LINE(4, "厂线");
+};
+import {
+  addOrganization,
+  updateOrganization,
+  getById,
+  getCode
+} from '@/api/system/organization';
+import { basicAreaPageAPI } from '@/api/regionalManage';
+import { cityDataLabel } from 'ele-admin/packages/utils/regions';
 
-  const defEnterprise = {
-    businessLicenseFile: [],
-    name: null,
-    address: null,
-    tel: '',
-    registerDate: '',
-    unifiedSocialCreditCode: '',
-    businessScope: '',
-    mainProduct: '',
-    remark: '',
-    fax: ''
-  };
-  import {
-    addOrganization,
-    updateOrganization,
-    getById
-  } from '@/api/system/organization';
-  export default {
-    components: { OrgSelect, OrgTypeSelect, staffSelection, fileUpload },
-    props: {
-      // 弹窗是否打开
-      visible: Boolean,
-      // 修改回显的数据
-      data: Object,
-      // 上级id
-      parentId: [Number, String],
-      // 机构数据
-      organizationList: Array
-    },
-    data() {
-      const defaultForm = {
-        id: null,
-        parentId: null,
-        name: '',
-        type: '',
-        sort: null,
-        status: 1,
-        manager: []
+export default {
+  components: {
+    OrgSelect,
+    OrgTypeSelect,
+    staffSelection,
+    fileUpload,
+    AreaSelect
+  },
+  props: {
+    // 弹窗是否打开
+    visible: Boolean,
+    // 修改回显的数据
+    data: Object,
+    // 上级id
+    parentId: [Number, String],
+    // 机构数据
+    organizationList: Array
+  },
+  data() {
+    const defaultForm = {
+      id: null,
+      parentId: null,
+      name: '',
+      type: '',
+      sort: null,
+      status: 1,
+      manager: [],
+      groupCode:''
+    };
+    return {
+      defaultForm,
+      responsibleName: '',
+      // 表单数据
+      form: { ...defaultForm },
+      enterprise: { ...defEnterprise },
+      factoryForm: {
+        ...defFactoryForm
+      },
+      cityDataLabel,
+      // 表单验证规则
+      rules: {
+        name: [{ required: true, message: '请输入机构名称', trigger: 'blur' }],
+        manager: [{ required: true, message: '请选择负责人', trigger: 'blur' }],
+        type: [{ required: true, message: '请选择机构类型', trigger: 'blur' }]
+      },
+      // 表单验证规则
+      enterpriseRules: {
+        name: [{ required: true, message: '请输入企业名称', trigger: 'blur' }],
+        address: [
+          { required: true, message: '请输入企业地址', trigger: 'blur' }
+        ],
+        unifiedSocialCreditCode: [
+          { required: true, message: '请输入统一社会性代码', trigger: 'blur' }
+        ]
+      },
+      // 提交状态
+      loading: false,
+      // 是否是修改
+      isUpdate: false
+    };
+  },
+  computed: {
+    // 是否开启响应式布局
+    styleResponsive() {
+      return this.$store.state.theme.styleResponsive;
+    }
+  },
+  created() {
+    this.getBasicAreaList();
+  },
+  methods: {
+    /* 保存编辑 */
+    async save() {
+      if (!(await this.formValidate())) {
+        return false;
+      }
+      if (
+        ['10', '20'].includes(this.form.type) &&
+        !(await this.enterpriseValidate())
+      ) {
+        return false;
+      }
+      let form = {
+        ...this.form
       };
-      return {
-        defaultForm,
-        responsibleName: '',
-        // 表单数据
-        form: { ...defaultForm },
-        enterprise: { ...defEnterprise },
-        // 表单验证规则
-        rules: {
-          name: [
-            { required: true, message: '请输入机构名称', trigger: 'blur' }
-          ],
-          manager: [
-            { required: true, message: '请选择负责人', trigger: 'blur' }
-          ],
-          type: [{ required: true, message: '请选择机构类型', trigger: 'blur' }]
-        },
-        // 表单验证规则
-        enterpriseRules: {
-          name: [
-            { required: true, message: '请输入企业名称', trigger: 'blur' }
-          ],
-          address: [
-            { required: true, message: '请输入企业地址', trigger: 'blur' }
-          ],
-          unifiedSocialCreditCode: [
-            { required: true, message: '请输入统一社会性代码', trigger: 'blur' }
-          ]
-        },
-        // 提交状态
-        loading: false,
-        // 是否是修改
-        isUpdate: false
+      if (['10', '20'].includes(this.form.type)) {
+        form['enterprise'] = this.enterprise;
+      }
+      this.loading = true;
+      const data = {
+        ...form,
+        parentId: this.form.parentId || 0
       };
-    },
-    computed: {
-      // 是否开启响应式布局
-      styleResponsive() {
-        return this.$store.state.theme.styleResponsive;
+      if (!this.isUpdate) {
+        delete data.id;
       }
+      const saveOrUpdate = this.isUpdate ? updateOrganization : addOrganization;
+      saveOrUpdate(data)
+        .then((msg) => {
+          this.loading = false;
+          this.$message.success(msg);
+          this.updateVisible(false);
+          this.$emit('done');
+        })
+        .catch((e) => {
+          this.loading = false;
+          // this.$message.error(e.message);
+        });
     },
-    methods: {
-      /* 保存编辑 */
-      async save() {
-        if (!(await this.formValidate())) {
-          return false;
-        }
-        if (
-          ['10', '20'].includes(this.form.type) &&
-          !(await this.enterpriseValidate())
-        ) {
-          return false;
-        }
-        let form = {
-          ...this.form
-        };
-        if (['10', '20'].includes(this.form.type)) {
-          form['enterprise'] = this.enterprise;
-        }
-        this.loading = true;
-        const data = {
-          ...form,
-          parentId: this.form.parentId || 0
-        };
-        if (!this.isUpdate) {
-          delete data.id;
-        }
-        const saveOrUpdate = this.isUpdate
-          ? updateOrganization
-          : addOrganization;
-        saveOrUpdate(data)
-          .then((msg) => {
-            this.loading = false;
-            this.$message.success(msg);
-            this.updateVisible(false);
-            this.$emit('done');
-          })
-          .catch((e) => {
-            this.loading = false;
-            // this.$message.error(e.message);
-          });
-      },
-      formValidate() {
-        return new Promise((resolve, reject) => {
-          this.$refs.form.validate((valid) => {
-            resolve(valid);
-          });
+    formValidate() {
+      return new Promise((resolve, reject) => {
+        this.$refs.form.validate((valid) => {
+          resolve(valid);
         });
-      },
-      enterpriseValidate() {
-        return new Promise((resolve, reject) => {
-          this.$refs.enterpriseForm.validate((valid) => {
-            resolve(valid);
-          });
+      });
+    },
+    getAreaInfo(nodeInfo) {
+      this.factoryForm.areaName = nodeInfo[0]?.pathLabels.join('/') || '';
+      this.factoryForm.areaId = this.factoryForm.areaId || '';
+    },
+    enterpriseValidate() {
+      return new Promise((resolve, reject) => {
+        this.$refs.enterpriseForm.validate((valid) => {
+          resolve(valid);
         });
-      },
-
-      //选择负责人
-      confirmStaffSelection(data) {
-        this.form.manager = JSON.parse(JSON.stringify(data));
-        this.responsibleName = data.map((item) => item.name).toString();
-      },
-      openStaffSelection() {
-        console.log(this.form.manager);
-        this.$refs.staffSelection.open(
-          JSON.parse(JSON.stringify(this.form.manager)) || []
-        );
-      },
-      /* 更新visible */
-      updateVisible(value) {
-        this.$emit('update:visible', value);
+      });
+    },
+    /* 获取区域集合 */
+    async getBasicAreaList() {
+      this.areaList = await basicAreaPageAPI({
+        pageNum: 1,
+        size: 9999
+      });
+      this.areaTreeList = this.$util.toTreeData({
+        data: this.areaList,
+        idField: 'id',
+        parentIdField: 'parentId'
+      });
+    },
+    //选择负责人
+    confirmStaffSelection(data) {
+      this.form.manager = JSON.parse(JSON.stringify(data));
+      this.responsibleName = data.map((item) => item.name).toString();
+    },
+    openStaffSelection() {
+      console.log(this.form.manager);
+      this.$refs.staffSelection.open(
+        JSON.parse(JSON.stringify(this.form.manager)) || []
+      );
+    },
+    /* 更新visible */
+    updateVisible(value) {
+      this.$emit('update:visible', value);
+    }
+  },
+  watch: {
+    form: {
+      deep: true,
+      handler(n) {
+        this.enterprise.name = n.name;
+        this.factoryForm.name = n.name;
       }
     },
-    watch: {
-      form: {
-        deep: true,
-        handler(n) {
-          this.enterprise.name = n.name;
-        }
-      },
-      visible(visible) {
-        if (visible) {
-          if (this.data) {
-            getById(this.data.id).then((res) => {
-              for (const key in res.enterprise) {
-                this.$set(this.enterprise, key, res.enterprise[key]);
+    visible(visible) {
+      if (visible) {
+        if (this.data) {
+          getById(this.data.id).then((res) => {
+            for (const key in res.enterprise) {
+              this.$set(this.enterprise, key, res.enterprise[key]);
+            }
+            for (const key in res) {
+              if (key == 'parentId') {
+                this.$set(this.form, key, res[key] == 0 ? '' : res[key] ?? '');
               }
-              for (const key in res) {
-                if (key == 'parentId') {
-                  this.$set(
-                    this.form,
-                    key,
-                    res[key] == 0 ? '' : res[key] ?? ''
-                  );
-                }
-                if (key != 'enterprise') {
-                  this.$set(this.form, key, res[key]);
-                }
+              if (key != 'enterprise') {
+                this.$set(this.form, key, res[key]);
               }
+            }
 
-              this.form.type = '' + this.form.type; //回显
-              this.responsibleName =
-                res.manager && res.manager.map((item) => item.name).toString();
-            });
+            this.form.type = '' + this.form.type; //回显
+            this.responsibleName =
+              res.manager && res.manager.map((item) => item.name).toString();
+          });
 
-            // this.form.type = '' + this.form.type; //回显
-            // this.responsibleName =
-            //   this.data.manager &&
-            //   this.data.manager.map((item) => item.name).toString();
-            this.isUpdate = true;
-          } else {
-            this.form.parentId = this.parentId;
-            this.isUpdate = false;
-          }
+          // this.form.type = '' + this.form.type; //回显
+          // this.responsibleName =
+          //   this.data.manager &&
+          //   this.data.manager.map((item) => item.name).toString();
+          this.isUpdate = true;
         } else {
-          this.$refs.form.clearValidate();
-          this.$refs.enterpriseForm &&
-            this.$refs.enterpriseForm.clearValidate();
-          this.form = { ...this.defaultForm };
-          this.enterprise = { ...defEnterprise };
-          this.responsibleName = '';
+          this.form.parentId = this.parentId;
+          getCode().then((res) => {
+            this.form.groupCode = res;
+          });
+          this.isUpdate = false;
         }
+      } else {
+        this.$refs.form.clearValidate();
+        this.$refs.enterpriseForm && this.$refs.enterpriseForm.clearValidate();
+        this.form = { ...this.defaultForm };
+        this.enterprise = { ...defEnterprise };
+        this.responsibleName = '';
       }
     }
-  };
+  }
+};
 </script>

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

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

+ 73 - 20
src/views/login/index.vue

@@ -1,16 +1,34 @@
 <template>
-  <div :class="[
-    'login-wrapper',
-    ['', 'login-form-right', 'login-form-left'][direction]
-  ]">
-    <el-form ref="form" size="large" :model="form" :rules="rules" class="login-form ele-bg-white"
-      @keyup.enter.native="submit">
+  <div
+    :class="[
+      'login-wrapper',
+      ['', 'login-form-right', 'login-form-left'][direction]
+    ]"
+  >
+    <el-form
+      ref="form"
+      size="large"
+      :model="form"
+      :rules="rules"
+      class="login-form ele-bg-white"
+      @keyup.enter.native="submit"
+    >
       <h4>{{ $t('login.title') }}</h4>
       <el-form-item prop="loginName">
-        <el-input clearable v-model="form.loginName" prefix-icon="el-icon-user" placeholder="请输入登录账号" />
+        <el-input
+          clearable
+          v-model="form.loginName"
+          prefix-icon="el-icon-user"
+          placeholder="请输入登录账号"
+        />
       </el-form-item>
       <el-form-item prop="loginPwd">
-        <el-input show-password v-model="form.loginPwd" prefix-icon="el-icon-lock" placeholder="请输入登录密码" />
+        <el-input
+          show-password
+          v-model="form.loginPwd"
+          prefix-icon="el-icon-lock"
+          placeholder="请输入登录密码"
+        />
       </el-form-item>
       <!-- <el-form-item prop="code">
         <div class="login-input-group">
@@ -33,19 +51,36 @@
         <el-checkbox v-model="form.remember">
           {{ $t('login.remember') }}
         </el-checkbox>
-        <el-link type="primary" :underline="false" class="ele-pull-right" @click="$router.push('/forget')">
+        <el-link
+          type="primary"
+          :underline="false"
+          class="ele-pull-right"
+          @click="$router.push('/forget')"
+        >
           忘记密码
         </el-link>
       </div>
       <div class="el-form-item">
-        <el-button size="large" type="primary" class="login-btn" :loading="loading" @click="submit">
+        <el-button
+          size="large"
+          type="primary"
+          class="login-btn"
+          :loading="loading"
+          @click="submit"
+        >
           {{ loading ? $t('login.loading') : $t('login.login') }}
         </el-button>
       </div>
       <div class="ele-text-center" style="margin-bottom: 10px">
         <i class="login-oauth-icon el-icon-_qq" style="background: #3492ed"></i>
-        <i class="login-oauth-icon el-icon-_wechat" style="background: #4daf29"></i>
-        <i class="login-oauth-icon el-icon-_weibo" style="background: #cf1900"></i>
+        <i
+          class="login-oauth-icon el-icon-_wechat"
+          style="background: #4daf29"
+        ></i>
+        <i
+          class="login-oauth-icon el-icon-_weibo"
+          style="background: #cf1900"
+        ></i>
       </div>
     </el-form>
     <div class="login-copyright">
@@ -53,10 +88,15 @@
     </div>
     <!-- 多语言切换 -->
     <div style="position: absolute; right: 30px; top: 20px">
-      <i18n-icon :icon-style="{ fontSize: '22px', color: '#fff', cursor: 'pointer' }" />
+      <i18n-icon
+        :icon-style="{ fontSize: '22px', color: '#fff', cursor: 'pointer' }"
+      />
     </div>
     <!-- 实际项目去掉这段 -->
-    <div class="hidden-xs-only" style="position: absolute; right: 30px; bottom: 20px; z-index: 9">
+    <div
+      class="hidden-xs-only"
+      style="position: absolute; right: 30px; bottom: 20px; z-index: 9"
+    >
       <el-radio-group v-model="direction" size="mini">
         <el-radio-button label="2">居左</el-radio-button>
         <el-radio-button label="0">居中</el-radio-button>
@@ -83,9 +123,15 @@ export default {
       loading: false,
       // 表单数据
       form: {
-        loginName: localStorage.getItem('accountInfo') ? JSON.parse(localStorage.getItem('accountInfo')).loginName : '',
-        loginPwd: localStorage.getItem('accountInfo') ? JSON.parse(localStorage.getItem('accountInfo')).loginPwd : '',
-        remember: localStorage.getItem('accountInfo') ? JSON.parse(localStorage.getItem('accountInfo')).remember : false,
+        loginName: localStorage.getItem('accountInfo')
+          ? JSON.parse(localStorage.getItem('accountInfo')).loginName
+          : '',
+        loginPwd: localStorage.getItem('accountInfo')
+          ? JSON.parse(localStorage.getItem('accountInfo')).loginPwd
+          : '',
+        remember: localStorage.getItem('accountInfo')
+          ? JSON.parse(localStorage.getItem('accountInfo')).remember
+          : false
       },
       // 验证码base64数据
       captcha: '',
@@ -136,6 +182,14 @@ export default {
           .then((res) => {
             localStorage.setItem('userId', res.data.userId);
             // 用户信息
+            if (res.data?.loginChangeGroupVOList.length > 0) {
+              sessionStorage['currentUser'] = JSON.stringify({
+                currentGroupId: res.data.loginChangeGroupVOList[0].groupId,
+                currentRoleId:
+                  res.data.loginChangeGroupVOList[0].loginChangeRoleVOList[0]
+                    .roleId
+              });
+            }
             this.$store.commit('user/setUserInfo', res.data);
             this.loading = false;
             this.$message.success(res.message);
@@ -156,7 +210,7 @@ export default {
     },
     /* 跳转到首页 */
     goHome() {
-      this.$router.push(this.$route?.query?.from ?? '/').catch(() => { });
+      this.$router.push(this.$route?.query?.from ?? '/').catch(() => {});
     },
     /* 更换图形验证码 */
     changeCaptcha() {
@@ -217,7 +271,7 @@ export default {
     margin: 0 0 25px 0;
   }
 
-  &>.el-form-item {
+  & > .el-form-item {
     margin-bottom: 25px;
   }
 }
@@ -310,7 +364,6 @@ export default {
 }
 
 @media screen and (max-width: 768px) {
-
   .login-form-right .login-form,
   .login-form-left .login-form {
     left: 50%;

+ 1 - 1
src/views/material/BOMmanage/components/baseInfo.vue

@@ -30,7 +30,7 @@
         </el-col>
         <el-col :span="4" label-width="78px">
           <el-form-item label="版本号:" prop="type">
-            {{ dataInfo.versions }}
+           V{{ dataInfo.versions }}.0
           </el-form-item>
         </el-col>
         <el-col :span="4" label-width="80px">

+ 41 - 4
src/views/material/BOMmanage/components/baseInfoSave.vue

@@ -70,7 +70,7 @@
 </template>
 
 <script>
-  import { saveBomTreeList, bomCategoryUpdate } from '@/api/material/BOM.js';
+  import { saveBomTreeList, bomCategoryUpdate,  hasNewVersion } from '@/api/material/BOM.js';
   import { getCode } from '@/api/codeManagement/index.js';
   export default {
     data() {
@@ -145,7 +145,7 @@
         this.formData = {
           code: this.categoryObj.code,
           name: this.categoryObj.name,
-          versions: this.categoryObj.versions,
+          versions: 'V'+this.categoryObj.versions+'.0',
           status: this.categoryObj.status,
           id: this.categoryObj.id
         };
@@ -166,8 +166,13 @@
       },
 
       handleSave() {
-        this.$refs.form.validate((valid) => {
+        this.$refs.form.validate(async (valid)  => {
           if (valid) {
+            if(!this.isEdit) {
+              let isHas = await this.hasVersionFn();
+              if (!isHas) return;
+            }
+
             let param = {
               ...this.formData,
               categoryId: this.categoryId,
@@ -183,7 +188,39 @@
             return false;
           }
         });
-      }
+      },
+
+
+       hasVersionFn() {
+         return new Promise((resolve) => {
+        let param = {
+          categoryId: this.categoryId,
+          bomType: this.categoryObj.bomType
+        };
+        hasNewVersion(param).then((res) => {
+           if(res.data == 1) {
+                this.$confirm('已经草稿版本存在,是否覆盖?', '提示', {
+                  confirmButtonText: '覆盖',
+                  cancelButtonText: '取消',
+                  type: 'warning'
+                })
+                  .then(() => {
+                    resolve(true);
+                  })
+                  .catch(() => {
+                    resolve(false);
+                  });
+
+
+           } else {
+            resolve(true);
+           }
+
+
+        });
+      });
+      },
+
     }
   };
 </script>

+ 7 - 1
src/views/material/BOMmanage/components/detailedList.vue

@@ -40,6 +40,11 @@
         </el-input>
       </template>
 
+
+      <template v-slot:versions="{ row }">
+       V{{ row.versions }}.0
+      </template>
+
       <template v-slot:produceType="{ row }">
         <el-select
           v-model="row.produceType"
@@ -219,6 +224,7 @@
 
           {
             prop: 'versions',
+            slot: 'versions',
             label: '版本'
           },
 
@@ -250,7 +256,7 @@
         ],
         statusOpt: {
           '': '全部',
-          0: '已停用',
+          0: '草稿',
           1: '已发布'
         },
 

+ 3 - 20
src/views/material/BOMmanage/components/workmanship.vue

@@ -7,7 +7,7 @@
         @keyup.enter.native="search"
         @submit.native.prevent
       >
-        <el-row type="flex" :gutter="15">
+        <el-row type="flex" :gutter="24">
           <el-col :span="6">
             <el-form-item label="工序编码:" label-width="100px">
               <el-input clearable v-model.trim="where.code" placeholder="请输入" />
@@ -18,24 +18,13 @@
               <el-input clearable v-model.trim="where.name" placeholder="请输入" />
             </el-form-item>
           </el-col>
-          <el-col :span="6">
-            <el-form-item label="版本:" label-width="100px">
-              <el-input
-                clearable
-                v-model.trim="where.versions"
-                placeholder="请输入"
-              />
-            </el-form-item>
-          </el-col>
 
-        </el-row>
-        <el-row type="flex" :gutter="15">
           <el-col :span="6">
             <el-form-item label="所属工作中心" label-width="100px">
               <el-input clearable v-model.trim="where.workCenterName" placeholder="请输入" />
             </el-form-item>
           </el-col>
-          <el-col :span="18">
+          <el-col :span="4">
             <div class="ele-form-actions">
               <el-button
                 type="primary"
@@ -294,13 +283,7 @@
             align: 'center',
             minWidth: 110
           },
-          {
-            prop: 'versions',
-            label: '版本',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 110
-          },
+   
           {
             align: 'center',
             prop: 'controlName',

+ 53 - 15
src/views/material/BOMmanage/detailsPop.vue

@@ -133,7 +133,12 @@
               提交发布
             </el-button>
 
-            <el-button type="primary" size="mini" @click="handleSave"   v-if="currentNodeData.status != 1">
+            <el-button
+              type="primary"
+              size="mini"
+              @click="handleSave"
+              v-if="currentNodeData.status != 1"
+            >
               保存
             </el-button>
           </div>
@@ -199,7 +204,7 @@
               >
                 <el-option
                   v-for="item in versList"
-                  :label="item.versions"
+                  :label="'V' + item.versions + '.0'"
                   :value="item.versions"
                   :key="item.id"
                 >
@@ -352,7 +357,8 @@
     deleteBomTreeList,
     bomSubmit,
     jsBomSubmit,
-    deviceBomSubmit
+    deviceBomSubmit,
+    hasNewVersion
   } from '@/api/material/BOM.js';
 
   import baseInfo from './components/baseInfo.vue';
@@ -434,7 +440,6 @@
 
         if (Object.prototype.hasOwnProperty.call(row, 'bomType')) {
           this.currentNodeData.bomType = row.bomType;
-
         }
         this.drawer = true;
         this.getTreeData();
@@ -465,17 +470,16 @@
         this.getVersion();
       },
 
-
       async getTreeData() {
         try {
           this.treeLoading = true;
-          
+
           const res = await getBomTreeList({
             categoryId: this.searchObj.categoryId,
             versions: this.searchObj.versions,
             bomType: this.currentNodeData.bomType,
-            isTemp: this.searchObj.isTemp
-          });
+            isTemp: this.searchObj.isTemp  || 0
+           });
           this.treeLoading = false;
           if (res?.code === '0') {
             if (res.data?.length > 0) {
@@ -507,7 +511,7 @@
         if (id) {
           getBomGetById(id).then((res) => {
             this.currentNodeData = res.data;
-            this.searchObj.versions =  this.currentNodeData.versions
+            this.searchObj.versions = this.currentNodeData.versions;
             this.$forceUpdate();
           });
         } else {
@@ -521,7 +525,8 @@
       getVersion(type) {
         let param = {
           categoryId: this.searchObj.categoryId,
-          bomType: this.currentNodeData.bomType
+          bomType: this.currentNodeData.bomType,
+          isTemp: this.searchObj.isTemp || 0
         };
         versionList(param).then((res) => {
           this.versList = res || [];
@@ -558,10 +563,17 @@
           .finally(() => {});
       },
 
-      transformation(tt) {
+      async transformation(tt) {
         if (this.currentNodeData.status != 1) {
           return this.$message.warning('只有已发布版本才可以转换');
         }
+
+        let _type = tt == 'P' ? 1 : tt == 'M' ? 2 : tt == 'A' ? 3 : 4;
+        if (!this.isEdit) {
+          let isHas = await this.hasVersionFn(_type);
+          if (!isHas) return;
+        }
+
         this.loadingInstance = this.$loading({
           lock: true,
           text: '转换中...',
@@ -585,8 +597,6 @@
             this.loadingInstance.close();
             this.$message.success('转换成功');
 
- 
-             let _type = tt == 'P' ? 1 : tt == 'M' ? 2 : tt == 'A' ? 3 : 4;
             this.currentNodeData.bomType = _type;
             this.getTreeData();
             this.getVersion();
@@ -626,8 +636,10 @@
           })
             .then(() => {
               bomSubmit({ businessId: this.currentNodeData.id }).then((res) => {
-                this.$message.success('发布成功');
-                this.getTreeData();
+                if (res?.code == 0) {
+                  this.$message.success('发布成功');
+                  this.getTreeData();
+                }
               });
             })
             .catch(() => {});
@@ -657,6 +669,32 @@
         } else {
           this.$refs.detailRef.open(this.currentNodeData.processInstanceId);
         }
+      },
+
+      async hasVersionFn(bomType) {
+        return new Promise((resolve) => {
+          let param = {
+            categoryId: this.searchObj.categoryId,
+            bomType: bomType
+          };
+          hasNewVersion(param).then((res) => {
+            if (res.data == 1) {
+              this.$confirm('已经草稿版本存在,是否覆盖?', '提示', {
+                confirmButtonText: '覆盖',
+                cancelButtonText: '取消',
+                type: 'warning'
+              })
+                .then(() => {
+                  resolve(true);
+                })
+                .catch(() => {
+                  resolve(false);
+                });
+            } else {
+              resolve(true);
+            }
+          });
+        });
       }
     }
   };

+ 11 - 2
src/views/material/BOMmanage/index.vue

@@ -30,6 +30,11 @@
             </el-link>
           </template>
 
+          <template v-slot:versions="{ row }">
+              V{{ row.versions }}.0
+          </template>
+
+
           <template v-slot:isTemp="{ row }">
             <el-tag size="mini" v-if="row.isTemp == 1">主数据</el-tag>
           </template>
@@ -131,6 +136,7 @@
           },
           {
             prop: 'versions',
+            slot: 'versions',
             label: '版本'
           },
           {
@@ -247,8 +253,11 @@
           })
             .then(() => {
               bomSubmit({ businessId: row.id }).then((res) => {
-                this.$message.success('发布成功');
-                this.reload();
+                if(res?.code == '0') {
+                  this.$message.success('发布成功');
+                  this.reload();
+                }
+  
               });
             })
             .catch(() => {});

+ 2 - 2
src/views/material/product/components/index-data.vue

@@ -134,14 +134,14 @@
           结构BOM
         </el-link>
 
-        <el-link
+        <!-- <el-link
           type="primary"
           v-if="row.isProduct == 1"
           :underline="false"
           @click="openMaterial(row)"
         >
           物料BOM
-        </el-link>
+        </el-link> -->
 
         <!-- <el-link
           type="primary"

+ 26 - 22
src/views/system/organization/components/org-select.vue

@@ -10,33 +10,37 @@
     default-expand-all
     :placeholder="placeholder"
     @input="updateValue"
+    :disabled="disabled"
   />
 </template>
 
 <script>
-  export default {
-    props: {
-      // 选中的数据(v-model)
-      value: [Number,String],
-      // 提示信息
-      placeholder: {
-        type: String,
-        default: '请选择机构'
-      },
-      // 机构数据
-      data: Array
+export default {
+  props: {
+    // 选中的数据(v-model)
+    value: [Number, String],
+    disabled: {
+      type: Boolean,
+      default: false
     },
-    methods: {
-      /* 更新选中数据 */
-      updateValue(value) {
-        this.$emit('input', value);
-
-        let nodesInfo = []
-         nodesInfo = this.$refs['tree'].getHalfCheckedKeys()
-        nodesInfo.push(value)
-        this.$emit('checkedKeys', nodesInfo)
+    // 提示信息
+    placeholder: {
+      type: String,
+      default: '请选择机构'
+    },
+    // 机构数据
+    data: Array
+  },
+  methods: {
+    /* 更新选中数据 */
+    updateValue(value) {
+      this.$emit('input', value);
 
-      }
+      let nodesInfo = [];
+      nodesInfo = this.$refs['tree'].getHalfCheckedKeys();
+      nodesInfo.push(value);
+      this.$emit('checkedKeys', nodesInfo);
     }
-  };
+  }
+};
 </script>

Diff do ficheiro suprimidas por serem muito extensas
+ 415 - 222
src/views/system/organization/components/org-user-edit.vue


+ 334 - 178
src/views/system/organization/components/org-user-list.vue

@@ -22,7 +22,14 @@
           >
             添加
           </el-button>
-          <el-button type="primary" size="mini" icon="el-icon-upload2" plain @click="uploadFile">导入</el-button>
+          <el-button
+            type="primary"
+            size="mini"
+            icon="el-icon-upload2"
+            plain
+            @click="uploadFile"
+            >导入</el-button
+          >
         </org-user-search>
       </template>
       <!-- 角色列 -->
@@ -53,6 +60,7 @@
           :underline="false"
           icon="el-icon-edit"
           @click="openEdit(row)"
+          v-if="!row.loginName"
         >
           修改
         </el-link>
@@ -65,10 +73,20 @@
         >
           解绑
         </el-link>
+        <el-link
+          v-if="!row.loginName"
+          type="primary"
+          :underline="false"
+          icon="el-icon-add"
+          @click="addUsers(row)"
+        >
+          新建账号
+        </el-link>
         <el-popconfirm
           class="ele-action"
           title="确定要删除此用户吗?"
           @confirm="remove(row)"
+          v-if="!row.loginName"
         >
           <template v-slot:reference>
             <el-link type="danger" :underline="false" icon="el-icon-delete">
@@ -87,195 +105,333 @@
       :organization-id="organizationId"
       @done="reload"
     />
+    <addUsers :visible.sync="showEdit1" :data="null" ref="userEdit" />
+    <importDialog
+      :defModule="moudleName"
+      ref="importDialogRef"
+      @success="reload"
+    />
+    <el-dialog
+      title="提示"
+      :visible.sync="dialogVisible"
+      :before-close="handleClose"
+      width="400px"
+    >
+      <span>是否绑定已有用户?</span>
+      <el-radio v-model="radio" label="1">是</el-radio>
+      <el-radio v-model="radio" label="2">否</el-radio>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="setUser"
+          >确 定</el-button
+        >
+      </span>
+    </el-dialog>
 
-    <importDialog :defModule="moudleName" ref="importDialogRef" @success="reload" />
+    <ele-modal
+      width="1000px"
+      :visible="userShow"
+      :close-on-click-modal="false"
+      custom-class="ele-dialog-form"
+    >
+      <!-- 数据表格 -->
+      <ele-pro-table
+        ref="table"
+        :columns="columns1"
+        :datasource="datasource1"
+        :current.sync="userRow"
+        highlight-current-row
+        row-key="id"
+      >
+      </ele-pro-table>
+      <template v-slot:footer>
+        <el-button @click="userShow = false">取消</el-button>
+        <el-button type="primary" @click="getUser"> 确认 </el-button>
+      </template>
+    </ele-modal>
   </div>
 </template>
 
 <script>
-  import OrgUserSearch from './org-user-search.vue';
-  import OrgUserEdit from './org-user-edit.vue';
-  import importDialog from "@/components/upload/import-dialog.vue";
+import OrgUserSearch from './org-user-search.vue';
+import OrgUserEdit from './org-user-edit.vue';
+import importDialog from '@/components/upload/import-dialog.vue';
+import addUsers from '@/views/system/user/components/user-edit.vue';
 
-  import {
-    getUserPage,
-    removePersonnel,
-    unbindLoginName
-  } from '@/api/system/organization';
+import {
+  getUserPage,
+  removePersonnel,
+  unbindLoginName
+} from '@/api/system/organization';
+import { pageUsers } from '@/api/system/user';
+export default {
+  components: { importDialog, OrgUserSearch, OrgUserEdit, addUsers },
+  props: {
+    // 机构id
+    organizationId: [Number, String],
+    // 全部机构
+    organizationList: Array,
+    institutionList: Array
+  },
+  data() {
+    return {
+      moudleName: 'mainUser',
+      showEdit1: false,
+      userShow: false,
+      userRow: null,
+      currentRow: null,
+      dialogVisible: false,
+      radio: '2',
+      // 表格列配置
+      columns: [
+        {
+          columnKey: 'index',
+          type: 'index',
+          width: 45,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          prop: 'name',
+          label: '姓名',
+          sortable: 'custom',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'jobNumber',
+          label: '工号',
+          sortable: 'custom',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'loginName',
+          label: '用户账号',
+          sortable: 'custom',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'sex',
+          label: '性别',
+          sortable: 'custom',
+          showOverflowTooltip: true,
+          minWidth: 80,
+          formatter: (_row, _column, cellValue) => {
+            return cellValue == 1 ? '男' : cellValue == 2 ? '女' : '';
+          }
+        },
+        {
+          prop: 'status',
+          label: '状态',
+          align: 'center',
+          sortable: 'custom',
+          width: 80,
+          formatter: (_row, _column, cellValue) => {
+            const dom = this.statusOptions.find((item) => {
+              return item.value == cellValue;
+            });
+            return dom ? dom.label : '';
+          }
+        },
+        {
+          prop: 'createTime',
+          label: '创建时间',
+          sortable: 'custom',
+          showOverflowTooltip: true,
+          minWidth: 110,
+          formatter: (_row, _column, cellValue) => {
+            return this.$util.toDateString(cellValue);
+          }
+        },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 200,
+          align: 'left',
+          resizable: false,
+          slot: 'action',
+          showOverflowTooltip: true
+        }
+      ],
+      // 表格列配置
+      columns1: [
+        {
+          columnKey: 'index',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left',
+          label: '序号'
+        },
+        {
+          prop: 'loginName',
+          label: '用户账号',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'jobNumber',
+          label: '工号',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'name',
+          label: '姓名',
 
-  export default {
-    components: {importDialog, OrgUserSearch, OrgUserEdit},
-    props: {
-      // 机构id
-      organizationId: [Number, String],
-      // 全部机构
-      organizationList: Array,
-      institutionList: Array,
-    },
-    data() {
-      return {
-        moudleName : "mainUser",
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'phone',
+          label: '手机号',
+
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
 
-        // 表格列配置
-        columns: [
-          {
-            columnKey: 'index',
-            type: 'index',
-            width: 45,
-            align: 'center',
-            showOverflowTooltip: true,
-            fixed: 'left'
-          },
-          {
-            prop: 'name',
-            label: '姓名',
-            sortable: 'custom',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'jobNumber',
-            label: '工号',
-            sortable: 'custom',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'loginName',
-            label: '用户账号',
-            sortable: 'custom',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'sex',
-            label: '性别',
-            sortable: 'custom',
-            showOverflowTooltip: true,
-            minWidth: 80,
-            formatter: (_row, _column, cellValue) => {
-              return cellValue == 1 ? '男' : cellValue == 2 ? '女' : '';
-            }
-          },
-          {
-            prop: 'status',
-            label: '状态',
-            align: 'center',
-            sortable: 'custom',
-            width: 80,
-            formatter: (_row, _column, cellValue) => {
-              const dom = this.statusOptions.find((item) => {
-                return item.value == cellValue;
-              });
-              return dom ? dom.label : '';
-            }
-          },
-          {
-            prop: 'createTime',
-            label: '创建时间',
-            sortable: 'custom',
-            showOverflowTooltip: true,
-            minWidth: 110,
-            formatter: (_row, _column, cellValue) => {
-              return this.$util.toDateString(cellValue);
-            }
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 200,
-            align: 'left',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true
+        {
+          columnKey: 'groupRoleList',
+          label: '角色',
+          showOverflowTooltip: true,
+          minWidth: 110,
+          formatter: (_row, _column, cellValue) => {
+            let names = [];
+            _row.groupRoleList.forEach((item) => {
+              names.push(...item.roleVOList.map((val) => val.name));
+            });
+            return names.toString();
           }
-        ],
-        // 当前编辑数据
-        current: null,
-        // 是否显示编辑弹窗
-        showEdit: false,
-        statusOptions: [
-          { value: 1, label: '全职' },
-          { value: 2, label: '兼职' },
-          { value: 3, label: '实习' },
-          { value: 4, label: '正式' },
-          { value: 5, label: '试用' },
-          { value: 6, label: '离职' }
-        ]
-      };
+        },
+        {
+          prop: 'createTime',
+          label: '创建时间',
+          // sortable: 'custom',
+          showOverflowTooltip: true,
+          minWidth: 110,
+          formatter: (_row, _column, cellValue) => {
+            return this.$util.toDateString(cellValue);
+          }
+        }
+      ],
+      // 当前编辑数据
+      current: null,
+      // 是否显示编辑弹窗
+      showEdit: false,
+      statusOptions: [
+        { value: 1, label: '全职' },
+        { value: 2, label: '兼职' },
+        { value: 3, label: '实习' },
+        { value: 4, label: '正式' },
+        { value: 5, label: '试用' },
+        { value: 6, label: '离职' }
+      ]
+    };
+  },
+  methods: {
+    async addUsers(row) {
+      this.userRow = null;
+      this.currentRow = row;
+      this.dialogVisible = true;
     },
-    methods: {
-      /* 表格数据源 */
-      datasource({ page, limit, where, order }) {
-        return getUserPage({
-          ...where,
-          ...order,
-          pageNum: page,
-          size: limit,
-          groupId: this.organizationId
-        });
-      },
-      /* 刷新表格 */
-      reload(where) {
-        this.$refs.table.reload({ pageNum: 1, where: where });
-      },
-      /* 显示编辑 */
-      openEdit(row) {
-        this.current = row;
-        this.showEdit = true;
-      },
-
-      // 解除绑定
-      toUnBind(row) {
-        const loading = this.$loading({ lock: true });
-        unbindLoginName(row.id)
-          .then((res) => {
-            loading.close();
-            this.$message.success('解绑成功');
-            this.reload();
-          })
-          .catch((e) => {
-            loading.close();
-            // this.$message.error(e.message);
-          });
-      },
-      /* 删除 */
-      remove(row) {
-        const loading = this.$loading({ lock: true });
-        removePersonnel([row.id])
-          .then((msg) => {
-            loading.close();
-            this.$message.success(msg);
-            this.reload();
-          })
-          .catch((e) => {
-            loading.close();
-            // this.$message.error(e.message);
-          });
-      },
-      /* 更改状态 */
-      editStatus(row) {
-        const loading = this.$loading({ lock: true });
-        updateUserStatus(row.userId, row.status)
-          .then((msg) => {
-            loading.close();
-            this.$message.success(msg);
-          })
-          .catch((e) => {
-            loading.close();
-            row.status = !row.status ? 1 : 0;
-            // this.$message.error(e.message);
-          });
-      },
-      uploadFile () {
-        this.$refs.importDialogRef.open();
+    setUser() {
+      this.dialogVisible = false
+      if (this.radio == 1) {
+        this.userShow = true;
+      } else {
+        this.showEdit1 = true;
+        this.$refs.userEdit.userBk(this.currentRow);
       }
     },
-    watch: {
-      // 监听机构id变化
-      organizationId() {
-        this.reload();
+    getUser() {
+      if (!this.userRow) {
+        this.$message.warning('请选择一条数据!');
+        return;
       }
+      this.userShow = false;
+      this.showEdit1 = true;
+      this.$refs.userEdit.getByData(this.userRow, this.currentRow);
+    },
+
+    /* 表格数据源 */
+    datasource({ page, limit, where, order }) {
+      return getUserPage({
+        ...where,
+        ...order,
+        pageNum: page,
+        size: limit,
+        groupId: this.organizationId
+      });
+    },
+    /* 表格数据源 */
+    datasource1({ page, limit, where, order }) {
+      return pageUsers({ ...where, ...order, pageNum: page, size: limit });
+    },
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({ pageNum: 1, where: where });
+    },
+    /* 显示编辑 */
+    openEdit(row) {
+      this.current = row;
+      this.showEdit = true;
+    },
+
+    // 解除绑定
+    toUnBind(row) {
+      const loading = this.$loading({ lock: true });
+      unbindLoginName(row.id)
+        .then((res) => {
+          loading.close();
+          this.$message.success('解绑成功');
+          this.reload();
+        })
+        .catch((e) => {
+          loading.close();
+          // this.$message.error(e.message);
+        });
+    },
+    /* 删除 */
+    remove(row) {
+      const loading = this.$loading({ lock: true });
+      removePersonnel([row.id])
+        .then((msg) => {
+          loading.close();
+          this.$message.success(msg);
+          this.reload();
+        })
+        .catch((e) => {
+          loading.close();
+          // this.$message.error(e.message);
+        });
+    },
+    /* 更改状态 */
+    editStatus(row) {
+      const loading = this.$loading({ lock: true });
+      updateUserStatus(row.userId, row.status)
+        .then((msg) => {
+          loading.close();
+          this.$message.success(msg);
+        })
+        .catch((e) => {
+          loading.close();
+          row.status = !row.status ? 1 : 0;
+          // this.$message.error(e.message);
+        });
+    },
+    uploadFile() {
+      this.$refs.importDialogRef.open();
+    }
+  },
+  watch: {
+    // 监听机构id变化
+    organizationId() {
+      this.reload();
     }
-  };
+  }
+};
 </script>

+ 2 - 1
src/views/system/organization/index.vue

@@ -72,6 +72,7 @@
       :organization-list="data"
       @done="query"
     />
+   
   </div>
 </template>
 
@@ -85,7 +86,7 @@ import {
 
 export default {
   name: 'SystemOrganization',
-  components: {OrgUserList, OrgEdit},
+  components: {OrgUserList,OrgEdit},
   data() {
     return {
       // 加载状态

+ 36 - 21
src/views/system/user/components/user-edit.vue

@@ -162,21 +162,30 @@ export default {
       this.$refs.addREf.open();
     },
     userBk(data) {
-      this.form.groupRolePOList = [];
-      if (data && data.deptIds) {
+      if (data) {
         this.form.name = data.name;
         this.form.mainUserId = data.id;
         this.form.jobNumber = data.jobNumber;
         this.form.phone = data.phone;
-
-        const deptNames = data.deptName.split('/');
-        data.deptIds.forEach((item, index) => {
+        this.form.groupRolePOList = [];
+        if (!data.deptIds.includes(data.groupId)) {
           this.form.groupRolePOList.push({
-            groupName: deptNames[index],
-            groupId: item,
+            groupName: data.groupName,
+            groupId: data.groupId,
             roleIds: []
           });
-        });
+        }
+
+        if (data.deptIds.length > 0) {
+          const deptNames = data.deptName.split('/');
+          data.deptIds.forEach((item, index) => {
+            this.form.groupRolePOList.push({
+              groupName: deptNames[index],
+              groupId: item,
+              roleIds: []
+            });
+          });
+        }
       }
     },
     /* 保存编辑 */
@@ -225,25 +234,31 @@ export default {
     /* 更新visible */
     updateVisible(value) {
       this.$emit('update:visible', value);
+    },
+    getByData(userRow,currentRow) {
+      let id=this.data?.id||userRow?.id
+      getById(id).then((res) => {
+        this.form = res.data;
+        this.form.groupRolePOList = [];
+        res.data.groupRoleList.forEach((item) => {
+          this.form.groupRolePOList.push({
+            groupName: item.groupName,
+            groupId: item.groupId,
+            roleIds: item.roleVOList.map((ids) => ids.id)
+          });
+        });
+        if (currentRow) {
+          this.isUpdate=true
+          this.userBk(currentRow);
+        }
+      });
     }
   },
   watch: {
     visible(visible) {
       if (visible) {
         if (this.data) {
-          getById(this.data.id).then((res) => {
-            console.log(res,'res')
-            this.form = res.data;
-            this.form.groupRolePOList = [];
-            res.data.groupRoleList.forEach((item) => {
-              this.form.groupRolePOList.push({
-                groupName: item.groupName,
-                groupId: item.groupId,
-                roleIds: item.roleVOList.map((ids) => ids.id)
-              });
-            });
-          });
-
+          this.getByData(this.data);
           this.isUpdate = true;
         } else {
           this.isUpdate = false;

+ 13 - 13
src/views/workforceManagement/team/components/staffSelection.vue

@@ -85,23 +85,23 @@
                       </el-button>
                     </template>
                   </el-table-column>
-<!--                  <el-table-column width="80" label="操作">-->
+                 <el-table-column width="80" label="操作">
 
 
 
 
-<!--                    <template slot-scope="{ row }">-->
-<!--                      <el-button-->
-<!--                        size="mini"-->
-<!--                        type="primary"-->
-<!--                        @click="choiceAsset(row)"-->
-<!--                        :disabled="row.disabled"-->
-<!--                        icon="el-icon-arrow-right"-->
-<!--                        circle-->
-<!--                      >-->
-<!--                      </el-button>-->
-<!--                    </template>-->
-<!--                  </el-table-column>-->
+                 <template slot-scope="{ row }">
+                    <el-button
+                       size="mini"
+                        type="primary"
+                        @click="choiceAsset(row)"
+                        :disabled="row.disabled"
+                       icon="el-icon-arrow-right"
+                        circle
+                     >
+                     </el-button>
+                 </template>
+                  </el-table-column>
                 </el-table>
 <!--                <div-->
 <!--                  v-if="staffList.length !== 0 && isMore"-->

+ 3 - 1
vue.config.js

@@ -33,7 +33,9 @@ module.exports = {
       '/api': {
         // target: 'http://192.168.1.124:50001',
         // target: 'http://192.168.1.147:18086',
-        target: 'http://192.168.1.105:18086',
+        // target: 'http://192.168.1.176:18086',
+        target: 'http://192.168.1.125:18086',
+
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff