LiGuang 2 lat temu
rodzic
commit
bd8a4baacc

+ 176 - 4
src/views/system/schedulingInformation/BdWorkOverTimeList.vue

@@ -131,7 +131,9 @@
       </a-form>
     </div>
 
-   
+   <!-- <div class="table-operator">
+     <a-button @click="handleAdds()" type="primary" icon="plus" >新增</a-button>
+     </div> -->
     <!-- table区域-begin -->
     <a-tabs default-active-key="1" @change="callback">
       
@@ -183,6 +185,52 @@
       
        </a-tab-pane>
     </a-tabs>
+    <a-modal v-model="vailts" title="年假新增"  @ok="addval()">
+      <a-spin :spinning="confirmLoading">
+       <a-form :form="form">
+         <a-form-item
+           :labelCol="labelCol"
+           :wrapperCol="wrapperCol"
+           label="员工姓名">
+           <j-select-user-by-dep  v-decorator="['userId', validatorRules.realname]"/>
+         </a-form-item>
+         <a-form-item
+           :labelCol="labelCol"
+           :wrapperCol="wrapperCol"
+           label="部门名称">
+           <a-input placeholder="请输入部门名称" :disabled="true" v-decorator="['deptNames', validatorRules.deptname ]" />
+         </a-form-item>
+         <a-form-item
+           :labelCol="labelCol"
+           :wrapperCol="wrapperCol"
+           label="类型">
+           <j-dict-select-tag disabled v-decorator="['holidayType', {initialValue:'年假'}]" :triggerChange="true" placeholder="请选择类型"
+             dictCode="vacation_type" />
+           
+         </a-form-item>
+         <a-form-item
+           :labelCol="labelCol"
+           :wrapperCol="wrapperCol"
+           label="开始日期">
+           <a-date-picker showTime format='YYYY-MM-DD HH:mm:ss' v-decorator="[ 'startDate', validatorRules.startDate]" />
+         </a-form-item>
+         <a-form-item
+           :labelCol="labelCol"
+           :wrapperCol="wrapperCol"
+           label="结束日期">
+           <a-date-picker showTime :disabled-date="disabledDate" format='YYYY-MM-DD HH:mm:ss' v-decorator="[ 'endDate', validatorRules.endDate]" />
+         </a-form-item>
+         <a-form-item
+           :labelCol="labelCol"
+           :wrapperCol="wrapperCol"
+           label="备注">
+           <a-textarea :maxLength="255" placeholder="请输入备注" v-decorator="['demo', {}]" />
+         </a-form-item>
+         
+       		
+       </a-form>
+       </a-spin>
+        </a-modal>
     <!-- table区域-end -->
 
     <!-- 表单区域 -->
@@ -195,23 +243,48 @@
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import JDictSelectTag from '@/components/dict/JDictSelectTag'
   import departWindow from '../modules/DepartWindow'
