|
@@ -63,6 +63,8 @@ import dataForm from '@/components/form.vue';
|
|
|
import upload from '@/components/uploadone.vue';
|
|
|
import uploadfile from '@/components/uploaddock.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: question } = createNamespacedHelpers('question');
|
|
|
+const { mapActions: projectsolic } = createNamespacedHelpers('projectsolic');
|
|
|
export default {
|
|
|
metaInfo() {
|
|
|
return { title: this.$route.meta.title };
|
|
@@ -111,6 +113,7 @@ export default {
|
|
|
{ label: '信息内容', model: 'content', type: 'editor' },
|
|
|
],
|
|
|
// 项目征集列表
|
|
|
+ proid: '',
|
|
|
proopera: [],
|
|
|
profields: [
|
|
|
{ label: '项目名称', prop: 'name' },
|
|
@@ -126,35 +129,59 @@ export default {
|
|
|
await this.search();
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...question(['query', 'create', 'update', 'delete']),
|
|
|
+ ...projectsolic({ solicQuery: 'query', solicFetch: 'fetch' }),
|
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
- console.log('查询');
|
|
|
+ const res = await this.query({ skip, limit, ...info });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
},
|
|
|
// 修改
|
|
|
toEdit({ data }) {
|
|
|
- console.log(data);
|
|
|
+ this.$set(this, 'form', _.cloneDeep(data));
|
|
|
+ this.display = 'detail';
|
|
|
},
|
|
|
// 删除
|
|
|
- toDelete({ data }) {
|
|
|
- console.log(data);
|
|
|
+ async toDelete({ data }) {
|
|
|
+ const res = await this.delete(data.id);
|
|
|
+ if (this.$checkRes(res, '删除成功', '删除失败' || res.errmsg)) {
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
},
|
|
|
// 添加数据
|
|
|
add() {
|
|
|
this.display = 'detail';
|
|
|
},
|
|
|
// 添加,修改
|
|
|
- toSave({ data }) {
|
|
|
- console.log(data);
|
|
|
+ async toSave({ data }) {
|
|
|
+ const dup = _.cloneDeep(data);
|
|
|
+ let res;
|
|
|
+ if (dup.id) {
|
|
|
+ res = await this.update(dup);
|
|
|
+ } else {
|
|
|
+ res = await this.create(dup);
|
|
|
+ }
|
|
|
+ if (this.$checkRes(res, '保存成功', res.errmsg || '保存失败')) {
|
|
|
+ this.search();
|
|
|
+ this.back();
|
|
|
+ }
|
|
|
},
|
|
|
// 查看项目征集
|
|
|
toView({ data }) {
|
|
|
this.display = 'projectList';
|
|
|
- console.log(data);
|
|
|
- this.prosearch(data);
|
|
|
+ this.$set(this, `proid`, data._id);
|
|
|
+ this.prosearch();
|
|
|
},
|
|
|
|
|
|
// 查看调研调查中的项目征集数据
|
|
|
- prosearch({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
- console.log('查询');
|
|
|
+ async prosearch({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ const res = await this.solicQuery({ skip, limit, question_id: this.proid });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `prolist`, res.data);
|
|
|
+ this.$set(this, `prototal`, res.total);
|
|
|
+ }
|
|
|
},
|
|
|
// 返回列表
|
|
|
back() {
|