|
|
@@ -1,95 +1,131 @@
|
|
|
<template>
|
|
|
- <div class="app-container">
|
|
|
- <el-table
|
|
|
- :key="tableKey"
|
|
|
- v-loading="listLoading"
|
|
|
- :data="list"
|
|
|
- border
|
|
|
- fit
|
|
|
- highlight-current-row
|
|
|
- style="width: 100%;"
|
|
|
- >
|
|
|
- <el-table-column :label="$t('ad.adTitle')" prop="id" align="center" :class-name="getSortClass('id')">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.TITLE }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('ad.adLocation')" prop="id" align="center" :class-name="getSortClass('id')">
|
|
|
- <template :value="{allLocation}">
|
|
|
- <span>{{ allLocation.LOCATION_NAME }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('ad.type')" align="center"> <!-- 类型 -->
|
|
|
- <template slot-scope="{row}">
|
|
|
- <template v-if="row.TYPE === '1'">
|
|
|
- <el-tag type="success">External Links</el-tag> <!-- 外链 -->
|
|
|
+ <div class="white-box">
|
|
|
+ <div class="filter-box">
|
|
|
+ <el-table
|
|
|
+ :key="tableKey"
|
|
|
+ v-loading="listLoading"
|
|
|
+ :data="list"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ style="width: 100%;"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ >
|
|
|
+ <el-table-column type="selection" width="55" />
|
|
|
+ <el-table-column :label="$t('ad.adTitle')" prop="id" align="center" :class-name="getSortClass('id')">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.TITLE }}</span>
|
|
|
</template>
|
|
|
- <template v-else-if="row.TYPE === '2'">
|
|
|
- <el-tag>Article</el-tag> <!-- 文章 -->
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('ad.adLocation')" prop="id" align="center" :class-name="getSortClass('id')">
|
|
|
+ <template :value="{allLocation}">
|
|
|
+ <span>{{ allLocation.LOCATION_NAME }}</span>
|
|
|
</template>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('ad.content')" prop="id" align="center" :class-name="getSortClass('id')">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <div v-if="row.TYPE === '1'">
|
|
|
- <el-link type="primary" target="_blank" :href="getHref(row.CONTENT)">{{ row.CONTENT }}</el-link>
|
|
|
- </div><!-- 链接 -->
|
|
|
- <div v-else-if="row.TYPE === '2'">
|
|
|
- <router-link :to="`/article/detail/${row.CONTENT}`" target="_blank" style="cursor: pointer;">{{ getContent(row.CONTENT) }}</router-link>
|
|
|
- </div><!-- 文章 -->
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('ad.sort')" prop="id" align="center" :class-name="getSortClass('id')">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input
|
|
|
- v-model="row.SORT"
|
|
|
- min="0"
|
|
|
- max="99"
|
|
|
- @change="handleChangeSort(row.ID, row.SORT)"
|
|
|
- @click.native.stop=""
|
|
|
- />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('ad.creator')" prop="id" align="center" :class-name="getSortClass('id')">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.CREATE_ADMIN_NAME }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('ad.createTime')" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.CREATED_AT | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('ad.modifiedBy')" prop="id" align="center" width="80" :class-name="getSortClass('id')">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.UPDATE_ADMIN_NAME }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('ad.modifiedTime')" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.UPDATED_AT | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('ad.status')" align="center"> <!-- 类型 -->
|
|
|
- <template slot-scope="{row}">
|
|
|
- <template v-if="row.STATUS === '1'">
|
|
|
- <el-tag type="success">show</el-tag> <!-- 外链 -->
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('ad.type')" align="center"> <!-- 类型 -->
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <template v-if="row.TYPE === '1'">
|
|
|
+ <el-tag type="success">External Links</el-tag> <!-- 外链 -->
|
|
|
+ </template>
|
|
|
+ <template v-else-if="row.TYPE === '2'">
|
|
|
+ <el-tag>Article</el-tag> <!-- 文章 -->
|
|
|
+ </template>
|
|
|
</template>
|
|
|
- <template v-else>
|
|
|
- <el-tag>hide</el-tag> <!-- 文章 -->
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('ad.content')" prop="id" align="center" :class-name="getSortClass('id')">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <div v-if="row.TYPE === '1'">
|
|
|
+ <el-link type="primary" target="_blank" :href="getHref(row.CONTENT)">{{ row.CONTENT }}</el-link>
|
|
|
+ </div><!-- 链接 -->
|
|
|
+ <div v-else-if="row.TYPE === '2'">
|
|
|
+ <router-link :to="`/article/detail/${row.CONTENT}`" target="_blank" style="cursor: pointer;">{{ getContent(row.CONTENT) }}</router-link>
|
|
|
+ </div><!-- 文章 -->
|
|
|
</template>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('ad.action')" align="center" class-name="small-padding fixed-width" />
|
|
|
- </el-table>
|
|
|
- <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.pageSize" @pagination="getList" />
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('ad.sort')" prop="id" align="center" :class-name="getSortClass('id')">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input
|
|
|
+ v-model="row.SORT"
|
|
|
+ min="0"
|
|
|
+ max="99"
|
|
|
+ @change="handleChangeSort(row.ID, row.SORT)"
|
|
|
+ @click.native.stop=""
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('ad.creator')" prop="id" align="center" :class-name="getSortClass('id')">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.CREATE_ADMIN_NAME }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('ad.createTime')" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.CREATED_AT | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('ad.modifiedBy')" prop="id" align="center" width="80" :class-name="getSortClass('id')">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.UPDATE_ADMIN_NAME }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('ad.modifiedTime')" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ tool.formatDate(row.UPDATED_AT) }}</span>
|
|
|
+
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('ad.status')" align="center"> <!-- 类型 -->
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <template v-if="row.STATUS === '1'">
|
|
|
+ <el-tag type="success">show</el-tag> <!-- 外链 -->
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-tag>hide</el-tag> <!-- 文章 -->
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('ad.action')" align="center">
|
|
|
+
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-dropdown v-if="permission.hasPermission(`ad/ad-delete`) || permission.hasPermission(`ad/edit`)" size="small" trigger="click">
|
|
|
+ <el-button type="primary" size="small" @click.stop="">
|
|
|
+ {{ $t('ad.action') }}<i class="el-icon-arrow-down el-icon--right" />
|
|
|
+ </el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item v-if="permission.hasPermission(`ad/edit`)" command="edit" @click.native="handleEdit(row)">{{ $t('common.edit') }}</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-if="permission.hasPermission(`ad/ad-delete`)" command="delete" @click.native="handleDeleteOne(row)">{{ $t('common.delete') }}</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-if="permission.hasPermission(`ad/ad-hide`)" command="hide" @click.native="handleHideOne(row)">{{ $t('ad.hide') }}</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-if="permission.hasPermission(`ad/ad-un-hide`)" command="un-hide" @click.native="handleUnHideOne(row)">{{ $t('ad.unhide') }}</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="white-box-footer">
|
|
|
+ <el-dropdown v-if="permission.hasPermission(`ad/ad-delete`)" size="small">
|
|
|
+ <el-button type="primary" size="small">
|
|
|
+ {{ $t('ad.selectData') }}<i class="el-icon-arrow-down el-icon--right" />
|
|
|
+ </el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item command="delete" @click.native="handleMuliDel()">{{ $t('table.delete') }}</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="hide" @click.native="handleMultiHide()">{{ $t('ad.hide') }}</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="un-hide" @click.native="handleMultiUnHide()">{{ $t('ad.unhide') }}</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ <el-button v-if="permission.hasPermission(`ad/ad-add`)" type="primary" size="small" icon="el-icon-plus" @click="handleAdd">{{ $t('ad.add') }}</el-button>
|
|
|
+ <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.pageSize" @pagination="getList" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </el-table></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { fetchAdList, fetchChangeSort } from '@/api/ad'
|
|
|
+import { fetchAdList, fetchChangeSort, fetchDelete, fetchHide, fetchUnhide } from '@/api/ad'
|
|
|
import waves from '@/directive/waves' // waves directive
|
|
|
import { parseTime } from '@/utils'
|
|
|
+import tool from '@/utils/tool'
|
|
|
+import permission from '@/utils/permission'
|
|
|
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
|
|
|
|
|
|
const calendarTypeOptions = [
|
|
|
@@ -125,7 +161,11 @@ export default {
|
|
|
tableKey: 0,
|
|
|
list: null,
|
|
|
total: 0,
|
|
|
+ loading: true,
|
|
|
listLoading: true,
|
|
|
+ tool: tool,
|
|
|
+ permission: permission,
|
|
|
+ multipleSelection: null,
|
|
|
listQuery: {
|
|
|
page: 1,
|
|
|
pageSize: 20,
|
|
|
@@ -135,7 +175,7 @@ export default {
|
|
|
id: null,
|
|
|
sort: null
|
|
|
},
|
|
|
- sort: '',
|
|
|
+ sort: null,
|
|
|
importanceOptions: [1, 2, 3],
|
|
|
calendarTypeOptions,
|
|
|
sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
|
|
|
@@ -174,6 +214,9 @@ export default {
|
|
|
this.getList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.multipleSelection = val
|
|
|
+ },
|
|
|
getList() {
|
|
|
this.listLoading = true
|
|
|
this.listQuery.adId = this.$route.params
|
|
|
@@ -236,6 +279,108 @@ export default {
|
|
|
},
|
|
|
getHref(link) {
|
|
|
return link.indexOf('http') > -1 ? link : 'http://' + link
|
|
|
+ },
|
|
|
+ handleEdit(row) {
|
|
|
+ this.$router.push({ path: `/ad/edit/${row.ID}` })
|
|
|
+ },
|
|
|
+ handleAdd() {
|
|
|
+ this.$router.push({ path: `/ad/add` })
|
|
|
+ },
|
|
|
+ handleMuliDel() {
|
|
|
+ this.handleDelete()
|
|
|
+ },
|
|
|
+ handleMultiHide() {
|
|
|
+ this.handleHide()
|
|
|
+ },
|
|
|
+ handleHideOne(row) {
|
|
|
+ this.handleHide(row.ID)
|
|
|
+ },
|
|
|
+ handleMultiUnHide() {
|
|
|
+ this.handleUnhide()
|
|
|
+ },
|
|
|
+ handleDeleteOne(row) {
|
|
|
+ this.handleDelete(row.ID)
|
|
|
+ },
|
|
|
+ handleDelete(id = null) {
|
|
|
+ const obj = this
|
|
|
+ obj.$confirm('Are you sure to delete the selected data?', 'Notice', { // 确定删除选定的数据?
|
|
|
+ confirmButtonText: 'confirm', // 确定
|
|
|
+ cancelButtonText: 'cancel', // 取消
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const selectedIds = []
|
|
|
+ if (id === null) {
|
|
|
+ for (const val of obj.multipleSelection) {
|
|
|
+ selectedIds.push(val.ID)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ selectedIds.push(id)
|
|
|
+ }
|
|
|
+ fetchDelete({ selected: selectedIds }).then(response => {
|
|
|
+ this.$message({
|
|
|
+ message: response.data,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ obj.getList(obj.currentPage, obj.pageSize)
|
|
|
+ }).catch(response => {
|
|
|
+
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleHide(id = null) {
|
|
|
+ const obj = this
|
|
|
+ obj.$confirm('Are you sure to hide the selected data?', 'Notice', { // 确定删除选定的数据?
|
|
|
+ confirmButtonText: 'confirm', // 确定
|
|
|
+ cancelButtonText: 'cancel', // 取消
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const selectedIds = []
|
|
|
+ if (id === null) {
|
|
|
+ for (const val of obj.multipleSelection) {
|
|
|
+ selectedIds.push(val.ID)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ selectedIds.push(id)
|
|
|
+ }
|
|
|
+ fetchHide({ selected: selectedIds }).then(response => {
|
|
|
+ this.$message({
|
|
|
+ message: response.data,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ obj.getList(obj.currentPage, obj.pageSize)
|
|
|
+ }).catch(response => {
|
|
|
+
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleUnHideOne(row) {
|
|
|
+ this.handleUnhide(row.ID)
|
|
|
+ },
|
|
|
+ handleUnhide(id = null) {
|
|
|
+ const obj = this
|
|
|
+ obj.$confirm('Are you sure to hide the selected data?', 'Notice', { // 确定删除选定的数据?
|
|
|
+ confirmButtonText: 'confirm', // 确定
|
|
|
+ cancelButtonText: 'cancel', // 取消
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const selectedIds = []
|
|
|
+ if (id === null) {
|
|
|
+ for (const val of obj.multipleSelection) {
|
|
|
+ selectedIds.push(val.ID)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ selectedIds.push(id)
|
|
|
+ }
|
|
|
+ fetchUnhide({ selected: selectedIds }).then(response => {
|
|
|
+ this.$message({
|
|
|
+ message: response.data,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ obj.getList(obj.currentPage, obj.pageSize)
|
|
|
+ }).catch(response => {
|
|
|
+
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|