import React from 'react'; 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, formatTreeData, flattenObject } from '@src/services/Tools'; import { asyncSMessage, asyncForm } from '@src/services/AsyncTools'; import { ServiceKey, ServiceParamMap, SwitchSelect } from '../../../../Constant'; import { Course } from '../../../stores/course'; import { Exercise } from '../../../stores/exercise'; const SwitchSelectMap = getMap(SwitchSelect, 'value', 'label'); export default class extends Page { constructor(props) { super(props); this.exerciseMap = {}; this.actionList = [{ key: 'add', type: 'primary', name: '创建', }]; this.itemList = [{ key: 'id', type: 'hidden', }, { key: 'title', type: 'input', name: '套餐名称', }, { key: 'structId', type: 'select', select: [], name: '套餐学科', }, { key: 'description', type: 'input', name: '套餐描述', }, { key: 'price', type: 'number', name: '套餐价格', min: 0, }, { key: 'courseIds', type: 'multiple', name: '包含课程', }]; ServiceKey.forEach((row) => { const list = ServiceParamMap[row.value]; const item = { key: `gift.${row.value}`, type: 'number', name: `送${row.label}`, }; if (list) { item.select = list; item.type = 'select'; item.allowClear = true; } this.itemList.push(item); }); this.columns = [{ title: '套餐名称', dataIndex: 'title', }, { title: '套餐学科', dataIndex: 'structId', render: (text) => { return this.exerciseMap[text]; }, }, { title: '套餐价格', dataIndex: 'price', }, { title: '销售数量', dataIndex: 'saleNumber', }, { title: '首页推荐', dataIndex: 'isSpecial', render: (text) => { return SwitchSelectMap[text] || text; }, }, { title: '上架', dataIndex: 'isShow', render: (text) => { return SwitchSelectMap[text] || text; }, }, { title: '操作', dataIndex: 'handler', render: (text, record) => { return