i18n和夜晚模式
This commit is contained in:
@@ -99,6 +99,10 @@ const toastTitle = ref('操作成功')
|
||||
const toastText = ref('')
|
||||
const deleteConfirmOpen = ref(false)
|
||||
const pendingDeleteContractId = ref<string | null>(null)
|
||||
const messageDialogOpen = ref(false)
|
||||
const messageDialogTitle = ref('')
|
||||
const messageDialogDesc = ref('')
|
||||
const batchDeleteConfirmOpen = ref(false)
|
||||
const modalOffset = ref({ x: 0, y: 0 })
|
||||
let dragStartX = 0
|
||||
let dragStartY = 0
|
||||
@@ -186,6 +190,12 @@ const notify = (text: string) => {
|
||||
})
|
||||
}
|
||||
|
||||
const showMessageDialog = (title: string, description: string) => {
|
||||
messageDialogTitle.value = title
|
||||
messageDialogDesc.value = description
|
||||
messageDialogOpen.value = true
|
||||
}
|
||||
|
||||
const pendingDeleteContractName = computed(() => {
|
||||
if (!pendingDeleteContractId.value) return ''
|
||||
const target = contracts.value.find(item => item.id === pendingDeleteContractId.value)
|
||||
@@ -519,7 +529,7 @@ const initializeContractScaleData = async (contractId: string) => {
|
||||
|
||||
const exportSelectedContracts = async () => {
|
||||
if (selectedContractIds.value.length === 0) {
|
||||
window.alert('请先勾选至少一个合同段。')
|
||||
showMessageDialog('提示', '请先勾选至少一个合同段。')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -544,7 +554,7 @@ const exportSelectedContracts = async () => {
|
||||
|
||||
const projectIndustry = await getCurrentProjectIndustry()
|
||||
if (!projectIndustry) {
|
||||
window.alert('导出失败:未读取到当前项目工程行业,请先在“基础信息”里新建项目。')
|
||||
showMessageDialog('导出失败', '未读取到当前项目工程行业,请先在“基础信息”里新建项目。')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -583,7 +593,7 @@ const exportSelectedContracts = async () => {
|
||||
exitContractSelectionMode()
|
||||
} catch (error) {
|
||||
console.error('export selected contracts failed:', error)
|
||||
window.alert('导出失败,请重试。')
|
||||
showMessageDialog('导出失败', '请重试。')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -689,15 +699,16 @@ const importContractSegments = async (event: Event) => {
|
||||
const message = error instanceof Error ? error.message : ''
|
||||
if (message.startsWith('PROJECT_INDUSTRY_MISMATCH:')) {
|
||||
const [, importIndustry = '', currentIndustry = ''] = message.split(':')
|
||||
window.alert(
|
||||
`导入失败:工程行业不一致(导入包:${formatIndustryLabel(importIndustry)},当前项目:${formatIndustryLabel(currentIndustry)})。`
|
||||
showMessageDialog(
|
||||
'导入失败',
|
||||
`工程行业不一致(导入包:${formatIndustryLabel(importIndustry)},当前项目:${formatIndustryLabel(currentIndustry)})。`
|
||||
)
|
||||
} else if (message === 'CURRENT_PROJECT_INDUSTRY_MISSING') {
|
||||
window.alert('导入失败:当前项目未设置工程行业,请先在“基础信息”里新建项目。')
|
||||
showMessageDialog('导入失败', '当前项目未设置工程行业,请先在“基础信息”里新建项目。')
|
||||
} else if (message === 'IMPORT_PACKAGE_INDUSTRY_MISSING') {
|
||||
window.alert('导入失败:导入包缺少工程行业信息,请使用最新版本重新导出后再导入。')
|
||||
showMessageDialog('导入失败', '导入包缺少工程行业信息,请使用最新版本重新导出后再导入。')
|
||||
} else {
|
||||
window.alert('导入失败:文件无效、已损坏或不是合同段导出文件。')
|
||||
showMessageDialog('导入失败', '文件无效、已损坏或不是合同段导出文件。')
|
||||
}
|
||||
} finally {
|
||||
input.value = ''
|
||||
@@ -844,21 +855,27 @@ const deleteContract = async (id: string) => {
|
||||
|
||||
const deleteSelectedContracts = async () => {
|
||||
if (selectedContractIds.value.length === 0) {
|
||||
window.alert('请先勾选至少一个合同段。')
|
||||
showMessageDialog('提示', '请先勾选至少一个合同段。')
|
||||
return
|
||||
}
|
||||
|
||||
const selectedSet = new Set(selectedContractIds.value)
|
||||
const targets = contracts.value.filter(item => selectedSet.has(item.id))
|
||||
if (targets.length === 0) {
|
||||
window.alert('未找到可删除的合同段。')
|
||||
showMessageDialog('提示', '未找到可删除的合同段。')
|
||||
return
|
||||
}
|
||||
batchDeleteConfirmOpen.value = true
|
||||
}
|
||||
|
||||
const confirmed = window.confirm(
|
||||
`即将删除 ${targets.length} 个合同段及其关联咨询服务和计价数据,是否继续?`
|
||||
)
|
||||
if (!confirmed) return
|
||||
const confirmDeleteSelectedContracts = async () => {
|
||||
const selectedSet = new Set(selectedContractIds.value)
|
||||
const targets = contracts.value.filter(item => selectedSet.has(item.id))
|
||||
if (targets.length === 0) {
|
||||
batchDeleteConfirmOpen.value = false
|
||||
showMessageDialog('提示', '未找到可删除的合同段。')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const targetIds = targets.map(item => item.id)
|
||||
@@ -882,7 +899,9 @@ const deleteSelectedContracts = async () => {
|
||||
exitContractSelectionMode()
|
||||
} catch (error) {
|
||||
console.error('delete selected contracts failed:', error)
|
||||
window.alert('批量删除失败,请重试。')
|
||||
showMessageDialog('批量删除失败', '请重试。')
|
||||
} finally {
|
||||
batchDeleteConfirmOpen.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user