|
@@ -8,13 +8,16 @@
|
|
|
<el-form-item label="姓名">{{ operaObject.name }}</el-form-item>
|
|
|
<el-form-item label="原因">{{ operaObject.reason }}</el-form-item>
|
|
|
<el-form-item label="时间">{{ operaObject.time }}</el-form-item>
|
|
|
+ <el-form-item label="拒绝原因">
|
|
|
+ <el-input size="mini" v-model="operaObject.refcause" placeholder="拒绝原因非必填"></el-input>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-row type="flex" justify="middle" align="center">
|
|
|
<el-col :span="7">
|
|
|
- <el-button type="primary" size="mini" @click="setCheck('0')">通过</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="setCheck('1')">通过</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="7">
|
|
|
- <el-button type="danger" size="mini" @click="setCheck('1')">拒绝</el-button>
|
|
|
+ <el-button type="danger" size="mini" @click="setCheck('2')">拒绝</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form-item>
|
|
@@ -26,8 +29,10 @@
|
|
|
<script>
|
|
|
import listFrame from '@frame/layout/admin/list-frame';
|
|
|
import dataTable from '@frame/components/data-table';
|
|
|
+import _ from 'lodash';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
-const { mapActions } = createNamespacedHelpers('dept');
|
|
|
+const { mapActions } = createNamespacedHelpers('leave');
|
|
|
+const { mapActions: student } = createNamespacedHelpers('student');
|
|
|
export default {
|
|
|
metaInfo: { title: '请假管理' },
|
|
|
name: 'index',
|
|
@@ -35,11 +40,6 @@ export default {
|
|
|
components: { listFrame, dataTable },
|
|
|
data: () => ({
|
|
|
opera: [
|
|
|
- {
|
|
|
- label: '查看学生详情',
|
|
|
- icon: 'el-icon-document',
|
|
|
- method: 'edit',
|
|
|
- },
|
|
|
{
|
|
|
label: '请假审核',
|
|
|
icon: 'el-icon-s-check',
|
|
@@ -50,13 +50,16 @@ export default {
|
|
|
{ label: '学生姓名', prop: 'name' },
|
|
|
{ label: '时间', prop: 'time' },
|
|
|
{ label: '理由', prop: 'reason' },
|
|
|
+ { label: '审核状态', prop: 'status', format: i => (i === '0' ? '审核中' : i === '1' ? '通过' : '未通过') },
|
|
|
],
|
|
|
- list: [{ name: '测试学生1', time: '2020-05-01 - 2020-05-01', reason: '发烧' }],
|
|
|
+ list: [],
|
|
|
total: 0,
|
|
|
dialog: false,
|
|
|
operaObject: {},
|
|
|
}),
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
|
mainTitle() {
|
|
@@ -72,10 +75,18 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
- ...mapActions(['query', 'delete']),
|
|
|
+ ...mapActions(['query', 'delete', 'update']),
|
|
|
+ ...student({ allRequest: 'mergeRequest' }),
|
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
- const res = await this.query({ skip, limit, ...info });
|
|
|
+ const res = await this.query({ skip, limit, ...info, schid: this.user.code });
|
|
|
if (this.$checkRes(res)) {
|
|
|
+ let studs = await this.allRequest({ method: 'fetch', data: _.uniq(res.data.map(i => i.studentid)) });
|
|
|
+ res.data.map(i => {
|
|
|
+ let student = studs.find(f => f._id === i.studentid);
|
|
|
+ if (student) i.name = student.name;
|
|
|
+ i.time = `${i.starttime} 至 ${i.endtime}`;
|
|
|
+ return i;
|
|
|
+ });
|
|
|
this.$set(this, `list`, res.data);
|
|
|
this.$set(this, `total`, res.total);
|
|
|
}
|
|
@@ -90,7 +101,12 @@ export default {
|
|
|
},
|
|
|
async setCheck(status) {
|
|
|
//TODO 请假审核
|
|
|
- this.toClose();
|
|
|
+ let object = { id: this.operaObject.id, status: status, studentid: this.operaObject.studentid, refcause: this.operaObject.refcause };
|
|
|
+ let res = await this.update(object);
|
|
|
+ if (this.$checkRes(res, '审核成功', '审核失败')) {
|
|
|
+ this.toClose();
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
},
|
|
|
toClose() {
|
|
|
this.dialog = false;
|