|
@@ -14,27 +14,41 @@
|
|
|
<a-button @click="handleOk" type="primary" style="margin-left: 8px;">确认</a-button>
|
|
|
</template>
|
|
|
<div class="table-page-search-wrapper">
|
|
|
- <a-form-model layout="inline" ref="form" :model="formState" >
|
|
|
+ <a-form-model layout="inline" ref="form" :model="formState" :rules="validatorRules">
|
|
|
<a-row :gutter="24">
|
|
|
+ <a-col :md="24">
|
|
|
+ <a-form-model-item label="类型" prop="type" :labelCol="{offset: 4}">
|
|
|
+ <a-select v-model="formState.type" @change="changeType">
|
|
|
+ <a-select-option value="加班工资单">加班工资单</a-select-option>
|
|
|
+ <a-select-option value="年休工资单">年休工资单</a-select-option>
|
|
|
+ <a-select-option value="月度工资">月度工资</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
<a-col :md="24" >
|
|
|
- <a-form-model-item label="年月" prop="name">
|
|
|
- <a-month-picker placeholder="请选择" v-model="formState.yearMonth" @change="onChange" style="width:100% !important"/>
|
|
|
+ <a-form-model-item label="计算月份" prop="yearWithMonth" :labelCol="{offset: 2}" v-if="formState.type=='加班工资单'||formState.type=='月度工资'">
|
|
|
+ <a-month-picker placeholder="请选择" v-model="formState.yearWithMonth" style="width:100% !important"/>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="24">
|
|
|
- <a-form-model-item label="类型" prop="totalNum">
|
|
|
- <a-select v-model="formState.type">
|
|
|
- <a-select-option value="加班费">加班费</a-select-option>
|
|
|
- <a-select-option value="年休假补贴">年休假补贴</a-select-option>
|
|
|
- <a-select-option value="月底工资">月底工资</a-select-option>
|
|
|
- </a-select>
|
|
|
+ <a-col :md="24" >
|
|
|
+ <a-form-model-item label="计算年份" prop="yearWith" :labelCol="{offset: 2}" v-if="formState.type=='年休工资单'">
|
|
|
+ <a-date-picker placeholder="请选择" :open="isopen" mode="year" v-model="formState.yearWith" format="YYYY" style="width:100% !important" @openChange="changeopen" @panelChange="handlePanelChange1"/>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="24">
|
|
|
- <a-form-model-item label="文件" >
|
|
|
- <a-upload name="file" :multiple="false" action="https://www.mocky.io/v2/5cc8019d300000980a055e76" :headers="headers" @change="handleChange" >
|
|
|
- <a-button> <a-icon type="upload" /> 上 传 </a-button>
|
|
|
- </a-upload>
|
|
|
+ <a-col :md="24" >
|
|
|
+ <a-form-model-item label="加班月份区间" prop="DateTime" v-if="formState.type=='加班工资单'">
|
|
|
+ <a-range-picker
|
|
|
+ style="width: 100% !important"
|
|
|
+ v-model="formState.DateTime"
|
|
|
+ format="YYYY-MM"
|
|
|
+ valueFormat="YYYY-MM"
|
|
|
+ :mode="mode2"
|
|
|
+ :open="open"
|
|
|
+ :placeholder="['开始时间', '结束时间']"
|
|
|
+ @panelChange="handlePanelChange2"
|
|
|
+ @openChange="onDateChange"
|
|
|
+ @change="changeData"
|
|
|
+ />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
@@ -48,7 +62,7 @@
|
|
|
import moment from 'moment'
|
|
|
import pick from 'lodash.pick'
|
|
|
import { FormTypes } from '@/utils/JEditableTableUtil'
|
|
|
- import { putAction,getAction } from '@/api/manage'
|
|
|
+ import { putAction,getAction,postAction } from '@/api/manage'
|
|
|
export default {
|
|
|
name: 'uploadModal',
|
|
|
components: {
|
|
@@ -56,14 +70,25 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- formState:{},
|
|
|
+ formState:{
|
|
|
+ type:'月度工资',
|
|
|
+ yearWithMonth:moment().subtract(1, 'months'),
|
|
|
+ DateTime:[],
|
|
|
+ yearWith:''
|
|
|
+ },
|
|
|
+ DateTime:[],
|
|
|
+ open: false,
|
|
|
+ isopen:false,
|
|
|
dataSource: [{}],
|
|
|
+ mode2: ['month', 'month'],
|
|
|
visible:false,
|
|
|
- loading:false,
|
|
|
- headers: {
|
|
|
- authorization: 'authorization-text',
|
|
|
- },
|
|
|
-
|
|
|
+ loading:false,
|
|
|
+ validatorRules: {
|
|
|
+ type: [{required: true, message: '请选择!' }],
|
|
|
+ yearWithMonth: [{required: true, message: '请选择!' }],
|
|
|
+ DateTime: [{required: true, message: '请选择!',trigger: 'change' }],
|
|
|
+ yearWith: [{required: true, message: '请选择!',trigger: 'change' }],
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
created(){
|
|
@@ -73,14 +98,89 @@
|
|
|
methods: {
|
|
|
handleCancel(){
|
|
|
this.visible = false
|
|
|
+ this.formState={
|
|
|
+ type:'月度工资',
|
|
|
+ yearWithMonth:moment().subtract(1, 'months')
|
|
|
+ }
|
|
|
+ // this.DateTime = []
|
|
|
+ },
|
|
|
+ changeType(data){
|
|
|
+ if(data=='月度工资'){
|
|
|
+ this.formState={
|
|
|
+ type:'月度工资',
|
|
|
+ yearWithMonth:moment().subtract(1, 'months')
|
|
|
+ }
|
|
|
+ }else if(data=='加班工资单'){
|
|
|
+ this.formState={
|
|
|
+ type:'加班工资单',
|
|
|
+ yearWithMonth:moment().subtract(1, 'months'),
|
|
|
+ DateTime:[]
|
|
|
+ }
|
|
|
+ }else if(data=='年休工资单'){
|
|
|
+ this.formState={
|
|
|
+ type:'年休工资单',
|
|
|
+ yearWith:''
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
handleOk(){
|
|
|
+ this.$refs.form.validate((valid,err) => {
|
|
|
+ if (valid) {
|
|
|
+ if(this.formState.type=='加班工资单'){
|
|
|
+ this.formState.beginMonth = moment(this.formState.DateTime[0]).format('YYYY-MM')
|
|
|
+ this.formState.endMonth = moment(this.formState.DateTime[1]).format('YYYY-MM')
|
|
|
+ delete this.formState.DateTime
|
|
|
+ }
|
|
|
+ if(this.formState.type=='加班工资单'||this.formState.type=='月度工资'){
|
|
|
+ this.formState.yearWithMonth = moment(this.formState.yearWithMonth).format('YYYY-MM')
|
|
|
+ }
|
|
|
+ if(this.formState.type=='年休工资单'){
|
|
|
+ this.formState.yearWith = moment(this.formState.yearWith).format('YYYY')
|
|
|
+ }
|
|
|
+
|
|
|
+ this.loading = true
|
|
|
+ postAction('/salary/salaryManagement/generatePayroll', this.formState).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success(res.message);
|
|
|
+ this.handleCancel()
|
|
|
+ this.$emit('ok')
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
- onChange(data){
|
|
|
+ changeData(value){
|
|
|
+ this.formState.DateTime = value
|
|
|
},
|
|
|
- handleChange(){
|
|
|
+ onDateChange(status) {
|
|
|
+ if(status){
|
|
|
+ this.open = true;
|
|
|
+ }else{
|
|
|
+ this.open = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handlePanelChange2(value,mode){
|
|
|
+ if (this.formState.DateTime[1] && this.formState.DateTime[1]._d != value[1]._d) {
|
|
|
+ this.open = false;
|
|
|
+ this.$refs.form.clearValidate();
|
|
|
+ }
|
|
|
+ this.formState.DateTime = value
|
|
|
+ this.mode2 = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]];
|
|
|
+ },
|
|
|
+ handlePanelChange1(value){
|
|
|
+ this.isopen = false
|
|
|
+ this.formState.yearWith =value
|
|
|
|
|
|
+ },
|
|
|
+ changeopen(status){
|
|
|
+ if(status){
|
|
|
+ this.isopen = true
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|