style:部门选择样式
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<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__header">
|
||||
<text class="company-dept-dialog__title">{{ dialogStore.title }}</text>
|
||||
@@ -12,10 +12,7 @@
|
||||
<uni-data-select
|
||||
v-model="selectedCompanyModel"
|
||||
:localdata="companyOptionsForSelect"
|
||||
collection=""
|
||||
field="companyName"
|
||||
orderby=""
|
||||
:clear-icon="false"
|
||||
:clear="false"
|
||||
@change="onCompanyChangeUni"
|
||||
/>
|
||||
</view>
|
||||
@@ -26,17 +23,14 @@
|
||||
<uni-data-select
|
||||
v-model="selectedDeptModel"
|
||||
:localdata="deptOptionsForSelect"
|
||||
collection=""
|
||||
field="deptName"
|
||||
orderby=""
|
||||
:clear-icon="false"
|
||||
:clear="false"
|
||||
@change="onDeptChangeUni"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="company-dept-dialog__footer">
|
||||
<u-button @tap="handleCancel">取消</u-button>
|
||||
<u-button type="primary" :disabled="!isConfirmEnabled" @tap="handleConfirm"> 确定 </u-button>
|
||||
<u-button v-if="showCancel" style="width: 40%" @tap="handleCancel">取消</u-button>
|
||||
<u-button style="width: 40%" type="primary" :disabled="!isConfirmEnabled" @tap="handleConfirm"> 确定 </u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -48,7 +42,7 @@ import { storeToRefs } from 'pinia'
|
||||
import nx from '@/nx'
|
||||
|
||||
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))
|
||||
|
||||
@@ -189,7 +183,6 @@ const handleConfirm = () => {
|
||||
&__footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { defineStore } from 'pinia'
|
||||
|
||||
const defaultState = () => ({
|
||||
show: false,
|
||||
showCancel: false,
|
||||
title: '请选择当前业务办理归属的公司部门信息',
|
||||
companyList: [],
|
||||
selectedCompanyId: null,
|
||||
@@ -20,13 +21,15 @@ const companyDeptStore = defineStore({
|
||||
onCancel = null,
|
||||
defaultCompanyId = null,
|
||||
defaultDeptId = null,
|
||||
title = null
|
||||
title = null,
|
||||
showCancel = false
|
||||
}) {
|
||||
this.companyList = companyList
|
||||
this.onConfirm = onConfirm
|
||||
this.onCancel = onCancel
|
||||
this.title = title || '请选择当前业务办理归属的公司部门信息'
|
||||
this.show = true
|
||||
this.showCancel = showCancel
|
||||
this.selectedCompanyId = defaultCompanyId
|
||||
this.selectedDeptId = defaultDeptId
|
||||
if (!this.selectedCompanyId && this.companyList.length > 0) {
|
||||
|
||||
@@ -74,6 +74,7 @@ const handleSelectCompany = () => {
|
||||
companyList: companyList.value,
|
||||
defaultCompanyId: selectedCompanyId.value,
|
||||
defaultDeptId: selectedDeptId.value,
|
||||
showCancel: true,
|
||||
onConfirm: ({ companyId, deptId }) => {
|
||||
const selectedCompany = companyList.value.find(company => company.companyId === selectedCompanyId.value)
|
||||
const selectedDept = selectedCompany?.depts.find(dept => dept.deptId === selectedDeptId.value)
|
||||
|
||||
Reference in New Issue
Block a user