Commit d5009288 by pangchong

feat(electronicBill): 优化过夜维护AF+PF开关交互及界面布局

- 为过夜维护AF+PF开关添加change事件,触发内部相关开关自动变更
- 调整一般勤务、例行检查和飞机放行的开关分组展示为AF与PF两个部分
- 相关开关的禁用规则修改为仅根据tr字段控制,不再受overnightAfPf影响
- 新增overnightPf系列字段及其初始赋值和重置逻辑,保证界面状态一致
- 添加switch-group和switch-item样式,优化多开关横向排列和标签样式
- 修改相关函数,确保过夜维护状态变更时对应各子开关同步更新
parent a367f18a
...@@ -114,28 +114,39 @@ ...@@ -114,28 +114,39 @@
<view class="mocp-title">过夜维护AF+PF</view> <view class="mocp-title">过夜维护AF+PF</view>
<view class="mocp-form"> <view class="mocp-form">
<up-form-item label="过夜维护AF+PF" prop="overnightAfPf" :borderBottom="true"> <up-form-item label="过夜维护AF+PF" prop="overnightAfPf" :borderBottom="true">
<global-switch v-model="formData.overnightAfPf" switchAlign="right"></global-switch> <global-switch v-model="formData.overnightAfPf" switchAlign="right" @change="changeOvernightAfPf"></global-switch>
</up-form-item> </up-form-item>
<up-form-item label="一般勤务" prop="overnightService" :borderBottom="true"> <up-form-item label="AF" :borderBottom="true">
<global-switch <view class="switch-group">
v-model="formData.overnightService" <view class="switch-item">
switchAlign="right" <text class="label">一般勤务</text>
:disabled="formData.tr == '1' || formData.overnightAfPf == '1'" <global-switch v-model="formData.overnightService" :disabled="formData.tr == '1'"></global-switch>
></global-switch> </view>
</up-form-item> <view class="switch-item">
<up-form-item label="例行检查" prop="overnightRoutineInspection" :borderBottom="true"> <text class="label">例行检查</text>
<global-switch <global-switch v-model="formData.overnightRoutineInspection" :disabled="formData.tr == '1'"></global-switch>
v-model="formData.overnightRoutineInspection" </view>
switchAlign="right" <view class="switch-item">
:disabled="formData.tr == '1' || formData.overnightAfPf == '1'" <text class="label">飞机放行</text>
></global-switch> <global-switch v-model="formData.overnightFlightRelease" :disabled="formData.tr == '1'"></global-switch>
</view>
</view>
</up-form-item> </up-form-item>
<up-form-item label="飞机放行" prop="overnightFlightRelease" :borderBottom="true"> <up-form-item label="PF" :borderBottom="true">
<global-switch <view class="switch-group">
v-model="formData.overnightFlightRelease" <view class="switch-item">
switchAlign="right" <text class="label">一般勤务</text>
:disabled="formData.tr == '1' || formData.overnightAfPf == '1'" <global-switch v-model="formData.overnightPfService" :disabled="formData.tr == '1'"></global-switch>
></global-switch> </view>
<view class="switch-item">
<text class="label">例行检查</text>
<global-switch v-model="formData.overnightPfRoutineInspection" :disabled="formData.tr == '1'"></global-switch>
</view>
<view class="switch-item">
<text class="label">飞机放行</text>
<global-switch v-model="formData.overnightPfFlightRelease" :disabled="formData.tr == '1'"></global-switch>
</view>
</view>
</up-form-item> </up-form-item>
</view> </view>
<view class="mocp-title">设备使用记录</view> <view class="mocp-title">设备使用记录</view>
...@@ -183,7 +194,7 @@ import useElectronicBillStore from 'mocp/store/electronicBill' ...@@ -183,7 +194,7 @@ import useElectronicBillStore from 'mocp/store/electronicBill'
import { formData, rules } from './constants/add.compositions' import { formData, rules } from './constants/add.compositions'
import { navigateTo } from 'mocp/utils/jump' import { navigateTo } from 'mocp/utils/jump'
import { onUnmounted, ref, watchEffect } from 'vue' import { onUnmounted, ref, watchEffect } from 'vue'
import { changeAcreg } from './constants/add.functionals' import { changeAcreg, changeOvernightAfPf } from './constants/add.functionals'
import { getTerminalSelect } from 'mocp/utils/permission' import { getTerminalSelect } from 'mocp/utils/permission'
import { resetData } from './constants/sign.functionals' import { resetData } from './constants/sign.functionals'
...@@ -205,15 +216,15 @@ watchEffect(() => { ...@@ -205,15 +216,15 @@ watchEffect(() => {
formData.overnightService = '0' formData.overnightService = '0'
formData.overnightRoutineInspection = '0' formData.overnightRoutineInspection = '0'
formData.overnightFlightRelease = '0' formData.overnightFlightRelease = '0'
formData.overnightPfService = '0'
formData.overnightPfRoutineInspection = '0'
formData.overnightPfFlightRelease = '0'
} }
if (formData.overnightAfPf == '1') { if (formData.overnightAfPf == '1') {
formData.tr = '0' formData.tr = '0'
formData.serviceTr = '0' formData.serviceTr = '0'
formData.routineInspection = '0' formData.routineInspection = '0'
formData.fly = '0' formData.fly = '0'
formData.overnightService = '0'
formData.overnightRoutineInspection = '0'
formData.overnightFlightRelease = '0'
} }
formData.legs = formData.legs1 + '-' + formData.legs2 + '-' + formData.legs3 formData.legs = formData.legs1 + '-' + formData.legs2 + '-' + formData.legs3
}) })
...@@ -231,4 +242,25 @@ onUnmounted(() => { ...@@ -231,4 +242,25 @@ onUnmounted(() => {
padding: 0 32rpx 24rpx 32rpx; padding: 0 32rpx 24rpx 32rpx;
background-color: $mocp-fill-1; background-color: $mocp-fill-1;
} }
.switch-group {
display: flex;
align-items: center;
justify-content: flex-end;
flex-wrap: nowrap;
width: 100%;
.switch-item {
display: flex;
align-items: center;
margin-left: 16rpx;
flex-shrink: 0;
.label {
margin-right: 8rpx;
font-size: 24rpx;
color: #666;
white-space: nowrap;
}
}
}
</style> </style>
...@@ -25,8 +25,6 @@ export const formData = reactive({ ...@@ -25,8 +25,6 @@ export const formData = reactive({
pf: '0', pf: '0',
remark: '', remark: '',
returnFlight: '0', returnFlight: '0',
serviceAf: '0',
servicePf: '0',
serviceTr: '0', serviceTr: '0',
overnightService: '0', overnightService: '0',
overnightRoutineInspection: '0', overnightRoutineInspection: '0',
...@@ -39,7 +37,10 @@ export const formData = reactive({ ...@@ -39,7 +37,10 @@ export const formData = reactive({
fly: '0', fly: '0',
overnightAfPf: '0', overnightAfPf: '0',
upLocation: '', upLocation: '',
downLocation: '' downLocation: '',
overnightPfService: '0',
overnightPfRoutineInspection: '0',
overnightPfFlightRelease: '0'
}) })
export const rules = reactive({ export const rules = reactive({
......
import { getAirlineAcregApi } from 'mocp/api/electronicBill' import { getAirlineAcregApi } from 'mocp/api/electronicBill'
import { formData } from './add.compositions' import { formData } from './add.compositions'
import { nextTick } from 'vue'
export const changeAcreg = async (acreg) => { export const changeAcreg = async (acreg) => {
if (!acreg) return if (!acreg) return
...@@ -18,3 +19,15 @@ export const changeAcreg = async (acreg) => { ...@@ -18,3 +19,15 @@ export const changeAcreg = async (acreg) => {
uni.$mocpMessage.error(res.message) uni.$mocpMessage.error(res.message)
} }
} }
export const changeOvernightAfPf = (value) => {
if (value == '1') {
nextTick(() => {
formData.overnightService = '1'
formData.overnightRoutineInspection = '1'
formData.overnightFlightRelease = '1'
formData.overnightPfService = '1'
formData.overnightPfRoutineInspection = '1'
formData.overnightPfFlightRelease = '1'
})
}
}
...@@ -100,8 +100,6 @@ export const resetData = () => { ...@@ -100,8 +100,6 @@ export const resetData = () => {
pf: '0', pf: '0',
remark: '', remark: '',
returnFlight: '0', returnFlight: '0',
serviceAf: '0',
servicePf: '0',
serviceTr: '0', serviceTr: '0',
overnightService: '0', overnightService: '0',
overnightRoutineInspection: '0', overnightRoutineInspection: '0',
...@@ -114,6 +112,9 @@ export const resetData = () => { ...@@ -114,6 +112,9 @@ export const resetData = () => {
fly: '0', fly: '0',
overnightAfPf: '0', overnightAfPf: '0',
upLocation: '', upLocation: '',
downLocation: '' downLocation: '',
overnightPfService: '0',
overnightPfRoutineInspection: '0',
overnightPfFlightRelease: '0'
}) })
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment