Commit d2fa39b1 authored by TZW's avatar TZW

11301650

parent ec1c81c7
...@@ -20,11 +20,30 @@ function DetailPro(props) { ...@@ -20,11 +20,30 @@ function DetailPro(props) {
return { return {
request: async () => { request: async () => {
let res = await doFetch({ url: props.detailpath, params: props.params }); let res = await doFetch({ url: props.detailpath, params: props.params });
setcuritem(res?.data?.data ?? {}); if (props?.extendField) {
let obj = {};
res?.data?.data[props.extendField]?.forEach((it) => {
obj[it?.fieldId] = it?.fieldRealValue;
});
console.log('extendField:', obj);
setcuritem({
...(res?.data?.data ?? {}),
...obj,
});
console.log('drawerpro:', {
...(res?.data?.data ?? {}),
...obj,
});
return { return {
success: res?.code == '0000', success: res?.code == '0000',
data: res?.data?.data ?? {}, data:
{
...(res?.data?.data ?? {}),
...obj,
} ?? {},
}; };
}
}, },
}; };
} }
......
...@@ -7,7 +7,6 @@ import PropTypes from 'prop-types'; ...@@ -7,7 +7,6 @@ import PropTypes from 'prop-types';
function DrawerPro(props) { function DrawerPro(props) {
let newProps = { ...props }; let newProps = { ...props };
delete newProps.children; delete newProps.children;
const detailprops = { const detailprops = {
...newProps, ...newProps,
detailpath: props.detailpath, detailpath: props.detailpath,
......
...@@ -469,7 +469,6 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) { ...@@ -469,7 +469,6 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) {
params={params} params={params}
request={async (parse) => { request={async (parse) => {
let result = {}; let result = {};
console.log(curlinkparams);
for (let key in curlinkparams) { for (let key in curlinkparams) {
let reversekey = !curlinkparams[key] ? key : curlinkparams[key]; let reversekey = !curlinkparams[key] ? key : curlinkparams[key];
result[reversekey] = parse[key]; result[reversekey] = parse[key];
...@@ -496,6 +495,12 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) { ...@@ -496,6 +495,12 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) {
} else { } else {
ifclean = res?.data?.dataList.filter((it) => it.value == curval)?.[0]?.value; ifclean = res?.data?.dataList.filter((it) => it.value == curval)?.[0]?.value;
} }
console.log(
curval,
res?.data?.dataList?.map((it) => it.value),
curkey,
);
formRef?.current?.setFieldsValue({ [curkey]: ifclean }); formRef?.current?.setFieldsValue({ [curkey]: ifclean });
} }
return res?.data?.dataList ?? []; return res?.data?.dataList ?? [];
......
import { doFetch } from '@/utils/doFetch'; import { doFetch } from '@/utils/doFetch';
import { Image } from 'antd'; import { Image } from 'antd';
import { useState, useEffect } from 'react';
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
{ {
...@@ -19,11 +20,87 @@ function getcolumns(setdrawer) { ...@@ -19,11 +20,87 @@ function getcolumns(setdrawer) {
return ( return (
<a <a
onClick={() => { onClick={() => {
const [fieldscolumns, setfieldscolumns] = useState([
{
title: '用户名',
dataIndex: 'username',
key: 'username',
},
{
title: '姓名',
dataIndex: 'fullName',
key: 'fullName',
},
{ title: '手机号', hideInTable: true, dataIndex: 'telephone', key: 'telephone' },
{
title: '邮箱',
dataIndex: 'mailNo',
key: 'mailNo',
hideInTable: true,
search: false,
},
]);
const selectValueType = (type, options) => {
switch (type) {
case 1:
return {
valueType: 'input',
};
case 2:
return {
valueType: 'select',
options,
};
case 3:
return {
valueType: 'radio',
options,
};
case 4:
return {
valueType: 'select',
options,
};
default:
break;
}
};
useEffect(() => {
const fn = async () => {
let res = await doFetch({
url: '/base/paFormField/queryList',
params: {
formId: '1',
},
});
if (res?.data?.dataList) {
let column = [
{
title: '扩展字段',
valueType: 'split',
},
];
res?.data?.dataList?.forEach((el) => {
column.push({
...selectValueType(el.fieldChar, el.valueList),
title: el.fieldName,
dataIndex: el.fieldName,
key: el.id,
});
});
setfieldscolumns(fieldscolumns.concat(column));
}
};
fn();
}, []);
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row, item: row,
title: '详情', title: '详情',
fields: fieldscolumns,
extendField: 'userCharList',
detailpath: '/auth/sysUser/detail', detailpath: '/auth/sysUser/detail',
params: { id: row.id }, params: { id: row.id },
val: 'detail', val: 'detail',
...@@ -119,7 +196,7 @@ function getcolumns(setdrawer) { ...@@ -119,7 +196,7 @@ function getcolumns(setdrawer) {
factoryIdList: 'factoryIdList', factoryIdList: 'factoryIdList',
}, },
}, },
key: 'shopId', key: 'shopIdList',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ {
...@@ -138,7 +215,7 @@ function getcolumns(setdrawer) { ...@@ -138,7 +215,7 @@ function getcolumns(setdrawer) {
options: { options: {
path: '/auth/sysSection/getAllSectionSelectionByShopIdList', path: '/auth/sysSection/getAllSectionSelectionByShopIdList',
linkParams: { linkParams: {
shopId: 'shopIdList', shopIdList: '',
}, },
}, },
}, },
...@@ -159,7 +236,7 @@ function getcolumns(setdrawer) { ...@@ -159,7 +236,7 @@ function getcolumns(setdrawer) {
options: { options: {
path: '/auth/sysProductionLine/getAllProductLineSelectionByShopIdList', path: '/auth/sysProductionLine/getAllProductLineSelectionByShopIdList',
linkParams: { linkParams: {
shopId: 'shopIdList', shopIdList: '',
}, },
}, },
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44 * @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-30 14:10:10 * @Last Modified time: 2022-11-30 16:42:10
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -39,7 +39,7 @@ function User(props) { ...@@ -39,7 +39,7 @@ function User(props) {
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row, // item: row,
title: '详情', title: '详情',
val: 'detail', val: 'detail',
title: row.userName + '的详细信息', title: row.userName + '的详细信息',
...@@ -137,7 +137,6 @@ function User(props) { ...@@ -137,7 +137,6 @@ function User(props) {
const Adduser = () => { const Adduser = () => {
const [value, setValue] = useState(''); const [value, setValue] = useState('');
const [options, setOptions] = useState([]);
const [fieldscolumns, setfieldscolumns] = useState(columns); const [fieldscolumns, setfieldscolumns] = useState(columns);
const selectValueType = (type, options) => { const selectValueType = (type, options) => {
switch (type) { switch (type) {
...@@ -188,12 +187,12 @@ function User(props) { ...@@ -188,12 +187,12 @@ function User(props) {
key: el.id, key: el.id,
}); });
}); });
console.log('11111', column);
setfieldscolumns(fieldscolumns.concat(column)); setfieldscolumns(fieldscolumns.concat(column));
} }
}; };
fn(); fn();
}, []); }, []);
return ( return (
<> <>
<InitForm <InitForm
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment