Browse Source
* 1.repair [BUG]#884;2.Add Scheduling Time Fields to Workflow Instance List;3.Add a reminder for empty data 4.Delete the'babel-plugin-transform-remove-console'dependency package * 1.update logo 2.Workflow Definition Page Timing Component Replaced with Source Code * Repair bug #901,#909,#935pull/2/head
break60
5 years ago
committed by
qiaozhanwei
45 changed files with 2929 additions and 376 deletions
Before Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 8.4 KiB |
@ -0,0 +1,22 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
import vCrontab from './source/app.vue' |
||||
// import './source/index.scss'
|
||||
|
||||
export { |
||||
vCrontab |
||||
} |
@ -0,0 +1,39 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
/* eslint-disable */ |
||||
import _ from 'lodash' |
||||
import zh_CN from './locale/zh_CN' |
||||
import en_US from './locale/en_US' |
||||
|
||||
export function localeList () { |
||||
return [ |
||||
{ |
||||
code: 'zh_CN', |
||||
name: '中文', |
||||
locale: zh_CN |
||||
}, |
||||
{ |
||||
code: 'en_US', |
||||
name: 'English', |
||||
locale: en_US |
||||
} |
||||
] |
||||
} |
||||
|
||||
export function findLocale (code) { |
||||
return _.find(localeList(), ['code', code]) |
||||
} |
@ -0,0 +1,28 @@
|
||||
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
import { findLocale } from './config' |
||||
import { template } from './util' |
||||
|
||||
export default { |
||||
methods: { |
||||
$t (str, data) { |
||||
return template(findLocale(window.localeCrontab).locale[str], data) |
||||
} |
||||
} |
||||
} |
||||
|
@ -0,0 +1,76 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
export default { |
||||
'秒': 'second', |
||||
'分': 'minute', |
||||
'时': 'hour', |
||||
'天': 'day', |
||||
'月': 'month', |
||||
'年': 'year', |
||||
'星期一': 'Monday', |
||||
'星期二': 'Tuesday', |
||||
'星期三': 'Wednesday', |
||||
'星期四': 'Thursday', |
||||
'星期五': 'Friday', |
||||
'星期六': 'Saturday', |
||||
'星期天': 'Sunday', |
||||
'每一秒钟': 'Every second', |
||||
'每隔': 'Every', |
||||
'秒执行 从': 'second carried out', |
||||
'秒开始': 'Start', |
||||
'具体秒数(可多选)': 'Specific second(multiple)', |
||||
'请选择具体秒数': 'Please enter a specific second', |
||||
'周期从': 'Cycle from', |
||||
'到': 'to', |
||||
'每一分钟': 'Every minute', |
||||
'分执行 从': 'minute carried out', |
||||
'分开始': 'Start', |
||||
'具体分钟数(可多选)': 'Specific minute(multiple)', |
||||
'请选择具体分钟数': 'Please enter a specific minute', |
||||
'每一小时': 'Every hour', |
||||
'小时执行 从': 'hour carried out', |
||||
'小时开始': 'Start', |
||||
'具体小时数(可多选)': 'Specific hour(multiple)', |
||||
'请选择具体小时数': 'Please enter a hour', |
||||
'每一天': 'Every day', |
||||
'周执行 从': 'week carried out', |
||||
'开始': 'Start', |
||||
'天执行 从': 'day carried out', |
||||
'天开始': 'Start', |
||||
'具体星期几(可多选)': 'Specific day of the week(multiple)', |
||||
'请选择具体周几': 'Please enter a week', |
||||
'具体天数(可多选)': 'Specific days(multiple)', |
||||
'请选择具体天数': 'Please enter a days', |
||||
'在这个月的最后一天': 'On the last day of the month', |
||||
'在这个月的最后一个工作日': 'On the last working day of the month', |
||||
'在这个月的最后一个': 'At the last of this month', |
||||
'在本月底前': 'Before the end of this month', |
||||
'最近的工作日(周一至周五)至本月': 'The most recent business day (Monday to Friday) to this month', |
||||
'在这个月的第': 'In this months', |
||||
'每一月': 'Every month', |
||||
'月执行 从': 'month carried out', |
||||
'月开始': 'Start', |
||||
'具体月数(可多选)': 'Specific months(multiple)', |
||||
'请选择具体月数': 'Please enter a months', |
||||
'每一年': 'Every year', |
||||
'年执行 从': 'year carried out', |
||||
'年开始': 'Start', |
||||
'具体年数(可多选)': 'Specific year(multiple)', |
||||
'请选择具体年数': 'Please enter a year', |
||||
'小时': 'hour', |
||||
'日': 'day' |
||||
} |
@ -0,0 +1,76 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
export default { |
||||
'秒': '秒', |
||||
'分': '分', |
||||
'时': '时', |
||||
'天': '天', |
||||
'月': '月', |
||||
'年': '年', |
||||
'星期一': '星期一', |
||||
'星期二': '星期二', |
||||
'星期三': '星期三', |
||||
'星期四': '星期四', |
||||
'星期五': '星期五', |
||||
'星期六': '星期六', |
||||
'星期天': '星期天', |
||||
'每一秒钟': '每一秒钟', |
||||
'每隔': '每隔', |
||||
'秒执行 从': '秒执行 从', |
||||
'秒开始': '秒开始', |
||||
'具体秒数(可多选)': '具体秒数(可多选)', |
||||
'请选择具体秒数': '请选择具体秒数', |
||||
'周期从': '周期从', |
||||
'到': '到', |
||||
'每一分钟': '每一分钟', |
||||
'分执行 从': '分执行 从', |
||||
'分开始': '分开始', |
||||
'具体分钟数(可多选)': '具体分钟数(可多选)', |
||||
'请选择具体分钟数': '请选择具体分钟数', |
||||
'每一小时': '每一小时', |
||||
'小时执行 从': '小时执行 从', |
||||
'小时开始': '小时开始', |
||||
'具体小时数(可多选)': '具体小时数(可多选)', |
||||
'请选择具体小时数': '请选择具体小时数', |
||||
'每一天': '每一天', |
||||
'周执行 从': '周执行 从', |
||||
'开始': '开始', |
||||
'天执行 从': '天执行 从', |
||||
'天开始': '天开始', |
||||
'具体星期几(可多选)': '具体星期几(可多选)', |
||||
'请选择具体周几': '请选择具体周几', |
||||
'具体天数(可多选)': '具体天数(可多选)', |
||||
'请选择具体天数': '请选择具体天数', |
||||
'在这个月的最后一天': '在这个月的最后一天', |
||||
'在这个月的最后一个工作日': '在这个月的最后一个工作日', |
||||
'在这个月的最后一个': '在这个月的最后一个', |
||||
'在本月底前': '在本月底前', |
||||
'最近的工作日(周一至周五)至本月': '最近的工作日(周一至周五)至本月', |
||||
'在这个月的第': '在这个月的第', |
||||
'每一月': '每一月', |
||||
'月执行 从': '月执行 从', |
||||
'月开始': '月开始', |
||||
'具体月数(可多选)': '具体月数(可多选)', |
||||
'请选择具体月数': '请选择具体月数', |
||||
'每一年': '每一年', |
||||
'年执行 从': '年执行 从', |
||||
'年开始': '年开始', |
||||
'具体年数(可多选)': '具体年数(可多选)', |
||||
'请选择具体年数': '请选择具体年数', |
||||
'小时': '小时', |
||||
'日': '日' |
||||
} |
@ -0,0 +1,50 @@
|
||||
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
/** |
||||
* template |
||||
* |
||||
* @param {String} string |
||||
* @param {Array} ...args |
||||
* @return {String} |
||||
*/ |
||||
const { hasOwnProperty } = {} |
||||
const RE_NARGS = /(%|)\{([0-9a-zA-Z_]+)\}/g |
||||
const hasOwn = (o, k) => hasOwnProperty.call(o, k) |
||||
const template = (string, ...args) => { |
||||
if (args.length === 1 && typeof args[0] === 'object') { |
||||
args = args[0] |
||||
} |
||||
if (!args || !args.hasOwnProperty) { |
||||
args = {} |
||||
} |
||||
return string.replace(RE_NARGS, (match, prefix, i, index) => { |
||||
let result |
||||
if (string[index - 1] === '{' && |
||||
string[index + match.length] === '}') { |
||||
return i |
||||
} else { |
||||
result = hasOwn(args, i) ? args[i] : null |
||||
if (result === null || result === undefined) { |
||||
return '' |
||||
} |
||||
return result |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export { template } |
@ -0,0 +1,521 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<div class="day-model"> |
||||
<div class="v-crontab-from-model"> |
||||
<x-radio-group v-model="radioDay" vertical> |
||||
<div class="list-box"> |
||||
<x-radio label="everyDay"> |
||||
<span class="text">{{$t('每一天')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="WkintervalWeek"> |
||||
<span class="text">{{$t('每隔')}}</span> |
||||
<m-input-number :min="0" :max="7" :props-value="parseInt(WkintervalWeekPerformVal)" @on-number="onWkintervalWeekPerform"></m-input-number> |
||||
<span class="text">{{$t('天执行 从')}}</span> |
||||
<x-select :placeholder="$t('请选择具体小时数')" style="width: 200px" v-model="WkintervalWeekStartVal"> |
||||
<x-option |
||||
v-for="item in selectWeekList" |
||||
:key="item.value" |
||||
:value="item.value" |
||||
:label="item.label"> |
||||
</x-option> |
||||
</x-select> |
||||
<span class="text">{{$t('开始')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="intervalDay"> |
||||
<span class="text">{{$t('每隔')}}</span> |
||||
<m-input-number :min="0" :max="31" :props-value="parseInt(intervalDayPerformVal)" @on-number="onIntervalDayPerform"></m-input-number> |
||||
<span class="text">{{$t('天执行 从')}}</span> |
||||
<m-input-number :min="1" :max="31" :props-value="parseInt(intervalDayStartVal)" @on-number="onIntervalDayStart"></m-input-number> |
||||
<span class="text">{{$t('天开始')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="WkspecificWeek"> |
||||
<!--<span class="text">(周)</span>--> |
||||
<span class="text">{{$t('具体星期几(可多选)')}}</span> |
||||
<x-select multiple :placeholder="$t('请选择具体周几')" v-model="WkspecificWeekVal"> |
||||
<x-option |
||||
v-for="item in selectSpecificWeekList" |
||||
:key="item.value" |
||||
:value="item.value" |
||||
:label="item.label"> |
||||
</x-option> |
||||
</x-select> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="specificDay"> |
||||
<span class="text">{{$t('具体天数(可多选)')}}</span> |
||||
<x-select multiple :placeholder="$t('请选择具体天数')" v-model="WkspecificDayVal"> |
||||
<x-option |
||||
v-for="item in selectSpecificDayList" |
||||
:key="item.value" |
||||
:value="item.value" |
||||
:label="item.label"> |
||||
</x-option> |
||||
</x-select> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="monthLastDays"> |
||||
<span class="text">{{$t('在这个月的最后一天')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="monthLastWorkingDays"> |
||||
<span class="text">{{$t('在这个月的最后一个工作日')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="monthLastWeeks"> |
||||
<span class="text">{{$t('在这个月的最后一个')}}</span> |
||||
<x-select :placeholder="$t('请选择具体周几')" v-model="monthLastWeeksVal"> |
||||
<x-option |
||||
v-for="item in monthLastWeeksList" |
||||
:key="item.value" |
||||
:value="item.value" |
||||
:label="item.label"> |
||||
</x-option> |
||||
</x-select> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="monthTailBefore"> |
||||
<m-input-number :min="0" :max="31" :props-value="parseInt(monthTailBeforeVal)" @on-number="onMonthTailBefore"></m-input-number> |
||||
<span class="text">{{$t('在本月底前')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="recentlyWorkingDaysMonth"> |
||||
<span class="text">{{$t('最近的工作日(周一至周五)至本月')}}</span> |
||||
<m-input-number :min="0" :max="31" :props-value="parseInt(recentlyWorkingDaysMonthVal)" @on-number="onRecentlyWorkingDaysMonth"></m-input-number> |
||||
<span class="text">{{$t('日')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="WkmonthNumWeeks"> |
||||
<!--<span class="text">(周)</span>--> |
||||
<span class="text">{{$t('在这个月的第')}}</span> |
||||
<m-input-number :min="0" :max="31" :props-value="parseInt(WkmonthNumWeeksDayVal)" @on-number="onWkmonthNumWeeksDay"></m-input-number> |
||||
<x-select :placeholder="$t('请选择具体周几')" style="width: 200px" v-model="WkmonthNumWeeksWeekVal"> |
||||
<x-option |
||||
v-for="item in WkmonthNumWeeksWeekList" |
||||
:key="item.value" |
||||
:value="item.value" |
||||
:label="item.label"> |
||||
</x-option> |
||||
</x-select> |
||||
</x-radio> |
||||
</div> |
||||
</x-radio-group> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import i18n from '../_source/i18n' |
||||
import { selectList, isStr, isWeek } from '../util/index' |
||||
import mInputNumber from '../_source/input-number' |
||||
|
||||
export default { |
||||
name: 'day', |
||||
mixins: [i18n], |
||||
data () { |
||||
return { |
||||
radioDay: 'everyDay', |
||||
dayValue: '*', |
||||
weekValue: '?', |
||||
everyDayVal: '*', |
||||
WkintervalWeekPerformVal: 2, // 每隔几天执行 |
||||
WkintervalWeekStartVal: 2, // 从周几开始 |
||||
selectWeekList: _.map(_.cloneDeep(selectList['week']), v => { |
||||
return { |
||||
value: v.value, |
||||
label: `${this.$t(v.label)}` |
||||
} |
||||
}), |
||||
intervalDayPerformVal: 1, // 每隔天执行 |
||||
intervalDayStartVal: 1, // 从第几天开始 |
||||
WkspecificWeekVal: [], // 具体星期几 |
||||
selectSpecificWeekList: selectList['specificWeek'], |
||||
WkspecificDayVal: [], // 具体星期几 |
||||
selectSpecificDayList: selectList['day'], |
||||
monthLastDaysVal: 'L', |
||||
monthLastWorkingDays: 'LW', |
||||
monthLastWeeksVal: '1L', |
||||
monthLastWeeksList: _.map(_.cloneDeep(selectList['lastWeeks']), v => { |
||||
return { |
||||
value: v.value, |
||||
label: `${this.$t(v.label)}` |
||||
} |
||||
}), |
||||
monthTailBeforeVal: 1, |
||||
recentlyWorkingDaysMonthVal: 1, |
||||
WkmonthNumWeeksDayVal: 1, |
||||
WkmonthNumWeeksWeekVal: 1, |
||||
WkmonthNumWeeksWeekList: _.map(_.cloneDeep(selectList['week']), v => { |
||||
return { |
||||
value: v.value, |
||||
label: `${this.$t(v.label)}` |
||||
} |
||||
}) |
||||
} |
||||
}, |
||||
props: { |
||||
dayVal: String, |
||||
weekVal: String |
||||
}, |
||||
methods: { |
||||
// 每隔几周执行 |
||||
onWkintervalWeekPerform (val) { |
||||
this.WkintervalWeekPerformVal = val |
||||
if (this.radioDay === 'WkintervalWeek') { |
||||
this.dayValue = `?` |
||||
this.weekValue = `${this.WkintervalWeekStartVal}/${this.WkintervalWeekPerformVal}` |
||||
} |
||||
}, |
||||
// 每隔天执行 |
||||
onIntervalDayPerform (val) { |
||||
this.intervalDayPerformVal = val |
||||
if (this.radioDay === 'intervalDay') { |
||||
this.dayValue = `${this.intervalDayStartVal}/${this.intervalDayPerformVal}` |
||||
} |
||||
}, |
||||
// 从第天周开始 |
||||
onIntervalDayStart (val) { |
||||
this.intervalDayStartVal = val |
||||
if (this.radioDay === 'intervalDay') { |
||||
this.dayValue = `${this.intervalDayStartVal}/${this.intervalDayPerformVal}` |
||||
} |
||||
}, |
||||
// 在本月底前 |
||||
onMonthTailBefore (val) { |
||||
this.monthTailBeforeVal = val |
||||
if (this.radioDay === 'monthTailBefore') { |
||||
this.dayValue = `L-${this.monthTailBeforeVal}` |
||||
} |
||||
}, |
||||
// 最近工作日 |
||||
onRecentlyWorkingDaysMonth (val) { |
||||
this.recentlyWorkingDaysMonthVal = val |
||||
if (this.radioDay === 'recentlyWorkingDaysMonth') { |
||||
this.dayValue = `${this.recentlyWorkingDaysMonthVal}W` |
||||
} |
||||
}, |
||||
// 在这个月的天 |
||||
onWkmonthNumWeeksDay (val) { |
||||
this.WkmonthNumWeeksDayVal = val |
||||
this.weekValue = `${this.WkmonthNumWeeksWeekVal}#${this.WkmonthNumWeeksDayVal}` |
||||
}, |
||||
|
||||
// 重置每一天 |
||||
everyDayReset () { |
||||
this.dayValue = _.cloneDeep(this.everyDayVal) |
||||
}, |
||||
// 重置间隔周 从*开始 |
||||
WkintervalWeekReset () { |
||||
this.weekValue = `${this.WkintervalWeekStartVal}/${this.WkintervalWeekPerformVal}` |
||||
}, |
||||
// 重置间隔天 从*开始 |
||||
intervalDayReset () { |
||||
this.dayValue = `${this.intervalDayStartVal}/${this.intervalDayPerformVal}` |
||||
}, |
||||
// 具体周(多选) |
||||
WkspecificWeekReset () { |
||||
this.weekValue = this.WkspecificWeekVal.length ? this.WkspecificWeekVal.join(',') : '*' |
||||
}, |
||||
// 具体天数(多选) |
||||
specificDayReset () { |
||||
this.dayValue = this.WkspecificDayVal.length ? this.WkspecificDayVal.join(',') : '*' |
||||
}, |
||||
// 在这个月的最后一天 |
||||
monthLastDaysReset () { |
||||
this.dayValue = _.cloneDeep(this.monthLastDaysVal) |
||||
}, |
||||
// 在这个月的最后一个工作日 |
||||
monthLastWorkingDaysReset () { |
||||
this.dayValue = _.cloneDeep(this.monthLastWorkingDays) |
||||
}, |
||||
// 在这个月的最后一个* |
||||
monthLastWeeksReset () { |
||||
this.dayValue = _.cloneDeep(this.monthLastWeeksVal) |
||||
}, |
||||
// 在本月底前 |
||||
monthTailBeforeReset () { |
||||
this.dayValue = `L-${this.monthTailBeforeVal}` |
||||
}, |
||||
// 最近的工作日(周一至周五)至本月 |
||||
recentlyWorkingDaysMonthReset () { |
||||
this.dayValue = `${this.recentlyWorkingDaysMonthVal}W` |
||||
}, |
||||
// 在这个月的第 |
||||
WkmonthNumReset () { |
||||
this.weekValue = `${this.WkmonthNumWeeksWeekVal}#${this.WkmonthNumWeeksDayVal}` |
||||
} |
||||
}, |
||||
watch: { |
||||
dayValue (val) { |
||||
this.$emit('on-day-value', val) |
||||
// console.log('dayValue=> ' + val) |
||||
}, |
||||
weekValue (val) { |
||||
this.$emit('on-week-value', val) |
||||
// console.log('weekValue=> ' + val) |
||||
}, |
||||
// 选中类型 |
||||
radioDay (val) { |
||||
switch (val) { |
||||
case 'everyDay': |
||||
this.weekValue = '?' |
||||
this.everyDayReset() |
||||
break |
||||
case 'WkintervalWeek': |
||||
this.dayValue = '?' |
||||
this.WkintervalWeekReset() |
||||
break |
||||
case 'intervalDay': |
||||
this.weekValue = '?' |
||||
this.intervalDayReset() |
||||
break |
||||
case 'WkspecificWeek': |
||||
this.dayValue = '?' |
||||
this.WkspecificWeekReset() |
||||
break |
||||
case 'specificDay': |
||||
this.weekValue = '?' |
||||
this.specificDayReset() |
||||
break |
||||
case 'monthLastDays': |
||||
this.weekValue = '?' |
||||
this.monthLastDaysReset() |
||||
break |
||||
case 'monthLastWorkingDays': |
||||
this.weekValue = '?' |
||||
this.monthLastWorkingDaysReset() |
||||
break |
||||
case 'monthLastWeeks': |
||||
this.weekValue = '?' |
||||
this.monthLastWeeksReset() |
||||
break |
||||
case 'monthTailBefore': |
||||
this.weekValue = '?' |
||||
this.monthTailBeforeReset() |
||||
break |
||||
case 'recentlyWorkingDaysMonth': |
||||
this.weekValue = '?' |
||||
this.recentlyWorkingDaysMonthReset() |
||||
break |
||||
case 'WkmonthNumWeeks': |
||||
this.dayValue = '?' |
||||
this.WkmonthNumReset() |
||||
break |
||||
} |
||||
}, |
||||
WkintervalWeekStartVal (val) { |
||||
if (this.radioDay === 'WkintervalWeek') { |
||||
this.dayValue = `?` |
||||
this.weekValue = `${val}/${this.WkintervalWeekPerformVal}` |
||||
} |
||||
}, |
||||
// 具体星期几(多选) |
||||
WkspecificWeekVal (val) { |
||||
if (this.radioDay === 'WkspecificWeek') { |
||||
this.dayValue = `?` |
||||
this.weekValue = val.join(',') |
||||
} |
||||
}, |
||||
// 具体天数(多选) |
||||
WkspecificDayVal (val) { |
||||
if (this.radioDay === 'specificDay') { |
||||
this.weekValue = `?` |
||||
this.dayValue = val.join(',') |
||||
} |
||||
}, |
||||
monthLastWeeksVal (val) { |
||||
if (this.radioDay === 'monthLastWeeks') { |
||||
this.weekValue = `?` |
||||
this.dayValue = val |
||||
} |
||||
}, |
||||
WkmonthNumWeeksWeekVal (val) { |
||||
if (this.radioDay === 'WkmonthNumWeeks') { |
||||
this.dayValue = `?` |
||||
this.weekValue = `${val}#${this.WkmonthNumWeeksDayVal}` |
||||
} |
||||
} |
||||
}, |
||||
beforeCreate () { |
||||
}, |
||||
created () { |
||||
let $dayVal = _.cloneDeep(this.dayVal) |
||||
let $weekVal = _.cloneDeep(this.weekVal) |
||||
let isWeek1 = $weekVal.indexOf('/') !== -1 |
||||
let isWeek2 = $weekVal.indexOf('#') !== -1 |
||||
|
||||
// 初始化 |
||||
if ($dayVal === '*' && $weekVal === '?') { |
||||
console.log('初始化') |
||||
this.radioDay = 'everyDay' |
||||
return |
||||
} |
||||
|
||||
// 周 |
||||
if (isWeek1 || isWeek2 || isWeek($weekVal)) { |
||||
this.dayValue = `?` |
||||
|
||||
/** |
||||
* 按顺序标序号处理(除去天) |
||||
* @param [ |
||||
* WkintervalWeek=>(/), |
||||
* WkspecificWeek=>(TUE,WED), |
||||
* WkmonthNumWeeks=>(#) |
||||
* ] |
||||
*/ |
||||
let hanleWeekOne = () => { |
||||
console.log('1/3') |
||||
let a = isStr($weekVal, '/') |
||||
this.WkintervalWeekStartVal = parseInt(a[0]) |
||||
this.WkintervalWeekPerformVal = parseInt(a[1]) |
||||
this.dayValue = `?` |
||||
this.weekValue = `${this.WkintervalWeekPerformVal}/${this.WkintervalWeekStartVal}` |
||||
this.radioDay = 'WkintervalWeek' |
||||
} |
||||
|
||||
let hanleWeekTwo = () => { |
||||
console.log('TUE,WED') |
||||
this.WkspecificWeekVal = $weekVal.split(',') |
||||
this.radioDay = 'WkspecificWeek' |
||||
} |
||||
|
||||
let hanleWeekThree = () => { |
||||
console.log('6#5') |
||||
let a = isStr($weekVal, '#') |
||||
this.WkmonthNumWeeksWeekVal = parseInt(a[0]) |
||||
this.WkmonthNumWeeksDayVal = parseInt(a[1]) |
||||
this.radioDay = 'WkmonthNumWeeks' |
||||
} |
||||
|
||||
// 处理周 |
||||
if (isStr($weekVal, '/')) { |
||||
hanleWeekOne() |
||||
} else if (isStr($weekVal, '#')) { |
||||
hanleWeekThree() |
||||
} else if (isWeek($weekVal)) { |
||||
hanleWeekTwo() |
||||
} |
||||
} else { |
||||
this.weekValue = `?` |
||||
|
||||
/** |
||||
* 按顺序标序号处理(除去周) |
||||
* @param [ |
||||
* everyDay=>(*), |
||||
* intervalDay=>(1/1), |
||||
* specificDay=>(1,2,5,3,4), |
||||
* monthLastDays=>(L), |
||||
* monthLastWorkingDays=>(LW), |
||||
* monthLastWeeks=>(3L), |
||||
* monthTailBefore=>(L-4), |
||||
* recentlyWorkingDaysMonth=>(6W) |
||||
* ] |
||||
*/ |
||||
const hanleDayOne = () => { |
||||
console.log('*') |
||||
} |
||||
const hanleDayTwo = () => { |
||||
console.log('1/1') |
||||
let a = isStr($dayVal, '/') |
||||
this.intervalDayStartVal = parseInt(a[0]) |
||||
this.intervalDayPerformVal = parseInt(a[1]) |
||||
this.radioDay = 'intervalDay' |
||||
} |
||||
const hanleDayThree = () => { |
||||
console.log('1,2,5,3,4') |
||||
this.WkspecificDayVal = $dayVal.split(',') |
||||
this.radioDay = 'specificDay' |
||||
} |
||||
const hanleDayFour = () => { |
||||
console.log('L') |
||||
this.radioDay = 'monthLastDays' |
||||
} |
||||
const hanleDayFive = () => { |
||||
console.log('LW') |
||||
this.radioDay = 'monthLastWorkingDays' |
||||
} |
||||
const hanleDaySix = () => { |
||||
console.log('3L') |
||||
this.monthLastWeeksVal = $dayVal |
||||
this.radioDay = 'monthLastWeeks' |
||||
} |
||||
const hanleDaySeven = () => { |
||||
console.log('L-4') |
||||
let a = isStr($dayVal, '-') |
||||
this.monthTailBeforeVal = parseInt(a[1]) |
||||
this.radioDay = 'monthTailBefore' |
||||
} |
||||
const hanleDayEight = () => { |
||||
console.log('6W') |
||||
this.recentlyWorkingDaysMonthVal = parseInt($dayVal.slice(0, $dayVal.length - 1)) |
||||
this.radioDay = 'recentlyWorkingDaysMonth' |
||||
} |
||||
if ($dayVal === '*') { |
||||
hanleDayOne() |
||||
} else if (isStr($dayVal, '/')) { |
||||
hanleDayTwo() |
||||
} else if ($dayVal === 'L') { |
||||
hanleDayFour() |
||||
} else if ($dayVal === 'LW') { |
||||
hanleDayFive() |
||||
} else if ($dayVal.charAt($dayVal.length - 1) === 'L') { |
||||
hanleDaySix() |
||||
} else if (isStr($dayVal, '-')) { |
||||
hanleDaySeven() |
||||
} else if ($dayVal.charAt($dayVal.length - 1) === 'W') { |
||||
hanleDayEight() |
||||
} else { |
||||
hanleDayThree() |
||||
} |
||||
} |
||||
}, |
||||
beforeMount () { |
||||
}, |
||||
mounted () { |
||||
|
||||
}, |
||||
beforeUpdate () { |
||||
}, |
||||
updated () { |
||||
}, |
||||
beforeDestroy () { |
||||
}, |
||||
destroyed () { |
||||
}, |
||||
computed: {}, |
||||
components: { mInputNumber } |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" rel="stylesheet/scss"> |
||||
.day-model { |
||||
|
||||
} |
||||
</style> |
@ -0,0 +1,255 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<div class="hour-model"> |
||||
<div class="v-crontab-from-model"> |
||||
<x-radio-group v-model="radioHour" vertical> |
||||
<div class="list-box"> |
||||
<x-radio label="everyHour"> |
||||
<span class="text">{{$t('每一小时')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="intervalHour"> |
||||
<span class="text">{{$t('每隔')}}</span> |
||||
<m-input-number :min="0" :max="23" :props-value="parseInt(intervalPerformVal)" @on-number="onIntervalPerform"></m-input-number> |
||||
<span class="text">{{$t('小时执行 从')}}</span> |
||||
<m-input-number :min="0" :max="23" :props-value="parseInt(intervalStartVal)" @on-number="onIntervalStart"></m-input-number> |
||||
<span class="text">{{$t('小时开始')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="specificHour"> |
||||
<span class="text">{{$t('具体小时数(可多选)')}}</span> |
||||
<x-select multiple :placeholder="$t('请选择具体小时数')" v-model="specificHoursVal" @on-change="onspecificHours"> |
||||
<x-option |
||||
v-for="item in selectHourList" |
||||
:key="item.value" |
||||
:value="item.value" |
||||
:label="item.label"> |
||||
</x-option> |
||||
</x-select> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="cycleHour"> |
||||
<span class="text">{{$t('周期从')}}</span> |
||||
<m-input-number :min="0" :max="23" :props-value="parseInt(cycleStartVal)" @on-number="onCycleStart"></m-input-number> |
||||
<span class="text">{{$t('到')}}</span> |
||||
<m-input-number :min="0" :max="23" :props-value="parseInt(cycleEndVal)" @on-number="onCycleEnd"></m-input-number> |
||||
<span class="text">{{$t('小时')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
</x-radio-group> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import i18n from '../_source/i18n' |
||||
import { selectList, isStr } from '../util/index' |
||||
import mInputNumber from '../_source/input-number' |
||||
|
||||
export default { |
||||
name: 'hour', |
||||
mixins: [i18n], |
||||
data () { |
||||
return { |
||||
hourValue: '*', |
||||
radioHour: 'everyHour', |
||||
selectHourList: selectList['24'], |
||||
intervalPerformVal: 5, |
||||
intervalStartVal: 3, |
||||
specificHoursVal: [], |
||||
cycleStartVal: 1, |
||||
cycleEndVal: 1 |
||||
} |
||||
}, |
||||
props: { |
||||
hourVal: String, |
||||
value: { |
||||
type: String, |
||||
default: '*' |
||||
} |
||||
}, |
||||
model: { |
||||
prop: 'value', |
||||
event: 'hourValueEvent' |
||||
}, |
||||
methods: { |
||||
// 间隔执行时间(1) |
||||
onIntervalPerform (val) { |
||||
this.intervalPerformVal = val |
||||
if (this.radioHour === 'intervalHour') { |
||||
this.hourValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
} |
||||
}, |
||||
// 间隔开始时间(2) |
||||
onIntervalStart (val) { |
||||
this.intervalStartVal = val |
||||
if (this.radioHour === 'intervalHour') { |
||||
this.hourValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
} |
||||
}, |
||||
// 具体小时 |
||||
onspecificHours (arr) { |
||||
}, |
||||
// 周期开始值 |
||||
onCycleStart (val) { |
||||
this.cycleStartVal = val |
||||
if (this.radioHour === 'cycleHour') { |
||||
this.hourValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
} |
||||
}, |
||||
// 周期结束值 |
||||
onCycleEnd (val) { |
||||
this.cycleEndVal = val |
||||
if (this.radioHour === 'cycleHour') { |
||||
this.hourValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
} |
||||
}, |
||||
// 重置每一小时 |
||||
everyReset () { |
||||
this.hourValue = '*' |
||||
}, |
||||
// 重置间隔小时 |
||||
intervalReset () { |
||||
this.hourValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
}, |
||||
// 重置具体小时数 |
||||
specificReset () { |
||||
if (this.specificHoursVal.length) { |
||||
this.hourValue = this.specificHoursVal.join(',') |
||||
} else { |
||||
this.hourValue = '*' |
||||
} |
||||
}, |
||||
// 重置周期小时数 |
||||
cycleReset () { |
||||
this.hourValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
}, |
||||
/** |
||||
* 解析参数值 |
||||
*/ |
||||
analyticalValue () { |
||||
return new Promise((resolve, reject) => { |
||||
let $hourVal = _.cloneDeep(this.value) |
||||
// 间隔小时 |
||||
let $interval = isStr($hourVal, '/') |
||||
// 具体小时 |
||||
let $specific = isStr($hourVal, ',') |
||||
// 周期小时 |
||||
let $cycle = isStr($hourVal, '-') |
||||
|
||||
// 每一小时 |
||||
if ($hourVal === '*') { |
||||
this.radioHour = 'everyHour' |
||||
this.hourValue = '*' |
||||
return |
||||
} |
||||
|
||||
// 正整数(时) |
||||
if ($hourVal.length === 1 && _.isInteger(parseInt($hourVal)) || |
||||
$hourVal.length === 2 && _.isInteger(parseInt($hourVal)) |
||||
) { |
||||
this.radioHour = 'specificHour' |
||||
this.specificHoursVal = [$hourVal] |
||||
return |
||||
} |
||||
|
||||
// 间隔小时 |
||||
if ($interval) { |
||||
this.radioHour = 'intervalHour' |
||||
this.intervalStartVal = parseInt($interval[0]) |
||||
this.intervalPerformVal = parseInt($interval[1]) |
||||
this.hourValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
return |
||||
} |
||||
|
||||
// 具体小时数 |
||||
if ($specific) { |
||||
this.radioHour = 'specificHour' |
||||
this.specificHoursVal = $specific |
||||
return |
||||
} |
||||
|
||||
// 周期小时 |
||||
if ($cycle) { |
||||
this.radioHour = 'cycleHour' |
||||
this.cycleStartVal = parseInt($cycle[0]) |
||||
this.cycleEndVal = parseInt($cycle[1]) |
||||
this.hourValue = `${this.cycleStartVal}/${this.cycleEndVal}` |
||||
return |
||||
} |
||||
resolve() |
||||
}) |
||||
} |
||||
}, |
||||
watch: { |
||||
// 导出值 |
||||
hourValue (val) { |
||||
this.$emit('hourValueEvent', val) |
||||
}, |
||||
// 选中类型 |
||||
radioHour (val) { |
||||
switch (val) { |
||||
case 'everyHour': |
||||
this.everyReset() |
||||
break |
||||
case 'intervalHour': |
||||
this.intervalReset() |
||||
break |
||||
case 'specificHour': |
||||
this.specificReset() |
||||
break |
||||
case 'cycleHour': |
||||
this.cycleReset() |
||||
break |
||||
} |
||||
}, |
||||
// 具体小时数 |
||||
specificHoursVal (arr) { |
||||
this.hourValue = arr.join(',') |
||||
} |
||||
}, |
||||
beforeCreate () { |
||||
}, |
||||
created () { |
||||
this.analyticalValue().then(() => { |
||||
console.log('数据结构解析成功!') |
||||
}) |
||||
}, |
||||
beforeMount () { |
||||
}, |
||||
mounted () { |
||||
|
||||
}, |
||||
beforeUpdate () { |
||||
}, |
||||
updated () { |
||||
}, |
||||
beforeDestroy () { |
||||
}, |
||||
destroyed () { |
||||
}, |
||||
computed: {}, |
||||
components: { mInputNumber } |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" rel="stylesheet/scss"> |
||||
</style> |
@ -0,0 +1,261 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<div class="minute-model"> |
||||
<div class="v-crontab-from-model"> |
||||
<x-radio-group v-model="radioMinute" vertical> |
||||
<div class="list-box"> |
||||
<x-radio label="everyMinute"> |
||||
<span class="text">{{$t('每一分钟')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="intervalMinute"> |
||||
<span class="text">{{$t('每隔')}}</span> |
||||
<m-input-number :min="0" :max="59" :props-value="parseInt(intervalPerformVal)" @on-number="onIntervalPerform"></m-input-number> |
||||
<span class="text">{{$t('分执行 从')}}</span> |
||||
<m-input-number :min="0" :max="59" :props-value="parseInt(intervalStartVal)" @on-number="onIntervalStart"></m-input-number> |
||||
<span class="text">{{$t('分开始')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="specificMinute"> |
||||
<span class="text">{{$t('具体分钟数(可多选)')}}</span> |
||||
<x-select multiple :placeholder="$t('请选择具体分钟数')" v-model="specificMinutesVal" @on-change="onspecificMinutes"> |
||||
<x-option |
||||
v-for="item in selectMinuteList" |
||||
:key="item.value" |
||||
:value="item.value" |
||||
:label="item.label"> |
||||
</x-option> |
||||
</x-select> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="cycleMinute"> |
||||
<span class="text">{{$t('周期从')}}</span> |
||||
<m-input-number :min="0" :max="59" :props-value="parseInt(cycleStartVal)" @on-number="onCycleStart"></m-input-number> |
||||
<span class="text">{{$t('到')}}</span> |
||||
<m-input-number :min="0" :max="59" :props-value="parseInt(cycleEndVal)" @on-number="onCycleEnd"></m-input-number> |
||||
<span class="text">{{$t('分')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
</x-radio-group> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import i18n from '../_source/i18n' |
||||
import { selectList, isStr } from '../util/index' |
||||
import mInputNumber from '../_source/input-number' |
||||
|
||||
export default { |
||||
name: 'minute', |
||||
mixins: [i18n], |
||||
data () { |
||||
return { |
||||
minuteValue: '*', |
||||
radioMinute: 'everyMinute', |
||||
selectMinuteList: selectList['60'], |
||||
intervalPerformVal: 5, |
||||
intervalStartVal: 3, |
||||
specificMinutesVal: [], |
||||
cycleStartVal: 1, |
||||
cycleEndVal: 1 |
||||
} |
||||
}, |
||||
props: { |
||||
minuteVal: String, |
||||
value: { |
||||
type: String, |
||||
default: '*' |
||||
} |
||||
}, |
||||
model: { |
||||
prop: 'value', |
||||
event: 'minuteValueEvent' |
||||
}, |
||||
methods: { |
||||
// 间隔执行时间(1) |
||||
onIntervalPerform (val) { |
||||
console.log(val) |
||||
this.intervalPerformVal = val |
||||
if (this.radioMinute === 'intervalMinute') { |
||||
this.minuteValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
} |
||||
}, |
||||
// 间隔开始时间(2) |
||||
onIntervalStart (val) { |
||||
this.intervalStartVal = val |
||||
if (this.radioMinute === 'intervalMinute') { |
||||
this.minuteValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
} |
||||
}, |
||||
// 具体分 |
||||
onspecificMinutes (arr) { |
||||
}, |
||||
// 周期开始值 |
||||
onCycleStart (val) { |
||||
this.cycleStartVal = val |
||||
if (this.radioMinute === 'cycleMinute') { |
||||
this.minuteValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
} |
||||
}, |
||||
// 周期结束值 |
||||
onCycleEnd (val) { |
||||
this.cycleEndVal = val |
||||
if (this.radioMinute === 'cycleMinute') { |
||||
this.minuteValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
} |
||||
}, |
||||
// 重置每一分 |
||||
everyReset () { |
||||
this.minuteValue = '*' |
||||
}, |
||||
// 重置间隔分 |
||||
intervalReset () { |
||||
this.minuteValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
}, |
||||
// 重置具体分钟数 |
||||
specificReset () { |
||||
if (this.specificMinutesVal.length) { |
||||
this.minuteValue = this.specificMinutesVal.join(',') |
||||
} else { |
||||
this.minuteValue = '*' |
||||
} |
||||
}, |
||||
// 重置周期分分钟数 |
||||
cycleReset () { |
||||
this.minuteValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
}, |
||||
/** |
||||
* 解析参数值 |
||||
*/ |
||||
analyticalValue () { |
||||
return new Promise((resolve, reject) => { |
||||
let $minuteVal = _.cloneDeep(this.value) |
||||
// 间隔分 |
||||
let $interval = isStr($minuteVal, '/') |
||||
// 具体分 |
||||
let $specific = isStr($minuteVal, ',') |
||||
// 周期分 |
||||
let $cycle = isStr($minuteVal, '-') |
||||
|
||||
// 每一分 |
||||
if ($minuteVal === '*') { |
||||
this.radioMinute = 'everyMinute' |
||||
this.minuteValue = '*' |
||||
return |
||||
} |
||||
|
||||
// 正整数(分) |
||||
if ($minuteVal.length === 1 && _.isInteger(parseInt($minuteVal)) || |
||||
$minuteVal.length === 2 && _.isInteger(parseInt($minuteVal)) |
||||
) { |
||||
this.radioMinute = 'specificMinute' |
||||
this.specificMinutesVal = [$minuteVal] |
||||
return |
||||
} |
||||
|
||||
// 间隔分 |
||||
if ($interval) { |
||||
this.radioMinute = 'intervalMinute' |
||||
this.intervalStartVal = parseInt($interval[0]) |
||||
this.intervalPerformVal = parseInt($interval[1]) |
||||
this.minuteValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
return |
||||
} |
||||
|
||||
// 具体分钟数 |
||||
if ($specific) { |
||||
this.radioMinute = 'specificMinute' |
||||
this.specificMinutesVal = $specific |
||||
return |
||||
} |
||||
|
||||
// 周期分 |
||||
if ($cycle) { |
||||
this.radioMinute = 'cycleMinute' |
||||
this.cycleStartVal = parseInt($cycle[0]) |
||||
this.cycleEndVal = parseInt($cycle[1]) |
||||
this.minuteValue = `${this.cycleStartVal}/${this.cycleEndVal}` |
||||
return |
||||
} |
||||
resolve() |
||||
}) |
||||
} |
||||
}, |
||||
watch: { |
||||
// 导出值 |
||||
minuteValue (val) { |
||||
this.$emit('minuteValueEvent', val) |
||||
}, |
||||
// 选中类型 |
||||
radioMinute (val) { |
||||
switch (val) { |
||||
case 'everyMinute': |
||||
this.everyReset() |
||||
break |
||||
case 'intervalMinute': |
||||
this.intervalReset() |
||||
break |
||||
case 'specificMinute': |
||||
this.specificReset() |
||||
break |
||||
case 'cycleMinute': |
||||
this.cycleReset() |
||||
break |
||||
} |
||||
}, |
||||
// 具体分钟数 |
||||
specificMinutesVal (arr) { |
||||
this.minuteValue = arr.join(',') |
||||
} |
||||
}, |
||||
beforeCreate () { |
||||
}, |
||||
created () { |
||||
this.analyticalValue().then(() => { |
||||
console.log('数据结构解析成功!') |
||||
}) |
||||
}, |
||||
beforeMount () { |
||||
}, |
||||
mounted () { |
||||
|
||||
}, |
||||
beforeUpdate () { |
||||
}, |
||||
updated () { |
||||
}, |
||||
beforeDestroy () { |
||||
}, |
||||
destroyed () { |
||||
}, |
||||
computed: {}, |
||||
components: { mInputNumber } |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" rel="stylesheet/scss"> |
||||
.minute-model { |
||||
|
||||
} |
||||
|
||||
|
||||
</style> |
@ -0,0 +1,260 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<div class="month-model"> |
||||
<div class="v-crontab-from-model"> |
||||
<x-radio-group v-model="radioMonth" vertical> |
||||
<div class="list-box"> |
||||
<x-radio label="everyMonth"> |
||||
<span class="text">{{$t('每一月')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="intervalMonth"> |
||||
<span class="text">{{$t('每隔')}}</span> |
||||
<m-input-number :min="0" :max="12" :props-value="parseInt(intervalPerformVal)" @on-number="onIntervalPerform"></m-input-number> |
||||
<span class="text">{{$t('月执行 从')}}</span> |
||||
<m-input-number :min="0" :max="12" :props-value="parseInt(intervalStartVal)" @on-number="onIntervalStart"></m-input-number> |
||||
<span class="text">{{$t('月开始')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="specificlMonth"> |
||||
<span class="text">{{$t('具体月数(可多选)')}}</span> |
||||
<x-select multiple :placeholder="$t('请选择具体月数')" v-model="specificMonthVal" @on-change="onspecificlMonths"> |
||||
<x-option |
||||
v-for="item in selectMonthList" |
||||
:key="item.value" |
||||
:value="item.value" |
||||
:label="item.label"> |
||||
</x-option> |
||||
</x-select> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="cycleMonth"> |
||||
<span class="text">{{$t('周期从')}}</span> |
||||
<m-input-number :min="0" :max="12" :props-value="parseInt(cycleStartVal)" @on-number="onCycleStart"></m-input-number> |
||||
<span class="text">{{$t('到')}}</span> |
||||
<m-input-number :min="0" :max="12" :props-value="parseInt(cycleEndVal)" @on-number="onCycleEnd"></m-input-number> |
||||
<span class="text">{{$t('月')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
</x-radio-group> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import i18n from '../_source/i18n' |
||||
import { selectList, isStr } from '../util/index' |
||||
import mInputNumber from '../_source/input-number' |
||||
|
||||
export default { |
||||
name: 'month', |
||||
mixins: [i18n], |
||||
data () { |
||||
return { |
||||
monthValue: '*', |
||||
radioMonth: 'everyMonth', |
||||
selectMonthList: selectList['12'], |
||||
intervalPerformVal: 5, |
||||
intervalStartVal: 3, |
||||
specificMonthVal: [], |
||||
cycleStartVal: 1, |
||||
cycleEndVal: 1 |
||||
} |
||||
}, |
||||
props: { |
||||
monthVal: String, |
||||
value: { |
||||
type: String, |
||||
default: '*' |
||||
} |
||||
}, |
||||
model: { |
||||
prop: 'value', |
||||
event: 'monthValueEvent' |
||||
}, |
||||
methods: { |
||||
// 间隔执行时间(1) |
||||
onIntervalPerform (val) { |
||||
this.intervalPerformVal = val |
||||
if (this.radioMonth === 'intervalMonth') { |
||||
this.monthValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
} |
||||
}, |
||||
// 间隔开始时间(2) |
||||
onIntervalStart (val) { |
||||
this.intervalStartVal = val |
||||
if (this.radioMonth === 'intervalMonth') { |
||||
this.monthValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
} |
||||
}, |
||||
// 具体月 |
||||
onspecificlMonths (arr) { |
||||
}, |
||||
// 周期开始值 |
||||
onCycleStart (val) { |
||||
this.cycleStartVal = val |
||||
if (this.radioMonth === 'cycleMonth') { |
||||
this.monthValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
} |
||||
}, |
||||
// 周期结束值 |
||||
onCycleEnd (val) { |
||||
this.cycleEndVal = val |
||||
if (this.radioMonth === 'cycleMonth') { |
||||
this.monthValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
} |
||||
}, |
||||
// 重置每一月 |
||||
everyReset () { |
||||
this.monthValue = '*' |
||||
}, |
||||
// 重置间隔月 |
||||
intervalReset () { |
||||
this.monthValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
}, |
||||
// 重置具体月数 |
||||
specificReset () { |
||||
if (this.specificMonthVal.length) { |
||||
this.monthValue = this.specificMonthVal.join(',') |
||||
} else { |
||||
this.monthValue = '*' |
||||
} |
||||
}, |
||||
// 重置周期月数 |
||||
cycleReset () { |
||||
this.monthValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
}, |
||||
/** |
||||
* 解析参数值 |
||||
*/ |
||||
analyticalValue () { |
||||
return new Promise((resolve, reject) => { |
||||
let $monthVal = _.cloneDeep(this.value) |
||||
// 间隔月 |
||||
let $interval = isStr($monthVal, '/') |
||||
// 具体月 |
||||
let $specific = isStr($monthVal, ',') |
||||
// 周期月 |
||||
let $cycle = isStr($monthVal, '-') |
||||
|
||||
// 每一月 |
||||
if ($monthVal === '*') { |
||||
this.radioMonth = 'everyMonth' |
||||
this.monthValue = '*' |
||||
return |
||||
} |
||||
|
||||
// 正整数(月) |
||||
if ($monthVal.length === 1 && _.isInteger(parseInt($monthVal)) || |
||||
$monthVal.length === 2 && _.isInteger(parseInt($monthVal)) |
||||
) { |
||||
this.radioMonth = 'specificlMonth' |
||||
this.specificMonthVal = [$monthVal] |
||||
return |
||||
} |
||||
|
||||
// 间隔月 |
||||
if ($interval) { |
||||
this.radioMonth = 'intervalMonth' |
||||
this.intervalStartVal = parseInt($interval[0]) |
||||
this.intervalPerformVal = parseInt($interval[1]) |
||||
this.monthValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
return |
||||
} |
||||
|
||||
// 具体月数 |
||||
if ($specific) { |
||||
this.radioMonth = 'specificlMonth' |
||||
this.specificMonthVal = $specific |
||||
return |
||||
} |
||||
|
||||
// 周期月 |
||||
if ($cycle) { |
||||
this.radioMonth = 'cycleMonth' |
||||
this.cycleStartVal = parseInt($cycle[0]) |
||||
this.cycleEndVal = parseInt($cycle[1]) |
||||
this.monthValue = `${this.cycleStartVal}/${this.cycleEndVal}` |
||||
return |
||||
} |
||||
resolve() |
||||
}) |
||||
} |
||||
}, |
||||
watch: { |
||||
// 导出值 |
||||
monthValue (val) { |
||||
this.$emit('monthValueEvent', val) |
||||
}, |
||||
// 选中类型 |
||||
radioMonth (val) { |
||||
switch (val) { |
||||
case 'everyMonth': |
||||
this.everyReset() |
||||
break |
||||
case 'intervalMonth': |
||||
this.intervalReset() |
||||
break |
||||
case 'specificlMonth': |
||||
this.specificReset() |
||||
break |
||||
case 'cycleMonth': |
||||
this.cycleReset() |
||||
break |
||||
} |
||||
}, |
||||
// 具体月数 |
||||
specificMonthVal (arr) { |
||||
this.monthValue = arr.join(',') |
||||
} |
||||
}, |
||||
beforeCreate () { |
||||
}, |
||||
created () { |
||||
this.analyticalValue().then(() => { |
||||
console.log('数据结构解析成功!') |
||||
}) |
||||
}, |
||||
beforeMount () { |
||||
}, |
||||
mounted () { |
||||
|
||||
}, |
||||
beforeUpdate () { |
||||
}, |
||||
updated () { |
||||
}, |
||||
beforeDestroy () { |
||||
}, |
||||
destroyed () { |
||||
}, |
||||
computed: {}, |
||||
components: { mInputNumber } |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" rel="stylesheet/scss"> |
||||
.month-model { |
||||
|
||||
} |
||||
|
||||
|
||||
</style> |
@ -0,0 +1,268 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<div class="second-model"> |
||||
<div class="v-crontab-from-model"> |
||||
<x-radio-group v-model="radioSecond" vertical> |
||||
<div class="list-box"> |
||||
<x-radio label="everySecond"> |
||||
<span class="text">{{$t('每一秒钟')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="intervalSecond"> |
||||
<span class="text">{{$t('每隔')}}</span> |
||||
<m-input-number :min="0" :max="59" :props-value="parseInt(intervalPerformVal)" @on-number="onIntervalPerform"></m-input-number> |
||||
<span class="text">{{$t('秒执行 从')}}</span> |
||||
<m-input-number :min="0" :max="59" :props-value="parseInt(intervalStartVal)" @on-number="onIntervalStart"></m-input-number> |
||||
<span class="text">{{$t('秒开始')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="specificSecond"> |
||||
<span class="text">{{$t('具体秒数(可多选)')}}</span> |
||||
<x-select multiple :placeholder="$t('请选择具体秒数')" v-model="specificSecondsVal" @on-change="onSpecificSeconds"> |
||||
<x-option |
||||
v-for="item in selectSecondList" |
||||
:key="item.value" |
||||
:value="item.value" |
||||
:label="item.label"> |
||||
</x-option> |
||||
</x-select> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="cycleSecond"> |
||||
<span class="text">{{$t('周期从')}}</span> |
||||
<m-input-number :min="0" :max="59" :props-value="parseInt(cycleStartVal)" @on-number="onCycleStart"></m-input-number> |
||||
<span class="text">{{$t('到')}}</span> |
||||
<m-input-number :min="0" :max="59" :props-value="parseInt(cycleEndVal)" @on-number="onCycleEnd"></m-input-number> |
||||
<span class="text">{{$t('秒')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
</x-radio-group> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import i18n from '../_source/i18n' |
||||
import { selectList, isStr } from '../util/index' |
||||
import mInputNumber from '../_source/input-number' |
||||
|
||||
export default { |
||||
name: 'second', |
||||
mixins: [i18n], |
||||
data () { |
||||
return { |
||||
secondValue: '*', |
||||
radioSecond: 'everySecond', |
||||
selectSecondList: selectList['60'], |
||||
intervalPerformVal: 5, |
||||
intervalStartVal: 3, |
||||
specificSecondsVal: [], |
||||
cycleStartVal: 1, |
||||
cycleEndVal: 1 |
||||
} |
||||
}, |
||||
props: { |
||||
secondVal: String, |
||||
value: { |
||||
type: String, |
||||
default: '*' |
||||
} |
||||
}, |
||||
model: { |
||||
prop: 'value', |
||||
event: 'secondValueEvent' |
||||
}, |
||||
methods: { |
||||
// 间隔执行时间(1) |
||||
onIntervalPerform (val) { |
||||
console.log(val) |
||||
console.log('++') |
||||
this.intervalPerformVal = val |
||||
if (this.radioSecond === 'intervalSecond') { |
||||
this.secondValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
} |
||||
}, |
||||
// 间隔开始时间(2) |
||||
onIntervalStart (val) { |
||||
this.intervalStartVal = val |
||||
if (this.radioSecond === 'intervalSecond') { |
||||
this.secondValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
} |
||||
}, |
||||
// 具体秒 |
||||
onSpecificSeconds (arr) { |
||||
}, |
||||
// 周期开始值 |
||||
onCycleStart (val) { |
||||
this.cycleStartVal = val |
||||
if (this.radioSecond === 'cycleSecond') { |
||||
this.secondValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
} |
||||
}, |
||||
// 周期结束值 |
||||
onCycleEnd (val) { |
||||
this.cycleEndVal = val |
||||
if (this.radioSecond === 'cycleSecond') { |
||||
this.secondValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
} |
||||
}, |
||||
// 重置每一秒 |
||||
everyReset () { |
||||
this.secondValue = '*' |
||||
}, |
||||
// 重置间隔秒 |
||||
intervalReset () { |
||||
this.secondValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
}, |
||||
// 重置具体秒数 |
||||
specificReset () { |
||||
if (this.specificSecondsVal.length) { |
||||
this.secondValue = this.specificSecondsVal.join(',') |
||||
} else { |
||||
this.secondValue = '*' |
||||
} |
||||
}, |
||||
// 重置周期秒数 |
||||
cycleReset () { |
||||
this.secondValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
}, |
||||
/** |
||||
* 解析参数值 |
||||
*/ |
||||
analyticalValue () { |
||||
return new Promise((resolve, reject) => { |
||||
let $secondVal = _.cloneDeep(this.value) |
||||
// 间隔秒 |
||||
let $interval = isStr($secondVal, '/') |
||||
// 具体秒 |
||||
let $specific = isStr($secondVal, ',') |
||||
// 周期秒 |
||||
let $cycle = isStr($secondVal, '-') |
||||
|
||||
// 每一秒 |
||||
if ($secondVal === '*') { |
||||
this.radioSecond = 'everySecond' |
||||
this.secondValue = '*' |
||||
return |
||||
} |
||||
|
||||
// 正整数(秒) |
||||
if ($secondVal.length === 1 && _.isInteger(parseInt($secondVal)) || |
||||
$secondVal.length === 2 && _.isInteger(parseInt($secondVal)) |
||||
) { |
||||
this.radioSecond = 'specificSecond' |
||||
this.specificSecondsVal = [$secondVal] |
||||
return |
||||
} |
||||
|
||||
// 间隔秒 |
||||
if ($interval) { |
||||
this.radioSecond = 'intervalSecond' |
||||
this.intervalStartVal = parseInt($interval[0]) |
||||
this.intervalPerformVal = parseInt($interval[1]) |
||||
this.secondValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
return |
||||
} |
||||
|
||||
// 具体秒数 |
||||
if ($specific) { |
||||
this.radioSecond = 'specificSecond' |
||||
this.specificSecondsVal = $specific |
||||
return |
||||
} |
||||
|
||||
// 周期秒 |
||||
if ($cycle) { |
||||
this.radioSecond = 'cycleSecond' |
||||
this.cycleStartVal = parseInt($cycle[0]) |
||||
this.cycleEndVal = parseInt($cycle[1]) |
||||
this.secondValue = `${this.cycleStartVal}/${this.cycleEndVal}` |
||||
return |
||||
} |
||||
resolve() |
||||
}) |
||||
} |
||||
}, |
||||
watch: { |
||||
// value变化重新解析结构 |
||||
value () { |
||||
this.analyticalValue().then(() => { |
||||
console.log('数据结构解析成功!') |
||||
}) |
||||
}, |
||||
// 导出值 |
||||
secondValue (val) { |
||||
this.$emit('secondValueEvent', val) |
||||
}, |
||||
// 选中类型 |
||||
radioSecond (val) { |
||||
switch (val) { |
||||
case 'everySecond': |
||||
this.everyReset() |
||||
break |
||||
case 'intervalSecond': |
||||
this.intervalReset() |
||||
break |
||||
case 'specificSecond': |
||||
this.specificReset() |
||||
break |
||||
case 'cycleSecond': |
||||
this.cycleReset() |
||||
break |
||||
} |
||||
}, |
||||
// 具体秒数 |
||||
specificSecondsVal (arr) { |
||||
this.secondValue = arr.join(',') |
||||
} |
||||
}, |
||||
beforeCreate () { |
||||
}, |
||||
created () { |
||||
this.analyticalValue().then(() => { |
||||
console.log('数据结构解析成功!') |
||||
}) |
||||
}, |
||||
beforeMount () { |
||||
}, |
||||
mounted () { |
||||
|
||||
}, |
||||
beforeUpdate () { |
||||
}, |
||||
updated () { |
||||
}, |
||||
beforeDestroy () { |
||||
}, |
||||
destroyed () { |
||||
}, |
||||
computed: {}, |
||||
components: { mInputNumber } |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" rel="stylesheet/scss"> |
||||
.second-model { |
||||
|
||||
} |
||||
|
||||
|
||||
</style> |
@ -0,0 +1,259 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<div class="year-model"> |
||||
<div class="v-crontab-from-model"> |
||||
<x-radio-group v-model="radioYear" vertical> |
||||
<div class="list-box"> |
||||
<x-radio label="everyYear"> |
||||
<span class="text">{{$t('每一年')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="intervalYear"> |
||||
<span class="text">{{$t('每隔')}}</span> |
||||
<m-input-number :min="2019" :max="2030" :props-value="parseInt(intervalPerformVal)" @on-number="onIntervalPerform"></m-input-number> |
||||
<span class="text">{{$t('年执行 从')}}</span> |
||||
<m-input-number :min="2019" :max="2030" :props-value="parseInt(intervalStartVal)" @on-number="onIntervalStart"></m-input-number> |
||||
<span class="text">{{$t('年开始')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="specificYear"> |
||||
<span class="text">{{$t('具体年数(可多选)')}}</span> |
||||
<x-select multiple :placeholder="$t('请选择具体年数')" v-model="specificYearVal" @on-change="onspecificYears"> |
||||
<x-option |
||||
v-for="item in selectYearList" |
||||
:key="item.value" |
||||
:value="item.value" |
||||
:label="item.label"> |
||||
</x-option> |
||||
</x-select> |
||||
</x-radio> |
||||
</div> |
||||
<div class="list-box"> |
||||
<x-radio label="cycleYear"> |
||||
<span class="text">{{$t('周期从')}}</span> |
||||
<m-input-number :min="2019" :max="2030" :props-value="parseInt(cycleStartVal)" @on-number="onCycleStart"></m-input-number> |
||||
<span class="text">{{$t('到')}}</span> |
||||
<m-input-number :min="2019" :max="2030" :props-value="parseInt(cycleEndVal)" @on-number="onCycleEnd"></m-input-number> |
||||
<span class="text">{{$t('年')}}</span> |
||||
</x-radio> |
||||
</div> |
||||
</x-radio-group> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import i18n from '../_source/i18n' |
||||
import { selectList, isStr } from '../util/index' |
||||
import mInputNumber from '../_source/input-number' |
||||
|
||||
export default { |
||||
name: 'year', |
||||
mixins: [i18n], |
||||
data () { |
||||
return { |
||||
yearValue: '*', |
||||
radioYear: 'everyYear', |
||||
selectYearList: selectList['year'], |
||||
intervalPerformVal: 1, |
||||
intervalStartVal: 2019, |
||||
specificYearVal: [], |
||||
cycleStartVal: 2019, |
||||
cycleEndVal: 2019 |
||||
} |
||||
}, |
||||
props: { |
||||
yearVal: String, |
||||
value: { |
||||
type: String, |
||||
default: '*' |
||||
} |
||||
}, |
||||
model: { |
||||
prop: 'value', |
||||
event: 'yearValueEvent' |
||||
}, |
||||
methods: { |
||||
// 间隔执行时间(1) |
||||
onIntervalPerform (val) { |
||||
console.log(val) |
||||
this.intervalPerformVal = val |
||||
if (this.radioYear === 'intervalYear') { |
||||
this.yearValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
} |
||||
}, |
||||
// 间隔开始时间(2) |
||||
onIntervalStart (val) { |
||||
this.intervalStartVal = val |
||||
if (this.radioYear === 'intervalYear') { |
||||
this.yearValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
} |
||||
}, |
||||
// 具体年 |
||||
onspecificYears (arr) { |
||||
}, |
||||
// 周期开始值 |
||||
onCycleStart (val) { |
||||
this.cycleStartVal = val |
||||
if (this.radioYear === 'cycleYear') { |
||||
this.yearValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
} |
||||
}, |
||||
// 周期结束值 |
||||
onCycleEnd (val) { |
||||
this.cycleEndVal = val |
||||
if (this.radioYear === 'cycleYear') { |
||||
this.yearValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
} |
||||
}, |
||||
// 重置每一年 |
||||
everyReset () { |
||||
this.yearValue = '*' |
||||
}, |
||||
// 重置间隔年 |
||||
intervalReset () { |
||||
this.yearValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
}, |
||||
// 重置具体年数 |
||||
specificReset () { |
||||
if (this.specificYearVal.length) { |
||||
this.yearValue = this.specificYearVal.join(',') |
||||
} else { |
||||
this.yearValue = '*' |
||||
} |
||||
}, |
||||
// 重置周期年数 |
||||
cycleReset () { |
||||
this.yearValue = `${this.cycleStartVal}-${this.cycleEndVal}` |
||||
}, |
||||
/** |
||||
* 解析参数值 |
||||
*/ |
||||
analyticalValue () { |
||||
return new Promise((resolve, reject) => { |
||||
let $yearVal = _.cloneDeep(this.value) |
||||
// 间隔年 |
||||
let $interval = isStr($yearVal, '/') |
||||
// 具体年 |
||||
let $specific = isStr($yearVal, ',') |
||||
// 周期年 |
||||
let $cycle = isStr($yearVal, '-') |
||||
|
||||
// 每一年 |
||||
if ($yearVal === '*') { |
||||
this.radioYear = 'everyYear' |
||||
this.yearValue = '*' |
||||
return |
||||
} |
||||
|
||||
// 正整数(年) |
||||
if ($yearVal.length === 4 && _.isInteger(parseInt($yearVal))) { |
||||
this.radioYear = 'specificYear' |
||||
this.specificYearVal = [$yearVal] |
||||
return |
||||
} |
||||
|
||||
// 间隔年 |
||||
if ($interval) { |
||||
this.radioYear = 'intervalYear' |
||||
this.intervalStartVal = parseInt($interval[0]) |
||||
this.intervalPerformVal = parseInt($interval[1]) |
||||
this.yearValue = `${this.intervalStartVal}/${this.intervalPerformVal}` |
||||
return |
||||
} |
||||
|
||||
// 具体年数 |
||||
if ($specific) { |
||||
this.radioYear = 'specificYear' |
||||
this.specificYearVal = $specific |
||||
return |
||||
} |
||||
|
||||
// 周期年 |
||||
if ($cycle) { |
||||
this.radioYear = 'cycleYear' |
||||
this.cycleStartVal = parseInt($cycle[0]) |
||||
this.cycleEndVal = parseInt($cycle[1]) |
||||
this.yearValue = `${this.cycleStartVal}/${this.cycleEndVal}` |
||||
return |
||||
} |
||||
resolve() |
||||
}) |
||||
} |
||||
}, |
||||
watch: { |
||||
// 导出值 |
||||
yearValue (val) { |
||||
this.$emit('yearValueEvent', val) |
||||
}, |
||||
// 选中类型 |
||||
radioYear (val) { |
||||
switch (val) { |
||||
case 'everyYear': |
||||
this.everyReset() |
||||
break |
||||
case 'intervalYear': |
||||
this.intervalReset() |
||||
break |
||||
case 'specificYear': |
||||
this.specificReset() |
||||
break |
||||
case 'cycleYear': |
||||
this.cycleReset() |
||||
break |
||||
} |
||||
}, |
||||
// 具体年数 |
||||
specificYearVal (arr) { |
||||
this.yearValue = arr.join(',') |
||||
} |
||||
}, |
||||
beforeCreate () { |
||||
}, |
||||
created () { |
||||
this.analyticalValue().then(() => { |
||||
console.log('数据结构解析成功!') |
||||
}) |
||||
}, |
||||
beforeMount () { |
||||
}, |
||||
mounted () { |
||||
|
||||
}, |
||||
beforeUpdate () { |
||||
}, |
||||
updated () { |
||||
}, |
||||
beforeDestroy () { |
||||
}, |
||||
destroyed () { |
||||
}, |
||||
computed: {}, |
||||
components: { mInputNumber } |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" rel="stylesheet/scss"> |
||||
.year-model { |
||||
|
||||
} |
||||
|
||||
|
||||
</style> |
@ -0,0 +1,206 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
<template> |
||||
<div class="v-crontab"> |
||||
|
||||
<!--<div style="border: 1px solid red;padding: 10px">--> |
||||
<!--<!–<span style="display: block">{{secondVal}} {{minuteVal}} {{hourVal}} {{dayVal}} {{monthVal}} {{weekVal}} {{yearVal}}</span>–>--> |
||||
<!--{{rtValue}}--> |
||||
<!--</div>--> |
||||
|
||||
<div class="v-crontab-model"> |
||||
<div class="clearfix v-crontab-tab"> |
||||
<a href="javascript:" :class="tabVal === 'second' ?' active' :''" @click="onTab('second')"><i class="ans-icon-calendar"></i><span>{{$t('秒')}}</span></a> |
||||
<a href="javascript:" :class="tabVal === 'minute' ?' active' :''" @click="onTab('minute')"><i class="ans-icon-calendar"></i><span>{{$t('分')}}</span></a> |
||||
<a href="javascript:" :class="tabVal === 'hour' ?' active' :''" @click="onTab('hour')"><i class="ans-icon-calendar"></i><span>{{$t('时')}}</span></a> |
||||
<a href="javascript:" :class="tabVal === 'day' ?' active' :''" @click="onTab('day')"><i class="ans-icon-calendar"></i><span>{{$t('天')}}</span></a> |
||||
<a href="javascript:" :class="tabVal === 'month' ?' active' :''" @click="onTab('month')"><i class="ans-icon-calendar"></i><span>{{$t('月')}}</span></a> |
||||
<a href="javascript:" :class="tabVal === 'year' ?' active' :''" @click="onTab('year')"><i class="ans-icon-calendar"></i><span>{{$t('年')}}</span></a> |
||||
</div> |
||||
<div class="v-crontab-content"> |
||||
<template v-if="tabVal === 'second'"> |
||||
<m-second v-model="secondVal"></m-second> |
||||
</template> |
||||
<template v-if="tabVal === 'minute'"> |
||||
<m-minute v-model="minuteVal"></m-minute> |
||||
</template> |
||||
<template v-if="tabVal === 'hour'"> |
||||
<m-hour v-model="hourVal"></m-hour> |
||||
</template> |
||||
|
||||
<!-- 天 start --> |
||||
<template v-if="tabVal === 'day'"> |
||||
<m-day @on-day-value="_onDayValue" @on-week-value="_onWeekValue" :day-val="dayVal" :week-val="weekVal"></m-day> |
||||
</template> |
||||
<!-- 天 end --> |
||||
|
||||
<template v-if="tabVal === 'month'"> |
||||
<m-month v-model="monthVal"></m-month> |
||||
</template> |
||||
|
||||
<template v-if="tabVal === 'year'"> |
||||
<m-year v-model="yearVal"></m-year> |
||||
</template> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import i18n from './_source/i18n' |
||||
import mSecond from './_times/second' |
||||
import mMinute from './_times/minute' |
||||
import mHour from './_times/hour' |
||||
import mDay from './_times/day' |
||||
import mMonth from './_times/month' |
||||
import mYear from './_times/year' |
||||
|
||||
export default { |
||||
name: 'app', |
||||
data () { |
||||
return { |
||||
tabVal: 'second', |
||||
secondVal: '*', |
||||
minuteVal: '*', |
||||
hourVal: '*', |
||||
dayVal: '*', |
||||
monthVal: '*', |
||||
weekVal: '?', |
||||
yearVal: '*', |
||||
watchValue: '' |
||||
} |
||||
}, |
||||
mixins: [i18n], |
||||
props: { |
||||
value: { |
||||
type: String, |
||||
default: '* * * * * ? *' |
||||
}, |
||||
locale: { |
||||
type: String, |
||||
default: 'en_US' |
||||
} |
||||
}, |
||||
model: { |
||||
prop: 'value', |
||||
event: 'valueEvent' |
||||
}, |
||||
methods: { |
||||
onTab (val) { |
||||
this.tabVal = val |
||||
}, |
||||
_onDayValue (val) { |
||||
this.dayVal = val |
||||
}, |
||||
_onWeekValue (val) { |
||||
this.weekVal = val |
||||
}, |
||||
_reset () { |
||||
let str = this.value.split(' ') |
||||
this.secondVal = str[0] |
||||
this.minuteVal = str[1] |
||||
this.hourVal = str[2] |
||||
this.dayVal = str[3] |
||||
this.monthVal = str[4] |
||||
this.weekVal = str[5] |
||||
this.yearVal = str[6] |
||||
} |
||||
}, |
||||
watch: { |
||||
rtValue (val) { |
||||
this.$emit('valueEvent', val) |
||||
}, |
||||
value () { |
||||
this._reset() |
||||
} |
||||
}, |
||||
beforeCreate () { |
||||
}, |
||||
created () { |
||||
// 国际化绑win下 |
||||
window.localeCrontab = this.locale |
||||
|
||||
// 初始化 |
||||
this._reset() |
||||
}, |
||||
beforeMount () { |
||||
}, |
||||
mounted () { |
||||
}, |
||||
beforeUpdate () { |
||||
}, |
||||
updated () { |
||||
}, |
||||
beforeDestroy () { |
||||
}, |
||||
destroyed () { |
||||
}, |
||||
computed: { |
||||
rtValue () { |
||||
return `${this.secondVal} ${this.minuteVal} ${this.hourVal} ${this.dayVal} ${this.monthVal} ${this.weekVal} ${this.yearVal}` |
||||
} |
||||
}, |
||||
components: { mSecond, mMinute, mHour, mDay, mMonth, mYear } |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
@import "index"; |
||||
.v-crontab { |
||||
width: 640px; |
||||
border:1px solid #e4e7ed; |
||||
background: #fff; |
||||
border-radius: 4px; |
||||
.v-crontab-model { |
||||
.v-crontab-tab { |
||||
background: #f5f7fa; |
||||
height: 42px; |
||||
border-bottom: 1px solid #e4e7ed; |
||||
a { |
||||
width: 86px; |
||||
height: 42px; |
||||
line-height: 42px; |
||||
text-align: center; |
||||
float: left; |
||||
border-right: 1px solid #e4e7ed; |
||||
text-decoration: none; |
||||
span,i { |
||||
font-size: 14px; |
||||
color: #888; |
||||
vertical-align: middle; |
||||
} |
||||
i { |
||||
margin-right: 5px; |
||||
} |
||||
&:hover{ |
||||
text-decoration: none; |
||||
} |
||||
&.active { |
||||
background: #fff; |
||||
position: relative; |
||||
height: 43px; |
||||
} |
||||
} |
||||
} |
||||
.v-crontab-content { |
||||
padding: 8px 20px; |
||||
padding-bottom: 12px; |
||||
} |
||||
} |
||||
} |
||||
|
||||
</style> |
@ -0,0 +1,46 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
.v-crontab-from-model { |
||||
.list-box { |
||||
//padding: 6px 0; |
||||
|
||||
.ans-radio-wrapper { |
||||
height: auto !important; |
||||
} |
||||
.ans-radio-group-item { |
||||
.text { |
||||
color: #888; |
||||
} |
||||
} |
||||
.ans-radio-wrapper-checked { |
||||
.text { |
||||
color: #0097e0; |
||||
} |
||||
} |
||||
.ans-select { |
||||
.tag-container { |
||||
.tag-wrapper { |
||||
line-height: 10px; |
||||
margin-left: 6px; |
||||
.tag-text { |
||||
margin-right: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,215 @@
|
||||
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
import _ from 'lodash' |
||||
|
||||
/** |
||||
* 生成指定区间数字 |
||||
* @param start 起始数值 |
||||
* @param end 结束数值 |
||||
*/ |
||||
const range = (start, end) => { |
||||
let length = end - start + 1 |
||||
let step = start - 1 |
||||
return Array.apply(null, { length: length }).map(function (v, i) { step++; return step }) |
||||
} |
||||
|
||||
let selectList = { |
||||
'60': _.map(range(0, 59), v => { |
||||
return { |
||||
value: v + '', |
||||
label: v + '' |
||||
} |
||||
}), |
||||
'24': _.map(range(0, 23), v => { |
||||
return { |
||||
value: v + '', |
||||
label: v + '' |
||||
} |
||||
}), |
||||
'12': _.map(range(0, 12), v => { |
||||
return { |
||||
value: v + '', |
||||
label: v + '' |
||||
} |
||||
}), |
||||
'year': _.map(range(2018, 2030), v => { |
||||
return { |
||||
value: v + '', |
||||
label: v + '' |
||||
} |
||||
}), |
||||
'week': [ |
||||
{ |
||||
value: 1, |
||||
label: '星期天' |
||||
}, |
||||
{ |
||||
value: 2, |
||||
label: '星期一' |
||||
}, |
||||
{ |
||||
value: 3, |
||||
label: '星期二' |
||||
}, |
||||
{ |
||||
value: 4, |
||||
label: '星期三' |
||||
}, |
||||
{ |
||||
value: 5, |
||||
label: '星期四' |
||||
}, |
||||
{ |
||||
value: 6, |
||||
label: '星期五' |
||||
}, |
||||
{ |
||||
value: 7, |
||||
label: '星期六' |
||||
} |
||||
], |
||||
'specificWeek': [ |
||||
{ |
||||
value: 'SUN', |
||||
label: 'SUN' |
||||
}, |
||||
{ |
||||
value: 'MON', |
||||
label: 'MON' |
||||
}, |
||||
{ |
||||
value: 'TUE', |
||||
label: 'TUE' |
||||
}, |
||||
{ |
||||
value: 'WED', |
||||
label: 'WED' |
||||
}, |
||||
{ |
||||
value: 'THU', |
||||
label: 'THU' |
||||
}, |
||||
{ |
||||
value: 'FRI', |
||||
label: 'FRI' |
||||
}, |
||||
{ |
||||
value: 'SAT', |
||||
label: 'SAT' |
||||
} |
||||
], |
||||
'day': _.map(range(1, 31), v => { |
||||
return { |
||||
value: v + '', |
||||
label: v + '' |
||||
} |
||||
}), |
||||
'lastWeeks': [ |
||||
{ |
||||
value: '1L', |
||||
label: '星期天' |
||||
}, |
||||
{ |
||||
value: '2L', |
||||
label: '星期一' |
||||
}, |
||||
{ |
||||
value: '3L', |
||||
label: '星期二' |
||||
}, |
||||
{ |
||||
value: '4L', |
||||
label: '星期三' |
||||
}, |
||||
{ |
||||
value: '5L', |
||||
label: '星期四' |
||||
}, |
||||
{ |
||||
value: '6L', |
||||
label: '星期五' |
||||
}, |
||||
{ |
||||
value: '7L', |
||||
label: '星期六' |
||||
} |
||||
] |
||||
} |
||||
|
||||
const isStr = (str, v) => { |
||||
let flag |
||||
if (str.indexOf(v) !== -1) { |
||||
flag = str.split(v) |
||||
} |
||||
return flag |
||||
} |
||||
|
||||
const isWeek = (str) => { |
||||
let flag = false |
||||
let data = str.split(',') |
||||
let isSpecificWeek = (key) => { |
||||
return _.findIndex(selectList.specificWeek, v => v.value === key) !== -1 |
||||
} |
||||
_.map(data, v => { |
||||
if (isSpecificWeek(v)) { |
||||
flag = true |
||||
} |
||||
}) |
||||
return flag |
||||
} |
||||
|
||||
|
||||
/** |
||||
* template |
||||
* |
||||
* @param {String} string |
||||
* @param {Array} ...args |
||||
* @return {String} |
||||
*/ |
||||
const { hasOwnProperty } = {} |
||||
const RE_NARGS = /(%|)\{([0-9a-zA-Z_]+)\}/g |
||||
const hasOwn = (o, k) => hasOwnProperty.call(o, k) |
||||
const template = (string, ...args) => { |
||||
if (args.length === 1 && typeof args[0] === 'object') { |
||||
args = args[0] |
||||
} |
||||
if (!args || !args.hasOwnProperty) { |
||||
args = {} |
||||
} |
||||
return string.replace(RE_NARGS, (match, prefix, i, index) => { |
||||
let result |
||||
if (string[index - 1] === '{' && |
||||
string[index + match.length] === '}') { |
||||
return i |
||||
} else { |
||||
result = hasOwn(args, i) ? args[i] : null |
||||
if (result === null || result === undefined) { |
||||
return '' |
||||
} |
||||
return result |
||||
} |
||||
}) |
||||
} |
||||
|
||||
|
||||
export { |
||||
selectList, |
||||
isStr, |
||||
isWeek, |
||||
template |
||||
} |
Before Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 8.3 KiB |
@ -1,30 +0,0 @@
|
||||
An component project |
||||
|
||||
### Setup |
||||
|
||||
- 安装node > 8的LTS版本,https://nodejs.org/en/ |
||||
|
||||
- 增加npm本地仓库host,106.75.23.50 npm.analysys.cn |
||||
|
||||
- 没安装yarn的,可以忽略以下yarn命令 |
||||
|
||||
```sh |
||||
# set registry |
||||
npm config set registry http://registry.npm.analysys.cn |
||||
|
||||
# install parcel |
||||
yarn global add parcel-bundler | npm i -g parcel-bundler |
||||
|
||||
# install dependencies |
||||
yarn | npm i |
||||
|
||||
# startup development server (defaults to 3000) |
||||
# -> http://localhost:3000 |
||||
yarn start | npm start |
||||
``` |
||||
|
||||
### Lint |
||||
```sh |
||||
yarn test | npm run test |
||||
yarn lint:fix | npm run lint:fix |
||||
``` |
@ -1,65 +0,0 @@
|
||||
/** |
||||
* webpack config |
||||
* |
||||
* author: liuxin(liuxin@analysys.com.cn) |
||||
*/ |
||||
|
||||
const path = require('path') |
||||
const glob = require('globby') |
||||
|
||||
const isProduction = process.env.NODE_ENV !== 'development' |
||||
const resolve = dir => path.join(__dirname, '..', dir) |
||||
const assetsDir = resolve('src') |
||||
const distDir = resolve('dist') |
||||
|
||||
const baseConfig = { |
||||
entry: { |
||||
'index': glob.sync(['index.js'], { cwd: assetsDir }) |
||||
}, |
||||
output: { |
||||
path: distDir |
||||
}, |
||||
module: { |
||||
rules: [ |
||||
{ |
||||
test: /\.js$/, |
||||
exclude: file => ( |
||||
/node_modules/.test(file) && |
||||
!/\.vue\.js/.test(file) |
||||
), |
||||
use: [ |
||||
{ |
||||
loader: 'babel-loader', |
||||
options: { |
||||
cacheDirectory: true, |
||||
cacheIdentifier: true |
||||
} |
||||
} |
||||
] |
||||
} |
||||
] |
||||
}, |
||||
resolve: { |
||||
modules: [ |
||||
resolve('node_modules'), |
||||
resolve('src') |
||||
], |
||||
extensions: ['.js', '.json', '.vue', '.scss'] |
||||
}, |
||||
externals: { |
||||
'vue': 'Vue', |
||||
'lodash': { |
||||
commonjs: 'lodash', |
||||
commonjs2: 'lodash', |
||||
amd: 'lodash', |
||||
root: '_' |
||||
} |
||||
} |
||||
} |
||||
|
||||
module.exports = { |
||||
isProduction, |
||||
assetsDir, |
||||
distDir, |
||||
baseConfig |
||||
} |
@ -1,106 +0,0 @@
|
||||
/** |
||||
* webpack config for production |
||||
* |
||||
* author: liuxin(liuxin@analysys.com.cn) |
||||
*/ |
||||
|
||||
const webpack = require('webpack') |
||||
const merge = require('webpack-merge') |
||||
const { baseConfig } = require('./config') |
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin') |
||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin') |
||||
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin') |
||||
const ProgressPlugin = require('@fedor/progress-webpack-plugin') |
||||
const VueLoaderPlugin = require('vue-loader/lib/plugin') |
||||
|
||||
const config = merge.smart(baseConfig, { |
||||
devtool: 'source-map', |
||||
output: { |
||||
filename: '[name].js', |
||||
libraryTarget: 'umd', |
||||
umdNamedDefine: false |
||||
}, |
||||
module: { |
||||
rules: [ |
||||
{ |
||||
test: /\.vue$/, |
||||
loader: 'vue-loader', |
||||
options: { |
||||
hotReload: false |
||||
} |
||||
}, |
||||
{ |
||||
test: /\.css$/, |
||||
loader: ExtractTextPlugin.extract({ |
||||
use: [ |
||||
'css-loader', |
||||
{ |
||||
loader: 'postcss-loader', |
||||
options: { |
||||
plugins: (loader) => [ |
||||
require('autoprefixer')({ |
||||
'browsers': ['ie > 8', 'last 2 version', 'safari >= 9'] |
||||
}), |
||||
require('cssnano') |
||||
] |
||||
} |
||||
} |
||||
], |
||||
fallback: ['vue-style-loader'] |
||||
}) |
||||
}, |
||||
{ |
||||
test: /\.scss$/, |
||||
loader: ExtractTextPlugin.extract({ |
||||
use: [ |
||||
'css-loader', |
||||
{ |
||||
loader: 'postcss-loader', |
||||
options: { |
||||
plugins: (loader) => [ |
||||
require('autoprefixer')({ |
||||
'browsers': ['ie > 8', 'last 2 version', 'safari >= 9'] |
||||
}), |
||||
require('cssnano') |
||||
] |
||||
} |
||||
}, |
||||
'sass-loader' |
||||
], |
||||
fallback: ['vue-style-loader'] |
||||
}) |
||||
} |
||||
] |
||||
}, |
||||
plugins: [ |
||||
new ProgressPlugin(), |
||||
new VueLoaderPlugin(), |
||||
new ExtractTextPlugin({ filename: '[name].css', allChunks: true }), |
||||
new webpack.optimize.OccurrenceOrderPlugin(), |
||||
new OptimizeCssAssetsPlugin({ |
||||
assetNameRegExp: /\.css$/g, |
||||
cssProcessor: require('cssnano'), |
||||
cssProcessorOptions: { discardComments: { removeAll: true } }, |
||||
canPrint: true |
||||
}), |
||||
new UglifyJSPlugin({ |
||||
parallel: true, |
||||
sourceMap: true, |
||||
uglifyOptions: { |
||||
compress: { |
||||
drop_console: true, |
||||
drop_debugger: true |
||||
}, |
||||
comments: function (n, c) { |
||||
/*! IMPORTANT: Please preserve 3rd-party library license info, inspired from @allex/amd-build-worker/config/util.js */ |
||||
var text = c.value, type = c.type |
||||
if (type === 'comment2') { |
||||
return /^!|@preserve|@license|@cc_on|MIT/i.test(text) |
||||
} |
||||
} |
||||
} |
||||
}) |
||||
] |
||||
}) |
||||
|
||||
module.exports = config |
@ -1 +0,0 @@
|
||||
.input-number-model{display:inline-block}.input-number-model button{background:#f5f7fa;padding:8px 10px;position:relative}.input-number-model button .bt-text{font-size:18px;color:#888}.input-number-model .ans-input{width:60px;margin:0 -2px 0 -1px}.input-number-model .ans-input input{text-align:center}.input-number-model button,.input-number-model input{vertical-align:middle}.v-crontab{width:640px;border:1px solid #e4e7ed;background:#fff;border-radius:4px}.v-crontab .v-crontab-model .v-crontab-tab{background:#f5f7fa;height:42px;border-bottom:1px solid #e4e7ed}.v-crontab .v-crontab-model .v-crontab-tab a{width:86px;height:42px;line-height:42px;text-align:center;float:left;border-right:1px solid #e4e7ed;text-decoration:none}.v-crontab .v-crontab-model .v-crontab-tab a i,.v-crontab .v-crontab-model .v-crontab-tab a span{font-size:14px;color:#888;vertical-align:middle}.v-crontab .v-crontab-model .v-crontab-tab a i{margin-right:5px}.v-crontab .v-crontab-model .v-crontab-tab a:hover{text-decoration:none}.v-crontab .v-crontab-model .v-crontab-tab a.active{background:#fff;position:relative;height:43px}.v-crontab .v-crontab-model .v-crontab-content{padding:8px 20px 12px}.v-crontab-from-model .list-box .ans-radio-wrapper{height:auto!important}.v-crontab-from-model .list-box .ans-radio-group-item .text{color:#888}.v-crontab-from-model .list-box .ans-radio-wrapper-checked .text{color:#0097e0}.v-crontab-from-model .list-box .ans-select .tag-container .tag-wrapper{line-height:10px;margin-left:6px}.v-crontab-from-model .list-box .ans-select .tag-container .tag-wrapper .tag-text{margin-right:0} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,47 +0,0 @@
|
||||
<template> |
||||
<div> |
||||
<div style="padding: 20px;"> |
||||
<x-button @click="_lang('zh_CN')">中文</x-button> |
||||
<x-button @click="_lang('en_US')">英文</x-button> |
||||
</div> |
||||
<div style="padding: 40px"> |
||||
{{value}} |
||||
</div> |
||||
<div v-if="is"> |
||||
<v-crontab v-model="value" :locale="lang"></v-crontab> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import { vCrontab } from '../src' |
||||
export default { |
||||
name: 'app', |
||||
data: function () { |
||||
return { |
||||
value: '* * * * * ? *', |
||||
lang: 'zh_CN', |
||||
is: false |
||||
} |
||||
}, |
||||
watch: { |
||||
}, |
||||
mounted () { |
||||
setTimeout(() => { |
||||
// this.value = '4/6 4/6 4/6 4/6 4/6 ? 2019/2' |
||||
}, 2000) |
||||
|
||||
this.is = true |
||||
}, |
||||
methods: { |
||||
_lang (type) { |
||||
this.is = false |
||||
this.lang = type |
||||
setTimeout(() => { |
||||
this.is = true |
||||
}, 1) |
||||
} |
||||
}, |
||||
components: { vCrontab } |
||||
} |
||||
</script> |
||||
<style lang="scss"></style> |
@ -1,14 +0,0 @@
|
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1"> |
||||
<script src="https://s1.analysys.cn/libs/??js-polyfills/0.1.42/polyfill.min.js"></script> |
||||
<title>demo</title> |
||||
</head> |
||||
<body> |
||||
<div id="app"></div> |
||||
<script src="https://s1.analysys.cn/libs/??lodash.js/4.17.11/lodash.min.js"></script> |
||||
<script src="./index.js"></script> |
||||
</body> |
||||
</html> |
@ -1,14 +0,0 @@
|
||||
import Vue from 'vue' |
||||
import App from './app.vue' |
||||
import '@analysys/ans-ui/lib/ans-ui.min.css' |
||||
import ans from '@analysys/ans-ui/lib/ans-ui.min.js' |
||||
|
||||
Vue.use(ans) |
||||
|
||||
new Vue({ |
||||
el: '#app', |
||||
render: h => h(App), |
||||
mounted () { |
||||
console.log('success') |
||||
} |
||||
}) |
@ -1,63 +0,0 @@
|
||||
{ |
||||
"name": "@vue/crontab", |
||||
"version": "1.0.0-beta.10", |
||||
"description": "crontab", |
||||
"author": "quanquan <gongzijian@analysys.com.cn>", |
||||
"main": "dist/index.js", |
||||
"license": "MIT", |
||||
"scripts": { |
||||
"dev": "npm run clean && parcel ./example/index.html -p 3000", |
||||
"build": "npm run clean && cross-env NODE_ENV=production webpack --config ./build/webpack.config.prod.js", |
||||
"lint": "standard \"**/*.{js,vue}\"", |
||||
"lint:fix": "standard \"**/*.{js,vue}\" --fix", |
||||
"clean": "rimraf dist", |
||||
"start": "npm run dev", |
||||
"test": "npm run lint", |
||||
"prepublishOnly": "npm run build" |
||||
}, |
||||
"dependencies": { |
||||
}, |
||||
"devDependencies": { |
||||
"@fedor/progress-webpack-plugin": "^1.0.0", |
||||
"@fedor/standard": "^1.0.3", |
||||
"autoprefixer": "^9.1.3", |
||||
"babel-core": "^6.26.3", |
||||
"babel-eslint": "^8.2.6", |
||||
"babel-loader": "^7.1.1", |
||||
"babel-preset-env": "^1.7.0", |
||||
"cross-env": "^5.2.0", |
||||
"css-loader": "^0.28.8", |
||||
"cssnano": "^4.1.0", |
||||
"extract-text-webpack-plugin": "^3.0.2", |
||||
"ghooks": "^2.0.4", |
||||
"globby": "^8.0.1", |
||||
"node-sass": "^4.9.3", |
||||
"optimize-css-assets-webpack-plugin": "3.2.0", |
||||
"postcss-loader": "^3.0.0", |
||||
"rimraf": "^2.6.2", |
||||
"sass-loader": "^7.1.0", |
||||
"uglifyjs-webpack-plugin": "^1.2.7", |
||||
"vue": "^2.5.17", |
||||
"vue-hot-reload-api": "^2.3.0", |
||||
"vue-loader": "^15.4.1", |
||||
"vue-style-loader": "^4.1.1", |
||||
"vue-template-compiler": "^2.5.17", |
||||
"webpack": "^3.12.0", |
||||
"webpack-merge": "^4.1.4" |
||||
}, |
||||
"standard": { |
||||
"parser": "babel-eslint", |
||||
"ignore": [ |
||||
"src/font/*", |
||||
"dist/**", |
||||
"test/coverage/**", |
||||
"karma.conf.js", |
||||
"postcss.config.js" |
||||
] |
||||
}, |
||||
"config": { |
||||
"ghooks": { |
||||
"pre-commit": "npm run lint" |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue