|
@@ -0,0 +1,149 @@
|
|
|
+<template>
|
|
|
+ <div id="remind">
|
|
|
+ <detail-frame :title="pageTitle" v-if="view === 'list'">
|
|
|
+ <el-row type="flex" align="middle" justify="end" class="btn_bar">
|
|
|
+ <el-col :span="2">
|
|
|
+ <el-button type="primary" size="mini" @click="toSendMsg()">发送通知</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <data-table :fields="fields" :data="list" :opera="opera" @view="toView" :total="total" @query="search"></data-table>
|
|
|
+ </detail-frame>
|
|
|
+ <detail-frame title="通知确认" v-if="view === 'result'" :returns="toReturns">
|
|
|
+ <el-row type="flex" align="middle" justify="end" class="btn_bar">
|
|
|
+ <el-col :span="3">
|
|
|
+ <el-button type="primary" size="mini" @click="toResend()">再次通知未确认人员</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <data-table :fields="resFields" :data="result.notified" :opera="[]" :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>
|
|
|
+
|
|
|
+<script>
|
|
|
+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.vue';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: notice } = createNamespacedHelpers('notice');
|
|
|
+export default {
|
|
|
+ name: 'remind',
|
|
|
+ props: {},
|
|
|
+ components: { detailFrame, dataTable, sendForm },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ view: 'list',
|
|
|
+ loading: false,
|
|
|
+ options: undefined,
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ opera: [
|
|
|
+ {
|
|
|
+ label: '查看通知情况',
|
|
|
+ icon: 'el-icon-view',
|
|
|
+ method: 'view',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fields: [{ label: '内容', prop: 'content' }],
|
|
|
+ dialogSend: false,
|
|
|
+ form: {
|
|
|
+ type: '0',
|
|
|
+ },
|
|
|
+ result: {},
|
|
|
+ resFields: [
|
|
|
+ { label: '通知人员', prop: 'username' },
|
|
|
+ { label: '状态', prop: 'status', format: i => (i == '0' ? '未确认' : '已确认') },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ ...notice({ noticeCreate: 'create', getNotice: 'query', resend: 'resend' }),
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ let { classid } = this.options;
|
|
|
+ if (!classid) return;
|
|
|
+ const res = await this.getNotice({ skip, limit, ...info, classid });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 通知打开
|
|
|
+ toSendMsg({ data } = {}) {
|
|
|
+ if (data) this.$set(this, `classid`, data.id);
|
|
|
+ this.dialogSend = true;
|
|
|
+ },
|
|
|
+ // 取消提交
|
|
|
+ resetForm() {
|
|
|
+ this.form = {};
|
|
|
+ this.dialogSend = false;
|
|
|
+ },
|
|
|
+ // 通知确定
|
|
|
+ async submitForm({ data }) {
|
|
|
+ let { classid } = this.defaultOption;
|
|
|
+ if (classid) {
|
|
|
+ data.classid = classid;
|
|
|
+ }
|
|
|
+ data.noticeid = this.user.userid;
|
|
|
+ let { planyearid, planid, termid } = this.defaultOption;
|
|
|
+ data = { ...data, planyearid, planid, termid };
|
|
|
+ const arr = await this.noticeCreate(data);
|
|
|
+ if (this.$checkRes(arr)) {
|
|
|
+ this.$message({
|
|
|
+ message: '通知成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.search();
|
|
|
+ this.resetForm();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toView({ data }) {
|
|
|
+ this.$set(this, `result`, data);
|
|
|
+ this.view = 'result';
|
|
|
+ },
|
|
|
+ toReturns() {
|
|
|
+ this.view = 'list';
|
|
|
+ },
|
|
|
+ async toResend() {
|
|
|
+ const { _id } = this.result;
|
|
|
+ console.log(this.result);
|
|
|
+ const res = await this.resend({ id: _id });
|
|
|
+ if (res.errcode == '0') this.$message.success('再次通知成功');
|
|
|
+ else this.$message.error(res.errmsg || '通知失败');
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ defaultOption: {
|
|
|
+ immediate: true,
|
|
|
+ deep: true,
|
|
|
+ handler(val) {
|
|
|
+ if (!_.get(this, 'options')) {
|
|
|
+ this.$set(this, `options`, _.cloneDeep(val));
|
|
|
+ this.search();
|
|
|
+ } else {
|
|
|
+ let ntermid = _.get(val, 'termid');
|
|
|
+ let otermid = _.get(this.options, 'termid');
|
|
|
+ if (ntermid && !_.isEqual(ntermid, otermid)) {
|
|
|
+ this.$set(this, `options`, _.cloneDeep(val));
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user', 'defaultOption']),
|
|
|
+ pageTitle() {
|
|
|
+ return `${this.$route.meta.title}`;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|