ljw 2026-03-03 11:37:05 +08:00
commit 1bcbc1c4cb
7 changed files with 311 additions and 173 deletions

View File

@ -6,176 +6,29 @@ import {
import Strings from '@/common/utils/strings.ts'
import Evt from '@/common/utils/evt.ts'
interface IdentityInfo {
identityCategory: string
customerId: string
/**
* Idcst_org.id
*/
orgId: string
/**
*
*/
customerName: string
/**
*
*/
phone: string
/**
* YueJie-->YuE-->XianFu-->
*/
settlementWay: string
settlementWayTxt: string
/**
* 0-->1-->
*/
manager: boolean
/**
* GeTiHu-->QiYe-->
*/
orgCategory: string
orgCategoryTxt: string
/**
*
*/
uscc: string
/**
*
*/
orgName: string
/**
*
*/
businessLicense: string
/**
*
*/
licenseStartTime: string
/**
*
*/
licenseEndTime: string
/**
*
*/
legalRepresentative: string
/**
*
*/
idcard: string
/**
*
*/
idcardStartTime: string
/**
*
*/
idcardEndTime: string
/**
*
*/
idcardFront: string
/**
*
*/
idcardBack: string
/**
*
*/
province: string
/**
*
*/
city: string
/**
*
*/
area: string
/**
*
*/
town: string
/**
*
*/
provinceName: string
/**
*
*/
cityName: string
/**
*
*/
areaName: string
/**
*
*/
townName: string
/**
*
*/
address: string
/**
*
*/
lng: string
/**
*
*/
lat: string
}
export const useAppUserStore = defineStore('AppUser', () => {
const userId = ref<string | null>(null)
const roles = ref<string[]>([])
const bizObj = ref<string | null>(null)
const nickname = ref<string | null>(null)
const avatar = ref<string | null>(null)
const token = ref<string | null>(null)
const tenantId = ref<string | null>(null)
const tenantName = ref<string | null>(null)
const currentIdentity = ref<IdentityInfo | null>(null)
const identities = ref<IdentityInfo[]>([])
const currentCustomerId = ref<string | null>(null)
const identities = ref<LoginTypes.IdentityInfo[]>([])
const currentIdentity = ref<LoginTypes.IdentityInfo | null>(null)
const isAuthenticated = computed(() => !Strings.isEmpty(token.value))
const isXiaoNa = computed(() => {
return roles.value.includes('ROLE_XiaoNa')
})
const isAdmin = computed(() => {
return roles.value.includes('ROLE_ADMIN')
})
const hasCaiGou = ref<boolean>(false)
const isCaiGou = ref<boolean>(false)
const hasChanFei = ref<boolean>(false)
const isChanFei = ref<boolean>(false)
const hasSiJi = ref<boolean>(false)
const isSiJi = ref<boolean>(false)
const hasXiaoNa = ref<boolean>(false)
const isXiaoNa = ref<boolean>(false)
const hasYunShu = ref<boolean>(false)
const isYunShu = ref<boolean>(false)
const isAdmin = ref<boolean>(false)
function $reset() {
userId.value = null
@ -184,8 +37,23 @@ export const useAppUserStore = defineStore('AppUser', () => {
token.value = null
tenantId.value = null
tenantName.value = null
bizObj.value = null
roles.value = []
currentCustomerId.value = null
currentIdentity.value = null
identities.value = []
tenantId.value = null
tenantName.value = null
hasCaiGou.value = false
isCaiGou.value = false
hasChanFei.value = false
isChanFei.value = false
hasSiJi.value = false
isSiJi.value = false
hasXiaoNa.value = false
isXiaoNa.value = false
hasYunShu.value = false
isYunShu.value = false
isAdmin.value = false
}
Evt.on('logout', $reset)
@ -197,18 +65,27 @@ export const useAppUserStore = defineStore('AppUser', () => {
token,
tenantId,
tenantName,
bizObj,
isAuthenticated,
roles,
hasCaiGou,
isCaiGou,
hasChanFei,
isChanFei,
hasSiJi,
isSiJi,
hasXiaoNa,
isXiaoNa,
hasYunShu,
isYunShu,
isAdmin,
identities,
currentIdentity,
currentCustomerId,
$reset,
}
}, {
persist: {
pick: [ 'userId', 'avatar', 'nickname', 'token', 'tenantId', 'tenantName', 'bizObj' ],
pick: [ 'userId', 'avatar', 'nickname', 'token', 'tenantId', 'tenantName' ],
},
})

View File

@ -45,8 +45,21 @@ export function reloadUserInfo() {
avatar: data.avatar,
tenantId: data.tenantId,
tenantName: data.tenantName,
bizObj: data.bizObj,
roles: data.roles,
currentCustomerId: data.currentCustomerId,
identities: data.identities,
currentIdentity: data.currentIdentity,
hasCaiGou: data.hasCaiGou,
isCaiGou: data.isCaiGou,
hasChanFei: data.hasChanFei,
isChanFei: data.isChanFei,
hasSiJi: data.hasSiJi,
isSiJi: data.isSiJi,
hasXiaoNa: data.hasXiaoNa,
isXiaoNa: data.isXiaoNa,
hasYunShu: data.hasYunShu,
isYunShu: data.isYunShu,
isAdmin: data.isAdmin,
})
})
}
@ -59,9 +72,7 @@ export function hasPermission(resSn?: string) {
export function changeIdentity(id: string) {
return AppApi.changeIdentity(id)
.then(() => {
return reloadUserInfo()
})
.then(reloadUserInfo)
}
export function saveFile(r: Promise<R<{ content: Blob, filename: string }>>, defaultName: string = '下载的文件') {

View File

@ -6,10 +6,22 @@ import AIcon from '@/components/a-icon/AIcon.vue'
import { useAppPageStore } from '@/common/app/app-page-store.ts'
import { elIcons } from '@/common/element/element.ts'
import ATabbar from '@/pages/a-frame/ATabbar.vue'
import { useAppUserStore } from '@/common/app/app-user-store.ts'
import { changeIdentity } from '@/common/app'
import Colls from '@/common/utils/colls.ts'
const appPageStore = useAppPageStore()
const isCollapse = ref(false)
const changingIdentity = ref(false)
const appUserStore = useAppUserStore()
function changeIdentityHandle(val: string) {
changingIdentity.value = true
changeIdentity(val)
.finally(() => {
changingIdentity.value = false
})
}
onMounted(() => {
Evt.emit('connect_ws')
@ -42,6 +54,19 @@ onUnmounted(() => {
<ElButton text>
<AIcon name="settings"/>
</ElButton>
<ElSelect
v-if="!Colls.isEmpty(appUserStore.identities)"
:class="{'change-identity-changing':changingIdentity}"
:disabled="changingIdentity"
:model-value="appUserStore.currentCustomerId"
:show-arrow="changingIdentity"
:suffix-icon="changingIdentity?elIcons.Loading:elIcons.ArrowDown"
class="change-identity" @change="changeIdentityHandle">
<ElOption v-for="item in appUserStore.identities"
:key="item.identityCategory"
:label="item.identityCategoryTxt"
:value="item.customerId"/>
</ElSelect>
</div>
<AAvatar/>
</div>
@ -62,6 +87,15 @@ onUnmounted(() => {
</template>
<style lang="stylus" scoped>
@keyframes el-select__icon-rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.a-frame {
height 100%
width 100%;
@ -81,13 +115,35 @@ onUnmounted(() => {
& > section {
height 100%
//padding-right 20px
.a-frame-header {
height 110px
padding 0 10px 0 0
background-color: #FAFBFC;
.change-identity {
width: 120px
:deep(.el-select__wrapper) {
box-shadow: unset !important
}
:deep(.el-select__wrapper.is-disabled) {
background-color unset !important
}
:deep(.el-select__icon) {
color var(--el-color-primary)
}
}
.change-identity-changing {
:deep(.el-select__icon) {
animation: el-select__icon-rotate 1s linear infinite;
}
}
& > div:nth-child(1) {
height 60px
width 100%

View File

@ -1,6 +1,6 @@
import {
get,
post
post,
} from '@/common/utils/http-util.ts'
export default {
@ -19,4 +19,7 @@ export default {
del(ids: string[]) {
return post('/station/del', ids)
},
listAll() {
return get<StationTypes.SearchStationResult[]>('/station/list_all')
},
}

View File

@ -20,6 +20,17 @@
<ElFormItem v-else label="项目名称" prop="expenseItemName">
<ElInput v-model="formData.expenseItemName" placeholder="项目名称"/>
</ElFormItem>
<ElFormItem v-if="appUserStore.isXiaoNa" label="站点" prop="stationId">
<ElSelect v-model="formData.stationId" clearable>
<ElOption
v-for="item in stations"
:key="item.id"
:label="item.stationName"
:value="item.id!"/>
</ElSelect>
</ElFormItem>
<ElFormItem label="计费策略" prop="expenseStrategy">
<ElRadioGroup v-model="formData.expenseStrategy">
<ElRadio v-for="it in expenseStrategy" :key="'expenseStrategy'+it.val" :value="it.val" border>{{ it.txt }}</ElRadio>
@ -86,6 +97,8 @@ import {
} from '@/pages/gds/goods/constants.ts'
import { expenseItemCategory } from '@/pages/fin/expense-item/constants.ts'
import GoodsDropTable from '@/pages/gds/goods/GoodsDropTable.vue'
import { useAppUserStore } from '@/common/app/app-user-store.ts'
import StationApi from '@/pages/cst/station/station-api.ts'
const props = withDefaults(defineProps<{
research?: () => void
@ -93,6 +106,7 @@ const props = withDefaults(defineProps<{
research: () => {
},
})
const appUserStore = useAppUserStore()
const formPanelIns = useTemplateRef<AFormPanelInstance>('formPanel')
const status = ref<'add' | 'modify'>('add')
const formPanelProps = buildFormPanelProps<ExpenseItemTypes.SearchExpenseItemResult>({
@ -115,11 +129,11 @@ const formPanelProps = buildFormPanelProps<ExpenseItemTypes.SearchExpenseItemRes
doSubmit(data) {
if (status.value === 'add') {
return ExpenseItemApi
.add(data)
.add({...data, stationId: appUserStore.isXiaoNa ? data.stationId : undefined})
.then(props.research)
} else {
return ExpenseItemApi
.modify(data)
.modify({...data, stationId: appUserStore.isXiaoNa ? data.stationId : undefined})
.then(props.research)
}
},
@ -144,8 +158,18 @@ const formPanelProps = buildFormPanelProps<ExpenseItemTypes.SearchExpenseItemRes
watchEffect(() => {
formPanelProps.title = status.value === 'add' ? '新建收费项目' : '修改收费项目信息'
})
const stations = ref<StationTypes.SearchStationResult[]>([])
defineExpose({
open(data?: ExpenseItemTypes.SearchExpenseItemResult) {
if (appUserStore.isXiaoNa) {
StationApi.listAll()
.then(res => {
stations.value = res.data
})
} else {
stations.value = []
}
formPanelIns.value?.open(data?.id)
},
})

View File

@ -5,6 +5,7 @@ declare global {
interface SearchExpenseItemParam extends G.PageParam {
// Id
id?: string
stationId?: string
// 归属用户 Id
userId?: string
// 归属客户 Id
@ -52,6 +53,7 @@ declare global {
id?: string
// 归属用户 Id
userId?: string
stationId?: string
// 归属客户 Id
customerId?: string
// 归属组织 Id
@ -97,6 +99,7 @@ declare global {
id?: string
// 归属用户 Id
userId?: string
stationId?: string
// 归属客户 Id
customerId?: string
// 归属组织 Id
@ -140,6 +143,7 @@ declare global {
interface ModifyExpenseItemParam {
// Id
id?: string
stationId?: string
// 归属用户 Id
userId?: string
// 归属客户 Id

View File

@ -14,10 +14,160 @@ declare global {
logo: string | null
}
interface IdentityInfo {
identityCategory: string
identityCategoryTxt: string
customerId: string
/**
* Idcst_org.id
*/
orgId: string
/**
*
*/
customerName: string
/**
*
*/
phone: string
/**
* YueJie-->YuE-->XianFu-->
*/
settlementWay: string
settlementWayTxt: string
/**
* 0-->1-->
*/
manager: boolean
/**
* GeTiHu-->QiYe-->
*/
orgCategory: string
orgCategoryTxt: string
/**
*
*/
uscc: string
/**
*
*/
orgName: string
/**
*
*/
businessLicense: string
/**
*
*/
licenseStartTime: string
/**
*
*/
licenseEndTime: string
/**
*
*/
legalRepresentative: string
/**
*
*/
idcard: string
/**
*
*/
idcardStartTime: string
/**
*
*/
idcardEndTime: string
/**
*
*/
idcardFront: string
/**
*
*/
idcardBack: string
/**
*
*/
province: string
/**
*
*/
city: string
/**
*
*/
area: string
/**
*
*/
town: string
/**
*
*/
provinceName: string
/**
*
*/
cityName: string
/**
*
*/
areaName: string
/**
*
*/
townName: string
/**
*
*/
address: string
/**
*
*/
lng: string
/**
*
*/
lat: string
}
interface UserDetail {
id: string
nickname: string
bizObj?: string
avatar?: string
tenantId?: string
tenantName?: string
@ -27,6 +177,19 @@ declare global {
setting: UserSetting
currentCustomerId: string
currentOrgId: string
hasCaiGou: boolean
isCaiGou: boolean
hasChanFei: boolean
isChanFei: boolean
hasSiJi: boolean
isSiJi: boolean
hasXiaoNa: boolean
isXiaoNa: boolean
hasYunShu: boolean
isYunShu: boolean
isAdmin: boolean
identities: IdentityInfo[]
currentIdentity: IdentityInfo
}