sh-view 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +21 -0
- package/README.en.md +36 -0
- package/README.md +39 -0
- package/package.json +64 -0
- package/packages/assets/css/animated.scss +33 -0
- package/packages/assets/css/loader.scss +193 -0
- package/packages/assets/css/main.scss +235 -0
- package/packages/assets/css/theme.scss +52 -0
- package/packages/assets/icons/demo.css +539 -0
- package/packages/assets/icons/iconfont.css +415 -0
- package/packages/assets/icons/iconfont.js +1 -0
- package/packages/assets/icons/iconfont.json +709 -0
- package/packages/assets/icons/iconfont.ttf +0 -0
- package/packages/assets/icons/iconfont.woff +0 -0
- package/packages/assets/icons/iconfont.woff2 +0 -0
- package/packages/assets/img/image-error.png +0 -0
- package/packages/assets/img/square-image.png +0 -0
- package/packages/components/global-components/sh-card/index.vue +122 -0
- package/packages/components/global-components/sh-code-editor/index.vue +237 -0
- package/packages/components/global-components/sh-corner/index.vue +236 -0
- package/packages/components/global-components/sh-count-to/index.vue +46 -0
- package/packages/components/global-components/sh-empty/index.vue +43 -0
- package/packages/components/global-components/sh-header/index.vue +269 -0
- package/packages/components/global-components/sh-icon/icons.vue +32 -0
- package/packages/components/global-components/sh-icon/index.vue +27 -0
- package/packages/components/global-components/sh-iv-form/components/iv-group-item.vue +57 -0
- package/packages/components/global-components/sh-iv-form/components/iv-single-item.vue +76 -0
- package/packages/components/global-components/sh-iv-form/index.vue +255 -0
- package/packages/components/global-components/sh-layout/index.vue +142 -0
- package/packages/components/global-components/sh-loading/index.vue +42 -0
- package/packages/components/global-components/sh-noticebar/index.vue +201 -0
- package/packages/components/global-components/sh-preview/index.vue +62 -0
- package/packages/components/global-components/sh-pull-refresh/index.vue +290 -0
- package/packages/components/global-components/sh-result/index.vue +88 -0
- package/packages/components/global-components/sh-sheet/index.vue +173 -0
- package/packages/components/global-components/sh-upload/components/u-img.vue +63 -0
- package/packages/components/global-components/sh-upload/components/u-list.vue +100 -0
- package/packages/components/global-components/sh-upload/index.vue +418 -0
- package/packages/components/global-components/sh-vxe-form/components/form-item.vue +25 -0
- package/packages/components/global-components/sh-vxe-form/css/index.scss +55 -0
- package/packages/components/global-components/sh-vxe-form/index.vue +115 -0
- package/packages/components/global-components/sh-vxe-form/js/methods.js +170 -0
- package/packages/components/global-components/sh-vxe-form/js/props.js +63 -0
- package/packages/components/global-components/sh-vxe-form/mixin/defaultData.js +33 -0
- package/packages/components/global-components/sh-vxe-list/index.vue +129 -0
- package/packages/components/global-components/sh-vxe-modal/index.vue +209 -0
- package/packages/components/global-components/sh-vxe-query/index.vue +286 -0
- package/packages/components/global-components/sh-vxe-table/components/importModal.vue +377 -0
- package/packages/components/global-components/sh-vxe-table/css/index.scss +94 -0
- package/packages/components/global-components/sh-vxe-table/index.vue +350 -0
- package/packages/components/global-components/sh-vxe-table/js/excel_to_json.js +313 -0
- package/packages/components/global-components/sh-vxe-table/js/methods.js +614 -0
- package/packages/components/global-components/sh-vxe-table/js/props.js +311 -0
- package/packages/components/global-components/sh-vxe-table/mixin/defaultData.js +116 -0
- package/packages/components/global-components/sh-vxe-toolbar/index.vue +172 -0
- package/packages/components/global-components/sh-vxe-tree/components/table-tree.vue +251 -0
- package/packages/components/global-components/sh-vxe-tree/css/index.scss +20 -0
- package/packages/components/global-components/sh-vxe-tree/index.vue +85 -0
- package/packages/components/global-components/sh-vxe-tree/js/props.js +120 -0
- package/packages/components/global-components/sh-vxe-tree/js/treeMethods.js +171 -0
- package/packages/components/global-components/sh-vxe-tree/mixin/defaultData.js +48 -0
- package/packages/components/global-components/sh-vxe-tree/vxe-direct-tree.vue +202 -0
- package/packages/components/global-components/sh-vxe-tree/vxe-select-tree.vue +291 -0
- package/packages/components/global-components/sh-water-fall/index.vue +87 -0
- package/packages/components/global-components/sh-word/index.vue +110 -0
- package/packages/components/index.js +64 -0
- package/packages/components/other-components/sh-cron-modal/components/cron-content.vue +287 -0
- package/packages/components/other-components/sh-cron-modal/css/index.scss +45 -0
- package/packages/components/other-components/sh-cron-modal/index.vue +67 -0
- package/packages/components/other-components/sh-cron-modal/mixin/cron-box.js +169 -0
- package/packages/components/other-components/sh-cron-modal/tabs/cron-day-box.vue +92 -0
- package/packages/components/other-components/sh-cron-modal/tabs/cron-hour-box.vue +56 -0
- package/packages/components/other-components/sh-cron-modal/tabs/cron-minute-box.vue +56 -0
- package/packages/components/other-components/sh-cron-modal/tabs/cron-month-box.vue +56 -0
- package/packages/components/other-components/sh-cron-modal/tabs/cron-second-box.vue +56 -0
- package/packages/components/other-components/sh-cron-modal/tabs/cron-week-box.vue +115 -0
- package/packages/components/other-components/sh-cron-modal/tabs/cron-year-box.vue +46 -0
- package/packages/components/other-components/sh-cron-modal/utils/index.js +52 -0
- package/packages/components/other-components/sh-markdown/index.vue +170 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/ar.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/az.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/bg_BG.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/bn_BD.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/ca.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/cs.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/cy.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/da.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/de.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/dv.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/el.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/eo.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/es.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/es_MX.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/et.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/eu.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/fa.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/fi.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/fr_FR.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/ga.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/gl.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/he_IL.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/hi.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/hr.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/hu_HU.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/hy.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/id.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/is_IS.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/it.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/ja.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/kab.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/kk.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/ko_KR.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/ku.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/lt.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/lv.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/nb_NO.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/ne.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/nl.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/nl_BE.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/oc.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/pl.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/pt_BR.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/ro.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/ru.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/sk.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/sl_SI.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/sq.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/sr.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/sv_SE.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/ta.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/tg.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/th_TH.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/tr.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/ug.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/uk.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/vi.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/langs/zh-Hans.js +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/dark/content.css +72 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/dark/content.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/default/content.css +67 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/default/content.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/document/content.css +72 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/document/content.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/writer/content.css +68 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/content/writer/content.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/content.css +732 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/content.inline.css +726 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/content.inline.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/content.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/content.mobile.css +29 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/content.mobile.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/skin.css +3047 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/skin.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/skin.mobile.css +673 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/skin.mobile.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/skin.shadowdom.css +37 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide/skin.shadowdom.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.css +714 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.inline.css +726 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.inline.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.mobile.css +29 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/content.mobile.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff +0 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.css +3047 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.mobile.css +673 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.mobile.min.css +7 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +37 -0
- package/packages/components/other-components/sh-markdown/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +7 -0
- package/packages/components/other-components/sh-menu-card/index.vue +224 -0
- package/packages/components/other-components/sh-menu-card/menu-box.vue +68 -0
- package/packages/components/other-components/sh-system-tip/index.vue +113 -0
- package/packages/css/index.js +6 -0
- package/packages/directive/directives.js +27 -0
- package/packages/directive/index.js +19 -0
- package/packages/directive/module/draggable.js +42 -0
- package/packages/index.js +40 -0
- package/packages/iview/css/index.scss +32 -0
- package/packages/iview/index.js +24 -0
- package/packages/mixin/index.js +87 -0
- package/packages/vxeTable/css/index.scss +454 -0
- package/packages/vxeTable/css/variable.scss +256 -0
- package/packages/vxeTable/index.js +178 -0
- package/packages/vxeTable/render/cell/vxe-render-checkbox.vue +19 -0
- package/packages/vxeTable/render/cell/vxe-render-checkgroup.vue +36 -0
- package/packages/vxeTable/render/cell/vxe-render-code.vue +19 -0
- package/packages/vxeTable/render/cell/vxe-render-goption.vue +93 -0
- package/packages/vxeTable/render/cell/vxe-render-href.vue +11 -0
- package/packages/vxeTable/render/cell/vxe-render-img.vue +28 -0
- package/packages/vxeTable/render/cell/vxe-render-input.vue +51 -0
- package/packages/vxeTable/render/cell/vxe-render-money.vue +25 -0
- package/packages/vxeTable/render/cell/vxe-render-progress.vue +19 -0
- package/packages/vxeTable/render/cell/vxe-render-radio.vue +19 -0
- package/packages/vxeTable/render/cell/vxe-render-radiogroup.vue +36 -0
- package/packages/vxeTable/render/cell/vxe-render-select.vue +36 -0
- package/packages/vxeTable/render/cell/vxe-render-switch.vue +19 -0
- package/packages/vxeTable/render/cell/vxe-render-table.vue +78 -0
- package/packages/vxeTable/render/cell/vxe-render-textarea.vue +19 -0
- package/packages/vxeTable/render/cell/vxe-render-time.vue +34 -0
- package/packages/vxeTable/render/cell/vxe-render-tree.vue +59 -0
- package/packages/vxeTable/render/cell/vxe-render-upload.vue +24 -0
- package/packages/vxeTable/render/filters/vxe-filter-input.vue +43 -0
- package/packages/vxeTable/render/footer/vxe-footer-input.vue +13 -0
- package/packages/vxeTable/render/footer/vxe-footer-money.vue +20 -0
- package/packages/vxeTable/render/globalRenders.js +491 -0
- package/packages/vxeTable/render/header/vxe-header-money.vue +21 -0
- package/packages/vxeTable/render/mixin/cell-mixin.js +195 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// 全局公共封装组件
|
|
2
|
+
import ShCard from './global-components/sh-card'
|
|
3
|
+
import ShCodeEditor from './global-components/sh-code-editor'
|
|
4
|
+
import ShCorner from './global-components/sh-corner'
|
|
5
|
+
import ShCountTo from './global-components/sh-count-to'
|
|
6
|
+
import ShEmpty from './global-components/sh-empty'
|
|
7
|
+
import ShHeader from './global-components/sh-header'
|
|
8
|
+
import ShIcon from './global-components/sh-icon'
|
|
9
|
+
import ShIvForm from './global-components/sh-iv-form'
|
|
10
|
+
import ShLayout from './global-components/sh-layout'
|
|
11
|
+
import ShLoading from './global-components/sh-loading'
|
|
12
|
+
import ShNoticeBar from './global-components/sh-noticebar'
|
|
13
|
+
import ShPreview from './global-components/sh-preview'
|
|
14
|
+
import ShPullRefresh from './global-components/sh-pull-refresh'
|
|
15
|
+
import ShResult from './global-components/sh-result'
|
|
16
|
+
import ShSheet from './global-components/sh-sheet'
|
|
17
|
+
import ShUpload from './global-components/sh-upload'
|
|
18
|
+
import ShForm from './global-components/sh-vxe-form'
|
|
19
|
+
import ShList from './global-components/sh-vxe-list'
|
|
20
|
+
import ShModal from './global-components/sh-vxe-modal'
|
|
21
|
+
import ShQuery from './global-components/sh-vxe-query'
|
|
22
|
+
import ShTable from './global-components/sh-vxe-table'
|
|
23
|
+
import ShToolbar from './global-components/sh-vxe-toolbar'
|
|
24
|
+
import ShTree from './global-components/sh-vxe-tree'
|
|
25
|
+
import ShWaterFall from './global-components/sh-water-fall'
|
|
26
|
+
import ShWord from './global-components/sh-word'
|
|
27
|
+
|
|
28
|
+
const components = {
|
|
29
|
+
ShCard,
|
|
30
|
+
ShCodeEditor,
|
|
31
|
+
ShCorner,
|
|
32
|
+
ShCountTo,
|
|
33
|
+
ShEmpty,
|
|
34
|
+
ShHeader,
|
|
35
|
+
ShIcon,
|
|
36
|
+
ShIvForm,
|
|
37
|
+
ShLayout,
|
|
38
|
+
ShLoading,
|
|
39
|
+
ShNoticeBar,
|
|
40
|
+
ShPreview,
|
|
41
|
+
ShPullRefresh,
|
|
42
|
+
ShResult,
|
|
43
|
+
ShSheet,
|
|
44
|
+
ShUpload,
|
|
45
|
+
ShForm,
|
|
46
|
+
ShList,
|
|
47
|
+
ShModal,
|
|
48
|
+
ShQuery,
|
|
49
|
+
ShTable,
|
|
50
|
+
ShToolbar,
|
|
51
|
+
ShTree,
|
|
52
|
+
ShWaterFall,
|
|
53
|
+
ShWord
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const index = {
|
|
57
|
+
install: function (Vue) {
|
|
58
|
+
Object.keys(components).forEach(key => {
|
|
59
|
+
Vue.component(key, components[key])
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default index
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sh-cron-content">
|
|
3
|
+
<Tabs v-model="activeKey" :size="`small`">
|
|
4
|
+
<template v-for="tab in cronTabList" :key="tab.name">
|
|
5
|
+
<TabPane v-bind="tab"></TabPane>
|
|
6
|
+
</template>
|
|
7
|
+
</Tabs>
|
|
8
|
+
<template v-if="activeKey === 'second'">
|
|
9
|
+
<cronSecondBox v-model="second" :disabled="disabled" />
|
|
10
|
+
</template>
|
|
11
|
+
<template v-else-if="activeKey === 'minute'">
|
|
12
|
+
<cronMinuteBox v-model="minute" :disabled="disabled" />
|
|
13
|
+
</template>
|
|
14
|
+
<template v-else-if="activeKey === 'hour'">
|
|
15
|
+
<cronHourBox v-model="hour" :disabled="disabled" />
|
|
16
|
+
</template>
|
|
17
|
+
<template v-else-if="activeKey === 'day'">
|
|
18
|
+
<cronDayBox v-model="day" :week="week" :disabled="disabled" />
|
|
19
|
+
</template>
|
|
20
|
+
<template v-else-if="activeKey === 'month'">
|
|
21
|
+
<cronMonthBox v-model="month" :disabled="disabled" />
|
|
22
|
+
</template>
|
|
23
|
+
<template v-else-if="activeKey === 'week'">
|
|
24
|
+
<cronWeekBox v-model="week" :day="day" :disabled="disabled" />
|
|
25
|
+
</template>
|
|
26
|
+
<template v-else-if="activeKey === 'year'">
|
|
27
|
+
<cronYearBox v-model="year" :disabled="disabled" />
|
|
28
|
+
</template>
|
|
29
|
+
<!-- 执行时间预览 -->
|
|
30
|
+
<vxe-grid v-bind="tableConfig" @edit-closed="onTableEditClosed" @header-cell-click="onTableHeaderClick">
|
|
31
|
+
<template #bottom>
|
|
32
|
+
<!-- cron错误提示 -->
|
|
33
|
+
<Alert v-if="errMessage" type="error" show-icon>
|
|
34
|
+
<span>表达式错误,请检查</span>
|
|
35
|
+
<template #desc>{{ errMessage }}</template>
|
|
36
|
+
</Alert>
|
|
37
|
+
<template v-else>
|
|
38
|
+
<div class="cron-title">近十次执行时间(不含年)</div>
|
|
39
|
+
<vxe-textarea v-model="preTimeList" :rows="5" disabled />
|
|
40
|
+
</template>
|
|
41
|
+
</template>
|
|
42
|
+
</vxe-grid>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
import cronSecondBox from '../tabs/cron-second-box.vue'
|
|
48
|
+
import cronMinuteBox from '../tabs/cron-minute-box.vue'
|
|
49
|
+
import cronHourBox from '../tabs/cron-hour-box.vue'
|
|
50
|
+
import cronDayBox from '../tabs/cron-day-box.vue'
|
|
51
|
+
import cronMonthBox from '../tabs/cron-month-box.vue'
|
|
52
|
+
import cronWeekBox from '../tabs/cron-week-box.vue'
|
|
53
|
+
import cronYearBox from '../tabs/cron-year-box.vue'
|
|
54
|
+
import cronUtils from '../utils'
|
|
55
|
+
export default {
|
|
56
|
+
name: 'CronContent',
|
|
57
|
+
components: {
|
|
58
|
+
cronSecondBox,
|
|
59
|
+
cronMinuteBox,
|
|
60
|
+
cronHourBox,
|
|
61
|
+
cronDayBox,
|
|
62
|
+
cronMonthBox,
|
|
63
|
+
cronWeekBox,
|
|
64
|
+
cronYearBox
|
|
65
|
+
},
|
|
66
|
+
props: {
|
|
67
|
+
modelValue: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: ''
|
|
70
|
+
},
|
|
71
|
+
disabled: {
|
|
72
|
+
type: Boolean
|
|
73
|
+
},
|
|
74
|
+
hideSecond: {
|
|
75
|
+
type: Boolean
|
|
76
|
+
},
|
|
77
|
+
hideYear: {
|
|
78
|
+
type: Boolean
|
|
79
|
+
},
|
|
80
|
+
remote: {
|
|
81
|
+
type: Function
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
emits: ['update:modelValue', 'change'],
|
|
85
|
+
data() {
|
|
86
|
+
return {
|
|
87
|
+
activeKey: this.hideSecond ? 'minute' : 'second',
|
|
88
|
+
second: '*',
|
|
89
|
+
minute: '*',
|
|
90
|
+
hour: '*',
|
|
91
|
+
day: '*',
|
|
92
|
+
month: '*',
|
|
93
|
+
week: '?',
|
|
94
|
+
year: '*',
|
|
95
|
+
tableConfig: {
|
|
96
|
+
align: 'center',
|
|
97
|
+
columns: [
|
|
98
|
+
{ title: '秒', field: 'second', editRender: { name: '$input' } },
|
|
99
|
+
{ title: '分', field: 'minute', editRender: { name: '$input' } },
|
|
100
|
+
{ title: '时', field: 'hour', editRender: { name: '$input' } },
|
|
101
|
+
{ title: '日', field: 'day', editRender: { name: '$input' } },
|
|
102
|
+
{ title: '月', field: 'month', editRender: { name: '$input' } },
|
|
103
|
+
{ title: '周', field: 'week', editRender: { name: '$input' } },
|
|
104
|
+
{ title: '年', field: 'year', editRender: { name: '$input' } }
|
|
105
|
+
],
|
|
106
|
+
data: [],
|
|
107
|
+
editConfig: {
|
|
108
|
+
enable: !this.disabled
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
preTimeList: '执行预览,会忽略年份参数。',
|
|
112
|
+
errMessage: '',
|
|
113
|
+
calTriggerList: this.$vUtils.debounce(this.calTriggerListInner, 500)
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
computed: {
|
|
117
|
+
cronTabList() {
|
|
118
|
+
let list = [
|
|
119
|
+
{ name: 'second', label: '秒' },
|
|
120
|
+
{ name: 'minute', label: '分' },
|
|
121
|
+
{ name: 'hour', label: '时' },
|
|
122
|
+
{ name: 'day', label: '日' },
|
|
123
|
+
{ name: 'month', label: '月' },
|
|
124
|
+
{ name: 'week', label: '周' },
|
|
125
|
+
{ name: 'year', label: '年' }
|
|
126
|
+
]
|
|
127
|
+
if (this.hideSecond) {
|
|
128
|
+
list = list.filter(item => !['second', 'year'].includes(item.name))
|
|
129
|
+
} else if (this.hideYear) {
|
|
130
|
+
list = list.filter(item => !['year'].includes(item.name))
|
|
131
|
+
}
|
|
132
|
+
return list
|
|
133
|
+
},
|
|
134
|
+
cronValueInner() {
|
|
135
|
+
let { hideSecond, hideYear, second, minute, hour, day, month, week, year } = this
|
|
136
|
+
let result = []
|
|
137
|
+
if (!hideSecond) {
|
|
138
|
+
result.push(second ? second : '*')
|
|
139
|
+
}
|
|
140
|
+
result.push(minute ? minute : '*')
|
|
141
|
+
result.push(hour ? hour : '*')
|
|
142
|
+
result.push(day ? day : '*')
|
|
143
|
+
result.push(month ? month : '*')
|
|
144
|
+
result.push(week ? week : '?')
|
|
145
|
+
if (!hideYear && !hideSecond) result.push(year ? year : '*')
|
|
146
|
+
return result.join(' ')
|
|
147
|
+
},
|
|
148
|
+
cronValueNoYear() {
|
|
149
|
+
const v = this.cronValueInner
|
|
150
|
+
if (this.hideYear || this.hideSecond) return v
|
|
151
|
+
const vs = v.split(' ')
|
|
152
|
+
if (vs.length >= 6) {
|
|
153
|
+
// 转成 Quartz 的规则
|
|
154
|
+
vs[5] = this.convertWeekToQuartz(vs[5])
|
|
155
|
+
}
|
|
156
|
+
return vs.slice(0, vs.length - 1).join(' ')
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
watch: {
|
|
160
|
+
modelValue(nv) {
|
|
161
|
+
if (nv === this.cronValueInner) {
|
|
162
|
+
return
|
|
163
|
+
}
|
|
164
|
+
this.formatValue()
|
|
165
|
+
},
|
|
166
|
+
cronValueInner(nv) {
|
|
167
|
+
this.calTriggerList()
|
|
168
|
+
this.emitValue(nv)
|
|
169
|
+
this.assignTable()
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
created() {
|
|
173
|
+
this.assignTable()
|
|
174
|
+
this.formatValue()
|
|
175
|
+
this.calTriggerListInner()
|
|
176
|
+
},
|
|
177
|
+
methods: {
|
|
178
|
+
formatValue() {
|
|
179
|
+
let { modelValue, hideSecond } = this
|
|
180
|
+
if (!modelValue) return
|
|
181
|
+
const values = modelValue.split(' ').filter(item => !!item)
|
|
182
|
+
if (!values || values.length <= 0) return
|
|
183
|
+
let i = 0
|
|
184
|
+
if (!hideSecond) this.second = values[i++]
|
|
185
|
+
if (values.length > i) this.minute = values[i++]
|
|
186
|
+
if (values.length > i) this.hour = values[i++]
|
|
187
|
+
if (values.length > i) this.day = values[i++]
|
|
188
|
+
if (values.length > i) this.month = values[i++]
|
|
189
|
+
if (values.length > i) this.week = values[i++]
|
|
190
|
+
if (values.length > i) this.year = values[i]
|
|
191
|
+
this.assignTable()
|
|
192
|
+
},
|
|
193
|
+
assignTable() {
|
|
194
|
+
this.tableConfig.data = [
|
|
195
|
+
{
|
|
196
|
+
second: this.second,
|
|
197
|
+
minute: this.minute,
|
|
198
|
+
hour: this.hour,
|
|
199
|
+
day: this.day,
|
|
200
|
+
month: this.month,
|
|
201
|
+
week: this.week,
|
|
202
|
+
year: this.year
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
calTriggerListInner() {
|
|
207
|
+
this.errMessage = ''
|
|
208
|
+
// 设置了回调函数
|
|
209
|
+
if (this.remote) {
|
|
210
|
+
this.remote(this.cronValueInner, +new Date(), v => {
|
|
211
|
+
this.preTimeList = v
|
|
212
|
+
})
|
|
213
|
+
return
|
|
214
|
+
}
|
|
215
|
+
try {
|
|
216
|
+
const format = 'yyyy-MM-dd hh:mm:ss'
|
|
217
|
+
const options = {
|
|
218
|
+
currentDate: this.$vUtils.toDateString(new Date(), format)
|
|
219
|
+
}
|
|
220
|
+
const iter = cronUtils.parse(this.cronValueNoYear, options)
|
|
221
|
+
const result = []
|
|
222
|
+
for (let i = 1; i <= 10; i++) {
|
|
223
|
+
result.push(this.$vUtils.toDateString(new Date(iter.next()), format))
|
|
224
|
+
}
|
|
225
|
+
this.preTimeList = result.length > 0 ? result.join('\n') : '无执行时间'
|
|
226
|
+
} catch (e) {
|
|
227
|
+
this.errMessage = e
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
// Quartz 的规则:
|
|
231
|
+
// 1 = 周日,2 = 周一,3 = 周二,4 = 周三,5 = 周四,6 = 周五,7 = 周六
|
|
232
|
+
convertWeekToQuartz(week) {
|
|
233
|
+
let convert = v => {
|
|
234
|
+
if (v === '0') {
|
|
235
|
+
return '1'
|
|
236
|
+
}
|
|
237
|
+
if (v === '1') {
|
|
238
|
+
return '0'
|
|
239
|
+
}
|
|
240
|
+
return (Number.parseInt(v) - 1).toString()
|
|
241
|
+
}
|
|
242
|
+
// 匹配示例 1-7 or 1/7
|
|
243
|
+
let patten1 = /^([0-7])([-/])([0-7])$/
|
|
244
|
+
// 匹配示例 1,4,7
|
|
245
|
+
let patten2 = /^([0-7])(,[0-7])+$/
|
|
246
|
+
if (/^[0-7]$/.test(week)) {
|
|
247
|
+
return convert(week)
|
|
248
|
+
} else if (patten1.test(week)) {
|
|
249
|
+
return week.replace(patten1, ($0, before, separator, after) => {
|
|
250
|
+
if (separator === '/') {
|
|
251
|
+
return convert(before) + separator + after
|
|
252
|
+
} else {
|
|
253
|
+
return convert(before) + separator + convert(after)
|
|
254
|
+
}
|
|
255
|
+
})
|
|
256
|
+
} else if (patten2.test(week)) {
|
|
257
|
+
return week
|
|
258
|
+
.split(',')
|
|
259
|
+
.map(v => convert(v))
|
|
260
|
+
.join(',')
|
|
261
|
+
}
|
|
262
|
+
return week
|
|
263
|
+
},
|
|
264
|
+
onTableHeaderClick({ column }) {
|
|
265
|
+
this.activeKey = column.property
|
|
266
|
+
},
|
|
267
|
+
onTableEditClosed({ row, column }) {
|
|
268
|
+
this.second = row.second
|
|
269
|
+
this.minute = row.minute
|
|
270
|
+
this.hour = row.hour
|
|
271
|
+
this.day = row.day
|
|
272
|
+
this.month = row.month
|
|
273
|
+
this.week = row.week
|
|
274
|
+
this.year = row.year
|
|
275
|
+
},
|
|
276
|
+
onInputCronBlur(event) {
|
|
277
|
+
this.emitValue(event.target.value)
|
|
278
|
+
},
|
|
279
|
+
emitValue(value) {
|
|
280
|
+
this.$emit('change', value)
|
|
281
|
+
this.$emit('update:modelValue', value)
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
</script>
|
|
286
|
+
|
|
287
|
+
<style scoped></style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.sh-cron-content {
|
|
2
|
+
.ivu-tabs{
|
|
3
|
+
.ivu-tabs-bar{
|
|
4
|
+
margin-bottom: 5px;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
.sh-cron-config-list{
|
|
8
|
+
text-align: left;
|
|
9
|
+
margin: 0 10px 10px 10px;
|
|
10
|
+
.item {
|
|
11
|
+
margin-top: 5px;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
font-size: var(--font-size-base);
|
|
15
|
+
.choice{
|
|
16
|
+
padding: 5px 8px;
|
|
17
|
+
margin-right: 10px;
|
|
18
|
+
}
|
|
19
|
+
.cron-item-input{
|
|
20
|
+
width: 70px;
|
|
21
|
+
margin: 0 5px;
|
|
22
|
+
}
|
|
23
|
+
.list {
|
|
24
|
+
}
|
|
25
|
+
.list-check-item {
|
|
26
|
+
padding: 1px 3px;
|
|
27
|
+
width: 4em;
|
|
28
|
+
margin: 0;
|
|
29
|
+
}
|
|
30
|
+
.list-cn .list-check-item {
|
|
31
|
+
width: 5em;
|
|
32
|
+
}
|
|
33
|
+
.tip-info{
|
|
34
|
+
color: #999;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
.cron-title{
|
|
39
|
+
font-weight: bold;
|
|
40
|
+
border-left: 3px solid var(--theme-color);
|
|
41
|
+
padding: 0 5px;
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
margin: 10px 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sh-modal v-bind="modalConfig" @close="onModalClose" @confirm="onModalConfim">
|
|
3
|
+
<cron-content v-model="cronValue" :disabled="disabled"></cron-content>
|
|
4
|
+
</sh-modal>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import cronContent from './components/cron-content.vue'
|
|
9
|
+
export default {
|
|
10
|
+
name: 'ShCronModal',
|
|
11
|
+
components: {
|
|
12
|
+
cronContent
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
modelValue: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: ''
|
|
18
|
+
},
|
|
19
|
+
visible: {
|
|
20
|
+
type: Boolean
|
|
21
|
+
},
|
|
22
|
+
disabled: {
|
|
23
|
+
type: Boolean
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
emits: ['update:modelValue', 'update:visible', 'submit'],
|
|
27
|
+
data() {
|
|
28
|
+
return {
|
|
29
|
+
cronValue: '',
|
|
30
|
+
modalConfig: {
|
|
31
|
+
loading: false,
|
|
32
|
+
width: '70%',
|
|
33
|
+
title: 'cron表达式',
|
|
34
|
+
visible: this.visible
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
watch: {
|
|
39
|
+
modelValue(nv) {
|
|
40
|
+
this.cronValue = this.modelValue
|
|
41
|
+
},
|
|
42
|
+
visible() {
|
|
43
|
+
this.modalConfig.visible = this.visible
|
|
44
|
+
this.cronValue = this.modelValue
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
methods: {
|
|
48
|
+
emitValue() {
|
|
49
|
+
this.$emit('update:modelValue', this.cronValue)
|
|
50
|
+
this.$emit('submit', this.cronValue)
|
|
51
|
+
},
|
|
52
|
+
// 提交
|
|
53
|
+
async onModalConfim() {
|
|
54
|
+
this.emitValue()
|
|
55
|
+
this.onModalClose()
|
|
56
|
+
},
|
|
57
|
+
// 关闭
|
|
58
|
+
onModalClose() {
|
|
59
|
+
this.$emit('update:visible', false)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<style lang="scss">
|
|
66
|
+
@import './css/index.scss';
|
|
67
|
+
</style>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
const TypeEnum = {
|
|
2
|
+
unset: 'UNSET',
|
|
3
|
+
every: 'EVERY',
|
|
4
|
+
range: 'RANGE',
|
|
5
|
+
loop: 'LOOP',
|
|
6
|
+
work: 'WORK',
|
|
7
|
+
last: 'LAST',
|
|
8
|
+
specify: 'SPECIFY'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
props: {
|
|
13
|
+
modelValue: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: '*'
|
|
16
|
+
},
|
|
17
|
+
disabled: {
|
|
18
|
+
type: Boolean
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
emits: ['update:modelValue', 'change'],
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
TypeEnum: TypeEnum,
|
|
25
|
+
type: TypeEnum.every,
|
|
26
|
+
valueList: [],
|
|
27
|
+
valueWork: ''
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
computed: {
|
|
31
|
+
beforeRadioAttrs() {
|
|
32
|
+
return {
|
|
33
|
+
class: ['choice'],
|
|
34
|
+
disabled: this.disabled
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
inputNumberAttrs() {
|
|
38
|
+
return {
|
|
39
|
+
class: ['cron-item-input'],
|
|
40
|
+
type: 'integer',
|
|
41
|
+
size: 'mini'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
typeRangeAttrs() {
|
|
45
|
+
return {
|
|
46
|
+
...this.inputNumberAttrs,
|
|
47
|
+
disabled: this.type !== TypeEnum.range || this.disabled
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
typeLoopAttrs() {
|
|
51
|
+
return {
|
|
52
|
+
...this.inputNumberAttrs,
|
|
53
|
+
disabled: this.type !== TypeEnum.loop || this.disabled
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
typeSpecifyAttrs() {
|
|
57
|
+
return {
|
|
58
|
+
class: ['list-check-item'],
|
|
59
|
+
disabled: this.type !== TypeEnum.specify || this.disabled
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
specifyRange() {
|
|
63
|
+
const { minValue, maxValue } = this
|
|
64
|
+
let range = []
|
|
65
|
+
if (maxValue != null) {
|
|
66
|
+
for (let i = minValue; i <= maxValue; i++) {
|
|
67
|
+
range.push(i)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return range
|
|
71
|
+
},
|
|
72
|
+
// 根据不同的类型计算出的value
|
|
73
|
+
computeValue() {
|
|
74
|
+
let { defaultValue, type, valueRange, valueLoop, valueWork, valueList, minValue } = this
|
|
75
|
+
let valueArray = []
|
|
76
|
+
switch (type) {
|
|
77
|
+
case TypeEnum.unset:
|
|
78
|
+
valueArray.push('?')
|
|
79
|
+
break
|
|
80
|
+
case TypeEnum.every:
|
|
81
|
+
valueArray.push('*')
|
|
82
|
+
break
|
|
83
|
+
case TypeEnum.range:
|
|
84
|
+
valueArray.push(`${valueRange.start}-${valueRange.end}`)
|
|
85
|
+
break
|
|
86
|
+
case TypeEnum.loop:
|
|
87
|
+
valueArray.push(`${valueLoop.start}/${valueLoop.interval}`)
|
|
88
|
+
break
|
|
89
|
+
case TypeEnum.work:
|
|
90
|
+
valueArray.push(`${valueWork}W`)
|
|
91
|
+
break
|
|
92
|
+
case TypeEnum.last:
|
|
93
|
+
valueArray.push('L')
|
|
94
|
+
break
|
|
95
|
+
case TypeEnum.specify:
|
|
96
|
+
if (valueList.length === 0) {
|
|
97
|
+
valueList.push(minValue)
|
|
98
|
+
}
|
|
99
|
+
valueArray.push(valueList.join(','))
|
|
100
|
+
break
|
|
101
|
+
default:
|
|
102
|
+
valueArray.push(defaultValue)
|
|
103
|
+
break
|
|
104
|
+
}
|
|
105
|
+
return valueArray.length > 0 ? valueArray.join('') : defaultValue
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
methods: {
|
|
109
|
+
parseValue(value) {
|
|
110
|
+
let { computeValue, defaultValue } = this
|
|
111
|
+
if (value === computeValue) {
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
if (!value || value === defaultValue) {
|
|
116
|
+
this.type = TypeEnum.every
|
|
117
|
+
} else if (value.indexOf('?') >= 0) {
|
|
118
|
+
this.type = TypeEnum.unset
|
|
119
|
+
} else if (value.indexOf('-') >= 0) {
|
|
120
|
+
this.type = TypeEnum.range
|
|
121
|
+
const values = value.split('-')
|
|
122
|
+
if (values.length >= 2) {
|
|
123
|
+
this.valueRange.start = parseInt(values[0])
|
|
124
|
+
this.valueRange.end = parseInt(values[1])
|
|
125
|
+
}
|
|
126
|
+
} else if (value.indexOf('/') >= 0) {
|
|
127
|
+
this.type = TypeEnum.loop
|
|
128
|
+
const values = value.split('/')
|
|
129
|
+
if (values.length >= 2) {
|
|
130
|
+
this.valueLoop.start = value[0] === '*' ? 0 : parseInt(values[0])
|
|
131
|
+
this.valueLoop.interval = parseInt(values[1])
|
|
132
|
+
}
|
|
133
|
+
} else if (value.indexOf('W') >= 0) {
|
|
134
|
+
this.type = TypeEnum.work
|
|
135
|
+
const values = value.split('W')
|
|
136
|
+
if (!values[0] && !isNaN(values[0])) {
|
|
137
|
+
this.valueWork = parseInt(values[0])
|
|
138
|
+
}
|
|
139
|
+
} else if (value.indexOf('L') >= 0) {
|
|
140
|
+
this.type = TypeEnum.last
|
|
141
|
+
} else if (value.indexOf(',') >= 0 || !isNaN(value)) {
|
|
142
|
+
this.type = TypeEnum.specify
|
|
143
|
+
this.valueList = value.split(',').map(item => parseInt(item))
|
|
144
|
+
} else {
|
|
145
|
+
this.type = TypeEnum.every
|
|
146
|
+
}
|
|
147
|
+
} catch (e) {
|
|
148
|
+
this.type = TypeEnum.every
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
updateValue(value) {
|
|
152
|
+
this.$emit('change', value)
|
|
153
|
+
this.$emit('update:modelValue', value)
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
watch: {
|
|
157
|
+
modelValue: {
|
|
158
|
+
handler(val) {
|
|
159
|
+
if (val !== this.computeValue) {
|
|
160
|
+
this.parseValue(val)
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
immediate: true
|
|
164
|
+
},
|
|
165
|
+
computeValue(v) {
|
|
166
|
+
this.updateValue(v)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|