浏览代码

巡更管理新增修改限制

wangtao 3 年之前
父节点
当前提交
7ddb8d0279
共有 2 个文件被更改,包括 79 次插入41 次删除
  1. 78 40
      src/views/business/OM/MochaITOM/plan/index.vue
  2. 1 1
      vue.config.js

+ 78 - 40
src/views/business/OM/MochaITOM/plan/index.vue

@@ -155,10 +155,10 @@
                 style="width: 160px"
               >
                 <el-option
-                  v-for="dict in inspectTimeList"
-                  :key="dict.dictValue"
-                  :label="dict.dictValue"
-                  :value="dict.dictValue"
+                  v-for="dict in implementTimeStart"
+                  :key="dict.value"
+                  :label="dict.value"
+                  :value="dict.value"
                 />
               </el-select>
             </el-form-item>
@@ -172,10 +172,10 @@
                 style="width: 160px"
               >
                 <el-option
-                  v-for="dict in inspectTimeList"
-                  :key="dict.dictValue"
-                  :label="dict.dictValue"
-                  :value="dict.dictValue"
+                  v-for="dict in implementTimeEnd"
+                  :key="dict.value"
+                  :label="dict.value"
+                  :value="dict.value"
                 />
               </el-select>
             </el-form-item>
@@ -286,7 +286,8 @@ export default {
         {dictValue:"2",dictLabel:"周"},
         {dictValue:"3",dictLabel:"月"},
       ],
-      inspectTimeList:[],
+      implementTimeStart:[],//执行开始时段
+      implementTimeEnd:[],//执行结束时段
 
       dateRange:[],
       teamList:[],
@@ -295,7 +296,8 @@ export default {
   },
   created() {
     this.getList();//初始化table
-    this.zxtime()//执行时间
+    this.zxtimeStart()
+    this.zxtimeEnd()
   },
   methods: {
 
@@ -307,6 +309,7 @@ export default {
     // 取消按钮
     cancel() {
       this.open = false;
+      this.loading = false
       this.reset();
     },
     /** 重置按钮操作 */
@@ -330,30 +333,55 @@ export default {
       this.queryParams.current = 1;
       this.getList();
     },
-    /** 执行时间 */
-    zxtime(){
+    /** 执行开始时间 */
+    zxtimeStart(){
       let arr = []
       for(let i = 0; i<48;i++){
         arr[i] = {}
         if(i%2 == "NaN"){
-          arr[i].dictValue="00:00:00"
+          arr[i].value="00:00:00"
         }
         if(i%2 == "0"){
           if(i/2>=10){
-            arr[i].dictValue= i/2 + ":00:00"
+            arr[i].value= i/2 + ":00:00"
           }else{
-            arr[i].dictValue="0" + i/2 + ":00:00"
+            arr[i].value="0" + i/2 + ":00:00"
           }
         }
         if(i%2 == "1"){
           if(i/2>=10){
-            arr[i].dictValue=(i-1)/2 + ":30:00"
+            arr[i].value=(i-1)/2 + ":30:00"
           }else{
-            arr[i].dictValue="0" + (i-1)/2 + ":30:00"
+            arr[i].value="0" + (i-1)/2 + ":30:00"
           }
         }
       }
-      this.inspectTimeList = arr
+      this.implementTimeStart = arr
+    },
+    /** 执行开结束时间 */
+    zxtimeEnd(){
+      let arr = []
+      for(let i = 0; i<49;i++){
+        arr[i] = {}
+        if(i%2 == "NaN"){
+          arr[i].value="00:00:00"
+        }
+        if(i%2 == "0"){
+          if(i/2>=10){
+            arr[i].value= i/2 + ":00:00"
+          }else{
+            arr[i].value="0" + i/2 + ":00:00"
+          }
+        }
+        if(i%2 == "1"){
+          if(i/2>=10){
+            arr[i].value=(i-1)/2 + ":30:00"
+          }else{
+            arr[i].value="0" + (i-1)/2 + ":30:00"
+          }
+        }
+      }
+      this.implementTimeEnd = arr.slice(1,arr.length)
     },
     /** 查询参数列表 */
     getList() {
@@ -444,25 +472,34 @@ export default {
           }
           this.loading = true
           if (this.form.id != undefined) {
-            updateMaintianPlan(this.form).then(response => {
-              this.loading = false,
-              this.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            }).catch(()=>{
-              this.loading = false
-            })
-          } else {
-            addMaintianPlan(this.form).then(response => {
-              this.loading = false
-              if(response.status == "SUCCESS"){
-                this.msgSuccess("新增成功");
+            if(this.form.planPathId){
+              updateMaintianPlan(this.form).then(response => {
+                this.loading = false,
+                this.msgSuccess("修改成功");
                 this.open = false;
                 this.getList();
-              }
-            }).catch((err)=>{
-              this.loading = false
-            })
+              }).catch(()=>{
+                this.loading = false
+              })
+            }else{
+              this.msgError("巡更路线不能为空");
+            }
+          } else {
+            if(this.form.planPathId){
+              addMaintianPlan(this.form).then(response => {
+                this.loading = false
+                if(response.status == "SUCCESS"){
+                  this.msgSuccess("新增成功");
+                  this.open = false;
+                  this.getList();
+                }
+              }).catch((err)=>{
+                this.loading = false
+              })
+            }else{
+              this.msgError("巡更路线不能为空");
+            }
+
           }
         }
       });
@@ -481,17 +518,18 @@ export default {
           this.msgSuccess("删除成功");
         }).catch(() => {});
     },
-    /** table */
+    /** 路线选择 */
     dialogCheck(selection, row){
       this.$refs.dataTable.clearSelection()
         if (selection.length === 0) { // 判断selection是否有值存在
+            this.form.planPathId = undefined
+            this.form.planPathName = undefined
             return
-        }
-        if (row) {
+        }else{
             this.selectioned = row
             this.$refs.dataTable.toggleRowSelection(row, true)
-            this.form.planPathId = row.id
-            this.form.planPathName = row.name
+            this.form.planPathId = selection[selection.length-1].id
+            this.form.planPathName = selection[selection.length-1].name
         }
     },
     /** 导出按钮操作 */

+ 1 - 1
vue.config.js

@@ -125,4 +125,4 @@ module.exports = {
                 }
             )
     }
-}
+}