修改首页
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
@copy-version="onCopyVersion"
|
||||
@open-details="onOpenVersionDetails"
|
||||
@activate="onActivateVersion"
|
||||
@reschedule="onRescheduleVersion"
|
||||
@edit="onEditVersion"
|
||||
@remove="onRemoveVersion"
|
||||
/>
|
||||
@@ -38,7 +39,7 @@
|
||||
|
||||
<el-dialog
|
||||
v-model="activateVisible"
|
||||
:title="activateTitle"
|
||||
:title="activateDialogTitle"
|
||||
width="460px"
|
||||
append-to-body
|
||||
@closed="onActivateClosed"
|
||||
@@ -56,11 +57,11 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<div class="activate-hint">{{ activateHint }}</div>
|
||||
<div class="activate-hint">{{ activateDialogHint }}</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="activateVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="activateSubmitting" @click="submitActivate">确认启动</el-button>
|
||||
<el-button type="primary" :loading="activateSubmitting" @click="submitActivate">{{ activateConfirmText }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -130,27 +131,48 @@ function formatNow() {
|
||||
const activateVisible = ref(false)
|
||||
const activateSubmitting = ref(false)
|
||||
const activateFormRef = ref()
|
||||
const activateTitle = '启动版本'
|
||||
const activateMode = ref('activate')
|
||||
const activatePh = '请选择生效时间'
|
||||
const activateHint = '若生效时间晚于当前,版本将进入「待生效」;到时自动生效并使上一版本失效。'
|
||||
const activateForm = reactive({
|
||||
psvId: undefined,
|
||||
versionNo: '',
|
||||
effectiveTime: undefined
|
||||
})
|
||||
const activateDialogTitle = computed(() =>
|
||||
activateMode.value === 'reschedule' ? '修改生效时间' : '启动版本'
|
||||
)
|
||||
const activateConfirmText = computed(() =>
|
||||
activateMode.value === 'reschedule' ? '确认修改' : '确认启动'
|
||||
)
|
||||
const activateDialogHint = computed(() =>
|
||||
activateMode.value === 'reschedule'
|
||||
? '仅待生效版本可修改;若时间晚于当前仍为待生效,到时自动生效并使上一版本失效。'
|
||||
: '若生效时间晚于当前,版本将进入「待生效」;到时自动生效并使上一版本失效。'
|
||||
)
|
||||
const activateRules = {
|
||||
effectiveTime: [{ required: true, message: '请选择生效时间', trigger: 'change' }]
|
||||
}
|
||||
|
||||
function onActivateVersion(row) {
|
||||
if (!row || row.psvId == null) return
|
||||
activateMode.value = 'activate'
|
||||
activateForm.psvId = row.psvId
|
||||
activateForm.versionNo = row.versionNo || ''
|
||||
activateForm.effectiveTime = formatNow()
|
||||
activateVisible.value = true
|
||||
}
|
||||
|
||||
function onRescheduleVersion(row) {
|
||||
if (!row || row.psvId == null) return
|
||||
activateMode.value = 'reschedule'
|
||||
activateForm.psvId = row.psvId
|
||||
activateForm.versionNo = row.versionNo || ''
|
||||
activateForm.effectiveTime = row.effectiveTime || formatNow()
|
||||
activateVisible.value = true
|
||||
}
|
||||
|
||||
function onActivateClosed() {
|
||||
activateMode.value = 'activate'
|
||||
activateForm.psvId = undefined
|
||||
activateForm.versionNo = ''
|
||||
activateForm.effectiveTime = undefined
|
||||
@@ -165,7 +187,10 @@ function submitActivate() {
|
||||
.then(() => {
|
||||
const eff = activateForm.effectiveTime
|
||||
const pending = eff && new Date(eff.replace(/-/g, '/')).getTime() > Date.now()
|
||||
proxy.$modal.msgSuccess(pending ? '已设为待生效' : '版本已启动')
|
||||
const okMsg = activateMode.value === 'reschedule'
|
||||
? (pending ? '已更新为待生效' : '生效时间已更新,版本已生效')
|
||||
: (pending ? '已设为待生效' : '版本已启动')
|
||||
proxy.$modal.msgSuccess(okMsg)
|
||||
activateVisible.value = false
|
||||
load()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user