Commit e76ef1eb authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

🐞 fix(采购询价): 添加采购物料加上不可重复选择物货号

parent c0ccd3b5
......@@ -56,11 +56,18 @@ const Table: React.FC<Iprops> = (props: any) => {
/** 列表数据 */
const fetchData = (params?: any) => {
return new Promise((resolve, reject) => {
if (!Array.isArray(fetch)) {
fetch({ ...params }).then(res => {
resolve(res.data)
}).catch(error => {
console.warn(error)
})
return
}
resolve({
code: 1000,
data: fetch
})
})
}
......@@ -119,7 +126,7 @@ const Table: React.FC<Iprops> = (props: any) => {
<StandardTable
currentRef={tableRef}
columns={columns}
tableProps={{ rowKew: 'id' }}
tableProps={{ rowKey: 'id' }}
rowSelection={selectedRow && rowSelection}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
......
......@@ -109,10 +109,8 @@ const BasicInfo: React.FC<Iprops> = (props: any) => {
city[idx] = { citydata: res.data }
setcity([...city])
}
})
}).catch(() => {})
}
}).catch(error => {
console.warn(error)
})
} else {
......@@ -130,13 +128,11 @@ const BasicInfo: React.FC<Iprops> = (props: any) => {
})
setcity([...city])
}
console.log(2)
setrequisitionFormAddress(result);
}
/** 选择城市的时候下拉就调用方 */
const onDropdownVisibleChange = () => {
console.log(1)
return new Promise(reslove => reslove(code)).then((res: any) => {
city.forEach((item: any) => {
item.citydata.filter(it => {
......@@ -148,8 +144,6 @@ const BasicInfo: React.FC<Iprops> = (props: any) => {
})
})
setcity([...city])
}).catch(error => {
console.warn(error)
})
}
......
......@@ -182,6 +182,7 @@ const Material: React.FC<Iprops> = (props: any) => {
}
}, [fetchdata])
return (
<>
<Form
......@@ -222,6 +223,7 @@ const Material: React.FC<Iprops> = (props: any) => {
{materielMode === 1
&& (
<AnchorModal
dataSource={dataSource}
preview={isPreview}
edit={edit}
visible={flag}
......
......@@ -18,6 +18,8 @@ const layout: any = {
};
interface AnchorModalProps {
/** 列表数据 */
dataSource?: any[],
/** 显示隐藏 */
visible?: boolean,
/** 是否查看数据 */
......@@ -32,13 +34,14 @@ interface AnchorModalProps {
const AnchorModal: React.FC<AnchorModalProps> = (props: any) => {
const [form] = Form.useForm();
const { visible, preview, edit, onClose, onConfirm } = props;
const { dataSource, visible, preview, edit, onClose, onConfirm } = props;
const [loading, setloading] = useState<boolean>(false);
const [searchVisible, setSearchVisible] = useState<boolean>(false)
const [isSeleted, setIsSeleted] = useState<number>(1);
const [category, setcategory] = useState([]);
const [files, setFiles] = useState([]);
const [product, setProduct] = useState<any>({});
const [ids, setIds] = useState<Array<number>[]>([])
const [menu] = useState([
{ id: 1, label: '基本信息' },
......@@ -99,7 +102,6 @@ const AnchorModal: React.FC<AnchorModalProps> = (props: any) => {
console.warn(error)
})
}).then((data: any) => {
console.log(data)
setcategory(data)
})
}
......@@ -110,7 +112,6 @@ const AnchorModal: React.FC<AnchorModalProps> = (props: any) => {
setIsSeleted(1)
searchCategoryTree(null);
if (!isEmpty(edit)) {
console.log(edit)
form.setFieldsValue({
number: edit.number,
name: edit.name,
......@@ -122,11 +123,22 @@ const AnchorModal: React.FC<AnchorModalProps> = (props: any) => {
})
setFiles(edit.urls)
}
if (!isEmpty(dataSource)) {
const arr: Array<number>[] = []
dataSource.forEach(item => {
arr.push(item.goodsId)
});
setIds(arr)
}
}, [visible]);
/** 选择货品点击 */
const confirm = (selectRowKeys: string[] | number[], selectRowRecord: any) => {
const selectRow = selectRowRecord;
if (ids.includes(selectRow[0].id)) {
message.error('货品已存在,请勿重复选择!')
return
}
if (selectRow.length > 0) {
const data: any = selectRow[0]
if (data.customerCategory.category) {
......
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