@@ -17,7 +17,7 @@ | |||
}, | |||
}, | |||
'/kitchbase/': { | |||
target: 'http://192.168.1.19:5007/', | |||
target: 'http://192.168.1.19:5006/', | |||
changeOrigin: true, | |||
secure: false, //关闭证书验证 | |||
pathRewrite: { | |||
@@ -25,7 +25,7 @@ | |||
}, | |||
}, | |||
'/kitchorder/': { | |||
target: 'http://localhost:5005', | |||
target: 'http://192.168.1.19:5007', | |||
changeOrigin: true, | |||
secure: false, //关闭证书验证 | |||
pathRewrite: { | |||
@@ -172,6 +172,13 @@ export default [ | |||
component: './database/goods/goodstechnology', | |||
access: 'k7', | |||
}, | |||
{ | |||
name: '商品属性配置', | |||
icon: 'smile', | |||
path: '/database/goods/goodsattributeprice', | |||
component: './database/goods/goodsattributeprice', | |||
access: 'k7', | |||
}, | |||
] | |||
}, | |||
], | |||
@@ -252,6 +252,14 @@ export async function getInitialState() { | |||
component: './database/goods/newgoods', | |||
access: 'k10', | |||
}, | |||
{ | |||
code: 'newgoods', | |||
name: '商品属性配置', | |||
icon: 'smile', | |||
path: '/database/goods/goodsattributeprice', | |||
component: './database/goods/goodsattributeprice', | |||
access: 'k10', | |||
}, | |||
] | |||
}, | |||
{ | |||
@@ -12,3 +12,9 @@ export function getDataBaseUrl() { | |||
export function GetkitchbaseUrl() { | |||
return '/kitchbase'; | |||
} | |||
export function GetkitchbaseUrl() { | |||
return '/kitchorder'; | |||
} | |||
@@ -1,16 +1,26 @@ | |||
import React, { useState, useRef } from 'react'; | |||
import { Modal, Button, message, Popconfirm, Typography } from 'antd'; | |||
import { Modal, Button, message, Popconfirm, Typography, Form, Input, DatePicker, Select, Radio } from 'antd'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import ProTable from '@ant-design/pro-table'; | |||
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 { PageAuthorization, AddAuthorization, UpdateAuthorization } from "./services" | |||
import { PageAuthorization, AddAuthorization, UpdateAuthorization, UpdateAuthTime,DelAuthorization } from "./services" | |||
const App = () => { | |||
const actionRef = useRef(); | |||
const [ModalVisible, handleModalVisible] = useState(false); | |||
const [currentRow, setCurrentRow] = useState(); | |||
const [form] = Form.useForm(); | |||
const columns = [ | |||
{ | |||
title: '主键', | |||
@@ -20,25 +30,36 @@ const App = () => { | |||
tip: '规则名称是唯一的 key' | |||
}, | |||
{ | |||
title: 'TenantId', | |||
dataIndex: 'groupId', | |||
title: '授权码', | |||
dataIndex: 'key', | |||
valueType: 'textarea', | |||
search: false, | |||
render: (text) => <Paragraph style={{ display: 'inline' }} copyable>{text}</Paragraph>, | |||
}, | |||
{ | |||
title: '授权码', | |||
dataIndex: 'key', | |||
title: '有效日期', | |||
dataIndex: 'periodValidity', | |||
valueType: 'textarea', | |||
width:200, | |||
search: false, | |||
render: (text) => <Paragraph style={{ display: 'inline' }} copyable>{text}</Paragraph>, | |||
render: (_, record) => { | |||
var time=dayjs(record.periodValidity, dateFormat).format('YYYY-MM-DD'); | |||
return <span>{record.periodValidity == null ? "长期有效" : time}</span> | |||
} | |||
}, | |||
{ | |||
title: '修改时间', | |||
dataIndex: 'updateAt', | |||
valueType: 'textarea', | |||
width:200, | |||
search: false | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'option', | |||
valueType: 'option', | |||
fixed: 'right', | |||
width: 450, | |||
width: 300, | |||
render: (_, record) => [ | |||
<Popconfirm | |||
type="primary" | |||
@@ -58,8 +79,37 @@ const App = () => { | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<a href="#">更新</a> | |||
<a href="#">更新授权码</a> | |||
</Popconfirm>, | |||
<a href="#" onClick={() => { | |||
setCurrentRow(record); | |||
var aa = record.periodValidity == null ? "cqyx" : "gdsj"; | |||
var time=record.periodValidity == null ?null:dayjs(record.periodValidity, dateFormat); | |||
form.setFieldsValue({ id: record.id, autho:aa, periodValidity: time }); | |||
handleModalVisible(true); | |||
}}>更新授权时间</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={() => { | |||
DelAuthorization(record.id).then((r) => { | |||
if (r.statusCode == 200 && r.data) { | |||
actionRef.current.reload(); | |||
message.success("删除成功"); | |||
} else { | |||
message.error(r.errors || "删除失败"); | |||
} | |||
}); | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm> | |||
], | |||
}, | |||
@@ -79,14 +129,8 @@ const App = () => { | |||
type="primary" | |||
key="primary" | |||
onClick={() => { | |||
AddAuthorization().then((r) => { | |||
if (r.statusCode == 200 && r.data) { | |||
message.success("添加成功"); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors || "添加失败"); | |||
} | |||
}); | |||
handleModalVisible(true); | |||
form.setFieldsValue({ id: null, autho: "cqyx", periodValidity: null }); | |||
}} > | |||
<PlusOutlined /> 添加授权码 | |||
</Button>, | |||
@@ -107,6 +151,67 @@ const App = () => { | |||
columns={columns} | |||
/> | |||
<Modal title="授权操作" open={ModalVisible} | |||
onOk={() => { | |||
form.submit(); | |||
}} | |||
onCancel={() => { | |||
handleModalVisible(false); | |||
}}> | |||
<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={{ | |||
maxWidth: 600, | |||
}}> | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</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> | |||
); | |||
}; | |||
@@ -26,5 +26,20 @@ export async function UpdateAuthorization(data) { | |||
}); | |||
} | |||
/** 修改平台授权码时间 */ | |||
export async function UpdateAuthTime(data) { | |||
return request(getDataBaseUrl()+`/api/authorization/updateauthtime`, { | |||
method: 'POST', | |||
data: data, | |||
}); | |||
} | |||
/** 删除授权码 */ | |||
export async function DelAuthorization(data) { | |||
return request(getDataBaseUrl()+`/api/authorization/delauthorization?id=`+data, { | |||
method: 'POST', | |||
data: data, | |||
}); | |||
} | |||
@@ -1,18 +1,25 @@ | |||
import React, { useState, useRef, useEffect } from 'react'; | |||
import { Modal, Button, message, Popconfirm, Typography, Select } from 'antd'; | |||
import { Modal, Button, message, Popconfirm, Typography, Select,Form,Input,Radio,DatePicker} from 'antd'; | |||
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,DelStoreAuthTime } from "./services" | |||
const App = () => { | |||
const actionRef = useRef(); | |||
const [ModalVisible, handleModalVisible] = useState(false); | |||
const [currentRow, setCurrentRow] = useState(); | |||
const [storeList, setStoreList] = useState([]); | |||
const [form] = Form.useForm(); | |||
//初始化数据 | |||
useEffect(() => { | |||
@@ -44,6 +51,12 @@ const App = () => { | |||
hideInTable: true, | |||
tip: '规则名称是唯一的 key' | |||
}, | |||
{ | |||
title: '场景', | |||
dataIndex: 'storeName', | |||
valueType: 'textarea', | |||
width:200, | |||
}, | |||
{ | |||
title: '授权码', | |||
dataIndex: 'key', | |||
@@ -51,18 +64,31 @@ const App = () => { | |||
search: false, | |||
render: (text) => <Paragraph style={{ display: 'inline' }} copyable>{text}</Paragraph>, | |||
}, | |||
{ | |||
title: '店铺', | |||
dataIndex: 'storeName', | |||
valueType: 'textarea', | |||
title: '有效日期', | |||
dataIndex: 'periodValidity', | |||
valueType: 'date', | |||
width:150, | |||
search: false, | |||
render: (_, record) => { | |||
var time=dayjs(record.periodValidity, dateFormat).format('YYYY-MM-DD'); | |||
return <span>{record.periodValidity == null ? "长期有效" : time}</span> | |||
} | |||
}, | |||
{ | |||
title: '修改时间', | |||
dataIndex: 'updateAt', | |||
valueType: 'textarea', | |||
width: 150, | |||
search: false | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'option', | |||
valueType: 'option', | |||
fixed: 'right', | |||
width: 450, | |||
width: 250, | |||
render: (_, record) => [ | |||
<Popconfirm | |||
type="primary" | |||
@@ -83,7 +109,36 @@ const App = () => { | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<a href="#">更新</a> | |||
<a href="#">更新授权码</a> | |||
</Popconfirm>, | |||
<a href="#" onClick={() => { | |||
setCurrentRow(record); | |||
var aa = record.periodValidity == null ? "cqyx" : "gdsj"; | |||
var time=record.periodValidity == null ?null:dayjs(record.periodValidity, dateFormat); | |||
form.setFieldsValue({ id: record.id, autho:aa, periodValidity: time,storeId:record.storeId }); | |||
handleModalVisible(true); | |||
}}>更新授权时间</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={async () => { | |||
await DelStoreAuthTime(record.id).then((r) => { | |||
if (r.statusCode == 200 && r.data) { | |||
message.success("删除成功"); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors || "删除失败"); | |||
} | |||
}); | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
], | |||
@@ -109,7 +164,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 +177,67 @@ 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) { | |||
UpdateStoreAuthTime(values).then((r) => { | |||
if (r.statusCode == 200 && r.data) { | |||
message.success("修改成功"); | |||
actionRef.current.reload(); | |||
handleModalVisible(false); | |||
} else { | |||
message.error(r.errors || "修改失败"); | |||
} | |||
}); | |||
} else { | |||
AddStoreAuthorization(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="storeId" label="场景" rules={[{ required: true, }]}> | |||
<Select style={{ width: 330, }} 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> | |||
@@ -26,6 +26,25 @@ export async function UpdateStoreAuthorization(data) { | |||
}); | |||
} | |||
/** 修改平台授权码时间 */ | |||
export async function UpdateStoreAuthTime(data) { | |||
return request(GetkitchbaseUrl()+`/api/authorization/updatestoreauthtime`, { | |||
method: 'POST', | |||
data: data, | |||
}); | |||
} | |||
/** 删除店铺授权码 */ | |||
export async function DelStoreAuthTime(data) { | |||
return request(GetkitchbaseUrl()+`/api/authorization/delstoreauthorization?id=`+data, { | |||
method: 'POST', | |||
data: data, | |||
}); | |||
} | |||
/** 获取店铺列表 */ | |||
export async function GetStoreList(data) { | |||
@@ -0,0 +1,370 @@ | |||
import { PlusOutlined,ArrowLeftOutlined } from '@ant-design/icons'; | |||
import { Button, message, Input, Form, Popconfirm,Radio,InputNumber,Card,Tag } from 'antd'; | |||
import React, { useState, useRef, useEffect } from 'react'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import ProTable from '@ant-design/pro-table'; | |||
import EditableProTable from '@ant-design/pro-table'; | |||
import { history } from 'umi'; | |||
import ProDescriptions from '@ant-design/pro-descriptions'; | |||
import { | |||
getpage, | |||
add, | |||
update, | |||
del, | |||
getbygoodsidattribute | |||
} from './service'; | |||
const goodsattribute = (props) => { | |||
/** 新建/更新窗口的弹窗 */ | |||
const [createModalVisible, handleModalVisible] = useState(false); | |||
const [editableKeys, setEditableRowKeys] = useState([]); | |||
/** 分布更新窗口的弹窗 */ | |||
const [arttuename,setarttuename]=useState(""); | |||
const [checkvalue, setCheckvalue] = useState([]); | |||
const actionRef = useRef(); | |||
const [currentRow, setCurrentRow] = useState(); | |||
const [selectedRowsState, setSelectedRows] = useState([]); | |||
const [price, setprice] = useState(0); | |||
const [goodsAttriburteData, setGoodsAttriburteData] = useState([]); | |||
const [dataSource, setDataSource] = useState([]); | |||
/** 国际化修改 */ | |||
useEffect(() => { | |||
intDicData(); | |||
}, []); | |||
function intDicData() { | |||
getbygoodsidattribute(props.location.query.values.id).then((r)=>{ | |||
if(r.data && r.data.length>0){ | |||
setGoodsAttriburteData(r.data); | |||
} | |||
}) | |||
} | |||
/** | |||
* 批量删除 | |||
* | |||
* @param selectedRows | |||
*/ | |||
const handleRemove = async (selectedRows) => { | |||
const hide = message.loading('正在删除'); | |||
if (!selectedRows) return true; | |||
await del(selectedRows.map((row) => row.id)).then((r) => { | |||
if (r.succeeded) { | |||
message.success('删除成功'); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}); | |||
hide(); | |||
return true; | |||
}; | |||
const columns = [ | |||
{ | |||
title: '主键', | |||
dataIndex: 'id', | |||
hideInSearch: true, | |||
hideInTable: true, | |||
tip: '规则名称是唯一的 key', | |||
render: (dom, entity) => { | |||
return ( | |||
<a | |||
onClick={() => { | |||
setCurrentRow(entity); | |||
setShowDetail(true); | |||
}} | |||
> | |||
{dom} | |||
</a> | |||
); | |||
}, | |||
}, | |||
{ | |||
title: '属性', | |||
dataIndex: 'goodsattributeValue', | |||
valueType: 'textarea', | |||
ellipsis: true, | |||
readonly: true, | |||
}, | |||
{ | |||
title: '价格', | |||
dataIndex: 'price', | |||
hideInSearch: true, | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'option', | |||
valueType: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="config" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
更新 | |||
</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={async () => { | |||
await del([record.id]).then((r) => { | |||
if (r.succeeded) { | |||
message.success('删除成功'); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}); | |||
}} | |||
onCancel={() => {}} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
], | |||
}, | |||
]; | |||
const onChangevalue =(data)=>{ | |||
const { name, value } = data.target; | |||
let names=""; | |||
let updatedValues = [...checkvalue]; | |||
for (let index = 0; index <goodsAttriburteData.length; index++) { | |||
if (name === 'radiogroup'+index) { | |||
// 将第一组的值累加到数组中 | |||
updatedValues[index] = value; | |||
} | |||
} | |||
goodsAttriburteData.forEach(item=>{ | |||
for (let index = 0; index < updatedValues.length; index++) { | |||
var bs=item.goodsAttributeValueList.find(x=>x.goodsAttributeValuId==updatedValues[index])?.attributeValue | |||
if(bs){ | |||
names=names+bs; | |||
if(index< updatedValues.length-1){ | |||
names=names+"-" | |||
} | |||
} | |||
} | |||
item.goodsAttributeValueList.forEach(x=>{ | |||
if(value==x.goodsAttributeValuId){ | |||
x.check=true; | |||
item.defalutvalue=value | |||
} | |||
}) | |||
}) | |||
setarttuename(names) | |||
setCheckvalue(updatedValues) | |||
} | |||
const onpriceChange=(value)=>{ | |||
setprice(value) | |||
} | |||
const onsubmit=()=>{ | |||
var check=true; | |||
if(checkvalue.length==0){ | |||
check=false; | |||
message.error("请选择属性"); | |||
} | |||
else if(price<=0){ | |||
check=false; | |||
message.error("价格不能小于0"); | |||
} | |||
if(check){ | |||
var parm={goodsId:props.location.query.values.id,goodsattributeValueId:checkvalue.join(','),Price:price,goodsattributeValue:arttuename} | |||
add(parm).then((r)=>{ | |||
if (r.succeeded) { | |||
message.success('保存成功'); | |||
actionRef.current.reload(); | |||
setCheckvalue([]); | |||
setarttuename(""); | |||
setprice(0) | |||
var gg=goodsAttriburteData.map(x => { | |||
x.goodsAttributeValueList.forEach(t=>{ | |||
t.check=false; | |||
x.defalutvalue="" | |||
}) | |||
return x | |||
}) | |||
setGoodsAttriburteData(gg) | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}) | |||
} | |||
} | |||
const onresetsubmit=()=>{ | |||
setCheckvalue([]); | |||
setarttuename(""); | |||
setprice(0) | |||
var gg=goodsAttriburteData.map(x => { | |||
x.goodsAttributeValueList.forEach(t=>{ | |||
t.check=false; | |||
x.defalutvalue="" | |||
}) | |||
return x | |||
}) | |||
setGoodsAttriburteData(gg) | |||
} | |||
return ( | |||
<> | |||
<PageContainer host header={{ | |||
title: [<a key="back" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/database/goods/newgoods', | |||
}); | |||
}}><ArrowLeftOutlined />返回</a>], | |||
breadcrumb: {}, | |||
}}> | |||
<Card> | |||
<span><span style={{color:'red',marginRight: 3}}>*</span>商品属性</span> | |||
{ | |||
goodsAttriburteData==undefined || goodsAttriburteData.length ==0 ? ( <div style={{fontSize: '12px',marginLeft:10}}>当前商品分类还未配置属性点击跳转 <a | |||
key="primary" | |||
type="primary" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/database/goods/goodstypemanage', | |||
}); | |||
// handleModalVisible(true); | |||
// setCurrentRow(record); | |||
}} | |||
> | |||
添加属性 | |||
</a></div>) :( | |||
goodsAttriburteData.map((item, index) => { | |||
return ( | |||
<div style={{marginLeft: 80,marginBottom:10}}> | |||
<div> | |||
<span style={{marginRight: 10}}> <Tag color="blue">{item.attributeName}</Tag>:</span> | |||
<span> | |||
<Radio.Group name={"radiogroup"+index} buttonStyle="solid" size="small" value={item.defalutvalue} onChange={onChangevalue}> | |||
{ | |||
item.goodsAttributeValueList.map((item, index)=>{ | |||
return ( | |||
<Radio.Button name={index} defaultChecked={item.check} checked={item.check} value={item.goodsAttributeValuId} style={{marginRight: 22, marginTop: 16}}>{item.attributeValue}</Radio.Button> | |||
) | |||
}) | |||
} | |||
</Radio.Group> | |||
</span> | |||
</div> | |||
</div> | |||
); | |||
}) | |||
) | |||
} | |||
<div style={{marginTop:10}}> | |||
<span style={{marginRight:'3%'}}><span style={{color:'red',marginRight: 3}}>*</span>价格:</span><InputNumber value={price} style={{width:'20%'}} onChange={onpriceChange} placeholder="请输入价格"/> | |||
</div> | |||
<div style={{float:'right',position: 'absolute', top: '70%',left: '88%',width: '200px'}}> | |||
<Button htmlType="submit" style={{marginRight:'2%'}} onClick={onresetsubmit}> 重置</Button> | |||
<Button type="primary" htmlType="submit" onClick={onsubmit}> | |||
保存 | |||
</Button> | |||
</div> | |||
</Card> | |||
<EditableProTable | |||
headerTitle="属性价格列表" | |||
actionRef={actionRef} | |||
rowKey="id" | |||
pagination={{ defaultPageSize: 10 }} | |||
search={false} | |||
// toolBarRender={false} | |||
recordCreatorProps={false} | |||
request={async (params) => { | |||
var data = []; | |||
params.goodsId=props.location.query.values.id | |||
var total = 0; | |||
await getpage(params).then((r) => { | |||
data = r.data.data; | |||
total = r.data.total; | |||
}); | |||
return { | |||
data: data, | |||
success: true, | |||
total: total, | |||
}; | |||
}} | |||
columns={columns} | |||
onChange={setDataSource} | |||
editable={{ | |||
type: 'multiple', | |||
editableKeys, | |||
actionRender: (row, config, dom) => [dom.save, dom.cancel], | |||
onSave: async (rowKey, data, row) => { | |||
console.log(rowKey, data, row); | |||
update(data).then((res)=>{ | |||
if (res.succeeded) { | |||
message.success('保存成功'); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}) | |||
//onsubmit() | |||
}, | |||
onChange: setEditableRowKeys, | |||
}} | |||
rowSelection={{ | |||
onChange: (_, selectedRows) => { | |||
setSelectedRows(selectedRows); | |||
}, | |||
}} | |||
/> | |||
{selectedRowsState?.length > 0 && ( | |||
<FooterToolbar | |||
extra={ | |||
<div> | |||
已选择{' '} | |||
<a | |||
style={{ | |||
fontWeight: 600, | |||
}} | |||
> | |||
{selectedRowsState.length} | |||
</a>{' '} | |||
项 | |||
{/* <span> | |||
服务调用次数总计 {selectedRowsState.reduce((pre, item) => pre + item.id, 0)} 万 | |||
</span> */} | |||
</div> | |||
} | |||
> | |||
<Button | |||
onClick={async () => { | |||
await handleRemove(selectedRowsState); | |||
setSelectedRows([]); | |||
actionRef.current?.reloadAndRest?.(); | |||
}} | |||
> | |||
删除 | |||
</Button> | |||
{/* <Button type="primary">批量审批</Button> */} | |||
</FooterToolbar> | |||
)} | |||
</PageContainer> | |||
</> | |||
); | |||
}; | |||
export default goodsattribute; |
@@ -0,0 +1,41 @@ | |||
import { request } from 'umi'; | |||
import { getDataBaseUrl } from '@/global_data'; | |||
/** 获取商品属性列表 sdsa GET /kitchen/api/rule */ | |||
export async function getpage(data) { | |||
return request(getDataBaseUrl()+`/api/goodsattributeprice/getpage`, { | |||
method: 'POST', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function add(data) { | |||
return request(getDataBaseUrl()+`/api/goodsattributeprice/add`, { | |||
method: 'POST', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function update(data) { | |||
return request(getDataBaseUrl()+`/api/goodsattributeprice/update`, { | |||
method: 'POST', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function del(data) { | |||
return request(getDataBaseUrl()+`/api/goodsattributeprice/delete?id=`+data, { | |||
method: 'GET', | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function getbygoodsidattribute (data) { | |||
return request(getDataBaseUrl()+`/api/goodsattribute/getbygoodsidattribute?id=`+data, { | |||
method: 'Get', | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} |
@@ -2,6 +2,7 @@ import React, { useState,useRef,useEffect } from 'react'; | |||
import { PlusOutlined,CheckOutlined} from '@ant-design/icons'; | |||
import { Modal, Form, Input, Button, Select,Radio,message,Tag,Divider,Space } from 'antd'; | |||
import { AddBomType,getbyidbomlist } from '../service'; | |||
import { history } from 'umi'; | |||
import { | |||
EditableProTable, | |||
ProTable | |||
@@ -243,7 +244,20 @@ const GoodsbomFrom = (props) => { | |||
> | |||
<span><span style={{color:'red',marginRight: 3}}>*</span>商品属性</span> | |||
{ | |||
props.goodsAttriburteData == undefined ? '' :( | |||
props.goodsAttriburteData == undefined || props.goodsAttriburteData.length==0 ? ( <div style={{fontSize: '12px',marginLeft:10}}>当前商品分类还未配置属性点击跳转 <a | |||
key="primary" | |||
type="primary" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/database/goods/goodstypemanage', | |||
}); | |||
// handleModalVisible(true); | |||
// setCurrentRow(record); | |||
}} | |||
> | |||
添加属性 | |||
</a></div>) :( | |||
props.goodsAttriburteData.map((item, index) => { | |||
return ( | |||
<div style={{marginLeft: 80,marginBottom:10}}> | |||
@@ -3,6 +3,7 @@ import React, { useState, useRef, useEffect } from 'react'; | |||
import { CloseOutlined, DeleteOutlined, FormOutlined } from '@ant-design/icons'; | |||
import { ProCard } from '@ant-design/pro-Card'; | |||
import { BetaSchemaForm } from '@ant-design/pro-form'; | |||
import { history } from 'umi'; | |||
import { | |||
getbyidgoods, | |||
GetGoodsTechnology, | |||
@@ -473,10 +474,23 @@ const goodstechnologymaken = (props) => { | |||
</Descriptions> | |||
</Card> | |||
<Card bodyStyle={{ padding: 15 }} style={{ display: display }} > | |||
<Card bodyStyle={{ padding: 15 }} > | |||
<div style={{ fontSize: 16, marginBottom: 5, color: '#1890ff', fontWeight: 600 }}>商品属性</div> | |||
{ | |||
goodsinfo.goodsAttributeList == undefined ? '' : ( | |||
goodsinfo.goodsAttributeList == undefined || goodsinfo.goodsAttributeList == "" ? ( <div style={{fontSize: '12px',marginLeft:10}}>当前商品分类还未配置属性点击跳转 <a | |||
key="primary" | |||
type="primary" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/database/goods/goodstypemanage', | |||
}); | |||
// handleModalVisible(true); | |||
// setCurrentRow(record); | |||
}} | |||
> | |||
添加属性 | |||
</a></div>) : ( | |||
goodsinfo.goodsAttributeList.map((item, index) => { | |||
return ( | |||
<div style={{ marginLeft: 10 }}> | |||
@@ -164,7 +164,7 @@ const GoodsManage = () => { | |||
// setCurrentRow(record); | |||
}} | |||
> | |||
商品配方设置 | |||
配方配置 | |||
</a>, | |||
<a | |||
key="primary" | |||
@@ -182,9 +182,25 @@ const GoodsManage = () => { | |||
// setCurrentRow(record); | |||
}} | |||
> | |||
商品工艺设置 | |||
工艺配置 | |||
</a>, | |||
<a | |||
key="primary" | |||
type="primary" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/database/goods/goodsattributeprice', | |||
query: { | |||
isAdd: false, | |||
values: record, | |||
}, | |||
}); | |||
// handleModalVisible(true); | |||
// setCurrentRow(record); | |||
}} | |||
> | |||
价格配置 | |||
</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||