From e76747474bd811c139255498a63ceffb9de02596 Mon Sep 17 00:00:00 2001 From: chenjianjian Date: Mon, 20 Mar 2023 09:30:05 +0800 Subject: [PATCH] =?UTF-8?q?'=E8=B5=84=E6=96=99=E7=AE=A1=E7=90=8695%?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=8C=E6=88=90'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/axios/api1.js | 4 + src/mock/DataMangement.js | 18 +++- src/routers/DataManagement/index.tsx | 5 ++ .../DataManagement/Project/AddProject.tsx | 2 +- .../DataManagement/Project/EditProject.tsx | 82 +++++++++++++++++++ src/views/DataManagement/ServiceProject.tsx | 3 +- src/views/DataManagement/team/Join.tsx | 2 +- 7 files changed, 112 insertions(+), 4 deletions(-) create mode 100644 src/views/DataManagement/Project/EditProject.tsx diff --git a/src/axios/api1.js b/src/axios/api1.js index 6b946d6..f42f22f 100644 --- a/src/axios/api1.js +++ b/src/axios/api1.js @@ -177,4 +177,8 @@ export function doctor_del(params = {}) { // 新增服务包 export function team_addPackage(params = {}) { return service.post('/team/addPackage', params) +} +// 编辑服务项目 +export function edit_project(params = {}) { + return service.post('/service/editproject', params) } \ No newline at end of file diff --git a/src/mock/DataMangement.js b/src/mock/DataMangement.js index f040539..f31b74c 100644 --- a/src/mock/DataMangement.js +++ b/src/mock/DataMangement.js @@ -103,7 +103,7 @@ Mock.mock('/api/orgin/add', 'post', (req) => { // 查询机构信息 Mock.mock('/api/orgin/search', 'post', (req) => { var { key } = JSON.parse(req.body) - + var index = OrginData.orginlist.findIndex((item) => { return item.key == key }) @@ -938,4 +938,20 @@ Mock.mock('/api/available/search_a', 'post', (req) => { return { code: 200, msg: "查询成功", available: newAvailablelist_b } } } +}) +// 编辑服务项目 +Mock.mock('/api/service/editproject', 'post', (req) => { + var json = JSON.parse(req.body) + var index = servicesAvailable.available.findIndex((item) => { + return item.Availableid == json.Availableid + }) + if (index != -1) { + servicesAvailable.available[index].Availablename = json.Availablename + servicesAvailable.available[index].Availableprice = json.Availableprice + servicesAvailable.available[index].Availablenum = json.Availablenum + servicesAvailable.available[index].Availabletype = json.Availabletype + servicesAvailable.available[index].Availableintroduce = json.Availableintroduce + localStorage.setItem('service_available', JSON.stringify(servicesAvailable)) + } + return { code: 200 } }) \ No newline at end of file diff --git a/src/routers/DataManagement/index.tsx b/src/routers/DataManagement/index.tsx index 45881a4..b3e7ca8 100644 --- a/src/routers/DataManagement/index.tsx +++ b/src/routers/DataManagement/index.tsx @@ -21,6 +21,7 @@ const DoctorDetail = lazy(() => import("../../views/DataManagement/doctor/Doctor const AddPack = lazy(() => import("../../views/DataManagement/package/Addpack")) const EditPack = lazy(() => import("../../views/DataManagement/package/Editpack")) const Project = lazy(() => import("../../views/DataManagement/Project/AddProject")) +const EditProject = lazy(() => import("../../views/DataManagement/Project/EditProject")) export default [ // 资料管理 @@ -118,5 +119,9 @@ export default [ { path: '/MyLayout/Project', element: + }, // 新增服务项目 + { + path: '/MyLayout/EditProject', + element: } ] \ No newline at end of file diff --git a/src/views/DataManagement/Project/AddProject.tsx b/src/views/DataManagement/Project/AddProject.tsx index cbbae2a..21e4cd6 100644 --- a/src/views/DataManagement/Project/AddProject.tsx +++ b/src/views/DataManagement/Project/AddProject.tsx @@ -74,7 +74,7 @@ function Addproject(props: Props) {
- +
diff --git a/src/views/DataManagement/Project/EditProject.tsx b/src/views/DataManagement/Project/EditProject.tsx new file mode 100644 index 0000000..860b1d4 --- /dev/null +++ b/src/views/DataManagement/Project/EditProject.tsx @@ -0,0 +1,82 @@ +import { Button, Form, Input, Select } from 'antd'; +import { use } from 'echarts'; +import React, { useEffect } from 'react'; +import { Navigate, useNavigate, useSearchParams } from 'react-router-dom'; +import { edit_project, service_searchProject } from '../../../axios/api1'; +interface Props { + +} +const { TextArea } = Input; +function EditProject(props: Props) { + const [form] = Form.useForm() + const push = useNavigate() + const [params, setParams] = useSearchParams() + var key = params.get('key') + console.log("editproject", key); + const options = [ + { value: '免费项目', label: '免费项目' }, + { value: '付费项目', label: '付费项目' }, + ] + const projectDetail = () => { + service_searchProject({ key: key }).then((res) => { + if (res.data.code == 200) { + form.setFieldsValue(res.data.available) + } + }) + } + useEffect(() => { + projectDetail() + }, [key]) + const Save = () => { + var json = form.getFieldsValue() + edit_project(json).then((res) => { + if (res.data.code == 200) { + push(-1) + } + }) + } + const back = () => { + push(-1) + } + return ( +
+

新增服务项目

+
+

服务项目信息

+ {/* 表单信息 */} + <> +
+ + + + + + + + + + + + + +