|
@@ -0,0 +1,83 @@
|
|
|
+<template>
|
|
|
+ <div id="newspaper">
|
|
|
+ <list-frame title="新人才报" @query="search" :total="total" :needFilter="false" :needAdd="false">
|
|
|
+ <data-table :fields="fields" :data="list" :opera="opera" @download="download"></data-table>
|
|
|
+ </list-frame>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import _ from 'lodash';
|
|
|
+import listFrame from '@frame/layout/admin/list-frame';
|
|
|
+import dataTable from '@frame/components/data-table';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: talented } = createNamespacedHelpers('talented');
|
|
|
+
|
|
|
+export default {
|
|
|
+ metaInfo: { title: '新人才报' },
|
|
|
+ name: 'newspaper',
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ listFrame,
|
|
|
+ dataTable,
|
|
|
+ },
|
|
|
+ data: () => ({
|
|
|
+ opera: [
|
|
|
+ {
|
|
|
+ label: '下载',
|
|
|
+ icon: 'el-icon-download',
|
|
|
+ method: 'download',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fields: [{ label: '姓名', prop: 'stuname' }],
|
|
|
+ list: [],
|
|
|
+ classList: [],
|
|
|
+ total: 0,
|
|
|
+ }),
|
|
|
+ async created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ computed: { ...mapState(['user', 'defaultOption']) },
|
|
|
+ methods: {
|
|
|
+ ...talented(['query', 'export']),
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ this.$set(this, `total`, 0);
|
|
|
+ const { classid } = this.defaultOption;
|
|
|
+ if (!classid) return;
|
|
|
+ const res = await this.query({ ...this.searchInfo, skip, limit, classid });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 下载
|
|
|
+ async download({ data }) {
|
|
|
+ const { id } = data;
|
|
|
+ const r = await this.export({ id });
|
|
|
+ if (this.$checkRes(r)) {
|
|
|
+ window.open(r.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async toGetStudent(classid) {
|
|
|
+ const res = await this.getStudent({ classid, job: '宣传委员' });
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `studentList`, res.data);
|
|
|
+ },
|
|
|
+ async toExport(data) {
|
|
|
+ const r = await this.export(data);
|
|
|
+ if (this.$checkRes(r)) {
|
|
|
+ window.open(r.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ defaultOption: {
|
|
|
+ deep: true,
|
|
|
+ handler(val, oval) {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|