<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"
    >
    </table-list>
  </div>
</template>
<script>
import { arrToObj } from '@/utils'
import SearchForm from './components/searchForm/Index'
import baseTable from '_m/baseTable.js'
export default {
  name: 'index',
  components: {
    SearchForm,
  },
  provide() {
    return {
      parentData: this
    }
  },
  mixins: [baseTable],
  data() {
    return {
      apiStr: 'user.admfeedbacklist',
      searchForm: null,
      isDtlShow: false,
      curObj: {}
    }
  },
  computed: {
    tableData2() {
      const arr = [...this.tableData]
      arr.map(item => {
        const curImg = (item.images || '').split(',')
        item.img1 = curImg[0] || ''
        item.img2 = curImg[1] || ''
        item.img3 = curImg[2] || ''
      })
      return arr
    }
  },
  created() {},
  mounted() {
    this.listConfig = {
      rows: [
        { label: '反馈图1', prop: 'img1', type: 'img' },
        { label: '反馈图2', prop: 'img2', type: 'img' },
        { label: '反馈图3', prop: 'img3', type: 'img' },
        { label: '反馈内容', prop: 'feedback_count' },
        { label: '类型', prop: 'feedback_type', type: 'tag', tags: arrToObj(this.$dictData.feedback_type) }, 
        { label: '联系方式', prop: 'contact' },
        { label: '操作', width: 60, type: 'handle2', operations:
          [
            { label: '删除', func: this.delHandle, btnType: 'danger' },
          ]
        }
      ]
    }
  },
  methods: {
    delHandle(row) {
      this.$msg(`您确定要删除该文章吗？`, 'confirm', () => {
        this.$api.user.admfeedbackdel({
          id: row.id,
        }).then(data => {
          this.$msgs(`已删除！`)
          this.fetchData()
        })
      }, null, true)
    },
  }
}
</script>
<style lang="scss" scoped>
</style>

