[update 友情链接] 完善
This commit is contained in:
@@ -56,6 +56,9 @@ const getNewestEnterEnStandard = (params) => getAction('/laws/localTool/standard
|
|||||||
// 将实施标准
|
// 将实施标准
|
||||||
const getWillImplementStandards = (params) => getAction('/laws/localTool/standardEarlyWarning/latestImplement', params)
|
const getWillImplementStandards = (params) => getAction('/laws/localTool/standardEarlyWarning/latestImplement', params)
|
||||||
|
|
||||||
|
// 友情链接列表
|
||||||
|
const getFriendlyLinkList = (params) => getAction('/sys/lawsFriendlyLinks/list', params)
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getSearchHistoryData,
|
getSearchHistoryData,
|
||||||
deleteSearchHistoryById,
|
deleteSearchHistoryById,
|
||||||
@@ -81,5 +84,6 @@ export {
|
|||||||
getHomeNewStandard,
|
getHomeNewStandard,
|
||||||
getNewestEnterStandard,
|
getNewestEnterStandard,
|
||||||
getNewestEnterEnStandard,
|
getNewestEnterEnStandard,
|
||||||
getWillImplementStandards
|
getWillImplementStandards,
|
||||||
|
getFriendlyLinkList
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getAction, getFileAccessHttpUrl } from '@/api/manage'
|
import { getFileAccessHttpUrl } from '@/api/manage'
|
||||||
|
import { getFriendlyLinkList } from '@api/dashboard'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'FriendLinkCard',
|
name: 'FriendLinkCard',
|
||||||
@@ -27,10 +28,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
defaultLogo: require('@/assets/image/dashboard/friendship-link.png'),
|
defaultLogo: require('@/assets/image/dashboard/friendship-link.png'),
|
||||||
loading: false,
|
loading: false,
|
||||||
dataSource: [],
|
dataSource: []
|
||||||
url: {
|
|
||||||
list: '/sys/lawsFriendlyLinks/list'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
@@ -45,7 +43,7 @@ export default {
|
|||||||
},
|
},
|
||||||
loadData () {
|
loadData () {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
getAction(this.url.list, {}).then((res) => {
|
getFriendlyLinkList({ count: 6 }).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.dataSource = res.result || []
|
this.dataSource = res.result || []
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -14,15 +14,6 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col :md="6" :sm="8">
|
|
||||||
<a-form-item :label="$t('system.friendshipLink.shelfStatus')">
|
|
||||||
<j-dict-select-tag
|
|
||||||
:placeholder="$t('pleaseSelect') + $t('system.friendshipLink.shelfStatus')"
|
|
||||||
v-model="queryParam.grounding"
|
|
||||||
dict-code="yn"></j-dict-select-tag>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
|
|
||||||
<div style="float: right;overflow: hidden;" class="table-page-search-submitButtons">
|
<div style="float: right;overflow: hidden;" class="table-page-search-submitButtons">
|
||||||
<a-button type="primary" @click="searchQuery" icon="search" v-has="'sys:friendshipLink:search'">
|
<a-button type="primary" @click="searchQuery" icon="search" v-has="'sys:friendshipLink:search'">
|
||||||
{{ $t('query') }}
|
{{ $t('query') }}
|
||||||
@@ -50,18 +41,11 @@
|
|||||||
rowKey="id"
|
rowKey="id"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:dataSource="dataSource"
|
:dataSource="dataSource"
|
||||||
:pagination="false"
|
:pagination="ipagination"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||||
@change="handleTableChange">
|
@change="handleTableChange">
|
||||||
|
|
||||||
<template v-slot:link="{text, record}">
|
|
||||||
<a-tooltip overlay-class-name="tooltip-style">
|
|
||||||
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
|
|
||||||
<a class="link-a" @click="handleLinkClick(record)">{{ text }}</a>
|
|
||||||
</a-tooltip>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-slot:logoUrl="{text}">
|
<template v-slot:logoUrl="{text}">
|
||||||
<div class="table-image" v-viewer="{movable: false}">
|
<div class="table-image" v-viewer="{movable: false}">
|
||||||
<img :src="getImgView(text)">
|
<img :src="getImgView(text)">
|
||||||
@@ -70,6 +54,8 @@
|
|||||||
|
|
||||||
<template v-slot:action="{text, record}">
|
<template v-slot:action="{text, record}">
|
||||||
<a @click="handleEdit(record)" v-has="'sys:friendshipLink:edit'">{{ $t('edit') }}</a>
|
<a @click="handleEdit(record)" v-has="'sys:friendshipLink:edit'">{{ $t('edit') }}</a>
|
||||||
|
<a-divider type="vertical" v-if="isHasPermission('sys:friendshipLink:edit') && isHasPermission('sys:friendshipLink:delete')" />
|
||||||
|
<a class="operate-del-btn" @click="handleDelete(record.id)" v-has="'sys:friendshipLink:delete'">{{ $t('delete') }}</a>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</j-table>
|
</j-table>
|
||||||
@@ -82,17 +68,15 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import JTable from '@/components/jero/JTable'
|
import JTable from '@/components/jero/JTable'
|
||||||
import JDictSelectTag from '@/components/dict/JDictSelectTag'
|
|
||||||
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
||||||
import { postAction, getAction } from '@/api/manage'
|
|
||||||
import FriendshipLinkModal from './modules/FriendshipLinkModal'
|
import FriendshipLinkModal from './modules/FriendshipLinkModal'
|
||||||
|
import { isHasPermission } from '@/utils/hasPermission'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'FriendshipLinkList',
|
name: 'FriendshipLinkList',
|
||||||
components: {
|
components: {
|
||||||
FriendshipLinkModal,
|
FriendshipLinkModal,
|
||||||
JTable,
|
JTable
|
||||||
JDictSelectTag
|
|
||||||
},
|
},
|
||||||
mixins: [JeroListMixin],
|
mixins: [JeroListMixin],
|
||||||
data () {
|
data () {
|
||||||
@@ -144,58 +128,14 @@ export default {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
url: {
|
url: {
|
||||||
list: '/sys/lawsFriendlyLinks/list',
|
list: '/sys/lawsFriendlyLinks/page',
|
||||||
edit: '/sys/lawsFriendlyLinks/edit'
|
edit: '/sys/lawsFriendlyLinks/edit',
|
||||||
|
delete: '/sys/lawsFriendlyLinks/delete'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadData () {
|
isHasPermission
|
||||||
const params = Object.assign({}, this.queryParam)
|
|
||||||
this.loading = true
|
|
||||||
getAction(this.url.list, params).then((res) => {
|
|
||||||
if (res.success) {
|
|
||||||
this.dataSource = res.result ? res.result.map(item => {
|
|
||||||
return {
|
|
||||||
...item,
|
|
||||||
grounding: item.grounding !== '0'
|
|
||||||
}
|
|
||||||
}) : []
|
|
||||||
} else {
|
|
||||||
this.$message.warning(res.message)
|
|
||||||
}
|
|
||||||
}).finally(() => {
|
|
||||||
this.loading = false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleLinkClick (record) {
|
|
||||||
const href = record.link
|
|
||||||
window.open(href)
|
|
||||||
},
|
|
||||||
// 是否上架状态改变
|
|
||||||
switchChange (record) {
|
|
||||||
console.log(record)
|
|
||||||
if (!record.link) {
|
|
||||||
this.$message.warning(this.$t('system.friendshipLink.shelfWarn'))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 1开启 0未开启
|
|
||||||
if (this.dataSource.reduce((pre, cur) => pre += (cur.grounding ? 1 : 0), 0) > 6) {
|
|
||||||
this.$message.warning('最多上架六个友情链接')
|
|
||||||
record.grounding = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
console.log(record)
|
|
||||||
const param = Object.assign({}, record)
|
|
||||||
param.grounding = record.grounding === true ? '1' : '0'
|
|
||||||
postAction(this.url.edit, param).then(res => {
|
|
||||||
if (res.success) {
|
|
||||||
this.loadData()
|
|
||||||
} else {
|
|
||||||
this.$message.warning(res.message)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user