Browse Source

:sparkles: 添加新特性。支持图形化选择 cron

冷冷 6 năm trước cách đây
mục cha
commit
f3bc802c22

+ 9 - 11
src/const/crud/daemon/sysjob.js

@@ -217,13 +217,15 @@ export const tableOption = {
         hide: true,
         addDisplay: false,
         editDisplay: false,
-        rules: [{ validator: (rule, value, callback) => {
-            if(value>9){
-              callback(new Error('请输入1-9数字') );
+        rules: [{
+          validator: (rule, value, callback) => {
+            if (value > 9) {
+              callback(new Error('请输入1-9数字'));
             }
             callback();
 
-          }, trigger: 'blur' }],
+          }, trigger: 'blur'
+        }],
       }
       ,
       {
@@ -283,12 +285,9 @@ export const tableOption = {
       ,
       {
         label: 'cron表达式',
-        prop:
-          'cronExpression',
-        width:
-          100,
-        overHidden:
-          true,
+        prop:'cronExpression',
+        width: 100,
+        formsolt: true,
         rules:
           [{
             required: true,
@@ -296,7 +295,6 @@ export const tableOption = {
             message: '请输入cron表达式',
             trigger: 'blur'
           }, {validator: validateCron, trigger: 'blur'}]
-
       }
       ,
       {

+ 0 - 5
src/const/crud/daemon/sysjoblog.js

@@ -48,11 +48,6 @@ export const tableOption = {
         'get',
       width: 100,
     },
-    {
-      label: '执行路径',
-      prop: 'executePath',
-      overHidden: true,
-    },
     {
       label: '执行文件',
       prop: 'className',

+ 27 - 5
src/views/daemon/jobmanage/index.vue

@@ -3,6 +3,7 @@
     <basic-container>
       <avue-crud ref="crud"
                  :page="page"
+                 v-model="form"
                  :data="tableData"
                  :table-loading="tableLoading"
                  :option="tableOption"
@@ -31,6 +32,17 @@
             <el-tag type="danger">{{getDicNameJobExecuteStatus(scope.row.jobExecuteStatus)}}</el-tag>
           </div>
         </template>
+
+        <template slot="cronExpressionForm" slot-scope="scope">
+          <div class="cron">
+            <el-popover v-model="cronPopover">
+              <cron @change="changeCron" @close="cronPopover=false" i18n="cn"></cron>
+              <el-input slot="reference" @click="cronPopover=true" v-model="form.cronExpression"
+                        placeholder="请输入定时策略"></el-input>
+            </el-popover>
+          </div>
+        </template>
+
         <template slot="menuLeft">
           <el-button type="primary" @click="handleAdd" size="small" v-if="permissions.job_sysjob_add">
             新建任务
@@ -128,11 +140,15 @@
   import {tableLogOption, tableOption} from '@/const/crud/daemon/sysjob'
   import {remote} from '@/api/admin/dict'
   import {mapGetters} from 'vuex'
+  import {cron} from 'vue-cron'
 
   export default {
+    components: {cron},
     name: 'sysmanage',
     data() {
       return {
+        form: {},
+        cronPopover: false,
         queryParams: [],//全局检索条件
         tableData: [],
         tableLogData: [],
@@ -155,9 +171,6 @@
         JobExecuteStatusDicCache: [],
         JobStatusDicCache: [],
       }
-    },
-    created() {
-
     },
     mounted: function () {
       this.getDicJobExecuteStatusCache("job_execute_status");//获取定时任务运行时状态
@@ -167,6 +180,9 @@
       ...mapGetters(['permissions'])
     },
     methods: {
+      changeCron(val) {
+        this.form.cronExpression = val
+      },
       /**
        * 关闭执行日志对话框重置信息
        */
@@ -223,12 +239,12 @@
             startJobRa(row.jobId).then(response => {
               let code = response.data.code;
               if ('0' == code) {
-                this.getList(this.page);
                 this.$notify({
                   title: "成功",
                   message: "启动成功",
                   type: "success"
                 });
+                this.refreshChange()
               }
             }).catch(() => {
               this.$notify.error({
@@ -289,6 +305,7 @@
                   type: "success"
                 });
               }
+              this.refreshChange()
             }).catch(() => {
               this.$notify.error({
                 title: '错误',
@@ -356,6 +373,7 @@
                 message: msg,
                 type: "success"
               });
+              this.refreshChange()
             } else {
               this.$notify.error({
                 title: '错误',
@@ -392,6 +410,7 @@
                 message: '启动成功',
                 type: "success"
               });
+              this.refreshChange()
             } else {
               this.$notify.error({
                 title: '错误',
@@ -428,6 +447,7 @@
                 message: '重置成功',
                 type: "success"
               });
+              this.refreshChange()
             } else {
               this.$notify.error({
                 title: '错误',
@@ -466,8 +486,8 @@
               loading();
             });
           }
-          this.getList(this.page)
           done();
+          this.refreshChange()
         })
       }
       ,
@@ -484,6 +504,7 @@
             type: 'success',
             duration: 2000
           })
+          this.refreshChange()
         }).catch(() => {
           loading();
         });
@@ -508,6 +529,7 @@
               type: 'success',
               duration: 2000
             })
+            this.refreshChange()
           }).catch(function () {
           })
         } else {