소스 검색

Merge branch 'dev' of http://10.2.1.24:10244/bpa/BPA.KitChen.Web into dev

tags/小炒逻辑变更前
txb 2 년 전
부모
커밋
b23d6d23f6
8개의 변경된 파일906개의 추가작업 그리고 1개의 파일을 삭제
  1. +1
    -1
      config/proxy.js
  2. +21
    -0
      config/routes.js
  3. +21
    -0
      src/app.jsx
  4. +482
    -0
      src/pages/applet/material/index.jsx
  5. +12
    -0
      src/pages/applet/material/index.less
  6. +242
    -0
      src/pages/applet/pageManage/index.jsx
  7. +12
    -0
      src/pages/applet/pageManage/index.less
  8. +115
    -0
      src/pages/applet/service.js

+ 1
- 1
config/proxy.js 파일 보기

@@ -9,7 +9,7 @@
export default {
dev: {
'/kitchen/': {
target: 'https://localhost:5001/',
target: 'http://kitchen.dev1.com/',
changeOrigin: true,
secure: false, //关闭证书验证
pathRewrite: {


+ 21
- 0
config/routes.js 파일 보기

@@ -98,6 +98,27 @@ export default [
},
],
},
{
name: '小程序管理',
icon: 'BankFilled',
path: '/applet',
routes: [
{
name: '页面管理',
icon: 'smile',
path: '/applet/pageManage',
component: './applet/pageManage',
access: 'k2',
},
{
name: '素材管理',
icon: 'smile',
path: '/applet/material',
component: './applet/material',
access: 'k2',
},
]
},
{
name: '物料管理',
icon: 'DropboxSquareFilled',


+ 21
- 0
src/app.jsx 파일 보기

@@ -224,6 +224,27 @@ export async function getInitialState() {
},
],
},
{
name: '小程序管理',
icon: 'BankFilled',
path: '/applet',
routes: [
{
name: '页面管理',
icon: 'smile',
path: '/applet/pageManage',
component: './applet/pageManage',
access: 'k2',
},
{
name: '素材管理',
icon: 'smile',
path: '/applet/material',
component: './applet/material',
access: 'k2',
},
]
},
{
code: 'bom',
name: '配方管理',


+ 482
- 0
src/pages/applet/material/index.jsx 파일 보기

@@ -0,0 +1,482 @@
import { PlusOutlined } from '@ant-design/icons';
import ProTable from '@ant-design/pro-table';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Card, Image, Select, message, Modal, Input, Upload, Popconfirm } from 'antd';
import React, { useRef, useState } from 'react';
import appletAPI from "../service";
import { useEffect } from 'react';
import styles from "./index.less";
import axios from 'axios';

const getBase64 = (file) =>
new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
});



const Material = () => {
const actionRef = useRef();
const [selectedStore, setSelectedStore] = useState('');
const [storeList, setStoreList] = useState([]);
const [isModalVisible, setIsModalVisible] = useState(false);
const [currentImage, setCurrentImage] = useState({
id: '',
pageId: '',
materialName: '',
materialCode: '',
materialPath: [],
materialType: 0
});

const [previewVisible, setPreviewVisible] = useState(false);
const [previewImage, setPreviewImage] = useState('');
const [previewTitle, setPreviewTitle] = useState('');
const [fileList, setFileList] = useState([]);

const [miniPageList, setMiniPageList] = useState([]);

const [currentPage, setCurrentPage] = useState(1);
const [pageSize, setPageSize] = useState(10);
const [total, setTotal] = useState(0);

const handleCancel = () => setPreviewVisible(false);
const handlePreview = async (file) => {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
setPreviewImage(file.url || file.preview);
setPreviewVisible(true);
setPreviewTitle(file.name || file.url.substring(file.url.lastIndexOf('/') + 1));
};

const handleChange = ({ fileList: newFileList }) => {
newFileList.forEach(item => {
item.status = 'done'
});
setFileList(newFileList)
};

const columns = [
{
title: '素材名称',
dataIndex: 'materialName',
ellipsis: true,
},
{
title: '素材编码',
dataIndex: 'materialCode',
ellipsis: true,
},
{
title: '素材图片',
dataIndex: 'materialPath',
render: (_, record) => (
<Image
style={{width: '50%', height: '50%'}}
src={JSON.parse(record.materialPath)[0]}
fallback="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSk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0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg==">
</Image>
)
},
{
title: '操作',
valueType: 'option',
key: 'option',
render: (_, record) => [
<a onClick={() => onEditMaterial(record)}>
编辑
</a>,
<Popconfirm
title="确定要删除此素材吗?"
onConfirm={() => onDeleteMaterial(record)}
okText="确定"
cancelText="取消"
>
<a href="#">删除</a>
</Popconfirm>
]
},
];

const uploadButton = (
<div>
<PlusOutlined />
<div
style={{
marginTop: 8,
}}
>
Upload
</div>
</div>
);

/**
* 获取店铺列表
*/
const onFetchStoreList = async () => {
const response = await appletAPI.GetAllStore();
if (response.isSuccess) {
setStoreList(response.data);
setSelectedStore(response.data[0].id);
} else {
message.error(response.msg || '获取店铺列表失败');
}
}

const uploadProp = {
name: 'file',
showUploadList: true,
multiple: false,
accept: '.png, .jpg, .jpeg, .gif',
// 这里需要指定文件上传的content-type
headers: {
'Content-Type': 'application/octet-stream',
},
customRequest({
action,
file,
headers,
onError,
onProgress,
withCredentials,
}) {
//覆盖action 上传之前获取上传地址
var index = file.name.lastIndexOf(".");
var ext = file.name.substr(index + 1);
let fileData = null;
appletAPI.GetCosRequestURL({ directory: "applet", fileExtension: ext, method: "PUT" }).then((r) => {
action = r.allUrl;
const reader = new FileReader();
reader.readAsArrayBuffer(file);
reader.onload = (e) => {
fileData = e.target.result;
axios.put(action, fileData, {
withCredentials,
headers,
onUploadProgress: ({ total, loaded }) => {
onProgress({ percent: Math.round(loaded / total * 100).toFixed(2) }, file);
},
}).then(response => {
if (response.status == 200 || response.statusText == 'OK') {
const tempUploadImage = JSON.parse(JSON.stringify(currentImage));
tempUploadImage.materialPath.push(r.seeUrl);
setCurrentImage(tempUploadImage);
message.success('上传成功!');
}
}).catch(onError);
};
});
return {
abort() {
console.log('upload progress is aborted.');
},
};
},
};

/**
* 添加、更新页面素材
*/
const onAddPageMaterial = async () => {
console.log('currentImage>>>>', currentImage, !currentImage.pageId);
if (!currentImage.pageId) {
message.info('请选择所属页面');
return;
} else if (!currentImage.materialName) {
message.info('请填写素材名称');
return;
} else if (!currentImage.materialCode) {
message.info('请填写素材编码');
return;
} else if (currentImage.materialPath.length === 0) {
message.info('请选择至少上传一张素材图片');
return;
}
const jsonData = {
pageId: currentImage.pageId,
materialName: currentImage.materialName,
materialCode: currentImage.materialCode,
materialPath: JSON.stringify(currentImage.materialPath),
materialType: currentImage.materialType
}
if (!currentImage.id) {
jsonData.id = currentImage.id;
const response = await appletAPI.UpdateMiniMaterial(jsonData);
if (response.statusCode === 200) {
message.success('更新成功');
setIsModalVisible(false);
actionRef.current.reload();
} else {
message.error('更新失败')
}
} else {
const response = await appletAPI.AddMinimaterial(jsonData);
if (response.statusCode === 200) {
message.success('添加成功');
setIsModalVisible(false);
actionRef.current.reload();
} else {
message.error('添加失败')
}
}
}

/**
* 编辑素材
* @param {*} record
*/
const onEditMaterial = (record) => {
const materialPath = JSON.parse(record.materialPath);
const material = {
id: record.id,
pageId: record.pageId,
materialName: record.materialName,
materialCode: record.materialCode,
materialPath: materialPath
}
if (materialPath.length > 1) {
material.materialType = 1;
} else {
material.materialType = 0;
}
const fileList = [];
materialPath.forEach((item, index) => {
fileList.push({
uid: index,
name: item.split('/applet/')[1] || "图片.jpg",
status: 'done',
url: item,
});
});
setFileList(fileList);
setCurrentImage(material);
setIsModalVisible(true);
}

/**
* 删除素材
* @param {*} record
*/
const onDeleteMaterial = async (record) => {
const response = await appletAPI.DeleteMiniMaterial(record.id);
if (response.statusCode === 200) {
actionRef.current.reload();
message.success('删除成功');
} else {
message.error(response.errors || '删除失败');
}
}

/**
* 获取小程序页面
*/
const onFetchMiniPageList = async () => {
const response = await appletAPI.MiniPageList({
current: 1,
pageSize: 999,
storeId: selectedStore
});
if (response.statusCode === 200) {
setMiniPageList(response.data.items);
} else {
message.error(response.errors || '获取页面列表失败')
}
}

const onBeforeCreate = () => {
setFileList([]);
setCurrentImage({
pageId: '',
materialName: '',
materialCode: '',
materialPath: [],
materialType: 0
});
}

useEffect(() => {
onFetchStoreList();
}, []);

useEffect(() => {
if (!selectedStore) return;
onFetchMiniPageList();
actionRef.current.reload();
}, [selectedStore]);

return <PageContainer>
<Card style={{ marginBottom: '10px' }}>
<div className={styles.table_search_item}>
<div>
当前门店:
</div>
<Select style={{ width: 300 }} value={selectedStore} onChange={(value) => {
setSelectedStore(value);
}}>
{
storeList.map(item => {
return <Option value={item.id} key={item.id}>{item.store_Name}</Option>
})
}
</Select>
</div>
</Card>
<ProTable
search={false}
columns={columns}
actionRef={actionRef}
cardBordered
editable={{
type: 'multiple',
}}
request={async () => {
if (!selectedStore) return;
const jsonData = {
"current": currentPage,
"pageSize": pageSize,
"storeId": selectedStore
}
const response = await appletAPI.MinimaterialListByStore(jsonData);
const pageList = [];
response.data.forEach(item => {
pageList.push(...item.list);
});
return {
data: pageList,
success: true,
total: 10,
}
}}
columnsState={{
persistenceKey: 'pro-table-singe-demos',
persistenceType: 'localStorage',
onChange(value) {
console.log('value: ', value);
},
}}
rowKey="id"
options={{
setting: {
listsHeight: 400,
},
}}
pagination={{
pageSize: 5,
onChange: (page) => console.log(page),
}}
dateFormatter="string"
headerTitle="图片管理"
toolBarRender={() => [
<Button key="button" icon={<PlusOutlined />} type="primary" onClick={() => { setIsModalVisible(true); onBeforeCreate() }}>
新建
</Button>
]}
/>
<Modal title="编辑素材" visible={isModalVisible} onOk={onAddPageMaterial} onCancel={() => setIsModalVisible(false)}>
<div className={styles.edit_image_card}>
<div className={styles.edit_image_item}>
<div className={styles.edit_image_prev}>
素材名称:
</div>
<div className={styles.edit_image_suffix}>
<Input placeholder='请输入素材名称' value={currentImage.materialName} onChange={value => {
const tempImg = JSON.parse(JSON.stringify(currentImage));
tempImg.materialName = value.target.value;
setCurrentImage(tempImg);
}}></Input>
</div>
</div>
<div className={styles.edit_image_item}>
<div className={styles.edit_image_prev}>
素材编码:
</div>
<div className={styles.edit_image_suffix}>
<Input placeholder='请输入素材编码' value={currentImage.materialCode} onChange={value => {
const tempImg = JSON.parse(JSON.stringify(currentImage));
tempImg.materialCode = value.target.value;
setCurrentImage(tempImg);
}}></Input>
</div>
</div>
<div className={styles.edit_image_item}>
<div className={styles.edit_image_prev}>
所属页面:
</div>
<div className={styles.edit_image_suffix}>
<Select placeholder="请选择所在页面" style={{ width: '100%' }} value={currentImage.pageId} onChange={(value) => {
const tempImg = JSON.parse(JSON.stringify(currentImage));
tempImg.pageId = value;
setCurrentImage(tempImg);
}}>
{
miniPageList.map(item => {
return <Option value={item.id} key={item.id}>{item.pageName}</Option>
})
}
</Select>
</div>
</div>
<div className={styles.edit_image_item}>
<div className={styles.edit_image_prev}>
数量:
</div>
<div className={styles.edit_image_suffix}>
<Select placeholder="请选择素材数量" style={{ width: '100%' }} value={currentImage.materialType} onChange={(value) => {
const tempImg = JSON.parse(JSON.stringify(currentImage));
tempImg.materialType = value;
setCurrentImage(tempImg);
}}>
<Option value={0} key={0}>单张</Option>
<Option value={1} key={1}>多张</Option>
</Select>
</div>
</div>
<Upload
listType="picture-card"
fileList={fileList}
onPreview={handlePreview}
onChange={handleChange}
onRemove={(remove) => {
const findIndex = fileList.findIndex(item => item.uid === remove.uid);
if (findIndex > -1) {
const tempUpload = JSON.parse(JSON.stringify(currentImage));
tempUpload.materialPath.splice(findIndex, 1);
setCurrentImage(tempUpload);
}
}}
{...uploadProp}
>
{
(() => {
if (currentImage.materialType === 0) {
if (fileList.length >= 1) {
return null;
} else {
return uploadButton
}
} else {
return <>{fileList.length >= 9 ? null : uploadButton}</>
}
})()
}
</Upload>
</div>
</Modal>
<Modal visible={previewVisible} title={previewTitle} footer={null} onCancel={handleCancel}>
<img
alt="example"
style={{
width: '100%',
}}
src={previewImage}
/>
</Modal>
</PageContainer >
}

