695593266@qq.com 9 месяцев назад
Родитель
Сommit
80aff89c23
1 измененных файлов с 25 добавлено и 5 удалено
  1. 25 5
      src/views/singleLogin/index.vue

+ 25 - 5
src/views/singleLogin/index.vue

@@ -223,7 +223,7 @@
 <script>
   import I18nIcon from '@/layout/components/i18n-icon.vue';
   import { getToken } from '@/utils/token-util';
-  import { login, getCaptcha, getUserInfo } from '@/api/login';
+  import { login, getCaptcha, getUserInfo, getFactoryarea } from '@/api/login';
   import xyy from '@/assets/xyy.jpg';
   import { getPathAddress } from '@/api/system/file';
   import { setCurrentUser } from '@/utils/token-util';
@@ -379,13 +379,27 @@
       /* 跳转到首页 */
       goHome() {
         localStorage.setItem('singleUserInfo', '1');
-        this.isInfo = true;
-        // this.getFactoryList();
+        if (this.$store.state.user.info.teamId) {
+          this.getFactoryareaList();
+          this.getUserAllInfo();
+          this.isInfo = true;
+        } else {
+          this.$message.warning('请先给该员工配置班组!!');
+        }
+        // this.getFactoryList()
 
-        this.getUserAllInfo();
         // this.$router.push(this.$route?.query?.from ?? '/').catch(() => {});
       },
 
+      async getFactoryareaList() {
+        await getFactoryarea({
+          type: 1,
+          size: 9999
+        }).then((res) => {
+          this.factoryList = res.list;
+        });
+      },
+
       async getUserAllInfo() {
         this.infoForm.factoryId = '';
         this.infoForm.workCenterId = '';
@@ -395,7 +409,13 @@
         this.infoForm.factoryName = '';
 
         await getUserInfo(this.$store.state.user.info.userId).then((res) => {
-          this.infoForm.factoryName = res.factoryName;
+          // this.infoForm.factoryName = res.factoryName;
+          // if (res.factoryName) {
+          //   this.infoForm.factoryName = res.factoryName;
+          // } else {
+          const data = this.factoryList.find((it) => it.id == res.factoryId);
+          console.log(data, '数据111');
+          // }
           this.infoForm.factoryId = res.factoryId;
           this.teamList = res.teamList;
           this.userData = res;