doum
2 天以前 116a83c60384f716cb8c988a4e8f2b30bf5d6718
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<template>
  <TableLayout :permissions="['business:activity:query']">
    <!-- 搜索表单 -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
      <el-form-item label="标题" prop="name">
        <el-input v-model="searchForm.name" placeholder="请输入标题" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="发布人" prop="realName">
        <el-input v-model="searchForm.realName" placeholder="请输入发布人" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="所属分类" prop="labelId">
        <el-select
            v-model="searchForm.labelId"
            placeholder="请选择所属分类"
            style="width: 150px"
            clearable
            @change="search"
        >
          <el-option
              v-for="item in labels"
              :key="item.id"
              :value="item.id"
              :label="item.name"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="所属品牌" prop="brandId">
        <el-select
            v-model="searchForm.brandId"
            style="width: 150px"
            placeholder="请选择所属品牌"
            clearable
            @change="search"
        >
          <el-option
              v-for="item in brands"
              :key="item.id"
              :value="item.id"
              :label="item.name"
          ></el-option>
        </el-select>
      </el-form-item>
 
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button @click="reset">重置</el-button>
      </section>
    </el-form>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <ul class="toolbar" v-permissions="['business:activity:create', 'business:activity:delete']">
        <li><el-button type="primary" @click="$refs.operaInformationWindow.open('新建')" icon="el-icon-plus" v-permissions="['business:activity:create']">新建</el-button></li>
        <li><el-button type="danger"  @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:activity:delete']">删除</el-button></li>
      </ul>
      <el-table
        v-loading="isWorking.search"
        :data="tableData.list"
        stripe
        border
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" ></el-table-column>
        <el-table-column prop="imgurlfull" label="主图" align="center" min-width="100px">
          <template slot-scope="{row}">
            <el-image style="width: 50px;height: 50px;" v-if="row.imgurl && row.imgurl!=''" :src="row.imgurlfull" :preview-src-list="[row.imgurlfull]"></el-image>
          </template>
        </el-table-column>
        <el-table-column prop="name" label="标题" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="lablesName" label="所属分类" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="brandName" label="所属品牌" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="content" label="数据值" min-width="100px">
          <template slot-scope="{row}">
            <div v-if="row.content">
              <el-button v-if="row.contentType == 1" title="点击跳转外链查看" type="text" @click="openUrl(row)" >点击跳转</el-button>
              <el-button v-else title="点击查看详情" type="text" @click="showCode(row)" >点击查看</el-button>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="looknum" label="浏览量" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="zanCount" label="点赞数" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="collectCount" label="收藏数" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="realName" label="发布人" align="center" min-width="140px"></el-table-column>
        <el-table-column prop="editDate" label="发布时间" align="center" min-width="140px"></el-table-column>
        <el-table-column prop="status" label="状态" min-width="80px" align="center">
          <template slot-scope="{row}">
            <el-switch
                v-model="row.status"
                :active-value="1"
                :inactive-value="0"
                active-color="#13ce66"
                fixed="right"
                inactive-color="#ff4949"
                @change="statusChange(row)"
            ></el-switch>
          </template>
        </el-table-column>
        <el-table-column
          v-if="containPermissions(['business:activity:update', 'business:activity:delete'])"
          label="操作"
          min-width="120"
          fixed="right"
        >
          <template slot-scope="{row}">
            <el-button type="text" @click="$refs.operaInformationWindow.open('编辑', row)" icon="el-icon-edit" v-permissions="['business:activity:update']">编辑</el-button>
            <el-button type="text"  style="color: red;" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:activity:delete']">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        @size-change="handleSizeChange"
        @current-change="handlePageChange"
        :pagination="tableData.pagination"
      >
      </pagination>
    </template>
    <!-- 新建/修改 -->
    <OperaInformationWindow ref="operaInformationWindow" @success="handlePageChange"/>
    <el-dialog
        class="center-title"
        :title="'内容详情【'+curTitle+'】'"
        width="70%"
        height="70%"
        text="字典值"
        :visible.sync="visible1"
        append-to-body
    >
      <div class="agree-list"  v-html="agreement">
      </div>
      <template  v-slot:footer>
        <el-button @click="visible1=false">返回</el-button>
      </template>
    </el-dialog>
  </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaInformationWindow from '@/components/business/OperaInformationWindow'
import { findAll as labelList } from '@/api/business/labels'
export default {
  name: 'Information',
  extends: BaseTable,
  components: { TableLayout, Pagination, OperaInformationWindow },
  data () {
    return {
      // 搜索
      searchForm: {
        name: '',
        realName: '',
        brandId: null,
        labelId: null,
        contentType: '',
        type: 3 // 类型0商家活动 1平台活动 2探店 3资讯
      },
      agreement: null,
      curTitle:'',
      visible1: false,
      labels: [],
      brands: []
    }
  },
  provide () {
    return {
      labels: () => this.labels,
      brands: () => this.brands
    }
  },
  created: function () {
    this.config({
      module: '资讯信息表',
      api: '/business/activity',
      'field.id': 'id',
      'field.main': 'id'
    })
    this.search()
    labelList({
      type: 0 // 商品分类
    }).then(res => {
      this.labels = res
    })
    labelList({
      type: 1 // 商品品牌
    })
      .then(res => {
        this.brands = res
      })
  },
  methods: {
    showCode(row){
      this.curTitle =row.name
      this.agreement=row.content
      this.visible1=true
    },
    openUrl(row){
      window.open(row.content)
    },
    statusChange (row) {
      this.api.updateStatusById({ id: row.id, status: row.status })
        .then(() => {
          this.$message.success('操作成功')
        })
        .catch(e => {
          this.$message.error('操作成功')
        })
        .then(() => {
          this.handlePageChange()
        })
    }
  }
}
</script>
 
<style scoped lang="scss">
.agree-list{
  height: 550px;
  //max-height: 50%;
  overflow: auto;
}
.no-scroll {
  overflow: hidden !important;
}
/deep/ .window__body {
  .table-content {
    padding: 0;
    .table-wrap {
      padding-top: 0;
    }
  }
 
}
</style>