From 50f11921daf05d9847ab325e98387442ef7882b0 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期一, 05 八月 2024 16:13:38 +0800 Subject: [PATCH] 一些更改 --- src/views/sys/login/LoginForm.vue | 56 +++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 37 insertions(+), 19 deletions(-) diff --git a/src/views/sys/login/LoginForm.vue b/src/views/sys/login/LoginForm.vue index 854335b..8420c4c 100644 --- a/src/views/sys/login/LoginForm.vue +++ b/src/views/sys/login/LoginForm.vue @@ -25,18 +25,22 @@ /> </FormItem> <FormItem name="factory" class="enter-x dept"> - <ARow class="enter-x"> - <ACol :md="24" :xs="24" :span="24"> - <ApiTreeSelect - :api="getProdTreeList" - showSearch - v-model:value="formData.factory" - optionFilterProp="label" - labelField="deptName" - valueField="deptCode" - /> - </ACol> - </ARow> + <ApiSelect + v-if="byOrg" + :api="getTreeList" + v-model:value="formData.factory" + labelField="deptName" + valueField="deptCode" + placeholder="璇烽�夋嫨宸ュ巶" + /> + <ApiSelect + v-if="byProd" + :api="getProdTreeList" + v-model:value="formData.factory" + labelField="deptName" + valueField="deptCode" + placeholder="璇烽�夋嫨宸ュ巶" + /> </FormItem> <ARow class="enter-x"> <ACol :span="12"> @@ -95,9 +99,9 @@ </Form> </template> <script lang="ts" setup> - import { reactive, ref, unref, computed } from 'vue'; + import { reactive, ref, unref, computed, onMounted, onUnmounted } from 'vue'; - import { Checkbox, Form, Input, Row, Col, Button, Divider, } from 'ant-design-vue'; + import { Checkbox, Form, Input, Row, Col, Button, Divider } from 'ant-design-vue'; // import { // GithubFilled, // WechatFilled, @@ -106,15 +110,15 @@ // TwitterCircleFilled, // } from '@ant-design/icons-vue'; import LoginFormTitle from './LoginFormTitle.vue'; - + import { ApiSelect } from '/@/components/Form/index'; import { useI18n } from '@/hooks/web/useI18n'; import { useMessage } from '@/hooks/web/useMessage'; - import { ApiTreeSelect } from '@/components/Form'; - import { getProdTreeList } from '/@/api/tigerapi/dept'; + import { getProdTreeList, getTreeList } from '/@/api/tigerapi/dept'; import { useUserStore } from '@/store/modules/user'; import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin'; import { useDesign } from '@/hooks/web/useDesign'; -import { AccountInfo } from '/@/api/tigerapi/model/systemModel'; + import { AccountInfo } from '/@/api/tigerapi/model/systemModel'; + import { getSysParam } from '/@/api/tigerapi/system'; //import { onKeyStroke } from '@vueuse/core'; const ACol = Col; @@ -132,6 +136,8 @@ const formRef = ref(); const loading = ref(false); const rememberMe = ref(false); + const byOrg = ref(false); + const byProd = ref(false); const formData = reactive({ account: '', @@ -145,6 +151,18 @@ const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); + onMounted(async () => { + var action = await getSysParam({ group: 'ByAuthActive' }); + if (action.IsSuccessed) { + if (action.Data.filter((x) => x.PARAM_CODE == 'ByOrgActive')[0].PARAM_VALUE == 'Y') { + byOrg.value = true; + } + if (action.Data.filter((x) => x.PARAM_CODE == 'ByProdActive')[0].PARAM_VALUE == 'Y') { + byProd.value = true; + } + } + }); + async function handleLogin() { const data = await validForm(); if (!data) return; @@ -154,7 +172,7 @@ const accountInfo: AccountInfo = { useR_CODE: data.account, password: data.password, - ORG_CODE: '', //globSetting.useOrg == 'Y' ? orgData.dept : '', + ORG_CODE: data.factory, //globSetting.useOrg == 'Y' ? orgData.dept : '', ad_info: Info.ad_info, ip: Info.ip, PROD_CODE: data.factory, //globSetting.useOrg == 'N' ? orgData.dept : '', -- Gitblit v1.9.3