|
|
|
@ -8,6 +8,7 @@ import { useProductsTypes } from '@/hooks/useProductsSets';
|
|
|
|
|
import Extras from './Detail/Extras';
|
|
|
|
|
import { groupBy } from '@/utils/commons';
|
|
|
|
|
import { useParams } from 'react-router-dom';
|
|
|
|
|
import useProductsStore from '@/stores/Products/Index';
|
|
|
|
|
import { useHTLanguageSets } from '@/hooks/useHTLanguageSets';
|
|
|
|
|
import { useDefaultLgc } from '@/i18n/LanguageSwitcher';
|
|
|
|
|
import BatchImportPrice from './Detail/BatchImportPrice1';
|
|
|
|
@ -37,6 +38,7 @@ function Detail() {
|
|
|
|
|
const HTLanguageSets = useHTLanguageSets();
|
|
|
|
|
const { Search } = Input;
|
|
|
|
|
|
|
|
|
|
const [editingProduct, setEditingProduct] = useProductsStore((state) => [state.editingProduct, state.setEditingProduct]);
|
|
|
|
|
|
|
|
|
|
const [expandedKeys, setExpandedKeys] = useState([]);
|
|
|
|
|
const [searchValue, setSearchValue] = useState('');
|
|
|
|
@ -51,53 +53,53 @@ function Detail() {
|
|
|
|
|
const productProject = {
|
|
|
|
|
"6": [],
|
|
|
|
|
"B": [
|
|
|
|
|
{ code: "code", name: t('products:Code') },
|
|
|
|
|
{ code: "city_name", name: t('products:City') },
|
|
|
|
|
{ code: "km", name: t('products:KM') },
|
|
|
|
|
{ code: "remarks", name: t('products:Remarks') }
|
|
|
|
|
{ code: "code", name: t('products:Code'), nameKey: 'products:Code' },
|
|
|
|
|
{ code: "city_name", name: t('products:City'), nameKey: 'products:City' },
|
|
|
|
|
{ code: "km", name: t('products:KM'), nameKey: 'products:KM' },
|
|
|
|
|
{ code: "remarks", name: t('products:Remarks'), nameKey: 'products:Remarks' }
|
|
|
|
|
],
|
|
|
|
|
"J": [
|
|
|
|
|
{ code: "code", name: t('products:Code') },
|
|
|
|
|
{ code: "city_name", name: t('products:City') },
|
|
|
|
|
{ code: "recommends_rate", name: t('products:recommendationRate') },
|
|
|
|
|
{ code: "duration", name: t('products:Duration') },
|
|
|
|
|
{ code: "dept_name", name: t('products:Dept') },
|
|
|
|
|
{ code: "display_to_c", name: t('products:DisplayToC') },
|
|
|
|
|
{ code: "remarks", name: t('products:Remarks') },
|
|
|
|
|
{ code: "code", name: t('products:Code'), nameKey: 'products:Code' },
|
|
|
|
|
{ code: "city_name", name: t('products:City'), nameKey: 'products:City' },
|
|
|
|
|
{ code: "recommends_rate", name: t('products:recommendationRate'), nameKey: 'products:recommendationRate' },
|
|
|
|
|
{ code: "duration", name: t('products:Duration'), nameKey: 'products:Duration' },
|
|
|
|
|
{ code: "dept_name", name: t('products:Dept'), nameKey: 'products:Dept' },
|
|
|
|
|
{ code: "display_to_c", name: t('products:DisplayToC'), nameKey: 'products:DisplayToC' },
|
|
|
|
|
{ code: "remarks", name: t('products:Remarks'), nameKey: 'products:Remarks' },
|
|
|
|
|
],
|
|
|
|
|
"Q": [
|
|
|
|
|
{ code: "code", name: t('products:Code') },
|
|
|
|
|
{ code: "city_name", name: t('products:City') },
|
|
|
|
|
{ code: "recommends_rate", name: t('products:recommendationRate') },
|
|
|
|
|
{ code: "duration", name: t('products:Duration') },
|
|
|
|
|
{ code: "dept_name", name: t('products:Dept') },
|
|
|
|
|
{ code: "display_to_c", name: t('products:DisplayToC') },
|
|
|
|
|
{ code: "remarks", name: t('products:Remarks') },
|
|
|
|
|
{ code: "code", name: t('products:Code'), nameKey: 'products:Code' },
|
|
|
|
|
{ code: "city_name", name: t('products:City'), nameKey: 'products:City' },
|
|
|
|
|
{ code: "recommends_rate", name: t('products:recommendationRate'), nameKey: 'products:recommendationRate' },
|
|
|
|
|
{ code: "duration", name: t('products:Duration'), nameKey: 'products:Duration' },
|
|
|
|
|
{ code: "dept_name", name: t('products:Dept'), nameKey: 'products:Dept' },
|
|
|
|
|
{ code: "display_to_c", name: t('products:DisplayToC'), nameKey: 'products:DisplayToC' },
|
|
|
|
|
{ code: "remarks", name: t('products:Remarks'), nameKey: 'products:Remarks' },
|
|
|
|
|
],
|
|
|
|
|
"D": [
|
|
|
|
|
{ code: "code", name: t('products:Code') },
|
|
|
|
|
{ code: "city_name", name: t('products:City') },
|
|
|
|
|
{ code: "recommends_rate", name: t('products:recommendationRate') },
|
|
|
|
|
{ code: "duration", name: t('products:Duration') },
|
|
|
|
|
{ code: "dept_name", name: t('products:Dept') },
|
|
|
|
|
{ code: "display_to_c", name: t('products:DisplayToC') },
|
|
|
|
|
{ code: "remarks", name: t('products:Remarks') },
|
|
|
|
|
{ code: "code", name: t('products:Code'), nameKey: 'products:Code' },
|
|
|
|
|
{ code: "city_name", name: t('products:City'), nameKey: 'products:City' },
|
|
|
|
|
{ code: "recommends_rate", name: t('products:recommendationRate'), nameKey: 'products:recommendationRate' },
|
|
|
|
|
{ code: "duration", name: t('products:Duration'), nameKey: 'products:Duration' },
|
|
|
|
|
{ code: "dept_name", name: t('products:Dept'), nameKey: 'products:Dept' },
|
|
|
|
|
{ code: "display_to_c", name: t('products:DisplayToC'), nameKey: 'products:DisplayToC' },
|
|
|
|
|
{ code: "remarks", name: t('products:Remarks'), nameKey: 'products:Remarks' },
|
|
|
|
|
],
|
|
|
|
|
"7": [
|
|
|
|
|
{ code: "code", name: t('products:Code') },
|
|
|
|
|
{ code: "city_name", name: t('products:City') },
|
|
|
|
|
{ code: "recommends_rate", name: t('products:recommendationRate') },
|
|
|
|
|
{ code: "duration", name: t('products:Duration') },
|
|
|
|
|
{ code: "open_weekdays", name: t('products:OpenWeekdays') },
|
|
|
|
|
{ code: "remarks", name: t('products:Remarks') },
|
|
|
|
|
{ code: "code", name: t('products:Code'), nameKey: 'products:Code' },
|
|
|
|
|
{ code: "city_name", name: t('products:City'), nameKey: 'products:City' },
|
|
|
|
|
{ code: "recommends_rate", name: t('products:recommendationRate'), nameKey: 'products:recommendationRate' },
|
|
|
|
|
{ code: "duration", name: t('products:Duration'), nameKey: 'products:Duration' },
|
|
|
|
|
{ code: "open_weekdays", name: t('products:OpenWeekdays'), nameKey: 'products:OpenWeekdays' },
|
|
|
|
|
{ code: "remarks", name: t('products:Remarks'), nameKey: 'products:Remarks' },
|
|
|
|
|
],
|
|
|
|
|
"8": [
|
|
|
|
|
{ code: "code", name: t('products:Code') },
|
|
|
|
|
{ code: "city_name", name: t('products:City') },
|
|
|
|
|
],
|
|
|
|
|
"R": [
|
|
|
|
|
{ code: "code", name: t('products:Code') },
|
|
|
|
|
{ code: "city_name", name: t('products:City') },
|
|
|
|
|
{ code: "code", name: t('products:Code'), nameKey: 'products:Code' },
|
|
|
|
|
{ code: "city_name", name: t('products:City'), nameKey: 'products:City' },
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
const [selectedCategory, setSelectedCategory] = useState(productProject.B);
|
|
|
|
@ -128,10 +130,12 @@ function Detail() {
|
|
|
|
|
children: (productsData[type.value] || []).map(product => ({
|
|
|
|
|
title: product.info.title,
|
|
|
|
|
key: `${type.value}-${product.info.id}`,
|
|
|
|
|
_raw: product,
|
|
|
|
|
}))
|
|
|
|
|
}));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const treeData = generateTreeData(productsTypes, groupedProducts);
|
|
|
|
|
console.log("treeData", treeData)
|
|
|
|
|
setTreeData(treeData);
|
|
|
|
@ -444,14 +448,16 @@ function Detail() {
|
|
|
|
|
const editable = isEditing(record);
|
|
|
|
|
return editable ? (
|
|
|
|
|
<span>
|
|
|
|
|
<a href="#!" onClick={() => handleSave(record.id)} style={{ marginRight: 8 }}>{t('products:save')}</a>
|
|
|
|
|
<Popconfirm title={t('products:sureCancel')} onConfirm={cancel}><a>{t('products:cancel')}</a></Popconfirm>
|
|
|
|
|
{/* <a href="#!" onClick={() => handleSave(record.id)} style={{ marginRight: 8 }}>{t('Save')}</a> */}
|
|
|
|
|
<Button type="link" onClick={() => handleSave(record.id)}>{t('Save')}</Button>
|
|
|
|
|
<Button type="link" onClick={cancel}>{t('Cancel')}</Button>
|
|
|
|
|
{/* <Popconfirm title={t('sureCancel')} onConfirm={cancel}><a>{t('Cancel')}</a></Popconfirm> */}
|
|
|
|
|
</span>
|
|
|
|
|
) : (
|
|
|
|
|
<span>
|
|
|
|
|
<a disabled={editingid !== ''} onClick={() => edit(record)} style={{ marginRight: 8 }}>{t('products:edit')}</a>
|
|
|
|
|
<Popconfirm title={t('products:sureDelete')} onConfirm={() => handleDelete(record.id)}>
|
|
|
|
|
<a>{t('products:delete')}</a>
|
|
|
|
|
<a disabled={editingid !== ''} onClick={() => edit(record)} style={{ marginRight: 8 }}>{t('Edit')}</a>
|
|
|
|
|
<Popconfirm title={t('sureDelete')} onConfirm={() => handleDelete(record.id)}>
|
|
|
|
|
<a>{t('Delete')}</a>
|
|
|
|
|
</Popconfirm>
|
|
|
|
|
</span>
|
|
|
|
|
);
|
|
|
|
@ -559,6 +565,8 @@ function Detail() {
|
|
|
|
|
setRemainderLanguage(HTLanguageSets.filter(item => item.key !== language.toString()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setEditingProduct(node._raw);
|
|
|
|
|
|
|
|
|
|
let initialQuotationData = null;
|
|
|
|
|
let infoData = null;
|
|
|
|
|
let lgcDetailsData = null;
|
|
|
|
@ -616,8 +624,8 @@ function Detail() {
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<Row>
|
|
|
|
|
<Col span={6}>
|
|
|
|
|
<Card style={{ width: "20%", position: "fixed", maxHeight: "80vh", overflowY: "auto" }}>
|
|
|
|
|
<Col span={6} className=' relative'>
|
|
|
|
|
<Card className='w-[inherit] fixed overflow-y-auto max-h-[80vh]'>
|
|
|
|
|
<Search style={{ marginBottom: 8 }} placeholder="Search" onChange={onChange} />
|
|
|
|
|
<Tree
|
|
|
|
|
onSelect={handleNodeSelect}
|
|
|
|
@ -633,18 +641,19 @@ function Detail() {
|
|
|
|
|
<Col span={18}>
|
|
|
|
|
<Form form={form} name="control-hooks" onFinish={onSave}>
|
|
|
|
|
<Card
|
|
|
|
|
style={{ width: "80%" }}
|
|
|
|
|
// style={{ width: "80%" }}
|
|
|
|
|
title={
|
|
|
|
|
<Breadcrumb items={[
|
|
|
|
|
{ title: <Link to={'/'}>供应商</Link> },
|
|
|
|
|
// { title: <Link to={'/'}>供应商</Link> },
|
|
|
|
|
{ title: <Link to={'/products'}>综费</Link> },
|
|
|
|
|
{ title: '文章列表' }
|
|
|
|
|
{ title: editingProduct?.info?.title || t('New') }
|
|
|
|
|
]} />
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<h2>{t('products:productProject')}</h2>
|
|
|
|
|
<h2>{t('products:EditComponents.info')}</h2>
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
|
{selectedCategory.map((item, index) => (
|
|
|
|
|
|
|
|
|
|
<Col span={8} id={index} key={`${item.code}-${index}`}>
|
|
|
|
|
<Form.Item name={['info', item.code]} label={item.name}>
|
|
|
|
|
{item.code === "duration" ? (
|
|
|
|
@ -667,6 +676,7 @@ function Detail() {
|
|
|
|
|
<div>
|
|
|
|
|
{tags.map(tag => (
|
|
|
|
|
<Tag
|
|
|
|
|
key={tag}
|
|
|
|
|
id={tag}
|
|
|
|
|
onClick={() => handleTagClick(tag)}
|
|
|
|
|
color={tag === selectedTag ? 'blue' : undefined}
|
|
|
|
@ -711,12 +721,12 @@ function Detail() {
|
|
|
|
|
/>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Card>
|
|
|
|
|
</Card>
|
|
|
|
|
{/* </Card> */}
|
|
|
|
|
|
|
|
|
|
<Card style={{ width: "80%" }}>
|
|
|
|
|
{/* <Card style={{ width: "80%" }}> */}
|
|
|
|
|
<h2>{t('products:supplierQuotation')}</h2>
|
|
|
|
|
<Form.Item name="quotation">
|
|
|
|
|
<Table
|
|
|
|
|
<Table rowKey={'id'}
|
|
|
|
|
components={{ body: { cell: EditableCell } }}
|
|
|
|
|
bordered
|
|
|
|
|
dataSource={quotation}
|
|
|
|
@ -730,20 +740,20 @@ function Detail() {
|
|
|
|
|
|
|
|
|
|
<Button onClick={handleBatchImport} type="primary" style={{ marginBottom: 16 }}>批量添加</Button>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
<Card style={{ width: "80%" }}>
|
|
|
|
|
<Extras productId={2} />
|
|
|
|
|
</Card>
|
|
|
|
|
<Button type="primary" htmlType="submit" style={{ marginTop: 16, float: "right", marginRight: "20%" }}>
|
|
|
|
|
{t('Save')}
|
|
|
|
|
</Button>
|
|
|
|
|
<Button type="primary" htmlType="submit" style={{ marginTop: 16, float: "right", marginRight: "5%" }}>
|
|
|
|
|
提交审核
|
|
|
|
|
</Button>
|
|
|
|
|
</Card>
|
|
|
|
|
</Form>
|
|
|
|
|
|
|
|
|
|
{/* <Card style={{ width: "80%" }}> */}
|
|
|
|
|
<Extras productId={2} />
|
|
|
|
|
{/* </Card> */}
|
|
|
|
|
|
|
|
|
|
<Button type="primary" htmlType="submit" style={{ marginTop: 16, float: "right", marginRight: "20%" }}>
|
|
|
|
|
{t('products:save')}
|
|
|
|
|
</Button>
|
|
|
|
|
<Button type="primary" htmlType="submit" style={{ marginTop: 16, float: "right", marginRight: "5%" }}>
|
|
|
|
|
提交审核
|
|
|
|
|
</Button>
|
|
|
|
|
</Form>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|