|
|
@@ -7,683 +7,334 @@ import ProDescriptions from '@ant-design/pro-descriptions'; |
|
|
|
import moment from 'moment'; |
|
|
|
const { TabPane } = Tabs; |
|
|
|
import { |
|
|
|
addPracticeType, |
|
|
|
getPracticeType, |
|
|
|
editPracticeType, |
|
|
|
editPracticeRecord, |
|
|
|
addPracticeRecord, |
|
|
|
getPracticeRecord, |
|
|
|
getPracticeRelevance, |
|
|
|
addPracticeRelevance, |
|
|
|
editPracticeRelevance, |
|
|
|
GetAllType, |
|
|
|
GetAllSmallType, |
|
|
|
GetAllGoods, |
|
|
|
GetAllPractice |
|
|
|
addPracticeType, |
|
|
|
getPracticeType, |
|
|
|
editPracticeType, |
|
|
|
editPracticeRecord, |
|
|
|
addPracticeRecord, |
|
|
|
getPracticeRecord, |
|
|
|
getPracticeRelevance, |
|
|
|
addPracticeRelevance, |
|
|
|
editPracticeRelevance, |
|
|
|
GetAllType, |
|
|
|
GetAllSmallType, |
|
|
|
GetAllGoods, |
|
|
|
GetAllPractice |
|
|
|
} from './service'; |
|
|
|
|
|
|
|
import CreateTypeForm from './components/createTypeForm'; |
|
|
|
import CreateRecordForm from './components/createRecordForm'; |
|
|
|
import CreateRelevanceForm from './components/createRelevanceForm'; |
|
|
|
|
|
|
|
import { set } from 'lodash'; |
|
|
|
import record from '@/pages/crm/coupon/coupon-Batch/components/ShowRecord'; |
|
|
|
|
|
|
|
const PageIndex = (props) => { |
|
|
|
const actionRef = useRef(); |
|
|
|
const [createTypeModalVisible, handleTypeModalVisible] = useState(); |
|
|
|
const [createRecordModalVisible, handleRecordModalVisible] = useState(); |
|
|
|
const [createRelevanceModalVisible, handleRelevanceModalVisible] = useState(); |
|
|
|
const [thisItemId, setthisItemId] = useState(); |
|
|
|
const [TypecurrentRow, setTypecurrentRow] = useState(); |
|
|
|
const [RecordCurrentRow, setRecordCurrentRow] = useState(); |
|
|
|
const [RelevanceCurrentRow, setRelevanceCurrentRow] = useState(); |
|
|
|
|
|
|
|
const [AllTypeList, setAllTypeList] = useState([]); |
|
|
|
const [domrelevanceType, setdomrelevanceType] = useState(1); |
|
|
|
|
|
|
|
const [Support, setSupport] = useState({ |
|
|
|
allType: [], |
|
|
|
allSmallType: [], |
|
|
|
allGoods: [], |
|
|
|
allPractice: [] |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 数据操作 |
|
|
|
*/ |
|
|
|
/** |
|
|
|
* 添加节点 |
|
|
|
* |
|
|
|
* @param fields |
|
|
|
*/ |
|
|
|
function handleRecordAdd(fields) { |
|
|
|
try { |
|
|
|
addPracticeRecord(fields) |
|
|
|
.then((r) => { |
|
|
|
if (r.data) { |
|
|
|
message.success('添加成功'); |
|
|
|
//刷新数据 |
|
|
|
actionRef.current.reload(); |
|
|
|
} else { |
|
|
|
message.error('添加失败请重试!'); |
|
|
|
} |
|
|
|
}); |
|
|
|
return true; |
|
|
|
} catch (error) { |
|
|
|
const actionRef = useRef(); |
|
|
|
const [createTypeModalVisible, handleTypeModalVisible] = useState(); |
|
|
|
const [createRecordModalVisible, handleRecordModalVisible] = useState(); |
|
|
|
const [createRelevanceModalVisible, handleRelevanceModalVisible] = useState(); |
|
|
|
const [thisItemId, setthisItemId] = useState(); |
|
|
|
const [TypecurrentRow, setTypecurrentRow] = useState(); |
|
|
|
const [RecordCurrentRow, setRecordCurrentRow] = useState(); |
|
|
|
const [RelevanceCurrentRow, setRelevanceCurrentRow] = useState(); |
|
|
|
|
|
|
|
const [AllTypeList, setAllTypeList] = useState([]); |
|
|
|
const [domrelevanceType, setdomrelevanceType] = useState(1); |
|
|
|
|
|
|
|
const [Support, setSupport] = useState({ |
|
|
|
allType: [], |
|
|
|
allSmallType: [], |
|
|
|
allGoods: [], |
|
|
|
allPractice: [] |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 数据操作 |
|
|
|
*/ |
|
|
|
function handleRelevanceAdd(fields) { |
|
|
|
try { |
|
|
|
addPracticeRelevance(fields) |
|
|
|
.then((r) => { |
|
|
|
if (r.data) { |
|
|
|
message.success('添加成功'); |
|
|
|
//刷新数据 |
|
|
|
actionRef.current.reload(); |
|
|
|
} else { |
|
|
|
message.error('添加失败请重试!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function handleTypeAdd(fields) { |
|
|
|
try { |
|
|
|
addPracticeType(fields) |
|
|
|
.then((r) => { |
|
|
|
if (r.data) { |
|
|
|
message.success('添加成功'); |
|
|
|
//刷新数据 |
|
|
|
actionRef.current.reload(); |
|
|
|
} else { |
|
|
|
message.error('添加失败请重试!'); |
|
|
|
} |
|
|
|
}); |
|
|
|
return true; |
|
|
|
} catch (error) { |
|
|
|
message.error('添加失败请重试!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function handleRelevanceAdd(fields) { |
|
|
|
try { |
|
|
|
addPracticeRelevance(fields) |
|
|
|
.then((r) => { |
|
|
|
if (r.data) { |
|
|
|
message.success('添加成功'); |
|
|
|
//刷新数据 |
|
|
|
actionRef.current.reload(); |
|
|
|
} else { |
|
|
|
message.error('添加失败请重试!'); |
|
|
|
} |
|
|
|
}); |
|
|
|
return true; |
|
|
|
} catch (error) { |
|
|
|
message.error('添加失败请重试!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
return true; |
|
|
|
} catch (error) { |
|
|
|
message.error('添加失败请重试!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 更新节点 |
|
|
|
* |
|
|
|
* @param fields |
|
|
|
*/ |
|
|
|
/** |
|
|
|
* 更新节点 |
|
|
|
* |
|
|
|
* @param fields |
|
|
|
*/ |
|
|
|
|
|
|
|
function handleRecordUpdate(fields) { |
|
|
|
try { |
|
|
|
editPracticeRecord(fields) |
|
|
|
.then((r) => { |
|
|
|
if (r.data) { |
|
|
|
message.success('配置成功'); |
|
|
|
} else { |
|
|
|
message.error('配置失败请重试!'); |
|
|
|
} |
|
|
|
setRecordCurrentRow(undefined); |
|
|
|
//刷新数据 |
|
|
|
actionRef.current.reload(); |
|
|
|
}); |
|
|
|
return true; |
|
|
|
} catch (error) { |
|
|
|
function handleRelevanceUpdate(fields) { |
|
|
|
try { |
|
|
|
editPracticeRelevance(fields) |
|
|
|
.then((r) => { |
|
|
|
if (r.data) { |
|
|
|
message.success('配置成功'); |
|
|
|
} else { |
|
|
|
message.error('配置失败请重试!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function handleTypeUpdate(fields) { |
|
|
|
try { |
|
|
|
editPracticeType(fields) |
|
|
|
.then((r) => { |
|
|
|
if (r.data) { |
|
|
|
message.success('配置成功'); |
|
|
|
} else { |
|
|
|
message.error('配置失败请重试!'); |
|
|
|
} |
|
|
|
setTypecurrentRow(undefined); |
|
|
|
//刷新数据 |
|
|
|
actionRef.current.reload(); |
|
|
|
}); |
|
|
|
return true; |
|
|
|
} catch (error) { |
|
|
|
message.error('配置失败请重试!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function handleRelevanceUpdate(fields) { |
|
|
|
try { |
|
|
|
editPracticeRelevance(fields) |
|
|
|
.then((r) => { |
|
|
|
if (r.data) { |
|
|
|
message.success('配置成功'); |
|
|
|
} else { |
|
|
|
message.error('配置失败请重试!'); |
|
|
|
} |
|
|
|
setTypecurrentRow(undefined); |
|
|
|
//刷新数据 |
|
|
|
actionRef.current.reload(); |
|
|
|
}); |
|
|
|
return true; |
|
|
|
} catch (error) { |
|
|
|
message.error('配置失败请重试!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
const parmar = { |
|
|
|
current: 1, |
|
|
|
pagesize: 99999 |
|
|
|
}; |
|
|
|
GetAllType(parmar).then((r) => { |
|
|
|
Support.allType = r.data.data; |
|
|
|
}); |
|
|
|
GetAllSmallType(parmar).then((r) => { |
|
|
|
Support.allSmallType = r.data.data; |
|
|
|
}); |
|
|
|
GetAllGoods(parmar).then((r) => { |
|
|
|
Support.allGoods = r.data.data; |
|
|
|
}); |
|
|
|
GetAllPractice(parmar).then((r) => { |
|
|
|
Support.allPractice = r.data.data; |
|
|
|
} |
|
|
|
setTypecurrentRow(undefined); |
|
|
|
//刷新数据 |
|
|
|
actionRef.current.reload(); |
|
|
|
}); |
|
|
|
getPracticeType(parmar).then((r) => { |
|
|
|
setAllTypeList(r.data.data); |
|
|
|
}); |
|
|
|
|
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 做法类别列表 |
|
|
|
*/ |
|
|
|
const PracticeTypecolumns = [ |
|
|
|
{ |
|
|
|
title: '规则id', |
|
|
|
dataIndex: 'id', |
|
|
|
tip: '规则名称是唯一的 key', |
|
|
|
hideInSearch: true, |
|
|
|
hideInTable: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '做法名称', |
|
|
|
dataIndex: 'typeName', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
dataIndex: 'option', |
|
|
|
valueType: 'option', |
|
|
|
render: (_, record) => [ |
|
|
|
<a |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
handleTypeModalVisible(true); |
|
|
|
setTypecurrentRow(record); |
|
|
|
}} |
|
|
|
> |
|
|
|
{' '} |
|
|
|
修改 |
|
|
|
</a>, |
|
|
|
<a |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
record.status = record.status == 0 ? 1 : 0; |
|
|
|
editPracticeType(record); |
|
|
|
}} |
|
|
|
> |
|
|
|
{' '} |
|
|
|
{record.status == 0 ? '停用' : '启用'} |
|
|
|
</a>, |
|
|
|
|
|
|
|
], |
|
|
|
}, |
|
|
|
]; |
|
|
|
return true; |
|
|
|
} catch (error) { |
|
|
|
message.error('配置失败请重试!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 做法档案列表 |
|
|
|
*/ |
|
|
|
const PracticeRecordcolumns = [ |
|
|
|
{ |
|
|
|
title: '规则id', |
|
|
|
dataIndex: 'id', |
|
|
|
tip: '规则名称是唯一的 key', |
|
|
|
hideInSearch: true, |
|
|
|
hideInTable: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '做法名称', |
|
|
|
dataIndex: 'practiceName', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '做法编码', |
|
|
|
dataIndex: 'code', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '做法类别', |
|
|
|
dataIndex: 'practiceTypeName', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '加价', |
|
|
|
dataIndex: 'raise', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '加价方式', |
|
|
|
dataIndex: 'raiseType', |
|
|
|
render: (_, record) => { |
|
|
|
if (record.raiseType == 1) { |
|
|
|
return ( |
|
|
|
<label>按出品数量加价</label> |
|
|
|
); |
|
|
|
|
|
|
|
} else |
|
|
|
if (record.raiseType == 1) { |
|
|
|
return ( |
|
|
|
<label>加价与出品数量无关 </label> |
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
return ( |
|
|
|
<CloseOutlined /> |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
dataIndex: 'option', |
|
|
|
valueType: 'option', |
|
|
|
render: (_, record) => [ |
|
|
|
<a |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
handleRecordModalVisible(true); |
|
|
|
setRecordCurrentRow(record); |
|
|
|
}} |
|
|
|
> |
|
|
|
{' '} |
|
|
|
修改 |
|
|
|
</a>, |
|
|
|
<a |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
record.status = record.status == 0 ? 1 : 0; |
|
|
|
editPracticeRecord(record); |
|
|
|
}} |
|
|
|
> |
|
|
|
{' '} |
|
|
|
{record.status == 0 ? '停用' : '启用'} |
|
|
|
</a>, |
|
|
|
|
|
|
|
], |
|
|
|
}, |
|
|
|
]; |
|
|
|
useEffect(() => { |
|
|
|
const parmar = { |
|
|
|
current: 1, |
|
|
|
pagesize: 99999 |
|
|
|
}; |
|
|
|
GetAllType(parmar).then((r) => { |
|
|
|
Support.allType = r.data.data; |
|
|
|
}); |
|
|
|
GetAllSmallType(parmar).then((r) => { |
|
|
|
Support.allSmallType = r.data.data; |
|
|
|
}); |
|
|
|
GetAllGoods(parmar).then((r) => { |
|
|
|
Support.allGoods = r.data.data; |
|
|
|
}); |
|
|
|
GetAllPractice(parmar).then((r) => { |
|
|
|
Support.allPractice = r.data.data; |
|
|
|
}); |
|
|
|
getPracticeType(parmar).then((r) => { |
|
|
|
setAllTypeList(r.data.data); |
|
|
|
}); |
|
|
|
|
|
|
|
/** |
|
|
|
* 出品做法关联设置 |
|
|
|
*/ |
|
|
|
const relevanceColumns = [ |
|
|
|
{ |
|
|
|
title: '规则id', |
|
|
|
dataIndex: 'id', |
|
|
|
tip: '规则名称是唯一的 key', |
|
|
|
hideInSearch: true, |
|
|
|
hideInTable: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '关联类型', |
|
|
|
dataIndex: 'relevanceType', |
|
|
|
render: (_, record) => { |
|
|
|
switch (record.relevanceType) { |
|
|
|
case 1: |
|
|
|
return ( |
|
|
|
<label>出品类别与做法类别关联</label> |
|
|
|
); |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
return ( |
|
|
|
<label>出品与做法关联</label> |
|
|
|
); |
|
|
|
break; |
|
|
|
default: |
|
|
|
return ( |
|
|
|
<CloseOutlined /> |
|
|
|
); |
|
|
|
break; |
|
|
|
} |
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 出品做法关联设置 |
|
|
|
*/ |
|
|
|
const TyperelevanceColumns = [ |
|
|
|
{ |
|
|
|
title: '规则id', |
|
|
|
dataIndex: 'id', |
|
|
|
tip: '规则名称是唯一的 key', |
|
|
|
hideInSearch: true, |
|
|
|
hideInTable: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '类别', |
|
|
|
dataIndex: 'values1Name', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '做法', |
|
|
|
dataIndex: 'values2Name', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
dataIndex: 'option', |
|
|
|
valueType: 'option', |
|
|
|
render: (_, record) => [ |
|
|
|
<a |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
handleRelevanceModalVisible(true); |
|
|
|
setRelevanceCurrentRow(record); |
|
|
|
}} |
|
|
|
> |
|
|
|
{' '} |
|
|
|
修改 |
|
|
|
</a>, |
|
|
|
<a |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
record.status = record.status == 0 ? 1 : 0; |
|
|
|
editPracticeRecord(record); |
|
|
|
}} |
|
|
|
> |
|
|
|
{' '} |
|
|
|
{record.status == 0 ? '停用' : '启用'} |
|
|
|
</a>, |
|
|
|
|
|
|
|
], |
|
|
|
}, |
|
|
|
]; |
|
|
|
const GoodsrelevanceColumns = [ |
|
|
|
{ |
|
|
|
title: '规则id', |
|
|
|
dataIndex: 'id', |
|
|
|
tip: '规则名称是唯一的 key', |
|
|
|
hideInSearch: true, |
|
|
|
hideInTable: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '商品', |
|
|
|
dataIndex: 'values1Name', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '做法', |
|
|
|
dataIndex: 'values2Name', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
dataIndex: 'option', |
|
|
|
valueType: 'option', |
|
|
|
render: (_, record) => [ |
|
|
|
<a |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
handleRelevanceModalVisible(true); |
|
|
|
setRelevanceCurrentRow(record); |
|
|
|
}} |
|
|
|
> |
|
|
|
{' '} |
|
|
|
修改 |
|
|
|
</a>, |
|
|
|
<a |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
record.status = record.status == 0 ? 1 : 0; |
|
|
|
editPracticeRecord(record); |
|
|
|
}} |
|
|
|
> |
|
|
|
{' '} |
|
|
|
{record.status == 0 ? '停用' : '启用'} |
|
|
|
</a>, |
|
|
|
|
|
|
|
], |
|
|
|
}, |
|
|
|
]; |
|
|
|
|
|
|
|
return ( |
|
|
|
<Tabs defaultActiveKey="1" > |
|
|
|
|
|
|
|
<CreateRelevanceForm |
|
|
|
onFinish={async (value) => { |
|
|
|
var success = false; |
|
|
|
if (value.id) { |
|
|
|
success = handleRelevanceUpdate(value); |
|
|
|
} else { |
|
|
|
success = handleRelevanceAdd(value); |
|
|
|
} |
|
|
|
if (success) { |
|
|
|
handleRelevanceModalVisible(false); |
|
|
|
setRelevanceCurrentRow(undefined); |
|
|
|
if (actionRef.current) { |
|
|
|
actionRef.current.reload(); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '商品', |
|
|
|
dataIndex: 'values1Name', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '做法', |
|
|
|
dataIndex: 'values2Name', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
dataIndex: 'option', |
|
|
|
valueType: 'option', |
|
|
|
render: (_, record) => [ |
|
|
|
<a |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
handleRelevanceModalVisible(true); |
|
|
|
setRelevanceCurrentRow(record); |
|
|
|
}} |
|
|
|
> |
|
|
|
{' '} |
|
|
|
修改 |
|
|
|
</a>, |
|
|
|
<a |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
record.status = record.status == 0 ? 1 : 0; |
|
|
|
editPracticeRecord(record); |
|
|
|
}} |
|
|
|
> |
|
|
|
{' '} |
|
|
|
{record.status == 0 ? '停用' : '启用'} |
|
|
|
</a>, |
|
|
|
|
|
|
|
], |
|
|
|
}, |
|
|
|
]; |
|
|
|
|
|
|
|
return ( |
|
|
|
<Tabs defaultActiveKey="1" > |
|
|
|
|
|
|
|
<CreateTypeForm |
|
|
|
onFinish={async (value) => { |
|
|
|
debugger; |
|
|
|
var success = false; |
|
|
|
if (value.id) { |
|
|
|
success = handleTypeUpdate(value); |
|
|
|
} else { |
|
|
|
success = handleTypeAdd(value); |
|
|
|
} |
|
|
|
if (success) { |
|
|
|
handleTypeModalVisible(false); |
|
|
|
setTypecurrentRow(undefined); |
|
|
|
if (actionRef.current) { |
|
|
|
actionRef.current.reload(); |
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
onCancel={() => { |
|
|
|
setTypecurrentRow(undefined); |
|
|
|
handleTypeModalVisible(false); |
|
|
|
actionRef.current.reload(); |
|
|
|
}} |
|
|
|
createModalVisible={createTypeModalVisible} |
|
|
|
values={TypecurrentRow || {}} |
|
|
|
} |
|
|
|
}} |
|
|
|
onCancel={() => { |
|
|
|
setRelevanceCurrentRow(undefined); |
|
|
|
handleRelevanceModalVisible(false); |
|
|
|
actionRef.current.reload(); |
|
|
|
}} |
|
|
|
Support={Support} |
|
|
|
domrelevanceType={domrelevanceType} |
|
|
|
createModalVisible={createRelevanceModalVisible} |
|
|
|
values={RelevanceCurrentRow || {}} |
|
|
|
> |
|
|
|
</CreateRelevanceForm> |
|
|
|
<TabPane tab="出品类别与做法类别关联" key="1" style={{ float: 'left' }} > |
|
|
|
<ProTable |
|
|
|
actionRef={actionRef} |
|
|
|
rowKey="id" |
|
|
|
search={{ |
|
|
|
labelWidth: 120, |
|
|
|
}} |
|
|
|
toolBarRender={() => [ |
|
|
|
<Button |
|
|
|
type="primary" |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
handleRelevanceModalVisible(true); |
|
|
|
}} |
|
|
|
> |
|
|
|
</CreateTypeForm> |
|
|
|
|
|
|
|
<CreateRecordForm |
|
|
|
onFinish={async (value) => { |
|
|
|
var success = false; |
|
|
|
if (value.id) { |
|
|
|
success = handleRecordUpdate(value); |
|
|
|
} else { |
|
|
|
success = handleRecordAdd(value); |
|
|
|
} |
|
|
|
if (success) { |
|
|
|
handleRecordModalVisible(false); |
|
|
|
setRecordCurrentRow(undefined); |
|
|
|
if (actionRef.current) { |
|
|
|
actionRef.current.reload(); |
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
onCancel={() => { |
|
|
|
setRecordCurrentRow(undefined); |
|
|
|
handleRecordModalVisible(false); |
|
|
|
actionRef.current.reload(); |
|
|
|
}} |
|
|
|
TypeList={AllTypeList || []} |
|
|
|
createModalVisible={createRecordModalVisible} |
|
|
|
values={RecordCurrentRow || {}} |
|
|
|
<PlusOutlined /> 添加 |
|
|
|
</Button> |
|
|
|
]} |
|
|
|
params={{ |
|
|
|
relevanceType: 1, |
|
|
|
}} |
|
|
|
request={async (params) => { |
|
|
|
var datas = []; |
|
|
|
var total = 0; |
|
|
|
await getPracticeRelevance(params).then((r) => { |
|
|
|
datas = r.data.data; |
|
|
|
total = r.data.total; |
|
|
|
}); |
|
|
|
return { |
|
|
|
data: datas, |
|
|
|
success: true, |
|
|
|
total: total, |
|
|
|
}; |
|
|
|
}} |
|
|
|
modalVisible={createRelevanceModalVisible} |
|
|
|
columns={TyperelevanceColumns} |
|
|
|
rowSelection={{ |
|
|
|
onChange: (_, selectedRows) => { |
|
|
|
setTypecurrentRow(selectedRows); |
|
|
|
}, |
|
|
|
}} |
|
|
|
/> |
|
|
|
</TabPane> |
|
|
|
|
|
|
|
<TabPane tab="出品与做法关联" key="2" style={{ float: 'left' }} > |
|
|
|
<ProTable |
|
|
|
actionRef={actionRef} |
|
|
|
rowKey="id" |
|
|
|
search={{ |
|
|
|
labelWidth: 120, |
|
|
|
}} |
|
|
|
toolBarRender={() => [ |
|
|
|
<Button |
|
|
|
type="primary" |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
handleRelevanceModalVisible(true); |
|
|
|
}} |
|
|
|
> |
|
|
|
</CreateRecordForm> |
|
|
|
|
|
|
|
<CreateRelevanceForm |
|
|
|
onFinish={async (value) => { |
|
|
|
var success = false; |
|
|
|
if (value.id) { |
|
|
|
success = handleRelevanceUpdate(value); |
|
|
|
} else { |
|
|
|
success = handleRelevanceAdd(value); |
|
|
|
} |
|
|
|
if (success) { |
|
|
|
handleRelevanceModalVisible(false); |
|
|
|
setRelevanceCurrentRow(undefined); |
|
|
|
if (actionRef.current) { |
|
|
|
actionRef.current.reload(); |
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
onCancel={() => { |
|
|
|
setRelevanceCurrentRow(undefined); |
|
|
|
handleRelevanceModalVisible(false); |
|
|
|
actionRef.current.reload(); |
|
|
|
}} |
|
|
|
Support={Support} |
|
|
|
domrelevanceType={domrelevanceType} |
|
|
|
createModalVisible={createRelevanceModalVisible} |
|
|
|
values={RelevanceCurrentRow || {}} |
|
|
|
> |
|
|
|
</CreateRelevanceForm> |
|
|
|
|
|
|
|
<TabPane tab="出品做法关联设置" key="1" style={{ float: 'left' }} > |
|
|
|
<Tabs onTabClick={(_,record) => { |
|
|
|
setdomrelevanceType(_); |
|
|
|
}}> |
|
|
|
<TabPane tab="出品类别与做法类别关联" key="1" style={{ float: 'left' }} > |
|
|
|
<ProTable |
|
|
|
actionRef={actionRef} |
|
|
|
rowKey="id" |
|
|
|
search={{ |
|
|
|
labelWidth: 120, |
|
|
|
}} |
|
|
|
toolBarRender={() => [ |
|
|
|
<Button |
|
|
|
type="primary" |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
handleRelevanceModalVisible(true); |
|
|
|
}} |
|
|
|
> |
|
|
|
<PlusOutlined /> 添加 |
|
|
|
</Button> |
|
|
|
]} |
|
|
|
params={{ |
|
|
|
relevanceType: 1, |
|
|
|
}} |
|
|
|
request={async (params) => { |
|
|
|
var datas = []; |
|
|
|
var total = 0; |
|
|
|
await getPracticeRelevance(params).then((r) => { |
|
|
|
datas = r.data.data; |
|
|
|
total = r.data.total; |
|
|
|
}); |
|
|
|
return { |
|
|
|
data: datas, |
|
|
|
success: true, |
|
|
|
total: total, |
|
|
|
}; |
|
|
|
}} |
|
|
|
modalVisible={createRelevanceModalVisible} |
|
|
|
columns={relevanceColumns} |
|
|
|
rowSelection={{ |
|
|
|
onChange: (_, selectedRows) => { |
|
|
|
setTypecurrentRow(selectedRows); |
|
|
|
}, |
|
|
|
}} |
|
|
|
/> |
|
|
|
</TabPane> |
|
|
|
|
|
|
|
<TabPane tab="出品与做法关联" key="2" style={{ float: 'left' }} > |
|
|
|
<ProTable |
|
|
|
actionRef={actionRef} |
|
|
|
rowKey="id" |
|
|
|
search={{ |
|
|
|
labelWidth: 120, |
|
|
|
}} |
|
|
|
toolBarRender={() => [ |
|
|
|
<Button |
|
|
|
type="primary" |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
handleRelevanceModalVisible(true); |
|
|
|
}} |
|
|
|
> |
|
|
|
<PlusOutlined /> 添加 |
|
|
|
</Button> |
|
|
|
]} |
|
|
|
params={{ |
|
|
|
relevanceType: 2, |
|
|
|
}} |
|
|
|
request={async (params) => { |
|
|
|
var datas = []; |
|
|
|
var total = 0; |
|
|
|
|
|
|
|
await getPracticeRelevance(params).then((r) => { |
|
|
|
datas = r.data.data; |
|
|
|
total = r.data.total; |
|
|
|
}); |
|
|
|
return { |
|
|
|
data: datas, |
|
|
|
success: true, |
|
|
|
total: total, |
|
|
|
}; |
|
|
|
}} |
|
|
|
modalVisible={createRelevanceModalVisible} |
|
|
|
columns={relevanceColumns} |
|
|
|
rowSelection={{ |
|
|
|
onChange: (_, selectedRows) => { |
|
|
|
setTypecurrentRow(selectedRows); |
|
|
|
}, |
|
|
|
}} |
|
|
|
/> |
|
|
|
</TabPane> |
|
|
|
</Tabs> |
|
|
|
|
|
|
|
</TabPane> |
|
|
|
|
|
|
|
<TabPane tab="做法档案" key="2" style={{ float: 'left' }}> |
|
|
|
<ProTable |
|
|
|
actionRef={actionRef} |
|
|
|
rowKey="id" |
|
|
|
search={{ |
|
|
|
labelWidth: 120, |
|
|
|
}} |
|
|
|
toolBarRender={() => [ |
|
|
|
<Button |
|
|
|
type="primary" |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
if (AllTypeList.length == 0) { |
|
|
|
getPracticeType({ |
|
|
|
thisItemId, |
|
|
|
}).then((r) => { |
|
|
|
setAllTypeList(r.data.data); |
|
|
|
}); |
|
|
|
} |
|
|
|
handleRecordModalVisible(true); |
|
|
|
}} |
|
|
|
> |
|
|
|
<PlusOutlined /> 添加 |
|
|
|
</Button> |
|
|
|
]} |
|
|
|
params={{ |
|
|
|
thisItemId, |
|
|
|
}} |
|
|
|
request={async (params) => { |
|
|
|
var datas = []; |
|
|
|
var total = 0; |
|
|
|
await getPracticeRecord(params).then((r) => { |
|
|
|
datas = r.data.data; |
|
|
|
total = r.data.total; |
|
|
|
}); |
|
|
|
return { |
|
|
|
data: datas, |
|
|
|
success: true, |
|
|
|
total: total, |
|
|
|
}; |
|
|
|
}} |
|
|
|
modalVisible={createRecordModalVisible} |
|
|
|
columns={PracticeRecordcolumns} |
|
|
|
rowSelection={{ |
|
|
|
onChange: (_, selectedRows) => { |
|
|
|
setRecordCurrentRow(selectedRows); |
|
|
|
}, |
|
|
|
}} |
|
|
|
/> |
|
|
|
</TabPane> |
|
|
|
|
|
|
|
<TabPane tab="做法类型" key="3" style={{ float: 'left' }}> |
|
|
|
<ProTable |
|
|
|
actionRef={actionRef} |
|
|
|
rowKey="id" |
|
|
|
search={{ |
|
|
|
labelWidth: 120, |
|
|
|
}} |
|
|
|
toolBarRender={() => [ |
|
|
|
<Button |
|
|
|
type="primary" |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
handleTypeModalVisible(true); |
|
|
|
}} |
|
|
|
> |
|
|
|
<PlusOutlined /> 添加 |
|
|
|
</Button> |
|
|
|
]} |
|
|
|
params={{ |
|
|
|
thisItemId, |
|
|
|
}} |
|
|
|
request={async (params) => { |
|
|
|
var datas = []; |
|
|
|
var total = 0; |
|
|
|
await getPracticeType(params).then((r) => { |
|
|
|
// setAllTypeList(r.data.data); |
|
|
|
datas = r.data.data; |
|
|
|
total = r.data.total; |
|
|
|
}); |
|
|
|
return { |
|
|
|
data: datas, |
|
|
|
success: true, |
|
|
|
total: total, |
|
|
|
}; |
|
|
|
}} |
|
|
|
modalVisible={createTypeModalVisible} |
|
|
|
columns={PracticeTypecolumns} |
|
|
|
rowSelection={{ |
|
|
|
onChange: (_, selectedRows) => { |
|
|
|
setTypecurrentRow(selectedRows); |
|
|
|
}, |
|
|
|
}} |
|
|
|
/> |
|
|
|
</TabPane> |
|
|
|
|
|
|
|
</Tabs> |
|
|
|
); |
|
|
|
<PlusOutlined /> 添加 |
|
|
|
</Button> |
|
|
|
]} |
|
|
|
params={{ |
|
|
|
relevanceType: 2, |
|
|
|
}} |
|
|
|
request={async (params) => { |
|
|
|
var datas = []; |
|
|
|
var total = 0; |
|
|
|
|
|
|
|
await getPracticeRelevance(params).then((r) => { |
|
|
|
datas = r.data.data; |
|
|
|
total = r.data.total; |
|
|
|
}); |
|
|
|
return { |
|
|
|
data: datas, |
|
|
|
success: true, |
|
|
|
total: total, |
|
|
|
}; |
|
|
|
}} |
|
|
|
modalVisible={createRelevanceModalVisible} |
|
|
|
columns={GoodsrelevanceColumns} |
|
|
|
rowSelection={{ |
|
|
|
onChange: (_, selectedRows) => { |
|
|
|
setTypecurrentRow(selectedRows); |
|
|
|
}, |
|
|
|
}} |
|
|
|
/> |
|
|
|
</TabPane> |
|
|
|
</Tabs> |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
export default PageIndex; |