DESKTOP-USV654P\pc 4 місяців тому
батько
коміт
a926740096

+ 219 - 0
src/views/activity/contest/data.config.ts

@@ -0,0 +1,219 @@
+import { BasicColumn, FormSchema } from '/@/components/Table';
+import { getDataOption } from '/@/api/system/dic';
+
+import { requestMagicApi } from '/@/api/magicApi';
+import { BasicOptionModel } from '/@/api/model/baseModel';
+import { Tinymce } from '/@/components/Tinymce';
+import { h } from 'vue';
+
+export const contestStatusOptions: BasicOptionModel[] = [
+  { label: '未发布', value: 1 },
+  { label: '报名中', value: 2 },
+  { label: '报名结束', value: 3 },
+  { label: '活动结束', value: 4 },
+];
+
+export const tableColumns: BasicColumn[] = [
+  {
+    title: '活动名称',
+    dataIndex: 'name',
+    align: 'left',
+    width: 150,
+  },
+  {
+    title: '开始时间',
+    dataIndex: 'stateDate',
+    align: 'left',
+    width: 150,
+  },
+  {
+    title: '结束时间',
+    dataIndex: 'endDate',
+    align: 'left',
+    width: 150,
+  },
+  {
+    title: '活动地点',
+    dataIndex: 'address',
+    align: 'left',
+  },
+  {
+    title: '活动类型',
+    dataIndex: 'type',
+    align: 'left',
+    width: 120,
+  },
+  {
+    title: '组织部门',
+    dataIndex: 'deptCn',
+    align: 'left',
+    width: 120,
+  },
+  {
+    title: '状态',
+    dataIndex: 'status',
+    align: 'left',
+    width: 80,
+    customRender: ({ text }) => {
+      return contestStatusOptions.filter((row) => row.value === text)[0]?.label;
+    },
+  },
+  {
+    title: '报名人数',
+    dataIndex: 'count',
+    align: 'left',
+    width: 80,
+  },
+];
+
+export const searchFormSchema: FormSchema[] = [
+  {
+    field: 'name',
+    label: '活动名称',
+    component: 'Input',
+    colProps: { span: 8 },
+  },
+  {
+    field: 'enrollType',
+    label: '活动类型',
+    component: 'ApiSelect',
+    colProps: { span: 8 },
+    componentProps: {
+      getPopupContainer: () => document.body,
+      api: getDataOption,
+      params: { code: 'enroll_type' },
+    },
+  },
+  {
+    field: 'deptId',
+    label: '组织部门',
+    component: 'ApiSelect',
+    colProps: { span: 8 },
+    componentProps: {
+      getPopupContainer: () => document.body,
+      api: requestMagicApi,
+      params: { url: 'educational/abutment/org-info' },
+      labelField: 'name',
+      valueField: 'id',
+    },
+  },
+  {
+    field: 'status',
+    label: '状态',
+    component: 'Select',
+    colProps: { span: 8 },
+    componentProps: {
+      options: contestStatusOptions,
+      getPopupContainer: () => document.body,
+    },
+  },
+];
+
+export const formSchema: FormSchema[] = [
+  {
+    field: 'name',
+    label: '活动名称',
+    component: 'Input',
+    required: true,
+    colProps: { span: 24 },
+  },
+  {
+    field: 'date',
+    label: '活动时间',
+    component: 'RangePicker',
+    required: true,
+    colProps: { span: 24 },
+    componentProps: {
+      getPopupContainer: () => document.body,
+      placeholder: ['开始时间', '结束时间'],
+      format: 'YYYY-MM-DD HH:mm:ss',
+      showTime: { format: 'HH:mm:ss' },
+    },
+  },
+  {
+    field: 'address',
+    label: '活动地点',
+    component: 'Input',
+    required: true,
+    colProps: { span: 12 },
+  },
+  {
+    field: 'enrollType',
+    label: '活动类型',
+    component: 'ApiSelect',
+    colProps: { span: 12 },
+    required: true,
+    componentProps: {
+      getPopupContainer: () => document.body,
+      api: getDataOption,
+      params: { code: 'enroll_type' },
+    },
+  },
+  {
+    field: 'endDate',
+    label: '截止时间',
+    component: 'DatePicker',
+    required: true,
+    colProps: { span: 12 },
+    componentProps: {
+      format: 'YYYY-MM-DD',
+      getPopupContainer: () => document.body,
+    },
+  },
+  {
+    field: 'deptId',
+    label: '组织部门',
+    component: 'ApiSelect',
+    colProps: { span: 12 },
+    required: true,
+    componentProps: {
+      getPopupContainer: () => document.body,
+      api: requestMagicApi,
+      params: { url: 'educational/abutment/org-info' },
+      labelField: 'name',
+      valueField: 'id',
+    },
+  },
+  {
+    field: 'name',
+    label: '负责人',
+    component: 'Input',
+    required: true,
+    colProps: { span: 12 },
+  },
+  {
+    field: 'tel',
+    label: '联系电话',
+    component: 'Input',
+    required: true,
+    colProps: { span: 12 },
+  },
+  {
+    label: '活动封面',
+    field: 'img',
+    component: 'Input',
+    colProps: { span: 24 },
+  },
+  {
+    label: '报名范围',
+    field: 'pople',
+    component: 'Input',
+    required: true,
+    colProps: { span: 24 },
+  },
+  {
+    field: 'newsContent',
+    component: 'Input',
+    label: '活动详情',
+    rules: [{ required: true }],
+    colProps: { span: 24 },
+    render: ({ model, field }) => {
+      return h(Tinymce, {
+        value: model[field],
+        onChange: (value: string) => {
+          model[field] = value;
+        },
+      });
+    },
+  },
+];

