123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <template>
- <div class="app-container">
- <search-form
- :list-loading="listLoading"
- @change="searchHandle"
- />
- <table-list
- :list-loading="listLoading"
- :data="tableData2"
- :columns="listConfig"
- :current-page="currentPage"
- :page-size="pageSize"
- :total-records="totalRecords"
- @currentChange="pageHandle"
- :isAdd="true"
- @add="openPopup"
- :insertSlotArr="[4]"
- >
- <div slot="OI4">
- <el-table-column
- width="50"
- label="链接"
- align="center"
- >
- <template slot-scope="scope">
- <a :href="scope.row.link" target="_blank" class="scoped-link">链接</a>
- </template>
- </el-table-column>
- </div>
- </table-list>
- <popup-edit
- :isShow="isDtlShow"
- :curObj="curObj"
- @close="closePopup"
- />
- </div>
- </template>
- <script>
- import { arrToObj } from '@/utils'
- import SearchForm from './components/searchForm/Index'
- import PopupEdit from './components/popup/IndexEdit'
- import baseTable from '_m/baseTable.js'
- export default {
- name: 'index',
- components: {
- SearchForm,
- PopupEdit,
- },
- provide() {
- return {
- parentData: this
- }
- },
- mixins: [baseTable],
- data() {
- return {
- apiStr: 'house.adminformationlist',
- searchForm: null,
- isDtlShow: false,
- curObj: {}
- }
- },
- computed: {
- tableData2() {
- const defaultImg = require('@/assets/ex_test.jpg')
- const arr = [...this.tableData]
- arr.map(item => {
- item.pri_image = item.pri_image || defaultImg
- item.hide_status = Number(item.hide_status)
- })
- return arr
- }
- },
- created() {},
- mounted() {
- this.listConfig = {
- rows: [
- { label: '标题', prop: 'title', fullShow: true, minWidth: 200 },
- { label: '分类', prop: 'information_category', type: 'flag', flags: arrToObj(this.$dictData.information_category) },
- { label: '主图', prop: 'pri_image', type: 'img' },
- // { label: '链接', prop: 'link' },
- { label: '作者', prop: 'author' },
- { label: '状态', prop: 'hide_status', type: 'tag', tags: arrToObj(this.$dictData.hide_status) },
- { label: '更新人', prop: 'update_by' },
- { label: '更新时间', prop: 'update_at' },
- { label: '操作', width: 120, type: 'handle2', operations:
- [
- { label: '编辑', func: this.openPopup, btnType: 'primary' },
- { label: '删除', func: this.delHandle, btnType: 'danger' },
- ]
- }
- ]
- }
- },
- methods: {
- delHandle(row) {
- this.$msg(`您确定要删除该文章吗?`, 'confirm', () => {
- this.$api.house.adminformationdel({
- id: row.id,
- }).then(data => {
- this.$msgs(`已删除!`)
- this.fetchData()
- })
- }, null, true)
- },
- openPopup(row) {
- if (row && row.id) {
- this.curObj = row
- } else {
- this.curObj = {}
- }
- this.isDtlShow = true
- },
- closePopup(obj) {
- this.isDtlShow = false
- if (obj) {
- this.fetchData()
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .scoped-link {
- color: #2d8cf0;
- text-decoration: underline;
- }
- </style>
|