@@ -37,7 +37,7 @@ const CreateForm = (props) => { | |||
message: '邮箱格式不正确', }]}> | |||
<Input placeholder="电子邮件是登录账户" disabled={props.values.id?true:false} /> | |||
</Form.Item> | |||
<Form.Item name="type" label="所属平台" rules={[{ required: true }]}> | |||
{/* <Form.Item name="type" label="所属平台" rules={[{ required: true }]}> | |||
<Select placeholder='请选择所属平台' allowClear options={[ | |||
{ | |||
value: 0, | |||
@@ -52,7 +52,7 @@ message: '邮箱格式不正确', }]}> | |||
label: '后厨', | |||
}, | |||
]}/> | |||
</Form.Item> | |||
</Form.Item> */} | |||
<Form.Item name="phone" label="电话" rules={[{ max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
message: '手机号格式不正确' }]}> | |||
<Input placeholder="请输入电话" /> | |||
@@ -165,23 +165,6 @@ const companyManage = () => { | |||
dataIndex: 'email', | |||
ellipsis: true, | |||
}, | |||
{ | |||
title: '所属平台', | |||
dataIndex: 'type', | |||
valueType: 'select', | |||
ellipsis:true, | |||
valueEnum: { | |||
0: { | |||
text: '团餐', | |||
}, | |||
1: { | |||
text: '门店', | |||
}, | |||
2: { | |||
text: '后厨', | |||
}, | |||
}, | |||
}, | |||
{ | |||
title: '电话', | |||
dataIndex: 'phone', | |||
@@ -261,45 +244,19 @@ const companyManage = () => { | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
<a | |||
// onClick={() => { | |||
// api.GetRoleMenu(record.sysRoleId).then((r) => { | |||
// setRow(r.data); | |||
// handleUpdateMenuModalVisible(true); | |||
// }); | |||
// setStepFormValues(record); | |||
// }} | |||
> | |||
{' '} | |||
LOGO设置 | |||
</a>, | |||
// <a | |||
// // onClick={() => { | |||
// // api.GetRoleMenu(record.sysRoleId).then((r) => { | |||
// // setRow(r.data); | |||
// // handleUpdateMenuModalVisible(true); | |||
// // }); | |||
// // setStepFormValues(record); | |||
// // }} | |||
// > | |||
// {' '} | |||
// LOGO设置 | |||
// </a>, | |||
]; | |||
//供应商下架 | |||
template.push( | |||
<a | |||
key="primary" | |||
onClick={() => { | |||
// record.status = record.status == 0 ? 0 : 0; | |||
if (record.status == 1) { | |||
//启用 | |||
api.Enable(record.id).then((r) => { | |||
message.success('启用成功,即将刷新'); | |||
actionRef.current.reload(); | |||
}); | |||
} else { | |||
//禁用 | |||
api.Disable(record.id).then((r) => { | |||
message.success('禁用成功,即将刷新'); | |||
actionRef.current.reload(); | |||
}); | |||
} | |||
}} | |||
> | |||
{' '} | |||
{record.status == 0 ? '禁用' : '启用'} | |||
</a>, | |||
); | |||
return template; | |||
}, | |||
}, | |||
@@ -7,7 +7,7 @@ import styles from './style.less'; | |||
import api from '../service' | |||
const fieldLabels = { | |||
name: '物料名称', | |||
stockUint: '库存单位', | |||
stockUint: '物料单位', | |||
specs: '物料规格', | |||
code: '物料编码', | |||
aittribute: '物料属性', | |||
@@ -264,6 +264,12 @@ const CreateForm = (props) => { | |||
label={fieldLabels.typeID} | |||
name="typeID" | |||
style={{width: 235,}} | |||
rules={[ | |||
{ | |||
required: true, | |||
message: '请选择物料类别', | |||
}, | |||
]} | |||
placeholder="请选择物料类别" | |||
fieldProps={{ | |||
dropdownRender:(menu) => ( | |||
@@ -340,7 +346,7 @@ const CreateForm = (props) => { | |||
options={itemsuity} | |||
/> | |||
</Col> | |||
<Col lg={8} md={12} sm={24}> | |||
{/* <Col lg={8} md={12} sm={24}> | |||
<ProFormSelect | |||
label={fieldLabels.OutstockUint} | |||
name="outstockUint" | |||
@@ -353,7 +359,7 @@ const CreateForm = (props) => { | |||
request={async () => itemsuity} | |||
placeholder="请选择出库单位" | |||
/> | |||
</Col> | |||
</Col> */} | |||
<Col lg={8} md={12} sm={24}> | |||
<ProFormDigit | |||
label={fieldLabels.proportion} | |||
@@ -390,13 +396,13 @@ const CreateForm = (props) => { | |||
placeholder="请选择状态" | |||
/> | |||
</Col> */} | |||
<Col lg={8} md={12} sm={24}> | |||
{/* <Col lg={8} md={12} sm={24}> | |||
<ProFormText | |||
label={fieldLabels.foreignKeyRe} | |||
name="foreignKeyRe" | |||
placeholder="请输入关联外键" | |||
/> | |||
</Col> | |||
</Col> */} | |||
</Row> | |||
{/* <ProForm.Item name="membersList" trigger="onValuesChange"> | |||
<EditableProTable | |||
@@ -179,25 +179,30 @@ const ProductManage = () => { | |||
dataIndex: 'code', | |||
ellipsis: true, | |||
}, | |||
{ | |||
title: '关联外键', | |||
dataIndex: 'foreignKeyRe', | |||
}, | |||
// { | |||
// title: '关联外键', | |||
// dataIndex: 'foreignKeyRe', | |||
// hideInSearch: true, | |||
// }, | |||
{ | |||
title: '物料规格', | |||
dataIndex: 'specs', | |||
hideInSearch: true, | |||
}, | |||
{ | |||
title: '成本价', | |||
dataIndex: 'price', | |||
hideInSearch: true, | |||
}, | |||
{ | |||
title: '净料率(%)', | |||
dataIndex: 'netrecovery', | |||
hideInSearch: true, | |||
}, | |||
{ | |||
title: '物料属性', | |||
dataIndex: 'aittribute', | |||
hideInSearch: true, | |||
valueEnum: { | |||
0: { | |||
text: '成品', | |||
@@ -214,12 +219,13 @@ const ProductManage = () => { | |||
title: '物料类别', | |||
dataIndex: 'typeID', | |||
valueType: 'select', | |||
hideInSearch: true, | |||
fieldProps: { | |||
options: TypeList, | |||
}, | |||
}, | |||
{ | |||
title: '库存单位', | |||
title: '物料单位', | |||
dataIndex: 'stockUint', | |||
valueType: 'select', | |||
fieldProps: { | |||
@@ -263,23 +269,6 @@ const ProductManage = () => { | |||
{' '} | |||
更新 | |||
</a>, | |||
<a | |||
key="primary" | |||
onClick={() => { | |||
var parm={id:record.id,status:record.status == 0 ? 1 : 0} | |||
api.updateStatus(parm).then((r) => { | |||
if (r.succeeded) { | |||
message.success('操作成功'); | |||
actionRef.current.reload(); | |||
}else{ | |||
message.error(e.error); | |||
} | |||
}); | |||
}} | |||
> | |||
{' '} | |||
{record.status == 0 ? '禁用' : '启用'} | |||
</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
@@ -147,7 +147,7 @@ const Advanced = (props) => { | |||
initGoodsUnit(); | |||
initGoodsType(); | |||
initGetbomType(); | |||
intBatching(); | |||
//intBatching();//默认原料 | |||
//} | |||
}, [tabStatus]) | |||
@@ -191,11 +191,11 @@ const Advanced = (props) => { | |||
}) | |||
} | |||
function intBatching(){ | |||
getproductpage().then((r) => { | |||
setMatedata(r.data); | |||
}); | |||
} | |||
// function intBatching(){ | |||
// getproductpage().then((r) => { | |||
// setMatedata(r.data); | |||
// }); | |||
// } | |||
function initTypeList(){ | |||
initGetbomType(); | |||
} | |||
@@ -404,7 +404,7 @@ const Advanced = (props) => { | |||
/> | |||
</Form.Item> | |||
<Form.Item name="price" label="商品价格" rules={[{ required: true }]}> | |||
<InputNumber placeholder="价格" min={0} /> | |||
<InputNumber style={{ width: '100%' }} placeholder="价格" min={0} /> | |||
</Form.Item> | |||
<Form.Item name="goodsTypeId" label="商品类型" rules={[{ required: true }]}> | |||
<TreeSelect | |||
@@ -417,10 +417,7 @@ const Advanced = (props) => { | |||
treeDefaultExpandAll | |||
/> | |||
</Form.Item> | |||
<Form.Item name="foreignKeyRe" label="关联外键" rules={[{ required: false }]}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="defaultMate" label="默认原料" rules={[{ required: false }]}> | |||
{/* <Form.Item name="defaultMate" label="默认原料" rules={[{ required: false }]}> | |||
<Select mode="multiple" allowClear> | |||
{ | |||
matedata == undefined ? '' : ( | |||
@@ -434,13 +431,20 @@ const Advanced = (props) => { | |||
) | |||
} | |||
</Select> | |||
</Form.Item> */} | |||
<Form.Item label="是否称重" name="isWeigh" valuePropName="checked" > | |||
<Switch checkedChildren="是" unCheckedChildren="否" defaultChecked={false} /> | |||
</Form.Item> | |||
<Form.Item name="remark" label="备注"> | |||
<Input /> | |||
<Form.Item label="是否多属性" name="isAttrubute" valuePropName="checked"> | |||
<Switch checkedChildren="是" unCheckedChildren="否" defaultChecked={false} /> | |||
</Form.Item> | |||
<Form.Item name="design" label="规格" > | |||
<Form.Item name="descritption" label="备注"> | |||
<TextArea rows={4} /> | |||
</Form.Item> | |||
{/* <Form.Item name="design" label="规格" > | |||
<TextArea rows={4} /> | |||
</Form.Item> | |||
</Form.Item> */} | |||
<Form.Item name="imgUrl" hidden={true} > | |||
<Input /> | |||
</Form.Item> | |||
@@ -455,12 +459,6 @@ const Advanced = (props) => { | |||
</Upload> | |||
</Form.Item> | |||
<Form.Item label="是否称重" name="isWeigh" valuePropName="checked" initialValue='false' > | |||
<Switch checkedChildren="是" unCheckedChildren="否" defaultChecked='false' /> | |||
</Form.Item> | |||
<Form.Item label="是否多属性" name="isAttrubute" valuePropName="checked" initialValue='false'> | |||
<Switch checkedChildren="是" unCheckedChildren="否" defaultChecked="false" /> | |||
</Form.Item> | |||
<Form.Item> | |||
<Button type="primary" htmlType="submit"> | |||
保存 | |||
@@ -1,15 +1,60 @@ | |||
import React from 'react'; | |||
import React, { useState,useEffect } from 'react'; | |||
import { Modal, Form, Input, Button, Select,InputNumber,TreeSelect } from 'antd'; | |||
import { | |||
EditableProTable | |||
} from '@ant-design/pro-table'; | |||
const CreateForm = (props) => { | |||
const [dataSource, setDataSource] = useState([]); | |||
const [editableKeys, setEditableRowKeys] = useState([]); | |||
const [form] = Form.useForm(); | |||
const columns=[ | |||
{ | |||
title: '名称', | |||
dataIndex: 'attributeValue', | |||
formItemProps: (form, { rowIndex }) => { | |||
return { | |||
rules: | |||
rowIndex > 1 ? [{ required: true, message: '此项为必填项' }] : [], | |||
}; | |||
}, | |||
width: '25%', | |||
}, | |||
{ | |||
title: '排序', | |||
dataIndex: 'sort', | |||
valueType:'digit', | |||
width: '15%', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
width: '15%', | |||
render: () => { | |||
return null; | |||
}, | |||
}, | |||
] | |||
const headleOk=()=>{ | |||
form | |||
.validateFields() | |||
.then((values) => { | |||
// console.log("dataSource",dataSource) | |||
// console.log("values",values) | |||
values.goodsAttributeValueList=dataSource | |||
props.onFinish(values) | |||
}) | |||
} | |||
return ( | |||
<Modal | |||
title={props.values.id ? '编辑' : '新建'} | |||
width={640} | |||
visible={props.createModalVisible} | |||
bodyStyle={{ padding: '32px 40px 1px 48px' }} | |||
footer={null} | |||
// footer={null} | |||
okText="确认" | |||
cancelText="取消" | |||
onOk={headleOk} | |||
onCancel={() => { | |||
props.onCancel(); | |||
}} | |||
@@ -18,8 +63,9 @@ const CreateForm = (props) => { | |||
<Form | |||
labelCol={{ span: 4 }} | |||
layout="horizontal" | |||
initialValues={props.values} | |||
onFinish={props.onFinish} | |||
// initialValues={props.values} | |||
form={form} | |||
// onFinish={props.onFinish} | |||
> | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
@@ -27,28 +73,8 @@ const CreateForm = (props) => { | |||
<Form.Item name="attributeName" label="属性名称" rules={[{ required: true,max:50 }]}> | |||
<Input /> | |||
</Form.Item> | |||
{/* <Form.Item | |||
name="goodsTypeId" | |||
label="商品小类" | |||
rules={[{ required: true, message: '请选择状态' }]} | |||
> | |||
<Select mode="multiple" allowClear> | |||
{ | |||
props.goodstypeData == undefined ? '' :( | |||
props.goodstypeData.map((item, index) => { | |||
return ( | |||
<Select.Option index={index} value={item.value} key={item.value}> | |||
{item.label} | |||
</Select.Option> | |||
); | |||
}) | |||
) | |||
} | |||
</Select> | |||
</Form.Item> */} | |||
<Form.Item name="goodsTypeId" label="商品类型" rules={[{ required: true }]}> | |||
{/* <Form.Item name="goodsTypeId" label="商品类型" rules={[{ required: true }]}> | |||
<TreeSelect | |||
allowClear | |||
showSearch | |||
@@ -61,19 +87,81 @@ const CreateForm = (props) => { | |||
placeholder="请选择商品类型" | |||
treeDefaultExpandAll | |||
/> | |||
</Form.Item> | |||
</Form.Item> */} | |||
<Form.Item name="sort" label="排序" rules={[{ required: true, message: '请输入排序号' }]} > | |||
<InputNumber /> | |||
<InputNumber style={{width:'100%'}} /> | |||
</Form.Item> | |||
<Form.Item> | |||
{/* <Form.Item> | |||
<Button htmlType="button" style={{float:'right',left:10}} onClick={props.onCancel} > | |||
取消 | |||
</Button> | |||
<Button type="primary" htmlType="submit" style={{float:'right'}} > | |||
保存 | |||
</Button> | |||
</Form.Item> | |||
</Form.Item> */} | |||
</Form> | |||
<EditableProTable | |||
headerTitle={<span style={{fontSize:14}}><span style={{color:'red',marginRight: 3}}>*</span>属性值设置</span>} | |||
columns={columns} | |||
rowKey="id" | |||
request={async () => { | |||
var Data = []; | |||
var total=0; | |||
// await getgoodsattributevalue(props.attributeid).then(r=>{ | |||
// Data=r.data | |||
// total=r.data.length | |||
// setDataSource(r.data); | |||
// setEditableRowKeys(r.data.map((item)=>item.id)) | |||
// }) | |||
// return { | |||
// data: Data, | |||
// success: true, | |||
// total: total, | |||
// }; | |||
}} | |||
value={dataSource} | |||
onChange={setDataSource} | |||
recordCreatorProps={{ | |||
newRecordType: 'dataSource', | |||
record: () => ({ | |||
id: Date.now(), | |||
}), | |||
}} | |||
// toolBarRender={() => { | |||
// return [ | |||
// <Button | |||
// type="primary" | |||
// key="save" | |||
// onClick={() => { | |||
// // dataSource 就是当前数据,可以调用 api 将其保存 | |||
// props.onFinish(dataSource) | |||
// console.log(dataSource); | |||
// }} | |||
// > | |||
// 保存数据 | |||
// </Button>, | |||
// ]; | |||
// }} | |||
editable={{ | |||
type: 'multiple', | |||
editableKeys, | |||
actionRender: (row, config, defaultDoms) => { | |||
return [defaultDoms.delete,defaultDoms.Button]; | |||
}, | |||
onValuesChange: (record, recordList) => { | |||
setDataSource(recordList); | |||
}, | |||
onDelete:async (key, row) =>{ | |||
console.log(key) | |||
console.log(row) | |||
// await deletegoodsattributevalue(key).then(r=>{ | |||
// }) | |||
}, | |||
onChange: setEditableRowKeys, | |||
}} | |||
/> | |||
</Modal> | |||
); | |||
}; | |||
@@ -18,7 +18,7 @@ import { | |||
const goodsattribute = () => { | |||
const goodsattribute = (props) => { | |||
/** 新建/更新窗口的弹窗 */ | |||
const [createModalVisible, handleModalVisible] = useState(false); | |||
const [createattrModalVisible, handleMattrodalVisible] = useState(false); | |||
@@ -68,7 +68,6 @@ const goodsattribute = () => { | |||
*/ | |||
const handleAdd = async (fields) => { | |||
const hide = message.loading('正在添加'); | |||
fields.createBy = 'admin'; | |||
try { | |||
await addgoodsattribute(JSON.stringify(fields)).then((r) => { | |||
if (r.succeeded) { | |||
@@ -143,16 +142,16 @@ const handleUpdate = async (fields) => { | |||
ellipsis: true, | |||
}, | |||
{ | |||
title: '商品类型', | |||
dataIndex: 'goodsTypeName', | |||
valueType: 'treeSelect', | |||
fieldProps: { | |||
showSearch:true, | |||
allowClear:true, | |||
options: treeData | |||
}, | |||
}, | |||
// { | |||
// title: '商品类型', | |||
// dataIndex: 'goodsTypeName', | |||
// valueType: 'treeSelect', | |||
// fieldProps: { | |||
// showSearch:true, | |||
// allowClear:true, | |||
// options: treeData | |||
// }, | |||
// }, | |||
{ | |||
title: '排序', | |||
dataIndex: 'sort', | |||
@@ -163,17 +162,17 @@ const handleUpdate = async (fields) => { | |||
dataIndex: 'option', | |||
valueType: 'option', | |||
render: (_, record) => [ | |||
<a | |||
key="state" | |||
onClick={async () => { | |||
setAttributeid(record.id); | |||
handleMattrodalVisible(true); | |||
setCurrentRow(record); | |||
// <a | |||
// key="state" | |||
// onClick={async () => { | |||
// setAttributeid(record.id); | |||
// handleMattrodalVisible(true); | |||
// setCurrentRow(record); | |||
}} | |||
> | |||
添加属性值 | |||
</a>, | |||
// }} | |||
// > | |||
// 添加属性值 | |||
// </a>, | |||
<a | |||
key="config" | |||
onClick={() => { | |||
@@ -320,7 +319,9 @@ const handleUpdate = async (fields) => { | |||
<CreateAttribute | |||
onFinish={async (value) => { | |||
console.log(value) | |||
console.log("value",value) | |||
console.log("props.currentRow",props.currentRow) | |||
value.goodsTypeId=props.currentRow.id; | |||
var data=value.map(x=>{ | |||
x.GoodsAttributeId=currentRow.id; | |||
return x; | |||
@@ -0,0 +1,327 @@ | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import { Button, message, Input, Drawer, Popconfirm } 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 ProDescriptions from '@ant-design/pro-descriptions'; | |||
import CreateAttributeValue from './CreateAttributeValue'; | |||
import { | |||
getgoodsattributepage, | |||
addgoodsattribute, | |||
deletegoodsattribute, | |||
deletegoodsattributevalue, | |||
addgoodsattributevalue, | |||
} from '../service'; | |||
const goodsattribute = (props) => { | |||
/** 新建/更新窗口的弹窗 */ | |||
const [createModalVisible, handleModalVisible] = useState(false); | |||
const [createattrModalVisible, handleMattrodalVisible] = useState(false); | |||
/** 分布更新窗口的弹窗 */ | |||
const [goodstypeData, setGoodstypeData] = useState([]); | |||
const [attributeid, setAttributeid] = useState(''); | |||
const actionRef = useRef(); | |||
const [currentRow, setCurrentRow] = useState(); | |||
const [selectedRowsState, setSelectedRows] = useState([]); | |||
const [treeData, setTreeData] = useState(); | |||
/** 国际化修改 */ | |||
useEffect(() => { | |||
intDicData(); | |||
}, []); | |||
function intDicData() { | |||
// gettree().then((r) => { | |||
// setTreeData(r.data); | |||
// }); | |||
} | |||
/** | |||
* 批量删除 | |||
* | |||
* @param selectedRows | |||
*/ | |||
const handleRemove = async (selectedRows) => { | |||
const hide = message.loading('正在删除'); | |||
if (!selectedRows) return true; | |||
await deletegoodsattribute(selectedRows.map((row) => row.id)).then((r) => { | |||
if (r.succeeded) { | |||
message.success('删除成功'); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}); | |||
hide(); | |||
return true; | |||
}; | |||
/** | |||
* 添加节点 | |||
* | |||
* @param fields | |||
*/ | |||
const handleAdd = async (fields) => { | |||
const hide = message.loading('正在添加'); | |||
try { | |||
await addgoodsattribute(JSON.stringify(fields)).then((r) => { | |||
if (r.succeeded) { | |||
message.success('添加成功'); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}); | |||
hide(); | |||
return true; | |||
} catch (error) { | |||
hide(); | |||
message.error('添加失败请重试!'); | |||
return false; | |||
} | |||
}; | |||
/** | |||
* 更新节点去 | |||
* | |||
* @param fields | |||
*/ | |||
const handleUpdate = async (fields) => { | |||
const hide = message.loading('正在修改'); | |||
try { | |||
await addgoodsattribute(fields).then((r) => { | |||
if (r.succeeded) { | |||
message.success('修改成功'); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}); | |||
hide(); | |||
return true; | |||
} catch (error) { | |||
hide(); | |||
message.error('修改失败请重试!'); | |||
return false; | |||
} | |||
}; | |||
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: 'attributeName', | |||
valueType: 'textarea', | |||
ellipsis: true, | |||
}, | |||
// { | |||
// title: '商品类型', | |||
// dataIndex: 'goodsTypeName', | |||
// valueType: 'treeSelect', | |||
// fieldProps: { | |||
// showSearch:true, | |||
// allowClear:true, | |||
// options: treeData | |||
// }, | |||
// }, | |||
{ | |||
title: '排序', | |||
dataIndex: 'sort', | |||
hideInSearch: true, | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'option', | |||
valueType: 'option', | |||
render: (_, record) => [ | |||
// <a | |||
// key="state" | |||
// onClick={async () => { | |||
// setAttributeid(record.id); | |||
// handleMattrodalVisible(true); | |||
// setCurrentRow(record); | |||
// }} | |||
// > | |||
// 添加属性值 | |||
// </a>, | |||
<a | |||
key="config" | |||
onClick={() => { | |||
handleModalVisible(true); | |||
setCurrentRow(record); | |||
}} | |||
> | |||
更新 | |||
</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="删除属性后会将属性的值一起删除,确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={async () => { | |||
await deletegoodsattribute([record.id]).then((r) => { | |||
if (r.succeeded) { | |||
message.success('删除成功'); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}); | |||
}} | |||
onCancel={() => {}} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
], | |||
}, | |||
]; | |||
return ( | |||
<PageContainer host header={{ | |||
title: '', | |||
breadcrumb: {}, | |||
}}> | |||
<ProTable | |||
headerTitle="查询表格" | |||
actionRef={actionRef} | |||
rowKey="id" | |||
pagination={{ defaultPageSize: 10 }} | |||
search={{ | |||
labelWidth: 120, | |||
}} | |||
toolBarRender={() => [ | |||
<Button | |||
type="primary" | |||
key="primary" | |||
onClick={() => { | |||
handleModalVisible(true); | |||
}} | |||
> | |||
<PlusOutlined /> 新建 | |||
</Button>, | |||
]} | |||
request={async (params) => { | |||
var goodsData = []; | |||
var total = 0; | |||
params.goodsTypeId=props.currentRow.id | |||
await getgoodsattributepage(params).then((r) => { | |||
goodsData = r.data.data; | |||
goodsData.forEach((x) => { | |||
if(x.goodsTypeId!=null){ | |||
x.goodsTypeId =x.goodsTypeId.split(","); | |||
} | |||
}); | |||
total = r.data.total; | |||
}); | |||
return { | |||
data: goodsData, | |||
success: true, | |||
total: total, | |||
}; | |||
}} | |||
columns={columns} | |||
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> | |||
)} | |||
<CreateAttributeValue | |||
onFinish={async (value) => { | |||
console.log(value) | |||
value.goodsTypeId=props.currentRow.id | |||
var success = false; | |||
if (value.id) { | |||
success = await handleUpdate(value); | |||
} else { | |||
success = await handleAdd(value); | |||
} | |||
if (success) { | |||
handleModalVisible(false); | |||
setCurrentRow(undefined); | |||
if (actionRef.current) { | |||
actionRef.current.reload(); | |||
} | |||
} | |||
}} | |||
onCancel={() => { | |||
handleModalVisible(false); | |||
setCurrentRow(undefined); | |||
}} | |||
deletattrvalue={(id)=>{ | |||
console.log('删除',id) | |||
deletegoodsattributevalue(id).then((r)=>{ | |||
if (r.succeeded) { | |||
message.success('删除成功'); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}) | |||
}} | |||
createModalVisible={createModalVisible} | |||
values={currentRow || {}} | |||
/> | |||
</PageContainer> | |||
); | |||
}; | |||
export default goodsattribute; |
@@ -0,0 +1,158 @@ | |||
import React, { useState,useEffect } from 'react'; | |||
import { Modal, Form, Input, Button, Select,InputNumber,Popconfirm } from 'antd'; | |||
import { | |||
EditableProTable | |||
} from '@ant-design/pro-table'; | |||
const CreateForm = (props) => { | |||
const [dataSource, setDataSource] = useState([]); | |||
const [editableKeys, setEditableRowKeys] = useState([]); | |||
const [form] = Form.useForm(); | |||
const columns=[ | |||
{ | |||
title: '名称', | |||
dataIndex: 'attributeValue', | |||
formItemProps: (form, { rowIndex }) => { | |||
return { | |||
rules: | |||
rowIndex > 1 ? [{ required: true, message: '此项为必填项' }] : [], | |||
}; | |||
}, | |||
width: '25%', | |||
}, | |||
{ | |||
title: '排序', | |||
dataIndex: 'sort', | |||
valueType:'digit', | |||
width: '15%', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
width: '15%', | |||
render: (_, record) => [ | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={async () => { | |||
props.deletattrvalue(record.id); | |||
setDataSource(dataSource.filter((item) => item.id !== record.id)); | |||
// await deletegoodsattribute([record.id]).then((r) => { | |||
// if (r.succeeded) { | |||
// message.success('删除成功'); | |||
// actionRef.current.reload(); | |||
// } else { | |||
// message.error(r.errors); | |||
// } | |||
// }); | |||
}} | |||
onCancel={() => {}} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm> | |||
], | |||
}, | |||
] | |||
useEffect(() => { | |||
console.log("props.values",props.values) | |||
if(props.values?.id){ | |||
form.setFieldsValue({ | |||
id:props.values?.id, | |||
attributeName:props.values?.attributeName, | |||
sort:props.values?.sort | |||
}) | |||
setEditableRowKeys(props.values?.attributeValueList.map((item) => item.id)) | |||
setDataSource(props.values?.attributeValueList) | |||
}else{ | |||
form.setFieldsValue({ | |||
id:'', | |||
attributeName:'', | |||
sort:0 | |||
}) | |||
setDataSource(props.values?.attributeValueList) | |||
} | |||
}, [props.values]); | |||
const headleOk=()=>{ | |||
form | |||
.validateFields() | |||
.then((values) => { | |||
values.goodsAttributeValueList=dataSource | |||
console.log("dataSource",dataSource) | |||
console.log("values",values) | |||
props.onFinish(values) | |||
}) | |||
} | |||
return ( | |||
<Modal | |||
title={props.values.id ? '编辑' : '新建'} | |||
width={640} | |||
visible={props.createModalVisible} | |||
bodyStyle={{ padding: '32px 40px 1px 48px' }} | |||
// footer={null} | |||
okText="确认" | |||
cancelText="取消" | |||
onOk={headleOk} | |||
onCancel={() => { | |||
props.onCancel(); | |||
}} | |||
destroyOnClose | |||
> | |||
<Form | |||
labelCol={{ span: 4 }} | |||
layout="horizontal" | |||
// initialValues={props.values} | |||
form={form} | |||
// onFinish={props.onFinish} | |||
> | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="attributeName" label="属性名称" rules={[{ required: true,max:50 }]}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="sort" label="排序" rules={[{ required: true, message: '请输入排序号' }]} > | |||
<InputNumber style={{width:'100%'}} /> | |||
</Form.Item> | |||
</Form> | |||
<EditableProTable | |||
headerTitle={<span style={{fontSize:14}}><span style={{color:'red',marginRight: 3}}>*</span>属性值设置</span>} | |||
columns={columns} | |||
rowKey="id" | |||
value={dataSource} | |||
onChange={setDataSource} | |||
recordCreatorProps={{ | |||
newRecordType: 'dataSource', | |||
record: () => ({ | |||
id: Date.now(), | |||
}), | |||
}} | |||
editable={{ | |||
type: 'multiple', | |||
editableKeys, | |||
actionRender: (row, config, defaultDoms) => { | |||
return [defaultDoms.delete,defaultDoms.Button]; | |||
}, | |||
onValuesChange: (record, recordList) => { | |||
setDataSource(recordList); | |||
}, | |||
onDelete:async (key, row) =>{ | |||
console.log(key) | |||
console.log(row) | |||
props.deletattrvalue(key); | |||
// await deletegoodsattributevalue(key).then(r=>{ | |||
// }) | |||
}, | |||
onChange: setEditableRowKeys, | |||
}} | |||
/> | |||
</Modal> | |||
); | |||
}; | |||
export default CreateForm; |
@@ -7,7 +7,7 @@ const CreateForm = (props) => { | |||
<Modal | |||
title={props.values.id ? '编辑' : '新建'} | |||
width={640} | |||
visible={props.createModalVisible} | |||
visible={props.createformModalVisible} | |||
bodyStyle={{ padding: '32px 40px 1px 48px' }} | |||
footer={null} | |||
onCancel={() => { | |||
@@ -1,11 +1,11 @@ | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import { Button, message, Input, Drawer, Popconfirm } from 'antd'; | |||
import { Button, message, Input, Drawer, Popconfirm,Modal } 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 ProDescriptions from '@ant-design/pro-descriptions'; | |||
import CreateForm from './components/CreateForm'; | |||
import GoodsAttribute from './components/CreateAttribute'; | |||
import { | |||
goodsType, | |||
addGoodsType, | |||
@@ -20,7 +20,7 @@ import { | |||
const GoodsTypeManage = () => { | |||
/** 新建/更新窗口的弹窗 */ | |||
const [createModalVisible, handleModalVisible] = useState(false); | |||
const [createformModalVisible, handleModalVisible] = useState(false); | |||
/** 分布更新窗口的弹窗 */ | |||
const [dicData, setDicData] = useState([]); | |||
@@ -29,6 +29,7 @@ const GoodsTypeManage = () => { | |||
const [currentRow, setCurrentRow] = useState(); | |||
const [selectedRowsState, setSelectedRows] = useState([]); | |||
const [treeData, setTreeData] = useState(); | |||
const [GoodsAttributeVisible,setGoodsAttributeVisible]= useState(false); | |||
/** 国际化修改 */ | |||
useEffect(() => { | |||
@@ -119,6 +120,10 @@ const handleAdd = async (fields) => { | |||
hide(); | |||
return true; | |||
}; | |||
const onGoodsAttributeCancel=()=>{ | |||
setGoodsAttributeVisible(false); | |||
setCurrentRow({}); | |||
} | |||
const columns = [ | |||
{ | |||
title: '主键', | |||
@@ -179,34 +184,25 @@ const handleAdd = async (fields) => { | |||
dataIndex: 'option', | |||
valueType: 'option', | |||
render: (_, record) => [ | |||
<a | |||
key="state" | |||
onClick={async () => { | |||
let a = 0; | |||
if (record.status == 0) { | |||
a = 1; | |||
} | |||
setCurrentRow((record.status = a)); | |||
await handleUpdate(record).then((r) => { | |||
if (r) { | |||
actionRef.current.reload(); | |||
} else { | |||
message.error('配置失败请重试!'); | |||
} | |||
}); | |||
key="config" | |||
onClick={() => { | |||
handleModalVisible(true); | |||
setCurrentRow(record); | |||
}} | |||
> | |||
{record.status == 0 ? '禁用' : '启用'} | |||
更新 | |||
</a>, | |||
<a | |||
key="config" | |||
onClick={() => { | |||
handleModalVisible(true); | |||
setGoodsAttributeVisible(true); | |||
setCurrentRow(record); | |||
}} | |||
> | |||
更新 | |||
添加属性 | |||
</a>, | |||
<Popconfirm | |||
type="primary" | |||
@@ -351,9 +347,20 @@ const handleAdd = async (fields) => { | |||
handleModalVisible(false); | |||
setCurrentRow(undefined); | |||
}} | |||
createModalVisible={createModalVisible} | |||
createformModalVisible={createformModalVisible} | |||
values={currentRow || {}} | |||
/> | |||
<Modal title={'属性'} | |||
width={1040} | |||
visible={GoodsAttributeVisible} | |||
bodyStyle={{ padding: '32px 40px 1px 48px' }} | |||
footer={null} | |||
onCancel={() => { | |||
onGoodsAttributeCancel(); | |||
}} | |||
destroyOnClose> | |||
<GoodsAttribute currentRow={currentRow}/> | |||
</Modal> | |||
<Drawer | |||
width={600} | |||
@@ -67,4 +67,42 @@ export async function gettree(params) { | |||
}, | |||
}); | |||
} | |||
export async function getgoodsattributepage(data) { | |||
return request(`/saasbase/api/goodsattribute/getgoodsattributepage`, { | |||
method: 'POST', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function addgoodsattribute(data) { | |||
return request(`/saasbase/api/goodsattribute/addgoodsattribute`, { | |||
method: 'POST', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function deletegoodsattribute(data) { | |||
return request(`/saasbase/api/goodsattribute/deletegoodsattribute`, { | |||
method: 'POST', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function addgoodsattributevalue(data) { | |||
return request(`/saasbase/api/goodsattribute/addgoodsattributevalue`, { | |||
method: 'POST', | |||
data: data, | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} | |||
export async function deletegoodsattributevalue(data) { | |||
return request(`/saasbase/api/goodsattribute/deletegoodsattributevalue?id=`+data, { | |||
method: 'GET', | |||
// params: { ...params }, | |||
// ...(options || {}), | |||
}); | |||
} |
@@ -159,7 +159,7 @@ const GoodsManage = () => { | |||
valueType: 'textarea', | |||
}, | |||
{ | |||
title: '基础价格', | |||
title: '商品价格', | |||
dataIndex: 'price', | |||
hideInForm: true, | |||
renderText: (val) => `${val}¥`, | |||
@@ -176,34 +176,6 @@ const GoodsManage = () => { | |||
options: treeData | |||
}, | |||
}, | |||
{ | |||
title: '商品类型', | |||
dataIndex: 'goodsTypeId', | |||
hideInForm: true, | |||
hideInTable: true, | |||
// hideInSearch: true, | |||
valueEnum: goodsTypes, | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'status', | |||
hideInForm: true, | |||
valueEnum: { | |||
0: { | |||
text: '正常', | |||
status: 'Processing', | |||
}, | |||
1: { | |||
text: '停用', | |||
status: 'Error', | |||
}, | |||
2: { | |||
text: '删除', | |||
status: 'Error', | |||
}, | |||
}, | |||
}, | |||
// { | |||
// title: '创建时间', | |||
// dataIndex: 'createAt', | |||
@@ -211,7 +183,7 @@ const GoodsManage = () => { | |||
// }, | |||
{ | |||
title: '备注', | |||
dataIndex: 'remark', | |||
dataIndex: 'descritption', | |||
ellipsis: true, | |||
tip: '标题过长会自动收缩', | |||
}, | |||
@@ -276,31 +248,7 @@ const GoodsManage = () => { | |||
> | |||
商品工艺设置 | |||
</a>, | |||
record.status === 0 && | |||
(( | |||
<a | |||
key="link" | |||
onClick={() => { | |||
record.status = '1'; | |||
handleUpdate(record); | |||
actionRef.current.reload(); | |||
}} | |||
> | |||
停用 | |||
</a> | |||
)), | |||
(record.status === 1 || record.status === 2) && ( | |||
<a | |||
key="warn" | |||
onClick={() => { | |||
record.status = '0'; | |||
handleUpdate(record); | |||
actionRef.current.reload(); | |||
}} | |||
> | |||
启用 | |||
</a> | |||
), | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
@@ -90,9 +90,6 @@ const CreateForm = (props) => { | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item label={"版本号"} name="vesion" rules={[{ required: true,max:50}]} > | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item label={"所属产品"} name="productId" rules={[{ required: true,max:50}]} > | |||
<Select> | |||
{props.dicData.map((item, index) => { | |||
@@ -104,6 +101,10 @@ const CreateForm = (props) => { | |||
})} | |||
</Select> | |||
</Form.Item> | |||
<Form.Item label={"版本号"} name="vesion" rules={[{ required: true,max:50}]} > | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item> | |||
<Button type="primary" htmlType="submit"> | |||
保存 | |||
@@ -1,5 +1,5 @@ | |||
import { Modal, Button, message, Form, Upload, Tag } from 'antd'; | |||
import { Modal, Button, message, Form, Upload, Tag ,Popconfirm} from 'antd'; | |||
import React, { useState, useRef, useEffect } from 'react'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
@@ -136,15 +136,6 @@ const GoodsTypeManage = () => { | |||
dataIndex: 'productName', | |||
valueType: 'textarea', | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'status', | |||
valueEnum: { | |||
0: { text: '启用', status: 'Processing' }, | |||
1: { text: '禁用', status: 'Success' }, | |||
}, | |||
hideInSearch: true, | |||
}, | |||
{ | |||
title: '是否存在模板', | |||
dataIndex: 'templatePath', | |||
@@ -169,23 +160,28 @@ const GoodsTypeManage = () => { | |||
setCurrentRow(record); | |||
// form.setFielsValue(record) | |||
}} > 更新</a>, | |||
<a | |||
key="primary" | |||
onClick={() => { | |||
var parm={id:record.id,status:record.status == 0 ? 1 : 0} | |||
UpdateStatus(parm).then((r) => { | |||
if (r.succeeded) { | |||
message.success('操作成功'); | |||
<Popconfirm | |||
type="primary" | |||
key="primary11" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={() => { | |||
DelDeviceVesion([record.id]).then((r) => { | |||
if (r.data) { | |||
message.success('删除成功'); | |||
actionRef.current.reload(); | |||
}else{ | |||
message.error(e.error); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}); | |||
}} | |||
onCancel={() => { }} | |||
> | |||
{' '} | |||
{record.status == 0 ? '禁用' : '启用'} | |||
</a>, | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
<a | |||
key="config" | |||
onClick={() => { | |||
@@ -26,7 +26,7 @@ const CreateForm = (props) => { | |||
<Form.Item label={"产品名称"} name="name" rules={[{ required: true,max:50}]} > | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item label={"产品标签"} name="code" rules={[{ required: true,max:50}]} > | |||
<Form.Item label={"产品标识"} name="code" rules={[{ required: true,max:50}]} > | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item label={"备注"} name="remark" rules={[{ required: false,max:50}]} > | |||
@@ -28,7 +28,7 @@ const GoodsTypeManage = () => { | |||
valueType: 'textarea', | |||
}, | |||
{ | |||
title: '产品标签', | |||
title: '产品标识', | |||
dataIndex: 'code', | |||
valueType: 'textarea', | |||
}, | |||
@@ -44,22 +44,7 @@ const GoodsTypeManage = () => { | |||
valueType: 'textarea', | |||
width: 450, | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'status', | |||
hideInForm: true, | |||
search: true, | |||
valueEnum: { | |||
0: { | |||
text: '启用', | |||
status: 'Processing', | |||
}, | |||
1: { | |||
text: '禁用', | |||
status: 'Success', | |||
}, | |||
}, | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'option', | |||
@@ -73,23 +58,6 @@ const GoodsTypeManage = () => { | |||
handleModalVisible(true); | |||
setCurrentRow(record); | |||
}} > 更新</a>, | |||
<a | |||
key="status" | |||
onClick={async () => { | |||
actionRef.current.reload(); | |||
record.status = record.status ? 0 : 1; | |||
await UpdateStatus(record).then((r) => { | |||
if (r.succeeded) { | |||
message.success('配置成功'); | |||
} else { | |||
message.error('配置失败请重试!'); | |||
} | |||
}); | |||
}} | |||
> | |||
{record.status == 0 ? '禁用' : '启用'} | |||
</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary" | |||
@@ -199,12 +199,6 @@ const onChangeboolLabel1=(e)=>{ | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="type" label="功能类型"> | |||
<Radio.Group name="type" defaultValue={0} value={arttue} onChange={onchagetype} disabled={disabled}> | |||
<Radio.Button value={0}>属性</Radio.Button> | |||
<Radio.Button value={1}>服务</Radio.Button> | |||
</Radio.Group> | |||
</Form.Item> | |||
<Form.Item label={'产品版本'} name="deviceVersionKey" rules={[{ required: true }]}> | |||
<Select> | |||
{props.DeviceVesionData.map((item, index) => { | |||
@@ -216,6 +210,13 @@ const onChangeboolLabel1=(e)=>{ | |||
})} | |||
</Select> | |||
</Form.Item> | |||
<Form.Item name="type" label="功能类型"> | |||
<Radio.Group name="type" defaultValue={0} value={arttue} onChange={onchagetype} disabled={disabled}> | |||
<Radio.Button value={0}>属性</Radio.Button> | |||
<Radio.Button value={1}>服务</Radio.Button> | |||
</Radio.Group> | |||
</Form.Item> | |||
<Form.Item name="name" label="功能名称" rules={[{ required: true, max: 64, whitespace: true }]}> | |||
<Input placeholder="请输入功能名称" /> | |||
</Form.Item> | |||
@@ -284,7 +285,7 @@ const onChangeboolLabel1=(e)=>{ | |||
<Form.Item style={{display:display}} name="readWrite" label="读写类型" rules={[{ required: false }]}> | |||
<Radio.Group onChange={onChangewrite} name="radiogroup" defaultValue={0} value={ReadWrite}> | |||
<Radio value={0}>读写</Radio> | |||
<Radio value={1}>只读</Radio> | |||
{/* <Radio value={1}>只读</Radio> */} | |||
</Radio.Group> | |||
</Form.Item> | |||
<Form.Item name="description" label="描述" rules={[{ required: false }]}> | |||
@@ -151,26 +151,6 @@ const bomtechnology = (props) => { | |||
<a href="#">删除</a> | |||
</Popconfirm>); | |||
arr.push(<a | |||
key="state" | |||
onClick={async () => { | |||
let a = 0; | |||
if (record.status == 0) { | |||
a = 1; | |||
} | |||
setCurrentRow((record.status = a)); | |||
await handleUpdate(record).then((r) => { | |||
if (r) { | |||
actionRef.current.reload(); | |||
} else { | |||
message.error('配置失败请重试!'); | |||
} | |||
}); | |||
}} | |||
> | |||
{record.status == 0 ? '禁用' : '启用'} | |||
</a>); | |||
return arr; | |||
} | |||
const columns = [ | |||
@@ -223,22 +203,6 @@ const bomtechnology = (props) => { | |||
search: true, | |||
valueEnum:DeviceVesionEnum | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'status', | |||
hideInForm: true, | |||
search: true, | |||
valueEnum: { | |||
0: { | |||
text: '启用', | |||
status: 'Processing', | |||
}, | |||
1: { | |||
text: '禁用', | |||
status: 'Success', | |||
}, | |||
}, | |||
}, | |||
{ | |||
title: '创建时间', | |||
dataIndex: 'createAt', | |||
@@ -359,11 +323,13 @@ const bomtechnology = (props) => { | |||
*/ | |||
const handleAdd = async (fields) => { | |||
try { | |||
var check=true; | |||
console.log(fields) | |||
//var parm=JSON.stringify(fields) | |||
if(fields.dataType=="select"){ | |||
if(fields.enumvaluelist.length==0){ | |||
if(!fields.enumvaluelist){ | |||
message.error('请添加枚举值'); | |||
check=false; | |||
}else{ | |||
fields.enumValue=JSON.stringify(fields.enumvaluelist) | |||
} | |||
@@ -371,19 +337,23 @@ const handleAdd = async (fields) => { | |||
if(fields.type==1){ | |||
fields.dataType=""; | |||
} | |||
await addgoodstechnology(JSON.stringify(fields)).then((r) => { | |||
if (r.data) { | |||
message.success('添加成功'); | |||
var params={productId:props.location.query.values.id,deviceTypeKey:props.location.query.values.id,current:1,pageSize:10} | |||
LoadfunData(params) | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}); | |||
return true; | |||
if(check){ | |||
await addgoodstechnology(JSON.stringify(fields)).then((r) => { | |||
if (r.data) { | |||
message.success('添加成功'); | |||
var params={productId:props.location.query.values.id,deviceTypeKey:props.location.query.values.id,current:1,pageSize:10} | |||
LoadfunData(params) | |||
handleModalVisible(false); | |||
if (actionRef.current) { | |||
actionRef.current.reload(); | |||
} | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}); | |||
} | |||
} catch (error) { | |||
message.error('添加失败请重试!'); | |||
return false; | |||
} | |||
}; | |||
/** | |||
@@ -409,26 +379,32 @@ const handleRemove = async (ids) => { | |||
}; | |||
const handleUpdate = async (fields) => { | |||
try { | |||
var check=true; | |||
if(fields.dataType=="select"){ | |||
if(fields.enumvaluelist.length==0){ | |||
message.error('请添加枚举值'); | |||
check=false; | |||
}else{ | |||
fields.enumValue=JSON.stringify(fields.enumvaluelist) | |||
} | |||
} | |||
updategoodstechnology(fields).then((r) => { | |||
if (r.data) { | |||
message.success('修改成功'); | |||
var params={productId:props.location.query.values.id,deviceTypeKey:props.location.query.values.id,current:1,pageSize:10} | |||
LoadfunData(params) | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}); | |||
return true; | |||
if(check){ | |||
updategoodstechnology(fields).then((r) => { | |||
if (r.data) { | |||
message.success('修改成功'); | |||
var params={productId:props.location.query.values.id,deviceTypeKey:props.location.query.values.id,current:1,pageSize:10} | |||
LoadfunData(params) | |||
handleModalVisible(false); | |||
if (actionRef.current) { | |||
actionRef.current.reload(); | |||
} | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}); | |||
} | |||
} catch (error) { | |||
message.error('修改失败请重试!'); | |||
return false; | |||
} | |||
}; | |||
const LoadtopisData= async(params)=>{ | |||
@@ -523,16 +499,9 @@ const handleRemove = async (ids) => { | |||
value.productId=props.location.query.values.id | |||
var success = false; | |||
if (value.id) { | |||
success = await handleUpdate(value); | |||
} else { | |||
success = await handleAdd(value); | |||
} | |||
if (success) { | |||
handleModalVisible(false); | |||
if (actionRef.current) { | |||
actionRef.current.reload(); | |||
} | |||
await handleUpdate(value); | |||
} else { | |||
await handleAdd(value); | |||
} | |||
}} | |||
onCancel={() => { | |||
@@ -141,29 +141,6 @@ const TableList = () => { | |||
width: 350, | |||
render: (_, record) => { | |||
let node = <a key="primary"></a>; | |||
if (record.type >= 2) { | |||
node = ([ | |||
<a | |||
key="primary2" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/sys/storemanage', | |||
query: { | |||
isAdd: false, | |||
values: record.id | |||
}, | |||
}); | |||
// handleModalVisible(true); | |||
// setStepFormValues(record); | |||
}} | |||
> | |||
店铺管理 | |||
</a> | |||
] | |||
); | |||
} | |||
return [ | |||
<a | |||
key="primary3" | |||
@@ -175,16 +152,30 @@ const TableList = () => { | |||
{' '} | |||
修改 | |||
</a>, | |||
// <a | |||
// key="primary2" | |||
// onClick={() => { | |||
// setauthcode(record.authCode) | |||
// setStepFormValues(record); | |||
// setmodalAuthVisible(true); | |||
// }} | |||
// > | |||
// 授权码 | |||
// </a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary11" | |||
title="确认删除吗?" | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={async () => { | |||
await orgdelete(record.id).then((r) => { | |||
if (r.data) { | |||
message.success('删除成功'); | |||
initfranchiseeType(); | |||
actionRef.current.reload(); | |||
} else { | |||
message.error(r.errors); | |||
} | |||
}); | |||
}} | |||
onCancel={() => { }} | |||
> | |||
<a href="#">删除</a> | |||
</Popconfirm>, | |||
node, | |||
]; | |||
}, | |||
@@ -192,14 +183,14 @@ const TableList = () => { | |||
]; | |||
useEffect(() => { | |||
function initfranchiseeType() { | |||
gettree().then((r) => { | |||
setTreeData(r.data); | |||
}); | |||
} | |||
initfranchiseeType(); | |||
}, []); | |||
function initfranchiseeType() { | |||
gettree().then((r) => { | |||
setTreeData(r.data); | |||
}); | |||
} | |||
const onclickAuth = (e) => { | |||
console.log(stepFormValues); | |||
// AddAuthCode(stepFormValues.id).then((r) => { | |||
@@ -45,11 +45,9 @@ export async function getlist(params) { | |||
}); | |||
} | |||
export async function orgdelete(params) { | |||
return request('/kitchen/api/organize/deleteorg', { | |||
method: 'POST', | |||
data: { | |||
...params, | |||
}, | |||
return request('/saasbase/api/organize/deleteorg?id='+params, { | |||
method: 'GET', | |||
}); | |||
} | |||
@@ -153,21 +153,6 @@ const DictDataManage = (props) => { | |||
ellipsis:true, | |||
hideInSearch: true, | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'status', | |||
hideInForm: true, | |||
valueEnum: { | |||
0: { | |||
text: '正常', | |||
status: 'Processing', | |||
}, | |||
1: { | |||
text: '停用', | |||
status: 'Success', | |||
}, | |||
}, | |||
}, | |||
{ | |||
title: '创建时间', | |||
dataIndex: 'createAt', | |||
@@ -128,21 +128,7 @@ const DictTypeManage = () => { | |||
ellipsis: true, | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'status', | |||
hideInForm: true, | |||
valueEnum: { | |||
0: { | |||
text: '正常', | |||
status: 'Processing', | |||
}, | |||
1: { | |||
text: '停用', | |||
status: 'Success', | |||
}, | |||
}, | |||
}, | |||
{ | |||
title: '创建时间', | |||
dataIndex: 'createAt', | |||
@@ -43,7 +43,7 @@ const CreateForm = (props) => { | |||
</Row> | |||
<Row> | |||
<Col span={12}> | |||
<Form.Item name="router" label="菜单路径"> | |||
<Form.Item name="router" label="菜单路径" rules={[{ required: true}]}> | |||
<Input placeholder="请输入菜单名称" /> | |||
</Form.Item> | |||
</Col> | |||
@@ -111,7 +111,7 @@ const CreateForm = (props) => { | |||
/> | |||
</Form.Item> | |||
</Col> | |||
<Col span={12}> | |||
{/* <Col span={12}> | |||
<Form.Item name="type" label="所属平台"> | |||
<Select placeholder='请选择所属平台' mode="multiple" allowClear options={[ | |||
@@ -134,7 +134,7 @@ const CreateForm = (props) => { | |||
]}/> | |||
</Form.Item> | |||
</Col> | |||
</Col> */} | |||
</Row> | |||
<Form.Item> | |||
<Button htmlType="button" style={{float:'right',left:10}} onClick={props.onCancel} > | |||
@@ -28,7 +28,7 @@ const menuManager = () => { | |||
*/ | |||
const handleAdd = async (fields) => { | |||
fields.type=fields.type.join(','); | |||
// fields.type=fields.type.join(','); | |||
await api.add({ ...fields }).then((r) => { | |||
if (r.succeeded) { | |||
message.success('添加成功'); | |||
@@ -47,7 +47,6 @@ const menuManager = () => { | |||
*/ | |||
const handleUpdate = async (fields) => { | |||
fields.type=fields.type.join(','); | |||
api.update(fields).then((r) => { | |||
if (r.succeeded) { | |||
message.success('更新成功'); | |||
@@ -73,47 +72,15 @@ const handleUpdate = async (fields) => { | |||
onClick={() => { | |||
InitTree(); | |||
handleModalVisible(true); | |||
console.log("record.type",record.type) | |||
if(!Array.isArray(record.type)){ | |||
record.type=record.type.split(','); | |||
} | |||
// console.log("record.type",record.type) | |||
// if(!Array.isArray(record.type)){ | |||
// record.type=record.type.split(','); | |||
// } | |||
setStepFormValues(record); | |||
}} | |||
> | |||
更新 | |||
</a>); | |||
if (record.status == 1) { | |||
arr.push(<a | |||
onClick={() => { | |||
api.enable(record.id).then((r) => { | |||
if (r.succeeded) { | |||
message.success('操作成功'); | |||
actionRef.current.reload(); | |||
}else{ | |||
message.error(r.errors); | |||
} | |||
}); | |||
}} | |||
> | |||
启用 | |||
</a>); | |||
} | |||
if (record.status == 0) { | |||
arr.push(<a | |||
onClick={() => { | |||
api.disable(record.id).then((r) => { | |||
if (r.succeeded) { | |||
message.success('操作成功'); | |||
actionRef.current.reload(); | |||
}else{ | |||
message.error(r.errors); | |||
} | |||
}); | |||
}} | |||
> | |||
禁用 | |||
</a>); | |||
} | |||
arr.push( | |||
// <a | |||
// onClick={() => { | |||
@@ -162,32 +129,32 @@ const handleUpdate = async (fields) => { | |||
dataIndex: 'name', | |||
ellipsis:true, | |||
}, | |||
{ | |||
title: '所属平台', | |||
dataIndex: 'typeName', | |||
// { | |||
// title: '所属平台', | |||
// dataIndex: 'typeName', | |||
}, | |||
{ | |||
title: '所属平台', | |||
dataIndex: 'type', | |||
valueType: 'select', | |||
ellipsis:true, | |||
hideInTable: true, | |||
valueEnum: { | |||
0: { | |||
text: '团餐', | |||
}, | |||
1: { | |||
text: '门店', | |||
}, | |||
2: { | |||
text: '后厨', | |||
}, | |||
3: { | |||
text: '公共', | |||
}, | |||
}, | |||
}, | |||
// }, | |||
// { | |||
// title: '所属平台', | |||
// dataIndex: 'type', | |||
// valueType: 'select', | |||
// ellipsis:true, | |||
// hideInTable: true, | |||
// valueEnum: { | |||
// 0: { | |||
// text: '团餐', | |||
// }, | |||
// 1: { | |||
// text: '门店', | |||
// }, | |||
// 2: { | |||
// text: '后厨', | |||
// }, | |||
// 3: { | |||
// text: '公共', | |||
// }, | |||
// }, | |||
// }, | |||
{ | |||
title: '菜单编码', | |||
dataIndex: 'code', | |||