123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396 |
- import { BasicColumn } from '/@/components/Table';
- import { FormSchema } from '/@/components/Table';
- import { rules } from '/@/utils/helper/validator';
- import { render } from '/@/utils/common/renderUtils';
- import { getWeekMonthQuarterYear } from '/@/utils';
- import { getInsureList, getSprotProject } from '/@/api/common/api';
- import { defHttp } from '/@/utils/http/axios';
- import { getCoachList } from './courses.api';
- import { useUserStore } from '/@/store/modules/user';
- import ZtCustomTable from '/@/components/ZtCustomTable/index.vue';
- import { h } from 'vue';
- import { Business } from '../gymnasiumBag/gymnasiumBag.api';
- import { storeToRefs } from 'pinia';
- const { userInfo } = storeToRefs(useUserStore());
- //列表数据
- export const columns: BasicColumn[] = [
- {
- title: '课程名称',
- align: 'center',
- dataIndex: 'name',
- },
- {
- title: '课程封面',
- align: 'center',
- dataIndex: 'cover',
- slots: {
- customRender: 'img',
- },
- },
- {
- title: '课时节数及时间',
- align: 'center',
- dataIndex: 'totalNum',
- slots: { customRender: 'totalNum' },
- },
- {
- title: '上课地点',
- align: 'center',
- dataIndex: 'address',
- },
- {
- title: '销售价/原价(元)',
- align: 'center',
- dataIndex: 'categoryId',
- slots: { customRender: 'price' },
- },
- {
- title: '上下架状态',
- align: 'center',
- dataIndex: 'rackingStatus',
- slots: { customRender: 'priceType' },
- },
- {
- title: '课程类型',
- align: 'center',
- dataIndex: 'categoryIds',
- },
- ];
- //查询数据
- export const searchFormSchema: FormSchema[] = [
- {
- field: 'name',
- label: '课程名称',
- component: 'Input',
- colProps: { span: 6 },
- },
- {
- field: '上下架状态',
- label: '上下架状态',
- component: 'Select',
- colProps: { span: 6 },
- componentProps: {
- options: [
- { label: '上架', value: 0 },
- { label: '下架', value: 1 },
- ],
- },
- },
- {
- field: 'coursesStatus',
- label: '课程进展',
- component: 'Select',
- colProps: { span: 6 },
- componentProps: {
- options: [
- { label: '全部', value: '' },
- // 全部、未开始、正常上课中、休息中、补课中、已结束
- { label: '未开始', value: 0 },
- { label: '正常上课中', value: 1 },
- { label: '休息中', value: 2 },
- { label: '补课中', value: 3 },
- { label: '已结束', value: 4 },
- ],
- },
- },
- {
- field: 'categoryId',
- label: '课程类型',
- component: 'ApiSelect',
- colProps: { span: 6 },
- componentProps: {
- api: () => defHttp.get({ url: '/app/appCategory/list' }),
- labelField: 'name',
- valueField: 'id',
- resultField: 'records',
- },
- },
- ];
- //表单数据
- export const formSchema: FormSchema[] = [
- {
- label: 'title1',
- field: 'orgCode',
- colSlot: 'title1',
- component: 'Input',
- },
- {
- label: '课程类型',
- field: 'categoryId',
- component: 'ApiSelect',
- required: true,
- componentProps: {
- api: getSprotProject,
- labelField: 'name',
- valueField: 'id',
- mode: 'tags',
- resultField: 'records',
- },
- },
- {
- label: '课程名称',
- required: true,
- field: 'name',
- component: 'Input',
- },
- {
- label: '课程封面',
- field: 'cover',
- component: 'JImageUpload',
- componentProps: {
- tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
- },
- required: true,
- },
- {
- label: '上课地点',
- field: 'addressSiteId',
- component: 'ApiSelect',
- required: true,
- componentProps: {
- api: Business,
- labelField: 'name',
- valueField: 'tenantId',
- params: {
- orgCode: 'A01',
- type: 0,
- },
- },
- },
- {
- label: '教练',
- field: 'userId',
- component: 'ApiSelect',
- required: true,
- componentProps: {
- api: getCoachList,
- labelField: 'name',
- valueField: 'userId',
- params: { orgCode: useUserStore().userInfo?.orgCode },
- },
- },
- {
- label: 'title2',
- field: 'title2',
- component: 'Input',
- colSlot: 'title2',
- },
- {
- label: '原价',
- field: 'originalPrice',
- component: 'InputNumber',
- },
- {
- label: '销售价',
- field: 'sellingPrice',
- component: 'InputNumber',
- required: true,
- },
- {
- label: '限购',
- field: 'limitNum',
- required: true,
- component: 'InputNumber',
- componentProps: {
- addonBefore: '每人限制购买',
- addonAfter: '张',
- },
- },
- {
- label: '正常课表',
- field: 'priceRulesList',
- component: 'InputNumber',
- slot: 'ZtCustomTable1',
- required: true,
- },
- {
- label: 'title3',
- field: 'sellingPrice',
- component: 'InputNumber',
- colSlot: 'title3',
- },
- {
- label: '视频',
- field: 'video',
- component: 'JUpload',
- slot: 'VideoUpload',
- componentProps: {
- fileType: 'video',
- bizPath: 'video',
- },
- },
- {
- label: '图片',
- field: 'backgroundImage',
- component: 'JImageUpload',
- componentProps: {
- tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
- },
- required: true,
- },
- {
- label: '使用须知',
- field: 'reminder',
- component: 'InputTextArea',
- required: true,
- },
- {
- label: '配套保险',
- field: 'insureIds',
- component: 'ApiSelect',
- required: true,
- componentProps: {
- api: getInsureList,
- resultField: 'data',
- labelField: 'name',
- valueField: 'id',
- mode: 'multiple',
- },
- },
- {
- label: '图文详情',
- field: 'details',
- component: 'JEditor',
- required: true,
- },
- {
- label: '上架状态',
- field: 'rackingStatus',
- component: 'Switch',
- required: true,
- componentProps: {
- //非选中时的内容
- unCheckedChildren: '下架',
- //非选中时的值
- unCheckedValue: 1,
- //选中时的内容
- checkedChildren: '上架',
- //选中时的值
- checkedValue: 0,
- },
- defaultValue: 0,
- },
- // TODO 主键隐藏字段,目前写死为ID
- {
- label: '',
- field: 'id',
- component: 'Input',
- show: false,
- },
- ];
- /**
- * 流程表单调用这个方法获取formSchema
- * @param param
- */
- export function getBpmFormSchema(_formData): FormSchema[] {
- // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
- return formSchema;
- }
- export const publishcoursesColums: BasicColumn[] = [
- {
- title: '时间段',
- dataIndex: 'time',
- editComponent: 'RangePicker',
- editRule: true,
- editComponentProps: {
- showTime: true,
- size: 'middle',
- placeholder: ['开始时间', '结束时间'],
- valueFormat: 'YYYY-MM-DD HH:mm:ss',
- },
- width: 450,
- editRow: true,
- editable: true,
- },
- {
- title: '课时名称',
- dataIndex: 'name',
- editComponent: 'Input',
- editRule: true,
- editRow: true,
- editable: true,
- width: 500,
- editComponentProps: {
- size: 'middle',
- },
- },
- {
- key: 'op',
- dataIndex: 'operation',
- title: 'operation',
- fixed: 'right',
- ellipsis: true,
- width: 80,
- },
- ];
- export const coursesForm: FormSchema[] = [
- {
- label: '课程名称',
- field: 'name',
- component: 'Input',
- componentProps: {
- disabled: true,
- },
- required: true,
- },
- {
- label: '补课课表',
- field: 'dtoList',
- component: 'Input',
- required: true,
- render({ model, field }) {
- return h(ZtCustomTable, {
- tableColumn: [
- {
- dataIndex: 'time',
- title: '时间',
- editComponent: 'RangePicker',
- editRule: true,
- editComponentProps: {
- placeholder: ['开始时间', '结束时间'],
- size: 'middle',
- valueFormat: 'YYYY-MM-DD HH:mm:ss',
- showTime: true,
- },
- width: 350,
- editRow: true,
- editable: true,
- },
- {
- dataIndex: 'name',
- title: '名称',
- editComponent: 'Input',
- editRule: true,
- editComponentProps: {
- size: 'middle',
- },
- width: 350,
- editRow: true,
- editable: true,
- },
- {
- dataIndex: 'operation',
- title: 'operation',
- fixed: 'right',
- },
- ],
- value: model[field],
- showIndex: true,
- showAction: true,
- });
- },
- defaultValue: [],
- },
- {
- label: '课程名称',
- field: 'id',
- component: 'Input',
- show: false,
- },
- ];
|