refactor(项目管理): 同步需求设置开关影响频率设置显示

This commit is contained in:
guoyuqi 2024-09-13 11:05:57 +08:00 committed by Craftsman
parent 32a4465880
commit 98e046db5a
1 changed files with 12 additions and 1 deletions

View File

@ -46,6 +46,7 @@
unchecked-value="false"
size="small"
type="line"
@change="handleSwitchChange"
/>
<span class="ml-[8px] text-[var(--color-text-1)]">
{{ t('project.menu.updateSync') }}
@ -65,7 +66,7 @@
</a-tooltip>
</a-form-item>
<!-- 同步频率 -->
<a-form-item field="CRON_EXPRESSION" :label="t('project.menu.CRON_EXPRESSION')">
<a-form-item v-if="hasChange" field="CRON_EXPRESSION" :label="t('project.menu.CRON_EXPRESSION')">
<MsCronSelect v-model:model-value="form.CRON_EXPRESSION" />
</a-form-item>
</a-form>
@ -105,6 +106,7 @@
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { FormInstance, Message } from '@arco-design/web-vue';
import MsCronSelect from '@/components/pure/ms-cron-select/index.vue';
@ -149,6 +151,8 @@
CRON_EXPRESSION: '0 0 0 * * ?', //
});
const hasChange = ref(false);
const formCreateValue = ref<Record<string, any>>({});
const okDisabled = computed(() => !form.PLATFORM_KEY);
@ -237,6 +241,7 @@
// keychange
await handlePlatformChange(res.platform_key);
form.CASE_ENABLE = res.case_enable;
hasChange.value = res.sync_enable === 'true';
form.PLATFORM_KEY = res.platform_key;
form.SYNC_ENABLE = res.sync_enable;
form.CRON_EXPRESSION = res.cron_expression;
@ -262,6 +267,12 @@
setValue();
}
function handleSwitchChange(value: string | number | boolean) {
if (typeof value === 'string') {
hasChange.value = value === 'true';
}
}
watch(
() => props.visible,
(val) => {