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

fix: 暂存商品草稿,处理仓位列表不能修改仓位库存的问题,修复品类关联属性无法显示页面的问题

parent 8958df8f
...@@ -34,6 +34,7 @@ src/global/config/navigation.config.ts ...@@ -34,6 +34,7 @@ src/global/config/navigation.config.ts
src/services/*Api.ts src/services/*Api.ts
src/services/*Api src/services/*Api
config/routes/index.ts
config/router.config.json config/router.config.json
# 忽略yapi生成的文件 # 忽略yapi生成的文件
......
...@@ -8,10 +8,10 @@ import CommodityRoute from './commodityRoute' // 商品能力路由 ...@@ -8,10 +8,10 @@ import CommodityRoute from './commodityRoute' // 商品能力路由
import MemberRoute from './memberRoute' // 会员能力路由 import MemberRoute from './memberRoute' // 会员能力路由
// import ShopRoute from './shopRoute' // 店铺能力路由 // import ShopRoute from './shopRoute' // 店铺能力路由
// import ChannelRoute from './channelRoute' // 渠道能力路由 // import ChannelRoute from './channelRoute' // 渠道能力路由
import TranactionRoute from './tranactionRoute' // 交易能力路由 // import TranactionRoute from './tranactionRoute' // 交易能力路由
// import LogisticsRoute from './logisticsRoutes' // 物流能力路由 // import LogisticsRoute from './logisticsRoutes' // 物流能力路由
// import PayandSettleRoute from './payandSettle' //支付与结算 // import PayandSettleRoute from './payandSettle' //支付与结算
import AuthConfigRoute from './authConfigRoute' // import AuthConfigRoute from './authConfigRoute'
// import AfterService from './afterServiceRoute' // 售后 // import AfterService from './afterServiceRoute' // 售后
// import HandlingRoute from './handlingRoute'; // 加工能力 // import HandlingRoute from './handlingRoute'; // 加工能力
// import DealAbilityRoute from './dealAbilityRoute'; // // import DealAbilityRoute from './dealAbilityRoute'; //
...@@ -26,7 +26,7 @@ import ProcurementRoute from './procurementRoute'; // todo wuting ...@@ -26,7 +26,7 @@ import ProcurementRoute from './procurementRoute'; // todo wuting
// import contracRoute from './contracRoute'; // import contracRoute from './contracRoute';
// export const routes = [CommodityRoute, MemberRoute, ShopRoute, ChannelRoute, TranactionRoute, AfterService, PayandSettleRoute, LogisticsRoute, AuthConfigRoute, HandlingRoute, BalaceRoute] // export const routes = [CommodityRoute, MemberRoute, ShopRoute, ChannelRoute, TranactionRoute, AfterService, PayandSettleRoute, LogisticsRoute, AuthConfigRoute, HandlingRoute, BalaceRoute]
const isDev = process.env.NODE_ENV === "development"; const isDev = false;
const homeRoute = { const homeRoute = {
path: `/memberCenter/home`, path: `/memberCenter/home`,
name: 'home', name: 'home',
...@@ -34,7 +34,7 @@ const homeRoute = { ...@@ -34,7 +34,7 @@ const homeRoute = {
key: 'home', key: 'home',
component: '@/pages/home', component: '@/pages/home',
}; };
const routes = isDev ? [ homeRoute, OrderRoute ] : asyncRoutes; const routes = isDev ? [ CommodityRoute ] : asyncRoutes;
// const routes = isDev ? [ CommodityRoute ] : asyncRoutes; // const routes = isDev ? [ CommodityRoute ] : asyncRoutes;
const memberCenterRoute = { const memberCenterRoute = {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"upload:v2scm": "cross-env PRO_ENV=v2scm taskName=upload yarn scripts:build", "upload:v2scm": "cross-env PRO_ENV=v2scm taskName=upload yarn scripts:build",
"upload:v2Test": "cross-env PRO_ENV=v2Test taskName=upload yarn scripts:build", "upload:v2Test": "cross-env PRO_ENV=v2Test taskName=upload yarn scripts:build",
"api": "god-ytt", "api": "god-ytt",
"testApi": "cross-env PRO_ENV=v2 god-ytt", "testApi": "cross-env PRO_ENV=v2-220418 god-ytt",
"scripts:build": "node scripts/run", "scripts:build": "node scripts/run",
"scripts:build-test": "cross-env PRO_ENV=v2 node scripts/run", "scripts:build-test": "cross-env PRO_ENV=v2 node scripts/run",
"start:dev": "cross-env NODE_OPTIONS=--max_old_space_size=4096 umi dev", "start:dev": "cross-env NODE_OPTIONS=--max_old_space_size=4096 umi dev",
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
"start:v2scm": "cross-env PRO_ENV=v2scm yarn start", "start:v2scm": "cross-env PRO_ENV=v2scm yarn start",
"start:v2-220318": "cross-env PRO_ENV=v2-220318 yarn start", "start:v2-220318": "cross-env PRO_ENV=v2-220318 yarn start",
"start:v2-220418": "cross-env PRO_ENV=v2-220418 yarn start" "start:v2-220418": "cross-env PRO_ENV=v2-220418 yarn start"
}, },
"lint-staged": { "lint-staged": {
"*.{js,jsx,less,md,json}": [ "*.{js,jsx,less,md,json}": [
......
...@@ -209,6 +209,9 @@ export default { ...@@ -209,6 +209,9 @@ export default {
'commodity.products.addDirectChannel.tab.3':'Logistics information', 'commodity.products.addDirectChannel.tab.3':'Logistics information',
'commodity.products.addDirectChannel.tab.4':'Applicable channels', 'commodity.products.addDirectChannel.tab.4':'Applicable channels',
'commodity.products.addProducts.onSave.error.draft.1' : 'Please upload at least one product picture for each item to save the draft!',
'commodity.products.addProducts.onSave.error.draft.2' : 'Please re-upload the product picture to save the draft!',
'commodity.products.addProducts.onSave.error.draft.3' : 'Please upload the product picture to save the draft!',
'commodity.products.addProducts.onSave.error.1':'Please upload at least one product image for each item! ', 'commodity.products.addProducts.onSave.error.1':'Please upload at least one product image for each item! ',
'commodity.products.addProducts.onSave.error.2':'Please complete other product information! ', 'commodity.products.addProducts.onSave.error.2':'Please complete other product information! ',
'commodity.products.addProducts.onSave.error.3':'Commodity price is required! ', 'commodity.products.addProducts.onSave.error.3':'Commodity price is required! ',
......
...@@ -211,6 +211,9 @@ export default { ...@@ -211,6 +211,9 @@ export default {
'commodity.products.addDirectChannel.tab.3' : '물류 정보', 'commodity.products.addDirectChannel.tab.3' : '물류 정보',
'commodity.products.addDirectChannel.tab.4' : '적용 경로', 'commodity.products.addDirectChannel.tab.4' : '적용 경로',
'commodity.products.addProducts.onSave.error.draft.1' : '품목별로 상품 사진을 한 장씩 올려주셔야 초고를 저장할 수 있습니다!',
'commodity.products.addProducts.onSave.error.draft.2' : '상품 사진 다시 올려주세요!',
'commodity.products.addProducts.onSave.error.draft.3' : '상품 사진 올려주셔야 초고 저장 가능합니다!',
'commodity.products.addProducts.onSave.error.1' : '항목마다 최소한 상품 사진 한 장씩 올려주세요!', 'commodity.products.addProducts.onSave.error.1' : '항목마다 최소한 상품 사진 한 장씩 올려주세요!',
'commodity.products.addProducts.onSave.error.2' : '상품 기타 정보를 보완해 주세요!', 'commodity.products.addProducts.onSave.error.2' : '상품 기타 정보를 보완해 주세요!',
'commodity.products.addProducts.onSave.error.3' : '상품 가격은 필수입니다!', 'commodity.products.addProducts.onSave.error.3' : '상품 가격은 필수입니다!',
......
...@@ -128,6 +128,7 @@ export default { ...@@ -128,6 +128,7 @@ export default {
'commodity.products.buttonGroup.5' : '上架', 'commodity.products.buttonGroup.5' : '上架',
'commodity.products.buttonGroup.6' : '下架', 'commodity.products.buttonGroup.6' : '下架',
'commodity.products.buttonGroup.7' : '查看供应商品', 'commodity.products.buttonGroup.7' : '查看供应商品',
'commodity.products.buttonGroup.8' : '查看上游商品',
'commodity.products.operationHandler.1' : '复制', 'commodity.products.operationHandler.1' : '复制',
'commodity.products.operationHandler.2' : '提交审核', 'commodity.products.operationHandler.2' : '提交审核',
'commodity.products.operationHandler.3' : '修改', 'commodity.products.operationHandler.3' : '修改',
...@@ -135,6 +136,7 @@ export default { ...@@ -135,6 +136,7 @@ export default {
'commodity.products.operationHandler.5' : '上架', 'commodity.products.operationHandler.5' : '上架',
'commodity.products.operationHandler.6' : '下架', 'commodity.products.operationHandler.6' : '下架',
'commodity.products.operationHandler.7' : '查看供应商品', 'commodity.products.operationHandler.7' : '查看供应商品',
'commodity.products.operationHandler.8': '查看上游商品',
'commodity.products.step0Description.text.1' : '点击下载 EXCEL文件模板', 'commodity.products.step0Description.text.1' : '点击下载 EXCEL文件模板',
'commodity.products.step0Description.text.2' : '按照模板整理货品资料', 'commodity.products.step0Description.text.2' : '按照模板整理货品资料',
'commodity.products.step0Description.text.3' : '点击导入按钮,导入整理好的货品资料', 'commodity.products.step0Description.text.3' : '点击导入按钮,导入整理好的货品资料',
...@@ -207,6 +209,9 @@ export default { ...@@ -207,6 +209,9 @@ export default {
'commodity.products.addDirectChannel.tab.3': '物流信息', 'commodity.products.addDirectChannel.tab.3': '物流信息',
'commodity.products.addDirectChannel.tab.4': '适用渠道', 'commodity.products.addDirectChannel.tab.4': '适用渠道',
'commodity.products.addProducts.onSave.error.draft.1' : '每项请至少上传一张商品图片才能保存草稿!',
'commodity.products.addProducts.onSave.error.draft.2' : '请重新上传商品图片才能保存草稿!',
'commodity.products.addProducts.onSave.error.draft.3' : '请上传商品图片才能保存草稿!',
'commodity.products.addProducts.onSave.error.1' : '每项请至少上传一张商品图片!', 'commodity.products.addProducts.onSave.error.1' : '每项请至少上传一张商品图片!',
'commodity.products.addProducts.onSave.error.2' : '请完善商品其他信息!', 'commodity.products.addProducts.onSave.error.2' : '请完善商品其他信息!',
'commodity.products.addProducts.onSave.error.3' : '商品价格为必填项!', 'commodity.products.addProducts.onSave.error.3' : '商品价格为必填项!',
......
...@@ -19,7 +19,7 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte ...@@ -19,7 +19,7 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import Submit from '@/components/NiceForm/components/Submit' import Submit from '@/components/NiceForm/components/Submit'
import { getProductCustomerGetCustomerCategoryAttributeList, getProductCustomerGetCustomerCategoryTree, postProductCustomerDeleteCustomerCategoryAttribute, postProductCustomerSaveCustomerCategoryAttribute, postProductCustomerSaveCustomerCategoryAttributeSort } from '@/services/ProductV2Api'; import { getProductCustomerGetCustomerCategoryAttributeList, getProductCustomerGetCustomerCategoryTree, postProductCustomerDeleteCustomerCategoryAttribute, postProductCustomerSaveCustomerCategoryAttribute, postProductCustomerSaveCustomerCategoryAttributeSort } from '@/services/ProductV2Api';
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { Sortable, SortableEvent } from 'react-sortablejs'; import Sortable, { SortableEvent } from "sortablejs";
import { arrayMoveImmutable } from '@/utils'; import { arrayMoveImmutable } from '@/utils';
import AuthButton from '@/components/AuthButton'; import AuthButton from '@/components/AuthButton';
import { AuthUrl } from '@/components/AuthButton/AuthUrl'; import { AuthUrl } from '@/components/AuthButton/AuthUrl';
......
...@@ -91,6 +91,7 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -91,6 +91,7 @@ const AddProducts: React.FC<{}> = (props) => {
const { data: _data }: any = await getProductCommodityGetCommodityDraftById({ commodityDraftId: draftId }) const { data: _data }: any = await getProductCommodityGetCommodityDraftById({ commodityDraftId: draftId })
const { draft: data } = _data const { draft: data } = _data
// @todo 草稿数据复制表单 // @todo 草稿数据复制表单
console.log(data, 'draft data')
setProductInfoByEdit(filterUsefulDraftData(data)) setProductInfoByEdit(filterUsefulDraftData(data))
setProductName(data?.name) setProductName(data?.name)
setProductPriceType(data?.priceType) setProductPriceType(data?.priceType)
...@@ -454,47 +455,72 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -454,47 +455,72 @@ const AddProducts: React.FC<{}> = (props) => {
if (clickTabIndex.indexOf("5") !== -1) { if (clickTabIndex.indexOf("5") !== -1) {
let _productAttributeAndImageParams = [...productAttributeAndImageParams] let _productAttributeAndImageParams = [...productAttributeAndImageParams]
if (_productAttributeAndImageParams.length > 0) { try {
_productAttributeAndImageParams.map(_item => { if (_productAttributeAndImageParams.length > 0) {
_productAttributeAndImageParams.map(_item => {
_item.goods = { id: _item.goodsId } // id为0表示无货品 _item.goods = { id: _item.goodsId } // id为0表示无货品
delete _item.goodsId delete _item.goodsId
if (_item.commodityPic.length > 0) { if (_item.commodityPic.length > 0) {
_item.commodityPic = _item.commodityPic.map(__item => __item?.response?.data || __item?.url || __item) _item.commodityPic = _item.commodityPic.map(__item => __item?.response?.data || __item?.url || __item)
if (_item.commodityPic.filter(Boolean).length === 0) { if (_item.commodityPic.filter(Boolean).length === 0) {
throw new Error(intl.formatMessage({ id: 'commodity.products.addProducts.onSave.error.1' })) throw new Error(intl.formatMessage({ id: 'commodity.products.addProducts.onSave.error.draft.1' }))
} }
if (isAllAttributePic) { if (isAllAttributePic) {
_item.commodityPic = _productAttributeAndImageParams[0].commodityPic _item.commodityPic = _productAttributeAndImageParams[0].commodityPic
} }
} else { } else {
if (isAllAttributePic && _productAttributeAndImageParams[0].commodityPic.length > 0 && _productAttributeAndImageParams[0].commodityPic.filter(Boolean).length > 0) { //处理所有属性共用 if (isAllAttributePic && _productAttributeAndImageParams[0].commodityPic.length > 0 && _productAttributeAndImageParams[0].commodityPic.filter(Boolean).length > 0) { //处理所有属性共用
_item.commodityPic = _productAttributeAndImageParams[0].commodityPic _item.commodityPic = _productAttributeAndImageParams[0].commodityPic
} else {
throw new Error(intl.formatMessage({ id: 'commodity.products.addProducts.onSave.error.draft.1' }))
}
} }
} })
}) } else {
throw new Error(intl.formatMessage({ id: 'commodity.products.addProducts.onSave.error.draft.1' }))
}
}
catch (error) {
console.log(error)
message.error(error.message)
setIsDisableSaveDrate(false)
return error
} }
_params.unitPriceAndPicList = _productAttributeAndImageParams _params.unitPriceAndPicList = _productAttributeAndImageParams
} else { } else {
if (productInfoByEdit) { try {
_params.unitPriceAndPicList = productInfoByEdit.unitPriceAndPicList if (productInfoByEdit) {
_params.isAllAttributePic = productInfoByEdit.isAllAttributePic _params.unitPriceAndPicList = productInfoByEdit.unitPriceAndPicList
if (clickTabIndex.indexOf("4") !== -1) { _params.isAllAttributePic = productInfoByEdit.isAllAttributePic
_params.unitPriceAndPicList = priceAttributeParams.map((item, index) => { if (clickTabIndex.indexOf("4") !== -1) {
const pic = productInfoByEdit.unitPriceAndPicList[index]?.commodityPic _params.unitPriceAndPicList = priceAttributeParams.map((item, index) => {
return { const pic = productInfoByEdit.unitPriceAndPicList[index]?.commodityPic
id: item.id, if (!pic) {
goods: { id: item.goodsId }, throw new Error(intl.formatMessage({ id: 'commodity.products.addProducts.onSave.error.draft.2' }))
attributeAndValueList: item.attributeAndValueList, }
unitPrice: item.unitPrice, return {
priceRate: item.priceRate, id: item.id,
commodityPic: pic goods: { id: item.goodsId },
} attributeAndValueList: item.attributeAndValueList,
}) unitPrice: item.unitPrice,
priceRate: item.priceRate,
commodityPic: pic
}
})
}
} else {
throw new Error(intl.formatMessage({ id: 'commodity.products.addProducts.onSave.error.draft.3' }))
} }
} }
catch (error) {
console.log(error)
message.error(error.message)
setIsDisableSaveDrate(false)
return error
}
} }
if (productInfoByEdit) { if (productInfoByEdit) {
...@@ -537,6 +563,7 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -537,6 +563,7 @@ const AddProducts: React.FC<{}> = (props) => {
}) })
} catch (error) { } catch (error) {
console.log(error) console.log(error)
message.error(error.message)
setIsDisableSaveDrate(false) setIsDisableSaveDrate(false)
} }
} }
......
...@@ -33,7 +33,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => { ...@@ -33,7 +33,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
const [banCarriageType, setBanCarriageType] = useState(false) const [banCarriageType, setBanCarriageType] = useState(false)
const [template, setTemplate] = useState(false) // 是否必填运费模板 const [template, setTemplate] = useState(false) // 是否必填运费模板
const { productInfoByEdit, selectCategoryId, productPriceType, isCrossBorder, sendCycle, isCrossBorder } = ProductStore const { productInfoByEdit, selectCategoryId, productPriceType, isCrossBorder, sendCycle } = ProductStore
useEffect(() => { useEffect(() => {
//传入ref给父级 //传入ref给父级
......
...@@ -28,12 +28,12 @@ const OtherForm: React.FC<Iprops> = (props) => { ...@@ -28,12 +28,12 @@ const OtherForm: React.FC<Iprops> = (props) => {
const { getOtherFormParamsByEdit, selectCategoryId, productPriceType, productInfoByEdit } = ProductStore const { getOtherFormParamsByEdit, selectCategoryId, productPriceType, productInfoByEdit } = ProductStore
const [disabledInvoice, setDisabledInvoice] = useState(false) const [disabledInvoice, setDisabledInvoice] = useState(false)
const { id } = history.location.query const { id, draftId } = history.location.query
useEffect(() => { useEffect(() => {
//传入ref给父级 //传入ref给父级
onRef(otherFormRef) onRef(otherFormRef)
if (id) { if (id || draftId) {
console.log(getOtherFormParamsByEdit, 'getOtherFormParamsByEdit') console.log(getOtherFormParamsByEdit, 'getOtherFormParamsByEdit')
otherForm.setFieldsValue(getOtherFormParamsByEdit) otherForm.setFieldsValue(getOtherFormParamsByEdit)
} }
...@@ -41,7 +41,7 @@ const OtherForm: React.FC<Iprops> = (props) => { ...@@ -41,7 +41,7 @@ const OtherForm: React.FC<Iprops> = (props) => {
useEffect(() => { useEffect(() => {
// 品类 变动清空form // 品类 变动清空form
if (history.location.query?.id && !flagRef.current) { if ((history.location.query?.id || history.location.query?.draftId) && !flagRef.current) {
flagRef.current = true flagRef.current = true
} else { } else {
otherForm.resetFields() otherForm.resetFields()
......
...@@ -104,7 +104,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -104,7 +104,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
useEffect(() => { useEffect(() => {
onRef(priceFormRef) onRef(priceFormRef)
if (history.location.query?.id) { // 编辑情况下 用于判断价格类型和显示单位 if (history.location.query?.id || history.location.query?.draftId) { // 编辑情况下 用于判断价格类型和显示单位
setPlanPrice(productInfoByEdit?.priceType) setPlanPrice(productInfoByEdit?.priceType)
handleUnitSearch(getPriceAttributeFormParamsByEdit.unitName) handleUnitSearch(getPriceAttributeFormParamsByEdit.unitName)
handleAssistUnitSearch(getPriceAttributeFormParamsByEdit.subUnitName) handleAssistUnitSearch(getPriceAttributeFormParamsByEdit.subUnitName)
...@@ -121,7 +121,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -121,7 +121,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
useEffect(() => { useEffect(() => {
// 品类 变动清空form和属性组合 // 品类 变动清空form和属性组合
if (history.location.query?.id && !flagRef.current) { if ((history.location.query?.id || history.location.query?.draftId) && !flagRef.current) {
flagRef.current = true flagRef.current = true
} else { } else {
// setProductSelectAttribute([]) // setProductSelectAttribute([])
...@@ -167,7 +167,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -167,7 +167,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
_temp_attributeValObjArr.push(_tempObjArr) _temp_attributeValObjArr.push(_tempObjArr)
} }
}) })
} else if (history.location.query?.id) { // 此时没有属性并且处于编辑状态 取接口返回的数据 [0]? (也有可能编辑情况下切换到无规格的品类) } else if (history.location.query?.id || history.location.query?.draftId) { // 此时没有属性并且处于编辑状态 取接口返回的数据 [0]? (也有可能编辑情况下切换到无规格的品类)
_attributeNameArr = productInfoByEdit.unitPriceAndPicList[0]?.attributeAndValueList.map(_ => _.customerAttribute.name) _attributeNameArr = productInfoByEdit.unitPriceAndPicList[0]?.attributeAndValueList.map(_ => _.customerAttribute.name)
_attributeValueArr = [productInfoByEdit.unitPriceAndPicList.map(item => item.attributeAndValueList.map(_ => _.customerAttributeValue.value))] _attributeValueArr = [productInfoByEdit.unitPriceAndPicList.map(item => item.attributeAndValueList.map(_ => _.customerAttributeValue.value))]
_temp_attributeObjArr = productInfoByEdit.unitPriceAndPicList[0]?.attributeAndValueList.map(item => { _temp_attributeObjArr = productInfoByEdit.unitPriceAndPicList[0]?.attributeAndValueList.map(item => {
...@@ -366,7 +366,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -366,7 +366,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
setAssistantUniquePriceRate(_priceRate) setAssistantUniquePriceRate(_priceRate)
const _priceNumber = Object.keys(_price)[0] === '0-0' ? Object.values(_price)[0] : Object.values(_price) const _priceNumber = Object.keys(_price)[0] === '0-0' ? Object.values(_price)[0] : Object.values(_price)
_tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.planPrice' })] = Array.isArray(_priceNumber) ? _priceNumber.map(_p => (Number(_p) * Number(_priceRate) / 100).toFixed(2)) : (Number(_priceNumber) * Number(_priceRate) / 100).toFixed(2) _tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.planPrice' })] = Array.isArray(_priceNumber) ? _priceNumber.map(_p => (Number(_p) * Number(_priceRate) / 100).toFixed(2)) : (Number(_priceNumber) * Number(_priceRate) / 100).toFixed(2)
// _tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.planPrice' })] = (Number(_price) * Number(_priceRate) / 100).toFixed(2)
} else { } else {
_tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = {} _tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = {}
} }
...@@ -405,9 +404,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -405,9 +404,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if (updateFlag.current) { if (updateFlag.current) {
updateFlag.current = false updateFlag.current = false
} else { } else {
// if(!(history.location.query?.id && planPrice === 3)){
// _tableDataSource.map(item => item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = {})
// }
if (isChangePriceType) { // 价格类型变动 清空价格 if (isChangePriceType) { // 价格类型变动 清空价格
_tableDataSource.map(item => item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = {}) _tableDataSource.map(item => item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = {})
} }
...@@ -889,7 +885,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -889,7 +885,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// initialValue={planPrice} // initialValue={planPrice}
> >
{ {
history.location.query?.id ? <Radio.Group onChange={handlePlanPriceChange} disabled={!productInfoByEdit.isUpdateAttribute}> (history.location.query?.id || history.location.query?.draftId) ? <Radio.Group onChange={handlePlanPriceChange} disabled={!productInfoByEdit.isUpdateAttribute}>
<Radio value={1}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.form.priceType.option.1' })}</Radio> <Radio value={1}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.form.priceType.option.1' })}</Radio>
<Radio value={2} disabled={isCrossBorder}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.form.priceType.option.2' })}</Radio> <Radio value={2} disabled={isCrossBorder}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.form.priceType.option.2' })}</Radio>
<Radio value={3} disabled={isCrossBorder}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.form.priceType.option.3' })}</Radio> <Radio value={3} disabled={isCrossBorder}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.form.priceType.option.3' })}</Radio>
......
...@@ -51,7 +51,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => { ...@@ -51,7 +51,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
useEffect(() => { useEffect(() => {
onRef(productAttributeFormRef) onRef(productAttributeFormRef)
// 编辑情况下 构建选中属性数据 给paramsArray初始化数据用于编辑 设置表单数据 // 编辑情况下 构建选中属性数据 给paramsArray初始化数据用于编辑 设置表单数据
if (history.location.query?.id) { if (history.location.query?.id || history.location.query?.draftId) {
constructProductSelectAttribute() constructProductSelectAttribute()
attributeForm.setFieldsValue(getProductAttributeFormParamsByEdit) attributeForm.setFieldsValue(getProductAttributeFormParamsByEdit)
} }
...@@ -63,7 +63,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => { ...@@ -63,7 +63,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
useEffect(() => { useEffect(() => {
// 属性变动 表明品类品牌变动 清空页面全局参数组合和store的选中属性 重置表单 (只对新增有效) // 属性变动 表明品类品牌变动 清空页面全局参数组合和store的选中属性 重置表单 (只对新增有效)
if (history.location.query?.id) { if (history.location.query?.id || history.location.query?.draftId) {
// 编辑第一次执行不清空,之后的变动需要清空 // 编辑第一次执行不清空,之后的变动需要清空
if (isClearFormAndDataInEdit) { if (isClearFormAndDataInEdit) {
paramsArray = [] paramsArray = []
...@@ -229,7 +229,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => { ...@@ -229,7 +229,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
let _isPrice = null let _isPrice = null
let _isUpdateAttribute = null let _isUpdateAttribute = null
let _isDisabled = false let _isDisabled = false
if (history.location.query?.id) { if (history.location.query?.id || history.location.query?.draftId) {
_isPrice = attrItem.isPrice _isPrice = attrItem.isPrice
_isUpdateAttribute = productInfoByEdit.isUpdateAttribute _isUpdateAttribute = productInfoByEdit.isUpdateAttribute
_isDisabled = _isPrice && !_isUpdateAttribute _isDisabled = _isPrice && !_isUpdateAttribute
...@@ -278,9 +278,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => { ...@@ -278,9 +278,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
} }
</Select> </Select>
</Col> </Col>
{/* <Col span={4}>
<Button type="link" onClick={() => addAtttributeValue(attrItem)}>新增属性值</Button>
</Col> */}
</Row> </Row>
</Form.Item> </Form.Item>
} }
...@@ -314,28 +311,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => { ...@@ -314,28 +311,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
options={attrItem.customerAttributeValueList} options={attrItem.customerAttributeValueList}
expandOperation={<Button style={{marginLeft: 8}} type="dashed" icon={<PlusOutlined />} onClick={() => addAtttributeValue(attrItem)}>新增</Button>} expandOperation={<Button style={{marginLeft: 8}} type="dashed" icon={<PlusOutlined />} onClick={() => addAtttributeValue(attrItem)}>新增</Button>}
/> />
{/* <Row>
<Col span={20}>
<Checkbox.Group
onChange={(v) => onChange(v, attrItem)}
disabled={_isDisabled}
style={{ width: "100%" }}
>
<Row>
{
attrItem?.customerAttributeValueList.length > 0 && attrItem.customerAttributeValueList.map((item: any, index: string) => (
<Col span={6} key={item.id}>
<Checkbox value={item.id}>{item.value}</Checkbox>
</Col>
))
}
</Row>
</Checkbox.Group>
</Col>
<Col span={4}>
<Button type="link" onClick={() => addAtttributeValue(attrItem)}>新增属性值</Button>
</Col>
</Row> */}
</Form.Item> </Form.Item>
) )
} }
......
...@@ -44,7 +44,7 @@ const ProductDescFormYang: React.FC<{}> = () => { ...@@ -44,7 +44,7 @@ const ProductDescFormYang: React.FC<{}> = () => {
const { run, loading } = useHttpRequest(postContractContractSignSaleSignContractCreate, { ctlType: 'none' }) const { run, loading } = useHttpRequest(postContractContractSignSaleSignContractCreate, { ctlType: 'none' })
useEffect(() => { useEffect(() => {
if (history.location.query?.id) { // 编辑状态下 if (history.location.query?.id || history.location.query?.draftId) { // 编辑状态下
setFileImageList(() => { setFileImageList(() => {
const images = productInfoByEdit.commodityRemark?.imageList const images = productInfoByEdit.commodityRemark?.imageList
return { return {
...@@ -65,7 +65,7 @@ const ProductDescFormYang: React.FC<{}> = () => { ...@@ -65,7 +65,7 @@ const ProductDescFormYang: React.FC<{}> = () => {
useEffect(() => { useEffect(() => {
// 品类 变动清空数据 // 品类 变动清空数据
// 编辑下 flag为false 不清空;编辑下 flag为true 新建清空 // 编辑下 flag为false 不清空;编辑下 flag为true 新建清空
if (history.location.query?.id && !flagRef.current) { if ((history.location.query?.id || history.location.query?.draftId) && !flagRef.current) {
flagRef.current = true flagRef.current = true
} else { } else {
setFileImageList({ setFileImageList({
......
...@@ -50,7 +50,7 @@ const ProductImageForm: React.FC<{}> = (props) => { ...@@ -50,7 +50,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
}, [tabClickItem]) }, [tabClickItem])
useEffect(() => { useEffect(() => {
if (history.location.query?.id) { if (history.location.query?.id || history.location.query?.draftId) {
setSetImageType(productInfoByEdit.isAllAttributePic) setSetImageType(productInfoByEdit.isAllAttributePic)
let o = productInfoByEdit.unitPriceAndPicList.map((_item, _index) => { let o = productInfoByEdit.unitPriceAndPicList.map((_item, _index) => {
// 编辑初始图片数据缓存(手动生成供图片回显数据) // 编辑初始图片数据缓存(手动生成供图片回显数据)
...@@ -91,7 +91,7 @@ const ProductImageForm: React.FC<{}> = (props) => { ...@@ -91,7 +91,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
useEffect(() => { useEffect(() => {
// 品类 变动清空数据 // 品类 变动清空数据
// 编辑下 flag为false 不清空;编辑下 flag为true 新建清空 // 编辑下 flag为false 不清空;编辑下 flag为true 新建清空
if (history.location.query?.id && !flagRef.current) { if ((history.location.query?.id || history.location.query?.draftId) && !flagRef.current) {
flagRef.current = true flagRef.current = true
} else { } else {
onChangeSetImageType({ target: { value: true } }) onChangeSetImageType({ target: { value: true } })
...@@ -101,7 +101,7 @@ const ProductImageForm: React.FC<{}> = (props) => { ...@@ -101,7 +101,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
useEffect(() => { useEffect(() => {
if (priceAttributeParams.length > 0) { if (priceAttributeParams.length > 0) {
constructImageListByRender(priceAttributeParams) constructImageListByRender(priceAttributeParams)
} else if (history.location.query?.id) { // 不点击前面 直接进入图片tab } else if (history.location.query?.id || history.location.query?.draftId) { // 不点击前面 直接进入图片tab
constructImageListByRender(productInfoByEdit.unitPriceAndPicList) constructImageListByRender(productInfoByEdit.unitPriceAndPicList)
} }
}, [priceAttributeParams, maintainImageData]) }, [priceAttributeParams, maintainImageData])
...@@ -110,7 +110,7 @@ const ProductImageForm: React.FC<{}> = (props) => { ...@@ -110,7 +110,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
/* 直接进入商品图片编辑的时候 参数为空数组 但是没有价格属性的时候 也可能为空数组 区别在于是否有url id */ /* 直接进入商品图片编辑的时候 参数为空数组 但是没有价格属性的时候 也可能为空数组 区别在于是否有url id */
const constructImageListByRender = (priceAttributeParams?: any) => { const constructImageListByRender = (priceAttributeParams?: any) => {
let _priceAttributeParams: any = [] let _priceAttributeParams: any = []
if (history.location.query?.id) { // id判断是否新增还是编辑 if (history.location.query?.id || history.location.query?.draftId) { // id判断是否新增还是编辑
setIsAllAttributePic(setImageType) setIsAllAttributePic(setImageType)
_priceAttributeParams = priceAttributeParams.map((_item, _index) => { _priceAttributeParams = priceAttributeParams.map((_item, _index) => {
......
...@@ -35,8 +35,8 @@ const SelectGoodsForm: React.FC<{}> = (props) => { ...@@ -35,8 +35,8 @@ const SelectGoodsForm: React.FC<{}> = (props) => {
}, [selectCategoryId, selectBrandId]) }, [selectCategoryId, selectBrandId])
useEffect(() => { useEffect(() => {
const { id } = history.location.query const { id, draftId } = history.location.query
if (id) { if (id || draftId) {
let _goodsArr: any = productInfoByEdit?.unitPriceAndPicList.map(_ => _.goods) let _goodsArr: any = productInfoByEdit?.unitPriceAndPicList.map(_ => _.goods)
let goodsArr: any = _goodsArr && _goodsArr.indexOf(null) === -1 && _goodsArr.length > 0 && Object.values(_goodsArr.reduce((item, next) => { let goodsArr: any = _goodsArr && _goodsArr.indexOf(null) === -1 && _goodsArr.length > 0 && Object.values(_goodsArr.reduce((item, next) => {
item[next.id] = next; item[next.id] = next;
......
...@@ -35,7 +35,7 @@ const CircleCheckbox: React.FC<PriceInputProps> = ({ value = [], options = [], o ...@@ -35,7 +35,7 @@ const CircleCheckbox: React.FC<PriceInputProps> = ({ value = [], options = [], o
} }
} }
return (options.length && <div className={styles.circleCheckbox}> return (options.length ? <div className={styles.circleCheckbox}>
<ul className={styles.circleCheckboxUl}> <ul className={styles.circleCheckboxUl}>
{ {
options.map((item: any, index: string) => ( <li options.map((item: any, index: string) => ( <li
...@@ -53,7 +53,7 @@ const CircleCheckbox: React.FC<PriceInputProps> = ({ value = [], options = [], o ...@@ -53,7 +53,7 @@ const CircleCheckbox: React.FC<PriceInputProps> = ({ value = [], options = [], o
expandOperation expandOperation
} }
</ul> </ul>
</div> </div> : null
) )
} }
......
...@@ -29,7 +29,7 @@ import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable' ...@@ -29,7 +29,7 @@ import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable'
import { priceTypeLabel, productStatusColor, productStatusLabel } from './constant' import { priceTypeLabel, productStatusColor, productStatusLabel } from './constant'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import UpperProductModalTable from './components/upperProductModalTable' import UpperProductModalTable from './components/upperProductModalTable'
import { getProductCommodityGetCommodityList, getProductCommodityGetShop, GetProductCommodityGetShopResponse, postProductCommodityApplyCheckCommodity, postProductCommodityCopyCommodity, postProductCommodityDeleteBatchCommodity, postProductCommodityExportCommodityQrCode, postProductCommodityExportCommoditySkuByCommodityIdList, postProductCommodityGetCommodityIsExistStock, postProductCommodityGetCommoditySkuIdList, postProductCommodityGetShopBatch, postProductCommodityOffPublishCommodity, postProductCommodityOffPublishCommodityBatch, postProductCommodityPublishCommodity, postProductCommodityPublishCommodityBatch } from '@/services/ProductV2Api' import { getProductCommodityExportCommodityTemplate, getProductCommodityGetCommodityList, getProductCommodityGetShop, GetProductCommodityGetShopResponse, postProductCommodityApplyCheckCommodity, postProductCommodityCopyCommodity, postProductCommodityDeleteBatchCommodity, postProductCommodityExportCommodityQrCode, postProductCommodityExportCommoditySkuByCommodityIdList, postProductCommodityGetCommodityIsExistStock, postProductCommodityGetCommoditySkuIdList, postProductCommodityGetShopBatch, postProductCommodityOffPublishCommodity, postProductCommodityOffPublishCommodityBatch, postProductCommodityPublishCommodity, postProductCommodityPublishCommodityBatch } from '@/services/ProductV2Api'
import { getTemplateWebMemberShopWebFindCurrMemberShop } from '@/services/TemplateV2Api' import { getTemplateWebMemberShopWebFindCurrMemberShop } from '@/services/TemplateV2Api'
import PutawayGuide, { GuideMenu } from './components/putawayGuide' import PutawayGuide, { GuideMenu } from './components/putawayGuide'
import { useRowSelectionTable, useRowSelectionTableCtl } from '@/hooks/useRowSelectionTable' import { useRowSelectionTable, useRowSelectionTableCtl } from '@/hooks/useRowSelectionTable'
...@@ -219,9 +219,9 @@ const Products: React.FC<{}> = () => { ...@@ -219,9 +219,9 @@ const Products: React.FC<{}> = () => {
className: 'commonPickColor', className: 'commonPickColor',
width: 240, width: 240,
ellipsis: true, ellipsis: true,
render: (text: any, record: any) => <EyePreview url={`/memberCenter/commodityAbility/commodity/products/detail?id=${record.id}`}> // render: (text: any, record: any) => <EyePreview url={`/memberCenter/commodityAbility/commodity/products/detail?id=${record.id}`}>
{text} // {text}
</EyePreview> // </EyePreview>
}, },
{ {
title: intl.formatMessage({ id: 'commodity.products.columns.customerCategory' }), title: intl.formatMessage({ id: 'commodity.products.columns.customerCategory' }),
...@@ -417,6 +417,19 @@ const Products: React.FC<{}> = () => { ...@@ -417,6 +417,19 @@ const Products: React.FC<{}> = () => {
const modalLoadTemplate = () => { const modalLoadTemplate = () => {
console.log('模板下载!') console.log('模板下载!')
let a: any = document.createElement("a")
document.body.appendChild(a)
a.style = "display: none"
getProductCommodityExportCommodityTemplate({ }, { responseType: 'blob', getResponse: true }).then((res: any) => {
const { data, response } = res
const filename = response.headers.get('content-disposition').split('=')[1]
let blob = new Blob([data], { type: "application/vnd.ms-excel" })
const url = window.URL.createObjectURL(blob);
a.href = url;
a.download = filename.replaceAll('"', '');
a.click();
window.URL.revokeObjectURL(url);
})
} }
const modalUpload = () => { const modalUpload = () => {
...@@ -941,9 +954,7 @@ const Products: React.FC<{}> = () => { ...@@ -941,9 +954,7 @@ const Products: React.FC<{}> = () => {
<PlusOutlined />{intl.formatMessage({ id: 'commodity.products.controllerBtns.button.1' })} <PlusOutlined />{intl.formatMessage({ id: 'commodity.products.controllerBtns.button.1' })}
</Button> </Button>
</AuthButton> </AuthButton>
<Button style={{margin:'0 16px'}} onClick={()=>setImportModal(true)}>导入数据</Button>
{/* <Button style={{margin:'0 16px'}} onClick={()=>setImportModal(true)}>导入数据</Button> */}
<AuthButton btnCode='products.batch' > <AuthButton btnCode='products.batch' >
<Dropdown overlay={menuMore} trigger={['click']}> <Dropdown overlay={menuMore} trigger={['click']}>
<Button> <Button>
...@@ -1005,7 +1016,7 @@ const Products: React.FC<{}> = () => { ...@@ -1005,7 +1016,7 @@ const Products: React.FC<{}> = () => {
<StandardTable <StandardTable
columns={draftColumns} columns={draftColumns}
currentRef={refDraft} currentRef={refDraft}
rowSelection={rowSelection} // rowSelection={rowSelection}
tableProps={{ tableProps={{
rowKey: 'id', rowKey: 'id',
}} }}
......
import React, { useRef } from 'react'; import React, { useContext, useEffect, useRef, useState } from 'react';
import { history, useIntl } from 'umi'; import { getIntl, history, useIntl } from 'umi';
import { Button, Card, message, Modal, Space, Tooltip } from 'antd'; import { Button, Card, Form, Input, message, Modal, Space, Tooltip } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons'; import { EditOutlined, PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import StandardTable from '@/components/StandardTable'; import StandardTable from '@/components/StandardTable';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
import EyePreview from '@/components/EyePreview'; import EyePreview from '@/components/EyePreview';
...@@ -20,6 +20,98 @@ import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'; ...@@ -20,6 +20,98 @@ import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { getProductFreightSpaceList, postProductFreightSpaceStopStart, postProductFreightSpaceUpdateBatch } from '@/services/ProductV2Api'; import { getProductFreightSpaceList, postProductFreightSpaceStopStart, postProductFreightSpaceUpdateBatch } from '@/services/ProductV2Api';
import AuthButton from '@/components/AuthButton'; import AuthButton from '@/components/AuthButton';
import { AuthUrl } from '@/components/AuthButton/AuthUrl'; import { AuthUrl } from '@/components/AuthButton/AuthUrl';
import { postProductFreightSpaceUpdateInventory } from '@/services/ProductV2Api/id13787';
const intl = getIntl();
// table编辑控件
const EditableContext = React.createContext<any>({});
interface EditableRowProps {
index: number;
}
const EditableRow: React.FC<EditableRowProps> = ({ index, ...props }) => {
console.log(0)
const [form] = Form.useForm();
return (
<Form form={form} component={false}>
<EditableContext.Provider value={form}>
<tr {...props} />
</EditableContext.Provider>
</Form>
);
};
interface EditableCellProps {
title: React.ReactNode;
editable: boolean;
children: React.ReactNode;
dataIndex: string;
record: any;
handleSave: (record: any) => void;
formItemProps: any,
}
const EditableCell: React.FC<EditableCellProps> = ({
title,
editable,
children,
dataIndex,
record,
formItemProps = {},
handleSave,
...restProps
}) => {
const [editing, setEditing] = useState(false);
const inputRef = useRef<any>({});
const form = useContext(EditableContext);
useEffect(() => {
if (editing) {
inputRef.current.focus();
}
}, [editing]);
const toggleEdit = () => {
setEditing(!editing);
form.setFieldsValue({ [dataIndex]: record[dataIndex] });
};
const save = async () => {
try {
const values = await form.validateFields();
toggleEdit();
handleSave({ ...record, ...values });
} catch (errInfo) {
console.log('Save failed:', errInfo);
}
};
let childNode = children;
if (editable) {
childNode = editing ? (
<Form.Item
style={{ margin: 0, width: record.width || 80 }}
name={dataIndex}
rules={[
{
required: true,
message: intl.formatMessage({ id: 'transaction_components.cixiangweibitianxiang' }),
},
{
pattern: /^\d+(\.\d{1,3})?$/,
message: intl.formatMessage({ id: 'transaction_components.zhifubilijinxianliangwei' }),
}
]}
>
<Input type='number' ref={inputRef} onBlur={save} onPressEnter={save} {...formItemProps} />
</Form.Item>
) : (
<div className="editable-cell-value-wrap" style={{ paddingRight: 24 }} onClick={toggleEdit}>
{children}
<EditOutlined />
</div>
);
}
return <td {...restProps}>{childNode}</td>;
};
const formActions = createFormActions(); const formActions = createFormActions();
const modalSchemaAction = createFormActions() const modalSchemaAction = createFormActions()
...@@ -48,7 +140,7 @@ const Repositories: React.FC<{}> = () => { ...@@ -48,7 +140,7 @@ const Repositories: React.FC<{}> = () => {
const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'id' }); const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'id' });
const { run, loading } = useHttpRequest(postProductFreightSpaceUpdateBatch, { ctlType: 'none' }) const { run, loading } = useHttpRequest(postProductFreightSpaceUpdateBatch, { ctlType: 'none' })
const columns: ColumnType<any>[] = [ const columns: any[] = [
{ {
title: intl.formatMessage({ id: 'repositories.columns.id' }), title: intl.formatMessage({ id: 'repositories.columns.id' }),
dataIndex: 'id', dataIndex: 'id',
...@@ -58,6 +150,8 @@ const Repositories: React.FC<{}> = () => { ...@@ -58,6 +150,8 @@ const Repositories: React.FC<{}> = () => {
title: intl.formatMessage({ id: 'repositories.columns.name' }), title: intl.formatMessage({ id: 'repositories.columns.name' }),
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
width: 240,
ellipsis: true,
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<EyePreview <EyePreview
type={AuthUrl('repositories.see') ? 'link' : 'button'} type={AuthUrl('repositories.see') ? 'link' : 'button'}
...@@ -71,6 +165,8 @@ const Repositories: React.FC<{}> = () => { ...@@ -71,6 +165,8 @@ const Repositories: React.FC<{}> = () => {
title: intl.formatMessage({ id: 'repositories.columns.productName' }), title: intl.formatMessage({ id: 'repositories.columns.productName' }),
dataIndex: 'productName', dataIndex: 'productName',
key: 'productName', key: 'productName',
width: 200,
ellipsis: true,
}, },
{ {
title: intl.formatMessage({ id: 'repositories.columns.category' }), title: intl.formatMessage({ id: 'repositories.columns.category' }),
...@@ -91,22 +187,15 @@ const Repositories: React.FC<{}> = () => { ...@@ -91,22 +187,15 @@ const Repositories: React.FC<{}> = () => {
title: intl.formatMessage({ id: 'repositories.columns.inventory' }), title: intl.formatMessage({ id: 'repositories.columns.inventory' }),
dataIndex: 'inventory', dataIndex: 'inventory',
key: 'inventory', key: 'inventory',
formItem: 'input',
editable: true,
width: 200,
}, },
{ {
title: intl.formatMessage({ id: 'repositories.columns.alreadyiInventory' }), title: intl.formatMessage({ id: 'repositories.columns.alreadyiInventory' }),
dataIndex: 'alreadyiInventory', dataIndex: 'alreadyiInventory',
key: 'alreadyiInventory', key: 'alreadyiInventory',
}, },
// {
// title: intl.formatMessage({ id: 'repositories.columns.upperMemberName' }),
// dataIndex: 'upperMemberName',
// key: 'upperMemberName',
// },
// {
// title: intl.formatMessage({ id: 'repositories.columns.upperStockCount' }),
// dataIndex: 'upperStockCount',
// key: 'upperStockCount',
// },
{ {
title: <span> title: <span>
上游商品库存&ensp; 上游商品库存&ensp;
...@@ -300,8 +389,45 @@ const Repositories: React.FC<{}> = () => { ...@@ -300,8 +389,45 @@ const Repositories: React.FC<{}> = () => {
console.log(value) console.log(value)
} }
const controllerBtns = <Space> const handleSave = row => {
console.log(row)
const { id, inventory } = row
// // 执行修改库存
postProductFreightSpaceUpdateInventory({
id,
inventory
}).then(res => {
if (res.code === 1000) {
ref.current.reload()
}
})
};
const editColumns = columns.map(col => {
if (!col.editable) {
return col;
}
return {
...col,
onCell: record => ({
record,
editable: col.editable,
dataIndex: col.dataIndex,
title: col.title,
formItemProps: col.formItemProps,
handleSave: handleSave,
}),
};
});
const editComponents = {
body: {
row: EditableRow,
cell: EditableCell
}
}
const controllerBtns = <Space>
<AuthButton btnCode='repositories.add'> <AuthButton btnCode='repositories.add'>
<Button <Button
type="primary" type="primary"
...@@ -318,16 +444,15 @@ const Repositories: React.FC<{}> = () => { ...@@ -318,16 +444,15 @@ const Repositories: React.FC<{}> = () => {
<AuthButton btnCode='repositories.batchedit'> <AuthButton btnCode='repositories.batchedit'>
<Button onClick={() => modalRef.current.setVisible(true)}>{intl.formatMessage({ id: 'repositories.controllerBtns.button.3' })}</Button> <Button onClick={() => modalRef.current.setVisible(true)}>{intl.formatMessage({ id: 'repositories.controllerBtns.button.3' })}</Button>
</AuthButton> </AuthButton>
</Space> </Space>
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
<StandardTable <StandardTable
columns={columns} columns={editColumns}
currentRef={ref} currentRef={ref}
tableProps={{ rowKey: 'id' }} tableProps={{ rowKey: 'id', components: editComponents }}
rowSelection={rowSelection} rowSelection={rowSelection}
fetchTableData={(params: any) => fetchData(params)} fetchTableData={(params: any) => fetchData(params)}
controlRender={ controlRender={
......
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