lipengtao 6 years ago
parent
commit
38329abbff

+ 12 - 0
src/api/content.js

@ -0,0 +1,12 @@
1
export const uploadPhotoUrl = '/ajax/article/image' //  上传图片
2
export const publishUrl = '/ajax/article/publish' //  内容发布
3
export const draftFirstUrl = '/ajax/article/draft' // 草稿首次保存
4
export const draftUrl = '/ajax/article/draft/save' // 草稿保存
5
export const draftPublishUrl = '/ajax/article/draft/publish' // 草稿发布
6
export const pageInquireUrl = '/ajax/article/pq' // 分页查询
7
export const inquireContentUrl = '/ajax/article/qo' //  单个查询
8
export const deleteUrl = '/ajax/article/invalid' // 删除
9
export const restoreUrl = '/ajax/article/valid' //  恢复
10
export const recycleBinInquireUrl = '/ajax/article/invalid/pq' // 回收站分页查询
11
export const thoroughDeleteSingleUrl = '/ajax/article/delete/one' //  单个彻底删除
12
export const thoroughDeleteAll = '/ajax/article/delete/all' //  全部彻底删除

+ 3 - 0
src/api/cooperationAgency.js

@ -0,0 +1,3 @@
1
export const agencyListUrl = '/ajax/org/list'
2
export const agencyUserUrl = '/ajax/org/qo'
3
export const sortUrl = '/ajax/org/setlevel'

+ 3 - 0
src/api/specialExpert.js

@ -0,0 +1,3 @@
1
export const expertListUrl = '/ajax/professor/list'
2
export const expertUserUrl = '/ajax/professor/qp'
3
export const sortUrl = '/ajax/professor/setlevel'

+ 29 - 54
src/components/complexTable/index.vue

@ -1,44 +1,25 @@
1 1
<template>
2 2
  <div>
3
    <el-table
4
      :data="tableData"
5
      height="630"
6
      border>
7
      <el-table-column v-if="hasSelect"
8
        type="selection"
9
        width="55">
3
    <el-table :data="tableData" height="630" border>
4
      <el-table-column v-if="hasSelect" type="selection" width="55">
10 5
      </el-table-column>
11
      <el-table-column
12
        v-for="item in tableItem"
13
        :key="item.index"
14
        :prop="item.prop ? item.prop : ''"
15
        :label="item.tit ? item.tit : ''"
16
        :width="item.width ? item.width : ''"
17
        align="center">
6
      <el-table-column v-for="item in tableItem" :key="item.index" :prop="item.prop ? item.prop : ''" :label="item.tit ? item.tit : ''"
7
        :width="item.width ? item.width : ''" align="center" :className="item.active">
18 8
        <template slot-scope="scope">
19 9
          <div v-if="scope.row[item.prop]">
20
            {{scope.row[item.prop]}}
10
            <div v-if="item.active" @click.stop="$emit('jump', scope.row.id)">{{scope.row[item.prop]}}</div>
11
            <div v-else> {{scope.row[item.prop]}}</div>
21 12
          </div>
22 13
          <div v-if="item.operate && typeof scope.row === 'object'">
23
            <el-button
24
              size="mini"
25
              type="primary"
26
              @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
27
            <el-button
28
              size="mini"
29
              type="danger"
30
              @click="handleDelete(scope.$index, scope.row)">删除</el-button>
14
            <el-button v-for="operating in operatingList" :key="operating.index " size="mini" :type="operating.icon"
15
              @click="$emit(operating.event, scope.row)">{{operating.text}}</el-button>
31 16
          </div>
32 17
        </template>
33 18
      </el-table-column>
34 19
    </el-table>
35 20
    <div class="pagination-container">
36
      <el-pagination
37
        background
38
        :current-page.sync="pageNo"
39
        :page-size="pageSize"
40
        layout="prev, pager, next, jumper"
41
        :total="total">
21
      <el-pagination background :current-page.sync="pageNo" :page-size="pageSize" layout="prev, pager, next, jumper"
22
        :total="total" @current-change="handleCurrentChange">
42 23
      </el-pagination>
43 24
    </div>
44 25
  </div>
@ -46,37 +27,31 @@
46 27
47 28
48 29
<script>
49
export default {
50
  name: 'complexTable',
51
  props: ['tableData', 'tableItem', 'hasSelect'],
52
  data() {
53
    return {
54
      pageNo: 1,
55
      pageSize: 20,
56
      total: 0
57
    }
58
  },
59
  computed: {
60
    dataSize() {
61
      return this.tableData.length % this.pageSize
62
    }
63
  },
64
  created() {
65
    this.gapFilling()
66
  },
67
  methods: {
68
    gapFilling() {
69
      const needNum = this.pageSize - this.tableData.length % this.pageSize
70
      for (let i = 0; i < needNum; ++i) {
71
        this.tableData.push(i)
30
  export default {
31
    name: 'complexTable',
32
    props: ['tableData', 'tableItem', 'hasSelect', 'operatingList', 'total'],
33
    data() {
34
      return {
35
        pageNo: 1,
36
        pageSize: 20
37
      }
38
    },
39
    methods: {
40
      handleCurrentChange(val) { // 点击页码
41
        this.pageNo = val
42
        this.$emit('current', val)
72 43
      }
73 44
    }
74 45
  }
75
}
76 46
</script>
77 47
78 48
<style rel="stylesheet/scss" lang="scss">
79
  .el-table .cell{
49
  .el-table .cell {
80 50
    min-height: 23px
81 51
  }
52
53
  .active {
54
    color: #409EFF;
55
    cursor: pointer
56
  }
82 57
</style>

+ 1 - 1
src/components/editorUE/index.vue

@ -27,7 +27,7 @@
27 27
        BaseUrl: '',
28 28
        initialFrameWidth: null,
29 29
        initialFrameHeight: 500,
30
        serverUrl: '',
30
        serverUrl: '/ajax/editor/controller',
31 31
        UEDITOR_HOME_URL: '/static/ueditor/' // 这个是静态资源的路径
32 32
      })// 初始化UE
33 33
      this.editor.addListener('ready', function() { // 确保UE加载完成后放入内容

+ 1 - 1
src/components/searchBar/index.vue

@ -1,7 +1,7 @@
1 1
<template>
2 2
  <el-form-item :label=relevant.label :prop=relevant.professor>
3 3
    <el-select v-model='input' filterable remote reserve-keyword :placeholder=relevant.placeholder :remote-method="remoteMethod"
4
      :loading="loading" :style="{ width: relevant.width }" @change='change(input)'>
4
      :loading="loading" @change='change(input)'>
5 5
      <el-option v-for="item in options4" :key="item.value" :label="item.label" :value="item.value">
6 6
      </el-option>
7 7
    </el-select>

+ 6 - 7
src/router/index.js

@ -120,6 +120,12 @@ export const asyncRouterMap = [
120 120
            }
121 121
          ]
122 122
        },
123
        {
124
          path: 'draftList',
125
          component: () => import('@/views/contentPub/draftList'),
126
          name: 'draftList',
127
          meta: { title: '内容草稿箱列表' }
128
        },
123 129
        {
124 130
          path: 'recycle',
125 131
          component: () => import('@/views/contentPub/index'),
@ -141,12 +147,6 @@ export const asyncRouterMap = [
141 147
              meta: { title: ' 查看回收内容' }
142 148
            }
143 149
          ]
144
        },
145
        {
146
          path: 'draftList',
147
          component: () => import('@/views/contentPub/draftList'),
148
          name: 'draftList',
149
          meta: { title: '内容草稿箱列表' }
150 150
        }
151 151
      ]
152 152
    },
@ -161,7 +161,6 @@ export const asyncRouterMap = [
161 161
        {
162 162
          path: 'expertslist',
163 163
          component: () => import('@/views/specialExperts/index'),
164
          name: 'publishedList',
165 164
          meta: { title: '特约专家列表' }
166 165
        }
167 166
      ]

+ 177 - 2
src/views/contentPub/draftList.vue

@ -1,3 +1,178 @@
1 1
<template>
2
  <div>内容草稿箱列表</div>
3
</template>
2
  <div class="app-container">
3
    <div class="box-container">
4
      <div class="contain-title">内容草稿箱列表</div>
5
    </div>
6
    <div class="content-container">
7
      <div class="contain-select">
8
        <span>栏目分类:</span>
9
        <el-select v-model="selectMode" placeholder="选择分类" @change="change">
10
          <el-option label="平台新闻" value="1"></el-option>
11
          <el-option label="采访专栏" value="2"></el-option>
