123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <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"
- :operationsDefaultLength="6"
- />
- </div>
- </template>
- <script>
- import { arrToObj } from '@/utils'
- import baseTable from '_m/baseTable.js'
- import SearchForm from './components/searchForm/Index2'
- export default {
- name: 'index',
- components: {
- SearchForm,
- },
- provide() {
- return {
- parentData: this
- }
- },
- mixins: [baseTable],
- data() {
- return {
- apiStr: 'user.admanswernew',
- searchForm: null,
- isDtlShow: false,
- curObj: {},
- isQShow: false,
- isAShow: false,
- }
- },
- computed: {
- tableData2() {
- const arr = [...this.tableData]
- arr.map(item => {
- if (Number(item.hide_status) !== 2) item.isHide = true
- })
- return arr
- }
- },
- created() {},
- mounted() {
- this.listConfig = {
- rows: [
- { label: '状态', prop: 'hide_status', type: 'tag', tags: arrToObj(this.$dictData.hide_status), tagTypeObj: {'1': 'success', '2': 'danger'} },
- { label: '回答内容', prop: 'answer_cont', minWidth: 100, align: 'left' },
- { label: '回答时间', prop: 'create_at' },
- { label: '昵称', prop: 'nickname' },
- { label: '头像', prop: 'avatar', type: 'img' },
- { label: '问题', prop: 'question_cont', fullShow: true },
- { label: '操作', width: 120, type: 'handle2', operations:
- [
- { label: '显示', func: this.showHandle, btnType: 'success', hide: 'isHide' },
- { label: '删除', func: this.delHandle, btnType: 'danger' },
- ]
- }
- ]
- }
- },
- methods: {
- showHandle (row) {
- this.$api.user.admanswershow({
- answer_id: row.answer_id
- }).then(data => {
- this.$msgs(`已显示!`)
- this.fetchData()
- })
- },
- delHandle(row) {
- this.$msg(`您确定要删除该问题吗?`, 'confirm', () => {
- this.$api.user.admanswerdel({
- answer_id: row.answer_id
- }).then(data => {
- this.$msgs(`已删除!`)
- this.fetchData()
- })
- }, null, true)
- },
- }
- }
- </script>
|