jbb 2 vuotta sitten
vanhempi
commit
c652a7aaeb
1 muutettua tiedostoa jossa 58 lisäystä ja 15 poistoa
  1. 58 15
      src/views/activiti/form/demoForm2.vue

+ 58 - 15
src/views/activiti/form/demoForm2.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="form-main">
+  <div class="form-main" id="form-main">
     <a-card :body-style="{ padding: '24px 32px' }" :bordered="false">
       <!-- <a-form @submit="handleSubmit" :form="form">
         <a-form-item
@@ -35,8 +35,8 @@
           type="primary"
           :disabled="disabled || btndisabled"
           @click="handleSubmit"
-        >保存</a-button
-        >
+          class="noprint"
+        >保存</a-button>
         <todoManageOperation
           v-if="processData.operationType && processData.operationType == '1'"
           :processData="processData"
@@ -46,7 +46,8 @@
           @refreshToDo="refreshToDo"
           @handleSubmit2="handleSubmit2"
         ></todoManageOperation>
-        <a-button style="margin-left: 8px;" :disabled="disabled || disabled2" @click="close">取消</a-button>
+        <a-button style="margin-left: 8px;" :disabled="disabled || disabled2" @click="close"   class="noprint">取消</a-button>
+        <!-- <a-button  type="primary"  v-if="printDisable" @click="changedd"   class="noprint" style="margin-left:10px">打印</a-button> -->
       </div>
     </a-card>
   </div>
@@ -113,9 +114,11 @@ export default {
                 typeData: [], // 请假类型下拉数据
                 reimbursementTypeList: [], // 报销类型下拉数据
                 invoiceTypeList: [], // 发票类型下拉数据
-                add: this.add
+                add: this.add,
             },
-            itemModelNameList: [] // 子表字段名
+            itemModelNameList: [], // 子表字段名
+            buttonArr:[],
+            printDisable:false//打印按钮
         }
     },
     watch: {
@@ -360,24 +363,32 @@ export default {
                         //保存多各含有help的数据
                         this.bv.push({bn:this.fArr})
                        //默认当天时间
-                        this.defualtData()
+                        this.defualtData(this.fArr)
                     }else if(obj[a].help ==''){
                         this.cvarr.push({model:obj[a].model,key:obj[a].key,type:obj[a].type})
+                    }else if(obj[a].type == 'button'){
+                        this.buttonArr.push(obj[a])
+                         this.buttonShow(obj[a])         
                     }
                     this.forHelp(obj[a])
                 }
-                }               
+                }     
+                
+        },
+        buttonShow(obj){
+            if(obj.label == '打印'){
+                this.printDisable = true
+            }
         },
-        defualtData(){
-             this.bv.map(item=>{
-                           if(item.bn[1].label =='today'){
-                               item.bn[0].value =moment(new Date()).format('YYYY-MM-DD')
+        defualtData(item){
+
+                           if(item[1].label =='today'){
+                               item[0].value =moment(new Date()).format('YYYY-MM-DD')
                                var that = this
                                setTimeout(function(){
-                               that.$refs.KFB.setData({[item.bn[0].label]:item.bn[0].value})   
+                               that.$refs.KFB.setData({[item[0].label]:item[0].value})   
                                   },0)
                            }
-                        })
         },
         // 获取申请人信息
         getApplicant () {
@@ -389,8 +400,22 @@ export default {
             //   })
             // }
         },
+        changedd(){
+         window.print()
+        },
         // 表单字段数值发生改变事件
         handleChange (value, key) {  
+            if((key == 'leave_category' && value == '1') || (key == 'leave_category' && value == '3')){
+                var that = this
+                setTimeout(function(){
+                               that.$refs.KFB.setData({unit:'1'})   
+                                  },0)
+            }else if(key == 'leave_category'){
+                 var that = this
+                setTimeout(function(){
+                               that.$refs.KFB.setData({unit:'2'})   
+                                  },0)
+            }
             //保存发生改变字段名对应的key 
             var cc ='',
                 type = ''
@@ -1047,6 +1072,24 @@ function updateModel (object, childIndex) {
 }
 </script>
 <style lang="less" scoped>
-.form-main {
+@media print {
+    @page {
+    /* 横向 */
+    size: landscape;
+    /* 去除浏览器默认页眉页脚 */
+    margin: 0;
+  }
+   .noprint {
+    display: none;
+  }
+  /deep/.ant-input{
+      border: none !important;
+  }
+  /deep/ .ant-modal-header{
+       display: none !important;
+  }
+   /deep/ .ant-modal-content{
+      box-shadow:none !important
+  }
 }
 </style>