|
|
@@ -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> |
|
|
|