| | |
| | | <div class="option"> |
| | | <div class="option-item" :style="[model.projectBlocking[blocking.CLOUDBLOCKINGCONFIGENABLE]!==1?'border:none' : '']"> |
| | | <span class="mr10">云端天气组飞设置</span> |
| | | <a-switch :checkedValue="'1'" :unCheckedValue="'2'" v-model:checked="model.projectBlocking[blocking.CLOUDBLOCKINGCONFIGENABLE]" /> |
| | | <a-switch :checkedValue="'1'" :unCheckedValue="'2'" v-model:checked="model.projectBlocking[blocking.CLOUDBLOCKINGCONFIGENABLE]" @change="changeEdit" /> |
| | | <div v-if="model.projectBlocking[blocking.CLOUDBLOCKINGCONFIGENABLE]==1"> |
| | | <p class="mt10 describe">当风速或雨量大于设置值时,将对机场的飞行器进行阻飞。</p> |
| | | </div> |
| | |
| | | </div> |
| | | <div class="option-item" v-if="model.projectBlocking[blocking.CLOUDBLOCKINGCONFIGENABLE]=='1'"> |
| | | <span class="mr10">天气预报</span> |
| | | <a-switch :checkedValue="'1'" :unCheckedValue="'2'" v-model:checked="model.projectBlocking[blocking.WEATHERREPORTENABLE]" /> |
| | | <a-switch :checkedValue="'1'" :unCheckedValue="'2'" @change="changeEdit" v-model:checked="model.projectBlocking[blocking.WEATHERREPORTENABLE]" /> |
| | | <p class="mt10 describe">天气阻飞将使用天气预报,同时也会使用机场风速计和雨量计数据。</p> |
| | | </div> |
| | | <div class="option-item-edit" v-if="model.projectBlocking[blocking.CLOUDBLOCKINGCONFIGENABLE]=='1'"> |
| | |
| | | import { weatherRules, FormWeather, rainSelect, WeatherEnum, } from './type' |
| | | import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface' |
| | | import Select from '/@/components/Search/Select.vue' |
| | | import { editProjectBlock } from '/@/api/project-page/index' |
| | | import { useVModel } from '/@/hooks/use-v-model' |
| | | import { message } from 'ant-design-vue' |
| | | interface FormState { |
| | | [FormWeather.WINDSPEEDREPORT]: number |
| | | [FormWeather.WINDSPEED]: number |
| | |
| | | required: true |
| | | }, |
| | | }) |
| | | const route = useRoute() |
| | | const emit = defineEmits(['update:modelValue']) |
| | | const model = useVModel(props, 'modelValue', emit) |
| | | const edit = ref(false) |
| | |
| | | const submit = () => { |
| | | weatherFormRef.value |
| | | .validate() |
| | | .then(() => { |
| | | .then(async () => { |
| | | edit.value = false |
| | | model.value.projectBlocking = { ...model.value.projectBlocking, ...FormWeatherModel.value } |
| | | if (route.query.id) { |
| | | const res = await editProjectBlock(model.value.projectBlocking) |
| | | if (res.code !== 5000) return message.error(res.message) |
| | | } |
| | | }) |
| | | .catch((error: ValidateErrorEntity<FormState>) => { |
| | | console.log('error', error) |
| | | }) |
| | | } |
| | | const changeEdit = async () => { |
| | | if (!route.query.id) return |
| | | model.value.projectBlocking = { ...model.value.projectBlocking, ...FormWeatherModel.value } |
| | | const res = await editProjectBlock(model.value.projectBlocking) |
| | | if (res.code !== 5000) return message.error(res.message) |
| | | } |
| | | const cancel = () => { |
| | | FormWeatherModel.value = model.value.projectBlocking |
| | | edit.value = false |