|
@@ -1,30 +1,26 @@
|
|
|
<template>
|
|
|
- <div id="completion">
|
|
|
- <detail-frame :title="pageTitle" :returns="toreturn">
|
|
|
- <self-cards title="问卷列表">
|
|
|
- <data-table :fields="fields" :data="list" :opera="opera" @data="toData" :usePage="false"></data-table>
|
|
|
- </self-cards>
|
|
|
- </detail-frame>
|
|
|
+ <div id="index">
|
|
|
+ <list-frame title="问卷列表" @query="search" :needPag="false" :filter="filFields" :needAdd="false">
|
|
|
+ <data-table :fields="fields" :data="list" :opera="opera" @data="toData" :usePage="false"></data-table>
|
|
|
+ </list-frame>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import dataTable from '@frame/components/filter-page-table';
|
|
|
-import detailFrame from '@frame/layout/admin/detail-frame';
|
|
|
-import selfCards from '@frame/parts/cards';
|
|
|
import _ from 'lodash';
|
|
|
+import listFrame from '@frame/layout/admin/list-frame';
|
|
|
+import dataTable from '@frame/components/filter-page-table';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
-const { mapActions: completion } = createNamespacedHelpers('completion');
|
|
|
-const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
-const { mapActions: termquest } = createNamespacedHelpers('termquest');
|
|
|
const { mapActions: questionnaire } = createNamespacedHelpers('questionnaire');
|
|
|
const { mapActions: util } = createNamespacedHelpers('util');
|
|
|
|
|
|
export default {
|
|
|
- metaInfo: { title: '问卷统计' },
|
|
|
- name: 'completion',
|
|
|
+ name: 'index',
|
|
|
props: {},
|
|
|
- components: { detailFrame, dataTable, selfCards },
|
|
|
+ components: {
|
|
|
+ listFrame,
|
|
|
+ dataTable,
|
|
|
+ },
|
|
|
data: () => ({
|
|
|
opera: [
|
|
|
{
|
|
@@ -45,7 +41,12 @@ export default {
|
|
|
total: 0,
|
|
|
}),
|
|
|
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ // this.search();
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user', 'defaultOption']),
|
|
|
+ },
|
|
|
methods: {
|
|
|
...util({ modelFetch: 'fetch' }),
|
|
|
...questionnaire(['query', 'delete']),
|
|
@@ -55,7 +56,12 @@ export default {
|
|
|
let unusaul = await this.modelFetch({ model: 'termquest', termid });
|
|
|
let uqlist = []; //非常用问卷
|
|
|
let usual = []; //常用问卷
|
|
|
- if (this.$checkRes(unusaul)) uqlist = unusaul.data.questionnaireid;
|
|
|
+ if (this.$checkRes(unusaul)) {
|
|
|
+ if (_.get(unusaul, 'data')) {
|
|
|
+ let { questionnaireid } = unusaul.data;
|
|
|
+ uqlist = unusaul.data.questionnaireid;
|
|
|
+ }
|
|
|
+ }
|
|
|
let res = await this.query({ ...info });
|
|
|
if (this.$checkRes(res)) {
|
|
|
usual = res.data.filter(i => i.type == 0 && i.status == 1);
|
|
@@ -65,23 +71,17 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
toData({ data }) {
|
|
|
- let classid = _.get(this.defaultOption, 'classid');
|
|
|
- this.$router.push({ path: './detail', query: { questionnaireid: data.id, classid } });
|
|
|
- },
|
|
|
- toReturns() {
|
|
|
- this.views = 'quest';
|
|
|
- },
|
|
|
- toreturn() {
|
|
|
- window.history.go(-1);
|
|
|
+ let termid = _.get(this.defaultOption, 'termid');
|
|
|
+ this.$router.push({ path: './detail', query: { questionnaireid: data.id, termid, classid: this.defaultOption.classid } });
|
|
|
},
|
|
|
- },
|
|
|
- computed: {
|
|
|
- ...mapState(['user', 'defaultOption']),
|
|
|
- id() {
|
|
|
- return this.$route.query.id;
|
|
|
+ async toDelete({ data }) {
|
|
|
+ const res = await this.delete(data.id);
|
|
|
+ this.$checkRes(res, '删除成功', '删除失败');
|
|
|
+ this.search();
|
|
|
},
|
|
|
- pageTitle() {
|
|
|
- return `${this.$route.meta.title}`;
|
|
|
+ toClass({ data }) {
|
|
|
+ let termid = _.get(this.defaultOption, 'termid');
|
|
|
+ this.$router.push({ path: '/statistics/question/class', query: { termid, questionnaireid: data._id, title: data.name } });
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
@@ -93,8 +93,8 @@ export default {
|
|
|
this.$set(this, `options`, _.cloneDeep(val));
|
|
|
this.search();
|
|
|
} else {
|
|
|
- let ntermid = _.get(val, 'termid');
|
|
|
- let otermid = _.get(this.options, 'termid');
|
|
|
+ let ntermid = _.get(val, 'classid');
|
|
|
+ let otermid = _.get(this.options, 'classid');
|
|
|
if (ntermid && !_.isEqual(ntermid, otermid)) {
|
|
|
this.$set(this, `options`, _.cloneDeep(val));
|
|
|
this.search();
|