houzhongjian
2024-07-11 759b1c71011abd6b58c37d2566f3f3c208c2f1b2
提交 | 用户 | 时间
759b1c 1 <template>
H 2   <div class="app-container">
3     <!-- 对话框(添加 / 修改) -->
4       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
5         <el-form-item label="开始时间" prop="startTime">
6           <el-date-picker clearable size="small" v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择开始时间" />
7         </el-form-item>
8         <el-form-item label="结束时间" prop="endTime">
9           <el-date-picker clearable size="small" v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择结束时间" />
10         </el-form-item>
11         <el-form-item label="请假类型" prop="type">
12           <el-select v-model="form.type" placeholder="请选择">
13             <el-option v-for="dict in typeDictData" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/>
14           </el-select>
15         </el-form-item>
16         <el-form-item label="原因" prop="reason">
17           <el-col :span="10">
18             <el-input type="textarea" :rows="3" v-model="form.reason" placeholder="请输入原因" />
19           </el-col>
20         </el-form-item>
21         <el-form-item>
22           <el-button type="primary" @click="submitForm">提 交</el-button>
23         </el-form-item>
24       </el-form>
25   </div>
26 </template>
27
28 <script>
29 import { createLeave}  from "@/api/bpm/leave"
30 import { getDictDatas, DICT_TYPE } from '@/utils/dict'
31
32 export default {
33   name: "BpmOALeaveCreate",
34   components: {
35   },
36   data() {
37     return {
38       // 表单参数
39       form: {
40         startTime: undefined,
41         endTime: undefined,
42         type: undefined,
43         reason: undefined,
44       },
45       // 表单校验
46       rules: {
47         startTime: [{ required: true, message: "开始时间不能为空", trigger: "blur" }],
48         endTime: [{ required: true, message: "结束时间不能为空", trigger: "blur" }],
49         type: [{ required: true, message: "请假类型不能为空", trigger: "change" }],
50         reason: [{ required: true, message: "请假原因不能为空", trigger: "change" }],
51       },
52
53       typeDictData: getDictDatas(DICT_TYPE.BPM_OA_LEAVE_TYPE),
54     };
55   },
56   created() {
57   },
58   methods: {
59     /** 提交按钮 */
60     submitForm() {
61       this.$refs["form"].validate(valid => {
62         if (!valid) {
63           return;
64         }
65
66         // 添加的提交
67         createLeave(this.form).then(response => {
68           this.$modal.msgSuccess("发起成功");
69           this.$tab.closeOpenPage({ path: "/bpm/oa/leave" });
70         });
71       });
72     }
73   }
74 };
75 </script>