Commit 23b4a568 authored by shuiluo's avatar shuiluo

feat: acron组件国际化完善

parent 775f2127
......@@ -47,7 +47,6 @@ export default {
cron(val) {
console.log(replaceWeekName(val));
this.afterCron = replaceWeekName(val);
console.log(val);
this.$emit('input', val);
},
},
......
<template>
<a-modal
title="corn表达式"
:title="$t('corn.expression')"
:width="modalWidth"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleSubmit"
@cancel="close"
cancelText="关闭"
:cancelText="$t('corn.close')"
:getContainer="getContainer"
>
<div class="card-container">
<a-tabs type="card">
<a-tab-pane key="1" type="card">
<span slot="tab"> <a-icon type="schedule" /></span>
<span slot="tab"> <a-icon type="schedule" />{{ $t('corn.second') }}</span>
<a-radio-group v-model="result.second.cronEvery">
<a-row>
<a-radio value="1">每一秒钟</a-radio>
<a-radio value="1">{{ $t('corn.everySecond') }}</a-radio>
</a-row>
<a-row>
<a-radio value="2">
每隔
{{ $t('corn.everyOther') }}
<a-input-number
size="small"
v-model="result.second.incrementIncrement"
:min="1"
:max="60"
></a-input-number
>秒执行 从
/>秒执行 从
<a-input-number
size="small"
v-model="result.second.incrementStart"
:min="0"
:max="59"
></a-input-number
>秒开始
/>秒开始
</a-radio>
</a-row>
<a-row>
<a-radio value="3">具体秒数(可多选)</a-radio>
<a-select
style="width:354px;"
style="width: 354px"
size="small"
mode="multiple"
v-model="result.second.specificSpecific"
......@@ -99,7 +97,7 @@
<a-row>
<a-radio value="3">具体分钟数(可多选)</a-radio>
<a-select
style="width:340px;"
style="width: 340px"
size="small"
mode="multiple"
v-model="result.minute.specificSpecific"
......@@ -163,7 +161,7 @@
<a-row>
<a-radio class="long" value="3">具体小时数(可多选)</a-radio>
<a-select
style="width:340px;"
style="width: 340px"
size="small"
mode="multiple"
v-model="result.hour.specificSpecific"
......@@ -244,7 +242,7 @@
<a-row>
<a-radio class="long" value="4">具体星期几(可多选)</a-radio>
<a-select
style="width:340px;"
style="width: 340px"
size="small"
mode="multiple"
v-model="result.week.specificSpecific"
......@@ -260,7 +258,7 @@
<a-row>
<a-radio class="long" value="5">具体天数(可多选)</a-radio>
<a-select
style="width:354px;"
style="width: 354px"
size="small"
mode="multiple"
v-model="result.day.specificSpecific"
......@@ -368,7 +366,7 @@
<a-row>
<a-radio class="long" value="3">具体月数(可多选)</a-radio>
<a-select
style="width:354px;"
style="width: 354px"
size="small"
filterable
mode="multiple"
......@@ -433,7 +431,7 @@
<a-row>
<a-radio class="long" value="3">具体年份(可多选)</a-radio>
<a-select
style="width:354px;"
style="width: 354px"
size="small"
filterable
mode="multiple"
......@@ -476,6 +474,7 @@
</div>
</a-modal>
</template>
<script>
const now = new Date();
const curYear = now.getFullYear();
......@@ -488,7 +487,7 @@ export default {
visible: false,
confirmLoading: false,
size: 'large',
weekDays: ['', '', '', '', '', '', ''].map(val => '星期' + val),
weekDays: ['', '', '', '', '', '', ''].map((val) => '星期' + val),
result: {
second: {},
minute: {},
......@@ -577,7 +576,7 @@ export default {
seconds = this.result.second.incrementStart + '/' + this.result.second.incrementIncrement;
break;
case '3':
this.result.second.specificSpecific.map(val => {
this.result.second.specificSpecific.map((val) => {
seconds += val + ',';
});
seconds = seconds.slice(0, -1);
......@@ -599,7 +598,7 @@ export default {
minutes = this.result.minute.incrementStart + '/' + this.result.minute.incrementIncrement;
break;
case '3':
this.result.minute.specificSpecific.map(val => {
this.result.minute.specificSpecific.map((val) => {
minutes += val + ',';
});
minutes = minutes.slice(0, -1);
......@@ -621,7 +620,7 @@ export default {
hours = this.result.hour.incrementStart + '/' + this.result.hour.incrementIncrement;
break;
case '3':
this.result.hour.specificSpecific.map(val => {
this.result.hour.specificSpecific.map((val) => {
hours += val + ',';
});
hours = hours.slice(0, -1);
......@@ -647,7 +646,7 @@ export default {
days = this.result.day.incrementStart + '/' + this.result.day.incrementIncrement;
break;
case '5':
this.result.day.specificSpecific.map(val => {
this.result.day.specificSpecific.map((val) => {
days += val + ',';
});
days = days.slice(0, -1);
......@@ -683,7 +682,7 @@ export default {
weeks = this.result.week.incrementStart + '/' + this.result.week.incrementIncrement;
break;
case '4':
this.result.week.specificSpecific.map(val => {
this.result.week.specificSpecific.map((val) => {
weeks += val + ',';
});
weeks = weeks.slice(0, -1);
......@@ -712,7 +711,7 @@ export default {
months = this.result.month.incrementStart + '/' + this.result.month.incrementIncrement;
break;
case '3':
this.result.month.specificSpecific.map(val => {
this.result.month.specificSpecific.map((val) => {
months += val + ',';
});
months = months.slice(0, -1);
......@@ -734,7 +733,7 @@ export default {
years = this.result.year.incrementStart + '/' + this.result.year.incrementIncrement;
break;
case '3':
this.result.year.specificSpecific.map(val => {
this.result.year.specificSpecific.map((val) => {
years += val + ',';
});
years = years.slice(0, -1);
......@@ -746,9 +745,9 @@ export default {
return years;
},
cron() {
return `${this.secondsText || '*'} ${this.minutesText || '*'} ${this.hoursText || '*'} ${this
.daysText || '*'} ${this.monthsText || '*'} ${this.weeksText || '?'} ${this.yearsText ||
'*'}`;
return `${this.secondsText || '*'} ${this.minutesText || '*'} ${this.hoursText || '*'} ${
this.daysText || '*'
} ${this.monthsText || '*'} ${this.weeksText || '?'} ${this.yearsText || '*'}`;
},
},
watch: {
......@@ -826,10 +825,7 @@ export default {
break;
case val.includes(','):
second.cronEvery = '3';
second.specificSpecific = val
.split(',')
.map(Number)
.sort();
second.specificSpecific = val.split(',').map(Number).sort();
break;
case val.includes('-'):
second.cronEvery = '4';
......@@ -863,10 +859,7 @@ export default {
break;
case val.includes(','):
minute.cronEvery = '3';
minute.specificSpecific = val
.split(',')
.map(Number)
.sort();
minute.specificSpecific = val.split(',').map(Number).sort();
break;
case val.includes('-'):
minute.cronEvery = '4';
......@@ -900,10 +893,7 @@ export default {
break;
case val.includes(','):
hour.cronEvery = '3';
hour.specificSpecific = val
.split(',')
.map(Number)
.sort();
hour.specificSpecific = val.split(',').map(Number).sort();
break;
case val.includes('-'):
hour.cronEvery = '4';
......@@ -952,10 +942,7 @@ export default {
break;
case days.includes(','):
day.cronEvery = '5';
day.specificSpecific = days
.split(',')
.map(Number)
.sort();
day.specificSpecific = days.split(',').map(Number).sort();
break;
case days.includes('LW'):
day.cronEvery = '7';
......@@ -990,10 +977,7 @@ export default {
break;
case weeks.includes(','):
day.cronEvery = '4';
week.specificSpecific = weeks
.split(',')
.map(Number)
.sort();
week.specificSpecific = weeks.split(',').map(Number).sort();
break;
case weeks.includes('#'):
day.cronEvery = '11';
......@@ -1035,10 +1019,7 @@ export default {
break;
case months.includes(','):
month.cronEvery = '3';
month.specificSpecific = months
.split(',')
.map(Number)
.sort();
month.specificSpecific = months.split(',').map(Number).sort();
break;
case months.includes('-'):
month.cronEvery = '4';
......@@ -1073,10 +1054,7 @@ export default {
break;
case years.includes(','):
year.cronEvery = '3';
year.specificSpecific = years
.split(',')
.map(Number)
.sort();
year.specificSpecific = years.split(',').map(Number).sort();
break;
case years.includes('-'):
year.cronEvery = '4';
......
export default {
'corn.title': ['Cron 控件', 'Cron Component'],
'corn.expression': ['corn表达式', 'Corn Expression'],
'corn.close': ['关闭', 'Close'],
'corn.second': ['', 'second'],
'corn.everySecond': ['每一秒钟', 'Every Second'],
'corn.everyOther': ['每隔', 'Every Other'],
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment