|
|
@@ -10,15 +10,19 @@ import Z3upFiles from '@/components/Z3upFiles'
|
|
|
import { treeOneIdByResFu } from '../Z1formSet/data'
|
|
|
import { useSelector } from 'react-redux'
|
|
|
import { RootState } from '@/store'
|
|
|
+import AddZiYuan from './AddZiYuan'
|
|
|
+import SelectGoods from '../SelectGoods'
|
|
|
+import { C1_APIgetGoodsListByFaBu } from '@/store/action/CinStorage/C1resIn'
|
|
|
type Props = {
|
|
|
sId: number
|
|
|
closeFu: () => void
|
|
|
succFu: (val: '新增' | '编辑', obj: any) => void
|
|
|
formZi: baseFormType[]
|
|
|
formDefId: number
|
|
|
+ kuList: any[]
|
|
|
}
|
|
|
|
|
|
-function AddGood({ formDefId, sId, closeFu, succFu, formZi }: Props) {
|
|
|
+function AddGood({ formDefId, sId, closeFu, succFu, formZi, kuList }: Props) {
|
|
|
// 级联选择
|
|
|
const jiLianKey = useMemo(() => {
|
|
|
return formZi.filter(v => ['关联标签', '关联字典'].includes(v.tag)).map(c => c.fieldName)
|
|
|
@@ -132,6 +136,11 @@ function AddGood({ formDefId, sId, closeFu, succFu, formZi }: Props) {
|
|
|
// 关联标签
|
|
|
const biaoQianTemp = useSelector((state: RootState) => state.B3resTag.dictAll)
|
|
|
|
|
|
+ // 点击关联资源
|
|
|
+ const [ziYuan, setZiYuan] = useState(false)
|
|
|
+
|
|
|
+ const [ziYuanId, setZiYuanId] = useState(0)
|
|
|
+
|
|
|
return (
|
|
|
<Modal
|
|
|
getContainer={() => document.querySelector('#root')!}
|
|
|
@@ -180,8 +189,9 @@ function AddGood({ formDefId, sId, closeFu, succFu, formZi }: Props) {
|
|
|
myUrl='cms/form/data/upload'
|
|
|
/>
|
|
|
) : item.fieldLabel === '关联资源' ? (
|
|
|
- // 待完善关联资源
|
|
|
- <Button type='primary'>关联资源</Button>
|
|
|
+ <Button type='primary' onClick={() => setZiYuan(true)}>
|
|
|
+ 关联资源
|
|
|
+ </Button>
|
|
|
) : null}
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -245,6 +255,30 @@ function AddGood({ formDefId, sId, closeFu, succFu, formZi }: Props) {
|
|
|
</Form.Item>
|
|
|
</Form>
|
|
|
</div>
|
|
|
+
|
|
|
+ {/* 点击关联资源 */}
|
|
|
+ {ziYuan ? (
|
|
|
+ <AddZiYuan
|
|
|
+ closeFu={() => setZiYuan(false)}
|
|
|
+ secletFu={val => setZiYuanId(val)}
|
|
|
+ kuList={kuList}
|
|
|
+ />
|
|
|
+ ) : null}
|
|
|
+
|
|
|
+ {/* 待完善 */}
|
|
|
+ {ziYuanId ? (
|
|
|
+ <SelectGoods
|
|
|
+ API_getList={C1_APIgetGoodsListByFaBu}
|
|
|
+ closeFu={() => setZiYuanId(0)}
|
|
|
+ dataResFu={data => {
|
|
|
+ console.log('-------', data)
|
|
|
+ }}
|
|
|
+ oldCheckArr={[]}
|
|
|
+ formDefId={ziYuanId}
|
|
|
+ kuList={kuList}
|
|
|
+ formZi={formZi}
|
|
|
+ />
|
|
|
+ ) : null}
|
|
|
</Modal>
|
|
|
)
|
|
|
}
|