export default Material;

+ 12
- 0
src/pages/applet/material/index.less 파일 보기

@@ -0,0 +1,12 @@
.table_search_item {
display: flex;
align-items: center;
}

.edit_image_item {
margin-bottom: 10px;
}

.edit_image_prev {
margin-bottom: 5px;
}

+ 242
- 0
src/pages/applet/pageManage/index.jsx 파일 보기

@@ -0,0 +1,242 @@
import ProTable from '@ant-design/pro-table';
import { PageContainer } from '@ant-design/pro-layout';
import { PlusOutlined } from '@ant-design/icons';
import { Button, Modal, Form, Input, Select, Card, message, Popconfirm } from 'antd';
import React, { useRef, useState, useEffect } from 'react';
import appletAPI from "../service";
import styles from "./index.less";

const pageManage = () => {
const actionRef = useRef();
const [isModalVisible, setIsModalVisible] = useState(false);
const [pageForm] = Form.useForm();
const [storeList, setStoreList] = useState([]);
const [currentPage, setCurrentPage] = useState(1);
const [pageSize, setPageSize] = useState(10);
const [total, setTotal] = useState(0);
const [selectedStore, setSelectedStore] = useState('');

const columns = [
{
title: '页面名称',
dataIndex: 'pageName',
ellipsis: true,
},
{
title: '页面路径',
dataIndex: 'pageRoute',
ellipsis: true,
},
{
title: '所属门店',
dataIndex: 'storeId',
ellipsis: true,
},
{
title: '操作',
valueType: 'option',
key: 'option',
render: (_, record) => [
<a onClick={() => {
pageForm.setFieldsValue(record);
setIsModalVisible(true);
}}>
编辑
</a>,
<Popconfirm
title="确定要删除此页面吗?"
onConfirm={() => onDeletePage(record)}
okText="确定"
cancelText="取消"
>
<a href="#">删除</a>
</Popconfirm>
],
}
];

const onBeforeCreate = () => {
setIsModalVisible(true);
pageForm.resetFields();
}

/**
* 添加/修改页面信息
*/
const onFinishPage = async (values) => {
if (values.id) {
const response = await appletAPI.MiniPageUpdate(values);
if (response.statusCode === 200) {
message.success('修改成功');
setIsModalVisible(false);
actionRef.current.reload();
} else {
message.error(response.errors);
}
} else {
const response = await appletAPI.MiniPageAdd(values);
if (response.statusCode === 200) {
message.success('添加成功');
setIsModalVisible(false);
actionRef.current.reload();
} else {
message.error(response.errors);
}
}
}

/**
* 删除页面
* @param {*} record
*/
const onDeletePage = async (record) => {
const response = await appletAPI.MiniPageDelete(record.id);
if (response.statusCode === 200) {
message.success('删除成功');
actionRef.current.reload();
} else {
message.error(response.errors);
}
}

/**
* 获取店铺列表
*/
const onFetchStoreList = async () => {
const response = await appletAPI.GetAllStore();
if (response.isSuccess) {
setStoreList(response.data);
setSelectedStore(response.data[0].id);
} else {
message.error(response.msg || '获取店铺列表失败');
}
}

useEffect(() => {
onFetchStoreList();
}, []);

useEffect(() => {
actionRef.current.reload();
}, [selectedStore]);

return <PageContainer>
<Card style={{ marginBottom: '10px' }}>
<div className={styles.table_search_item}>
<div>
当前门店:
</div>
<Select style={{ width: 300 }} value={selectedStore} onChange={(value) => {
setSelectedStore(value);
}}>
{
storeList.map(item => {
return <Option value={item.id} key={item.id}>{item.store_Name}</Option>
})
}
</Select>
</div>
</Card>
<ProTable
columns={columns}
actionRef={actionRef}
cardBordered
editable={{
type: 'multiple',
}}
request={async () => {
if (!selectedStore) return;
const jsonData = {
"current": currentPage,
"pageSize": pageSize,
"storeId": selectedStore
}
const response = await appletAPI.MiniPageList(jsonData);
return {
data: response.data.items,
success: true,
total: response.data.totalCount,
}
}}
rowKey="id"
search={false}
pagination={{
pageSize: 5,
onChange: (page) => console.log(page),
}}
dateFormatter="string"
headerTitle="页面管理"
toolBarRender={() => [
<Button key="button" icon={<PlusOutlined />} type="primary" onClick={onBeforeCreate}>
新建
</Button>
]}
/>
<Modal title="编辑页面" footer={false} visible={isModalVisible} onOk={() => setIsModalVisible(false)} onCancel={() => setIsModalVisible(false)}>
<Form
name="basic"
form={pageForm}
onFinish={onFinishPage}
>
<Form.Item
name="id"
hidden={true}
>
<Input />
</Form.Item>
<Form.Item
label="页面名称"
name="pageName"
rules={[
{
required: true,
message: '请输入页面名称!',
},
]}
>
<Input />
</Form.Item>

<Form.Item
label="页面路径"
name="pageRoute"
rules={[
{
required: true,
message: '请输入页面路径!',
},
]}
>
<Input />
</Form.Item>

<Form.Item
label="所属门店"
name="storeId"
rules={[
{
required: true,
message: '请选择门店!',
},
]}
>
<Select allowClear placeholder="请选择门店" style={{ width: '100%' }}>
{
storeList.map(item => {
return <Option value={item.id} key={item.id}>{item.store_Name}</Option>
})
}
</Select>
</Form.Item>

<Form.Item>
<Button type="primary" htmlType="submit">
确定
</Button>
</Form.Item>
</Form>
</Modal>
</PageContainer>
}

