import React from 'react'; import { Link } from 'react-router-dom'; import './index.less'; import Page from '@src/containers/Page'; import Block from '@src/components/Block'; import FilterLayout from '@src/layouts/FilterLayout'; import ActionLayout from '@src/layouts/ActionLayout'; import TableLayout from '@src/layouts/TableLayout'; import { getMap, bindSearch, formatDate, formatSeconds } from '@src/services/Tools'; import { asyncSMessage, asyncDelConfirm } from '@src/services/AsyncTools'; import { QuestionType, AnswerStatus, MoneyRange, SwitchSelect, AskTarget, AskModule } from '../../../../Constant'; import { User } from '../../../stores/user'; import { Question } from '../../../stores/question'; const QuestionTypeMap = getMap(QuestionType, 'value', 'label'); const AnswerStatusMap = getMap(AnswerStatus, 'value', 'label'); const SwitchSelectMap = getMap(SwitchSelect, 'value', 'label'); const AskModuleMap = getMap(AskModule, 'value', 'label'); export default class extends Page { init() { this.actionList = [{ key: 'ignore', type: 'danger', name: '批量忽略', needSelect: 1, }]; this.filterForm = [{ key: 'askModule', type: 'select', allowClear: true, name: '板块', select: AskModule, placeholder: '请选择', }, { key: 'questionType', type: 'select', allowClear: true, name: '题型', select: QuestionType, placeholder: '请选择', }, { key: 'answerStatus', type: 'select', allowClear: true, name: '状态', select: AnswerStatus, number: true, }, { key: 'moneyRang', type: 'select', allowClear: true, name: '消费金额', select: MoneyRange, number: true, }, { key: 'showStatus', type: 'select', allowClear: true, name: '展示状态', select: SwitchSelect, number: true, }, { key: 'target', type: 'select', allowClear: true, name: '提问内容', select: AskTarget, }, { key: 'questionNoId', type: 'select', allowClear: true, name: '题目ID', select: [], number: true, placeholder: '请输入', }, { key: 'userId', type: 'select', name: '用户', allowClear: true, select: [], number: true, placeholder: '请输入', }, { key: 'time', type: 'daterange', name: '提问时间', }]; this.columns = [{ title: '板块', dataIndex: 'askModule', render: (text) => { return AskModuleMap[text]; }, }, { title: '题型', dataIndex: 'type', render: (text, record) => { return QuestionTypeMap[record.question.questionType]; }, }, { title: '题目id', dataIndex: 'questionNo.no', }, { title: '提问者', dataIndex: 'user.nickname', }, { title: '消费金额', dataIndex: 'user.totalMoney', }, { title: '提问时间', dataIndex: 'createTime', render: (text) => { return formatDate(text, 'YYYY-MM-DD HH:mm:ss'); }, }, { title: '倒计时', sorter: true, dataIndex: 'expireTime', render: (text, record) => { const end = new Date(record.answerTime) || new Date(); const cost = (end.getTime() - new Date(record.createTime).getTime()) / 1000; if (text) { if (record.askTime - cost > 0) return `${formatSeconds(text - cost)}/${formatSeconds(text)}`; return `0/${formatSeconds(text)}`; } return '-'; }, }, { title: '回答者', dataIndex: 'manager.username', }, { title: '回答时间', sorter: true, dataIndex: 'answerTime', render: (text) => { return text ? formatDate(text, 'YYYY-MM-DD HH:mm:ss') : ''; }, }, { title: '回答状态', dataIndex: 'answerStatus', render: (text) => { return AnswerStatusMap[text] || text; }, }, { title: '展示状态', dataIndex: 'showStatus', render: (text) => { return SwitchSelectMap[text] || text; }, }, { title: '操作', dataIndex: 'handler', render: (text, record) => { return