Revert "Internalisation"
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch, onMounted, onUnmounted } from 'vue'
|
||||
import { useI18n } from '../composables/useI18n'
|
||||
|
||||
|
||||
const { locale, setLocale, getTranslation ,t} = useI18n()
|
||||
|
||||
|
||||
interface Props {
|
||||
modelValue?: string | [string, string]
|
||||
@@ -73,10 +68,6 @@ const formatDisplayDate = (dateStr: string) => {
|
||||
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`
|
||||
}
|
||||
|
||||
const getMonth = (key: string): string => {
|
||||
return getTranslation(key)
|
||||
}
|
||||
|
||||
// 显示值
|
||||
const displayValue = computed(() => {
|
||||
if (props.type === 'daterange') {
|
||||
@@ -473,7 +464,6 @@ const yearList = computed(() => {
|
||||
return years
|
||||
})
|
||||
|
||||
/*
|
||||
// 月份名称
|
||||
const monthNames = [
|
||||
'一月',
|
||||
@@ -490,7 +480,6 @@ const monthNames = [
|
||||
'十二月',
|
||||
]
|
||||
const weekDays = ['日', '一', '二', '三', '四', '五', '六']
|
||||
*/
|
||||
|
||||
// 生命周期
|
||||
onMounted(() => {
|
||||
@@ -747,7 +736,7 @@ const panelStyle = computed(() => {
|
||||
<<
|
||||
</button>
|
||||
<span class="el-month-picker__header-label" @click="showYearSelector($event)">
|
||||
{{ currentYear }}
|
||||
{{ currentYear }}年
|
||||
</span>
|
||||
<button type="button" class="el-picker-panel__icon-btn" @click="nextYear">
|
||||
>>
|
||||
@@ -755,7 +744,7 @@ const panelStyle = computed(() => {
|
||||
</div>
|
||||
<div class="el-month-picker__content">
|
||||
<div
|
||||
v-for="(monthName, index) in t.monthNames"
|
||||
v-for="(monthName, index) in monthNames"
|
||||
:key="index"
|
||||
class="el-month-picker__item"
|
||||
:class="{ 'is-current': index === currentMonth }"
|
||||
@@ -777,10 +766,10 @@ const panelStyle = computed(() => {
|
||||
</button>
|
||||
<span class="el-date-picker__header-label">
|
||||
<span class="el-date-picker__header-year" @click="showYearSelector($event)">
|
||||
{{ currentYear }}
|
||||
{{ currentYear }}年
|
||||
</span>
|
||||
<span class="el-date-picker__header-month" @click="showMonthSelector($event)">
|
||||
{{ t.monthNames[currentMonth] }}
|
||||
{{ monthNames[currentMonth] }}
|
||||
</span>
|
||||
</span>
|
||||
<button type="button" class="el-picker-panel__icon-btn" @click="nextMonth">
|
||||
@@ -794,7 +783,7 @@ const panelStyle = computed(() => {
|
||||
<div class="el-date-picker__content">
|
||||
<!-- 星期标题 -->
|
||||
<div class="el-date-table__header">
|
||||
<div v-for="day in t.weekDays" :key="day" class="el-date-table__header-cell">
|
||||
<div v-for="day in weekDays" :key="day" class="el-date-table__header-cell">
|
||||
{{ day }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,13 +2,6 @@
|
||||
import { computed, ref, onUnmounted } from 'vue'
|
||||
import type { Milestone } from '../models/classes/Milestone'
|
||||
import { TimelineScale } from '../models/types/TimelineScale'
|
||||
import { useI18n } from '../composables/useI18n'
|
||||
|
||||
const { setLocale, getTranslation } = useI18n()
|
||||
|
||||
const t = (key: string): string => {
|
||||
return getTranslation(key)
|
||||
}
|
||||
|
||||
interface Props {
|
||||
date: string // 里程碑日期
|
||||
@@ -485,26 +478,26 @@ const handleMilestoneMouseLeave = () => {
|
||||
|
||||
// 格式化日期显示
|
||||
const formatDisplayDate = (dateStr: string): string => {
|
||||
if (!dateStr) return t('dateNotSet') //Not Set
|
||||
if (!dateStr) return '未设置'
|
||||
|
||||
try {
|
||||
const date = new Date(dateStr)
|
||||
if (isNaN(date.getTime())) return t('dateNotSet')
|
||||
if (isNaN(date.getTime())) return '未设置'
|
||||
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
} catch {
|
||||
return t('dateNotSet')
|
||||
return '未设置'
|
||||
}
|
||||
}
|
||||
|
||||
// Tooltip内容 Target date
|
||||
// Tooltip内容
|
||||
const tooltipContent = computed(() => {
|
||||
const milestoneName = props.name || props.milestone?.name || t('milestone')
|
||||
const milestoneName = props.name || props.milestone?.name || '里程碑'
|
||||
const targetDate = formatDisplayDate(props.date || props.milestone?.startDate || '')
|
||||
return `${t('milestone')}:${milestoneName} <br> ${t('targetDate')}:${targetDate}`
|
||||
return `里程碑:${milestoneName} - 目标日期:${targetDate}`
|
||||
})
|
||||
|
||||
// 组件销毁时清理事件监听器
|
||||
@@ -688,7 +681,8 @@ const calculateMilestonePositionFromTimelineData = (
|
||||
top: `${tooltipPosition.y}px`,
|
||||
}"
|
||||
>
|
||||
<div class="tooltip-content" v-html="tooltipContent">
|
||||
<div class="tooltip-content">
|
||||
{{ tooltipContent }}
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
|
||||
@@ -4,10 +4,6 @@ import type { Task } from '../models/classes/Task'
|
||||
import { TimelineScale } from '../models/types/TimelineScale'
|
||||
import TaskContextMenu from './TaskContextMenu.vue'
|
||||
|
||||
|
||||
import { useI18n } from '../composables/useI18n'
|
||||
|
||||
|
||||
interface Props {
|
||||
task: Task
|
||||
rowHeight: number
|
||||
@@ -35,12 +31,6 @@ interface Props {
|
||||
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const { setLocale, getTranslation } = useI18n()
|
||||
|
||||
const t = (key: string): string => {
|
||||
return getTranslation(key)
|
||||
}
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:task',
|
||||
'bar-mounted',
|
||||
@@ -843,9 +833,9 @@ const handleBubbleMouseDown = (event: MouseEvent) => {
|
||||
|
||||
// 格式化日期显示
|
||||
const formatDisplayDate = (dateStr: string | undefined): string => {
|
||||
if (!dateStr) return t('dateNotSet')
|
||||
if (!dateStr) return '未设置'
|
||||
const date = createLocalDate(dateStr)
|
||||
if (!date) return t('dateNotSet')
|
||||
if (!date) return '未设置'
|
||||
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
@@ -1130,23 +1120,23 @@ onUnmounted(() => {
|
||||
<div class="tooltip-title">{{ task.name }}</div>
|
||||
<div class="tooltip-content">
|
||||
<div class="tooltip-row">
|
||||
<span class="tooltip-label"> {{ t('startDate') }}:</span>
|
||||
<span class="tooltip-label">计划开始:</span>
|
||||
<span class="tooltip-value">{{ formatDisplayDate(task.startDate) }}</span>
|
||||
</div>
|
||||
<div class="tooltip-row">
|
||||
<span class="tooltip-label">{{ t('endDate') }}:</span>
|
||||
<span class="tooltip-label">计划结束:</span>
|
||||
<span class="tooltip-value">{{ formatDisplayDate(task.endDate) }}</span>
|
||||
</div>
|
||||
<div class="tooltip-row">
|
||||
<span class="tooltip-label">{{ t('estimatedHours') }}:</span>
|
||||
<span class="tooltip-label">计划工时:</span>
|
||||
<span class="tooltip-value">{{ workHourInfo.total }}h</span>
|
||||
</div>
|
||||
<div class="tooltip-row">
|
||||
<span class="tooltip-label"> {{ t('actualHours') }}:</span>
|
||||
<span class="tooltip-label">已用工时:</span>
|
||||
<span class="tooltip-value">{{ workHourInfo.used }}h</span>
|
||||
</div>
|
||||
<div class="tooltip-row">
|
||||
<span class="tooltip-label"> {{ t('progress') }}:</span>
|
||||
<span class="tooltip-label">完成率:</span>
|
||||
<span class="tooltip-value">{{ task.progress || 0 }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -713,15 +713,15 @@ function confirmTimer(desc: string) {
|
||||
<span v-if="errors.type" class="error-text">{{ errors.type }}</span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="task-assignee">{{ t.assignee }}</label>
|
||||
<select id="task-assignee" v-model="formData.assignee" class="form-select">
|
||||
<option value="">{{ t.selectAssignee }}</option>
|
||||
<!-- <option value="张三">张三</option>
|
||||
<option value="">{{ t.selectAssignee }}</option>
|
||||
<option value="张三">张三</option>
|
||||
<option value="李四">李四</option>
|
||||
<option value="王五">王五</option>
|
||||
<option value="赵六">赵六</option>
|
||||
<option value="钱七">钱七</option>-->
|
||||
<option value="钱七">钱七</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1620,7 +1620,7 @@ const handleAddSuccessor = (task: Task) => {
|
||||
class="timeline-year"
|
||||
:style="{ width: '719px' }"
|
||||
>
|
||||
<div class="year-label">{{ yearValue }}</div>
|
||||
<div class="year-label">{{ yearValue }}年</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user