Browse Source

日期修改

duy 1 year ago
parent
commit
e8555c99e5
1 changed files with 80 additions and 14 deletions
  1. 80 14
      src/views/manager/projectinfo/treeTemplate/template/setInputTPT.vue

+ 80 - 14
src/views/manager/projectinfo/treeTemplate/template/setInputTPT.vue

@@ -26,9 +26,9 @@
         </el-col>
         <el-col :span="8">
           <el-checkbox-group v-model="checkDateList" style="margin-top: 10px;margin-left: 10px;" size="large">
-            <el-checkbox label="yyyy" >年</el-checkbox>
-            <el-checkbox label="MM" >月</el-checkbox>
-            <el-checkbox label="dd" >日</el-checkbox>
+            
+            <el-checkbox v-for="item in yearList" :label="item.value">{{ item.name }}</el-checkbox>
+       
           </el-checkbox-group>
         </el-col>
         <el-col :span="3.8" style="line-height: 40px">
@@ -37,14 +37,14 @@
         <el-col :span="8" style="margin-left: 10px;">
           <el-select
               style="width:100%;"
-              v-model="from.type"
+              v-model="from.divide_y"
               clearable
               placeholder="请选择"
             
             >
               <el-option
                 label="文本"
-                :value="文本"
+                value="文本"
               >
               </el-option>
               <el-option
@@ -66,10 +66,8 @@
           时间:
         </el-col>
         <el-col :span="8">
-          <el-checkbox-group v-model="checkDateList" style="margin-top: 10px;margin-left: 10px;" size="large">
-            <el-checkbox label="hh" >时</el-checkbox>
-            <el-checkbox label="mm" >分</el-checkbox>
-            <el-checkbox label="ss" >秒</el-checkbox>
+          <el-checkbox-group v-model="checkTimeist" style="margin-top: 10px;margin-left: 10px;" size="large">
+            <el-checkbox v-for="item in timeList" :label="item.value">{{ item.name }}</el-checkbox>
           </el-checkbox-group>
         </el-col>
         <el-col :span="3.8" style="line-height: 40px">
@@ -78,14 +76,14 @@
         <el-col :span="8" style="margin-left: 10px;">
           <el-select
               style="width:100%;"
-              v-model="from.type"
+              v-model="from.divide_h"
               clearable
               placeholder="请选择"
             
             >
               <el-option
                 label="文本"
-                :value="文本"
+                value="文本"
               >
               </el-option>
               <el-option
@@ -109,11 +107,16 @@
         <el-col :span="18" style="margin-left: 10px;">
           <el-select
               style="width:100%;"
-              v-model="from.type"
+              v-model="from.divide_c"
               clearable
               placeholder="请选择"
             
             >
+            <el-option
+                label="至"
+                value='至'
+              >
+              </el-option>
               <el-option
                 label="-"
                 value="-"
@@ -201,11 +204,23 @@ export default {
       from: {
         type: '',
         value: '',
+        divide_c:'至'
       },
       setInputTable: [],//数据体
       disabled: false,
+      yearList:[
+        {name:'年',value:'YYYY'},
+        {name:'月',value:'MM'},
+        {name:'日',value:'DD'},
+      ],
+      timeList:[
+        {name:'时',value:'HH'},
+        {name:'分',value:'mm'},
+        {name:'秒',value:'ss'},
+      ],
       checkDateList: [],
-      testvalue1: new Date(2000, 0, 0, 0, 22),
+      checkTimeist:[],
+  
     }
   },
   methods: {
@@ -251,7 +266,53 @@ export default {
               textInfo: this.setInputTable
             })
           }
-        } else {
+        } 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
+                )
+              }
+            })
+          })
+          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
+            })
+          }
+          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.saveInput({
             trIndex: this.htmlData.tr,
             tdIndex: this.htmlData.td,
@@ -279,10 +340,15 @@ export default {
     async saveInput(da) {//保存设置文本接口
       const { data: res } = await saveInput(da)
       console.log(res);
+      this.checkDateList=[]
+      this.checkTimeist=[]
+      this.from.divide_y=''
+      this.from.divide_h=''
       if (res.code == 200) {
         this.setInputTable = []
         this.disabled = false
         this.getExcelHtml()
+       
       }
     },
     // async getColByTabId () {//获取字段信息