切换组织机构

feature-JimuReport-1106-yjl
lijingjia 1 month ago
parent e3feb1b7e5
commit aab535bf28

@ -496,6 +496,15 @@ export function GetCarrierSelectList(params) {
})
}
// 切换组织机构
export function ChangeOrg(params) {
return request({
url: '/mainApi/Common/ChangeOrg',
method: 'get',
params,
})
}
export function GetFormSetListByModule(params) {
return request({
url: Api.GetFormSetListByModule,

@ -18,24 +18,26 @@
<!-- v-if="getShowDoc"-->
<!-- />-->
<!-- <MenuDivider v-if="getShowDoc" />-->
<MenuItem
key="logout"
:text="t('layout.header.dropdownItemLoginOut')"
icon="ion:power-outline"
/>
<!-- <MenuItem-->
<!-- v-if="getUseLockPage"-->
<!-- key="lock"-->
<!-- :text="t('layout.header.tooltipLock')"-->
<!-- icon="ion:lock-closed-outline"-->
<!-- />-->
<!-- <MenuItem key="tenant" text="切换租户" icon="ant-design:cluster-outlined" />-->
<MenuItem key="tenant" text="切换机构" icon="ant-design:cluster-outlined" />
<MenuItem key="password" text="修改密码" icon="ant-design:edit-outlined" />
<MenuItem
key="logout"
:text="t('layout.header.dropdownItemLoginOut')"
icon="ion:power-outline"
/>
</Menu>
</template>
</Dropdown>
<!-- <LockAction @register="register" />-->
<UpdatePassword ref="updatePasswordRef" />
<Org ref="orgRef" />
</template>
<script lang="ts">
// components
@ -55,6 +57,7 @@
import headerImg from '/@/assets/images/header.jpg'
import { propTypes } from '/@/utils/propTypes'
import { openWindow } from '/@/utils'
import Org from './org.vue'
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'
@ -68,6 +71,7 @@
MenuItem: createAsyncComponent(() => import('./DropMenuItem.vue')),
MenuDivider: Menu.Divider,
UpdatePassword: createAsyncComponent(() => import('./UpdatePassword.vue')),
Org
},
props: {
theme: propTypes.oneOf(['dark', 'light']),
@ -89,6 +93,11 @@
function handleLoginOut() {
userStore.confirmLoginOut()
}
const orgRef = ref(null)
function toggleOrg() {
console.log(orgRef)
orgRef.value.init(userStore.getUserInfo)
}
function handleLock() {
openModal(true)
}
@ -103,6 +112,9 @@
}
function handleMenuClick(e: MenuInfo) {
switch (e.key as MenuEvent) {
case 'tenant':
toggleOrg()
break
case 'logout':
handleLoginOut()
break
@ -126,6 +138,7 @@
register,
updatePasswordRef,
getUseLockPage,
orgRef
}
},
})

@ -0,0 +1,86 @@
<!--
* @Desc:
* @Author: lijj
* @Date: 2024-10-18 11:20:04
-->
<template>
<BasicModal
v-bind="$attrs"
title="选择机构"
width="400px"
@register="registerModal"
@ok="handleSubmit"
>
<a-form class="ds-org-toggle-model" layout="vertical">
<a-form-item label="机构名称">
<a-radio-group v-model:value="orgId">
<a-radio v-for="item in options" :key="item.orgId" :value="item.orgId">{{ item.orgName }}</a-radio>
</a-radio-group>
</a-form-item>
</a-form>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, defineExpose } from 'vue'
import { BasicModal, useModalInner } from '/@/components/Modal'
import { useMessage } from '/@/hooks/web/useMessage'
import { ChangeOrg, getUserInfo } from '/@/api/common/index'
import { useMultipleTabStore } from '/@/store/modules/multipleTab'
import { router } from '/@/router'
// Emits
const $message = useMessage()
import { useTabs } from '/@/hooks/web/useTabs'
import { useUserStore } from '/@/store/modules/user'
const { refreshPage } = useTabs(router)
const tabStore = useMultipleTabStore()
const options = ref([])
const orgId = ref(null)
//
const [registerModal, { setModalProps, closeModal }] = useModalInner()
//
async function handleSubmit() {
setModalProps({ confirmLoading: true })
const userStore = useUserStore()
ChangeOrg({ id: orgId.value }).then(res => {
userStore.setToken(res.data.accessToken)
userStore.setUserInfo({ refreshToken: res.data.refreshToken })
getUserInfo().then(data => {
setModalProps({ confirmLoading: false })
const userInfo = data.data
userStore.setUserInfo(userInfo)
tabStore.closeAllTab(router)
$message.createMessage.success('切换成功!')
closeModal()
}).catch(() => {
setModalProps({ confirmLoading: false })
})
refreshPage()
}).catch(() => {
setModalProps({ confirmLoading: false })
})
}
async function init(info) {
if (!info) {
$message.createMessage.warning('当前系统无登录用户!')
return
} else {
await setModalProps({ visible: true })
options.value = info.userOrgs
orgId.value = info.orgId
}
}
defineExpose({
init,
})
</script>
<style lang="less">
.ds-org-toggle-model {
.ant-radio-group .ant-radio-wrapper {
width: 100%;
}
}
</style>

