style:部门选择样式

This commit is contained in:
houjunxiang
2025-11-27 09:19:08 +08:00
parent fcc04865f9
commit f3c15b3692
3 changed files with 11 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
<template> <template>
<view v-if="dialogStore.show" class="company-dept-dialog"> <view v-if="dialogStore.show" class="company-dept-dialog">
<view class="company-dept-dialog__mask" @tap="handleCancel" /> <view class="company-dept-dialog__mask" />
<view class="company-dept-dialog__panel"> <view class="company-dept-dialog__panel">
<view class="company-dept-dialog__header"> <view class="company-dept-dialog__header">
<text class="company-dept-dialog__title">{{ dialogStore.title }}</text> <text class="company-dept-dialog__title">{{ dialogStore.title }}</text>
@@ -12,10 +12,7 @@
<uni-data-select <uni-data-select
v-model="selectedCompanyModel" v-model="selectedCompanyModel"
:localdata="companyOptionsForSelect" :localdata="companyOptionsForSelect"
collection="" :clear="false"
field="companyName"
orderby=""
:clear-icon="false"
@change="onCompanyChangeUni" @change="onCompanyChangeUni"
/> />
</view> </view>
@@ -26,17 +23,14 @@
<uni-data-select <uni-data-select
v-model="selectedDeptModel" v-model="selectedDeptModel"
:localdata="deptOptionsForSelect" :localdata="deptOptionsForSelect"
collection="" :clear="false"
field="deptName"
orderby=""
:clear-icon="false"
@change="onDeptChangeUni" @change="onDeptChangeUni"
/> />
</view> </view>
</view> </view>
<view class="company-dept-dialog__footer"> <view class="company-dept-dialog__footer">
<u-button @tap="handleCancel">取消</u-button> <u-button v-if="showCancel" style="width: 40%" @tap="handleCancel">取消</u-button>
<u-button type="primary" :disabled="!isConfirmEnabled" @tap="handleConfirm"> 确定 </u-button> <u-button style="width: 40%" type="primary" :disabled="!isConfirmEnabled" @tap="handleConfirm"> 确定 </u-button>
</view> </view>
</view> </view>
</view> </view>
@@ -48,7 +42,7 @@ import { storeToRefs } from 'pinia'
import nx from '@/nx' import nx from '@/nx'
const dialogStore = nx.$store('company-dept') const dialogStore = nx.$store('company-dept')
const { companyList, selectedCompanyId, selectedDeptId } = storeToRefs(dialogStore) const { companyList, selectedCompanyId, selectedDeptId, showCancel } = storeToRefs(dialogStore)
const deptOptions = computed(() => dialogStore.getDeptsByCompanyId(selectedCompanyModel.value)) const deptOptions = computed(() => dialogStore.getDeptsByCompanyId(selectedCompanyModel.value))
@@ -189,7 +183,6 @@ const handleConfirm = () => {
&__footer { &__footer {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
gap: 12px;
margin-top: 24px; margin-top: 24px;
} }
} }

View File

@@ -2,6 +2,7 @@ import { defineStore } from 'pinia'
const defaultState = () => ({ const defaultState = () => ({
show: false, show: false,
showCancel: false,
title: '请选择当前业务办理归属的公司部门信息', title: '请选择当前业务办理归属的公司部门信息',
companyList: [], companyList: [],
selectedCompanyId: null, selectedCompanyId: null,
@@ -20,13 +21,15 @@ const companyDeptStore = defineStore({
onCancel = null, onCancel = null,
defaultCompanyId = null, defaultCompanyId = null,
defaultDeptId = null, defaultDeptId = null,
title = null title = null,
showCancel = false
}) { }) {
this.companyList = companyList this.companyList = companyList
this.onConfirm = onConfirm this.onConfirm = onConfirm
this.onCancel = onCancel this.onCancel = onCancel
this.title = title || '请选择当前业务办理归属的公司部门信息' this.title = title || '请选择当前业务办理归属的公司部门信息'
this.show = true this.show = true
this.showCancel = showCancel
this.selectedCompanyId = defaultCompanyId this.selectedCompanyId = defaultCompanyId
this.selectedDeptId = defaultDeptId this.selectedDeptId = defaultDeptId
if (!this.selectedCompanyId && this.companyList.length > 0) { if (!this.selectedCompanyId && this.companyList.length > 0) {

View File

@@ -74,6 +74,7 @@ const handleSelectCompany = () => {
companyList: companyList.value, companyList: companyList.value,
defaultCompanyId: selectedCompanyId.value, defaultCompanyId: selectedCompanyId.value,
defaultDeptId: selectedDeptId.value, defaultDeptId: selectedDeptId.value,
showCancel: true,
onConfirm: ({ companyId, deptId }) => { onConfirm: ({ companyId, deptId }) => {
const selectedCompany = companyList.value.find(company => company.companyId === selectedCompanyId.value) const selectedCompany = companyList.value.find(company => company.companyId === selectedCompanyId.value)
const selectedDept = selectedCompany?.depts.find(dept => dept.deptId === selectedDeptId.value) const selectedDept = selectedCompany?.depts.find(dept => dept.deptId === selectedDeptId.value)