|
@@ -0,0 +1,196 @@
|
|
|
+<template>
|
|
|
+ <div id="index">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" class="main">
|
|
|
+ <span v-if="display == 'list'">
|
|
|
+ <el-col :span="24" class="btn">
|
|
|
+ <el-button type="primary" size="mini" @click="add">添加信息</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="list">
|
|
|
+ <data-table
|
|
|
+ :fields="fields"
|
|
|
+ :data="list"
|
|
|
+ :total="total"
|
|
|
+ @query="search"
|
|
|
+ :opera="opera"
|
|
|
+ @view="toView"
|
|
|
+ @edit="toEdit"
|
|
|
+ @delete="toDelete"
|
|
|
+ ></data-table>
|
|
|
+ </el-col>
|
|
|
+ </span>
|
|
|
+ <span v-else-if="display == 'detail'">
|
|
|
+ <el-col :span="24" class="btn">
|
|
|
+ <el-button type="primary" size="mini" @click="back">返回列表</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="detail">
|
|
|
+ <data-form :data="form" :fields="formFields" @save="toSave">
|
|
|
+ <template #custom="{item, form}">
|
|
|
+ <template v-if="item.model === 'img_path'">
|
|
|
+ <upload :limit="1" :data="form.img_path" type="img_path" :url="'/files/img_path/upload'" @upload="uploadSuccess"></upload>
|
|
|
+ </template>
|
|
|
+ <template v-if="item.model === 'file_path'">
|
|
|
+ <uploadfile
|
|
|
+ :limit="1"
|
|
|
+ :data="form.file_path"
|
|
|
+ type="file_path"
|
|
|
+ listType=""
|
|
|
+ :url="'/files/file_path/upload'"
|
|
|
+ @upload="sucfile"
|
|
|
+ @delete="delfile"
|
|
|
+ ></uploadfile>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </data-form>
|
|
|
+ </el-col>
|
|
|
+ </span>
|
|
|
+ <span v-else-if="display == 'projectList'">
|
|
|
+ <el-col :span="24" class="btn">
|
|
|
+ <el-button type="primary" size="mini" @click="back">返回列表</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="projectList">
|
|
|
+ <data-table :fields="profields" :opera="proopera" :data="prolist" :total="prototal" @query="prosearch"></data-table>
|
|
|
+ </el-col>
|
|
|
+ </span>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import dataTable from '@/components/data-table.vue';
|
|
|
+import dataForm from '@/components/form.vue';
|
|
|
+import upload from '@/components/uploadone.vue';
|
|
|
+import uploadfile from '@/components/uploaddock.vue';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+export default {
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+ name: 'index',
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ dataTable,
|
|
|
+ dataForm,
|
|
|
+ upload,
|
|
|
+ uploadfile,
|
|
|
+ },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ // 显示
|
|
|
+ display: 'list',
|
|
|
+ opera: [
|
|
|
+ {
|
|
|
+ label: '查看项目征集',
|
|
|
+ method: 'view',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '编辑',
|
|
|
+ method: 'edit',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '编辑',
|
|
|
+ method: 'delete',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fields: [
|
|
|
+ { label: '信息标题', prop: 'title' },
|
|
|
+ { label: '信息来源', prop: 'origin' },
|
|
|
+ { label: '发布时间', prop: 'create_date' },
|
|
|
+ ],
|
|
|
+ list: [
|
|
|
+ {
|
|
|
+ title: '测试',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ total: 0,
|
|
|
+ // 添加数据
|
|
|
+ form: {},
|
|
|
+ formFields: [
|
|
|
+ { label: '信息标题', model: 'title' },
|
|
|
+ { label: '发布时间', model: 'create_date', type: 'date' },
|
|
|
+ { label: '信息来源', model: 'origin' },
|
|
|
+ { label: '图片', model: 'img_path', custom: true },
|
|
|
+ { label: '附件', model: 'file_path', custom: true },
|
|
|
+ { label: '信息内容', model: 'content', type: 'editor' },
|
|
|
+ ],
|
|
|
+ // 项目征集列表
|
|
|
+ proopera: [],
|
|
|
+ profields: [
|
|
|
+ { label: '项目名称', prop: 'name' },
|
|
|
+ { label: '建议单位', prop: 'company' },
|
|
|
+ { label: '联系人', prop: 'contacts' },
|
|
|
+ { label: '联系方式', prop: 'phone' },
|
|
|
+ ],
|
|
|
+ prolist: [],
|
|
|
+ prototal: 0,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async created() {
|
|
|
+ await this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ console.log('查询');
|
|
|
+ },
|
|
|
+ // 修改
|
|
|
+ toEdit({ data }) {
|
|
|
+ console.log(data);
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ toDelete({ data }) {
|
|
|
+ console.log(data);
|
|
|
+ },
|
|
|
+ // 添加数据
|
|
|
+ add() {
|
|
|
+ this.display = 'detail';
|
|
|
+ },
|
|
|
+ // 添加,修改
|
|
|
+ toSave({ data }) {
|
|
|
+ console.log(data);
|
|
|
+ },
|
|
|
+ // 查看项目征集
|
|
|
+ toView({ data }) {
|
|
|
+ this.display = 'projectList';
|
|
|
+ console.log(data);
|
|
|
+ this.prosearch(data);
|
|
|
+ },
|
|
|
+
|
|
|
+ // 查看调研调查中的项目征集数据
|
|
|
+ prosearch({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ console.log('查询');
|
|
|
+ },
|
|
|
+ // 返回列表
|
|
|
+ back() {
|
|
|
+ this.form = {};
|
|
|
+ this.display = 'list';
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ // 图片上传
|
|
|
+ uploadSuccess({ type, data }) {
|
|
|
+ this.$set(this.form, `${type}`, data.uri);
|
|
|
+ },
|
|
|
+ // 视频文件
|
|
|
+ sucfile({ type, data }) {
|
|
|
+ this.$set(this.form, `${type}`, data.uri);
|
|
|
+ },
|
|
|
+ delfile(index) {
|
|
|
+ this.$set(this.form, `file_path`, '');
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ },
|
|
|
+ watch: {},
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.main {
|
|
|
+ padding: 0 15px 0 0;
|
|
|
+ .btn {
|
|
|
+ text-align: right;
|
|
|
+ margin: 0 0 10px 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|