<template>
|
<div class="app-container">
|
<el-form :model="dataForm" status-icon ref="dataForm" label-width="100px" style="margin-top:10px;">
|
<el-row>
|
<el-col :xs="24":sm="12":md="12":lg="12":xl="12">
|
<el-date-picker
|
v-model="yearMonth"
|
type="month"
|
format="yyyy-MM"
|
value-format="yyyyMM"
|
@change="changeYearMonth"
|
placeholder="选择月">
|
</el-date-picker>
|
</el-col>
|
<el-col :xs="24":sm="12":md="12":lg="12":xl="12">
|
<el-input v-model="days2" placeholder="二班制度时间(小时)"></el-input>
|
<el-input v-model="days3" placeholder="三班制度时间(小时)"></el-input>
|
</el-col>
|
</el-row>
|
</el-form>
|
<div style="display: flex;justify-content: center;align-items: center;margin-top:15px;">
|
<el-button size="medium" slot="trigger" type="primary" @click="submitForm()">确定</el-button>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { getWorkDays, setWorkDays } from '@/api/MdcApi'
|
|
export default {
|
data() {
|
return {
|
dataForm: {
|
},
|
yearMonth: '',
|
days2: '',
|
days3: '',
|
pickerOptions: {
|
disabledDate(time) {
|
return time.getTime() > Date.now()
|
}
|
},
|
clearDate: ''
|
}
|
},
|
mounted() {
|
},
|
methods: {
|
changeYearMonth() {
|
getWorkDays(this.yearMonth).then(res => {
|
this.listLoading = false
|
if (res.result === 'SUCCESS') {
|
this.days2 = (res.days2 == null) ? '' : res.days2
|
this.days3 = (res.days3 == null) ? '' : res.days3
|
}
|
})
|
},
|
submitForm() {
|
if ((this.yearMonth === null) || (this.yearMonth === '')) {
|
this.$message.error('请选择月份')
|
return
|
}
|
if ((this.days2 === null) || (this.days2 === '')) {
|
this.$message.error('请输入二班制度时间')
|
return
|
}
|
if ((this.days3 === null) || (this.days3 === '')) {
|
this.$message.error('请输入三班制度时间')
|
return
|
}
|
this.listLoading = true
|
this.$refs.dataForm.validate((valid) => {
|
if (valid) {
|
console.log(this.yearMonth)
|
console.log(this.days2)
|
console.log(this.days3)
|
setWorkDays(this.yearMonth, this.days2, this.days3).then(res => {
|
this.listLoading = false
|
if (res.result === 'SUCCESS') {
|
this.$message.success('设置成功')
|
} else {
|
this.$message.error(res.result)
|
}
|
})
|
}
|
})
|
}
|
}
|
}
|
</script>
|