2021-10-28 00:51:57 +08:00
|
|
|
<template>
|
|
|
|
<div class="app-container">
|
|
|
|
<!-- 对话框(添加 / 修改) -->
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
<el-form-item label="开始时间" prop="startTime">
|
|
|
|
<el-date-picker clearable size="small" v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择开始时间" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="结束时间" prop="endTime">
|
|
|
|
<el-date-picker clearable size="small" v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择结束时间" />
|
|
|
|
</el-form-item>
|
2022-01-22 21:49:50 +08:00
|
|
|
<el-form-item label="请假类型" prop="type">
|
|
|
|
<el-select v-model="form.type" placeholder="请选择">
|
|
|
|
<el-option v-for="dict in typeDictData" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/>
|
2021-10-28 00:51:57 +08:00
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="原因" prop="reason">
|
|
|
|
<el-col :span="10">
|
2022-01-22 21:49:50 +08:00
|
|
|
<el-input type="textarea" :rows="3" v-model="form.reason" placeholder="请输入原因" />
|
2021-10-28 00:51:57 +08:00
|
|
|
</el-col>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
2022-01-22 21:49:50 +08:00
|
|
|
<el-button type="primary" @click="submitForm">提 交</el-button>
|
2021-10-28 00:51:57 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-01-22 21:49:50 +08:00
|
|
|
import { createLeave} from "@/api/oa/leave"
|
|
|
|
import { getDictDatas, DICT_TYPE } from '@/utils/dict'
|
2021-10-28 00:51:57 +08:00
|
|
|
export default {
|
2022-01-22 19:20:00 +08:00
|
|
|
name: "LeaveCreate",
|
2021-10-28 00:51:57 +08:00
|
|
|
components: {
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
// 表单参数
|
2021-11-07 17:38:00 +08:00
|
|
|
form: {
|
2022-01-22 21:49:50 +08:00
|
|
|
startTime: undefined,
|
|
|
|
endTime: undefined,
|
|
|
|
type: undefined,
|
|
|
|
reason: undefined,
|
2021-11-07 17:38:00 +08:00
|
|
|
},
|
2021-10-28 00:51:57 +08:00
|
|
|
// 表单校验
|
|
|
|
rules: {
|
|
|
|
startTime: [{ required: true, message: "开始时间不能为空", trigger: "blur" }],
|
|
|
|
endTime: [{ required: true, message: "结束时间不能为空", trigger: "blur" }],
|
2022-01-22 21:49:50 +08:00
|
|
|
type: [{ required: true, message: "请假类型不能为空", trigger: "change" }],
|
|
|
|
reason: [{ required: true, message: "请假原因不能为空", trigger: "change" }],
|
2021-10-28 00:51:57 +08:00
|
|
|
},
|
2021-11-07 17:38:00 +08:00
|
|
|
|
2022-01-22 21:49:50 +08:00
|
|
|
typeDictData: getDictDatas(DICT_TYPE.BPM_OA_LEAVE_TYPE),
|
2021-10-28 00:51:57 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
/** 提交按钮 */
|
|
|
|
submitForm() {
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
if (!valid) {
|
|
|
|
return;
|
|
|
|
}
|
2021-11-07 17:38:00 +08:00
|
|
|
|
2021-10-28 00:51:57 +08:00
|
|
|
// 添加的提交
|
2022-01-22 21:49:50 +08:00
|
|
|
createLeave(this.form).then(response => {
|
|
|
|
this.msgSuccess("发起成功");
|
|
|
|
this.$store.dispatch("tagsView/delView", this.$route);
|
|
|
|
this.$router.push({ path: "/bpm/oa/leave"});
|
2021-10-28 00:51:57 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|