| | |
| | | :placeholder="t('sys.login.password')" |
| | | /> |
| | | </FormItem> |
| | | <FormItem name="dept" class="enter-x dept"> |
| | | <FormItem name="factory" class="enter-x dept"> |
| | | <ARow class="enter-x"> |
| | | <ACol :md="24" :xs="24" :span="24"> |
| | | <BasicForm @register="registerForm" /> |
| | | <ApiTreeSelect |
| | | :api="getProdTreeList" |
| | | showSearch |
| | | v-model:value="formData.factory" |
| | | optionFilterProp="label" |
| | | labelField="deptName" |
| | | valueField="deptCode" |
| | | /> |
| | | </ACol> |
| | | </ARow> |
| | | </FormItem> |
| | | |
| | | <ARow class="enter-x"> |
| | | <ACol :span="12"> |
| | | <FormItem> |
| | |
| | | |
| | | <FormItem class="enter-x"> |
| | | <Button type="primary" size="large" block @click="handleLogin" :loading="loading"> |
| | | {{ t({ Key: 'sys.login.welcomeLoginButton', Args: ['test'] }) }} |
| | | {{ t('sys.login.loginButton') }} |
| | | </Button> |
| | | <!-- <Button size="large" class="mt-4 enter-x" block @click="handleRegister"> |
| | | {{ t('sys.login.registerButton') }} |
| | | </Button> --> |
| | | </FormItem> |
| | | <!-- <ARow class="enter-x" :gutter="[16, 16]"> |
| | | <ACol :md="8" :xs="24"> |
| | | <Button block @click="setLoginState(LoginStateEnum.MOBILE)"> |
| | | {{ t('sys.login.mobileSignInFormTitle') }} |
| | | </Button> |
| | | </ACol> |
| | | <ACol :md="8" :xs="24"> |
| | | <Button block @click="setLoginState(LoginStateEnum.QR_CODE)"> |
| | | {{ t('sys.login.qrSignInFormTitle') }} |
| | | </Button> |
| | | </ACol> |
| | | <ACol :md="8" :xs="24"> |
| | | <Button block @click="setLoginState(LoginStateEnum.REGISTER)"> |
| | | {{ t('sys.login.registerButton') }} |
| | | </Button> |
| | | </ACol> |
| | | </ARow> |
| | | |
| | | <Divider class="enter-x">{{ t('sys.login.otherSignIn') }}</Divider> |
| | | |
| | | <div class="flex justify-evenly enter-x" :class="`${prefixCls}-sign-in-way`"> |
| | | <GithubFilled /> |
| | | <WechatFilled /> |
| | | <AlipayCircleFilled /> |
| | | <GoogleCircleFilled /> |
| | | <TwitterCircleFilled /> |
| | | </div> --> |
| | | </Form> |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import { reactive, ref, unref, computed, onMounted, h } from 'vue'; |
| | | import { BasicForm, useForm } from '/@/components/Form/index'; |
| | | import { Checkbox, Form, Input, Row, Col, Button, Select, Divider } from 'ant-design-vue'; |
| | | import { reactive, ref, unref, computed } from 'vue'; |
| | | |
| | | import { Checkbox, Form, Input, Row, Col, Button, Divider, } from 'ant-design-vue'; |
| | | // import { |
| | | // GithubFilled, |
| | | // WechatFilled, |
| | | // AlipayCircleFilled, |
| | | // GoogleCircleFilled, |
| | | // TwitterCircleFilled, |
| | | // } from '@ant-design/icons-vue'; |
| | | import LoginFormTitle from './LoginFormTitle.vue'; |
| | | |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | |
| | | import { useUserStore } from '/@/store/modules/user'; |
| | | import { useI18n } from '@/hooks/web/useI18n'; |
| | | import { useMessage } from '@/hooks/web/useMessage'; |
| | | import { ApiTreeSelect } from '@/components/Form'; |
| | | import { getProdTreeList } from '/@/api/tigerapi/dept'; |
| | | import { useUserStore } from '@/store/modules/user'; |
| | | import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin'; |
| | | import { useDesign } from '/@/hooks/web/useDesign'; |
| | | import { getUserIpConfig } from '/@/utils/http/jsonp'; |
| | | import { AccountInfo } from '/@/api/tigerapi/model/systemModel'; |
| | | import { accountFormSchema } from './loginDept.data'; |
| | | import { getProdTreeList, getTreeList, optionsListApi } from '/@/api/tigerapi/dept'; |
| | | import { useGlobSetting } from '/@/hooks/setting'; |
| | | |
| | | import { useDesign } from '@/hooks/web/useDesign'; |
| | | import { AccountInfo } from '/@/api/tigerapi/model/systemModel'; |
| | | //import { onKeyStroke } from '@vueuse/core'; |
| | | const globSetting = useGlobSetting(); |
| | | |
| | | const ACol = Col; |
| | | const ARow = Row; |
| | | const FormItem = Form.Item; |
| | |
| | | const formData = reactive({ |
| | | account: '', |
| | | password: '', |
| | | }); |
| | | onMounted(async () => { |
| | | // getOption(); |
| | | |
| | | const treeData = await getProdTreeList(); //globSetting.useOrg == 'Y' ? await getTreeList() : await getProdTreeList(); |
| | | updateSchema([ |
| | | { |
| | | field: 'dept', |
| | | componentProps: { treeData }, |
| | | }, |
| | | ]); |
| | | |
| | | // setFieldsValue({ |
| | | // dept: useUserStore().getUserInfo.orgCode, |
| | | // }); |
| | | factory: '', |
| | | }); |
| | | |
| | | const { validForm } = useFormValid(formRef); |
| | | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); |
| | | |
| | | const [registerForm, { updateSchema, validate }] = useForm({ |
| | | // labelWidth: 200, |
| | | baseColProps: { span: 24 }, |
| | | schemas: accountFormSchema, |
| | | showActionButtonGroup: false, |
| | | actionColOptions: { |
| | | span: 23, |
| | | }, |
| | | }); |
| | | //onKeyStroke('Enter', handleLogin); |
| | | |
| | | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); |
| | | |
| | | async function handleLogin() { |
| | | const data = await validForm(); |
| | | const orgData = await validate(); |
| | | console.log('data', data); |
| | | if (!data) return; |
| | | try { |
| | | loading.value = true; |
| | | //const positionInfo = await getUserIpConfig(); |
| | | const Info = { ad_info: {}, ip: '' }; //positionInfo.status === 110 ? { ad_info: {}, ip: '' } : positionInfo.result; |
| | | const Info = { ad_info: {}, ip: '' }; |
| | | const accountInfo: AccountInfo = { |
| | | useR_CODE: data.account, |
| | | password: data.password, |
| | | ORG_CODE: '', //globSetting.useOrg == 'Y' ? orgData.dept : '', |
| | | ad_info: Info.ad_info, |
| | | ip: Info.ip, |
| | | PROD_CODE: orgData.dept, //globSetting.useOrg == 'N' ? orgData.dept : '', |
| | | PROD_CODE: data.factory, //globSetting.useOrg == 'N' ? orgData.dept : '', |
| | | }; |
| | | |
| | | const userInfo = await userStore.login({ |
| | | id: 'string', |
| | | dataType: 'string', |
| | | data: accountInfo, |
| | | mode: 'none', //不要默认的错误提示 |
| | | }); |
| | | |
| | | if (userInfo) { |
| | | notification.success({ |
| | | message: t('sys.login.loginSuccessTitle'), |
| | | description: `${t('sys.login.loginSuccessDesc')}: ${userInfo.realName}`, |
| | | duration: 3, |
| | | }); |
| | | } else { |
| | | createErrorModal({ |
| | | title: t('sys.api.errorTip'), |
| | | content: t('sys.api.errMsg401'), |
| | | getContainer: () => document.body.querySelector(`.${prefixCls}`) || document.body, |
| | | }); |
| | | } |
| | | } catch (error) { |
| | | createErrorModal({ |
| | | title: t('sys.api.errorTip'), |
| | | content: (error as unknown as Error).message || t(error.Key), |
| | | // content: (error as unknown as Error).message || t('sys.api.networkExceptionMsg'), |
| | | content: (error as unknown as Error).message || t('sys.api.networkExceptionMsg'), |
| | | getContainer: () => document.body.querySelector(`.${prefixCls}`) || document.body, |
| | | }); |
| | | } finally { |
| | |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .dept { |
| | | /deep/.ant-select-selector { |
| | | height: 37px !important; |
| | | } |
| | | /deep/.ant-select-single .ant-select-selector { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | } |
| | | </style> |