소스 검색

提交

master
gwbvipvip 8 달 전
부모
커밋
78ffdd4736
3개의 변경된 파일94개의 추가작업 그리고 24개의 파일을 삭제
  1. +6
    -0
      src/global_data.js
  2. +80
    -24
      src/pages/authorization/storeAuthorization/index.jsx
  3. +8
    -0
      src/pages/authorization/storeAuthorization/services.js

+ 6
- 0
src/global_data.js 파일 보기

@@ -8,3 +8,9 @@ export function getApiUrl() {
export function getDataBaseUrl() {
return '/kitchbase';
}

export function GetkitchbaseUrl() {
return '/kitchbase';
}



+ 80
- 24
src/pages/authorization/storeAuthorization/index.jsx 파일 보기

@@ -4,9 +4,15 @@ import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import { PlusOutlined } from '@ant-design/icons';
import ProTable from '@ant-design/pro-table';
import { QuestionCircleOutlined } from '@ant-design/icons';
import dayjs from 'dayjs';
import weekday from "dayjs/plugin/weekday";
import localeData from "dayjs/plugin/localeData";
dayjs.extend(weekday);
dayjs.extend(localeData);
const dateFormat = 'YYYY/MM/DD';
const { Paragraph, Text } = Typography;

import { PageStoreAuthorization, AddStoreAuthorization, UpdateStoreAuthorization, GetStoreList } from "./services"
import { PageStoreAuthorization, AddStoreAuthorization, UpdateStoreAuthorization, UpdateStoreAuthTime, GetStoreList } from "./services"
const App = () => {

const actionRef = useRef();
@@ -57,6 +63,22 @@ const App = () => {
valueType: 'textarea',
search: false,
},
{
title: '有效日期',
dataIndex: 'periodValidity',
valueType: 'textarea',
search: false,
render: (_, record) => {
return <span>{record.periodValidity == null ? "长期有效" : record.periodValidity}</span>
}
},
{
title: '修改时间',
dataIndex: 'updateAt',
valueType: 'textarea',
width: 200,
search: false
},
{
title: '操作',
dataIndex: 'option',
@@ -109,7 +131,7 @@ const App = () => {
request={async (params) => {
var data = [];
var total = 0;
await PageStoreAuthorization(params).then((r) => {
await PageStoreAuthorization(params).then((r) => {
total = r.data.total;
data = r.data.data;
});
@@ -122,35 +144,69 @@ const App = () => {
columns={columns}
/>

<Modal title="添加授权" open={ModalVisible}
<Modal title="授权操作" open={ModalVisible}
onOk={() => {
if (!currentRow) {
message.error("请选择店铺");
return;
}
AddStoreAuthorization(currentRow).then((r) => {
if (r.statusCode == 200 && r.data) {
message.success("添加成功");
actionRef.current.reload();
handleModalVisible(false);
} else {
message.error(r.errors || "添加失败");
}
});
form.submit();

}}
onCancel={() => {
handleModalVisible(false);
}}>
<Select

<Form form={form} onFinish={(values) => {
if (values.id) {
UpdateAuthTime(values).then((r) => {
if (r.statusCode == 200 && r.data) {
message.success("修改成功");
actionRef.current.reload();
handleModalVisible(false);

} else {
message.error(r.errors || "修改失败");
}
});

} else {
AddAuthorization(values).then((r) => {
if (r.statusCode == 200 && r.data) {
message.success("添加成功");
actionRef.current.reload();
handleModalVisible(false);

} else {
message.error(r.errors || "添加失败");
}
});
}
}}
style={{
width: 470,
}}
onChange={(value) => {
setCurrentRow(value);
}}
options={storeList}
/>
maxWidth: 600,
}}>
<Form.Item name="id" hidden={true}>
<Input />
</Form.Item>
<Form.Item name="id" hidden={true}>
<Select style={{ width: 470, }} onChange={(value) => { setCurrentRow(value); }} options={storeList} />
</Form.Item>


<Form.Item name="autho" label="授权时间" rules={[{ required: true, }]} >
<Radio.Group >
<Radio value="cqyx"> 长期有效 </Radio>
<Radio value="gdsj"> 固定时间 </Radio>
</Radio.Group>
</Form.Item>

<Form.Item noStyle shouldUpdate={(prevValues, currentValues) => prevValues.autho !== currentValues.autho} >
{({ getFieldValue }) =>
getFieldValue('autho') == 'gdsj' ? (
<Form.Item name="periodValidity" label="固定时间" rules={[{ required: true, }]}>
<DatePicker style={{ width: "300px" }} />
</Form.Item>
) : null
}
</Form.Item>
</Form>
</Modal>

</PageContainer>


+ 8
- 0
src/pages/authorization/storeAuthorization/services.js 파일 보기

@@ -26,6 +26,14 @@ export async function UpdateStoreAuthorization(data) {
});
}

/** 修改平台授权码时间 */
export async function UpdateStoreAuthTime(data) {
return request(GetkitchbaseUrl()+`/api/authorization/updatestoreauthtime`, {
method: 'POST',
data: data,
});
}


/** 获取店铺列表 */
export async function GetStoreList(data) {


불러오는 중...
취소
저장