Commit c4b50366 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix

parent 4a38f03d
export default {
'/api': {
'target': 'http://10.0.0.25:8100/',
'target': 'http://10.0.0.25:8900/',
'changeOrigin': true,
'pathRewrite': { '^/api' : '' },
}
......
import { GetProductGoodsGetGoodsListResponseDetail } from '@/services';
interface InnerAttributeValueList {
customerAttributeValueId: number;
value: string;
}
export interface IProductSelectAttribute {
attributeName: string;
customerAttributeId: number;
customerAttributeValueList: InnerAttributeValueList[]
isPrice: boolean;
}
export interface IProductModule {
attributeLists: any[];
productName: string;
productSelectAttribute: any[];
selectedGoods: any[];
productSelectAttribute: IProductSelectAttribute[];
selectedGoods: GetProductGoodsGetGoodsListResponseDetail[];
tableDataSource: any[];
priceAttributeParams: any[]; // 价格设置的传输数据
setProductName(name: string):void;
setProductSelectAttribute(list: any[]):void;
setSelectedGoods(lists: any[]):void;
setTableDataSource(datas: any[]):void;
clearData(data: any[]):void;
setAttributeLists(lists: any[]): void;
setProductName(name: string): void;
setProductSelectAttribute(list: IProductSelectAttribute[]): void;
setSelectedGoods(lists: GetProductGoodsGetGoodsListResponseDetail[]): void;
setTableDataSource<T>(datas: T[]): void;
clearData(data: any[]): void;
setPriceAttributeParams<T>(datas: T[]): void;
}
......@@ -127,8 +127,10 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
let seletCategoryId = value[1] || value[0]
if (value.length > 0) {
PublicApi.getProductCustomerGetCustomerCategoryById({ id: seletCategoryId }).then(res => {
onChangeAttributeList(res.data?.customerAttributeList)
setShowCategory(res.data.name)
const { data } = res
onChangeAttributeList(data?.customerAttributeList)
setShowCategory(data.name)
ProductStore.setAttributeLists(data?.customerAttributeList)
})
}
else
......
.colBox{
background-color: #FAFBFC;
position: relative;
ul{
margin-bottom: 42px;
margin-top: 12px;
list-style: none;
padding: 0;
li{
padding-left: 24px;
height: 32px;
line-height: 32px;
color: #172B4D;
display: flex;
justify-content: space-between;
margin: 8px 0;
cursor: pointer;
// span{
// padding-top: 12px;
// padding-bottom: 12px;
// }
a{
color: #97A0AF;
float: right;
padding-right: 24px;
}
}
.actived-li{
box-sizing: border-box;
font-weight: bold;
border-left: 2px solid #00B37A;
}
.tipTitle{
height:20px;
font-size:12px;
font-weight:400;
color:rgba(151,160,175,0.8);
line-height:20px;
margin: 25px 0 20px 0;
padding-left: 24px;
}
}
.addBtn{
margin-top: 30px;
background-color: #F4F5F7;
width: 100%;
position: absolute;
bottom: 0;
}
}
\ No newline at end of file
......@@ -49,6 +49,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
name="logistic-form"
labelAlign="left"
ref={logisticsFormRef}
colon={false}
>
<Form.Item
name="deliveryType"
......
......@@ -40,6 +40,7 @@ const OtherForm: React.FC<Iprops> = (props) => {
name="other-form"
labelAlign="left"
ref={otherFormRef}
colon={false}
>
<Form.Item
name="isInvoice"
......
......@@ -11,8 +11,6 @@ import { inject, observer } from 'mobx-react'
// import { IProductModule } from '@/module/productModule'
// import { IStore } from '@/store';
import { store } from '@/store'
import ProductDescForm from './productDescForm'
import { Effects } from 'bizcharts'
const layout = {
labelCol: {
......@@ -54,7 +52,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const [colums, setColumns] = useState<ColumnType<any>[]>()
const { ProductStore } = store
const { productName, selectedGoods, productSelectAttribute, tableDataSource, setTableDataSource, clearData } = ProductStore
const { productName, selectedGoods, productSelectAttribute, tableDataSource, setTableDataSource, clearData, setPriceAttributeParams } = ProductStore
_tableDataSource = useMemo(() =>tableDataSource, [tableDataSource]) // 保持最新值
......@@ -174,9 +172,9 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
combineArray.map((_rowArr: any[], i: any) => { // _rowArr 属性值数组
let _tempObj: any = { 索引: i ,商品名称: productName }
console.log(_rowArr,'_rowArr')
Array.isArray(_rowArr) && _rowArr.map((__rowArr, index) => {
Array.isArray(_rowArr) ? _rowArr.map((__rowArr, index) => {
_tempObj[_attributeNameArr[index]] = __rowArr
})
}) : _tempObj[_attributeNameArr[i]] = _rowArr
_tempObj['对应货品'] = selectedGoods.length > 0 && selectedGoods[0].id
_tempObj['单价'] = {}
_tableData.push(_tempObj)
......@@ -200,16 +198,22 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
console.log('生成传输数据', combineAttributeArray, attributeObjArr, attributeValObjArr)
Array.isArray(combineAttributeArray) && combineAttributeArray.map((item, index)=>{ // 当属性减少的时候 这个combine数组还是之前的
let _tempArr: any = [], _tempObj: any = {}
Array.isArray(item) && item.map((_item, _index)=>{
Array.isArray(item) ? item.map((_item, _index)=>{
let _tempObject: any = {};
_tempObject.customerAttributeId = attributeObjArr[_index].customerAttributeId
_tempObject.customerAttributeName = attributeObjArr[_index].attributeName
_tempObject.customerAttributeValueId = attributeValObjArr[_index].find(__item=>__item.value===item[_index]).customerAttributeValueId
_tempObject.value = item[_index]
_tempArr.push(_tempObject)
}) : _tempArr.push({
customerAttributeId: attributeObjArr[0].customerAttributeId,
customerAttributeName: attributeObjArr[0].attributeName,
customerAttributeValueId: attributeValObjArr[0][0].customerAttributeValueId,
value: item.toString()
})
_paramsArray.push({goodsId: _tableDataSource[index] && _tableDataSource[index]['对应货品'], goodsCustomerAttributeList: _tempArr, unitPrice: _tableDataSource[index]&&_tableDataSource[index]['单价']}) /*带上货品id 带上单价*/
})
setPriceAttributeParams(_paramsArray)
console.log(_paramsArray,'params')
}
......@@ -324,6 +328,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
name="price-form"
labelAlign="left"
ref={priceFormRef}
colon={false}
>
<Form.Item
name="unitId"
......
......@@ -85,12 +85,17 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
})
}
paramsArray.push(params)
console.log(paramsArray,'paramsArray')
let resultParams = Object.values(paramsArray.reduce((item, next)=>{
let _resultParams = Object.values(paramsArray.reduce((item, next)=>{
item[next.customerAttributeId] = next;
return item
},{}))
console.log(resultParams,'result', paramsArray) // 最终传输数据
//遍历 排空
let resultParams = _resultParams.filter((_item: any)=>_item.customerAttributeValueList.length!=0)
console.log(resultParams,'resultParams') // 最终传输数据
ProductStore.setProductSelectAttribute(resultParams)
}
......@@ -164,6 +169,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
labelAlign="left"
onFinish={onFinish}
ref={productAttributeFormRef}
colon={false}
>
<Tabs defaultActiveKey="1" tabPosition="left">
{
......
......@@ -6,7 +6,7 @@ import { PublicApi } from '@/services/api'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import { EyeOutlined } from '@ant-design/icons'
import { GetProductGoodsGetGoodsListResponseDetail } from '@/services';
import { inject, observer } from 'mobx-react'
// import { IProductModule } from '@/module/productModule'
// import { IStore } from '@/store';
......@@ -28,7 +28,7 @@ export interface Iprops {
const SelectGoodsForm: React.FC<Iprops> = (props) => {
const [selectGoodsForm] = Form.useForm()
const [showSelectGoods, setIsSelectGoods] = useState(false)
const [selectGoodsRow, setSelectGoodsRow] = useState<any[]>([]) // 模态框选择的行数据
const [selectGoodsRow, setSelectGoodsRow] = useState<GetProductGoodsGetGoodsListResponseDetail[]>([]) // 模态框选择的行数据
const [selectedGoodsRowKeys, setSelectedGoodsRowKeys] = useState<Array<number>>([])
const { ProductStore } = store
......@@ -104,6 +104,7 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
form={selectGoodsForm}
name="select-goods"
labelAlign="left"
colon={false}
>
<Form.Item
label="是否选择货品"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
import {action, computed, observable, runInAction} from 'mobx'
import { IProductModule } from '@/module/productModule'; // mobx要用到的数据类型
import { IProductModule, IProductSelectAttribute } from '@/module/productModule'; // mobx要用到的数据类型
import { GetProductGoodsGetGoodsListResponseDetail } from '@/services';
class ProductStore implements IProductModule {
@observable public attributeLists: any[] = [];
@observable public productName: string = "";
@observable public productSelectAttribute: any[] = [];
@observable public selectedGoods: any[] = [];
@observable public productSelectAttribute: IProductSelectAttribute[] = [];
@observable public selectedGoods: GetProductGoodsGetGoodsListResponseDetail[] = [];
@observable public tableDataSource: any[] = [];
@observable public priceAttributeParams: any[] = [];
/** 定义动作区块,外部调用,改变对应的状态 **/
// 可以改变存的testText值
@action.bound
public setAttributeLists(lists: any[]) {
this.attributeLists = lists;
}
@action.bound
public setProductName(name: string) {
this.productName = name;
}
......@@ -20,12 +28,12 @@ class ProductStore implements IProductModule {
}
@action.bound
public setSelectedGoods(list: any[]) {
public setSelectedGoods(list: GetProductGoodsGetGoodsListResponseDetail[]) {
this.selectedGoods = list;
}
@action.bound
public setTableDataSource(datas: any[]) {
public setTableDataSource<T>(datas: T[]) {
console.log(datas, 'innerBox')
this.tableDataSource = datas;
}
......@@ -35,6 +43,11 @@ class ProductStore implements IProductModule {
this.tableDataSource = data;
}
@action.bound
public setPriceAttributeParams<T>(datas: T[]) {
this.priceAttributeParams = datas
}
}
export default ProductStore
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