hyf il y a 3 ans
Parent
commit
66d0c34133

+ 0 - 0
src/views/system/job/job/job.vue → src/views/system/job/job/components/Job.vue


+ 9 - 19
src/views/system/job/job/index.vue

@@ -79,7 +79,7 @@
 </template>
 
 <script>
-import Job from './job'
+import Job from './components/Job.vue'
 import { getJobByPage, updateJobStatus, deleteJobById } from '@/api/system/jobApi'
 import Pagination from '@/components/Pagination'
 
@@ -113,12 +113,10 @@ export default {
     getData() {
       this.listLoading = true
       getJobByPage(this.conditions).then((resp) => {
-        const { code, data, total } = resp
+        const { data, total } = resp
         this.listLoading = false
-        if (code === 200) {
-          this.conditions.total = total
-          this.dataList = data
-        }
+        this.conditions.total = total
+        this.dataList = data
       }).catch((error) => {
         console.log(error)
       })
@@ -128,12 +126,8 @@ export default {
     handlerChangeStatus(status, data) {
       const jobId = data.jobId
       updateJobStatus(jobId, status).then((resp) => {
-        const { code, msg } = resp
-        if (code === 200) {
-          this.$message.success(msg)
-        } else {
-          this.$message.error(msg)
-        }
+        const { msg } = resp
+        this.$message.success(msg)
       }).catch((error) => {
         console.log(error)
       })
@@ -157,13 +151,9 @@ export default {
         type: 'warning'
       }).then(() => {
         deleteJobById(data.jobId).then((resp) => {
-          const { code, msg } = resp
-          if (code === 200) {
-            this.getData()
-            this.$message.success(msg)
-          } else {
-            this.$message.error(msg)
-          }
+          const { msg } = resp
+          this.getData()
+          this.$message.success(msg)
         }).catch((error) => {
           console.log(error)
         })

+ 0 - 0
src/views/system/job/schedule/schedule.vue → src/views/system/job/schedule/components/Schedule.vue


+ 7 - 15
src/views/system/job/schedule/index.vue

@@ -71,7 +71,7 @@
 </template>
 
 <script>
-import JobSchedule from './schedule'
+import JobSchedule from './components/Schedule.vue'
 import { getJobScheduleByPage, deleteJobScheduleById } from '@/api/system/jobScheduleApi'
 import Pagination from '@/components/Pagination'
 
@@ -102,14 +102,10 @@ export default {
     getData() {
       this.listLoading = true
       getJobScheduleByPage(this.conditions).then((resp) => {
-        const { code, data, total, msg } = resp
+        const { data, total } = resp
         this.listLoading = false
-        if (code === 200) {
-          this.total = total
-          this.dataList = data
-        } else {
-          this.$message.error(msg)
-        }
+        this.total = total
+        this.dataList = data
       }).catch((error) => {
         console.log(error)
       })
@@ -138,13 +134,9 @@ export default {
         type: 'warning'
       }).then(() => {
         deleteJobScheduleById(jobId, scheduleId).then((resp) => {
-          const { code, msg } = resp
-          if (code === 200) {
-            this.getData()
-            this.$message.success(msg)
-          } else {
-            this.$message.error(msg)
-          }
+          const { msg } = resp
+          this.getData()
+          this.$message.success(msg)
         }).catch((error) => {
           console.log(error)
         })

+ 10 - 22
src/views/system/job/trigger/trigger.vue → src/views/system/job/trigger/components/Trigger.vue

@@ -85,10 +85,8 @@ export default {
       this.dialogVisible = true
 
       getJobTriggerById(triggerId).then((resp) => {
-        const { code, data } = resp
-        if (code === 200) {
-          this.formData = data
-        }
+        const { data } = resp
+        this.formData = data
       }).catch((error) => {
         console.log(error)
       })
@@ -126,15 +124,10 @@ export default {
         // Action: ADD
         case ACTION_ADD:
           createJobTrigger(this.formData).then((resp) => {
-            const { code, msg } = resp
-            if (code === 200) {
-              this.dialogVisible = false
-              this.formSuccess()
-            }
-            this.$message({
-              type: 'success',
-              message: msg
-            })
+            const { msg } = resp
+            this.dialogVisible = false
+            this.formSuccess()
+            this.$message.success(msg)
           }).catch((error) => {
             console.log(error)
           })
@@ -143,15 +136,10 @@ export default {
         // Action: UPDATE
         case ACTION_UPDATE:
           updateJobTrigger(this.formData).then((resp) => {
-            const { code, msg } = resp
-            if (code === 200) {
-              this.dialogVisible = false
-              this.formSuccess()
-            }
-            this.$message({
-              type: 'success',
-              message: msg
-            })
+            const { msg } = resp
+            this.dialogVisible = false
+            this.formSuccess()
+            this.$message.success(msg)
           }).catch((error) => {
             console.log(error)
           })

+ 1 - 1
src/views/system/job/trigger/index.vue

@@ -79,7 +79,7 @@
 </template>
 
 <script>
-import JobTrigger from './trigger'
+import JobTrigger from './components/Trigger.vue'
 import { getJobTriggerByList, updateJobTriggerStatus, deleteJobTriggerById } from '@/api/system/jobTriggerApi'
 
 export default {

+ 5 - 4
src/views/system/msg/leftUtil.vue → src/views/system/msg/components/LeftUtil.vue

@@ -14,7 +14,7 @@
 </template>
 <script>
 
-import MsgComponent from './msg'
+import MsgComponent from './Msg.vue'
 
 export default {
   name: 'LeftUtil',
@@ -42,12 +42,13 @@ export default {
     this.selectItem(this.typeList[0], 0)
   },
   methods: {
-    /**
-             * 添加
-             */
+
+    // 添加
     handleAdd() {
       this.$refs['AddTask'].handler()
     },
+
+    // 选中
     selectItem(data, index) {
       this.currentSelect = index
       this.$emit('selectItem', data.type)

+ 7 - 11
src/views/system/msg/msg.vue → src/views/system/msg/components/Msg.vue

@@ -35,10 +35,10 @@
 <script>
 import { ACTION_UPDATE } from '@/utils/actionType'
 import { sendMessage, getMessageById } from '@/api/system/messageApi'
-import UserSelector from '@/components/UserSelector'
+import UserSelector from '@/components/UserSelector/index.vue'
 
 export default {
-  name: 'OutcomeEvaluation',
+  name: 'Msg',
   components: { UserSelector },
   props: {
     title: {
@@ -90,10 +90,8 @@ export default {
       this.actionType = ACTION_UPDATE
       this.dialogVisible = true
       getMessageById(id).then((resp) => {
-        const { code, data } = resp
-        if (code === 200) {
-          this.ruleForm = data
-        }
+        const { data } = resp
+        this.ruleForm = data
       }).catch((error) => {
         console.log(error)
       })
@@ -120,11 +118,9 @@ export default {
       this.$refs[formName].validate((valid) => {
         if (valid) {
           sendMessage(this.formData).then((resp) => {
-            const { code, msg } = resp
-            if (code === 200) {
-              this.dialogVisible = false
-              this.formSuccess()
-            }
+            const { msg } = resp
+            this.dialogVisible = false
+            this.formSuccess()
             this.$message.success(msg)
           }).catch((error) => {
             console.log(error)

+ 10 - 5
src/views/system/msg/MsgItem.vue → src/views/system/msg/components/MsgItem.vue

@@ -33,19 +33,24 @@ export default {
   name: 'MsgItem',
   props: {
     id: {
-      type: Number
+      type: Number,
+      defaultValue: 0
     },
     title: {
-      type: String
+      type: String,
+      defaultValue: ''
     },
     content: {
-      type: String
+      type: String,
+      defaultValue: ''
     },
     date: {
-      type: String
+      type: String,
+      defaultValue: ''
     },
     cat: {
-      type: [String, Number]
+      type: [String, Number],
+      defaultValue: undefined
     }
   },
   methods: {

+ 10 - 18
src/views/system/msg/msgList.vue → src/views/system/msg/components/MsgList.vue

@@ -32,13 +32,13 @@
 
 <script>
 import vuescroll from 'vuescroll'
-import Msg from './msg'
+import Msg from './Msg.vue'
 import { getMsgByPage, deleteMsgById } from '@/api/system/msgApi'
-import MsgItem from './MsgItem'
-import Pagination from '@/components/Pagination'
+import MsgItem from './MsgItem.vue'
+import Pagination from '@/components/Pagination/index.vue'
 
 export default {
-  name: 'MsgManage',
+  name: 'MsgList',
   components: {
     vuescroll,
     Msg,
@@ -84,13 +84,9 @@ export default {
     // Fetch Data
     getData() {
       getMsgByPage(this.conditions).then((resp) => {
-        const { code, msg, data, count } = resp
-        if (code === 200) {
-          this.conditions.total = count
-          this.dataList = data
-        } else {
-          this.$message.error(msg)
-        }
+        const { data, total } = resp
+        this.conditions.total = total
+        this.dataList = data
       }).catch((error) => {
         console.log(error)
       })
@@ -104,13 +100,9 @@ export default {
         type: 'warning'
       }).then(() => {
         deleteMsgById(msgId).then((resp) => {
-          const { code, msg } = resp
-          if (code === 200) {
-            this.getData()
-            this.$message.success(msg)
-          } else {
-            this.$message.error(msg)
-          }
+          const { msg } = resp
+          this.getData()
+          this.$message.success(msg)
         }).catch((error) => {
           console.log(error)
         })

+ 3 - 2
src/views/system/msg/index.vue

@@ -14,9 +14,10 @@
   </div>
 </template>
 <script>
-import LeftUtil from './leftUtil.vue'
-import MsgList from './msgList.vue'
+import LeftUtil from './components/LeftUtil.vue'
+import MsgList from './components/MsgList.vue'
 export default {
+  name: 'MsgIndex',
   components: {
     LeftUtil,
     MsgList

+ 13 - 22
src/views/system/position/position.vue → src/views/system/position/components/Position.vue

@@ -32,6 +32,7 @@
 import { ACTION_ADD, ACTION_UPDATE } from '@/utils/actionType'
 import { getPositionById, createPosition, updatePosition } from '@/api/system/positionApi'
 export default {
+  name: 'Position',
   props: {
     title: {
       type: String,
@@ -58,23 +59,21 @@ export default {
 
   methods: {
 
-    // Show Add Model
+    // 新增
     showAddModel() {
       this.actionType = ACTION_ADD
       this.resetFormData()
       this.dialogVisible = true
     },
 
-    // Show Edit Model
+    // 编辑
     showEditModel(id) {
       this.actionType = ACTION_UPDATE
       this.resetFormData()
       this.dialogVisible = true
       getPositionById(id).then((resp) => {
-        const { code, data } = resp
-        if (code === 200) {
-          this.formData = data
-        }
+        const { data } = resp
+        this.formData = data
       }).catch((error) => {
         console.log(error)
       })
@@ -107,14 +106,10 @@ export default {
       switch (actionType) {
         case ACTION_ADD:
           createPosition(this.formData).then((resp) => {
-            const { code, msg } = resp
-            if (code === 200) {
-              this.dialogVisible = false
-              this.$message.success(msg)
-              this.formSuccess()
-            } else {
-              this.$message.error(msg)
-            }
+            const { msg } = resp
+            this.dialogVisible = false
+            this.$message.success(msg)
+            this.formSuccess()
           }).catch((error) => {
             console.log(error)
           })
@@ -122,14 +117,10 @@ export default {
 
         case ACTION_UPDATE:
           updatePosition(this.formData).then((resp) => {
-            const { code, msg } = resp
-            if (code === 200) {
-              this.dialogVisible = false
-              this.$message.success(msg)
-              this.formSuccess()
-            } else {
-              this.$message.error(msg)
-            }
+            const { msg } = resp
+            this.dialogVisible = false
+            this.$message.success(msg)
+            this.formSuccess()
           }).catch((error) => {
             console.log(error)
           })

+ 1 - 1
src/views/system/position/index.vue

@@ -50,7 +50,7 @@
 <script>
 import Pagination from '@/components/Pagination' // secondary package based on el-pagination
 import { getPositionByPage, deletePositionById } from '@/api/system/positionApi'
-import Position from '@/views/system/position/position'
+import Position from '@/views/system/position/components/Position.vue'
 import PositionPermit from '@/views/system/permit/position'
 
 export default {