@ -91,10 +91,10 @@
return item.id
})
if (pkIdArr.length === 0 || pkIdArr.length > 1) {
createMessage.warning('请选择一条数据!')
createMessage.warning('请选择一条数据进行复制')
return false
}
copyMoreFlag.value = true
go(`/BookingDetail?id=${pkIdArr[0]}&source=copy`)
}
function handleSubmitCopyMore() {
const select = props.selectRow()

@ -2,7 +2,7 @@ import { FormSchema, BasicColumn } from '/@/components/Table'
import { useOptionsStore } from '/@/store/modules/options'
import { GetClientListByCode } from '/@/api/common'
import {
GetPackageSelectList,
GetOrderContactListByClientId,
GetShippingBillTemplateSelectList,
GetClientPortSelectList,
GetVesselSelectList,
@ -557,45 +557,12 @@ export const formSchema2: FormSchema[] = [
}
},
},
// {
// label: '',
// field: 'transPort',
// component: 'Space',
// required: false,
// colProps: { span: 12 },
// },
{
field: 'shipperCnId',
label: '',
component: 'Input',
show: false,
},
{
label: '提单确认人',
field: 'shipperCn',
component: 'ApiSelect',
field: 'transPort',
component: 'Space',
required: false,
dynamicDisabled: false,
colProps: { span: 12 },
componentProps: ({ formModel }) => {
return {
api: GetClientListByCode,
params: { code: 'shippercn' },
labelField: 'pinYinCode',
valueField: 'shortName',
showName: 'shortName',
resultField: 'data',
immediate: false,
onChange: (e, obj) => {
if (e && obj) {
formModel.shipperCnId = obj.id
}
if (!e && !obj) {
formModel.shipperCnId = null
}
}
}
}
},
{
label: '',
@ -961,7 +928,7 @@ export const formSchema4: FormSchema[] = [
},
},
]
const personList = ref([])
// 集装箱表单
export const formSchema5: FormSchema[] = [
{
@ -969,7 +936,7 @@ export const formSchema5: FormSchema[] = [
field: 'mblno',
component: 'Input',
defaultValue: '',
colProps: { span: 12 },
colProps: { span: 5 },
},
{
label: '分提单号',
@ -977,8 +944,96 @@ export const formSchema5: FormSchema[] = [
component: 'Input',
required: true,
defaultValue: null,
colProps: { span: 12 },
colProps: { span: 5 },
},
{
field: 'shipperCnId',
label: '',
component: 'Input',
show: false,
},
{
label: '提单确认人',
field: 'shipperCn',
component: 'ApiSelect',
required: false,
dynamicDisabled: false,
colProps: { span: 5 },
componentProps: ({ formModel }) => {
return {
api: GetClientListByCode,
params: { code: 'shippercn' },
labelField: 'pinYinCode',
valueField: 'shortName',
showName: 'shortName',
resultField: 'data',
immediate: false,
onChange: (e, obj) => {
if (e && obj) {
formModel.shipperCnId = obj.id
GetOrderContactListByClientId({ id: obj.id }).then((res) => {
personList.value = res.data.map((item) => {
return {
label: item.name,
value: item.name,
id: item.id,
email: item.email,
mobile: item.mobile,
}
})
})
}
if (!e && !obj) {
formModel.shipperCnId = null
}
}
}
}
},
{
field: 'BLConfirmationId',
label: '',
component: 'Input',
show: false,
},
{
field: 'BLConfirmationName',
label: '联系人',
component: 'Select',
required: false,
dynamicDisabled: false,
colProps: { span: 5 },
componentProps: ({ formModel, formActionType }) => {
return {
options: personList.value,
mode: 'SECRET_COMBOBOX_MODE_DO_NOT_USE',
allowClear: true,
showSearch: true,
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
onChange: (v, obj) => {
if (v && obj) {
formModel.customerContactId = obj.id
formModel.email = obj.email
formModel.mobile = obj.mobile
}
if (!v && (!obj || obj == {})) {
formModel.customerContactId = null
formModel.email = null
formModel.mobile = null
}
}
}
}
},
{
label: '邮箱',
field: 'BLConfirmationEmail',
component: 'Input',
colProps: { span: 5 },
rules: [{ type: 'email', message: '请填写正确的邮箱地址' }]
}
]
// 历史提单表格

@ -88,13 +88,13 @@
<a-tabs v-model:activeKey="activeKey" class="ds-sea-child-tab">
<a-tab-pane key="1" tab="分单信息" size="small">
<a-spin :spinning="dloading">
<!-- 集装箱表单 -->
<BasicForm style="margin-bottom: 0;" @register="containerForm" />
<div class="flex mt10">
<!-- 收发通表单 -->
<BasicForm style="flex: 1;" @register="registerForm" />
<!-- 集装箱组件 -->
<div style="width: 800px;" class="ml15">
<!-- 集装箱表单 -->
<BasicForm style="margin-bottom: 0;" @register="containerForm" />
<container
ref="contBox"
:id="id"

@ -187,13 +187,13 @@
</template>
<template v-if="column.key === 'action'">
<TableAction :actions="[
{
icon: 'ant-design:copy-outlined',
tooltip: '复制',
onClick: () => {
copyBooking(record)
},
},
// {
// icon: 'ant-design:copy-outlined',
// tooltip: '',
// onClick: () => {
// copyBooking(record)
// },
// },
{
icon: 'clarity:note-edit-line',
tooltip: '编辑',
@ -452,10 +452,10 @@ const [registerTable, { reload, getForm, setLoading, getSelectRows }] = useTable
resizeHeightOffset: 75,
immediate: false,
actionColumn: {
width: 80,
width: 60,
title: '操作',
dataIndex: 'action',
fixed: 'right',
fixed: 'right'
},
// showSummary: true,
})

Loading…
Cancel
Save