|
@@ -25,7 +25,7 @@
|
|
|
日期:
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-checkbox-group v-model="checkDateList" style="margin-top: 10px;margin-left: 10px;" size="large">
|
|
|
+ <el-checkbox-group v-model="checkDateList" style="margin-top: 10px;margin-left: 10px;" size="large" @change="changeDate">
|
|
|
|
|
|
<el-checkbox v-for="item in yearList" :label="item.value">{{ item.name }}</el-checkbox>
|
|
|
|
|
@@ -66,7 +66,7 @@
|
|
|
时间:
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-checkbox-group v-model="checkTimeist" style="margin-top: 10px;margin-left: 10px;" size="large">
|
|
|
+ <el-checkbox-group v-model="checkTimeist" style="margin-top: 10px;margin-left: 10px;" size="large" @change="changeTime">
|
|
|
<el-checkbox v-for="item in timeList" :label="item.value">{{ item.name }}</el-checkbox>
|
|
|
</el-checkbox-group>
|
|
|
</el-col>
|
|
@@ -209,14 +209,16 @@ export default {
|
|
|
setInputTable: [],//数据体
|
|
|
disabled: false,
|
|
|
yearList:[
|
|
|
- {name:'年',value:'YYYY'},
|
|
|
- {name:'月',value:'MM'},
|
|
|
- {name:'日',value:'DD'},
|
|
|
+ {name:'年',value:'YYYY',sort:1},
|
|
|
+ {name:'月',value:'MM',sort:2},
|
|
|
+ {name:'日',value:'DD',sort:3},
|
|
|
],
|
|
|
+ yearSort:[],
|
|
|
+ TimeSort:[],
|
|
|
timeList:[
|
|
|
- {name:'时',value:'HH'},
|
|
|
- {name:'分',value:'mm'},
|
|
|
- {name:'秒',value:'ss'},
|
|
|
+ {name:'时',value:'HH',sort:4},
|
|
|
+ {name:'分',value:'mm',sort:5},
|
|
|
+ {name:'秒',value:'ss',sort:6},
|
|
|
],
|
|
|
checkDateList: [],
|
|
|
checkTimeist:[],
|
|
@@ -267,50 +269,59 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
} else if(this.from.type == 'daterange'|this.from.type == 'date'){
|
|
|
- let dateFormat=[]
|
|
|
- this.yearList.forEach((ele)=>{
|
|
|
- this.checkDateList.forEach((ele1)=>{
|
|
|
- if(ele.value===ele1){
|
|
|
- dateFormat.push(
|
|
|
- ele
|
|
|
- )
|
|
|
- }
|
|
|
+ let c = this.yearSort.concat(this.TimeSort);//c=[1,2,3,4,5,6]
|
|
|
+ console.log(c,'c');
|
|
|
+ let isAdd=this.IncreasingFn(c)
|
|
|
+ console.log(isAdd,'isAdd');
|
|
|
+ if(isAdd){
|
|
|
+ let dateFormat=[]
|
|
|
+ this.yearList.forEach((ele)=>{
|
|
|
+ this.checkDateList.forEach((ele1)=>{
|
|
|
+ if(ele.value===ele1){
|
|
|
+ dateFormat.push(
|
|
|
+ ele
|
|
|
+ )
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
- this.timeList.forEach((ele)=>{
|
|
|
- this.checkTimeist.forEach((ele1)=>{
|
|
|
- if(ele.value===ele1){
|
|
|
- dateFormat.push(
|
|
|
- ele
|
|
|
- )
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- if(this.from.divide_y){
|
|
|
- dateFormat.push({
|
|
|
- divide_y:this.from.divide_y
|
|
|
+ this.timeList.forEach((ele)=>{
|
|
|
+ this.checkTimeist.forEach((ele1)=>{
|
|
|
+ if(ele.value===ele1){
|
|
|
+ dateFormat.push(
|
|
|
+ ele
|
|
|
+ )
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- }
|
|
|
- if(this.from.divide_h){
|
|
|
- dateFormat.push({
|
|
|
- divide_h:this.from.divide_h
|
|
|
- })
|
|
|
- }
|
|
|
- if(this.from.divide_c&&this.from.type==='daterange'){
|
|
|
- dateFormat.push({
|
|
|
- divide_c:this.from.divide_c
|
|
|
+ if(this.from.divide_y){
|
|
|
+ dateFormat.push({
|
|
|
+ divide_y:this.from.divide_y
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(this.from.divide_h){
|
|
|
+ dateFormat.push({
|
|
|
+ divide_h:this.from.divide_h
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(this.from.divide_c&&this.from.type==='daterange'){
|
|
|
+ dateFormat.push({
|
|
|
+ divide_c:this.from.divide_c
|
|
|
+ })
|
|
|
+ }
|
|
|
+ console.log(dateFormat,'dateFormat');
|
|
|
+ this.saveInput({
|
|
|
+ trIndex: this.htmlData.tr,
|
|
|
+ tdIndex: this.htmlData.td,
|
|
|
+ tableId: this.pkeyId,
|
|
|
+ textId: this.from.type,
|
|
|
+ type: '1',
|
|
|
+ textInfo: this.setInputTable,
|
|
|
+ dateFormat:dateFormat
|
|
|
})
|
|
|
+ }else{
|
|
|
+ this.$message.warning('请按年月日时分秒顺序选择,不要跨越选择')
|
|
|
}
|
|
|
- console.log(dateFormat,'dateFormat');
|
|
|
- this.saveInput({
|
|
|
- trIndex: this.htmlData.tr,
|
|
|
- tdIndex: this.htmlData.td,
|
|
|
- tableId: this.pkeyId,
|
|
|
- textId: this.from.type,
|
|
|
- type: '1',
|
|
|
- textInfo: this.setInputTable,
|
|
|
- dateFormat:dateFormat
|
|
|
- })
|
|
|
+
|
|
|
}
|
|
|
else {
|
|
|
this.saveInput({
|
|
@@ -344,6 +355,8 @@ export default {
|
|
|
this.checkTimeist=[]
|
|
|
this.from.divide_y=''
|
|
|
this.from.divide_h=''
|
|
|
+ this.yearSort=[]
|
|
|
+ this.TimeSort=[]
|
|
|
if (res.code == 200) {
|
|
|
this.setInputTable = []
|
|
|
this.disabled = false
|
|
@@ -371,6 +384,57 @@ export default {
|
|
|
this.$emit('cop')
|
|
|
}
|
|
|
},
|
|
|
+ // 判断是否是是
|
|
|
+
|
|
|
+ IncreasingFn(array) {
|
|
|
+ let IncreasingFn = false
|
|
|
+ let arrayCount = array.length - 1
|
|
|
+ // console.log(arrayCount,'现在是?');
|
|
|
+ for (var i = 0; i < arrayCount; i++) {
|
|
|
+ let currentArr = Number(array[i]) + 1
|
|
|
+ let nestArr = Number(array[i + 1])
|
|
|
+
|
|
|
+ if (i < 1 == arrayCount) {
|
|
|
+ console.log('执行')
|
|
|
+ currentArr = Number(array[i])
|
|
|
+ nestArr = Number(array[i])
|
|
|
+ }
|
|
|
+ if (currentArr != nestArr) {
|
|
|
+ IncreasingFn = false
|
|
|
+ break
|
|
|
+ } else {
|
|
|
+ IncreasingFn = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return IncreasingFn
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ changeDate(val){
|
|
|
+ this.yearSort=[]
|
|
|
+ this.yearList.forEach((ele)=>{
|
|
|
+ val.forEach((ele1)=>{
|
|
|
+ if(ele.value===ele1){
|
|
|
+ this.yearSort.push(ele.sort)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ changeTime(val){
|
|
|
+ this.TimeSort=[]
|
|
|
+ this.timeList.forEach((ele)=>{
|
|
|
+ val.forEach((ele1)=>{
|
|
|
+ if(ele.value===ele1){
|
|
|
+ this.TimeSort.push(ele.sort)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
},
|
|
|
created() {
|
|
|
this.dictionary() //获取文本类型接口
|