Commit ee4ea158 authored by wuhao's avatar wuhao 🎯

asder

parent 4b6399e8
......@@ -169,7 +169,13 @@ const Mtable = (props) => {
params: newparames,
request: async (params) => {
if (Object.keys(it?.options).includes('linkParams')) {
let list = await doFetch({ url: it?.options?.path, params: newparames });
let resparams = {},
linkParams = it?.options?.linkParams ?? {};
for (let i in linkParams) {
let paramsKey = !linkParams[i] ? i : linkParams[i];
resparams[paramsKey] = newparames[i];
}
let list = await doFetch({ url: it?.options?.path, params: resparams });
const res = list.data.dataList;
return it.valueType == 'treeSelect' ? handlEmptyChild(res) : res;
} else {
......@@ -356,19 +362,25 @@ const Mtable = (props) => {
{...datas}
size={size}
onSubmit={(params) => {
////console.log(params, 'onSubmit');
let newparams = {};
columns.map((it, i) => {
if (
it?.options?.linkParams &&
Object.keys(it?.options?.linkParams).includes(Object.keys(params)[0])
) {
for (let dataindex in it?.options?.linkParams) {
newparams[dataindex] = formRefs?.current?.getFieldValue?.(dataindex);
let newparams = {},
curkey = Object.keys(params)[Object.keys(params).length - 1],
curval = Object.values(params)[Object.keys(params).length - 1];
columns
?.filter((it) => !(it.search === false || it.hideInSearch === true))
.map((it, i) => {
let { linkParams } = it?.options ?? {};
if (linkParams && Object.keys(linkParams).includes(curkey)) {
for (let dataindex in linkParams) {
newparams[dataindex] = formRefs?.current?.getFieldValue?.(dataindex);
}
}
}
});
setnewparams(newparams);
});
if (Object.keys(newparams).length > 0) {
setnewparams((s) => ({
...s,
...newparams,
}));
}
}}
onSizeChange={(size) => {
localStorage.setItem('size', size); //设置全局表格规格缓存
......
......@@ -160,7 +160,6 @@ function getcolumns(setDrawer, ifs, formRef) {
{
title: '部门名称',
width: 120,
valueType: 'treeSelect',
dataIndex: 'departmentName',
fieldProps: {
......@@ -193,14 +192,12 @@ function getcolumns(setDrawer, ifs, formRef) {
mode: 'multiple',
},
width: 120,
valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
},
{
title: '负责车间',
dataIndex: 'shopNames',
fieldProps: {
placeholder: '请选择',
showSearch: true,
......@@ -211,7 +208,7 @@ function getcolumns(setDrawer, ifs, formRef) {
options: {
path: '/auth/sysShop/getShopSelectionByFactoryIdList',
linkParams: {
factoryIdList: 'factoryIdList',
factoryIdList: '',
},
},
key: 'shopIdList',
......@@ -240,7 +237,6 @@ function getcolumns(setDrawer, ifs, formRef) {
},
{
title: '负责产线',
search: false,
width: 120,
dataIndex: 'productionLines',
valueType: 'select',
......@@ -252,7 +248,6 @@ function getcolumns(setDrawer, ifs, formRef) {
search: false,
hideInTable: true,
key: 'productionLineIdList',
options: {
path: '/auth/sysProductionLine/getAllProductLineSelectionByShopIdList',
linkParams: {
......
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