{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-bpm\\src\\views\\Login.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\views\\Login.vue","mtime":1698778492361},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\nimport uc from '@/api/uc.js'\r\nimport Cookie from 'js-cookie'\r\nimport portal from '@/api/portal.js'\r\nimport {mapState} from 'vuex'\r\nexport default {\r\n  name: 'login',\r\n  props: ['tenant'],\r\n  data() {\r\n    var checkAccount = (rule, value, callback) => {\r\n      if (!value) {\r\n        return callback(new Error('请输入账号'))\r\n      }\r\n      if (/^[a-zA-Z0-9_-]{2,20}$/.test(value)) {\r\n        return callback()\r\n      } else {\r\n        return callback(new Error('账号格式不符合规范'))\r\n      }\r\n    }\r\n    return {\r\n      logo: '',\r\n      name: 'EDP',\r\n      showTenant: false,\r\n      showLogo: false,\r\n      companyName: '管理平台',\r\n      tenantName: '',\r\n\r\n      principal: {\r\n        tenantId: '',\r\n        account: '',\r\n        password: '',\r\n        remberPwd: 0\r\n      },\r\n      rules: {\r\n        account: [{validator: checkAccount, trigger: 'blur'}],\r\n        password: [{required: true, message: '请输入密码', trigger: 'blur'}]\r\n      },\r\n      responseError: '',\r\n      loading: false,\r\n      backStyle: {\r\n        width: '100%',\r\n        height: '100%',\r\n        background: `url(${require('@/assets/img/bg.jpg')}) no-repeat center / 100% 100%`\r\n        // background: `url(${require('@/assets/img/loginbg.png')}) no-repeat center / 100% 100%`,\r\n        // background: `url(${require(\"@/assets/img/back.jpg\")}) center / 100% auto no-repeat`\r\n      },\r\n      totemStyle: {\r\n        width: '420px',\r\n        height: '420px',\r\n        float: 'left',\r\n        // backgroundColor: \"rgb(169 187 205 / 13%)\",\r\n        backgroundColor: '#282b33',\r\n        background: `url(${require('@/assets/img/loginImg.jpg')}) no-repeat center / 100% 100%`\r\n        // background: `#1975FF url(${require(\"@/assets/img/totem.png\")}) center / 100% auto no-repeat`\r\n        // background: `transparent url(${require(\"@/assets/img/totem1.png\")}) no-repeat center 30% / 100% 70% `\r\n      },\r\n      //负责的是登录页授权文件相关数据变量\r\n      isIeExplorer: false,\r\n      dialogVisible: false,\r\n      downLoading: false,\r\n      accept: '.lic',\r\n      files: [],\r\n      uploadingFiles: {}\r\n    }\r\n  },\r\n  mounted() {\r\n    window.webSocket && window.webSocket.close()\r\n    this.setDefaultValue()\r\n    //获取租户信息\r\n    let tenant = this.tenant ? this.tenant : 'platform'\r\n    if (tenant) {\r\n      let url = '${uc}/uc/tenantManage/v1/getTenantByCode?code=' + tenant\r\n      let _this = this\r\n\r\n      this.$http.get(url).then(resp => {\r\n        if (resp.data) {\r\n          let tenantManage = resp.data\r\n          _this.showTenant = true\r\n          _this.companyName = tenantManage.name\r\n          if (tenant != 'platform') {\r\n            _this.principal.tenantId = resp.data.id\r\n          }\r\n          if (tenantManage.ico) {\r\n            let ico = JSON.parse(tenantManage.ico)\r\n            if (ico && ico.length > 0) {\r\n              _this.showLogo = true\r\n              _this.logo =\r\n                window.context.portal +\r\n                '/file/v1/getLogoFile?logoType=manage&tenantId=' +\r\n                tenantManage.id\r\n            }\r\n          }\r\n        }\r\n      })\r\n    } else {\r\n      //不是租户\r\n      this.sysSetting()\r\n    }\r\n  },\r\n  computed: mapState({\r\n    downLoad: function() {\r\n      return `${\r\n        window.context.portal\r\n      }/uc/AuthorizationModel/v1/uploadAuthorizationFile`\r\n    },\r\n    headers: state => {\r\n      return {Authorization: `Bearer ${state.login.currentUser.token}`}\r\n    }\r\n  }),\r\n  methods: {\r\n    //如果记住密码则默认表单赋值\r\n    setDefaultValue() {\r\n      let account = Cookie.get('account'),\r\n        remberPwd = Number(Cookie.get('remberPwd')),\r\n        password = Cookie.get('accountPwd')\r\n      if (remberPwd) {\r\n        // 如果有记住密码 取密文解密放进输入框\r\n        let Base64 = require('js-base64').Base64\r\n        password = Base64.decode(password)\r\n      }\r\n      this.principal = {\r\n        ...this.principal,\r\n        ...{account, password, remberPwd}\r\n      }\r\n    },\r\n    //获取系统默认配置 系统Logo、名称\r\n    sysSetting() {\r\n      const _this = this\r\n      let url =\r\n        window.context.portal + '/sys/sysProperties/v1/getDecryptBySysSetting'\r\n      this.$http.get(url).then(response => {\r\n        if (response && response.data && response.data.value) {\r\n          _this.showTenant = true\r\n          let sysSettingData = JSON.parse(response.data.value)\r\n          if (sysSettingData.manageName == '') {\r\n            _this.companyName = _this.name\r\n          } else {\r\n            _this.companyName = sysSettingData.manageName\r\n          }\r\n          if (sysSettingData.ico.length > 0) {\r\n            let ico = sysSettingData.ico\r\n            _this.showLogo = true\r\n            _this.logo =\r\n              window.context.portal +\r\n              '/file/v1/downloadFile?fileId=' +\r\n              ico[0].id\r\n          }\r\n        }\r\n      })\r\n    },\r\n    querySearch(queryString, cb) {\r\n      if (!queryString) {\r\n        return cb([])\r\n      }\r\n      let queryFilter = {}\r\n      queryFilter.pageBean = {\r\n        page: 1,\r\n        pageSize: 20,\r\n        total: 0,\r\n        showTotal: true\r\n      }\r\n      let query = {\r\n        property: 'name_',\r\n        value: queryString,\r\n        group: 'main',\r\n        operation: 'LIKE',\r\n        relation: 'AND'\r\n      }\r\n      if (!queryFilter.querys) {\r\n        queryFilter.querys = []\r\n      }\r\n      queryFilter.querys.push(query)\r\n\r\n      this.$http\r\n        .post(`${window.context.uc}/uc/tenantManage/v1/listJson`, queryFilter)\r\n        .then(res => {\r\n          // 调用 callback 返回建议列表的数据\r\n          cb(res.data.rows)\r\n        })\r\n    },\r\n    handleSelect(item) {\r\n      this.tenantName = item.name\r\n      this.principal.tenantId = item.id\r\n    },\r\n    setRouterPath() {\r\n      this.$store.dispatch('login/actionLoginAccount', this.principal.account)\r\n      localStorage.setItem(\r\n        this.principal.account + 'loginRoutePath',\r\n        this.$route.path\r\n      )\r\n    },\r\n    submitForm(formName) {\r\n      this.$refs[formName].validate(valid => {\r\n        if (valid) {\r\n          this.inputGetFocus()\r\n          this.loading = true\r\n          this.setRouterPath()\r\n          this.$store\r\n            .dispatch('login/loginByPrincipal', this.principal)\r\n            .then(loginStatus => {\r\n              if (loginStatus && loginStatus == true) {\r\n                this.$store.dispatch('menu/actionMenus').then(res => {\r\n                  if (res.length) {\r\n                    if (res[0].children && res[0].children.length) {\r\n                      this.$router.push({\r\n                        path: `/sysplat/${res[0].children[0].alias}`\r\n                      })\r\n                      // 无固定首页\r\n                      // this.$router.push({\r\n                      //     path: `/frontPlat/${res[0].alias}/${res[0].children[0].alias}`,\r\n                      // })\r\n                      //获取端口号,判断是否是养护系统\r\n                      //   let port = window.location.port\r\n                      //   if (port === '8198' || port === '8888') {\r\n                      //     this.$router.push({\r\n                      //       path: `/sysplat/${res[0].children[0].alias}`\r\n                      //     })\r\n                      //   } else {\r\n                      //     // 固定首页\r\n                      //     // this.$router.push({\r\n                      //     //  path: `/sysplat/sysIndex`\r\n                      //     // })\r\n                      //   }\r\n                    }\r\n                    // else {\r\n                    //     this.$router.push({\r\n                    //         path: `/frontPlat/${res[0].alias}`,\r\n                    //     })\r\n                    // }\r\n                  }\r\n                  this.loading = false\r\n                })\r\n                this.$store.dispatch('menu/actionFrontMenus')\r\n                //     .then(res=>{\r\n                //         if(window.context.railway){\r\n                //             this.$router.push({\r\n                //                 path: `/frontPlat/${res[0].alias}`,\r\n                //             })\r\n                //         }else{\r\n                //             this.$router.push({\r\n                //                 path: `/frontPlat/frontIndex`,\r\n                //             });\r\n                //         }\r\n                //         this.loading = false\r\n                //     });\r\n                // 连接websocket\r\n                this.$bus.$emit('login')\r\n                this.getAllDict()\r\n              } else if (loginStatus == false) {\r\n                this.$router.push({\r\n                  name: 'resetPwdView',\r\n                  params: {account: this.principal.account}\r\n                })\r\n              }\r\n            })\r\n            .catch(msg => {\r\n              this.loading = false\r\n              if (msg.startsWith('timeout of')) {\r\n                msg = '登录超时'\r\n              }\r\n              this.responseError = msg\r\n            })\r\n        } else {\r\n          return false\r\n        }\r\n      })\r\n    },\r\n    getAllDict() {\r\n      portal.getSysDict().then(data => {\r\n        if (data) {\r\n          sessionStorage.setItem('dict_data', JSON.stringify(data))\r\n        }\r\n      })\r\n    },\r\n    inputGetFocus() {\r\n      this.responseError = ''\r\n    },\r\n    resetForm(formName) {\r\n      this.responseError = ''\r\n      this.$refs[formName].resetFields()\r\n    },\r\n    //弹出授权模态框\r\n    authMan() {\r\n      this.dialogVisible = true\r\n    },\r\n    //关闭模态框\r\n    handleClose(done) {\r\n      done()\r\n    },\r\n    //授权文件下载信息文件\r\n    download() {\r\n      this.downLoading = true\r\n      //   console.log('ffff')\r\n      portal.downloadFileLic().then(res => {\r\n        this.downLoading = false\r\n        // const content = res\r\n        // const blob = new Blob([content])\r\n        // const fileName = 'license.lic'\r\n        // const elink = document.createElement('a')\r\n        // elink.download = fileName\r\n        // elink.style.display = 'none'\r\n        // elink.href = URL.createObjectURL(blob)\r\n        // document.body.appendChild(elink)\r\n        // elink.click()\r\n        // URL.revokeObjectURL(elink.href) // 释放URL 对象\r\n        // document.body.removeChild(elink)\r\n        // this.downLoading = false\r\n      })\r\n    },\r\n    //上传授权文件成功返回提示\r\n    success(response, file, fileList) {\r\n      this.$message.success(response)\r\n      console.log(response, file, fileList)\r\n    },\r\n    //上传失败返回提示\r\n    error(response, file, fileList) {\r\n      this.$message.error('文件上传失败')\r\n      delete this.uploadingFiles[Base64.encode(file.name)]\r\n    },\r\n    beforeAvatarUpload(file) {\r\n      // 文件类型限制\r\n      const name = file.name ? file.name : ''\r\n      const ext = name\r\n        ? name.substr(name.lastIndexOf('.') + 1, name.length)\r\n        : true\r\n      const isExt = this.accept.indexOf(ext) < 0\r\n      this.isChecking = !isExt\r\n      if (isExt) {\r\n        if (this.accept == 'false') {\r\n          this.$message.error('请配置可上传文件的格式!')\r\n        } else {\r\n          this.$message.error('上传的附件只能是 ' + this.accept + '格式!')\r\n        }\r\n        return !isExt\r\n      }\r\n      this.uploadingFiles[Base64.encode(name)] = 'eror'\r\n    }\r\n  },\r\n  created() {\r\n    let USER_AGENT = navigator.userAgent.toLowerCase()\r\n    let isChrome = /.*(chrome)\\/([\\w.]+).*/\r\n    if (!isChrome.test(USER_AGENT)) {\r\n      this.isIeExplorer = true\r\n    }\r\n  },\r\n  components: {}\r\n}\r\n",null]}