|
@@ -105,11 +105,12 @@
|
|
|
/>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
- <a-col :xl="6" :lg="7" :md="8" :sm="24">
|
|
|
- <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
|
|
+ <a-col :xl="4" :lg="4" :md="4" :sm="24">
|
|
|
+ <span style="float: left;overflow: hidden;margin-left: -60px;" class="table-page-search-submitButtons">
|
|
|
<a-button type="primary" @click="searchQuerys()" icon="search">查询</a-button>
|
|
|
<a-button type="primary" @click="searchResets" icon="reload" style="margin-left: 8px">重置</a-button>
|
|
|
<a-button type="primary" icon="download" @click="handleExportXlst('请假息列表')" style="margin-left: 8px;">导出</a-button>
|
|
|
+ <a-button @click="handleAdds()" type="primary" icon="plus" style="margin-left: 8px;">新增</a-button>
|
|
|
<a @click="handleToggleSearchs" style="margin-left: 8px">
|
|
|
{{ toggleSearchStatuss ? '收起' : '展开' }}
|
|
|
<a-icon :type="toggleSearchStatuss ? 'up' : 'down'"/>
|
|
@@ -131,9 +132,9 @@
|
|
|
</a-form>
|
|
|
</div>
|
|
|
|
|
|
- <!-- <div class="table-operator">
|
|
|
- <a-button @click="handleAdds()" type="primary" icon="plus" >新增</a-button>
|
|
|
- </div> -->
|
|
|
+ <div class="table-operator" v-if="isShow==2||isShow=='2'">
|
|
|
+
|
|
|
+ </div>
|
|
|
<!-- table区域-begin -->
|
|
|
<a-tabs default-active-key="1" @change="callback">
|
|
|
|
|
@@ -185,7 +186,7 @@
|
|
|
|
|
|
</a-tab-pane>
|
|
|
</a-tabs>
|
|
|
- <a-modal v-model="vailts" title="年假新增" @ok="addval()">
|
|
|
+ <a-modal v-model="vailts" title="年假新增" @ok="addval()" >
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
<a-form :form="form">
|
|
|
<a-form-item
|
|
@@ -212,13 +213,30 @@
|
|
|
:labelCol="labelCol"
|
|
|
:wrapperCol="wrapperCol"
|
|
|
label="开始日期">
|
|
|
- <a-date-picker showTime format='YYYY-MM-DD HH:mm:ss' v-decorator="[ 'startDate', validatorRules.startDate]" />
|
|
|
+ <a-date-picker format='YYYY-MM-DD' v-decorator="[ 'startDate', validatorRules.startDate]" />
|
|
|
+ <a-select style="width: 40%" v-decorator="['startType',validatorRules.startType]" placeholder="请选择时间"
|
|
|
+ :getPopupContainer="(target) => target.parentNode" >
|
|
|
+ <a-select-option value="00:00:00">上午</a-select-option>
|
|
|
+ <a-select-option value="12:00:00">下午</a-select-option>
|
|
|
+ </a-select>
|
|
|
</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-date-picker :disabled-date="disabledDate" format='YYYY-MM-DD' v-decorator="[ 'endDate', validatorRules.endDate]" />
|
|
|
+ <a-select style="width: 40%" v-decorator="['endType',validatorRules.endType]" placeholder="请选择时间"
|
|
|
+ :getPopupContainer="(target) => target.parentNode" >
|
|
|
+ <a-select-option value="00:00:00">上午</a-select-option>
|
|
|
+ <a-select-option value="12:00:00">下午</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item
|
|
|
+ :labelCol="labelCol"
|
|
|
+ :wrapperCol="wrapperCol"
|
|
|
+ label="时长">
|
|
|
+ <a-input disabled placeholder="请输时长" suffix="小时" v-decorator="['holidayCount', {initialValue:0}]" />
|
|
|
</a-form-item>
|
|
|
<a-form-item
|
|
|
:labelCol="labelCol"
|
|
@@ -272,9 +290,11 @@ import moment from "moment"
|
|
|
validator: this.validateRealname
|
|
|
}]},
|
|
|
deptname:{rules: [{ required: true, message: '请输入部门名称!' }]},
|
|
|
+ startType:{initialValue:"00:00:00",rules: [{ required: true, message: '请选择时间!' },{validator:this.validatestartType}]},
|
|
|
+ endType:{initialValue:"00:00:00",rules: [{ required: true, message: '请选择时间!' },{validator:this.validateendType}]},
|
|
|
type:{rules: [{ required: true, message: '请选择类型' }]},
|
|
|
startDate:{rules: [{ required: true, message: '请选择开始日期' },{validator:this.validatestartDate}]},
|
|
|
- endDate:{rules: [{ required: true, message: '请选择结束日期' }]},
|
|
|
+ endDate:{rules: [{ required: true, message: '请选择结束日期' },{validator:this.validateendDate}]},
|
|
|
},
|
|
|
model: {},
|
|
|
labelCol: {
|
|
@@ -461,28 +481,32 @@ import moment from "moment"
|
|
|
addval(){
|
|
|
this.form.validateFields((err, values) => {
|
|
|
if (!err) {
|
|
|
- var startDate= this.form.getFieldValue('startDate');
|
|
|
- var endDate= this.form.getFieldValue('endDate');
|
|
|
+ var startDate= moment(this.form.getFieldValue('startDate')).format('YYYY-MM-DD')+" "+this.form.getFieldValue('startType');
|
|
|
+ var endDate=moment(this.form.getFieldValue('endDate')).format('YYYY-MM-DD')+" "+this.form.getFieldValue('endType');
|
|
|
var holidayType= this.form.getFieldValue('holidayType');
|
|
|
var demo=this.form.getFieldValue('demo');
|
|
|
var userId=this.form.getFieldValue('userId');
|
|
|
+ var holidayCount=this.form.getFieldValue('holidayCount');
|
|
|
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,
|
|
|
+ holidayCount:holidayCount,
|
|
|
holidayType:holidayType
|
|
|
},"post").then(res => {
|
|
|
if (res.success) {
|
|
|
this.$message.success(res.message);
|
|
|
- this.confirmLoading=false;
|
|
|
this.vailts=false;
|
|
|
+ this.querys();
|
|
|
} else {
|
|
|
this.$message.warning(res.message);
|
|
|
}
|
|
|
|
|
|
- })
|
|
|
+ }).finally(() => {
|
|
|
+ this.confirmLoading=false;
|
|
|
+ })
|
|
|
|
|
|
}
|
|
|
})
|
|
@@ -494,7 +518,10 @@ import moment from "moment"
|
|
|
startDate:null,
|
|
|
demo:null,
|
|
|
userId:null,
|
|
|
- deptNames:null
|
|
|
+ deptNames:null,
|
|
|
+ holidayCount:0,
|
|
|
+ startType:"00:00:00",
|
|
|
+ endType:"00:00:00"
|
|
|
})
|
|
|
this.vailts=true;
|
|
|
},
|
|
@@ -507,18 +534,211 @@ import moment from "moment"
|
|
|
callback()
|
|
|
} else {
|
|
|
callback()
|
|
|
- var end=this.form.getFieldValue('endDate');
|
|
|
+ var end=moment(this.form.getFieldValue('endDate')).format('YYYY-MM-DD');
|
|
|
+ var start=moment(value).format('YYYY-MM-DD');
|
|
|
+ var endType=this.form.getFieldValue('endType');
|
|
|
+ var startType=this.form.getFieldValue('startType');
|
|
|
if(end!=null){
|
|
|
- var start=new Date(value);
|
|
|
+ var starts=new Date(start);
|
|
|
var ends=new Date(end);
|
|
|
- if(ends.getTime()<start.getTime()){
|
|
|
+ if(ends.getTime()<starts.getTime()){
|
|
|
this.form.setFieldsValue({
|
|
|
- endDate:null
|
|
|
+ endDate:null,
|
|
|
+ holidayCount:0,
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ var count=0;
|
|
|
+ if(ends.getTime()==starts.getTime()){
|
|
|
+ if(endType==startType){
|
|
|
+ count=12;
|
|
|
+ }else{
|
|
|
+ count=24;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ for(var i=starts.getDate();i<=ends.getDate();i++){
|
|
|
+ if(i==starts.getDate()){
|
|
|
+ if(startType=="00:00:00"){
|
|
|
+ count+=24;
|
|
|
+ }else{
|
|
|
+ count+=12;
|
|
|
+ }
|
|
|
+ }else if(i==ends.getDate()){
|
|
|
+ if(endType=="00:00:00"){
|
|
|
+ count+=12;
|
|
|
+ }else{
|
|
|
+ count+=24;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ count+=24;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form.setFieldsValue({
|
|
|
+ holidayCount:count
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ validateendDate(rule, value, callback) {
|
|
|
+ if (!value) {
|
|
|
+ callback()
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ var start=moment(this.form.getFieldValue('startDate')).format('YYYY-MM-DD');
|
|
|
+ var end=moment(value).format('YYYY-MM-DD');
|
|
|
+ var endType=this.form.getFieldValue('endType');
|
|
|
+ var startType=this.form.getFieldValue('startType');
|
|
|
+ if(start!=null){
|
|
|
+ var starts=new Date(start);
|
|
|
+ var ends=new Date(end);
|
|
|
+ if(ends.getTime()<starts.getTime()){
|
|
|
+ this.form.setFieldsValue({
|
|
|
+ startDate:null,
|
|
|
+ holidayCount:0,
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ var count=0;
|
|
|
+ if(ends.getTime()==starts.getTime()){
|
|
|
+ if(endType==startType){
|
|
|
+ count=12;
|
|
|
+ }else{
|
|
|
+ count=24;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ for(var i=starts.getDate();i<=ends.getDate();i++){
|
|
|
+ if(i==starts.getDate()){
|
|
|
+ if(startType=="00:00:00"){
|
|
|
+ count+=24;
|
|
|
+ }else{
|
|
|
+ count+=12;
|
|
|
+ }
|
|
|
+ }else if(i==ends.getDate()){
|
|
|
+ if(endType=="00:00:00"){
|
|
|
+ count+=12;
|
|
|
+ }else{
|
|
|
+ count+=24;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ count+=24;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form.setFieldsValue({
|
|
|
+ holidayCount:count
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ validateendType(rule, value, callback) {
|
|
|
+ if (!value) {
|
|
|
+ callback()
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ var start=moment(this.form.getFieldValue('startDate')).format('YYYY-MM-DD');
|
|
|
+ var end=moment(this.form.getFieldValue('endDate')).format('YYYY-MM-DD');
|
|
|
+ var startType=this.form.getFieldValue('startType');
|
|
|
+ if(end!=null&&start!=null){
|
|
|
+ if(value!=startType){
|
|
|
+ if(value=="00:00:00"&&startType=="12:00:00"){
|
|
|
+ this.form.setFieldsValue({
|
|
|
+ startType:"00:00:00"
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ var startTypes=this.form.getFieldValue('startType');
|
|
|
+ var starts=new Date(start);
|
|
|
+ var ends=new Date(end);
|
|
|
+ var count=0;
|
|
|
+ if(ends.getTime()==starts.getTime()){
|
|
|
+ if(value==startTypes){
|
|
|
+ count=12;
|
|
|
+ }else{
|
|
|
+ count=24;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ for(var i=starts.getDate();i<=ends.getDate();i++){
|
|
|
+ if(i==starts.getDate()){
|
|
|
+ if(startTypes=="00:00:00"){
|
|
|
+ count+=24;
|
|
|
+ }else{
|
|
|
+ count+=12;
|
|
|
+ }
|
|
|
+ }else if(i==ends.getDate()){
|
|
|
+ if(value=="00:00:00"){
|
|
|
+ count+=12;
|
|
|
+ }else{
|
|
|
+ count+=24;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ count+=24;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form.setFieldsValue({
|
|
|
+ holidayCount:count
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ validatestartType(rule, value, callback) {
|
|
|
+ if (!value) {
|
|
|
+ callback()
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ var start=moment(this.form.getFieldValue('startDate')).format('YYYY-MM-DD');
|
|
|
+ var end=moment(this.form.getFieldValue('endDate')).format('YYYY-MM-DD');
|
|
|
+ var endType=this.form.getFieldValue('endType');
|
|
|
+ if(end!=null&&start!=null){
|
|
|
+ if(value!=endType){
|
|
|
+ if(value=="12:00:00"&&endType=="00:00:00"){
|
|
|
+ this.form.setFieldsValue({
|
|
|
+ endType:"12:00:00"
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var endTypes=this.form.getFieldValue('endType');
|
|
|
+ var starts=new Date(start);
|
|
|
+ var ends=new Date(end);
|
|
|
+ var count=0;
|
|
|
+ if(ends.getTime()==starts.getTime()){
|
|
|
+ if(value==endTypes){
|
|
|
+ count=12;
|
|
|
+ }else{
|
|
|
+ count=24;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ for(var i=starts.getDate();i<=ends.getDate();i++){
|
|
|
+ if(i==starts.getDate()){
|
|
|
+ if(endTypes=="00:00:00"){
|
|
|
+ count+=24;
|
|
|
+ }else{
|
|
|
+ count+=12;
|
|
|
+ }
|
|
|
+ }else if(i==ends.getDate()){
|
|
|
+ if(value=="00:00:00"){
|
|
|
+ count+=12;
|
|
|
+ }else{
|
|
|
+ count+=24;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ count+=24;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form.setFieldsValue({
|
|
|
+ holidayCount:count
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
queryDeptName(e){
|
|
|
getAction(this.url.dept,{id:e}).then((res)=>{
|
|
|
if(res.success){
|