فهرست منبع

:recycle: Refactoring code.refactor daemon

lishangbu 6 سال پیش
والد
کامیت
1c150b7d6f

+ 6 - 12
src/api/daemon/sys-job.js

@@ -40,14 +40,14 @@ export function refreshJobsRa() {
 export function startJobRa(jobId) {
   return request({
     url: '/job/sys-job/start-job/' + jobId,
-    method: 'get'
+    method: 'post'
   })
 }
 
 export function shutDownJobRa(jobId) {
   return request({
     url: '/job/sys-job/shutdown-job/' + jobId,
-    method: 'get'
+    method: 'post'
   })
 }
 
@@ -81,16 +81,10 @@ export function putObj(obj) {
   })
 }
 
-export function isValidCron(obj) {
-  return request({
-    url: "/job/sys-job/is-valid-cron?cronExpression=" + obj,
-    method: 'post',
-  })
-}
-
-export function isValidTaskName(jobName, jobGroup) {
+export function isValidTaskName(query) {
   return request({
-    url: "/job/sys-job/is-valid-task-name?jobName=" + jobName + "&jobGroup=" + jobGroup,
-    method: 'post',
+    url: '/job/sys-job/is-valid-task-name',
+    method: 'get',
+    params: query
   })
 }

+ 0 - 1
src/const/crud/daemon/execution-log.js

@@ -34,7 +34,6 @@ export const tableOption = {
   menuAlign: 'center',
   align: 'center',
   editBtn: false,
-  delBtn: false,
   addBtn: false,
   viewBtn: true,
   column: [

+ 1 - 3
src/const/crud/daemon/sys-job.js

@@ -1,5 +1,3 @@
-import {isValidCron} from '@/api/daemon/sys-job'
-
 export const tableOption = {
     border: true,
     card: true,
@@ -10,7 +8,7 @@ export const tableOption = {
     menuAlign: 'center',
     filterBtn: false,
     menuWidth: 300,
-    align: 'left',
+    align: 'center',
     viewBtn: false,
     editBtn: false,
     delBtn: false,

+ 9 - 66
src/views/daemon/execution-log/index.vue

@@ -23,21 +23,10 @@
                  :data="tableData"
                  :table-loading="tableLoading"
                  :option="tableOption"
+                 :permission="permissionList"
                  @on-load="getList"
                  @refresh-change="refreshChange"
-                 @row-update="handleUpdate"
-                 @row-save="handleSave"
-                 @row-del="rowDel">
-        <template slot-scope="scope"
-                  slot="menu">
-          <el-button type="text"
-                     v-if="permissions.daemon_execution_log_del"
-                     icon="el-icon-delete"
-                     size="small"
-                     plain
-                     @click="handleDel(scope.row,scope.index)">删除
-          </el-button>
-        </template>
+                 @row-del="handleDel">
       </avue-crud>
     </basic-container>
   </div>
@@ -68,7 +57,12 @@
     mounted: function () {
     },
     computed: {
-      ...mapGetters(['permissions'])
+      ...mapGetters(['permissions']),
+      permissionList() {
+        return {
+          delBtn: this.vaildData(this.permissions.daemon_execution_log_del, false),
+        };
+      }
     },
     methods: {
       getList(page, params = {}) {
@@ -83,21 +77,7 @@
           this.tableLoading = false
         })
       },
-      /**
-       * @title 打开新增窗口
-       * @detail 调用crud的handleadd方法即可
-       *
-       **/
-      handleAdd: function () {
-        this.$refs.crud.rowAdd()
-      },
-      handleEdit(row, index) {
-        this.$refs.crud.rowEdit(row, index)
-      },
-      handleDel(row, index) {
-        this.$refs.crud.rowDel(row, index)
-      },
-      rowDel: function (row, index) {
+      handleDel: function (row, index) {
         var _this = this
         this.$confirm('是否确认删除ID为' + row.id, '提示', {
           confirmButtonText: '确定',
@@ -116,43 +96,6 @@
         }).catch(function (err) {
         })
       },
-      /**
-       * @title 数据更新
-       * @param row 为当前的数据
-       * @param index 为当前更新数据的行数
-       * @param done 为表单关闭函数
-       *
-       **/
-      handleUpdate: function (row, index, done) {
-        putObj(row).then(data => {
-          this.tableData.splice(index, 1, Object.assign({}, row))
-          this.$message({
-            showClose: true,
-            message: '修改成功',
-            type: 'success'
-          })
-          done()
-          this.getList(this.page)
-        })
-      },
-      /**
-       * @title 数据添加
-       * @param row 为当前的数据
-       * @param done 为表单关闭函数
-       *
-       **/
-      handleSave: function (row, done) {
-        addObj(row).then(data => {
-          this.tableData.push(Object.assign({}, row))
-          this.$message({
-            showClose: true,
-            message: '添加成功',
-            type: 'success'
-          })
-          done()
-          this.getList(this.page)
-        })
-      },
       /**
        * 刷新回调
        */

+ 4 - 1
src/views/daemon/job-manage/index.vue

@@ -476,7 +476,10 @@
        * 新增定时任务持久化处理
        */
       save(row, done, loading) {
-        isValidTaskName(row.jobName, row.jobGroup).then(response => {
+        isValidTaskName({
+          'jobName':row.jobName,
+          'jobGroup': row.jobGroup
+        }).then(response => {
           let result = response.data.data;
           if (result != 0) {
             this.$notify.error({