fix: 条件変更時に有効期限を変更していないのに勝手に更新される問題を修正
This commit is contained in:
parent
f1889d3c5b
commit
9b00b3556e
|
@ -56,6 +56,7 @@ const props = defineProps<{
|
||||||
expiresAt: string;
|
expiresAt: string;
|
||||||
forward: boolean;
|
forward: boolean;
|
||||||
expirationDate: string;
|
expirationDate: string;
|
||||||
|
beforeExpiresAt?: string;
|
||||||
}
|
}
|
||||||
editable: boolean;
|
editable: boolean;
|
||||||
data?: {
|
data?: {
|
||||||
|
@ -77,9 +78,6 @@ const emit = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
if (props.modelValue && props.editable) {
|
|
||||||
emit('update:modelValue', props.data ?? props.modelValue);
|
|
||||||
}
|
|
||||||
const data = props.data ?? props.modelValue ?? {
|
const data = props.data ?? props.modelValue ?? {
|
||||||
name: '',
|
name: '',
|
||||||
targetUserPattern: '',
|
targetUserPattern: '',
|
||||||
|
@ -93,6 +91,9 @@ const value = computed({
|
||||||
data[key] = '';
|
data[key] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (props.modelValue && props.editable) {
|
||||||
|
emit('update:modelValue', data);
|
||||||
|
}
|
||||||
return data as unknown as Exclude<NonNullType<typeof props.modelValue>, undefined>;
|
return data as unknown as Exclude<NonNullType<typeof props.modelValue>, undefined>;
|
||||||
},
|
},
|
||||||
set(updateValue) {
|
set(updateValue) {
|
||||||
|
@ -116,6 +117,11 @@ function renderExpirationDate(empty = false) {
|
||||||
|
|
||||||
watch(() => value.value.expirationDate, () => renderExpirationDate(), { immediate: true });
|
watch(() => value.value.expirationDate, () => renderExpirationDate(), { immediate: true });
|
||||||
watch(() => value.value.expiresAt, () => renderExpirationDate(true));
|
watch(() => value.value.expiresAt, () => renderExpirationDate(true));
|
||||||
|
watch(() => props.editable, () => {
|
||||||
|
if (props.editable) {
|
||||||
|
value.value.beforeExpiresAt = value.value.expiresAt;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
|
@ -123,6 +123,7 @@ let editingResolver = $ref<{
|
||||||
expiresAt: string;
|
expiresAt: string;
|
||||||
expirationDate: string;
|
expirationDate: string;
|
||||||
forward: boolean;
|
forward: boolean;
|
||||||
|
beforeExpiresAt?: string;
|
||||||
}>(defaultResolver);
|
}>(defaultResolver);
|
||||||
|
|
||||||
const pagination = {
|
const pagination = {
|
||||||
|
@ -155,7 +156,9 @@ function save(): void {
|
||||||
targetUserPattern: editingResolver.targetUserPattern || null,
|
targetUserPattern: editingResolver.targetUserPattern || null,
|
||||||
reporterPattern: editingResolver.reporterPattern || null,
|
reporterPattern: editingResolver.reporterPattern || null,
|
||||||
reportContentPattern: editingResolver.reportContentPattern || null,
|
reportContentPattern: editingResolver.reportContentPattern || null,
|
||||||
expiresAt: editingResolver.expiresAt,
|
...(editingResolver.beforeExpiresAt && editingResolver.beforeExpiresAt === editingResolver.expiresAt ? {} : {
|
||||||
|
expiresAt: editingResolver.expiresAt,
|
||||||
|
}),
|
||||||
forward: editingResolver.forward,
|
forward: editingResolver.forward,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
editableResolver = null;
|
editableResolver = null;
|
||||||
|
|
Loading…
Reference in New Issue