From 0a3218b399dbcae1a002bb2d8ba6919b6fc0db55 Mon Sep 17 00:00:00 2001 From: liuyiliang Date: Thu, 20 Feb 2025 13:50:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=AD=97=E5=85=B8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=8E=B7=E5=8F=96=E4=B8=8B=E6=8B=89=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/examination/src/api/demo/index.tsx | 2 +- packages/examination/src/api/dict/index.tsx | 8 ++ .../examination/src/views/demo/demoList.tsx | 74 +++++++++++-------- 3 files changed, 54 insertions(+), 30 deletions(-) create mode 100644 packages/examination/src/api/dict/index.tsx diff --git a/packages/examination/src/api/demo/index.tsx b/packages/examination/src/api/demo/index.tsx index ea9d888..7824c04 100644 --- a/packages/examination/src/api/demo/index.tsx +++ b/packages/examination/src/api/demo/index.tsx @@ -2,7 +2,7 @@ import axios from '../axios'; export function getList(obj: any) { return axios({ - url: '/ins/demo/list', + url: '/ex/demo/list', method: 'get' }) } \ No newline at end of file diff --git a/packages/examination/src/api/dict/index.tsx b/packages/examination/src/api/dict/index.tsx new file mode 100644 index 0000000..654e9d6 --- /dev/null +++ b/packages/examination/src/api/dict/index.tsx @@ -0,0 +1,8 @@ +import axios from '../axios'; + +export function dictionary(code: any) { + return axios({ + url: '/ex/dict/dictionary?code=' + code, + method: 'get' + }) +} diff --git a/packages/examination/src/views/demo/demoList.tsx b/packages/examination/src/views/demo/demoList.tsx index 9de3d1b..8158ba5 100644 --- a/packages/examination/src/views/demo/demoList.tsx +++ b/packages/examination/src/views/demo/demoList.tsx @@ -1,12 +1,16 @@ import React, { Component } from "react"; -import { Button, Empty, Modal, notification, Popconfirm } from "antd"; +import {Button, Empty, Form, Input, Modal, notification, Popconfirm, Select} from "antd"; import { getList } from "api/demo/index"; +import { dictionary } from "api/dict/index"; + +const { Option } = Select interface States { resData: any visible: boolean title: string - current: any + current: any, + sexDict: any } class DemoList extends Component { @@ -16,12 +20,14 @@ class DemoList extends Component { resData: undefined, visible: false, title: '新增公告', - current: {} + current: {}, + sexDict: undefined } } componentDidMount() { this.getList() + this.getDict() } getList() { @@ -33,39 +39,20 @@ class DemoList extends Component { }).catch(() => { }) } - getStatusText(status: number): string { - if (status === 1) { - return "启用"; - } else if (status === 0) { - return "禁用"; - } else { - return ''; - } + getDict() { + dictionary('sex').then((res) => { + if(res.data){ + this.setState({ sexDict: res.data }) + } + }) } handelCreate() { this.setState({ visible: true }) } - handelUpdate(item: any) { - this.setState({ - visible: true, - title: '编辑公告', - current: item - }) - } - - handleEnable(item: any) { - } - - handleDisable(item: any) { - } - - handleDel(item: any) { - } - render() { - const { resData, visible, title, current } = this.state; + const { resData, visible, title, current, sexDict } = this.state; const handleCancel = () => { this.setState({ visible: false }) }; @@ -73,6 +60,35 @@ class DemoList extends Component { return (
TABLE
+
+
+ + + +
+
{ resData ? null :