12
          <el-option label="政策法规" value="3"></el-option>
13
          <el-option label="通知公告" value="4"></el-option>
14
        </el-select>
15
      </div>
16
      <complex-table :tableData="tableData" :tableItem="tableItem" :operatingList='operatingList' :total='total'
17
        v-on:sortSingleExpert="sortSingleExpert" v-on:jump="jump" v-on:current="current" v-on:edit="edit"></complex-table>
18
    </div>
19
  </div>
20
</template>
21
22
<script>
23
  import complexTable from '@/components/complexTable'
24
  import { pageInquireUrl, deleteUrl, inquireContentUrl } from '@/api/content'
25
  import { queryUserOne } from '@/api/sysSetting'
26
  import { parseTime } from '@/utils/index'
27
  import ret from '@/utils/comTable'
28
  export default {
29
    data() {
30
      return {
31
        searchText: '',
32
        selectMode: '',
33
        info: {
34
          title: '',
35
          catalog: '',
36
          published: 0,
37
          pageSize: 20,
38
          pageNo: 1
39
        },
40
        type: {
41
          '1': '平台新闻',
42
          '2': '采访专栏',
43
          '3': '政策法规',
44
          '4': '通知公告'
45
        },
46
        formData: {},
47
        operatingList: [ // 在子组件中遍历事件
48
          {
49
            text: '编辑',
50
            event: 'edit',
51
            icon: 'primary'
52
          },
53
          {
54
            text: '删除',
55
            event: 'sortSingleExpert',
56
            icon: 'danger'
57
          }
58
        ],
59
        dataList: [], //  拉去专家数据存到dataList这个数组里面
60
        tableData: [], //  每一页的存储的数据
61
        total: 0, //  页码总数
62
        tableItem: [ // 表头信息
63
          {
64
            prop: 'title',
65
            tit: '标题',
66
            active: 'active' // 点击加颜色,加此选项
67
          },
68
          {
69
            prop: 'catalog',
70
            tit: '栏目分类'
71
          },
72
          {
73
            prop: 'modifier',
74
            tit: '最后修改人',
75
            width: '160'
76
          },
77
          {
78
            prop: 'createTime',
79
            tit: '发布时间',
80
            width: '160'
81
          },
82
          {
83
            operate: 'edit',
84
            width: '200'
85
          }
86
        ]
87
      }
88
    },
89
    created() {
90
      this.publishList()
91
    },
92
    components: {
93
      complexTable //  表子页面
94
    },
95
    methods: {
96
      change(value) {
97
        this.info.catalog = value
98
        this.publishList()
99
      },
100
      publishList() {
101
        this.$http.get(pageInquireUrl, this.info, (response) => { //  拉去专家信息列表,总数据存在dataList,tableData存每一页的信息
102
          if (response.success && response.data) {
103
            const epData = response.data.data
104
            for (let i = 0; i < epData.length; i++) {
105
              epData[i].createTime = parseTime(epData[i].createTime).substr(0, 16)
106
              epData[i].catalog = this.type[epData[i].catalog]
107
              this.$http.get(queryUserOne, { id: epData[i].modifier }, (response) => {
108
                if (response.success) {
109
                  epData[i].modifier = response.data.name
110
                }
111
              })
112
            }
113
            this.dataList = epData
114
            this.total = Math.ceil(epData / 20)
115
            if (this.total > 1) {
116
              this.tableData = this.dataList.slice(0, 20)
117
            } else {
118
              const array = this.dataList
119
              ret.gapFilling(array)
120
              this.tableData = array
121
            }
122
          } else {
123
            this.$sort.total = 0
124
            this.tableData = []
125
          }
126
        })
127
      },
128
      edit(obj) {
129
        this.$router.push({ path: 'content/publish', query: { id: obj.id }})
130
      },
131
      sortSingleExpert(obj) { //  点击单个特约专家信息
132
        this.$confirm('确定删除该条内容?', '提示', {
133
          confirmButtonText: '确定',
134
          cancelButtonText: '取消',
135
          type: 'warning',
136
          center: true
137
        }).then(() => {
138
          this.$http.get(deleteUrl, { id: obj.id }, response => {
139
            if (response.success) {
140
              if (response.data) {
141
                this.publishList()
142
                this.$message({
143
                  message: '删除成功',
144
                  type: 'success'
145
                })
146
              } else {
147
                this.$http.get(inquireContentUrl, { id: this.id }, (response) => {
148
                  if (response.success && response.data) {
149
                    const info = response.data
150
                    if (!info.actived) {
151
                      this.$message({
152
                        message: '该内容已被删除',
153
                        type: 'warning'
154
                      })
155
                    }
156
                  }
157
                })
158
              }
159
            }
160
          })
161
        }).catch(() => {
162
        })
163
      },
164
      jump(id) { // 点击超练级跳转
165
        console.log(id)
166
      },
167
      current(val) { // 点击页码
168
        if (val < this.total) {
169
          this.tableData = this.dataList.slice(20 * (val - 1), 20 * val)
170
        } else {
171
          const array = this.dataList.slice(20 * val)
172
          ret.gapFilling(array)
173
          this.tableData = array
174
        }
175
      }
176
    }
177
  }
178
</script>

+ 178 - 73
src/views/contentPub/pubList.vue

@ -4,97 +4,202 @@
4 4
      <div class="contain-title">发布中内容列表</div>
5 5
      <div class="contain-search">
6 6
        <el-input placeholder="搜索内容标题" v-model="searchText" class="input-with-select">
7
          <el-button slot="append" icon="el-icon-search"></el-button>
7
          <el-button slot="append" icon="el-icon-search" @click.stop="search"></el-button>
8 8
        </el-input>
9 9
      </div>
10 10
      <div class="contian-operate">
11
        <el-button type="primary">发布内容</el-button>
11
        <el-button type="primary" @click.stop="$router.push('publish')">发布内容</el-button>
12 12
      </div>
13 13
    </div>
14 14
    <div class="content-container">
15 15
      <div class="contain-select">
16 16
        <span>栏目分类:</span>
17
        <el-select v-model="selectMode" placeholder="选择分类">
18
          <el-option label="餐厅名" value="1"></el-option>
19
          <el-option label="订单号" value="2"></el-option>
20
          <el-option label="用户电话" value="3"></el-option>
17
        <el-select v-model="selectMode" placeholder="选择分类" @change="change">
18
          <el-option label="平台新闻" value="1"></el-option>
19
          <el-option label="采访专栏" value="2"></el-option>
20
          <el-option label="政策法规" value="3"></el-option>
21
          <el-option label="通知公告" value="4"></el-option>
21 22
        </el-select>
22 23
      </div>
23
      <complex-table :tableData="tableData" :tableItem="tableItem"></complex-table>
24
      <complex-table :tableData="tableData" :tableItem="tableItem" :operatingList='operatingList' :total='total'
25
        v-on:sortSingleExpert="sortSingleExpert" v-on:jump="jump" v-on:current="current"></complex-table>
24 26
    </div>
25 27
  </div>