-  import { httpAction,getAction,downFile } from '@/api/manage'
+  import { httpAction,getAction,downFile} from '@/api/manage'
+  import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
 import moment from "moment"
   export default {
     name: 'BdSchedulingList',
     mixins: [JeecgListMixin],
     components: {
       JDictSelectTag,
-      departWindow
+      departWindow,
+      JSelectUserByDep
     },
     data() {
       return {
+        confirmLoading:false,
         description: '加班信息',
         departNames:"",
+        userid:"",
+        deptid:"",
+        vailts:false,
         toggleSearchStatuss:false,
         queryParam2:{},
         departNamest:"",
          dataSources:[],
+         form: this.$form.createForm(this),
+         validatorRules:{
+         realname:{rules: [{ required: true, message: '请输入员工名称!' },{
+               validator: this.validateRealname
+             }]},
+         deptname:{rules: [{ required: true, message: '请输入部门名称!' }]},
+         type:{rules: [{ required: true, message: '请选择类型' }]},
+         startDate:{rules: [{ required: true, message: '请选择开始日期' },{validator:this.validatestartDate}]},
+         endDate:{rules: [{ required: true, message: '请选择结束日期' }]},
+         },
+         model: {},
+         labelCol: {
+           xs: { span: 24 },
+           sm: { span: 5 },
+         },
+         wrapperCol: {
+           xs: { span: 24 },
+           sm: { span: 16 },
+         },
         loadings:false,
         isorters:{
           column: 'userDate',
@@ -374,7 +447,9 @@ import moment from "moment"
           list2:'/vacation/vacation/list',
           exportXlsUrl: "/workOvertime/workOvertime/exportXls",
           exportXlsUrls: "/vacation/vacation/exportXls",
-          importExcelUrl:"/workOvertime/workOvertime/importExcel"
+          importExcelUrl:"/workOvertime/workOvertime/importExcel",
+          dept:"/sys/user/queryUsersByusername",
+          add:"/vacation/vacation/add"
         },
       }
     },
@@ -383,6 +458,103 @@ import moment from "moment"
         return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
       }
     },methods: {
+      addval(){
+        this.form.validateFields((err, values) => {
+          if (!err) { 
+            var startDate= this.form.getFieldValue('startDate');
+            var endDate= this.form.getFieldValue('endDate');
+            var holidayType= this.form.getFieldValue('holidayType');
+            var demo=this.form.getFieldValue('demo');
+            var userId=this.form.getFieldValue('userId');
+            this.confirmLoading=true;
+            httpAction(this.url.add, {
+              userId: userId,
+              startDate:moment(startDate).format('YYYY-MM-DD HH:mm:ss'),
+              endDate:moment(endDate).format('YYYY-MM-DD HH:mm:ss'),
+              demo:demo,
+              holidayType:holidayType
+            },"post").then(res => { 
+              if (res.success) {
+                this.$message.success(res.message);
+                this.confirmLoading=false;
+                this.vailts=false;
+              } else {
+                this.$message.warning(res.message);
+              }
+            
+            })
+            
+          } 
+        })
+      },
+      handleAdds(){
+        
+        this.form.setFieldsValue({
+          endDate:null,
+          startDate:null,
+          demo:null,
+          userId:null,
+          deptNames:null
+        }) 
+        this.vailts=true;
+      },
+      disabledDate(current) {
+        var startDate= this.form.getFieldValue('startDate');
+        return current <= moment(startDate).subtract(0, 'day');
+      },
+      validatestartDate(rule, value, callback) {
+        if (!value) {
+          callback()
+        } else {
+          callback()
+         var end=this.form.getFieldValue('endDate');
+         if(end!=null){
+           var start=new Date(value);
+           var ends=new Date(end);
+           if(ends.getTime()<start.getTime()){
+             this.form.setFieldsValue({
+               endDate:null
+             }) 
+           }
+         }
+        }
+      },
+      queryDeptName(e){
+        getAction(this.url.dept,{id:e}).then((res)=>{
+          if(res.success){
+            if(res.result.length>0){
+              var list=res.result;
+              var deptids=[];
+              var deptname=[];
+              for(var i=0;i<list.length;i++){
+                deptids.push(list[i].deptid);
+                deptname.push(list[i].deptname);
+              }
+              this.deptid=deptids.join(",");
+              this.form.setFieldsValue({
+                deptNames:deptname.join(",")
+              })
+            }else{
+              this.deptid="";
+              this.form.setFieldsValue({
+                deptNames:""
+              })
+            }
+          }
+        })
+      },
+      validateRealname(rule, value, callback) {
+        if (!value) {
+          callback()
+          this.deptid="";
+          this.form.setFieldsValue({
+            deptNames:""
+          })
+        } else {
+          this.queryDeptName(value);
+          callback()
+        }
+      },
       handleToggleSearchs(){
         this.toggleSearchStatuss = !this.toggleSearchStatuss;
       },