export default pageManage;

+ 12
- 0
src/pages/applet/pageManage/index.less 파일 보기

@@ -0,0 +1,12 @@
.table_search_item {
display: flex;
align-items: center;
}

.edit_image_item {
margin-bottom: 10px;
}

.edit_image_prev {
margin-bottom: 5px;
}

+ 115
- 0
src/pages/applet/service.js 파일 보기

@@ -0,0 +1,115 @@
import { request } from 'umi';

export default {
GetAllStore() {
return request('/kitchen/api/StoreHelper/GetAllStore', {
method: 'GET'
});
},

GetCosRequestURL(data) {
return request(`/kitchen/api/systemconfig/GetCosRequestSignURL`, {
method: 'POST',
data: data,
});
},

/**
* 添加素材
* @param {*} params
* @returns
*/
AddMinimaterial(params) {
return request(`/kitchen/api/minimaterial/add`, {
method: 'POST',
data: params,
});
},

/**
* 更新素材
* @param {*} params
*/
UpdateMiniMaterial(params) {
return request(`/kitchen/api/minimaterial/update`, {
method: 'POST',
data: params,
});
},

/**
* 根据店铺id查询素材
*/
MinimaterialListByStore(params) {
return request(`/kitchen/api/minimaterial/store`, {
method: 'POST',
data: params,
});
},

/**
* 删除素材
*/
DeleteMiniMaterial(id) {
return request(`/kitchen/api/minimaterial/del`, {
method: 'POST',
data: {
id
},
});
},
/**
* 添加页面
* @param {*} params
* @returns
*/
MiniPageAdd(params) {
return request('/kitchen/api/minipage/add', {
method: 'POST',
data: {
...params
}
});
},

/**
* 删除
* @param {*} id
* @returns
*/
MiniPageDelete(id) {
return request('/kitchen/api/minipage/del', {
method: 'POST',
data: {
id
}
});
},

/**
* 更新页面
* @param {*} params
*/
MiniPageUpdate(params) {
return request('/kitchen/api/minipage/update', {
method: 'POST',
data: {
...params
}
});
},

/**
* 分页查询
*/
MiniPageList(params) {
return request('/kitchen/api/minipage/page', {
method: 'POST',
data: {
...params
}
});
}

}

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