26 28
</template>
27 29
28 30
<script>
29
import complexTable from '@/components/complexTable'
30
export default {
31
  data() {
32
    return {
33
      searchText: '',
34
      selectMode: '',
35
      tableData: [
36
        {
37
          date: '2018/08/25 16:32',
38
          name: '关于征集企业技术创新需求的通知',
39
          class: '通知公告',
40
          owner: '张贝贝',
41
          num: '4552'
42
        }, {
43
          date: '2018/08/25 16:32',
44
          name: '关于征集企业技术创新需求的通知',
45
          class: '通知公告',
46
          owner: '张贝贝',
47
          num: '4552'
48
        }, {
49
          date: '2018/08/25 16:32',
50
          name: '关于征集企业技术创新需求的通知',
51
          class: '通知公告',
52
          owner: '张贝贝',
53
          num: '4552'
54
        }, {
55
          date: '2018/08/25 16:32',
56
          name: '关于征集企业技术创新需求的通知',
57
          class: '通知公告',
58
          owner: '张贝贝',
59
          num: '4552'
60
        }
61
      ],
62
      tableItem: [
63
        {
64
          prop: 'name',
65
          tit: '标题'
66
        },
67
        {
68
          prop: 'class',
69
          tit: '栏目分类',
70
          width: '160'
71
        },
72
        {
73
          prop: 'owner',
74
          tit: '发布人',
75
          width: '160'
31
  import complexTable from '@/components/complexTable'
32
  import { pageInquireUrl, deleteUrl, inquireContentUrl } from '@/api/content'
33
  import { queryUserOne } from '@/api/sysSetting'
34
  import { parseTime } from '@/utils/index'
35
  import ret from '@/utils/comTable'
36
  export default {
37
    data() {
38
      return {
39
        searchText: '',
40
        selectMode: '',
41
        info: {
42
          title: '',
43
          catalog: '',
44
          published: 1,
45
          pageSize: 20,
46
          pageNo: 1
76 47
        },
77
        {
78
          prop: 'date',
79
          tit: '发布时间',
80
          width: '160'
48
        type: {
49
          '1': '平台新闻',
50
          '2': '采访专栏',
51
          '3': '政策法规',
52
          '4': '通知公告'
81 53
        },
82
        {
83
          prop: 'num',
84
          tit: '浏览数量',
85
          width: '160'
86
        },
87
        {
88
          operate: 'edit',
89
          width: '200'
54
        formData: {},
55
        operatingList: [ // 在子组件中遍历事件
56
          {
57
            text: '删除',
58
            event: 'sortSingleExpert',
59
            icon: 'danger'
60
          }
61
        ],
62
        dataList: [], //  拉去专家数据存到dataList这个数组里面
63
        tableData: [], //  每一页的存储的数据
64
        total: 0, //  页码总数
65
        tableItem: [ // 表头信息
66
          {
67
            prop: 'title',
68
            tit: '标题',
69
            active: 'active' // 点击加颜色,加此选项
70
          },
71
          {
72
            prop: 'catalog',
73
            tit: '栏目分类'
74
          },
75
          {
76
            prop: 'creator',
77
            tit: '发布人',
78
            width: '160'
79
          },
80
          {
81
            prop: 'createTime',
82
            tit: '发布时间',
83
            width: '160'
84
          },
85
          {
86
            prop: 'num',
87
            tit: '浏览数量',
88
            width: '160'
89
          },
90
          {
91
            operate: 'edit',
92
            width: '200'
93
          }
94
        ]
95
      }
96
    },
97
    created() {
98
      this.publishList()
99
    },
100
    components: {
101
      complexTable //  表子页面
102
    },
103
    methods: {
104
      change(value) {
105
        console.log(value)
106
        this.info.catalog = value
107
        this.publishList()
108
      },
109
      search() {
110
        this.info.title = this.searchText
111
        this.publishList()
112
      },
113
      publishList() {
114
        const arr = [
115
          {
116
            num: 1
117
          },
118
          {
119
            num: 2
120
          },
121
          {
122
            num: 3
123
          },
124
          {
125
            num: 4
126
          }
127
        ]
128
        this.$http.get(pageInquireUrl, this.info, (response) => { //  拉去专家信息列表,总数据存在dataList,tableData存每一页的信息
129
          if (response.success && response.data) {
130
            const epData = response.data.data
131
            console.log(epData)
132
            for (let i = 0; i < epData.length; i++) {
133
              epData[i].createTime = parseTime(epData[i].createTime).substr(0, 16)
134
              epData[i].catalog = this.type[epData[i].catalog]
135
              Object.assign(epData[i], arr[i])
136
              this.$http.get(queryUserOne, { id: epData[i].creator }, (response) => {
137
                if (response.success) {
138
                  epData[i].creator = response.data.name
139
                }
140
              })
141
            }
142
            this.dataList = epData
143
            this.total = Math.ceil(epData / 20)
144
            if (this.total > 1) {
145
              this.tableData = this.dataList.slice(0, 20)
146
            } else {
147
              const array = this.dataList
148
              ret.gapFilling(array)
149
              this.tableData = array
150
            }
151
          } else {
152
            this.$sort.total = 0
153
            this.tableData = []
154
          }
155
        })
156
      },
157
      sortSingleExpert(obj) { //  点击单个特约专家信息
158
        this.$confirm('确定删除该条内容?', '提示', {
159
          confirmButtonText: '确定',
160
          cancelButtonText: '取消',
161
          type: 'warning',
162
          center: true
163
        }).then(() => {
164
          this.$http.get(deleteUrl, { id: obj.id }, response => {
165
            if (response.success) {
166
              if (response.data) {
167
                this.publishList()
168
                this.$message({
169
                  message: '删除成功',
170
                  type: 'success'
171
                })
172
              } else {
173
                this.$http.get(inquireContentUrl, { id: this.id }, (response) => {
174
                  if (response.success && response.data) {
175
                    const info = response.data
176
                    if (!info.actived) {
177
                      this.$message({
178
                        message: '该内容已被删除',
179
                        type: 'warning'
180
                      })
181
                    }
182
                  }
183
                })
184
              }
185
            }
186
          })
187
        }).catch(() => {
188
189
        })
190
      },
191
      jump(id) { // 点击超练级跳转
192
        console.log(id)
193
      },
194
      current(val) { // 点击页码
195
        if (val < this.total) {
196
          this.tableData = this.dataList.slice(20 * (val - 1), 20 * val)
197
        } else {
198
          const array = this.dataList.slice(20 * val)
199
          ret.gapFilling(array)
200
          this.tableData = array
90 201
        }
91
      ]
202
      }
92 203
    }
93
  },
94
  components: {
95
    complexTable
96
  },
97
  methods: {
98 204
  }
99
}
100 205
</script>

+ 242 - 72
src/views/contentPub/publish.vue

@ -1,57 +1,62 @@
1 1
<template>
2
<div class="app-container">
3
  <div class="box-container">
4
    <div class="contain-title">新内容发布</div>
5
  </div>
6
  <div class="content-container contentBox">
7
    <el-form :model="ruleForm2" status-icon :rules="rules2" ref="ruleForm2" label-width="100px" class="demo-ruleForm" style="width: 943px">
8
      <div style="width: 500px">
9
        <el-form-item label="标题" prop="contentTitle">
10
          <el-input placeholder="请填写内容标题" v-model="ruleForm2.contentTitle" class="input-with-select" maxlength=50>
11
            <el-select v-model="ruleForm2.select" slot="prepend" placeholder="栏目分类" @change="change">
12
              <el-option label="平台新闻" value="1"></el-option>
13
              <el-option label="采访专栏" value="2"></el-option>
14
              <el-option label="政策法规" value="3"></el-option>
15
              <el-option label="通知公告" value="4"></el-option>
16
            </el-select>
17
          </el-input>
2
  <div class="app-container">
3
    <div class="box-container">
4
      <div class="contain-title">新内容发布</div>
5
    </div>
6
    <div class="content-container">
7
      <el-form :model="ruleForm2" status-icon :rules="rules2" ref="ruleForm2" label-width="100px" class="demo-ruleForm formWidth">
8
        <el-row>
9
          <el-col :span="12">
10
            <el-form-item label="标题" prop="title">
11
              <el-input placeholder="请填写内容标题" v-model="ruleForm2.title" class="input-with-select" maxlength=50>
12
                <el-select v-model="ruleForm2.catalog" slot="prepend" placeholder="栏目分类" @change="change" class="selectWidth">
13
                  <el-option label="平台新闻" value="1"></el-option>
14
                  <el-option label="采访专栏" value="2"></el-option>
15
                  <el-option label="政策法规" value="3"></el-option>
16
                  <el-option label="通知公告" value="4"></el-option>
17
                </el-select>
18
              </el-input>
19
            </el-form-item>
20
            <el-form-item label="作者/来源" prop="source">
21
              <el-input v-model.number="ruleForm2.source" placeholder="请填写作者/来源" maxlength=20></el-input>
22
            </el-form-item>
23
            <searchTemplate :relevant=relevantExperts v-on:expert="expert"></searchTemplate>
24
            <searchTemplate :relevant=relevantInstitutions v-on:institution="institution"></searchTemplate>
25
            <searchTemplate :relevant=relevantCompanies v-on:company="company"></searchTemplate>
26
          </el-col>
27
          <el-col :span="12">
28
            <el-form-item style="text-align:right" prop="imgUrl">
29
              <uploadFile :uploadImg=uploadImg v-on:uploadfun="uploadfun" :upImgsStr="upImgsStr"></uploadFile>
30
            </el-form-item>
31
          </el-col>
32
        </el-row>
33
        <el-form-item label="文章正文" prop="cnt" class="editBox">
34
          <UE :id="artUe" :contentText="ruleForm2.cnt" ref="ueBox"></UE>
18 35
        </el-form-item>
19
        <el-form-item label="作者/来源" prop="authorSource">
20
          <el-input v-model.number="ruleForm2.age" placeholder="请填写作者/来源" maxlength=20></el-input>
36
        <el-form-item class="traftButton">
37
          <el-button type="info" @click="draft">保存草稿</el-button>
21 38
        </el-form-item>
22
        <searchTemplate :relevant=relevantExperts v-on:expert="expert"></searchTemplate>
23
        <searchTemplate :relevant=relevantInstitutions v-on:institution="institution"></searchTemplate>
24
        <searchTemplate :relevant=relevantCompanies v-on:company="company"></searchTemplate>
25
      </div>
26
      <el-form-item label="文章正文" prop="artDesc" class="editBox">
27
        <UE :id="artUe" :contentText="ruleForm2.artDesc" ref="ueBox"></UE>
28
      </el-form-item>
29
      <el-form-item class="publishButton">
30
        <el-button type="primary" @click="submitForm('ruleForm2')">发布</el-button>
31
        <el-button @click="resetForm('ruleForm2')">重置</el-button>
32
      </el-form-item>
33
    </el-form>
34
    <div class="fileBox" v-on:uploadfun="uploadfun">
35
      <uploadFile :uploadImg=uploadImg></uploadFile>
36
      <p class="teimg">上传封面图片</p>
37
      <p class="tetype">PNG/JPG/JPEG格式,2M以内</p>
39
        <el-form-item class="publishButton">
40
          <el-button type="primary" @click="submitForm('ruleForm2')">发布</el-button>
41
          <el-button type="danger" @click="deleteContent" v-if="$route.query.id">删除</el-button>
42
        </el-form-item>
43
      </el-form>
38 44
    </div>
39
40 45
  </div>
41
</div>
42 46
</template>
43 47
44 48
<script>
45 49
  import searchTemplate from '@/components/searchBar'
46 50
  import uploadFile from '@/components/uploadFile'
47 51
  import UE from '@/components/editorUE'
52
  import { uploadPhotoUrl, publishUrl, draftFirstUrl, draftUrl, draftPublishUrl, deleteUrl, inquireContentUrl } from '@/api/content'
48 53
  export default {
49 54
    data() {
50 55
      var checkTitle = (rule, value, callback) => {
51 56
        if (!value) {
52 57
          return callback(new Error('请填写标题'))
53 58
        } else {
54
          if (this.ruleForm2.select === '') {
59
          if (this.draftFlag && this.ruleForm2.catalog === '') {
55 60
            callback('请选择该内容所属栏目分类')
56 61
          }
57 62
          callback()
@ -72,57 +77,81 @@
72 77
        }
73 78
      }
74 79
      return {
80
        draftFlag: true,
81
        upImgsStr: '',
82
        id: '',
75 83
        artUe: 'artUeditorId',
76 84
        uploadImg: {
77
          url: '',
78
          width: '400px',
79
          height: '200px',
80
          fun: 'uploadfun'
85
          url: uploadPhotoUrl,
86
          width: '340px',
87
          height: '200px'
81 88
        },
82 89
        relevantExperts: {
83 90
          url: '',
84 91
          placeholder: '请选择关联专家',
85 92
          fun: 'expert',
86 93
          label: '相关专家',
87
          prop: 'professor',
88
          width: '400px'
94
          prop: 'professors'
89 95
        },
90 96
        relevantInstitutions: {
91 97
          url: '',
92 98
          placeholder: '请选择关联机构',
93 99
          fun: 'institution',
94 100
          label: '相关机构',
95
          prop: 'institution',
96
          width: '400px'
101
          prop: 'orgs'
97 102
        },
98 103
        relevantCompanies: {
99 104
          url: '',
100 105
          placeholder: '请选择关联企业',
101 106
          fun: 'company',
102 107
          label: '相关企业',
103
          prop: 'company',
104
          width: '400px'
108
          prop: 'comps'
105 109
        },
106 110
        ruleForm2: {
107
          authorSource: '',
108
          select: '',
109
          contentTitle: '',
110
          professor: '',
111
          artDesc: ''
111
          title: '',
112
          catalog: '',
113
          source: '',
114
          imgUrl: '',
115
          cnt: '',
116
          professors: [],
117
          orgs: [],
118
          comps: []
112 119
        },
113 120
        rules2: {
114
          contentTitle: [
121
          title: [
115 122
            { validator: checkTitle, trigger: 'blur', required: true }
116 123
          ],
117
          authorSource: [
124
          source: [
118 125
            { validator: checkAuthorSource, trigger: 'blur', required: true }
119 126
          ],
120
          artDesc: [
127
          cnt: [
121 128
            { validator: checkContent, trigger: 'blur', required: true }
122
          ]
129
          ],
130
          imgUrl: []
123 131
        }
124 132
      }
125 133
    },
134
    created() {
135
      this.id = this.$route.query.id
136
      if (this.id) {
137
        this.$http.get(inquireContentUrl, { id: this.id }, (response) => {
138
          if (response.success && response.data) {
139
            const info = response.data
140
            this.ruleForm2 = {
141
              catalog: info.catalog,
142
              cnt: info.cnt,
143
              title: info.title,
144
              source: info.source,
145
              imgUrl: info.imgUrl,
146
              professors: [],
147
              orgs: [],
148
              comps: []
149
            }
150
            this.upImgsStr = info.imgUrl
151
          }
152
        })
153
      }
154
    },
126 155
    components: {
127 156
      searchTemplate,
128 157
      uploadFile,
@ -130,25 +159,151 @@
130 159
    },
131 160
    methods: {
132 161
      uploadfun(value) {
133
        console.log(value)
162
        this.ruleForm2.imgUrl = value
134 163
      },
135 164
      institution(value) {
136
        console.log(value)
165
        this.ruleForm2.orgs = [value]
137 166
      },
138 167
      company(value) {
139
        console.log(value)
168
        this.ruleForm2.comps = [value]
140 169
      },
141 170
      expert(value) {
142
        console.log(value)
171
        this.ruleForm2.professors = [value]
143 172
      },
144
      change() {
145
        console.log(11)
146
        this.$refs.ruleForm2.validateField('contentTitle')
173
      change(value) {
174
        if (this.ruleForm2.title) {
175
          this.$refs.ruleForm2.validateField('title')
176
        }
177
        if (value === '1' || value === '2') {
178
          console.log(value, typeof value)
179
          console.log(this.rules2)
180
          this.rules2.imgUrl.push({ message: '请上传封面图片', required: true, trigger: 'blur' })
181
        } else {
182
          this.rules2.imgUrl = []
183
        }
184
        this.ruleForm2.catalog = value
185
      },
186
      deleteContent() {
187
        this.$confirm('该内容是否删除?', '提示', {
188
          confirmButtonText: '确定',
189
          cancelButtonText: '取消',
190
          type: 'warning',
191
          center: true
192
        }).then(() => {
193
          this.$http.get(deleteUrl, { id: this.id }, response => {
194
            if (response.success) {
195
              if (response.data) {
196
                this.$router.push('/draftList')
197
                this.$message({
198
                  message: '删除成功',
199
                  type: 'success'
200
                })
201
              } else {
202
                this.$http.get(inquireContentUrl, { id: this.id }, (response) => {
203
                  if (response.success && response.data) {
204
                    const info = response.data
205
                    if (!info.actived) {
206
                      this.$message({
207
                        message: '该内容已被删除',
208
                        type: 'warning'
209
                      })
210
                    }
211
                  }
212
                })
213
              }
214
            }
215
          })
216
        }).catch(() => {
217
218
        })
219
      },
220
      draft() {
221
        this.draftFlag = false
222
        this.$refs.ruleForm2.validateField('title')
223
        this.ruleForm2.cnt = this.$refs.ueBox.getUEContent()
224
        if (this.ruleForm2.title) {
225
          if (this.id) {
226
            this.ruleForm2.id = this.id
227
          }
228
          this.$confirm('该内容是否保存草稿箱?', '提示', {
229
            confirmButtonText: '确定',
230
            cancelButtonText: '取消',
231
            type: 'warning',
232
            center: true
233
          }).then(() => {
234
            this.$http.post((this.id) ? draftUrl : draftFirstUrl, this.ruleForm2, response => {
235
              this.draftFlag = true
236
              if (response.success && response.data) {
237
                const info = response.data
238
                this.id = info
239
              } else {
240
                if (this.id) {
241
                  this.$http.get(inquireContentUrl, { id: this.id }, (response) => {
242
                    if (response.success && response.data) {
243
                      const info = response.data
244
                      if (info.published) {
245
                        this.$message({
246
                          message: '该内容草稿已被发布',
247
                          type: 'warning'
248
                        })
249
                      } else {
250
                        if (info.actived) {
251
                          this.$message({
252
                            message: '该内容草稿已被删除',
253
                            type: 'warning'
254
                          })
255
                        }
256
                      }
257
                    }
258
                  })
259
                }
260
              }
261
            })
262
          }).catch(() => {
263
          })
264
        }
147 265
      },
148 266
      submitForm(formName) {
267
        this.ruleForm2.cnt = this.$refs.ueBox.getUEContent()
149 268
        this.$refs[formName].validate((valid) => {
150 269
          if (valid) {
151
            alert('submit!')
270
            if (this.id) {
271
              this.ruleForm2.id = this.id
272
            }
273
            this.$confirm('该内容是否发布?', '提示', {
274
              confirmButtonText: '确定',
275
              cancelButtonText: '取消',
276
              type: 'warning',
277
              center: true
278
            }).then(() => {
279
              this.$http.post((this.id) ? draftPublishUrl : publishUrl, this.ruleForm2, (response) => {
280
                if (response.success && response.data) {
281
                  this.$router.push('publist')
282
                } else {
283
                  if (this.id) {
284
                    this.$http.get(inquireContentUrl, { id: this.id }, (response) => {
285
                      if (response.success && response.data) {
286
                        const info = response.data
287
                        if (info.published) {
288
                          this.$message({
289
                            message: '该内容已被发布',
290
                            type: 'warning'
291
                          })
292
                        } else {
293
                          if (info.actived) {
294
                            this.$message({
295
                              message: '该内容已被删除',
296
                              type: 'warning'
297
                            })
298
                          }
299
                        }
300
                      }
301
                    })
302
                  }
303
                }
304
              })
305
            }).catch(() => {
306
            })
152 307
          } else {
153 308
            console.log('error submit!!')
154 309
            return false
@ -163,26 +318,41 @@
163 318
</script>
164 319
165 320
<style rel="stylesheet/scss" lang="scss" scoped>
166
  .content-container {
167
    position: relative;
321
  .formWidth {
322
    width: 960px
168 323
  }
169 324
170
  .fileBox {
171
    position: absolute; top: 20px; left: 550px;
172
    text-align: center
325
  .selectWidth {
326
    width: 103px;
173 327
  }
328
174 329
  .teimg {
175
    color:#606266;
176
    font-size: 16px;
330
    color: #606266;
331
    font-size: 12px;
332
    text-align: center;
333
    line-height: 10px;
177 334
  }
335
178 336
  .tetype {
179
    color:#909399;
337
    color: #909399;
180 338
    font-size: 14px;
339
    text-align: center;
340
    line-height: 10px
181 341
  }
342
182 343
  .editBox .el-form-item__content {
183 344
    line-height: 0px;
184 345
  }
346
185 347
  .publishButton {
186 348
    text-align: center;
187 349
  }
350
351
  .traftButton {
352
    text-align: right;
353
  }
354
355
  .avatar-uploader {
356
    line-height: 1.15;
357
  }
188 358
</style>

+ 224 - 2
src/views/contentPub/recycleBin.vue

@ -1,3 +1,225 @@
1 1
<template>
2
  <div>内容回收站列表</div>
3
</template>
2
  <div class="app-container">
3
    <div class="box-container">
4
      <div class="contain-title">内容回收站列表</div>
5
      <div class="contian-operate">
6
        <el-button type="danger" @click.stop="deleteAll">全部彻底删除</el-button>
7
      </div>
8
    </div>
9
    <div class="content-container">
10
      <div class="contain-select">
11
        <span>栏目分类:</span>
12
        <el-select v-model="selectMode" placeholder="选择分类" @change="change">
13
          <el-option label="平台新闻" value="1"></el-option>
14
          <el-option label="采访专栏" value="2"></el-option>
15
          <el-option label="政策法规" value="3"></el-option>
16
          <el-option label="通知公告" value="4"></el-option>
17
        </el-select>
18
      </div>
19
      <complex-table :tableData="tableData" :tableItem="tableItem" :operatingList='operatingList' :total='total'
20
        v-on:sortSingleExpert="sortSingleExpert" v-on:jump="jump" v-on:current="current" v-on:edit="edit"></complex-table>
21
    </div>
22
  </div>
23
</template>
24
25
<script>
26
  import complexTable from '@/components/complexTable'
27
  import { thoroughDeleteAll, thoroughDeleteSingleUrl, recycleBinInquireUrl, restoreUrl, inquireContentUrl } from '@/api/content'
28
  import { queryUserOne } from '@/api/sysSetting'
29
  import { parseTime } from '@/utils/index'
30
  import ret from '@/utils/comTable'
31
  export default {
32
    data() {
33
      return {
34
        searchText: '',
35
        selectMode: '',
36
        info: {
37
          catalog: '',
38
          pageSize: 20,
39
          pageNo: 1
40
        },
41
        type: {
42
          '1': '平台新闻',
43
          '2': '采访专栏',
44
          '3': '政策法规',
45
          '4': '通知公告'
46
        },
47
        formData: {},
48
        operatingList: [ // 在子组件中遍历事件
49
          {
50
            text: '恢复',
51
            event: 'edit',
52
            icon: 'primary'
53
          },
54
          {
55
            text: '彻底删除',
56
            event: 'sortSingleExpert',
57
            icon: 'danger'
58
          }
59
        ],
60
        dataList: [], //  拉去专家数据存到dataList这个数组里面
61
        tableData: [], //  每一页的存储的数据
62
        total: 0, //  页码总数
63
        tableItem: [ // 表头信息
64
          {
65
            prop: 'title',
66
            tit: '标题',
67
            active: 'active' // 点击加颜色,加此选项
68
          },
69
          {
70
            prop: 'catalog',
71
            tit: '栏目分类'
72
          },
73
          {
74
            prop: 'createTime',
75
            tit: '创建时间'
76
          },
77
          {
78
            prop: 'creator',
79
            tit: '创建人'
80
          },
81
          {
82
            prop: 'invalidTime',
83
            tit: '删除时间',
84
            width: '160'
85
          },
86
          {
87
            prop: 'invalidOperator',
88
            tit: '删除人',
89
            width: '160'
90
          },
91
          {
92
            operate: 'edit',
93
            width: '200'
94
          }
95
        ]
96
      }
97
    },
98
    created() {
99
      this.publishList()
100
    },
101
    components: {
102
      complexTable //  表子页面
103
    },
104
    methods: {
105
      change(value) {
106
        this.info.catalog = value
107
        this.publishList()
108
      },
109
      publishList() {
110
        this.$http.get(recycleBinInquireUrl, this.info, (response) => { //  拉去专家信息列表,总数据存在dataList,tableData存每一页的信息
111
          if (response.success && response.data) {
112
            const epData = response.data.data
113
            for (let i = 0; i < epData.length; i++) {
114
              epData[i].createTime = parseTime(epData[i].createTime).substr(0, 16)
115
              epData[i].invalidTime = parseTime(epData[i].invalidTime).substr(0, 16)
116
              epData[i].catalog = this.type[epData[i].catalog]
117
              this.$http.get(queryUserOne, { id: epData[i].creator }, (response) => {
118
                if (response.success) {
119
                  epData[i].creator = response.data.name
120
                }
121
              })
122
            }
123
            this.dataList = epData
124
            this.total = Math.ceil(epData / 20)
125
            if (this.total > 1) {
126
              this.tableData = this.dataList.slice(0, 20)
127
            } else {
128
              const array = this.dataList
129
              ret.gapFilling(array)
130
              this.tableData = array
131
            }
132
          } else {
133
            this.$sort.total = 0
134
            this.tableData = []
135
          }
136
        })
137
      },
138
      edit(obj) {
139
        console.log(obj)
140
        this.$confirm(`确定恢复${obj.title}内容?`, '提示', {
141
          confirmButtonText: '确定',
142
          cancelButtonText: '取消',
143
          type: 'warning',
144
          center: true
145
        }).then(() => {
146
          this.$http.get(restoreUrl, { id: obj.id }, response => {
147
            if (response.success) {
148
              if (response.data) {
149
                this.publishList()
150
                this.$message({
151
                  message: '恢复成功成功',
152
                  type: 'success'
153
                })
154
              } else {
155
                this.$http.get(inquireContentUrl, { id: this.id }, (response) => {
156
                  if (response.success && response.data) {
157
                    const info = response.data
158
                    if (!info.actived) {
159
                      this.$message({
160
                        message: '状态改变',
161
                        type: 'warning'
162
                      })
163
                    }
164
                  }
165
                })
166
              }
167
            }
168
          })
169
        }).catch(() => {
170
        })
171
      },
172
      deleteAll() {
173
        this.$confirm('确定全部彻底删除回收站内容?', '提示', {
174
          confirmButtonText: '确定',
175
          cancelButtonText: '取消',
176
          type: 'warning',
177
          center: true
178
        }).then(() => {
179
          this.$http.get(thoroughDeleteAll, '', response => {
180
            if (response.success) {
181
              this.publishList()
182
              this.$message({
183
                message: '全部删除成功',
184
                type: 'success'
185
              })
186
            }
187
          })
188
        }).catch(() => {
189
        })
190
      },
191
      sortSingleExpert(obj) { //  点击单个特约专家信息
192
        console.log(obj)
193
        this.$confirm('确定彻底删除该条回收站内容?', '提示', {
194
          confirmButtonText: '确定',
195
          cancelButtonText: '取消',
196
          type: 'warning',
197
          center: true
198
        }).then(() => {
199
          this.$http.get(thoroughDeleteSingleUrl, { id: obj.id }, response => {
200
            if (response.success) {
201
              this.publishList()
202
              this.$message({
203
                message: '删除成功',
204
                type: 'success'
205
              })
206
            }
207
          })
208
        }).catch(() => {
209
        })
210
      },
211
      jump(id) { // 点击超练级跳转
212
        this.$router.push({ path: 'viewRecycling', query: { id }})
213
      },
214
      current(val) { // 点击页码
215
        if (val < this.total) {
216
          this.tableData = this.dataList.slice(20 * (val - 1), 20 * val)
217
        } else {
218
          const array = this.dataList.slice(20 * val)
219
          ret.gapFilling(array)
220
          this.tableData = array
221
        }
222
      }
223
    }
224
  }
225
</script>

+ 40 - 18
src/views/contentPub/viewRecyclingBins.vue

@ -6,24 +6,24 @@
6 6
    <div class="content-container contentBox">
7 7
      <el-form :model="ruleForm2" status-icon ref="ruleForm2" label-width="100px" class="demo-ruleForm formTable">
8 8
        <div class="formWidth">
9
          <el-form-item label="标题" prop="contentTitle">
10
            平台新闻<span>Science:美国国家科学基金会暂停研究生资助项目,上千访问学者或受影响</span>
9
          <el-form-item label="标题" prop="title">
10
            <span>{{ruleForm2.title}}</span>
11 11
          </el-form-item>
12
          <el-form-item label="作者/来源" prop="authorSource">
13
            科袖网
12
          <el-form-item label="作者/来源" prop="source">
13
            {{ruleForm2.source}}
14 14
          </el-form-item>
15
          <el-form-item label="相关专家" prop="professor">
16
            张莎莎
15
          <el-form-item label="相关专家" prop="professors">
16
            {{ruleForm2.professors}}
17 17
          </el-form-item>
18
          <el-form-item label="相关机构" prop="institution">
19
            北京科技大学
18
          <el-form-item label="相关机构" prop="orgs">
19
            {{ruleForm2.orgs}}
20 20
          </el-form-item>
21
          <el-form-item label="相关企业" prop="company">
22
            北京科技大学
21
          <el-form-item label="相关企业" prop="comps">
22
            {{ruleForm2.comps}}
23 23
          </el-form-item>
24 24
        </div>
25
        <el-form-item label="文章正文" prop="artDesc" class="editBox">
26
          <div class="editContent"></div>
25
        <el-form-item label="文章正文" prop="cnt" class="editBox">
26
          <div class="editContent" v-html="ruleForm2.cnt"></div>
27 27
        </el-form-item>
28 28
        <el-form-item class="publishButton">
29 29
          <el-button type="primary" @click="submitForm('ruleForm2')">恢复</el-button>
@ -31,7 +31,7 @@
31 31
        </el-form-item>
32 32
      </el-form>
33 33
      <div class="fileBox">
34
        <img src="../../assets/404_images/404.png" alt="" class="fileImg">
34
        <img :src="ruleForm2.imgUrl" alt="" class="fileImg">
35 35
      </div>
36 36
37 37
    </div>
@ -39,18 +39,40 @@
39 39
</template>
40 40
41 41
<script>
42
  import { inquireContentUrl } from '@/api/content'
42 43
  export default {
43 44
    data() {
44 45
      return {
45 46
        ruleForm2: {
46
          authorSource: '',
47
          select: '',
48
          contentTitle: '',
49
          professor: '',
50
          artDesc: ''
47
          title: '',
48
          source: '',
49
          cnt: '',
50
          imgUrl: '',
51
          catalog: '',
52
          professors: '',
53
          orgs: '',
54
          comps: ''
51 55
        }
52 56
      }
53 57
    },
58
    created() {
59
      const id = this.$route.query.id
60
      this.$http.get(inquireContentUrl, { id }, (response) => {
61
        if (response.success && response.data) {
62
          const info = response.data
63
          this.ruleForm2 = {
64
            catalog: info.catalog,
65
            cnt: info.cnt,
66
            title: info.title,
67
            source: info.source,
68
            imgUrl: info.imgUrl,
69
            professors: '',
70
            orgs: '',
71
            comps: ''
72
          }
73
        }
74
      })
75
    },
54 76
    methods: {
55 77
      submitForm(formName) {
56 78
        this.$refs[formName].validate((valid) => {

+ 50 - 11
src/views/cooperationAgency/agencySort.vue

@ -4,43 +4,82 @@
4 4
      <div class="t-left">
5 5
        <div class="headPhoto"></div>
6 6
      </div>
7
      <el-form :model="form" class="form-el">
7
      <el-form :model="form" class="form-el" ref="form" :rules="rules2">
8 8
        <el-form-item :label-width="formLabelWidth">
9
          机构名称
9
          {{form.name}}
10 10
        </el-form-item>
11 11
        <el-form-item :label-width="formLabelWidth">
12
          机构类型
12
          {{form.type}}
13 13
        </el-form-item>
14 14
        <el-form-item :label-width="formLabelWidth">
15
          所在城市
15
          {{form.name}}
16 16
        </el-form-item>
17
        <el-form-item :label-width="formLabelWidth">
17
        <el-form-item :label-width="formLabelWidth" prop="level">
18 18
          <div class='labelBox'>合作机构平台序号</div></span>
19
          <el-input v-model="form.name" placeholder="最多三位数字" class="conBox"></el-input>
19
          <el-input type="level" v-model="form.level" placeholder="最多三位数字" class="conBox" maxlength="3"></el-input>
20
        </el-form-item>
21
        <el-form-item class="modiaB">
22
          <el-button type="primary" @click="submitForm('form')">确定</el-button>
20 23
        </el-form-item>
21 24
      </el-form>
22 25
    </div>
23
    <div slot="footer" class="dialog-footer">
24
      <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
25
    </div>
26 26
  </el-dialog>
27 27
</template>
28
29 28
<script>
29
  import { sortUrl } from '@/api/cooperationAgency'
30 30
  export default {
31 31
    data() {
32
      //  校验排序字段
33
      const checkAge = (rule, value, callback) => {
34
        const par = /^\d{0,3}$/
35
        if (!value) {
36
          return callback()
37
        } else {
38
          if (par.test(value)) {
39
            return callback()
40
          } else {
41
            callback('请填写数字')
42
          }
43
        }
44
      }
32 45
      return {
33 46
        dialogFormVisible: false,
34 47
        form: {
35
          name: ''
48
          level: ''
49
        },
50
        rules2: {
51
          level: [
52
            { validator: checkAge, trigger: 'blur' }
53
          ]
36 54
        },
37 55
        formLabelWidth: '20px'
38 56
      }
57
    },
58
    methods: {
59
      submitForm(formName) {
60
        this.$refs[formName].validate((valid) => {
61
          if (valid) {
62
            this.$http.post(sortUrl, { id: this.form.id, level: this.form.level }, (response) => {
63
              if (response.success) {
64
                this.$emit('rearrange')
65
                this.dialogFormVisible = false
66
              }
67
            })
68
          } else {
69
            return false
70
          }
71
        })
72
      }
39 73
    }
40 74
  }
41 75
</script>
42 76
43 77
<style scoped>
78
  .modiaB {
79
    text-align: center;
80
    margin: 30px 0;
81
  }
82
44 83
  .box {
45 84
    overflow: hidden;
46 85
  }

+ 140 - 100
src/views/cooperationAgency/index.vue

@ -1,109 +1,149 @@
1 1
<template>
2
    <div class="app-container">
3
      <div class="box-container">
4
        <div class="contain-title">合作机构列表</div>
5
      </div>
6
      <div class="content-container">
7
        <complex-table :tableData="tableData" :tableItem="tableItem"></complex-table>
8
      </div>
9
      <agencySort ref="sort"></agencySort>
10
      <button @click="dianji">点击</button>
2
  <div class="app-container">
3
    <div class="box-container">
4
      <div class="contain-title">合作机构列表</div>
11 5
    </div>
12
  </template>
13
  
14
  <script>
15
    import complexTable from '@/components/complexTable'
16
    import agencySort from './agencySort'
17
    export default {
18
      data() {
19
        return {
20
          searchText: '',
21
          selectMode: '',
22
          tableData: [
23
            {
24
              date: 1,
25
              name: '关于征集企业技术创新需求的通知',
26
              class: '通知公告',
27
              owner: '张贝贝',
28
              num: '4552',
29
              mail: '280716068@qq.com',
30
              time: '2018/1/2'
31
            }, {
32
              date: 2,
33
              name: '关于征集企业技术创新需求的通知',
34
              class: '通知公告',
35
              owner: '张贝贝',
36
              num: '4552',
37
              mail: '280716068@qq.com',
38
              time: '2018/1/2'
39
            }, {
40
              date: 3,
41
              name: '关于征集企业技术创新需求的通知',
42
              class: '通知公告',
43
              owner: '张贝贝',
44
              num: '4552',
45
              mail: '280716068@qq.com',
46
              time: '2018/1/2'
47
            }, {
48
              date: 4,
49
              name: '关于征集企业技术创新需求的通知',
50
              class: '通知公告',
51
              owner: '张贝贝',
52
              num: '4552',
53
              mail: '280716068@qq.com',
54
              time: '2018/1/2'
6
    <div class="content-container">
7
      <complex-table :tableData="tableData" :tableItem="tableItem" :operatingList='operatingList' :total='total'
8
        v-on:sortSingleExpert="sortSingleAgency" v-on:jump="jump" v-on:current="current"></complex-table>
9
    </div>
10
    <agencySort ref="sort" v-on:rearrange="rearrange"></agencySort>
11
  </div>
12
</template>
13
14
<script>
15
  import complexTable from '@/components/complexTable'
16
  import agencySort from './agencySort'
17
  import { agencyListUrl } from '@/api/cooperationAgency' //  agencyUserUrl
18
  import { parseTime } from '@/utils/index'
19
  import ret from '@/utils/comTable'
20
  export default {
21
    data() {
22
      return {
23
        searchText: '',
24
        selectMode: '',
25
        formData: {},
26
        operatingList: [ // 在子组件中遍历事件
27
          {
28
            text: '排序',
29
            event: 'sortSingleExpert',
30
            icon: 'primary'
31
          }
32
        ],
33
        dataList: [], //  拉去专家数据存到dataList这个数组里面
34
        tableData: [], //  每一页的存储的数据
35
        total: 0, //  页码总数
36
        tableItem: [ // 表头信息
37
          {
38
            prop: 'level',
39
            tit: '机构序号'
40
          },
41
          {
42
            prop: 'name',
43
            tit: '机构名称',
44
            active: 'active' // 点击加颜色,加此选项
45
          },
46
          {
47
            prop: 'type',
48
            tit: '机构类型',
49
            width: '160'
50
          },
51
          {
52
            prop: 'linkman',
53
            tit: '联系人',
54
            width: '160'
55
          },
56
          {
57
            prop: 'linkphone',
58
            tit: '联系电话',
59
            width: '160'
60
          },
61
          {
62
            prop: 'linkemail',
63
            tit: '联系邮箱',
64
            width: '160'
65
          },
66
          {
67
            prop: 'assTime',
68
            tit: '入住时间',
69
            width: '160'
70
          },
71
          {
72
            operate: 'edit',
73
            width: '200'
74
          }
75
        ]
76
      }
77
    },
78
    created() {
79
      this.agencyList()
80
    },
81
    components: {
82
      complexTable,
83
      agencySort
84
    },
85
    methods: {
86
      agencyList() {
87
        const arr = [
88
          {
89
            name: '北京科袖科技有限公司',
90
            type: '上市公司',
91
            linkman: '张女士',
92
            linkphone: '13526256369',
93
            linkemail: '280716069@qq.com'
94
          },
95
          {
96
            name: '北京佳木斯科技有限公司',
97
            type: '国有企业',
98
            linkman: '李朋涛',
99
            linkphone: '1352569',
100
            linkemail: '280716890@qq.com'
101
          }
102
        ]
103
        this.$http.get(agencyListUrl, '', (response) => { //  拉去专家信息列表,总数据存在dataList,tableData存每一页的信息
104
          if (response.success && response.data) {
105
            const epData = response.data
106
            for (let i = 0; i < epData.length; i++) {
107
              epData[i].assTime = parseTime(epData[i].assTime).substr(0, 10)
108
              Object.assign(epData[i], arr[i])
109
              // this.$http.get(agencyUserUrl, {id: epData[i].id}, (response ) => {
110
              //   console.log(response)
111
              // })
55 112
            }
56
          ],
57
          tableItem: [
58
            {
59
              prop: 'date',
60
              tit: '机构序号'
61
            },
62
            {
63
              prop: 'class',
64
              tit: '机构名称',
65
              width: '160'
66
            },
67
            {
68
              prop: 'owner',
69
              tit: '机构类型',
70
              width: '160'
71
            },
72
            {
73
              prop: 'date',
74
              tit: '联系人',
75
              width: '160'
76
            },
77
            {
78
              prop: 'num',
79
              tit: '联系电话',
80
              width: '160'
81
            },
82
            {
83
              prop: 'mail',
84
              tit: '联系邮箱',
85
              width: '160'
86
            },
87
            {
88
              prop: 'time',
89
              tit: '入驻时间',
90
              width: '160'
91
            },
92
            {
93
              operate: 'edit',
94
              width: '200'
113
            this.dataList = epData
114
            this.total = Math.ceil(epData / 20)
115
            if (this.total > 1) {
116
              this.tableData = this.dataList.slice(0, 20)
117
            } else {
118
              const array = this.dataList
119
              ret.gapFilling(array)
120
              this.tableData = array
95 121
            }
96
          ]
97
        }
122
          } else {
123
            this.$sort.total = 0
124
            this.tableData = []
125
          }
126
        })
127
      },
128
      rearrange() {
129
        this.agencyList()
130
      },
131
      sortSingleAgency(obj) { //  点击单个特约专家信息
132
        this.$refs.sort.dialogFormVisible = true
133
        this.$refs.sort.form = { ...obj }
98 134
      },
99
      components: {
100
        complexTable,
101
        agencySort
135
      jump(id) { // 点击超练级跳转
136
        console.log(id)
102 137
      },
103
      methods: {
104
        dianji() {
105
          console.log(this.$refs.sort.dialogFormVisible = true)
138
      current(val) { // 点击页码
139
        if (val < this.total) {
140
          this.tableData = this.dataList.slice(20 * (val - 1), 20 * val)
141
        } else {
142
          const array = this.dataList.slice(20 * val)
143
          ret.gapFilling(array)
144
          this.tableData = array
106 145
        }
107 146
      }
108 147
    }
109
  </script>
148
  }
149
</script>

+ 53 - 12
src/views/specialExperts/expertSort.vue

@ -4,43 +4,83 @@
4 4
      <div class="t-left">
5 5
        <div class="headPhoto"></div>
6 6
      </div>
7
      <el-form :model="form" class="form-el">
7
      <el-form :model="form" class="form-el" ref="form" :rules="rules2">
8 8
        <el-form-item :label-width="formLabelWidth">
9
          专家姓名
9
          {{form.name}}
10 10
        </el-form-item>
11 11
        <el-form-item :label-width="formLabelWidth">
12
          职称
12
          {{form.job}}
13 13
        </el-form-item>
14 14
        <el-form-item :label-width="formLabelWidth">
15
          所在机构
15
          {{form.comp}}
16 16
        </el-form-item>
17
        <el-form-item :label-width="formLabelWidth">
17
        <el-form-item :label-width="formLabelWidth" prop="level">
18 18
          <div class='labelBox'>专家平台序号</div></span>
19
          <el-input v-model="form.name" placeholder="最多三位数字" class="conBox"></el-input>
19
          <el-input type="level" v-model="form.level" placeholder="最多三位数字" class="conBox" maxlength="3"></el-input>
20
        </el-form-item>
21
        <el-form-item class="modiaB">
22
          <el-button type="primary" @click="submitForm('form')">确定</el-button>
20 23
        </el-form-item>
21 24
      </el-form>
22 25
    </div>
23
    <div slot="footer" class="dialog-footer">
24
      <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
25
    </div>
26 26
  </el-dialog>
27 27
</template>
28 28
29 29
<script>
30
  import { sortUrl } from '@/api/specialExpert'
30 31
  export default {
31 32
    data() {
33
      //  校验排序字段
34
      const checkAge = (rule, value, callback) => {
35
        const par = /^\d{0,3}$/
36
        if (!value) {
37
          return callback()
38
        } else {
39
          if (par.test(value)) {
40
            return callback()
41
          } else {
42
            callback('请填写数字')
43
          }
44
        }
45
      }
32 46
      return {
33 47
        dialogFormVisible: false,
34 48
        form: {
35
          name: ''
49
          level: ''
50
        },
51
        rules2: {
52
          level: [
53
            { validator: checkAge, trigger: 'blur' }
54
          ]
36 55
        },
37 56
        formLabelWidth: '20px'
38 57
      }
58
    },
59
    methods: {
60
      submitForm(formName) {
61
        this.$refs[formName].validate((valid) => {
62
          if (valid) {
63
            this.$http.post(sortUrl, { id: this.form.id, level: this.form.level }, (response) => {
64
              if (response.success) {
65
                this.$emit('rearrange')
66
                this.dialogFormVisible = false
67
              }
68
            })
69
          } else {
70
            return false
71
          }
72
        })
73
      }
39 74
    }
40 75
  }
41 76
</script>
42 77
43 78
<style scoped>
79
  .modiaB {
80
    text-align: center;
81
    margin: 30px 0;
82
  }
83
44 84
  .box {
45 85
    overflow: hidden;
46 86
  }
@ -57,7 +97,8 @@
57 97
  }
58 98
59 99
  .form-el {
60
    float: left
100
    float: left;
101
    margin-bottom: 20px;
61 102
  }
62 103
63 104
  .form-el .el-form-item {
@ -77,4 +118,4 @@
77 118
  .dialog-footer {
78 119
    text-align: center;
79 120
  }
80
</style>
121
</style>

+ 94 - 47
src/views/specialExperts/index.vue

@ -4,88 +4,72 @@
4 4
      <div class="contain-title">特约专家列表</div>
5 5
    </div>
6 6
    <div class="content-container">
7
      <complex-table :tableData="tableData" :tableItem="tableItem"></complex-table>
7
      <complex-table :tableData="tableData" :tableItem="tableItem" :operatingList='operatingList' :total='total'
8
        v-on:sortSingleExpert="sortSingleExpert" v-on:jump="jump" v-on:current="current"></complex-table>
8 9
    </div>
9
    <expertSort ref="sort"></expertSort>
10
    <button @click="dianji">点击</button>
10
    <expertSort ref="sort" v-on:rearrange="rearrange"></expertSort>
11 11
  </div>
12 12
</template>
13 13
14 14
<script>
15 15
  import complexTable from '@/components/complexTable'
16 16
  import expertSort from './expertSort'
17
  import { expertListUrl } from '@/api/specialExpert' //  expertUserUrl
18
  import { parseTime } from '@/utils/index'
19
  import ret from '@/utils/comTable'
17 20
  export default {
18 21
    data() {
19 22
      return {
20 23
        searchText: '',
21 24
        selectMode: '',
22
        tableData: [
25
        formData: {},
26
        operatingList: [ // 在子组件中遍历事件
23 27
          {
24
            date: 1,
25
            name: '关于征集企业技术创新需求的通知',
26
            class: '通知公告',
27
            owner: '张贝贝',
28
            num: '4552',
29
            mail: '280716068@qq.com',
30
            time: '2018/1/2'
31
          }, {
32
            date: 2,
33
            name: '关于征集企业技术创新需求的通知',
34
            class: '通知公告',
35
            owner: '张贝贝',
36
            num: '4552',
37
            mail: '280716068@qq.com',
38
            time: '2018/1/2'
39
          }, {
40
            date: 3,
41
            name: '关于征集企业技术创新需求的通知',
42
            class: '通知公告',
43
            owner: '张贝贝',
44
            num: '4552',
45
            mail: '280716068@qq.com',
46
            time: '2018/1/2'
47
          }, {
48
            date: 4,
49
            name: '关于征集企业技术创新需求的通知',
50
            class: '通知公告',
51
            owner: '张贝贝',
52
            num: '4552',
53
            mail: '280716068@qq.com',
54
            time: '2018/1/2'
28
            text: '排序',
29
            event: 'sortSingleExpert',
30
            icon: 'primary'
55 31
          }
56 32
        ],
57
        tableItem: [
33
        dataList: [], //  拉去专家数据存到dataList这个数组里面
34
        tableData: [], //  每一页的存储的数据
35
        total: 0, //  页码总数
36
        tableItem: [ // 表头信息
58 37
          {
59
            prop: 'date',
38
            prop: 'level',
60 39
            tit: '专家序号'
61 40
          },
62 41
          {
63
            prop: 'class',
42
            prop: 'name',
43
            tit: '真实姓名',
44
            active: 'active' // 点击加颜色,加此选项
45
          },
46
          {
47
            prop: 'job',
64 48
            tit: '职称',
65 49
            width: '160'
66 50
          },
67 51
          {
68
            prop: 'owner',
52
            prop: 'comp',
69 53
            tit: '所在机构',
70 54
            width: '160'
71 55
          },
72 56
          {
73
            prop: 'date',
57
            prop: 'city',
74 58
            tit: '所在城市',
75 59
            width: '160'
76 60
          },
77 61
          {
78
            prop: 'num',
62
            prop: 'phone',
79 63
            tit: '联系电话',
80 64
            width: '160'
81 65
          },
82 66
          {
83
            prop: 'mail',
67
            prop: 'email',
84 68
            tit: '联系邮箱',
85 69
            width: '160'
86 70
          },
87 71
          {
88
            prop: 'time',
72
            prop: 'assTime',
89 73
            tit: '入住时间',
90 74
            width: '160'
91 75
          },
@ -96,13 +80,76 @@
96 80
        ]
97 81
      }
98 82
    },
83
    created() {
84
      this.expertList()
85
    },
99 86
    components: {
100
      complexTable,
101
      expertSort
87
      complexTable, //  表子页面
88
      expertSort //  专家排序页面
102 89
    },
103 90
    methods: {
104
      dianji() {
105
        console.log(this.$refs.sort.dialogFormVisible = true)
91
      expertList() {
92
        const arr = [
93
          {
94
            name: '张波',
95
            job: '教授',
96
            comp: '河南科技学院',
97
            city: '郑州',
98
            phone: '13526256369',
99
            email: '280716069@qq.com'
100
          },
101
          {
102
            name: '李朋涛',
103
            job: '讲师',
104
            comp: '北京大学',
105
            city: '北京',
106
            phone: '15623569685',
107
            email: '280715983@qq.com'
108
          }
109
        ]
110
        this.$http.get(expertListUrl, '', (response) => { //  拉去专家信息列表,总数据存在dataList,tableData存每一页的信息
111
          if (response.success && response.data) {
112
            const epData = response.data
113
            for (let i = 0; i < epData.length; i++) {
114
              epData[i].assTime = parseTime(epData[i].assTime).substr(0, 16)
115
              Object.assign(epData[i], arr[i])
116
              // this.$http.get(expertUserUrl, {id: epData[i].id}, (response ) => {
117
              //   console.log(response)
118
              // })
119
            }
120
            this.dataList = epData
121
            this.total = Math.ceil(epData / 20)
122
            if (this.total > 1) {
123
              this.tableData = this.dataList.slice(0, 20)
124
            } else {
125
              const array = this.dataList
126
              ret.gapFilling(array)
127
              this.tableData = array
128
            }
129
          } else {
130
            this.$sort.total = 0
131
            this.tableData = []
132
          }
133
        })
134
      },
135
      rearrange() {
136
        this.expertList()
137
      },
138
      sortSingleExpert(obj) { //  点击单个特约专家信息
139
        this.$refs.sort.dialogFormVisible = true
140
        this.$refs.sort.form = { ...obj }
141
      },
142
      jump(id) { // 点击超练级跳转
143
        console.log(id)
144
      },
145
      current(val) { // 点击页码
146
        if (val < this.total) {
147
          this.tableData = this.dataList.slice(20 * (val - 1), 20 * val)
148
        } else {
149
          const array = this.dataList.slice(20 * val)
150
          ret.gapFilling(array)
151
          this.tableData = array
152
        }
106 153
      }
107 154
    }
108 155
  }