|
@@ -8,6 +8,9 @@
|
|
|
</el-row>
|
|
|
<data-table :fields="fields" :data="list" :opera="opera" @msg="toSendMsg" :usePage="false"></data-table>
|
|
|
</detail-frame>
|
|
|
+ <el-dialog title="通知内容" :visible.sync="dialogSend">
|
|
|
+ <send-form :form="form" @resetForm="resetForm" @submitForm="submitForm"></send-form>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -15,12 +18,15 @@
|
|
|
import _ from 'lodash';
|
|
|
import dataTable from '@frame/components/filter-page-table';
|
|
|
import detailFrame from '@frame/layout/admin/detail-frame';
|
|
|
+import sendForm from './parts/send-form';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
+const { mapActions: student } = createNamespacedHelpers('student');
|
|
|
+const { mapActions: notice } = createNamespacedHelpers('notice');
|
|
|
export default {
|
|
|
name: 'remind',
|
|
|
props: {},
|
|
|
- components: { detailFrame, dataTable },
|
|
|
+ components: { detailFrame, dataTable, sendForm },
|
|
|
data: function() {
|
|
|
return {
|
|
|
loading: false,
|
|
@@ -38,11 +44,16 @@ export default {
|
|
|
{ label: '批次', prop: 'batch' },
|
|
|
{ label: '班级', prop: 'name' },
|
|
|
],
|
|
|
+ dialogSend: false,
|
|
|
+ form: {},
|
|
|
+ classid: '',
|
|
|
};
|
|
|
},
|
|
|
created() {},
|
|
|
methods: {
|
|
|
...classes(['query']),
|
|
|
+ ...student({ getStudentList: 'query' }),
|
|
|
+ ...notice({ noticeCreate: 'create' }),
|
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
let { termid } = this.options;
|
|
|
const res = await this.query({ skip, limit, ...info, termid });
|
|
@@ -51,8 +62,31 @@ export default {
|
|
|
this.$set(this, `total`, res.total);
|
|
|
}
|
|
|
},
|
|
|
+ // 通知打开
|
|
|
toSendMsg({ data }) {
|
|
|
- this.sendMsg([data._id]);
|
|
|
+ this.$set(this, `classid`, data.id);
|
|
|
+ this.dialogSend = true;
|
|
|
+ },
|
|
|
+ // 取消提交
|
|
|
+ resetForm() {
|
|
|
+ this.form = {};
|
|
|
+ this.dialogSend = false;
|
|
|
+ },
|
|
|
+ // 通知确定
|
|
|
+ async submitForm({ data }) {
|
|
|
+ let classid = this.classid;
|
|
|
+ let res = await this.getStudentList({ classid });
|
|
|
+ var notified = res.data.map(item => ({ notifiedid: item.id }));
|
|
|
+ data.noticeid = this.user.id;
|
|
|
+ data.notified = notified;
|
|
|
+ const arr = await this.noticeCreate(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '通知成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.resetForm();
|
|
|
+ }
|
|
|
},
|
|
|
toSelect(val) {
|
|
|
this.selected = val;
|