guhongwei 4 years ago
parent
commit
50c68e98c7
1 changed files with 62 additions and 4 deletions
  1. 62 4
      src/views/leave/confirm.vue

+ 62 - 4
src/views/leave/confirm.vue

@@ -1,25 +1,83 @@
 <template>
 <template>
   <div id="confirm">
   <div id="confirm">
-    <p>班主任确认学生退出</p>
+    <van-row>
+      <van-col span="24">
+        <van-col span="24">
+          <van-form>
+            <van-field v-model="form.stuname" name="姓名" label="姓名" readonly />
+            <van-field name="radio" label="请假类型">
+              <template #input>
+                <van-radio-group v-model="form.type" direction="horizontal" disabled>
+                  <van-radio name="0">请假</van-radio>
+                  <van-radio name="1">退出</van-radio>
+                </van-radio-group>
+              </template>
+            </van-field>
+            <van-field readonly clickable name="date" :value="form.starttime" label="开始时间" />
+            <van-field readonly clickable name="date" :value="form.endtime" label="结束时间" v-if="form.type == '0'" />
+            <van-field v-model="form.reason" name="请假理由" label="请假理由" readonly />
+            <div style="margin: 16px;">
+              <van-button round block type="info" @click="onSubmit">
+                确认
+              </van-button>
+            </div>
+          </van-form>
+        </van-col>
+      </van-col>
+    </van-row>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
 import { mapState, createNamespacedHelpers } from 'vuex';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: leave } = createNamespacedHelpers('leave');
+const { mapActions: student } = createNamespacedHelpers('student');
 export default {
 export default {
   name: 'confirm',
   name: 'confirm',
   props: {},
   props: {},
   components: {},
   components: {},
   data: function() {
   data: function() {
-    return {};
+    return {
+      form: {},
+    };
+  },
+  async created() {
+    console.log(this.id);
+    if (this.id) {
+      await this.search();
+    }
+  },
+  methods: {
+    ...leave({ leavefetch: 'fetch' }),
+    ...student(['fetch', 'update']),
+    async search() {
+      let res = await this.leavefetch(this.id);
+      if (res.errcode === 0) {
+        this.$set(this, `form`, res.data);
+      }
+    },
+    // 提交
+    async onSubmit() {
+      let data = this.form;
+      data.id = data.studentid;
+      data.isComming = '2';
+      let res = await this.update(data);
+      if (res.errcode === 0) {
+        this.$notify({
+          message: '确认成功',
+          type: 'success',
+        });
+      }
+    },
   },
   },
-  created() {},
-  methods: {},
   computed: {
   computed: {
     ...mapState(['user']),
     ...mapState(['user']),
     pageTitle() {
     pageTitle() {
       return `${this.$route.meta.title}`;
       return `${this.$route.meta.title}`;
     },
     },
+    id() {
+      return this.$route.query.id;
+    },
   },
   },
   metaInfo() {
   metaInfo() {
     return { title: this.$route.meta.title };
     return { title: this.$route.meta.title };