+ 76 - 0
src/views/activity/contest/edit.vue

@@ -0,0 +1,76 @@
+<template>
+  <BasicDrawer
+    @ok="handleSubmit"
+    :destroyOnClose="true"
+    :maskClosable="false"
+    v-bind="$attrs"
+    @register="registerModal"
+    :title="getTitle"
+    :width="1002"
+    showFooter
+  >
+    <BasicForm @register="registerForm" />
+  </BasicDrawer>
+</template>
+<script setup lang="ts">
+  import { ref, computed, unref } from 'vue';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
+  import { BasicForm, useForm } from '/@/components/Form/index';
+  import { formSchema } from './data.config';
+  import {
+    getBandingTaskInfo,
+    postBandingBandingTask,
+    putBandingBandingTask,
+  } from '/@/services/apis/BandingTaskController';
+
+  const isUpdate = ref(true);
+  const modelRef = ref({});
+  const emit = defineEmits(['success', 'register']);
+  const { createMessage } = useMessage();
+  const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({
+    labelWidth: 100,
+    schemas: formSchema,
+    showActionButtonGroup: false,
+  });
+
+  const [registerModal, { closeDrawer, setDrawerProps }] = useDrawerInner(async (data) => {
+    resetFields();
+    setDrawerProps({ confirmLoading: false });
+    isUpdate.value = !!data?.isUpdate;
+    modelRef.value = { ...data.baseData };
+
+    if (unref(isUpdate)) {
+      const resData = await getBandingTaskInfo({ id: data.baseData.id });
+
+      modelRef.value = { ...resData };
+      setFieldsValue({
+        ...resData,
+      });
+    }
+  });
+
+  const getTitle = computed(() => (!unref(isUpdate) ? '新增招生计划' : '编辑招生计划'));
+  const handleSubmit = async () => {
+    try {
+      const values = await validate();
+      setDrawerProps({ confirmLoading: true });
+      const postParams = unref(modelRef);
+      Object.assign(postParams, values);
+
+      if (unref(isUpdate)) {
+        await putBandingBandingTask(postParams as API.UpdateBandingTaskDto);
+      } else {
+        await postBandingBandingTask(postParams as API.AddBandingTaskDto);
+      }
+
+      createMessage.success('操作成功');
+      closeDrawer();
+      emit('success');
+    } finally {
+      setDrawerProps({ confirmLoading: false });
+    }
+  };
+</script>
+
+<style scoped lang="less"></style>

+ 107 - 0
src/views/activity/contest/index.vue

@@ -0,0 +1,107 @@
+<template>
+  <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
+    <BasicTable @register="registerTable">
+      <template #toolbar>
+        <a-button type="primary" @click="handleEdit({}, false)">新增</a-button>
+      </template>
+      <template #action="{ record }">
+        <TableAction
+          :actions="[
+            {
+              label: '编辑',
+              onClick: handleEdit.bind(null, record, true),
+            },
+            {
+              label: '发布',
+            },
+            {
+              label: '报名表',
+            },
+            {
+              label: '删除',
+              color: 'error',
+              onClick: handleDelete.bind(null, record),
+            },
+          ]"
+        />
+      </template>
+    </BasicTable>
+    <FormEdit @register="registerModal" @success="handleSuccess" />
+  </PageWrapper>
+</template>
+
+<script setup lang="ts">
+  import { onMounted } from 'vue';
+  import { PageWrapper } from '/@/components/Page';
+  import { BasicTable, useTable, TableAction } from '/@/components/Table';
+  import { tableColumns, searchFormSchema } from './data.config';
+  import {
+    deleteBandingBandingTask,
+    getBandingTaskPage,
+  } from '/@/services/apis/BandingTaskController';
+  import { useDrawer } from '/@/components/Drawer';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import FormEdit from './edit.vue';
+
+  const [registerModal, { openDrawer }] = useDrawer();
+
+  const [registerTable, { reload }] = useTable({
+    api: getBandingTaskPage,
+    title: '赛事活动列表',
+    rowKey: 'id',
+    columns: tableColumns,
+    formConfig: {
+      labelWidth: 120,
+      schemas: searchFormSchema,
+    },
+    useSearchForm: true,
+    showTableSetting: true,
+    bordered: true,
+    immediate: true,
+    canResize: true,
+    actionColumn: {
+      width: 210,
+      title: '操作',
+      dataIndex: 'action',
+      slots: { customRender: 'action' },
+      fixed: 'right',
+    },
+  });
+  const { createConfirm, createMessage } = useMessage();
+
+  const handleDelete = (record: any) => {
+    createConfirm({
+      iconType: 'warning',
+      title: '温馨提醒',
+      content: '是否删除该记录?',
+      onOk: async () => {
+        try {
+          await deleteBandingBandingTask([record.id]);
+          createMessage.success('删除成功');
+          await reload();
+        } catch (e) {
+          createMessage.error('删除失败');
+        }
+      },
+      okText: '确认',
+      cancelText: '取消',
+    });
+  };
+
+  const handleEdit = (record: any, isUpdate: boolean) => {
+    openDrawer(true, {
+      isUpdate: isUpdate,
+      baseData: {
+        ...record,
+      },
+    });
+  };
+
+  const handleSuccess = async () => {
+    await reload();
+  };
+
+  onMounted(async () => {});
+</script>
+
+<style scoped lang="less"></style>

+ 1 - 1
src/views/prize/statistics/data.config.ts

@@ -120,7 +120,7 @@ export const tableDetailColumns: BasicColumn[] = [
 
 export const searchDetailFormSchema: FormSchema[] = [
   {
-    field: 'competitionName',
+    field: 'wholeCompetitionName',
     label: '获奖奖项',
     component: 'Input',
     colProps: { span: 8 },