|
@@ -0,0 +1,74 @@
|
|
|
|
+import {ProForm, ProFormInstance, ProFormSelect, ProFormText} from '@ant-design/pro-components';
|
|
|
|
+import {message} from 'antd';
|
|
|
|
+import React, {useRef} from 'react';
|
|
|
|
+import {getConfigGetApi, postConfigSaveApi} from "@/services/swagger/configAdmin";
|
|
|
|
+
|
|
|
|
+const options = [
|
|
|
|
+ {
|
|
|
|
+ value: 1,
|
|
|
|
+ label: '紫币',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ value: 2,
|
|
|
|
+ label: '紫晶',
|
|
|
|
+ },
|
|
|
|
+]
|
|
|
|
+
|
|
|
|
+type VisitSettings = {
|
|
|
|
+ expendCnt: number;
|
|
|
|
+ expendType: number;
|
|
|
|
+ expendTime: number;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+export default () => {
|
|
|
|
+ const formRef = useRef<ProFormInstance>();
|
|
|
|
+ return (
|
|
|
|
+ <ProForm
|
|
|
|
+ layout="horizontal"
|
|
|
|
+ title="拜访设置"
|
|
|
|
+ formRef={formRef}
|
|
|
|
+ submitter={{}}
|
|
|
|
+ request={async () => {
|
|
|
|
+ const res = await getConfigGetApi({"code": "platform.visit.expend"})
|
|
|
|
+ if (res.success && res.data.content) {
|
|
|
|
+ const result: VisitSettings = JSON.parse(res.data.content)
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return {
|
|
|
|
+ expendCnt: 0,
|
|
|
|
+ expendTime: 0,
|
|
|
|
+ }
|
|
|
|
+ }}
|
|
|
|
+ onFinish={async (values) => {
|
|
|
|
+ const result: VisitSettings = {
|
|
|
|
+ expendCnt: parseInt(values.expendCnt),
|
|
|
|
+ expendType: parseInt(values.expendType),
|
|
|
|
+ expendTime: parseInt(values.expendTime),
|
|
|
|
+ };
|
|
|
|
+ console.log("value " + values);
|
|
|
|
+
|
|
|
|
+ const res = await postConfigSaveApi({
|
|
|
|
+ "type": "json",
|
|
|
|
+ "code": "platform.visit.expend",
|
|
|
|
+ "remark": "拜访消费设置",
|
|
|
|
+ "content": JSON.stringify(result)
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ if (res.success) {
|
|
|
|
+ message.success('提交成功');
|
|
|
|
+ } else {
|
|
|
|
+ message.error(res.errorMessage)
|
|
|
|
+ }
|
|
|
|
+ return res.success;
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+
|
|
|
|
+ <ProForm.Group key="expend">
|
|
|
|
+ <ProFormText name="expendCnt" width="md" label="消耗值"/>
|
|
|
|
+ <ProFormSelect name="expendType" options={options} initialValue='1' width="xs"/>
|
|
|
|
+ </ProForm.Group>
|
|
|
|
+ <ProFormText name="expendTime" width="md" label={`拜访时间`} addonAfter={"分钟"}/>
|
|
|
|
+ </ProForm>
|
|
|
|
+ );
|
|
|
|
+};
|