|
@@ -28,15 +28,19 @@ interface ParmForm { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ParmsTypeList = [{ |
|
|
|
|
|
|
|
|
|
|
|
label: '数据', |
|
|
|
|
|
value: 0 |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
label: '数组', |
|
|
|
|
|
value: 1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const ParmsTypeList = [ |
|
|
|
|
|
{ |
|
|
|
|
|
label: '数据', |
|
|
|
|
|
value: 0 |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
label: '多选', |
|
|
|
|
|
value: 1 |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
label: '单选', |
|
|
|
|
|
value: 2 |
|
|
|
|
|
} |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
export default () => { |
|
|
export default () => { |
|
@@ -53,7 +57,7 @@ export default () => { |
|
|
|
|
|
|
|
|
// useEffect(()=>{ |
|
|
// useEffect(()=>{ |
|
|
// console.log("funcParams"); |
|
|
// console.log("funcParams"); |
|
|
const [isParamsUnit, setIsParamsUnit] = useState<boolean>(); |
|
|
|
|
|
|
|
|
const [isParamsUnit, setIsParamsUnit] = useState<number>(0); |
|
|
|
|
|
|
|
|
// },[funcParams]) |
|
|
// },[funcParams]) |
|
|
const [paramsModelOpen, setParamsModelOpen] = useState<boolean>(false); |
|
|
const [paramsModelOpen, setParamsModelOpen] = useState<boolean>(false); |
|
@@ -71,23 +75,23 @@ export default () => { |
|
|
{ |
|
|
{ |
|
|
title: '主键', |
|
|
title: '主键', |
|
|
dataIndex: 'id', |
|
|
dataIndex: 'id', |
|
|
formItemProps:{ |
|
|
|
|
|
hidden:true |
|
|
|
|
|
|
|
|
formItemProps: { |
|
|
|
|
|
hidden: true |
|
|
}, |
|
|
}, |
|
|
search: false, |
|
|
search: false, |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '名称', |
|
|
title: '名称', |
|
|
dataIndex: 'name', |
|
|
dataIndex: 'name', |
|
|
formItemProps:{ |
|
|
|
|
|
rules:[{ required: true, message: '此项为必填项!' }] |
|
|
|
|
|
|
|
|
formItemProps: { |
|
|
|
|
|
rules: [{ required: true, message: '此项为必填项!' }] |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '编码', |
|
|
title: '编码', |
|
|
dataIndex: 'code', |
|
|
dataIndex: 'code', |
|
|
formItemProps:{ |
|
|
|
|
|
rules:[{ required: true, message: '此项为必填项!' }] |
|
|
|
|
|
|
|
|
formItemProps: { |
|
|
|
|
|
rules: [{ required: true, message: '此项为必填项!' }] |
|
|
}, |
|
|
}, |
|
|
search: false, |
|
|
search: false, |
|
|
}, |
|
|
}, |
|
@@ -99,7 +103,7 @@ export default () => { |
|
|
{ |
|
|
{ |
|
|
title: '操作', |
|
|
title: '操作', |
|
|
valueType: 'option', |
|
|
valueType: 'option', |
|
|
fixed:'right', |
|
|
|
|
|
|
|
|
fixed: 'right', |
|
|
render: (text, row) => [ |
|
|
render: (text, row) => [ |
|
|
<Space key={+new Date() + Math.random()}> |
|
|
<Space key={+new Date() + Math.random()}> |
|
|
<Button type='primary' size='small' onClick={() => { |
|
|
<Button type='primary' size='small' onClick={() => { |
|
@@ -215,7 +219,7 @@ export default () => { |
|
|
} |
|
|
} |
|
|
}} |
|
|
}} |
|
|
pagination={{ |
|
|
pagination={{ |
|
|
pageSize: 5, |
|
|
|
|
|
|
|
|
pageSize: 10, |
|
|
showSizeChanger: false |
|
|
showSizeChanger: false |
|
|
}} |
|
|
}} |
|
|
rowKey="id" |
|
|
rowKey="id" |
|
@@ -252,269 +256,277 @@ export default () => { |
|
|
<div>产品名称:{selectRow?.name}</div> |
|
|
<div>产品名称:{selectRow?.name}</div> |
|
|
<div>产品描述:{selectRow?.description}</div> |
|
|
<div>产品描述:{selectRow?.description}</div> |
|
|
</ProCard> |
|
|
</ProCard> |
|
|
|
|
|
|
|
|
<ProTable<deviceProduct.output> |
|
|
|
|
|
type={funcfromType as 'table'} |
|
|
|
|
|
cardBordered |
|
|
|
|
|
bordered |
|
|
|
|
|
scroll={{ x: true }} |
|
|
|
|
|
rowClassName={(record: any, index: number, indent: number) => { |
|
|
|
|
|
if (index % 2 === 0) { |
|
|
|
|
|
return ''; // 偶数行的类名 |
|
|
|
|
|
} else { |
|
|
|
|
|
return 'even-row-background'; // 奇数行的类名 |
|
|
|
|
|
} |
|
|
|
|
|
}} |
|
|
|
|
|
headerTitle="列表" |
|
|
|
|
|
formRef={funcRef} |
|
|
|
|
|
actionRef={funcActionRef} |
|
|
|
|
|
search={false} |
|
|
|
|
|
columns={[ |
|
|
|
|
|
{ |
|
|
|
|
|
title: '功能主键', |
|
|
|
|
|
dataIndex: 'id', |
|
|
|
|
|
search: false, |
|
|
|
|
|
formItemProps: { |
|
|
|
|
|
hidden: true |
|
|
|
|
|
}, |
|
|
|
|
|
readonly: true, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '功能名称', |
|
|
|
|
|
dataIndex: 'name', |
|
|
|
|
|
ellipsis: true, |
|
|
|
|
|
search: false, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<ProTable<deviceProduct.output> |
|
|
|
|
|
type={funcfromType as 'table'} |
|
|
|
|
|
cardBordered |
|
|
|
|
|
bordered |
|
|
|
|
|
scroll={{ x: true }} |
|
|
|
|
|
rowClassName={(record: any, index: number, indent: number) => { |
|
|
|
|
|
if (index % 2 === 0) { |
|
|
|
|
|
return ''; // 偶数行的类名 |
|
|
|
|
|
} else { |
|
|
|
|
|
return 'even-row-background'; // 奇数行的类名 |
|
|
|
|
|
} |
|
|
|
|
|
}} |
|
|
|
|
|
headerTitle="列表" |
|
|
|
|
|
formRef={funcRef} |
|
|
|
|
|
actionRef={funcActionRef} |
|
|
|
|
|
search={false} |
|
|
|
|
|
columns={[ |
|
|
|
|
|
{ |
|
|
|
|
|
title: '功能主键', |
|
|
|
|
|
dataIndex: 'id', |
|
|
|
|
|
search: false, |
|
|
|
|
|
formItemProps: { |
|
|
|
|
|
hidden: true |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
|
|
|
title: '功能编码', |
|
|
|
|
|
hideInDescriptions: true, |
|
|
|
|
|
dataIndex: 'code', |
|
|
|
|
|
search: false, |
|
|
|
|
|
}, { |
|
|
|
|
|
title: '输入参数', |
|
|
|
|
|
hideInDescriptions: true, |
|
|
|
|
|
hideInTable: true, |
|
|
|
|
|
dataIndex: "params", |
|
|
|
|
|
search: false, |
|
|
|
|
|
renderFormItem(schema, config, form, action?) { |
|
|
|
|
|
// let b = JSON.parse(config?.record!.params); |
|
|
|
|
|
return ( |
|
|
|
|
|
<div> |
|
|
|
|
|
{funcParams.map((res: ParmForm, index: number) => ( |
|
|
|
|
|
<Row key={+new Date() + Math.random()} style={{ borderBottom: "0.5px solid #f3e0e0", margin: "10px" }}> |
|
|
|
|
|
<Space split={<Divider type="vertical" />}> |
|
|
|
|
|
<div>参数名称:{res.paramName}</div> |
|
|
|
|
|
<div>参数代码:{res.paramCode}</div> |
|
|
|
|
|
<Button type='link' onClick={() => { |
|
|
|
|
|
setParamsModelOpen(true) |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
paramsForm.setFieldsValue(funcParams[index]); |
|
|
|
|
|
}, 100); |
|
|
|
|
|
}}>设置</Button> |
|
|
|
|
|
<Button type='link' onClick={() => { |
|
|
|
|
|
const newData = [...funcParams]; |
|
|
|
|
|
newData.splice(index, 1); |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
setFuncParams(newData); |
|
|
|
|
|
}, 100); |
|
|
|
|
|
}}>删除</Button> |
|
|
|
|
|
</Space> |
|
|
|
|
|
</Row> |
|
|
|
|
|
) |
|
|
|
|
|
)} |
|
|
|
|
|
<Button type='link' onClick={() => { |
|
|
|
|
|
paramsForm.resetFields(); |
|
|
|
|
|
setParamsModelOpen(true) |
|
|
|
|
|
}}>+增加参数</Button> |
|
|
|
|
|
<Modal |
|
|
|
|
|
maskClosable={false} destroyOnClose title="设置参数" footer={false} onCancel={() => setParamsModelOpen(false)} open={paramsModelOpen}> |
|
|
|
|
|
<ProForm form={paramsForm} id="paramsForm" |
|
|
|
|
|
onFinish={async (values) => { |
|
|
|
|
|
console.log(values); |
|
|
|
|
|
const b = paramsForm.getFieldsValue(); |
|
|
|
|
|
if (b.id) { |
|
|
|
|
|
funcParams.forEach((res) => { |
|
|
|
|
|
if (res.id === b.id) { |
|
|
|
|
|
res.paramCode = b.paramCode; |
|
|
|
|
|
res.paramName = b.paramName; |
|
|
|
|
|
res.paramType = b.paramType; |
|
|
|
|
|
res.paramUnit = b.paramUnit; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
setFuncParams(funcParams); |
|
|
|
|
|
} else { |
|
|
|
|
|
b.id = uuid() |
|
|
|
|
|
funcParams.push(b); |
|
|
|
|
|
} |
|
|
|
|
|
setFuncParams(funcParams); |
|
|
|
|
|
console.log(b); |
|
|
|
|
|
setParamsModelOpen(false) |
|
|
|
|
|
|
|
|
readonly: true, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '功能名称', |
|
|
|
|
|
dataIndex: 'name', |
|
|
|
|
|
ellipsis: true, |
|
|
|
|
|
search: false, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '功能编码', |
|
|
|
|
|
hideInDescriptions: true, |
|
|
|
|
|
dataIndex: 'code', |
|
|
|
|
|
search: false, |
|
|
|
|
|
}, { |
|
|
|
|
|
title: '输入参数', |
|
|
|
|
|
hideInDescriptions: true, |
|
|
|
|
|
hideInTable: true, |
|
|
|
|
|
dataIndex: "params", |
|
|
|
|
|
search: false, |
|
|
|
|
|
renderFormItem(schema, config, form, action?) { |
|
|
|
|
|
// let b = JSON.parse(config?.record!.params); |
|
|
|
|
|
return ( |
|
|
|
|
|
<div> |
|
|
|
|
|
{funcParams.map((res: ParmForm, index: number) => ( |
|
|
|
|
|
<Row key={+new Date() + Math.random()} style={{ borderBottom: "0.5px solid #f3e0e0", margin: "10px" }}> |
|
|
|
|
|
<Space split={<Divider type="vertical" />}> |
|
|
|
|
|
<div>参数名称:{res.paramName}</div> |
|
|
|
|
|
<div>参数代码:{res.paramCode}</div> |
|
|
|
|
|
<Button type='link' onClick={() => { |
|
|
|
|
|
setParamsModelOpen(true) |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
console.log('funcParams[index]', funcParams[index]); |
|
|
|
|
|
|
|
|
}}> |
|
|
|
|
|
<Form.Item label="主键" hidden name="id"> |
|
|
|
|
|
<Input></Input> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<Form.Item label="参数名称" name="paramName" rules={[{ required: true, message: '此项为必填项!' }]}> |
|
|
|
|
|
<Input></Input> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<Form.Item label="参数代码" name="paramCode" rules={[{ required: true, message: '此项为必填项!' }]}> |
|
|
|
|
|
<Input></Input> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<Form.Item label="参数类型" name="paramType" rules={[{ required: true, message: '此项为必填项!' }]}> |
|
|
|
|
|
<Select onChange={(value) => { |
|
|
|
|
|
if (value === 0) { |
|
|
|
|
|
setIsParamsUnit(false) |
|
|
|
|
|
} else { |
|
|
|
|
|
setIsParamsUnit(true) |
|
|
|
|
|
|
|
|
paramsForm.setFieldsValue(funcParams[index]); |
|
|
|
|
|
setIsParamsUnit(funcParams[index].paramType) |
|
|
|
|
|
}, 100); |
|
|
|
|
|
}}>设置</Button> |
|
|
|
|
|
<Button type='link' onClick={() => { |
|
|
|
|
|
const newData = [...funcParams]; |
|
|
|
|
|
newData.splice(index, 1); |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
setFuncParams(newData); |
|
|
|
|
|
}, 100); |
|
|
|
|
|
}}>删除</Button> |
|
|
|
|
|
</Space> |
|
|
|
|
|
</Row> |
|
|
|
|
|
) |
|
|
|
|
|
)} |
|
|
|
|
|
<Button type='link' onClick={() => { |
|
|
|
|
|
paramsForm.resetFields(); |
|
|
|
|
|
setParamsModelOpen(true) |
|
|
|
|
|
}}>+增加参数</Button> |
|
|
|
|
|
<Modal |
|
|
|
|
|
maskClosable={false} destroyOnClose title="设置参数" footer={false} onCancel={() => setParamsModelOpen(false)} open={paramsModelOpen}> |
|
|
|
|
|
<ProForm form={paramsForm} id="paramsForm" |
|
|
|
|
|
onFinish={async (values) => { |
|
|
|
|
|
console.log(values); |
|
|
|
|
|
const b = paramsForm.getFieldsValue(); |
|
|
|
|
|
if (b.id) { |
|
|
|
|
|
funcParams.forEach((res) => { |
|
|
|
|
|
if (res.id === b.id) { |
|
|
|
|
|
res.paramCode = b.paramCode; |
|
|
|
|
|
res.paramName = b.paramName; |
|
|
|
|
|
res.paramType = b.paramType; |
|
|
|
|
|
res.paramUnit = b.paramUnit; |
|
|
} |
|
|
} |
|
|
}} placeholder="选择数据类型" options={ParmsTypeList}> |
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
setFuncParams(funcParams); |
|
|
|
|
|
} else { |
|
|
|
|
|
b.id = uuid() |
|
|
|
|
|
funcParams.push(b); |
|
|
|
|
|
} |
|
|
|
|
|
setFuncParams(funcParams); |
|
|
|
|
|
console.log(b); |
|
|
|
|
|
setParamsModelOpen(false) |
|
|
|
|
|
|
|
|
</Select> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<Form.Item label="参数单位" hidden={isParamsUnit} name="paramUnit" rules={[{ required: !isParamsUnit, message: '此项为必填项!' }]}> |
|
|
|
|
|
<Input></Input> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
</ProForm> |
|
|
|
|
|
</Modal> |
|
|
|
|
|
</div> |
|
|
|
|
|
) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
}}> |
|
|
|
|
|
<Form.Item label="主键" hidden name="id"> |
|
|
|
|
|
<Input></Input> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<Form.Item label="参数名称" name="paramName" rules={[{ required: true, message: '此项为必填项!' }]}> |
|
|
|
|
|
<Input></Input> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<Form.Item label="参数代码" name="paramCode" rules={[{ required: true, message: '此项为必填项!' }]}> |
|
|
|
|
|
<Input></Input> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<Form.Item label="参数类型" name="paramType" rules={[{ required: true, message: '此项为必填项!' }]}> |
|
|
|
|
|
<Select onChange={(value) => { |
|
|
|
|
|
setIsParamsUnit(value) |
|
|
|
|
|
}} placeholder="选择数据类型" options={ParmsTypeList}> |
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '描述', |
|
|
|
|
|
dataIndex: 'description', |
|
|
|
|
|
search: false, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '操作', |
|
|
|
|
|
valueType: 'option', |
|
|
|
|
|
dataIndex: 'id', |
|
|
|
|
|
fixed:'right', |
|
|
|
|
|
render: (text, row) => [ |
|
|
|
|
|
<Space key={+new Date() + Math.random()}> |
|
|
|
|
|
<a onClick={() => { |
|
|
|
|
|
setFuncFromType('form') |
|
|
|
|
|
console.log('row', row); |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
funcRef.current?.setFieldsValue(row) |
|
|
|
|
|
if (row.params) { |
|
|
|
|
|
const ppp = JSON.parse(row.params) |
|
|
|
|
|
setFuncParams(ppp) |
|
|
|
|
|
} else { |
|
|
|
|
|
setFuncParams([]) |
|
|
|
|
|
|
|
|
</Select> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
{isParamsUnit ===1 ? |
|
|
|
|
|
<Form.Item label="参数单位" name="paramUnit" rules={[{ required: true, message: '此项为必填项!' }]}> |
|
|
|
|
|
<Input></Input> |
|
|
|
|
|
</Form.Item>:"" |
|
|
|
|
|
} |
|
|
|
|
|
{isParamsUnit === 2 ? |
|
|
|
|
|
<Form.Item label="数据源" name="paramSouce" rules={[{ required: true, message: '此项为必填项!' }]}> |
|
|
|
|
|
<Input.TextArea rows={10}> |
|
|
|
|
|
</Input.TextArea> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
:"" |
|
|
} |
|
|
} |
|
|
|
|
|
</ProForm> |
|
|
|
|
|
</Modal> |
|
|
|
|
|
</div> |
|
|
|
|
|
) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
}, 200); |
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '描述', |
|
|
|
|
|
dataIndex: 'description', |
|
|
|
|
|
search: false, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '操作', |
|
|
|
|
|
valueType: 'option', |
|
|
|
|
|
dataIndex: 'id', |
|
|
|
|
|
fixed: 'right', |
|
|
|
|
|
render: (text, row) => [ |
|
|
|
|
|
<Space key={+new Date() + Math.random()}> |
|
|
|
|
|
<a onClick={() => { |
|
|
|
|
|
setFuncFromType('form') |
|
|
|
|
|
console.log('row', row); |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
funcRef.current?.setFieldsValue(row) |
|
|
|
|
|
if (row.params) { |
|
|
|
|
|
const ppp = JSON.parse(row.params) |
|
|
|
|
|
setFuncParams(ppp) |
|
|
|
|
|
} else { |
|
|
|
|
|
setFuncParams([]) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}} key={+new Date() + Math.random()} target="_blank" rel="noopener noreferrer"> |
|
|
|
|
|
编辑 |
|
|
|
|
|
</a> |
|
|
|
|
|
<Popconfirm |
|
|
|
|
|
key="del" |
|
|
|
|
|
title="确定要删除此条数据吗?" |
|
|
|
|
|
onConfirm={() => { |
|
|
|
|
|
|
|
|
}, 200); |
|
|
|
|
|
|
|
|
deviceProducFunctiontApi.Del(row).then((res: MyResponse.Content) => { |
|
|
|
|
|
if (res.statusCode === 200) { |
|
|
|
|
|
message.info("删除成功!"); |
|
|
|
|
|
Reolod() |
|
|
|
|
|
} else { |
|
|
|
|
|
message.error(res.errors); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}} |
|
|
|
|
|
onCancel={() => { |
|
|
|
|
|
message.info('已取消删除'); |
|
|
|
|
|
}} |
|
|
|
|
|
okText="确认" |
|
|
|
|
|
cancelText="关闭" |
|
|
|
|
|
> |
|
|
|
|
|
<a> |
|
|
|
|
|
删除 |
|
|
|
|
|
</a> |
|
|
|
|
|
</Popconfirm> |
|
|
|
|
|
</Space> |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
]} |
|
|
|
|
|
onSubmit={(params: any) => { |
|
|
|
|
|
console.log(params, funcParams); |
|
|
|
|
|
params.params = JSON.stringify(funcParams); |
|
|
|
|
|
params.deviceProductId = selectRow?.id |
|
|
|
|
|
if (funcfromType === 'form') { |
|
|
|
|
|
if (params.id) { |
|
|
|
|
|
deviceProducFunctiontApi.Update(params).then((res: MyResponse.Content) => { |
|
|
|
|
|
if (res.statusCode === 200) { |
|
|
|
|
|
message.info("更新成功!"); |
|
|
|
|
|
setFuncFromType('table') |
|
|
|
|
|
FuncReolod() |
|
|
|
|
|
} else { |
|
|
|
|
|
message.error(res.errors); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
deviceProducFunctiontApi.Add(params).then((res: MyResponse.Content) => { |
|
|
|
|
|
if (res.statusCode === 200) { |
|
|
|
|
|
message.info("新增成功!"); |
|
|
|
|
|
setFuncFromType('table') |
|
|
|
|
|
FuncReolod() |
|
|
|
|
|
} else { |
|
|
|
|
|
message.error(res.errors); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}} |
|
|
|
|
|
request={async (params = {}) => { |
|
|
|
|
|
const jsonData: deviceProductFunction.queryPage = { |
|
|
|
|
|
pageIndex: params.current || 1, |
|
|
|
|
|
pageSize: params.pageSize || 10, |
|
|
|
|
|
deviceProductId: selectRow?.id |
|
|
|
|
|
}; |
|
|
|
|
|
const response = await deviceProducFunctiontApi.PagedList(jsonData); |
|
|
|
|
|
if (response.statusCode === 200) { |
|
|
|
|
|
return { |
|
|
|
|
|
data: response.data.items, |
|
|
|
|
|
success: true, |
|
|
|
|
|
total: response.data.total, |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
}} key={+new Date() + Math.random()} target="_blank" rel="noopener noreferrer"> |
|
|
|
|
|
编辑 |
|
|
|
|
|
</a> |
|
|
|
|
|
<Popconfirm |
|
|
|
|
|
key="del" |
|
|
|
|
|
title="确定要删除此条数据吗?" |
|
|
|
|
|
onConfirm={() => { |
|
|
|
|
|
|
|
|
|
|
|
deviceProducFunctiontApi.Del(row).then((res: MyResponse.Content) => { |
|
|
|
|
|
if (res.statusCode === 200) { |
|
|
|
|
|
message.info("删除成功!"); |
|
|
|
|
|
Reolod() |
|
|
|
|
|
} else { |
|
|
|
|
|
message.error(res.errors); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}} |
|
|
|
|
|
onCancel={() => { |
|
|
|
|
|
message.info('已取消删除'); |
|
|
|
|
|
}} |
|
|
|
|
|
okText="确认" |
|
|
|
|
|
cancelText="关闭" |
|
|
|
|
|
> |
|
|
|
|
|
<a> |
|
|
|
|
|
删除 |
|
|
|
|
|
</a> |
|
|
|
|
|
</Popconfirm> |
|
|
|
|
|
</Space> |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
]} |
|
|
|
|
|
onSubmit={(params: any) => { |
|
|
|
|
|
console.log(params, funcParams); |
|
|
|
|
|
params.params = JSON.stringify(funcParams); |
|
|
|
|
|
params.deviceProductId = selectRow?.id |
|
|
|
|
|
if (funcfromType === 'form') { |
|
|
|
|
|
if (params.id) { |
|
|
|
|
|
deviceProducFunctiontApi.Update(params).then((res: MyResponse.Content) => { |
|
|
|
|
|
if (res.statusCode === 200) { |
|
|
|
|
|
message.info("更新成功!"); |
|
|
|
|
|
setFuncFromType('table') |
|
|
|
|
|
FuncReolod() |
|
|
|
|
|
} else { |
|
|
|
|
|
message.error(res.errors); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
return { |
|
|
|
|
|
data: [], |
|
|
|
|
|
success: false, |
|
|
|
|
|
total: 0, |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
}} |
|
|
|
|
|
form={{ |
|
|
|
|
|
ignoreRules: true,// 自定义提交按钮的属性 |
|
|
|
|
|
submitter: { |
|
|
|
|
|
onReset: () => { |
|
|
|
|
|
funcRef.current?.resetFields(); |
|
|
|
|
|
setFuncFromType("table") |
|
|
|
|
|
}, |
|
|
|
|
|
searchConfig: { resetText: funcfromType === 'form' ? '返回' : '重置', submitText: funcfromType === 'form' ? '提交' : '查询' }, |
|
|
|
|
|
|
|
|
deviceProducFunctiontApi.Add(params).then((res: MyResponse.Content) => { |
|
|
|
|
|
if (res.statusCode === 200) { |
|
|
|
|
|
message.info("新增成功!"); |
|
|
|
|
|
setFuncFromType('table') |
|
|
|
|
|
FuncReolod() |
|
|
|
|
|
} else { |
|
|
|
|
|
message.error(res.errors); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
}} |
|
|
|
|
|
pagination={{ |
|
|
|
|
|
pageSize: 5, |
|
|
|
|
|
showSizeChanger: false |
|
|
|
|
|
}} |
|
|
|
|
|
rowKey="id" |
|
|
|
|
|
dateFormatter="string" |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}} |
|
|
|
|
|
request={async (params = {}) => { |
|
|
|
|
|
const jsonData: deviceProductFunction.queryPage = { |
|
|
|
|
|
pageIndex: params.current || 1, |
|
|
|
|
|
pageSize: params.pageSize || 10, |
|
|
|
|
|
deviceProductId: selectRow?.id |
|
|
|
|
|
}; |
|
|
|
|
|
const response = await deviceProducFunctiontApi.PagedList(jsonData); |
|
|
|
|
|
if (response.statusCode === 200) { |
|
|
|
|
|
return { |
|
|
|
|
|
data: response.data.items, |
|
|
|
|
|
success: true, |
|
|
|
|
|
total: response.data.total, |
|
|
|
|
|
}; |
|
|
|
|
|
} else { |
|
|
|
|
|
return { |
|
|
|
|
|
data: [], |
|
|
|
|
|
success: false, |
|
|
|
|
|
total: 0, |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
}} |
|
|
|
|
|
form={{ |
|
|
|
|
|
ignoreRules: true,// 自定义提交按钮的属性 |
|
|
|
|
|
submitter: { |
|
|
|
|
|
onReset: () => { |
|
|
|
|
|
funcRef.current?.resetFields(); |
|
|
|
|
|
setFuncFromType("table") |
|
|
|
|
|
}, |
|
|
|
|
|
searchConfig: { resetText: funcfromType === 'form' ? '返回' : '重置', submitText: funcfromType === 'form' ? '提交' : '查询' }, |
|
|
|
|
|
} |
|
|
|
|
|
}} |
|
|
|
|
|
pagination={{ |
|
|
|
|
|
pageSize: 10, |
|
|
|
|
|
showSizeChanger: false |
|
|
|
|
|
}} |
|
|
|
|
|
rowKey="id" |
|
|
|
|
|
dateFormatter="string" |
|
|
|
|
|
|
|
|
|
|
|
toolBarRender={() => [ |
|
|
|
|
|
<Button key="3" type="primary" onClick={() => { |
|
|
|
|
|
setFuncFromType('form'); |
|
|
|
|
|
setFuncParams([]) |
|
|
|
|
|
}}> |
|
|
|
|
|
<PlusOutlined /> |
|
|
|
|
|
添加功能 |
|
|
|
|
|
</Button>, |
|
|
|
|
|
]} |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
toolBarRender={() => [ |
|
|
|
|
|
<Button key="3" type="primary" onClick={() => { |
|
|
|
|
|
setFuncFromType('form'); |
|
|
|
|
|
setFuncParams([]) |
|
|
|
|
|
}}> |
|
|
|
|
|
<PlusOutlined /> |
|
|
|
|
|
添加功能 |
|
|
|
|
|
</Button>, |
|
|
|
|
|
]} |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
</> |
|
|
</> |
|
|
} |
|
|
} |
|
|
</> |
|
|
</> |
|
|