Explorar el Código

Merge branch 'master' of http://119.23.210.103:3000/wy/zdqy_firm_former

zhangjingyuan hace 2 años
padre
commit
7a75f1fb15
Se han modificado 1 ficheros con 77 adiciones y 13 borrados
  1. 77 13
      src/views/component/deviceSubtableDialog.vue

+ 77 - 13
src/views/component/deviceSubtableDialog.vue

@@ -344,11 +344,23 @@ export default {
         handleConfirm(key) {
             let a=this.dynamicParams.formObj.getData(this.templateKey)
             let val = this.corresponding(this.cycleValue)
-            if(this.cycleValue!=''&&val!=''&&this.maintenanceTextarea!=''){
+            let valNum = this.correspondingNum(this.cycleValue)
+            if(this.cycleValue!='按需保养'&&this.cycleValue!=''&&val!=''&&valNum!=''&&this.maintenanceTextarea!=''){
                 if(this.dynamicParams.position == 'manage'){
-                    this.$set(a,this.dynamicParams.params.index,{weiHuLeiXing:this.cycleValue,weiHuRiQi:val,weiHuXiangMuC:this.maintenanceTextarea})
+                    this.$set(a,this.dynamicParams.params.index,{weiHuLeiXing:this.cycleValue,weiHuRiQi:val,riQiShuZi:valNum,weiHuXiangMuC:this.maintenanceTextarea})
                 }else{
-                    a.push({weiHuLeiXing:this.cycleValue,weiHuRiQi:val,weiHuXiangMuC:this.maintenanceTextarea})
+                    a.push({weiHuLeiXing:this.cycleValue,weiHuRiQi:val,riQiShuZi:valNum,weiHuXiangMuC:this.maintenanceTextarea})
+                }
+                // this.$nextTick(function(){
+                this.dynamicParams.formObj.setData(this.templateKey,a)
+                // })
+                
+                this.closeDialog()
+            }else if(this.cycleValue=='按需保养'&&this.cycleValue!=''&&this.maintenanceTextarea!=''){
+                if(this.dynamicParams.position == 'manage'){
+                    this.$set(a,this.dynamicParams.params.index,{weiHuLeiXing:this.cycleValue,weiHuXiangMuC:this.maintenanceTextarea})
+                }else{
+                    a.push({weiHuLeiXing:this.cycleValue,weiHuXiangMuC:this.maintenanceTextarea})
                 }
                 // this.$nextTick(function(){
                 this.dynamicParams.formObj.setData(this.templateKey,a)
@@ -363,26 +375,74 @@ export default {
         corresponding(content){
             let that = this
             if(content == '日保养'){
-                let str = '周'
+                let str = '每周'
+                let numArr = []
+                that.dayCheckList.forEach((element,i) => {
+                    let ind = that.weekList.findIndex(item=>item===element)!=-1?that.weekList.findIndex(item=>item===element) + 1:''
+                    numArr.push(ind)
+                });
+                numArr.sort(function(a,b){
+                    return a-b;
+                })
+                numArr.forEach((element,i) => {
+                    if(i==that.dayCheckList.length-1){
+                        str = str+element
+                    }else{
+                        str = str+element+','
+                    }
+                });
+                return str
+            }else if(content == '月保养'){
+
+                return '每月'+that.monthDateValue
+            }else if(content == '周保养'){
+                let ind = that.weekList.findIndex(item=>item===that.weekDateValue)!=-1?that.weekList.findIndex(item=>item===that.weekDateValue) + 1:''
+                return '每周'+ind
+            }else if(content == '季度保养'){
+                return '每季度'+that.quarterDateValue
+            }else if(content == '半年保养'){
+                return '每半年'+that.midyearDateValue
+            }else if(content == '年保养'){
+                return '每年'+that.yearDateValue
+            }else{
+                return ''
+            }
+        },
+        correspondingNum(content){
+            let that = this
+            if(content == '日保养'){
+                let str = ''
+                let numArr = []
                 that.dayCheckList.forEach((element,i) => {
                     let ind = that.weekList.findIndex(item=>item===element) + 1
+                    numArr.push(ind)
+                });
+                numArr.sort(function(a,b){
+                    return a-b;
+                })
+                numArr.forEach((element,i) => {
                     if(i==that.dayCheckList.length-1){
-                        str = str+ind
+                        str = str+element
                     }else{
-                        str = str+ind+','
+                        str = str+element+','
                     }
                 });
                 return str
             }else if(content == '月保养'){
-                return that.monthDateValue
+                let turnVal = that.monthDateValue.replace(/[^0-9]/ig, '')
+                return turnVal
             }else if(content == '周保养'){
-                return that.weekDateValue
+                let ind = that.weekList.findIndex(item=>item===that.weekDateValue)!=-1?that.weekList.findIndex(item=>item===that.weekDateValue) + 1:''
+                return ind
             }else if(content == '季度保养'){
-                return that.quarterDateValue
+                let turnVal = that.quarterDateValue.replace(/[^0-9]/ig, '')
+                return turnVal
             }else if(content == '半年保养'){
-                return that.midyearDateValue
+                let turnVal = that.midyearDateValue.replace(/[^0-9]/ig, '')
+                return turnVal
             }else if(content == '年保养'){
-                return that.yearDateValue
+                let turnVal = that.yearDateValue.replace(/[^0-9]/ig, '')
+                return turnVal
             }else{
                 return ''
             }
@@ -391,8 +451,9 @@ export default {
             let that = this
             if(content.weiHuLeiXing == '日保养'){
                 let strArr = []
-                let str = content.weiHuRiQi.slice(1)
+                let str = content.weiHuRiQi.slice(2)
                 let partArr = str.split(",")
+                // console.log(partArr)
                 partArr.forEach((e,i)=>{
                     let num = e*1-1
                     strArr.push(this.weekList[num])
@@ -401,7 +462,10 @@ export default {
             }else if(content.weiHuLeiXing == '月保养'){
                 that.monthDateValue = content.weiHuRiQi
             }else if(content.weiHuLeiXing == '周保养'){
-                that.weekDateValue = content.weiHuRiQi
+                let str = content.weiHuRiQi.slice(2)
+                let partArr = str.split(",")
+                // console.log(partArr*1-1)
+                that.weekDateValue = this.weekList[partArr*1-1]
             }else if(content.weiHuLeiXing == '季度保养'){
                 that.quarterDateValue = content.weiHuRiQi
             }else if(content.weiHuLeiXing == '半年保养'){