This commit is contained in:
ylj20011123 2025-07-04 20:26:45 +08:00
parent 4c7c8707ab
commit 7fe7fe34e3
17 changed files with 3050 additions and 673 deletions

View File

@ -320,7 +320,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
list.push({ label: item.label, value: item.value }) list.push({ label: item.label, value: item.value })
obj[item.value] = item.label obj[item.value] = item.label
}) })
session.set('CCOMMODITYNATUREList', list); session.set('COMMODITYNATUREList', list);
session.set('COMMODITYNATUREObj', obj); session.set('COMMODITYNATUREObj', obj);
session.set('COMMODITYNATURETree', COMMODITYNATURE); session.set('COMMODITYNATURETree', COMMODITYNATURE);
} }

View File

@ -2,9 +2,9 @@
import { connect } from "umi"; import { connect } from "umi";
import type { CurrentUser } from "umi"; import type { CurrentUser } from "umi";
import type { ConnectState } from "@/models/connect"; import type { ConnectState } from "@/models/connect";
import React, { useRef, useState } from "react"; import React, { useEffect, useRef, useState } from "react";
import type { FormInstance } from "antd"; import type { FormInstance } from "antd";
import { Button, Col, message, Modal, Popconfirm, Row, Space, Spin, Tree } from "antd"; import { Button, Card, Col, message, Modal, Popconfirm, Row, Space, Spin, Steps, Tooltip, Tree } from "antd";
import type { ActionType } from "@ant-design/pro-table"; import type { ActionType } from "@ant-design/pro-table";
import ProTable from "@ant-design/pro-table"; import ProTable from "@ant-design/pro-table";
import PageTitleBox from "@/components/PageTitleBox"; import PageTitleBox from "@/components/PageTitleBox";
@ -16,8 +16,11 @@ import { handleGetNestingCOMMODITYTYPETree, handleGetServerpartShopTrade } from
import { handleGetUSERDEFINEDTYPEList } from "../userDefinedType/service"; import { handleGetUSERDEFINEDTYPEList } from "../userDefinedType/service";
import useRequest from "@ahooksjs/use-request"; import useRequest from "@ahooksjs/use-request";
import moment from 'moment' import moment from 'moment'
import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList, handleRejectCommodityProInst } from "../ProductApprovalProcess/service"; import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleDeleteCOMMODITY_RUNNING, handleDeleteCommodityProInst, handleGetApprovalCommodityList, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList, handleReapplyCommodityProInst, handleRejectCommodityProInst } from "../ProductApprovalProcess/service";
import './style.less'
const { Step } = Steps
const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props) => { const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props) => {
const { currentUser } = props const { currentUser } = props
const downloadBtnRef = useRef<any>() const downloadBtnRef = useRef<any>()
@ -31,8 +34,10 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
const [showApplyFor, setShowApplyFor] = useState<boolean>(false); const [showApplyFor, setShowApplyFor] = useState<boolean>(false);
// 显示新增商品的悬浮框 // 显示新增商品的悬浮框
const [showAddShopModal, setShowAddShopModal] = useState<boolean>(false); const [showAddShopModal, setShowAddShopModal] = useState<boolean>(false);
// 选择的当前商品行 // 选择记录行的数据
const [currentRow, setCurrentRow] = useState<any>() const [currentRow, setCurrentRow] = useState<any>()
// 选择商品行的数据
const [currentShopRow, setCurrentShopRow] = useState<any>()
// 商品列表数据 // 商品列表数据
const [shopData, setShopData] = useState<any>() const [shopData, setShopData] = useState<any>()
const [selectSERVERPARTID, setSelectSERVERPARTID] = useState<any>() const [selectSERVERPARTID, setSelectSERVERPARTID] = useState<any>()
@ -55,6 +60,12 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
const [ApprovalType, setApprovaType] = useState<number>(0) const [ApprovalType, setApprovaType] = useState<number>(0)
// 审批记录详情 // 审批记录详情
const [BUSINESSAPPROVALDETAIL, setBUSINESSAPPROVALDETAIL] = useState<any>() const [BUSINESSAPPROVALDETAIL, setBUSINESSAPPROVALDETAIL] = useState<any>()
// 还有几个环节 拼在流程进度后面
const [nextStepsList, setNextStepsList] = useState<any>()
// 判断有无发起申请的权限
const [InitiateApplication, setInitiateApplication] = useState<boolean>(false)
// 显示类型
const [showDetailType, setShowDetailType] = useState<any>()
// 加载服务区树 // 加载服务区树
const { loading: treeLoading, data: treeViews } = useRequest(async () => { const { loading: treeLoading, data: treeViews } = useRequest(async () => {
const req = { const req = {
@ -67,6 +78,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
return data return data
}) })
let statusList: string[] = ["0", "1000", "2000", "2010,2020,2030,2040,2050,2060,2070,2080,2090", "9000"]
const columns: any = [ const columns: any = [
{ {
dataIndex: 'BusinessProcess_StateSearch', dataIndex: 'BusinessProcess_StateSearch',
@ -75,12 +87,20 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
hideInTable: true, hideInTable: true,
// valueEnum: {
// "0": "全部",
// "2000": "待审核",
// "2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中",
// "9000": "已审结"
// },
valueEnum: { valueEnum: {
"0": "全部", 0: "全部",
"2000": "待审核", 1: "待申请",
"2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中", 2: "待审核",
"9000": "已审结" 3: "审核中",
4: "已审结"
}, },
initialValue: "0"
}, },
{ {
dataIndex: 'BusinessProcess_Name', dataIndex: 'BusinessProcess_Name',
@ -121,15 +141,27 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => {
return <a style={{
color: record?.BusinessProcess_StateText === '待审核' ? '#1890ff' :
record?.BusinessProcess_StateText === '审核中' ? 'rgb(250, 173, 20)' :
record?.BusinessProcess_StateText === '已审结' ? 'red' : ""
}} onClick={() => {
console.log('recordrecordrecord', record);
setShowDetailType('detail')
setCurrentRow(record)
setShowApplyFor(true)
}}>{record?.BusinessProcess_StateText || "-"}</a>
}
}, },
{ // {
dataIndex: 'Accept_Code', // dataIndex: 'Accept_Code',
title: '业务类别', // title: '业务类别',
width: 200, // width: 200,
ellipsis: true, // ellipsis: true,
align: 'center', // align: 'center',
hideInSearch: true, // hideInSearch: true,
}, // },
{ {
dataIndex: 'BusinessProcess_EndDate', dataIndex: 'BusinessProcess_EndDate',
title: '办结时间', title: '办结时间',
@ -152,7 +184,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
valueType: 'option', valueType: 'option',
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
width: 120, width: 180,
fixed: "right", fixed: "right",
ellipsis: true, ellipsis: true,
render: (_, record) => { render: (_, record) => {
@ -163,29 +195,61 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
{ {
record?.BusinessProcess_State === 1000 record?.BusinessProcess_State === 1000
? ?
<a onClick={() => { <>
setShowApplyFor(true) <a onClick={() => {
setCurrentRow(record) console.log('recordrecordrecord', record);
}}
> setCurrentRow(record)
setShowApplyFor(true)
</a> : "" }}
>
</a>
<Popconfirm
title="确认删除该商品审批流程吗?"
onConfirm={async () => {
const req: any = {
businessApprovalId: record?.BusinessApproval_ID,
UserId: currentUser?.ID
}
const data = await handleDeleteCommodityProInst(req)
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}}
>
<a></a>
</Popconfirm>
</>
: ""
}
{
record?.BusinessProcess_State > 1000 ?
<>
<a onClick={() => {
setApprovaType(1)
setCurrentRow(record)
// setApproveCurrentRow(record)
// setApproveModal(true)
setShowApplyFor(true)
}}
>
</a>
<a onClick={() => {
setApprovaType(2)
setCurrentRow(record)
// setApproveCurrentRow(record)
// setApproveModal(true)
setShowApplyFor(true)
}}>
</a>
</> : ""
} }
<a onClick={() => {
setApprovaType(1)
setApproveCurrentRow(record)
setApproveModal(true)
}}
>
</a>
<a onClick={() => {
setApprovaType(2)
setApproveCurrentRow(record)
setApproveModal(true)
}}>
</a>
</Space> : "" </Space> : ""
); );
@ -249,31 +313,65 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
render: (_, record) => { render: (_, record) => {
return ( return (
<Space> <Space>
<a {
onClick={() => { currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' :
setCurrentRow(record) <>
setShowAddShopModal(true) <a
}} onClick={() => {
> setCurrentShopRow(record)
setShowAddShopModal(true)
</a> }}
<Popconfirm >
title="确认删除该商品管理列表信息吗?"
onConfirm={async () => { </a>
console.log('record', record); <Popconfirm
let oldData: any = JSON.parse(JSON.stringify(shopData)) title="确认删除该商品管理列表信息吗?"
let list: any = [] onConfirm={async () => {
oldData.forEach((item: any) => { if (currentRow?.BusinessApproval_ID) {
if (item.ADDTIME !== record?.ADDTIME) { // 申请回到发起时候的真删
list.push(item) const req: any = {
} COMMODITY_RUNNINGId: record?.COMMODITY_ID
}) }
setShopData(list) const data = await handleDeleteCOMMODITY_RUNNING(req)
console.log('datadatadatadata', data);
actionRef.current?.reload()
// 实现直接删除的效果
let oldData: any = JSON.parse(JSON.stringify(shopData))
let list: any = []
oldData.forEach((item: any) => {
if (item.COMMODITY_ID !== record?.COMMODITY_ID) {
list.push(item)
}
})
setShopData(list)
} else {
// 还未发起申请的假删
console.log('record', record);
let oldData: any = JSON.parse(JSON.stringify(shopData))
let list: any = []
oldData.forEach((item: any) => {
if (item.ADDTIME !== record?.ADDTIME) {
list.push(item)
}
})
setShopData(list)
}
}}
>
<a></a>
</Popconfirm>
</>
}
{
currentRow?.BusinessProcess_State === 9000 ?
<a onClick={() => {
setCurrentShopRow(record)
setShowAddShopModal(true)
}}></a>
: ''
}
}}
>
<a></a>
</Popconfirm>
</Space> </Space>
); );
}, },
@ -315,6 +413,37 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
} }
useEffect(async () => {
const req: any = {
SearchParameter: {
APPROVALROUTE_STATES: "",
APPROVALROUTE_VALID: 1,
OPERATION_TYPES: "100100",
}
}
const data = await handleGetAPPROVALROUTEList(req)
console.log('datadatadatadata', data);
// 拿到发起申请的人
let firstSetp: any = {}
if (data && data.length > 0) {
data.forEach((item: any) => {
if (item.APPROVALROUTE_STATE === 1000) {
firstSetp = item
}
})
}
// 判断当前用户 是否有新增权限
let have: boolean = false
let idList: any = firstSetp.APPROVALSTAFF_ID.split(',')
console.log('idList', idList);
if (idList.indexOf(currentUser?.ID.toString()) !== -1) {
have = true
}
setInitiateApplication(have)
}, [])
return ( return (
<div> <div>
<div style={{ backgroundColor: '#fff', display: 'flex' }}> <div style={{ backgroundColor: '#fff', display: 'flex' }}>
@ -341,7 +470,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
SearchParameter: { SearchParameter: {
Operation_Type: 6, Operation_Type: 6,
Accept_Code: "6-100100", Accept_Code: "6-100100",
BusinessProcess_StateSearch: params?.BusinessProcess_StateSearch === 0 ? '' : params?.BusinessProcess_StateSearch BusinessProcess_StateSearch: statusList[params?.BusinessProcess_StateSearch] === "0" ? '' : statusList[params?.BusinessProcess_StateSearch]
}, },
PageIndex: 1, PageIndex: 1,
PageSize: 999999 PageSize: 999999
@ -351,7 +480,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
if (data.data && data.data.length > 0) { if (data.data && data.data.length > 0) {
data.data.forEach((item: any) => { data.data.forEach((item: any) => {
if (item.BusinessProcess_State === 1000) { if (item.BusinessProcess_State === 1000) {
item.BusinessProcess_StateText = "待审核" item.BusinessProcess_StateText = "待发起"
} else if (item.BusinessProcess_State === 2000) { } else if (item.BusinessProcess_State === 2000) {
item.BusinessProcess_StateText = "待审核" item.BusinessProcess_StateText = "待审核"
} else if (item.BusinessProcess_State > 2000 && item.BusinessProcess_State < 9000) { } else if (item.BusinessProcess_State > 2000 && item.BusinessProcess_State < 9000) {
@ -368,11 +497,12 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
}} }}
toolbar={{ toolbar={{
actions: [ actions: [
<Button type={"primary"} onClick={() => { InitiateApplication ?
setShowApplyFor(true) <Button type={"primary"} onClick={() => {
}}> setShowApplyFor(true)
}}>
</Button>
</Button> : ""
] ]
}} }}
/> />
@ -380,7 +510,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
</div> </div>
{/* 审批的悬浮框 */} {/* 审批的悬浮框 */}
<Modal {/* <Modal
width={"70%"} width={"70%"}
title={"审批"} title={"审批"}
open={approveModal} open={approveModal}
@ -566,12 +696,13 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
</Row> : "" </Row> : ""
} }
</ProForm> </ProForm>
</Modal> </Modal> */}
{/* 新增申请的悬浮框 */} {/* 新增申请的悬浮框 */}
<Modal <Modal
className="addProductModal"
width={"70%"} width={"70%"}
title={"新增商品申请"} title={currentRow?.BusinessApproval_ID ? "商品申请详情" : "新增商品申请"}
open={showApplyFor} open={showApplyFor}
destroyOnClose destroyOnClose
onCancel={() => { onCancel={() => {
@ -579,12 +710,46 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
setCurrentRow(undefined) setCurrentRow(undefined)
setShopData([]) setShopData([])
setBUSINESSAPPROVALDETAIL(undefined) setBUSINESSAPPROVALDETAIL(undefined)
}} setShowDetailType(null)
onOk={() => {
formRef?.current?.validateFields().then(() => {
modalFormRef?.current?.submit()
})
setApprovaType(0)
}}
footer={showDetailType === 'detail' || !InitiateApplication || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? false :
<div style={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'flex-end', boxSizing: 'border-box', padding: "0 16px" }}>
<Button style={{ marginRight: '8px' }} onClick={() => {
setShowApplyFor(false)
setCurrentRow(undefined)
setShopData([])
setBUSINESSAPPROVALDETAIL(undefined)
setShowDetailType(null)
setApprovaType(0)
}}></Button>
<Button type={"primary"} onClick={() => {
if (currentRow?.BusinessProcess_State > 1000) {
modalApproveFormRef?.current?.validateFields().then(() => {
modalApproveFormRef?.current?.submit()
})
} else {
modalFormRef?.current?.validateFields().then(() => {
modalFormRef?.current?.submit()
})
}
}}></Button>
</div>}
onOk={() => {
if (currentRow?.BusinessProcess_State > 1000) {
modalApproveFormRef?.current?.validateFields().then(() => {
modalApproveFormRef?.current?.submit()
})
} else {
modalFormRef?.current?.validateFields().then(() => {
modalFormRef?.current?.submit()
})
}
}} }}
> >
<ProForm <ProForm
@ -601,13 +766,27 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
console.log('datadatadata', data); console.log('datadatadata', data);
setBUSINESSAPPROVALDETAIL(data.Result_Data) setBUSINESSAPPROVALDETAIL(data.Result_Data)
const shopData = await handleGetCOMMODITYRUNNINGList({ let shopData: any = []
SearchParameter: {
BUSINESSAPPROVAL_ID: currentRow?.BusinessApproval_ID, if (currentRow?.BusinessProcess_State === 9000) {
}, shopData = await handleGetApprovalCommodityList({
PageIndex: 1, ProvinceCode: currentUser?.ProvinceCode,
pageSize: 999999, // CommodityId: currentUser?.ProvinceCode,
}) BusinessApprovalId: currentRow?.BusinessApproval_ID,
PageIndex: 1,
PageSize: 999999,
})
} else {
shopData = await handleGetCOMMODITYRUNNINGList({
SearchParameter: {
BUSINESSAPPROVAL_ID: currentRow?.BusinessApproval_ID,
},
PageIndex: 1,
pageSize: 999999,
})
}
console.log('shopDatashopDatashopDatashopData', shopData); console.log('shopDatashopDatashopDatashopData', shopData);
setShopData(shopData.Result_Data.List) setShopData(shopData.Result_Data.List)
return { return {
@ -616,31 +795,54 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
NextApproveStaffId: data.Result_Data.APPOVED_IDS NextApproveStaffId: data.Result_Data.APPOVED_IDS
} }
} else { } else {
return false return {}
} }
}} }}
onFinish={async (res) => { onFinish={async (res) => {
const req: any = { let data: any = {}
ProinstName: res.reasonForApplication, if (currentRow?.BusinessApproval_ID) {
UserId: currentUser?.ID, const req: any = {
OperateType: "100100", ProinstId: currentRow?.BusinessApproval_ID,
ServerpartId: res.ServerpartId, ProinstName: res.reasonForApplication,
NextApproveStaffId: res.NextApproveStaffId, UserId: currentUser?.ID,
NextApproveState: 2000, OperateType: "100100",
CommodityRunningList: shopData ServerpartId: res.ServerpartId,
NextApproveStaffId: res.NextApproveStaffId,
NextApproveState: 2000,
CommodityRunningList: shopData
}
data = await handleReapplyCommodityProInst(req)
} else {
const req: any = {
ProinstName: res.reasonForApplication,
UserId: currentUser?.ID,
OperateType: "100100",
ServerpartId: res.ServerpartId,
NextApproveStaffId: res.NextApproveStaffId,
NextApproveState: 2000,
CommodityRunningList: shopData
}
data = await handleCreateCommodityProInst(req)
console.log('dsaidjaskda', data);
} }
const data = await handleCreateCommodityProInst(req)
console.log('dsaidjaskda', data);
if (data.Result_Code === 100) { if (data.Result_Code === 100) {
message.success(data.Result_Desc) message.success(data.Result_Desc)
// setShowApplyFor(false)
// setCurrentRow(undefined)
setShowApplyFor(false) setShowApplyFor(false)
setCurrentRow(undefined) setCurrentRow(undefined)
setShopData([])
setBUSINESSAPPROVALDETAIL(undefined)
setShowDetailType(null)
setApprovaType(0)
actionRef.current?.reload() actionRef.current?.reload()
} else { } else {
message.error(data.Result_Desc) message.error(data.Result_Desc)
} }
}} }}
> >
<Row gutter={8}> <Row gutter={8}>
@ -652,6 +854,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
required: true, required: true,
message: "请输入申请原因!" message: "请输入申请原因!"
}]} }]}
disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)}
/> />
</Col> </Col>
<Col span={12}> <Col span={12}>
@ -679,9 +882,10 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
} }
return list return list
}} }}
disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)}
/> />
</Col> </Col>
<Col span={12}> <Col span={12} style={{ display: currentRow?.BusinessProcess_State > 1000 && ApprovalType !== 0 ? "none" : "" }}>
<ProFormSelect <ProFormSelect
label="下一环节审批人" label="下一环节审批人"
name="NextApproveStaffId" name="NextApproveStaffId"
@ -702,13 +906,24 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
const dataState = await handleGetAPPROVALROUTEList(reqState) const dataState = await handleGetAPPROVALROUTEList(reqState)
if (dataState && dataState.length > 0) { if (dataState && dataState.length > 0) {
let obj: any = {} let obj: any = {}
// 下面的环节
let nextList: any = []
console.log('dataState', dataState); console.log('dataState', dataState);
dataState.forEach((item: any) => { dataState.forEach((item: any) => {
if (item.APPROVALROUTE_STATE === 2000) { if (item.APPROVALROUTE_STATE === 2000) {
obj = item obj = item
} }
if (item.APPROVALROUTE_STATE >= currentRow?.BusinessProcess_State) {
if (item.APPROVALROUTE_STATE === currentRow?.BusinessProcess_State) {
item.status = "process"
}
nextList.push(item)
}
}) })
setNextStepsList(nextList)
console.log('next', nextList);
let personTotal: number = obj.APPROVALSTAFF_ID.split(',').length || 0 let personTotal: number = obj.APPROVALSTAFF_ID.split(',').length || 0
if (personTotal > 0) { if (personTotal > 0) {
let STAFFIDList: number[] = obj.APPROVALSTAFF_ID.split(',') let STAFFIDList: number[] = obj.APPROVALSTAFF_ID.split(',')
@ -721,30 +936,268 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
} }
} }
}} }}
disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)}
/> />
</Col> </Col>
</Row> </Row>
<ProTable
search={false}
options={false}
pagination={false}
columns={modalColumns}
dataSource={shopData}
bordered
toolbar={{
actions: [
<Button type={"primary"} onClick={() => {
setShowAddShopModal(true)
}}>
</Button>
]
}}
/>
</ProForm> </ProForm>
{
currentRow?.BusinessProcess_State > 1000 ?
<ProForm
// layout={'horizontal'}
formRef={modalApproveFormRef}
submitter={false}
preserve={false}
request={async () => {
console.log('approveCurrentRowapproveCurrentRowapproveCurrentRow', approveCurrentRow);
const reqState: any = {
SearchParameter: {
APPROVALROUTE_STATES: "",
APPROVALROUTE_VALID: 1,
OPERATION_TYPES: "100100",
},
PageIndex: 1,
PageSize: 999999
}
const dataState = await handleGetAPPROVALROUTEList(reqState)
console.log('dataStatedataStatedataState', dataState);
let obj: any = {}
let currentIndex: number = 0
if (dataState && dataState.length > 0) {
dataState.forEach((item: any, index: number) => {
if (item.APPROVALROUTE_STATE === currentRow.BusinessProcess_State) {
obj = item
currentIndex = index
}
})
}
if (obj) {
// 审批的时候 拿到当前状态 去找下一个状态
if (ApprovalType === 1) {
// 拿到当前状态的信息 判断下一状态 是不是结束了 结束了 就不显示 下一结算审批人 不是结束 就拿到下一流程的审批人
setNextApproval(obj.NEXT_STATE)
let nextObj: any = currentIndex + 1 <= dataState.length ? dataState[currentIndex + 1] : {}
if (nextObj) {
let personTotal: number = nextObj.APPROVALSTAFF_ID.split(',').length || 0
if (personTotal > 0) {
let STAFFIDList: number[] = nextObj.APPROVALSTAFF_ID.split(',')
let STAFFNAMEList: string[] = nextObj.APPROVALSTAFF_NAME.split(',')
let list: any = []
for (let i = 0; i < personTotal; i++) {
list.push({ label: STAFFNAMEList[i], value: STAFFIDList[i] })
}
setNextApprovalPerson(list)
}
}
} else {
// 驳回的话 去找历史状态
if (dataState && dataState.length > 0) {
let list: any = []
dataState.forEach((item: any, index: number) => {
if (obj.APPROVALROUTE_STATE > item.APPROVALROUTE_STATE) {
list.push({ label: item.APPROVALROUTE_NAME, value: item.APPROVALROUTE_STATE })
}
})
setNextApprovalPerson(list)
}
}
}
return {}
}}
onFinish={async (res) => {
setAddApprovalLoading(true)
let data: any = {}
if (ApprovalType === 1) {
// 审批
const req: any = {
businessApprovalId: currentRow?.BusinessApproval_ID,
UserId: currentUser?.ID,
ApproveInfo: res.ApproveInfo,
nextApproveStaffId: res.nextApproveStaffId || "",
nextApproveState: nextApproval || ""
}
data = await handleApproveCommodityProInst(req)
} else {
// 驳回
const req: any = {
businessApprovalId: currentRow?.BusinessApproval_ID,
UserId: currentUser?.ID,
RejectInfo: res.ApproveInfo,
nextApproveState: res.nextApproveState || ""
}
console.log('reqreqreqreq', req);
data = await handleRejectCommodityProInst(req)
}
setAddApprovalLoading(false)
console.log('datadatadata', data);
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
setShowApplyFor(false)
setCurrentRow(undefined)
setShopData([])
setBUSINESSAPPROVALDETAIL(undefined)
setShowDetailType(null)
// setApproveCurrentRow(undefined)
// setApproveModal(false)
setNextApproval(null)
setNextApprovalPerson(null)
setApprovaType(0)
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}}
>
{
ApprovalType === 1 ?
<Row>
{
nextApproval === 9000 ? '' :
<Col span={6}>
<ProFormSelect
label={"下一阶段审批人"}
name={"nextApproveStaffId"}
options={nextApprovalPerson}
rules={[
{
required: true,
message: "请选择下一阶段审批人!"
}
]}
/>
</Col>
}
<Col span={24}>
<ProFormTextArea
label={"审批意见"}
name={"ApproveInfo"}
rules={[
{
required: true,
message: "请输入审批意见!"
}
]}
/>
</Col>
</Row> : ApprovalType === 2 ?
<Row>
<Col span={6}>
<ProFormSelect
label={"驳回状态"}
name={"nextApproveState"}
options={nextApprovalPerson}
rules={[
{
required: true,
message: "请选择下一阶段审批人!"
}
]}
/>
</Col>
<Col span={24}>
<ProFormTextArea
label={"驳回意见"}
name={"ApproveInfo"}
rules={[
{
required: true,
message: "请输入驳回意见!"
}
]}
/>
</Col>
</Row> : ""
}
</ProForm> : ""
}
<ProTable
search={false}
options={false}
pagination={false}
columns={modalColumns}
dataSource={shopData}
bordered
toolbar={{
actions: [
currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : <Button type={"primary"} onClick={() => {
setShowAddShopModal(true)
}}>
</Button>
]
}}
/>
{
currentRow?.BusinessProcess_State > 1000 ?
<Card title="流程进度" bordered className="ProcessProgress">
<div style={{ width: '100%' }} className="ProcessProgressBox">
<Steps
size="small"
className="multi-line-steps"
direction="horizontal"
progressDot={false}
current={BUSINESSAPPROVALDETAIL?.approveList && BUSINESSAPPROVALDETAIL?.approveList.length ? BUSINESSAPPROVALDETAIL?.approveList.length : 0}
>
{/* <Step
style={{ minWidth: 180, maxWidth: 220 }}
status={currentRow?.BusinessProcess_State > 1000 ? 'finish' : 'wait'}
title="发起申请"
description={
<div>
<Tooltip title={`${currentRow?.Staff_Name || ''}${currentRow?.BusinessProcess_Desc ? `${currentRow?.BusinessProcess_Desc}` : ''}`}>
<p>{`${currentRow?.BusinessProcess_StartDate || ''}`}</p>
</Tooltip>
</div>
}
/> */}
{
BUSINESSAPPROVALDETAIL?.approveList && BUSINESSAPPROVALDETAIL?.approveList.length > 0 ?
BUSINESSAPPROVALDETAIL?.approveList.map((item: any, index: number) => (
<Step
key={index}
style={{ minWidth: 180, maxWidth: 220 }}
status={"finish"}
title={item.APPROVED_NAME}
description={
<div>
<Tooltip title={`${item.STAFF_NAME || ''}${item.APPLYAPPROVE_INFO ? `${item.APPLYAPPROVE_INFO}` : ''}`}>
<p>{`${item.APPLYAPPROVE_DATE || ''}`}</p>
</Tooltip>
</div>}
/>
)) : ''
}
{
nextStepsList && nextStepsList.length > 0 ?
nextStepsList.map((item: any, index: number) => (
<Step
key={index}
style={{ minWidth: 180, maxWidth: 220 }}
status={item.status === 'process' ? 'process' : 'wait'}
title={item.APPROVALROUTE_NAME}
/>
)) : ''
}
</Steps>
</div>
</Card>
: ''
}
</Modal> </Modal>
{/* 新增商品的悬浮框 */} {/* 新增商品的悬浮框 */}
@ -753,43 +1206,66 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
width={1200} width={1200}
wrapClassName={'shopModal'} wrapClassName={'shopModal'}
destroyOnClose destroyOnClose
title={currentRow ? '编辑商品' : '添加商品'} title={currentShopRow?.COMMODITY_ID ? '编辑商品' : '添加商品'}
onOk={() => { onOk={() => {
modalShopFormRef.current?.validateFields().then(async (res: any) => { modalShopFormRef.current?.validateFields().then(async (res: any) => {
let oldData: any = shopData && shopData.length > 0 ? JSON.parse(JSON.stringify(shopData)) : [] let oldData: any = shopData && shopData.length > 0 ? JSON.parse(JSON.stringify(shopData)) : []
console.log('oldDataoldDataoldData', oldData);
console.log('resresresresresres', res);
let newList: any = [] let newList: any = []
// 判断当前的里面有没有一样的 // 判断当前的里面有没有一样的
if (oldData && oldData.length > 0) { if (oldData && oldData.length > 0) {
let same: boolean = false
oldData.forEach((item: any, index: number) => { oldData.forEach((item: any, index: number) => {
if (item.ADDTIME === res.ADDTIME) { if (item.ADDTIME === res.ADDTIME) {
newList.push(res) same = true
newList.push({
...item,
...res
})
} else { } else {
newList.push(item) newList.push(item)
} }
}) })
if (!same) {
newList.push(res)
}
} else { } else {
newList.push(res) newList.push(res)
} }
console.log('newList', newList);
setShopData(newList) setShopData(newList)
setShowAddShopModal(false) setShowAddShopModal(false)
setCommodityList([]) setCommodityList([])
setCustomClassList([]) setCustomClassList([])
setCurrentRow(undefined) setCurrentShopRow(undefined)
}) })
}} }}
onCancel={() => { onCancel={() => {
setShowAddShopModal(false) setShowAddShopModal(false)
setCommodityList([]) setCommodityList([])
setCustomClassList([]) setCustomClassList([])
setCurrentRow(undefined) setCurrentShopRow(undefined)
}} }}
> >
<ProForm <ProForm
formRef={modalShopFormRef} formRef={modalShopFormRef}
submitter={false} submitter={false}
initialValues={currentRow} initialValues={currentShopRow}
request={async () => {
// !currentShopRow?.COMMODITY_ID &&
if (currentShopRow?.SERVERPART_ID) {
await handleGetCommodity(currentShopRow?.SERVERPART_ID)
}
return { ...currentShopRow, BUSINESSTYPE: currentShopRow?.BUSINESSTYPE.toString() }
}}
disabled={currentRow?.BusinessProcess_State === 9000}
> >
<div className={'modalTitle'}></div> <div className={'modalTitle'}></div>
<Row gutter={16}> <Row gutter={16}>

View File

@ -0,0 +1,16 @@
.addProductModal {
.ant-modal-content {
.ant-modal-body {
.ProcessProgress {
.ant-card-body {
.ProcessProgressBox {
.multi-line-steps {
flex-wrap: wrap !important;
display: flex !important;
}
}
}
}
}
}
}

View File

@ -6,7 +6,7 @@ import React, { useEffect, useRef, useState } from "react";
import ProCard from "@ant-design/pro-card"; import ProCard from "@ant-design/pro-card";
import { MenuFoldOutlined } from "@ant-design/icons"; import { MenuFoldOutlined } from "@ant-design/icons";
import type { FormInstance } from "antd"; import type { FormInstance } from "antd";
import { Button, message, Space, Spin, Tree } from "antd"; import { Button, Card, Col, message, Modal, Row, Space, Spin, Steps, Tooltip, Tree } from "antd";
import useRequest from "@ahooksjs/use-request"; import useRequest from "@ahooksjs/use-request";
import { getServerpartTree } from "@/services/options"; import { getServerpartTree } from "@/services/options";
import type { ActionType } from "@ant-design/pro-table"; import type { ActionType } from "@ant-design/pro-table";
@ -16,11 +16,15 @@ import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSele
import PageTitleBox from "@/components/PageTitleBox"; import PageTitleBox from "@/components/PageTitleBox";
import { handleGetExamineList } from "@/pages/examine/examineList/service"; import { handleGetExamineList } from "@/pages/examine/examineList/service";
import { handleGetAPPROVALROUTEList } from "@/pages/Setting/serviceConfig/service"; import { handleGetAPPROVALROUTEList } from "@/pages/Setting/serviceConfig/service";
import ProForm, { ProFormSelect, ProFormTextArea } from "@ant-design/pro-form";
import { handleGetApprovalCommodityList, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList } from "./service";
import './style.less'
const { Step } = Steps
const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) => { const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) => {
const { currentUser } = props const { currentUser } = props
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const modalFormRef = useRef<FormInstance>();
const formRef = useRef<FormInstance>(); const formRef = useRef<FormInstance>();
const [reqDetailList, setReqDetailList] = useState<any>(); // 合计项数据源 const [reqDetailList, setReqDetailList] = useState<any>(); // 合计项数据源
const [printOut, setPrintOut] = useState<any>(); // 打印数据的内容 const [printOut, setPrintOut] = useState<any>(); // 打印数据的内容
@ -30,10 +34,27 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) =
const [currentExamine, setCurrentExamine] = useState<any>() const [currentExamine, setCurrentExamine] = useState<any>()
// 判断当前用户是否有发起按钮 // 判断当前用户是否有发起按钮
const [currentShowInitiate, setCurrentShowInitiate] = useState<boolean>(false) const [currentShowInitiate, setCurrentShowInitiate] = useState<boolean>(false)
// 选择的当前商品行
const [currentRow, setCurrentRow] = useState<any>()
// 新增商品申请
const [showApplyFor, setShowApplyFor] = useState<boolean>(false);
// 商品列表数据
const [shopData, setShopData] = useState<any>()
// 选中的行数据
const [selectRowList, setSelectRowList] = useState<any>()
// 选中的行
const [selectedOrderRowKeys, setSelectedOrderRowKeys] = useState<any>()
// 显示类型
const [showDetailType, setShowDetailType] = useState<any>()
// 审批记录详情
const [BUSINESSAPPROVALDETAIL, setBUSINESSAPPROVALDETAIL] = useState<any>()
// 还有几个环节 拼在流程进度后面
const [nextStepsList, setNextStepsList] = useState<any>()
useEffect(async () => { useEffect(async () => {
await handleChangeType("6-100100") await handleChangeType("6-100100")
}, []) }, [])
let statusList: string[] = ["0", "1000", "2000", "2010,2020,2030,2040,2050,2060,2070,2080,2090", "9000"]
const columns: any = [ const columns: any = [
{ {
@ -49,7 +70,7 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) =
"6-100200": "商品调价流程", "6-100200": "商品调价流程",
"6-100210": "信息修改流程" "6-100210": "信息修改流程"
}, },
initialValue: "6-100100", initialValue: "0",
}, },
{ {
dataIndex: 'BusinessProcess_StateSearch', dataIndex: 'BusinessProcess_StateSearch',
@ -59,11 +80,13 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) =
align: 'center', align: 'center',
hideInTable: true, hideInTable: true,
valueEnum: { valueEnum: {
"0": "全部", 0: "全部",
"2000": "待审核", 1: "待申请",
"2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中", 2: "待审核",
"9000": "已审结" 3: "审核中",
4: "已审结"
}, },
initialValue: "0"
}, },
{ {
dataIndex: 'BusinessProcess_Name', dataIndex: 'BusinessProcess_Name',
@ -72,6 +95,12 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) =
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => {
return <a onClick={() => {
setCurrentRow(record)
setShowApplyFor(true)
}}>{record?.BusinessProcess_Name}</a>
}
}, },
{ {
dataIndex: 'Serverpart_Name', dataIndex: 'Serverpart_Name',
@ -104,6 +133,18 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) =
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => {
return <a style={{
color: record?.BusinessProcess_StateText === '待审核' ? '#1890ff' :
record?.BusinessProcess_StateText === '审核中' ? 'rgb(250, 173, 20)' :
record?.BusinessProcess_StateText === '已审结' ? 'red' : ""
}} onClick={() => {
console.log('recordrecordrecord', record);
setShowDetailType('detail')
setCurrentRow(record)
setShowApplyFor(true)
}}>{record?.BusinessProcess_StateText || "-"}</a>
}
}, },
{ {
dataIndex: 'Accept_Code', dataIndex: 'Accept_Code',
@ -112,6 +153,12 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) =
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
valueType: "select",
valueEnum: {
"6-100100": "新增商品审批",
"6-100200": "商品调价审批",
"6-100210": "商品信息修改审批"
},
}, },
{ {
dataIndex: 'BusinessProcess_EndDate', dataIndex: 'BusinessProcess_EndDate',
@ -131,6 +178,52 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) =
}, },
] ]
const modalColumns: any = [
{
title: "序号",
width: 70,
dataIndex: "index",
valueType: "index",
align: 'center',
ellipsis: true,
},
{
title: "名称",
width: 300,
dataIndex: "COMMODITY_NAME",
ellipsis: true,
align: 'center',
},
{
title: "条码",
width: 150,
dataIndex: "COMMODITY_BARCODE",
ellipsis: true,
align: 'center',
},
{
title: "零售价",
width: 150,
dataIndex: "COMMODITY_RETAILPRICE",
ellipsis: true,
align: 'center',
},
{
title: "规格",
width: 150,
dataIndex: "COMMODITY_RULE",
ellipsis: true,
align: 'center',
},
{
title: "单位",
width: 150,
dataIndex: "COMMODITY_UNIT",
ellipsis: true,
align: 'center',
},
]
// 修改审批类型 // 修改审批类型
const handleChangeType = async (type: string) => { const handleChangeType = async (type: string) => {
// 查出当前类型里面的流程数据 // 查出当前类型里面的流程数据
@ -189,7 +282,7 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) =
SearchParameter: { SearchParameter: {
Operation_Type: 6, Operation_Type: 6,
Accept_Code: params?.searchType === "0" ? '' : params?.searchType, Accept_Code: params?.searchType === "0" ? '' : params?.searchType,
BusinessProcess_StateSearch: params?.BusinessProcess_StateSearch === 0 ? '' : params?.BusinessProcess_StateSearch BusinessProcess_StateSearch: statusList[params?.BusinessProcess_StateSearch] === "0" ? '' : statusList[params?.BusinessProcess_StateSearch]
}, },
PageIndex: 1, PageIndex: 1,
PageSize: 999999 PageSize: 999999
@ -198,7 +291,9 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) =
console.log('data', data) console.log('data', data)
if (data.data && data.data.length > 0) { if (data.data && data.data.length > 0) {
data.data.forEach((item: any) => { data.data.forEach((item: any) => {
if (item.BusinessProcess_State === 2000) { if (item.BusinessProcess_State === 1000) {
item.BusinessProcess_StateText = "待发起"
} else if (item.BusinessProcess_State === 2000) {
item.BusinessProcess_StateText = "待审核" item.BusinessProcess_StateText = "待审核"
} else if (item.BusinessProcess_State > 2000 && item.BusinessProcess_State < 9000) { } else if (item.BusinessProcess_State > 2000 && item.BusinessProcess_State < 9000) {
item.BusinessProcess_StateText = "审核中" item.BusinessProcess_StateText = "审核中"
@ -219,6 +314,235 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) =
/> />
</div> </div>
</div> </div>
<Modal
className="addProductModal"
width={"70%"}
title={currentRow?.BusinessApproval_ID ? "商品信息修改详情" : "新增商品信息修改申请"}
open={showApplyFor}
destroyOnClose
onCancel={() => {
setShowApplyFor(false)
setCurrentRow(undefined)
setShopData([])
setSelectRowList([])
setSelectedOrderRowKeys([])
setShowDetailType(null)
}}
footer={false}
>
<ProForm
// layout={'horizontal'}
formRef={modalFormRef}
submitter={false}
preserve={false}
request={async () => {
if (currentRow?.BusinessApproval_ID) {
const req: any = {
BUSINESSAPPROVALId: currentRow?.BusinessApproval_ID,
}
const data = await handleGetBUSINESSAPPROVALDetail(req)
console.log('datadatadata', data);
setBUSINESSAPPROVALDETAIL(data.Result_Data)
let shopData: any = []
if (currentRow?.BusinessProcess_State === 9000) {
shopData = await handleGetApprovalCommodityList({
ProvinceCode: currentUser?.ProvinceCode,
// CommodityId: currentUser?.ProvinceCode,
BusinessApprovalId: currentRow?.BusinessApproval_ID,
PageIndex: 1,
PageSize: 999999,
})
} else {
shopData = await handleGetCOMMODITYRUNNINGList({
SearchParameter: {
BUSINESSAPPROVAL_ID: currentRow?.BusinessApproval_ID,
},
PageIndex: 1,
pageSize: 999999,
})
}
setShopData(shopData.Result_Data.List)
return {
reasonForApplication: data.Result_Data.BUSINESSAPPROVAL_DESC,
ServerpartId: data.Result_Data.SERVERPART_ID,
NextApproveStaffId: data.Result_Data.APPOVED_IDS
}
} else {
return {}
}
}}
>
<Row gutter={8}>
<Col span={24}>
<ProFormTextArea
label="申请原因"
name="reasonForApplication"
rules={[{
required: true,
message: "请输入申请原因!"
}]}
disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)}
/>
</Col>
<Col span={12}>
<ProFormSelect
label="服务区"
name="ServerpartId"
rules={[{
required: true,
message: "请选择服务区!"
}]}
request={async () => {
const data = await getServerpartTree(currentUser?.ProvinceCode, currentUser?.CityAuthority, true, true, true)
const list: any = []
if (data && data.length > 0) {
data.forEach((item: any) => {
if (item.children && item.children.length > 0) {
item.children.forEach((subItem: any) => {
list.push({ label: subItem.label, value: subItem.value })
})
}
})
data.forEach((item: any) => {
list.push({ label: item.label, value: item.value })
})
}
return list
}}
disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)}
/>
</Col>
<Col span={12} style={{ display: currentRow?.BusinessProcess_State > 1000 ? "none" : "" }}>
<ProFormSelect
label="下一环节审批人"
name="NextApproveStaffId"
rules={[{
required: true,
message: "请选择下一环节审批人!"
}]}
request={async () => {
const reqState: any = {
SearchParameter: {
APPROVALROUTE_STATES: "",
APPROVALROUTE_VALID: 1,
OPERATION_TYPES: "100210",
},
PageIndex: 1,
PageSize: 999999
}
const dataState = await handleGetAPPROVALROUTEList(reqState)
if (dataState && dataState.length > 0) {
let obj: any = {}
// 下面的环节
let nextList: any = []
console.log('dataState', dataState);
dataState.forEach((item: any) => {
if (item.APPROVALROUTE_STATE === 2000) {
obj = item
}
if (item.APPROVALROUTE_STATE >= currentRow?.BusinessProcess_State) {
if (item.APPROVALROUTE_STATE === currentRow?.BusinessProcess_State) {
item.status = "process"
}
nextList.push(item)
}
})
setNextStepsList(nextList)
let personTotal: number = obj.APPROVALSTAFF_ID.split(',').length || 0
if (personTotal > 0) {
let STAFFIDList: number[] = obj.APPROVALSTAFF_ID.split(',')
let STAFFNAMEList: string[] = obj.APPROVALSTAFF_NAME.split(',')
let list: any = []
for (let i = 0; i < personTotal; i++) {
list.push({ label: STAFFNAMEList[i], value: STAFFIDList[i] })
}
return list
}
}
}}
disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)}
/>
</Col>
</Row>
</ProForm>
<ProTable
search={false}
options={false}
pagination={false}
columns={modalColumns}
dataSource={shopData}
bordered
toolbar={{
actions: [
currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : <Button type={"primary"} onClick={() => {
// 判断服务区是否已选择
const values = modalFormRef.current?.getFieldsValue();
if (!values?.ServerpartId) {
message.error("请先选择服务区!");
return;
}
setShowAddShopModal(true);
}}>
</Button>
]
}}
/>
{
currentRow?.BusinessProcess_State > 1000 ?
<Card title="流程进度" bordered className="ProcessProgress">
<div style={{ width: '100%' }} className="ProcessProgressBox">
<Steps
size="small"
className="multi-line-steps"
direction="horizontal"
progressDot={false}
current={BUSINESSAPPROVALDETAIL?.approveList && BUSINESSAPPROVALDETAIL?.approveList.length ? BUSINESSAPPROVALDETAIL?.approveList.length : 0}
>
{
BUSINESSAPPROVALDETAIL?.approveList && BUSINESSAPPROVALDETAIL?.approveList.length > 0 ?
BUSINESSAPPROVALDETAIL?.approveList.map((item: any, index: number) => (
<Step
key={index}
style={{ minWidth: 180, maxWidth: 220 }}
status={"finish"}
title={item.APPROVED_NAME}
description={
<div>
<Tooltip title={`${item.STAFF_NAME || ''}${item.APPLYAPPROVE_INFO ? `${item.APPLYAPPROVE_INFO}` : ''}`}>
<p>{`${item.APPLYAPPROVE_DATE || ''}`}</p>
</Tooltip>
</div>}
/>
)) : ''
}
{
nextStepsList && nextStepsList.length > 0 ?
nextStepsList.map((item: any, index: number) => (
<Step
key={index}
style={{ minWidth: 180, maxWidth: 220 }}
status={item.status === 'process' ? 'process' : 'wait'}
title={item.APPROVALROUTE_NAME}
/>
)) : ''
}
</Steps>
</div>
</Card>
: ''
}
</Modal>
</div > </div >
) )
} }

View File

@ -17,6 +17,23 @@ export async function handleCreateCommodityProInst(params?: any) {
return data; return data;
} }
// 重新发起审批流程
export async function handleReapplyCommodityProInst(params?: any) {
const data = await request('/BusinessProcess/ReapplyCommodityProInst', {
method: 'POST',
data: {
...params,
requestEncryption: true
},
})
if (data.Result_Code !== 100) {
return data
}
return data;
}
// 审核服务区商品审批流程 // 审核服务区商品审批流程
export async function handleApproveCommodityProInst(params?: any) { export async function handleApproveCommodityProInst(params?: any) {
const data = await request('/BusinessProcess/ApproveCommodityProInst', { const data = await request('/BusinessProcess/ApproveCommodityProInst', {
@ -79,4 +96,70 @@ export async function handleGetCOMMODITYRUNNINGList(params?: any) {
return data; return data;
} }
return data; return data;
} }
// 获取办结之后的商品
export async function handleGetApprovalCommodityList(params?: any) {
const data = await request('/Commodity/GetApprovalCommodityList', {
method: 'POST',
data: {
...params,
requestEncryption: true
},
})
if (data.Result_Code !== 100) {
return data;
}
return data;
}
// 删除商品审批流程
export async function handleDeleteCommodityProInst(params?: any) {
const data = await request('/BusinessProcess/DeleteCommodityProInst', {
method: 'POST',
data: {
...params,
requestEncryption: true
},
})
if (data.Result_Code !== 100) {
return data;
}
return data;
}
// 同步编辑申请流程时的商品
export async function handleSynchroCOMMODITY_RUNNING(params?: any) {
const data = await request('/Commodity/SynchroCOMMODITY_RUNNING', {
method: 'POST',
data: {
...params,
requestEncryption: true
},
})
if (data.Result_Code !== 100) {
return data;
}
return data;
}
// 删除审批过程中的商品
export async function handleDeleteCOMMODITY_RUNNING(params?: any) {
const data = await request('/Commodity/DeleteCOMMODITY_RUNNING', {
method: 'POST',
data: {
...params,
requestEncryption: true
},
})
if (data.Result_Code !== 100) {
return data;
}
return data;
}

View File

@ -0,0 +1,16 @@
.addProductModal {
.ant-modal-content {
.ant-modal-body {
.ProcessProgress {
.ant-card-body {
.ProcessProgressBox {
.multi-line-steps {
flex-wrap: wrap !important;
display: flex !important;
}
}
}
}
}
}
}

View File

@ -3,9 +3,9 @@
import { connect } from "umi"; import { connect } from "umi";
import type { CurrentUser } from "umi"; import type { CurrentUser } from "umi";
import type { ConnectState } from "@/models/connect"; import type { ConnectState } from "@/models/connect";
import React, { useRef, useState } from "react"; import React, { useEffect, useRef, useState } from "react";
import type { FormInstance } from "antd"; import type { FormInstance } from "antd";
import { Button, Col, message, Modal, Popconfirm, Row, Space, Spin, Tree } from "antd"; import { Button, Card, Col, message, Modal, Popconfirm, Row, Space, Spin, Steps, Tooltip, Tree } from "antd";
import type { ActionType } from "@ant-design/pro-table"; import type { ActionType } from "@ant-design/pro-table";
import ProTable from "@ant-design/pro-table"; import ProTable from "@ant-design/pro-table";
import PageTitleBox from "@/components/PageTitleBox"; import PageTitleBox from "@/components/PageTitleBox";
@ -17,9 +17,11 @@ import { handleGetCommodityList, handleGetNestingCOMMODITYTYPETree, handleGetSer
import { handleGetUSERDEFINEDTYPEList } from "../userDefinedType/service"; import { handleGetUSERDEFINEDTYPEList } from "../userDefinedType/service";
import useRequest from "@ahooksjs/use-request"; import useRequest from "@ahooksjs/use-request";
import moment from 'moment' import moment from 'moment'
import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleRejectCommodityProInst } from "../ProductApprovalProcess/service"; import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleDeleteCOMMODITY_RUNNING, handleDeleteCommodityProInst, handleGetApprovalCommodityList, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList, handleReapplyCommodityProInst, handleRejectCommodityProInst } from "../ProductApprovalProcess/service";
import session from "@/utils/session"; import session from "@/utils/session";
import './style.less'
const { Step } = Steps
const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props) => { const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props) => {
const { currentUser } = props const { currentUser } = props
const downloadBtnRef = useRef<any>() const downloadBtnRef = useRef<any>()
@ -66,6 +68,14 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
const [editSelectRow, setEditSelectRow] = useState<any>() const [editSelectRow, setEditSelectRow] = useState<any>()
// 新增申请的加载效果 // 新增申请的加载效果
const [handleAddLoading, setHandleAddLoading] = useState<boolean>(false); const [handleAddLoading, setHandleAddLoading] = useState<boolean>(false);
// 审批记录详情
const [BUSINESSAPPROVALDETAIL, setBUSINESSAPPROVALDETAIL] = useState<any>()
// 还有几个环节 拼在流程进度后面
const [nextStepsList, setNextStepsList] = useState<any>()
// 判断有无发起申请的权限
const [InitiateApplication, setInitiateApplication] = useState<boolean>(false)
// 显示类型
const [showDetailType, setShowDetailType] = useState<any>()
// 加载服务区树 // 加载服务区树
const { loading: treeLoading, data: treeViews } = useRequest(async () => { const { loading: treeLoading, data: treeViews } = useRequest(async () => {
@ -100,6 +110,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
return obj return obj
}) })
let statusList: string[] = ["0", "1000", "2000", "2010,2020,2030,2040,2050,2060,2070,2080,2090", "9000"]
const columns: any = [ const columns: any = [
{ {
dataIndex: 'BusinessProcess_StateSearch', dataIndex: 'BusinessProcess_StateSearch',
@ -108,12 +119,20 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
hideInTable: true, hideInTable: true,
// valueEnum: {
// "0": "全部",
// "2000": "待审核",
// "2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中",
// "9000": "已审结"
// },
valueEnum: { valueEnum: {
"0": "全部", 0: "全部",
"2000": "待审核", 1: "待申请",
"2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中", 2: "待审核",
"9000": "已审结" 3: "审核中",
4: "已审结"
}, },
initialValue: "0"
}, },
{ {
dataIndex: 'BusinessProcess_Name', dataIndex: 'BusinessProcess_Name',
@ -154,15 +173,27 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => {
return <a style={{
color: record?.BusinessProcess_StateText === '待审核' ? '#1890ff' :
record?.BusinessProcess_StateText === '审核中' ? 'rgb(250, 173, 20)' :
record?.BusinessProcess_StateText === '已审结' ? 'red' : ""
}} onClick={() => {
console.log('recordrecordrecord', record);
setShowDetailType('detail')
setCurrentRow(record)
setShowApplyFor(true)
}}>{record?.BusinessProcess_StateText || "-"}</a>
}
}, },
{ // {
dataIndex: 'Accept_Code', // dataIndex: 'Accept_Code',
title: '业务类别', // title: '业务类别',
width: 200, // width: 200,
ellipsis: true, // ellipsis: true,
align: 'center', // align: 'center',
hideInSearch: true, // hideInSearch: true,
}, // },
{ {
dataIndex: 'BusinessProcess_EndDate', dataIndex: 'BusinessProcess_EndDate',
title: '办结时间', title: '办结时间',
@ -185,7 +216,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
valueType: 'option', valueType: 'option',
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
width: 120, width: 180,
fixed: "right", fixed: "right",
ellipsis: true, ellipsis: true,
render: (_, record) => { render: (_, record) => {
@ -193,21 +224,63 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
record?.ApproveStaff_ID === currentUser?.ID && record?.BusinessProcess_State !== 9000 record?.ApproveStaff_ID === currentUser?.ID && record?.BusinessProcess_State !== 9000
? ?
<Space> <Space>
<a onClick={() => { {
setApprovaType(1) record?.BusinessProcess_State === 1000
setApproveCurrentRow(record) ?
setApproveModal(true) <>
}} <a onClick={() => {
> setCurrentRow(record)
setShowApplyFor(true)
</a> }}
<a onClick={() => { >
setApprovaType(2)
setApproveCurrentRow(record) </a>
setApproveModal(true) <Popconfirm
}}> title="确认删除该商品审批流程吗?"
onConfirm={async () => {
</a> const req: any = {
businessApprovalId: record?.BusinessApproval_ID,
UserId: currentUser?.ID
}
const data = await handleDeleteCommodityProInst(req)
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}}
>
<a></a>
</Popconfirm>
</>
: ""
}
{
record?.BusinessProcess_State > 1000 ?
<>
<a onClick={() => {
setApprovaType(1)
// setApproveCurrentRow(record)
// setApproveModal(true)
setCurrentRow(record)
setShowApplyFor(true)
}}
>
</a>
<a onClick={() => {
setApprovaType(2)
// setApproveCurrentRow(record)
// setApproveModal(true)
setCurrentRow(record)
setShowApplyFor(true)
}}>
</a>
</> : ""
}
</Space> : "" </Space> : ""
); );
@ -271,37 +344,70 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
render: (_, record) => { render: (_, record) => {
return ( return (
<Space> <Space>
<a {
onClick={() => { currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' :
let obj: any = {} <>
if (shopData && shopData.length > 0) { <a
obj = shopData.filter((item: any) => item.COMMODITY_ID === record?.COMMODITY_ID)[0] onClick={() => {
} let obj: any = {}
console.log('shopData', shopData); if (shopData && shopData.length > 0) {
console.log('obj', obj); obj = shopData.filter((item: any) => item.COMMODITY_ID === record?.COMMODITY_ID)[0]
}
setEditSelectRow(obj)
setEditShopModal(true)
}}
>
</a>
<Popconfirm
title="确认删除该商品管理列表信息吗?"
onConfirm={async () => {
if (currentRow?.BusinessApproval_ID) {
// 申请回到发起时候的真删
const req: any = {
COMMODITY_RUNNINGId: record?.COMMODITY_ID
}
const data = await handleDeleteCOMMODITY_RUNNING(req)
console.log('datadatadatadata', data);
actionRef.current?.reload()
// 实现直接删除的效果
let oldData: any = JSON.parse(JSON.stringify(shopData))
let list: any = []
oldData.forEach((item: any) => {
if (item.COMMODITY_ID !== record?.COMMODITY_ID) {
list.push(item)
}
})
setShopData(list)
} else {
// 还未发起申请的假删
console.log('record', record);
let oldData: any = JSON.parse(JSON.stringify(shopData))
let list: any = []
oldData.forEach((item: any) => {
if (item.ADDTIME !== record?.ADDTIME) {
list.push(item)
}
})
setShopData(list)
}
}}
>
<a></a>
</Popconfirm>
</>
}
setEditSelectRow(obj) {
setEditShopModal(true) currentRow?.BusinessProcess_State === 9000 ?
}} <a onClick={() => {
> // setCurrentShopRow(record)
// setShowAddShopModal(true)
</a> setEditSelectRow(record)
<Popconfirm setEditShopModal(true)
title="确认删除该商品管理列表信息吗?" }}></a>
onConfirm={async () => { : ''
console.log('record', record); }
let oldData: any = JSON.parse(JSON.stringify(shopData))
let list: any = []
oldData.forEach((item: any) => {
if (item.ADDTIME !== record?.ADDTIME) {
list.push(item)
}
})
setShopData(list)
}}
>
<a></a>
</Popconfirm>
</Space> </Space>
); );
}, },
@ -443,7 +549,36 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
console.log('data', data) console.log('data', data)
} }
useEffect(async () => {
const req: any = {
SearchParameter: {
APPROVALROUTE_STATES: "",
APPROVALROUTE_VALID: 1,
OPERATION_TYPES: "100200",
}
}
const data = await handleGetAPPROVALROUTEList(req)
console.log('datadatadatadata', data);
// 拿到发起申请的人
let firstSetp: any = {}
if (data && data.length > 0) {
data.forEach((item: any) => {
if (item.APPROVALROUTE_STATE === 1000) {
firstSetp = item
}
})
}
// 判断当前用户 是否有新增权限
let have: boolean = false
let idList: any = firstSetp.APPROVALSTAFF_ID.split(',')
console.log('idList', idList);
if (idList.indexOf(currentUser?.ID.toString()) !== -1) {
have = true
}
setInitiateApplication(have)
}, [])
return ( return (
<div> <div>
@ -471,7 +606,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
SearchParameter: { SearchParameter: {
Operation_Type: 6, Operation_Type: 6,
Accept_Code: "6-100210", Accept_Code: "6-100210",
BusinessProcess_StateSearch: params?.BusinessProcess_StateSearch === 0 ? '' : params?.BusinessProcess_StateSearch BusinessProcess_StateSearch: statusList[params?.BusinessProcess_StateSearch] === "0" ? '' : statusList[params?.BusinessProcess_StateSearch]
}, },
PageIndex: 1, PageIndex: 1,
PageSize: 999999 PageSize: 999999
@ -481,7 +616,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
if (data.data && data.data.length > 0) { if (data.data && data.data.length > 0) {
data.data.forEach((item: any) => { data.data.forEach((item: any) => {
if (item.BusinessProcess_State === 1000) { if (item.BusinessProcess_State === 1000) {
item.BusinessProcess_StateText = "待审核" item.BusinessProcess_StateText = "待发起"
} else if (item.BusinessProcess_State === 2000) { } else if (item.BusinessProcess_State === 2000) {
item.BusinessProcess_StateText = "待审核" item.BusinessProcess_StateText = "待审核"
} else if (item.BusinessProcess_State > 2000 && item.BusinessProcess_State < 9000) { } else if (item.BusinessProcess_State > 2000 && item.BusinessProcess_State < 9000) {
@ -498,11 +633,12 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
}} }}
toolbar={{ toolbar={{
actions: [ actions: [
<Button type={"primary"} onClick={() => { InitiateApplication ?
setShowApplyFor(true) <Button type={"primary"} onClick={() => {
}}> setShowApplyFor(true)
}}>
</Button>
</Button> : ""
] ]
}} }}
/> />
@ -510,7 +646,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
</div> </div>
{/* 审批的悬浮框 */} {/* 审批的悬浮框 */}
<Modal {/* <Modal
width={"70%"} width={"70%"}
title={"审批"} title={"审批"}
open={approveModal} open={approveModal}
@ -696,27 +832,56 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
</Row> : "" </Row> : ""
} }
</ProForm> </ProForm>
</Modal> </Modal> */}
{/* 新增申请的悬浮框 */} {/* 新增申请的悬浮框 */}
<Modal <Modal
className="addProductModal"
width={"70%"} width={"70%"}
title={"新增商品信息修改申请"} title={currentRow?.BusinessApproval_ID ? "商品信息修改详情" : "新增商品信息修改申请"}
open={showApplyFor} open={showApplyFor}
confirmLoading={handleAddLoading} confirmLoading={handleAddLoading}
destroyOnClose destroyOnClose
footer={showDetailType === 'detail' || !InitiateApplication || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? false : <div style={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'flex-end', boxSizing: 'border-box', padding: "0 16px" }}>
<Button style={{ marginRight: '8px' }} onClick={() => {
setShowApplyFor(false)
setCurrentRow(undefined)
setShopData([])
setSelectRowList([])
setSelectedOrderRowKeys([])
setShowDetailType(null)
}}></Button>
<Button type={"primary"} onClick={() => {
if (currentRow?.BusinessProcess_State > 1000) {
modalApproveFormRef?.current?.validateFields().then(() => {
modalApproveFormRef?.current?.submit()
})
} else {
modalFormRef?.current?.validateFields().then(() => {
modalFormRef?.current?.submit()
})
}
}}></Button>
</div>}
onCancel={() => { onCancel={() => {
setShowApplyFor(false) setShowApplyFor(false)
setCurrentRow(undefined) setCurrentRow(undefined)
setShopData([]) setShopData([])
setSelectRowList([]) setSelectRowList([])
setSelectedOrderRowKeys([]) setSelectedOrderRowKeys([])
setShowDetailType(null)
}} }}
onOk={() => { onOk={() => {
formRef?.current?.validateFields().then(() => { if (currentRow?.BusinessProcess_State > 1000) {
modalFormRef?.current?.submit() modalApproveFormRef?.current?.validateFields().then(() => {
}) modalApproveFormRef?.current?.submit()
})
} else {
modalFormRef?.current?.validateFields().then(() => {
modalFormRef?.current?.submit()
})
}
}} }}
> >
<ProForm <ProForm
@ -724,6 +889,44 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
formRef={modalFormRef} formRef={modalFormRef}
submitter={false} submitter={false}
preserve={false} preserve={false}
request={async () => {
if (currentRow?.BusinessApproval_ID) {
const req: any = {
BUSINESSAPPROVALId: currentRow?.BusinessApproval_ID,
}
const data = await handleGetBUSINESSAPPROVALDetail(req)
console.log('datadatadata', data);
setBUSINESSAPPROVALDETAIL(data.Result_Data)
let shopData: any = []
if (currentRow?.BusinessProcess_State === 9000) {
shopData = await handleGetApprovalCommodityList({
ProvinceCode: currentUser?.ProvinceCode,
// CommodityId: currentUser?.ProvinceCode,
BusinessApprovalId: currentRow?.BusinessApproval_ID,
PageIndex: 1,
PageSize: 999999,
})
} else {
shopData = await handleGetCOMMODITYRUNNINGList({
SearchParameter: {
BUSINESSAPPROVAL_ID: currentRow?.BusinessApproval_ID,
},
PageIndex: 1,
pageSize: 999999,
})
}
console.log('shopDatashopDatashopDatashopData', shopData);
setShopData(shopData.Result_Data.List)
return {
reasonForApplication: data.Result_Data.BUSINESSAPPROVAL_DESC,
ServerpartId: data.Result_Data.SERVERPART_ID,
NextApproveStaffId: data.Result_Data.APPOVED_IDS
}
} else {
return {}
}
}}
onFinish={async (res) => { onFinish={async (res) => {
if (shopData && shopData.length > 0) { if (shopData && shopData.length > 0) {
@ -731,19 +934,37 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
message.error('请选择要修改的商品!') message.error('请选择要修改的商品!')
return return
} }
setHandleAddLoading(true)
const req: any = {
ProinstName: res.reasonForApplication,
UserId: currentUser?.ID,
OperateType: "100210",
ServerpartId: res.ServerpartId,
NextApproveStaffId: res.NextApproveStaffId,
NextApproveState: 2000,
CommodityRunningList: shopData
}
console.log('reqreq', req);
const data = await handleCreateCommodityProInst(req) let data: any = {}
setHandleAddLoading(true)
console.log('currentRowcurrentRowcurrentRow', currentRow);
if (currentRow?.BusinessApproval_ID) {
const req: any = {
ProinstId: currentRow?.BusinessApproval_ID,
ProinstName: res.reasonForApplication,
UserId: currentUser?.ID,
OperateType: "100210",
ServerpartId: res.ServerpartId,
NextApproveStaffId: res.NextApproveStaffId,
NextApproveState: 2000,
CommodityRunningList: shopData
}
data = await handleReapplyCommodityProInst(req)
} else {
const req: any = {
ProinstName: res.reasonForApplication,
UserId: currentUser?.ID,
OperateType: "100210",
ServerpartId: res.ServerpartId,
NextApproveStaffId: res.NextApproveStaffId,
NextApproveState: 2000,
CommodityRunningList: shopData
}
console.log('reqreq', req);
data = await handleCreateCommodityProInst(req)
}
setHandleAddLoading(false) setHandleAddLoading(false)
console.log('dsaidjaskda', data); console.log('dsaidjaskda', data);
if (data.Result_Code === 100) { if (data.Result_Code === 100) {
@ -754,11 +975,12 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
setShopData([]) setShopData([])
setSelectRowList([]) setSelectRowList([])
setSelectedOrderRowKeys([]) setSelectedOrderRowKeys([])
setShowDetailType(null)
} else { } else {
message.error(data.Result_Desc) message.error(data.Result_Desc)
} }
}
}} }
> >
<Row gutter={8}> <Row gutter={8}>
<Col span={24}> <Col span={24}>
@ -769,6 +991,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
required: true, required: true,
message: "请输入申请原因!" message: "请输入申请原因!"
}]} }]}
disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)}
/> />
</Col> </Col>
<Col span={12}> <Col span={12}>
@ -796,9 +1019,10 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
} }
return list return list
}} }}
disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)}
/> />
</Col> </Col>
<Col span={12}> <Col span={12} style={{ display: currentRow?.BusinessProcess_State > 1000 && ApprovalType !== 0 ? "none" : "" }}>
<ProFormSelect <ProFormSelect
label="下一环节审批人" label="下一环节审批人"
name="NextApproveStaffId" name="NextApproveStaffId"
@ -819,13 +1043,24 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
const dataState = await handleGetAPPROVALROUTEList(reqState) const dataState = await handleGetAPPROVALROUTEList(reqState)
if (dataState && dataState.length > 0) { if (dataState && dataState.length > 0) {
let obj: any = {} let obj: any = {}
// 下面的环节
let nextList: any = []
console.log('dataState', dataState); console.log('dataState', dataState);
dataState.forEach((item: any) => { dataState.forEach((item: any) => {
if (item.APPROVALROUTE_STATE === 2000) { if (item.APPROVALROUTE_STATE === 2000) {
obj = item obj = item
} }
if (item.APPROVALROUTE_STATE >= currentRow?.BusinessProcess_State) {
if (item.APPROVALROUTE_STATE === currentRow?.BusinessProcess_State) {
item.status = "process"
}
nextList.push(item)
}
}) })
setNextStepsList(nextList)
let personTotal: number = obj.APPROVALSTAFF_ID.split(',').length || 0 let personTotal: number = obj.APPROVALSTAFF_ID.split(',').length || 0
if (personTotal > 0) { if (personTotal > 0) {
let STAFFIDList: number[] = obj.APPROVALSTAFF_ID.split(',') let STAFFIDList: number[] = obj.APPROVALSTAFF_ID.split(',')
@ -838,36 +1073,264 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
} }
} }
}} }}
disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)}
/> />
</Col> </Col>
</Row> </Row>
<ProTable
search={false}
options={false}
pagination={false}
columns={modalColumns}
dataSource={shopData}
bordered
toolbar={{
actions: [
<Button type={"primary"} onClick={() => {
// 判断服务区是否已选择
const values = modalFormRef.current?.getFieldsValue();
if (!values?.ServerpartId) {
message.error("请先选择服务区!");
return;
}
setShowAddShopModal(true);
}}>
</Button>
]
}}
/>
</ProForm>
</ProForm>
{
currentRow?.BusinessProcess_State > 1000 ?
<ProForm
// layout={'horizontal'}
formRef={modalApproveFormRef}
submitter={false}
preserve={false}
request={async () => {
console.log('approveCurrentRowapproveCurrentRowapproveCurrentRow', currentRow);
const reqState: any = {
SearchParameter: {
APPROVALROUTE_STATES: "",
APPROVALROUTE_VALID: 1,
OPERATION_TYPES: "100210",
},
PageIndex: 1,
PageSize: 999999
}
const dataState = await handleGetAPPROVALROUTEList(reqState)
console.log('dataStatedataStatedataState', dataState);
let obj: any = {}
let currentIndex: number = 0
if (dataState && dataState.length > 0) {
dataState.forEach((item: any, index: number) => {
if (item.APPROVALROUTE_STATE === currentRow.BusinessProcess_State) {
obj = item
currentIndex = index
}
})
}
if (obj) {
// 审批的时候 拿到当前状态 去找下一个状态
if (ApprovalType === 1) {
// 拿到当前状态的信息 判断下一状态 是不是结束了 结束了 就不显示 下一结算审批人 不是结束 就拿到下一流程的审批人
setNextApproval(obj.NEXT_STATE)
let nextObj: any = currentIndex + 1 <= dataState.length ? dataState[currentIndex + 1] : {}
if (nextObj) {
let personTotal: number = nextObj.APPROVALSTAFF_ID.split(',').length || 0
if (personTotal > 0) {
let STAFFIDList: number[] = nextObj.APPROVALSTAFF_ID.split(',')
let STAFFNAMEList: string[] = nextObj.APPROVALSTAFF_NAME.split(',')
let list: any = []
for (let i = 0; i < personTotal; i++) {
list.push({ label: STAFFNAMEList[i], value: STAFFIDList[i] })
}
setNextApprovalPerson(list)
}
}
} else {
// 驳回的话 去找历史状态
if (dataState && dataState.length > 0) {
let list: any = []
dataState.forEach((item: any, index: number) => {
if (obj.APPROVALROUTE_STATE > item.APPROVALROUTE_STATE) {
list.push({ label: item.APPROVALROUTE_NAME, value: item.APPROVALROUTE_STATE })
}
})
setNextApprovalPerson(list)
}
}
}
return {}
}}
onFinish={async (res) => {
setAddApprovalLoading(true)
let data: any = {}
if (ApprovalType === 1) {
// 审批
const req: any = {
businessApprovalId: currentRow?.BusinessApproval_ID,
UserId: currentUser?.ID,
ApproveInfo: res.ApproveInfo,
nextApproveStaffId: res.nextApproveStaffId || "",
nextApproveState: nextApproval || ""
}
data = await handleApproveCommodityProInst(req)
} else {
// 驳回
const req: any = {
businessApprovalId: currentRow?.BusinessApproval_ID,
UserId: currentUser?.ID,
RejectInfo: res.ApproveInfo,
nextApproveState: res.nextApproveState || ""
}
console.log('reqreqreqreq', req);
data = await handleRejectCommodityProInst(req)
}
setAddApprovalLoading(false)
console.log('datadatadata', data);
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
setShowApplyFor(false)
setCurrentRow(undefined)
actionRef.current?.reload()
setShopData([])
setSelectRowList([])
setSelectedOrderRowKeys([])
setApproveCurrentRow(undefined)
setApproveModal(false)
setNextApproval(null)
setNextApprovalPerson(null)
setApprovaType(0)
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}}
>
{
ApprovalType === 1 ?
<Row>
{
nextApproval === 9000 ? '' :
<Col span={6}>
<ProFormSelect
label={"下一阶段审批人"}
name={"nextApproveStaffId"}
options={nextApprovalPerson}
rules={[
{
required: true,
message: "请选择下一阶段审批人!"
}
]}
/>
</Col>
}
<Col span={24}>
<ProFormTextArea
label={"审批意见"}
name={"ApproveInfo"}
rules={[
{
required: true,
message: "请输入审批意见!"
}
]}
/>
</Col>
</Row> : ApprovalType === 2 ?
<Row>
<Col span={6}>
<ProFormSelect
label={"驳回状态"}
name={"nextApproveState"}
options={nextApprovalPerson}
rules={[
{
required: true,
message: "请选择下一阶段审批人!"
}
]}
/>
</Col>
<Col span={24}>
<ProFormTextArea
label={"驳回意见"}
name={"ApproveInfo"}
rules={[
{
required: true,
message: "请输入驳回意见!"
}
]}
/>
</Col>
</Row> : ""
}
</ProForm> : ""
}
<ProTable
search={false}
options={false}
pagination={false}
columns={modalColumns}
dataSource={shopData}
bordered
toolbar={{
actions: [
currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : <Button type={"primary"} onClick={() => {
// 判断服务区是否已选择
const values = modalFormRef.current?.getFieldsValue();
if (!values?.ServerpartId) {
message.error("请先选择服务区!");
return;
}
setShowAddShopModal(true);
}}>
</Button>
]
}}
/>
{
currentRow?.BusinessProcess_State > 1000 ?
<Card title="流程进度" bordered className="ProcessProgress">
<div style={{ width: '100%' }} className="ProcessProgressBox">
<Steps
size="small"
className="multi-line-steps"
direction="horizontal"
progressDot={false}
current={BUSINESSAPPROVALDETAIL?.approveList && BUSINESSAPPROVALDETAIL?.approveList.length ? BUSINESSAPPROVALDETAIL?.approveList.length : 0}
>
{
BUSINESSAPPROVALDETAIL?.approveList && BUSINESSAPPROVALDETAIL?.approveList.length > 0 ?
BUSINESSAPPROVALDETAIL?.approveList.map((item: any, index: number) => (
<Step
key={index}
style={{ minWidth: 180, maxWidth: 220 }}
status={"finish"}
title={item.APPROVED_NAME}
description={
<div>
<Tooltip title={`${item.STAFF_NAME || ''}${item.APPLYAPPROVE_INFO ? `${item.APPLYAPPROVE_INFO}` : ''}`}>
<p>{`${item.APPLYAPPROVE_DATE || ''}`}</p>
</Tooltip>
</div>}
/>
)) : ''
}
{
nextStepsList && nextStepsList.length > 0 ?
nextStepsList.map((item: any, index: number) => (
<Step
key={index}
style={{ minWidth: 180, maxWidth: 220 }}
status={item.status === 'process' ? 'process' : 'wait'}
title={item.APPROVALROUTE_NAME}
/>
)) : ''
}
</Steps>
</div>
</Card>
: ''
}
</Modal> </Modal>
{/* 选择商品 */} {/* 选择商品 */}
@ -880,8 +1343,6 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
onOk={() => { onOk={() => {
setShowAddShopModal(false) setShowAddShopModal(false)
setShopData(selectRowList) setShopData(selectRowList)
console.log('selectRowListselectRowList', selectRowList);
}} }}
onCancel={() => { onCancel={() => {
setShowAddShopModal(false) setShowAddShopModal(false)
@ -968,7 +1429,20 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
<ProForm <ProForm
formRef={modalShopFormRef} formRef={modalShopFormRef}
submitter={false} submitter={false}
initialValues={editSelectRow} request={async () => {
// !currentShopRow?.COMMODITY_ID &&
if (editSelectRow?.SERVERPART_ID) {
await handleGetCommodity(editSelectRow?.SERVERPART_ID)
}
return { ...editSelectRow, BUSINESSTYPE: editSelectRow?.BUSINESSTYPE.toString(), COMMODITY_GRADE: Number(editSelectRow?.COMMODITY_GRADE) }
}}
disabled={currentRow?.BusinessProcess_State === 9000}
// initialValues={editSelectRow ? {
// ...editSelectRow,
// COMMODITY_GRADE: Number(editSelectRow?.COMMODITY_GRADE)
// } : {
// }}
> >
<div className={'modalTitle'}></div> <div className={'modalTitle'}></div>
<Row gutter={16}> <Row gutter={16}>

View File

@ -0,0 +1,16 @@
.addProductModal {
.ant-modal-content {
.ant-modal-body {
.ProcessProgress {
.ant-card-body {
.ProcessProgressBox {
.multi-line-steps {
flex-wrap: wrap !important;
display: flex !important;
}
}
}
}
}
}
}

View File

@ -3,9 +3,9 @@
import { connect } from "umi"; import { connect } from "umi";
import type { CurrentUser } from "umi"; import type { CurrentUser } from "umi";
import type { ConnectState } from "@/models/connect"; import type { ConnectState } from "@/models/connect";
import React, { useRef, useState } from "react"; import React, { useEffect, useRef, useState } from "react";
import type { FormInstance } from "antd"; import type { FormInstance } from "antd";
import { Button, Col, Input, message, Modal, Popconfirm, Row, Space, Spin, Tree } from "antd"; import { Button, Card, Col, Input, message, Modal, Popconfirm, Row, Space, Spin, Steps, Tooltip, Tree } from "antd";
import type { ActionType } from "@ant-design/pro-table"; import type { ActionType } from "@ant-design/pro-table";
import ProTable from "@ant-design/pro-table"; import ProTable from "@ant-design/pro-table";
import PageTitleBox from "@/components/PageTitleBox"; import PageTitleBox from "@/components/PageTitleBox";
@ -17,9 +17,10 @@ import { handleGetCommodityList, handleGetNestingCOMMODITYTYPETree, handleGetSer
import { handleGetUSERDEFINEDTYPEList } from "../userDefinedType/service"; import { handleGetUSERDEFINEDTYPEList } from "../userDefinedType/service";
import useRequest from "@ahooksjs/use-request"; import useRequest from "@ahooksjs/use-request";
import moment from 'moment' import moment from 'moment'
import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleRejectCommodityProInst } from "../ProductApprovalProcess/service"; import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleDeleteCOMMODITY_RUNNING, handleDeleteCommodityProInst, handleGetApprovalCommodityList, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList, handleReapplyCommodityProInst, handleRejectCommodityProInst } from "../ProductApprovalProcess/service";
import session from "@/utils/session"; import session from "@/utils/session";
import './style.less'
const { Step } = Steps
const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (props) => { const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (props) => {
const { currentUser } = props const { currentUser } = props
const downloadBtnRef = useRef<any>() const downloadBtnRef = useRef<any>()
@ -55,6 +56,14 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
const [ApprovalType, setApprovaType] = useState<number>(0) const [ApprovalType, setApprovaType] = useState<number>(0)
// 新增申请的加载效果 // 新增申请的加载效果
const [addApprovalLoading, setAddApprovalLoading] = useState<boolean>(false); const [addApprovalLoading, setAddApprovalLoading] = useState<boolean>(false);
// 审批记录详情
const [BUSINESSAPPROVALDETAIL, setBUSINESSAPPROVALDETAIL] = useState<any>()
// 还有几个环节 拼在流程进度后面
const [nextStepsList, setNextStepsList] = useState<any>()
// 判断有无发起申请的权限
const [InitiateApplication, setInitiateApplication] = useState<boolean>(false)
// 显示类型
const [showDetailType, setShowDetailType] = useState<any>()
const { loading: CommodityLoading, data: CommodityData } = useRequest(async () => { const { loading: CommodityLoading, data: CommodityData } = useRequest(async () => {
const data = await getFieldEnumTree({ FieldExplainField: 'CommodityTypeIds' }) const data = await getFieldEnumTree({ FieldExplainField: 'CommodityTypeIds' })
@ -76,7 +85,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
} }
return obj return obj
}) })
let statusList: string[] = ["0", "1000", "2000", "2010,2020,2030,2040,2050,2060,2070,2080,2090", "9000"]
const columns: any = [ const columns: any = [
{ {
dataIndex: 'BusinessProcess_StateSearch', dataIndex: 'BusinessProcess_StateSearch',
@ -85,12 +94,20 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
hideInTable: true, hideInTable: true,
// valueEnum: {
// "0": "全部",
// "2000": "待审核",
// "2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中",
// "9000": "已审结"
// },
valueEnum: { valueEnum: {
"0": "全部", 0: "全部",
"2000": "待审核", 1: "待申请",
"2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中", 2: "待审核",
"9000": "已审结" 3: "审核中",
4: "已审结"
}, },
initialValue: "0"
}, },
{ {
dataIndex: 'BusinessProcess_Name', dataIndex: 'BusinessProcess_Name',
@ -131,15 +148,27 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => {
return <a style={{
color: record?.BusinessProcess_StateText === '待审核' ? '#1890ff' :
record?.BusinessProcess_StateText === '审核中' ? 'rgb(250, 173, 20)' :
record?.BusinessProcess_StateText === '已审结' ? 'red' : ""
}} onClick={() => {
console.log('recordrecordrecord', record);
setShowDetailType('detail')
setCurrentRow(record)
setShowApplyFor(true)
}}>{record?.BusinessProcess_StateText || "-"}</a>
}
}, },
{ // {
dataIndex: 'Accept_Code', // dataIndex: 'Accept_Code',
title: '业务类别', // title: '业务类别',
width: 200, // width: 200,
ellipsis: true, // ellipsis: true,
align: 'center', // align: 'center',
hideInSearch: true, // hideInSearch: true,
}, // },
{ {
dataIndex: 'BusinessProcess_EndDate', dataIndex: 'BusinessProcess_EndDate',
title: '办结时间', title: '办结时间',
@ -170,22 +199,65 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
record?.ApproveStaff_ID === currentUser?.ID && record?.BusinessProcess_State !== 9000 record?.ApproveStaff_ID === currentUser?.ID && record?.BusinessProcess_State !== 9000
? ?
<Space> <Space>
<a {
onClick={() => { record?.BusinessProcess_State === 1000
setApprovaType(1) ?
setApproveCurrentRow(record) <>
setApproveModal(true) <a onClick={() => {
}} setCurrentRow(record)
> setShowApplyFor(true)
}}
</a> >
<a onClick={() => {
setApprovaType(2) </a>
setApproveCurrentRow(record) <Popconfirm
setApproveModal(true) title="确认删除该商品审批流程吗?"
}}> onConfirm={async () => {
const req: any = {
</a> businessApprovalId: record?.BusinessApproval_ID,
UserId: currentUser?.ID
}
const data = await handleDeleteCommodityProInst(req)
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}}
>
<a></a>
</Popconfirm>
</>
: ""
}
{
record?.BusinessProcess_State > 1000 ?
<>
<a
onClick={() => {
setApprovaType(1)
// setApproveCurrentRow(record)
// setApproveModal(true)
setCurrentRow(record)
setShowApplyFor(true)
}}
>
</a>
<a onClick={() => {
setApprovaType(2)
// setApproveCurrentRow(record)
// setApproveModal(true)
setCurrentRow(record)
setShowApplyFor(true)
}}>
</a>
</> : ""
}
</Space> : "" </Space> : ""
); );
}, },
@ -229,7 +301,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
render: (_, record) => { render: (_, record) => {
return <Input value={record.newPrice} onChange={(e: any) => { return <Input value={record.newPrice} disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} onChange={(e: any) => {
let oldData: any = JSON.parse(JSON.stringify(shopData)) let oldData: any = JSON.parse(JSON.stringify(shopData))
let list: any = [] let list: any = []
oldData.forEach((item: any) => { oldData.forEach((item: any) => {
@ -255,33 +327,63 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
valueType: 'option', valueType: 'option',
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
width: 120, width: 180,
fixed: "right", fixed: "right",
ellipsis: true, ellipsis: true,
render: (_, record) => { render: (_, record) => {
return ( return (
<Space> <Space>
<Popconfirm {
title="确认删除该商品管理列表信息吗?" currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' :
onConfirm={async () => { <>
console.log('record', record); <Popconfirm
let oldData: any = JSON.parse(JSON.stringify(shopData)) title="确认删除该商品管理列表信息吗?"
let list: any = [] onConfirm={async () => {
let rowKeyList: number[] = []
oldData.forEach((item: any) => { if (currentRow?.BusinessApproval_ID) {
if (item.COMMODITY_ID !== record?.COMMODITY_ID) { console.log('record', record);
list.push(item) // 申请回到发起时候的真删
rowKeyList.push(item.COMMODITY_ID) const req: any = {
} COMMODITY_RUNNINGId: record?.COMMODITY_ID
}) }
setShopData(list) const data = await handleDeleteCOMMODITY_RUNNING(req)
setSelectRowList(list) console.log('datadatadatadata', data);
setSelectedOrderRowKeys(rowKeyList) actionRef.current?.reload()
}} // 实现直接删除的效果
> console.log('record', record);
<a></a> let oldData: any = JSON.parse(JSON.stringify(shopData))
</Popconfirm> let list: any = []
let rowKeyList: number[] = []
oldData.forEach((item: any) => {
if (item.COMMODITY_ID !== record?.COMMODITY_ID) {
list.push(item)
rowKeyList.push(item.COMMODITY_ID)
}
})
setShopData(list)
setSelectRowList(list)
setSelectedOrderRowKeys(rowKeyList)
} else {
console.log('record', record);
let oldData: any = JSON.parse(JSON.stringify(shopData))
let list: any = []
let rowKeyList: number[] = []
oldData.forEach((item: any) => {
if (item.COMMODITY_ID !== record?.COMMODITY_ID) {
list.push(item)
rowKeyList.push(item.COMMODITY_ID)
}
})
setShopData(list)
setSelectRowList(list)
setSelectedOrderRowKeys(rowKeyList)
}
}}
>
<a></a>
</Popconfirm>
</>
}
</Space> </Space>
); );
}, },
@ -297,16 +399,16 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
hideInSearch: true, hideInSearch: true,
valueType: 'index' valueType: 'index'
}, },
{ // {
title: <div style={{ textAlign: 'center' }}></div>, // title: <div style={{ textAlign: 'center' }}>服务区</div>,
width: 150, // width: 150,
ellipsis: true, // ellipsis: true,
align: 'center', // align: 'center',
dataIndex: 'SERVERPART_NAME', // dataIndex: 'SERVERPART_NAME',
hideInSearch: true, // hideInSearch: true,
valueType: "select", // valueType: "select",
valueEnum: ServerpartIdsList // valueEnum: ServerpartIdsList
}, // },
{ {
title: <div style={{ textAlign: 'center' }}></div>, title: <div style={{ textAlign: 'center' }}></div>,
width: 120, width: 120,
@ -389,7 +491,36 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
} }
] ]
useEffect(async () => {
const req: any = {
SearchParameter: {
APPROVALROUTE_STATES: "",
APPROVALROUTE_VALID: 1,
OPERATION_TYPES: "100200",
}
}
const data = await handleGetAPPROVALROUTEList(req)
console.log('datadatadatadata', data);
// 拿到发起申请的人
let firstSetp: any = {}
if (data && data.length > 0) {
data.forEach((item: any) => {
if (item.APPROVALROUTE_STATE === 1000) {
firstSetp = item
}
})
}
// 判断当前用户 是否有新增权限
let have: boolean = false
let idList: any = firstSetp.APPROVALSTAFF_ID.split(',')
console.log('idList', idList);
if (idList.indexOf(currentUser?.ID.toString()) !== -1) {
have = true
}
setInitiateApplication(have)
}, [])
return ( return (
<div> <div>
@ -417,7 +548,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
SearchParameter: { SearchParameter: {
Operation_Type: 6, Operation_Type: 6,
Accept_Code: "6-100200", Accept_Code: "6-100200",
BusinessProcess_StateSearch: params?.BusinessProcess_StateSearch === 0 ? '' : params?.BusinessProcess_StateSearch BusinessProcess_StateSearch: statusList[params?.BusinessProcess_StateSearch] === "0" ? '' : statusList[params?.BusinessProcess_StateSearch]
}, },
PageIndex: 1, PageIndex: 1,
PageSize: 999999 PageSize: 999999
@ -427,7 +558,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
if (data.data && data.data.length > 0) { if (data.data && data.data.length > 0) {
data.data.forEach((item: any) => { data.data.forEach((item: any) => {
if (item.BusinessProcess_State === 1000) { if (item.BusinessProcess_State === 1000) {
item.BusinessProcess_StateText = "待审核" item.BusinessProcess_StateText = "待申请"
} else if (item.BusinessProcess_State === 2000) { } else if (item.BusinessProcess_State === 2000) {
item.BusinessProcess_StateText = "待审核" item.BusinessProcess_StateText = "待审核"
} else if (item.BusinessProcess_State > 2000 && item.BusinessProcess_State < 9000) { } else if (item.BusinessProcess_State > 2000 && item.BusinessProcess_State < 9000) {
@ -444,11 +575,12 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
}} }}
toolbar={{ toolbar={{
actions: [ actions: [
<Button type={"primary"} onClick={() => { InitiateApplication ?
setShowApplyFor(true) <Button type={"primary"} onClick={() => {
}}> setShowApplyFor(true)
}}>
</Button>
</Button> : ""
] ]
}} }}
/> />
@ -456,7 +588,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
</div> </div>
{/* 审批的悬浮框 */} {/* 审批的悬浮框 */}
<Modal {/* <Modal
width={"70%"} width={"70%"}
title={"审批"} title={"审批"}
open={approveModal} open={approveModal}
@ -642,12 +774,13 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
</Row> : "" </Row> : ""
} }
</ProForm> </ProForm>
</Modal> </Modal> */}
{/* 新增申请的悬浮框 */} {/* 新增申请的悬浮框 */}
<Modal <Modal
className="addProductModal"
width={"70%"} width={"70%"}
title={"新增商品申请"} title={currentRow?.BusinessApproval_ID ? "商品申请详情" : "新增商品申请"}
open={showApplyFor} open={showApplyFor}
destroyOnClose destroyOnClose
onCancel={() => { onCancel={() => {
@ -656,36 +789,128 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
setSelectRowList([]) setSelectRowList([])
setSelectedOrderRowKeys([]) setSelectedOrderRowKeys([])
setShopData([]) setShopData([])
setShowDetailType(null)
}} }}
confirmLoading={showApplyForLoading} confirmLoading={showApplyForLoading}
onOk={() => { footer={showDetailType === 'detail' || !InitiateApplication || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? false : <div style={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'flex-end', boxSizing: 'border-box', padding: "0 16px" }}>
// 判断表格里面的现价 是不是都已经输入了 <Button style={{ marginRight: '8px' }} onClick={() => {
let allRight: boolean = true setShowApplyFor(false)
console.log('shopData', shopData); setCurrentRow(undefined)
setSelectRowList([])
setSelectedOrderRowKeys([])
setShopData([])
setShowDetailType(null)
}}></Button>
if (shopData && shopData.length > 0) { <Button type={"primary"} loading={showApplyForLoading} onClick={() => {
shopData.forEach((item: any) => { if (currentRow?.BusinessProcess_State > 1000) {
if (!item.newPrice) { modalApproveFormRef?.current?.validateFields().then(() => {
allRight = false modalApproveFormRef?.current?.submit()
})
} else {
// 判断表格里面的现价 是不是都已经输入了
let allRight: boolean = true
if (shopData && shopData.length > 0) {
shopData.forEach((item: any) => {
if (!item.newPrice) {
allRight = false
}
})
} }
if (!allRight) {
message.error("请先完善表格数据!")
return
}
formRef?.current?.validateFields().then(() => {
modalFormRef?.current?.submit()
})
}
}}></Button>
</div>}
onOk={() => {
if (currentRow?.BusinessProcess_State > 1000) {
modalApproveFormRef?.current?.validateFields().then(() => {
modalApproveFormRef?.current?.submit()
})
} else {
// 判断表格里面的现价 是不是都已经输入了
let allRight: boolean = true
if (shopData && shopData.length > 0) {
shopData.forEach((item: any) => {
if (!item.newPrice) {
allRight = false
}
})
}
if (!allRight) {
message.error("请先完善表格数据!")
return
}
formRef?.current?.validateFields().then(() => {
modalFormRef?.current?.submit()
}) })
} }
if (!allRight) {
message.error("请先完善表格数据!")
return
}
formRef?.current?.validateFields().then(() => {
modalFormRef?.current?.submit()
})
}} }}
> >
<ProForm <ProForm
// layout={'horizontal'} // layout={'horizontal'}
formRef={modalFormRef} formRef={modalFormRef}
submitter={false} submitter={false}
preserve={false} preserve={false}
request={async () => {
console.log('currentRowcurrentRowdsada', currentRow);
if (currentRow?.BusinessApproval_ID) {
const req: any = {
BUSINESSAPPROVALId: currentRow?.BusinessApproval_ID,
}
const data = await handleGetBUSINESSAPPROVALDetail(req)
console.log('datadatadata', data);
setBUSINESSAPPROVALDETAIL(data.Result_Data)
let shopData: any = []
if (currentRow?.BusinessProcess_State === 9000) {
shopData = await handleGetApprovalCommodityList({
ProvinceCode: currentUser?.ProvinceCode,
// CommodityId: currentUser?.ProvinceCode,
BusinessApprovalId: currentRow?.BusinessApproval_ID,
PageIndex: 1,
PageSize: 999999,
})
} else {
shopData = await handleGetCOMMODITYRUNNINGList({
SearchParameter: {
BUSINESSAPPROVAL_ID: currentRow?.BusinessApproval_ID,
},
PageIndex: 1,
pageSize: 999999,
})
}
console.log('shopDatashopDatashopDatashopData', shopData);
let shopList: any = shopData.Result_Data.List
let list: any = []
if (shopList && shopList.length > 0) {
shopList.forEach((item: any) => {
let obj: any = JSON.parse(JSON.stringify(item))
obj.newPrice = item.COMMODITY_CURRPRICE
obj.COMMODITY_RETAILPRICE = item.COMMODITY_ORIPRICE
obj.COMMODITY_CURRPRICE = item.COMMODITY_ORIPRICE
obj.COMMODITY_ORIPRICE = null
list.push(obj)
})
}
setShopData(list)
return {
reasonForApplication: data.Result_Data.BUSINESSAPPROVAL_DESC,
ServerpartId: data.Result_Data.SERVERPART_ID,
NextApproveStaffId: data.Result_Data.APPOVED_IDS
}
} else {
return {}
}
}}
onFinish={async (res) => { onFinish={async (res) => {
setShowApplyForLoading(true) setShowApplyForLoading(true)
let list: any = [] let list: any = []
@ -699,20 +924,35 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
list.push(obj) list.push(obj)
}) })
} }
let data: any = {}
if (currentRow?.BusinessApproval_ID) {
const req: any = {
ProinstId: currentRow?.BusinessApproval_ID,
ProinstName: res.reasonForApplication,
UserId: currentUser?.ID,
OperateType: "100200",
ServerpartId: res.ServerpartId,
NextApproveStaffId: res.NextApproveStaffId,
NextApproveState: 2000,
CommodityRunningList: list
}
console.log('req', req);
data = await handleReapplyCommodityProInst(req)
} else {
const req: any = {
ProinstName: res.reasonForApplication,
UserId: currentUser?.ID,
OperateType: "100200",
ServerpartId: res.ServerpartId,
NextApproveStaffId: res.NextApproveStaffId,
NextApproveState: 2000,
CommodityRunningList: list
}
console.log('req', req);
const req: any = { data = await handleCreateCommodityProInst(req)
ProinstName: res.reasonForApplication,
UserId: currentUser?.ID,
OperateType: "100200",
ServerpartId: res.ServerpartId,
NextApproveStaffId: res.NextApproveStaffId,
NextApproveState: 2000,
CommodityRunningList: list
} }
console.log('req', req);
const data = await handleCreateCommodityProInst(req)
setShowApplyForLoading(false) setShowApplyForLoading(false)
console.log('dsaidjaskda', data); console.log('dsaidjaskda', data);
if (data.Result_Code === 100) { if (data.Result_Code === 100) {
@ -727,7 +967,8 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
message.error(data.Result_Desc) message.error(data.Result_Desc)
} }
}} }
}
> >
<Row gutter={8}> <Row gutter={8}>
<Col span={24}> <Col span={24}>
@ -738,6 +979,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
required: true, required: true,
message: "请输入申请原因!" message: "请输入申请原因!"
}]} }]}
disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)}
/> />
</Col> </Col>
<Col span={12}> <Col span={12}>
@ -765,9 +1007,10 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
} }
return list return list
}} }}
disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)}
/> />
</Col> </Col>
<Col span={12}> <Col span={12} style={{ display: currentRow?.BusinessProcess_State > 1000 && ApprovalType !== 0 ? "none" : "" }}>
<ProFormSelect <ProFormSelect
label="下一环节审批人" label="下一环节审批人"
name="NextApproveStaffId" name="NextApproveStaffId"
@ -788,13 +1031,23 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
const dataState = await handleGetAPPROVALROUTEList(reqState) const dataState = await handleGetAPPROVALROUTEList(reqState)
if (dataState && dataState.length > 0) { if (dataState && dataState.length > 0) {
let obj: any = {} let obj: any = {}
console.log('dataState', dataState); // 下面的环节
let nextList: any = []
dataState.forEach((item: any) => { dataState.forEach((item: any) => {
if (item.APPROVALROUTE_STATE === 2000) { if (item.APPROVALROUTE_STATE === 2000) {
obj = item obj = item
} }
if (item.APPROVALROUTE_STATE >= currentRow?.BusinessProcess_State) {
if (item.APPROVALROUTE_STATE === currentRow?.BusinessProcess_State) {
item.status = "process"
}
nextList.push(item)
}
}) })
setNextStepsList(nextList)
let personTotal: number = obj.APPROVALSTAFF_ID.split(',').length || 0 let personTotal: number = obj.APPROVALSTAFF_ID.split(',').length || 0
if (personTotal > 0) { if (personTotal > 0) {
let STAFFIDList: number[] = obj.APPROVALSTAFF_ID.split(',') let STAFFIDList: number[] = obj.APPROVALSTAFF_ID.split(',')
@ -807,36 +1060,276 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
} }
} }
}} }}
disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)}
/> />
</Col> </Col>
</Row> </Row>
<ProTable
search={false}
options={false}
pagination={false}
columns={modalColumns}
dataSource={shopData}
bordered
scroll={{ x: "100%", y: "500px" }}
toolbar={{
actions: [
<Button type={"primary"} onClick={() => {
// 判断服务区是否已选择
const values = modalFormRef.current?.getFieldsValue();
if (!values?.ServerpartId) {
message.error("请先选择服务区!");
return;
}
setShowAddShopModal(true);
}}>
</Button>
]
}}
/>
</ProForm> </ProForm>
{
currentRow?.BusinessProcess_State > 1000 ?
<ProForm
// layout={'horizontal'}
formRef={modalApproveFormRef}
submitter={false}
preserve={false}
request={async () => {
const reqState: any = {
SearchParameter: {
APPROVALROUTE_STATES: "",
APPROVALROUTE_VALID: 1,
OPERATION_TYPES: "100200",
},
PageIndex: 1,
PageSize: 999999
}
const dataState = await handleGetAPPROVALROUTEList(reqState)
console.log('dataStatedataStatedataState', dataState);
let obj: any = {}
let currentIndex: number = 0
if (dataState && dataState.length > 0) {
dataState.forEach((item: any, index: number) => {
if (item.APPROVALROUTE_STATE === currentRow.BusinessProcess_State) {
obj = item
currentIndex = index
}
})
}
if (obj) {
// 审批的时候 拿到当前状态 去找下一个状态
if (ApprovalType === 1) {
// 拿到当前状态的信息 判断下一状态 是不是结束了 结束了 就不显示 下一结算审批人 不是结束 就拿到下一流程的审批人
setNextApproval(obj.NEXT_STATE)
let nextObj: any = currentIndex + 1 <= dataState.length ? dataState[currentIndex + 1] : {}
if (nextObj) {
let personTotal: number = nextObj.APPROVALSTAFF_ID.split(',').length || 0
if (personTotal > 0) {
let STAFFIDList: number[] = nextObj.APPROVALSTAFF_ID.split(',')
let STAFFNAMEList: string[] = nextObj.APPROVALSTAFF_NAME.split(',')
let list: any = []
for (let i = 0; i < personTotal; i++) {
list.push({ label: STAFFNAMEList[i], value: STAFFIDList[i] })
}
setNextApprovalPerson(list)
}
}
} else {
// 驳回的话 去找历史状态
if (dataState && dataState.length > 0) {
let list: any = []
dataState.forEach((item: any, index: number) => {
if (obj.APPROVALROUTE_STATE > item.APPROVALROUTE_STATE) {
list.push({ label: item.APPROVALROUTE_NAME, value: item.APPROVALROUTE_STATE })
}
})
setNextApprovalPerson(list)
}
}
}
return {}
}}
onFinish={async (res) => {
setAddApprovalLoading(true)
let data: any = {}
if (ApprovalType === 1) {
// 审批
const req: any = {
businessApprovalId: currentRow?.BusinessApproval_ID,
UserId: currentUser?.ID,
ApproveInfo: res.ApproveInfo,
nextApproveStaffId: res.nextApproveStaffId || "",
nextApproveState: nextApproval || ""
}
data = await handleApproveCommodityProInst(req)
} else {
// 驳回
const req: any = {
businessApprovalId: currentRow?.BusinessApproval_ID,
UserId: currentUser?.ID,
RejectInfo: res.ApproveInfo,
nextApproveState: res.nextApproveState || ""
}
console.log('reqreqreqreq', req);
data = await handleRejectCommodityProInst(req)
}
setAddApprovalLoading(false)
console.log('datadatadata', data);
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
setShowApplyFor(false)
setCurrentRow(undefined)
setSelectRowList([])
setSelectedOrderRowKeys([])
setShopData([])
setShowDetailType(null)
setApproveCurrentRow(undefined)
setApproveModal(false)
setNextApproval(null)
setNextApprovalPerson(null)
setApprovaType(0)
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}}
>
{
ApprovalType === 1 ?
<Row>
{
nextApproval === 9000 ? '' :
<Col span={6}>
<ProFormSelect
label={"下一阶段审批人"}
name={"nextApproveStaffId"}
options={nextApprovalPerson}
rules={[
{
required: true,
message: "请选择下一阶段审批人!"
}
]}
/>
</Col>
}
<Col span={24}>
<ProFormTextArea
label={"审批意见"}
name={"ApproveInfo"}
rules={[
{
required: true,
message: "请输入审批意见!"
}
]}
/>
</Col>
</Row> : ApprovalType === 2 ?
<Row>
<Col span={6}>
<ProFormSelect
label={"驳回状态"}
name={"nextApproveState"}
options={nextApprovalPerson}
rules={[
{
required: true,
message: "请选择下一阶段审批人!"
}
]}
/>
</Col>
<Col span={24}>
<ProFormTextArea
label={"驳回意见"}
name={"ApproveInfo"}
rules={[
{
required: true,
message: "请输入驳回意见!"
}
]}
/>
</Col>
</Row> : ""
}
</ProForm>
: ""
}
<ProTable
search={false}
options={false}
pagination={false}
columns={modalColumns}
dataSource={shopData}
bordered
scroll={{ x: "100%", y: "500px" }}
toolbar={{
actions: [
currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : <Button type={"primary"} onClick={() => {
// 判断服务区是否已选择
const values = modalFormRef.current?.getFieldsValue();
if (!values?.ServerpartId) {
message.error("请先选择服务区!");
return;
}
setShowAddShopModal(true);
}}>
</Button>
]
}}
/>
{
currentRow?.BusinessProcess_State > 1000 ?
<Card title="流程进度" bordered className="ProcessProgress">
<div style={{ width: '100%' }} className="ProcessProgressBox">
<Steps
size="small"
className="multi-line-steps"
direction="horizontal"
progressDot={false}
current={BUSINESSAPPROVALDETAIL?.approveList && BUSINESSAPPROVALDETAIL?.approveList.length ? BUSINESSAPPROVALDETAIL?.approveList.length : 0}
>
{/* <Step
style={{ minWidth: 180, maxWidth: 220 }}
status={currentRow?.BusinessProcess_State > 1000 ? 'finish' : 'wait'}
title="发起申请"
description={
<div>
<Tooltip title={`${currentRow?.Staff_Name || ''}${currentRow?.BusinessProcess_Desc ? `${currentRow?.BusinessProcess_Desc}` : ''}`}>
<p>{`${currentRow?.BusinessProcess_StartDate || ''}`}</p>
</Tooltip>
</div>
}
/> */}
{
BUSINESSAPPROVALDETAIL?.approveList && BUSINESSAPPROVALDETAIL?.approveList.length > 0 ?
BUSINESSAPPROVALDETAIL?.approveList.map((item: any, index: number) => (
<Step
key={index}
style={{ minWidth: 180, maxWidth: 220 }}
status={"finish"}
title={item.APPROVED_NAME}
description={
<div>
<Tooltip title={`${item.STAFF_NAME || ''}${item.APPLYAPPROVE_INFO ? `${item.APPLYAPPROVE_INFO}` : ''}`}>
<p>{`${item.APPLYAPPROVE_DATE || ''}`}</p>
</Tooltip>
</div>}
/>
)) : ''
}
{
nextStepsList && nextStepsList.length > 0 ?
nextStepsList.map((item: any, index: number) => (
<Step
key={index}
style={{ minWidth: 180, maxWidth: 220 }}
status={item.status === 'process' ? 'process' : 'wait'}
title={item.APPROVALROUTE_NAME}
/>
)) : ''
}
</Steps>
</div>
</Card>
: ''
}
</Modal> </Modal>

View File

@ -0,0 +1,16 @@
.addProductModal {
.ant-modal-content {
.ant-modal-body {
.ProcessProgress {
.ant-card-body {
.ProcessProgressBox {
.multi-line-steps {
flex-wrap: wrap !important;
display: flex !important;
}
}
}
}
}
}
}

View File

@ -19,13 +19,12 @@ import type { ConnectState } from '@/models/connect';
import type { ActionType, ProColumns } from '@ant-design/pro-table'; import type { ActionType, ProColumns } from '@ant-design/pro-table';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { FormInstance } from 'antd'; import type { FormInstance } from 'antd';
import type { COMMODITYModel } from './data';
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
import { getList, delcommodity, updatecommodity } from './service'; // 接口相关对象的引用 import { getList, delcommodity, updatecommodity } from './service'; // 接口相关对象的引用
import PageTitleBox from "@/components/PageTitleBox"; import PageTitleBox from "@/components/PageTitleBox";
import LeftSelectMallType from './component/LeftSelectMallType'; import LeftSelectMallType from './component/LeftSelectMallType';
import { handeDeleteCOMMODITY, handeGetCOMMODITY_MULTIList, handeGetCOMMODITYDetail, handeGetCOMMODITYList, handeSynchroCOMMODITY, handleGetBRANDList } from '../service'; import { handeDeleteCOMMODITY, handeGetCOMMODITY_MULTIList, handeGetCOMMODITYDetail, handeGetCOMMODITYList, handeGetMERCHANTSList, handeGetRTCOMMODITY_MULTIList, handeSynchroCOMMODITY, handleGetBRANDList, handlGetUSERDEFINEDTYPEList } from '../service';
import session from '@/utils/session'; import session from '@/utils/session';
@ -33,7 +32,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
const { currentUser } = props const { currentUser } = props
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>(); const formRef = useRef<FormInstance>();
const [currentRow, setCurrentRow] = useState<COMMODITYModel>(); const [currentRow, setCurrentRow] = useState<any>();
const [showDetail, setShowDetail] = useState<boolean>(); const [showDetail, setShowDetail] = useState<boolean>();
const [modalVisible, handleModalVisible] = useState<boolean>(); const [modalVisible, handleModalVisible] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交 const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
@ -56,16 +55,21 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
const COMMODITYGRADEList = session.get('COMMODITYGRADEList') const COMMODITYGRADEList = session.get('COMMODITYGRADEList')
// 在proform里面的品牌查询列表 // 在proform里面的品牌查询列表
const [BRAND_NAMEList, setBRAND_NAMEList] = useState<any>() const [BRAND_NAMEList, setBRAND_NAMEList] = useState<any>()
// 供货商户数据
const [COMMODITYSUPPLIERLIST, setCOMMODITYSUPPLIERLIST] = useState<any>()
// 拿到左侧树的数据 // 拿到左侧树的数据
const [leftTreeData, setLeftTreeData] = useState<any>() const [leftTreeData, setLeftTreeData] = useState<any>()
// 多规格 // 多规格
const [showMoreSpecs, setShowMoreSpecs] = useState<boolean>(false) const [showMoreSpecs, setShowMoreSpecs] = useState<boolean>(false)
// 新增规格的 悬浮框 // 新增规格的 悬浮框
const [showAddSpecsModal, setShowAddSpecsModal] = useState<boolean>(false) const [showAddSpecsModal, setShowAddSpecsModal] = useState<boolean>(false)
// 树相关的属性和方法 // 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string>() const [selectedId, setSelectedId] = useState<string>()
// 选择的规格内容
const [selectedRowKeys, setSelectedRowKeys] = useState<any>()
const [selectedRows, setSelectedRows] = useState<any>()
const onDraggaleStart = (event, uiData) => { const onDraggaleStart = (event, uiData) => {
const { clientWidth, clientHeight } = window.document.documentElement; const { clientWidth, clientHeight } = window.document.documentElement;
@ -302,21 +306,21 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
valueType: 'index', valueType: 'index',
}, },
{ {
dataIndex: '', dataIndex: 'USERDEFINEDTYPE_NAME',
title: '规格分类', title: '规格分类',
align: 'center', align: 'center',
width: 150, width: 150,
ellipsis: true, ellipsis: true,
}, },
{ {
dataIndex: '', dataIndex: 'COMMODITY_NAME',
title: '规格名称', title: '规格名称',
align: 'center', align: 'center',
width: 200, width: 200,
ellipsis: true, ellipsis: true,
}, },
{ {
dataIndex: '', dataIndex: 'supplier',
title: '供应商', title: '供应商',
align: 'center', align: 'center',
width: 200, width: 200,
@ -341,24 +345,40 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
req = { req = {
...currentRow, ...currentRow,
...res, ...res,
BRAND_ID: res.BRAND_ID.split('-')[1],
BRAND_NAME: res.BRAND_ID.split('-')[0],
MERCHANTS_ID: res.MERCHANTS_ID.split('-')[1],
MERCHANTS_NAME: res.MERCHANTS_ID.split('-')[0],
OWNERUNIT_ID: currentUser?.OwnerUnitId, OWNERUNIT_ID: currentUser?.OwnerUnitId,
OWNERUNIT_NAME: currentUser?.OwnerUnitName, OWNERUNIT_NAME: currentUser?.OwnerUnitName,
PROVINCE_CODE: currentUser?.ProvinceCode, PROVINCE_CODE: currentUser?.ProvinceCode,
OPERATE_PERSON: currentUser?.ID, OPERATE_PERSON: currentUser?.ID,
COMMODITY_TYPE: 4000, COMMODITY_TYPE: 4000,
COMMODITY_STATE: 1,
OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'),
UPPER_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[0]).format('YYYY-MM-DD HH:mm:ss') : "",
OFF_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[1]).format('YYYY-MM-DD HH:mm:ss') : "",
} }
} else { } else {
req = { req = {
...res, ...res,
BRAND_ID: res.BRAND_ID.split('-')[1],
BRAND_NAME: res.BRAND_ID.split('-')[0],
MERCHANTS_ID: res.MERCHANTS_ID.split('-')[1],
MERCHANTS_NAME: res.MERCHANTS_ID.split('-')[0],
OWNERUNIT_ID: currentUser?.OwnerUnitId, OWNERUNIT_ID: currentUser?.OwnerUnitId,
OWNERUNIT_NAME: currentUser?.OwnerUnitName, OWNERUNIT_NAME: currentUser?.OwnerUnitName,
PROVINCE_CODE: currentUser?.ProvinceCode, PROVINCE_CODE: currentUser?.ProvinceCode,
OPERATE_PERSON: currentUser?.ID, OPERATE_PERSON: currentUser?.ID,
COMMODITY_TYPE: 4000, COMMODITY_TYPE: 4000,
COMMODITY_STATE: 1,
OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'),
UPPER_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[0]).format('YYYY-MM-DD HH:mm:ss') : "",
OFF_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[1]).format('YYYY-MM-DD HH:mm:ss') : "",
} }
} }
console.log('reqreqreqreq', req);
const data = await handeSynchroCOMMODITY(req) const data = await handeSynchroCOMMODITY(req)
handleConfirmLoading(false) handleConfirmLoading(false)
if (data.Result_Code === 100) { if (data.Result_Code === 100) {
@ -372,6 +392,31 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
} }
}; };
// 拿到类别列表里面得规格
const collectItemsWithCommodityMultiId = (data: any, result = []) => {
// 检查输入是否为数组
if (!Array.isArray(data)) {
return result;
}
// 遍历数组中的每一项
for (const item of data) {
// 检查是否是对象且包含 COMMODITY_MULTI_ID 属性
if (typeof item === 'object' && item !== null && 'COMMODITY_MULTI_ID' in item && item.COMMODITY_MULTI_ID) {
result.push(item);
}
// 递归检查所有可能包含子数组的属性
for (const key in item) {
if (Array.isArray(item[key])) {
collectItemsWithCommodityMultiId(item[key], result);
}
}
}
return result;
}
return ( return (
<div> <div>
<div style={{ backgroundColor: '#fff', display: 'flex' }}> <div style={{ backgroundColor: '#fff', display: 'flex' }}>
@ -383,7 +428,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
paddingRight: 0 paddingRight: 0
}}> }}>
{/* 最外层的列表 */} {/* 最外层的列表 */}
<ProTable<COMMODITYModel> <ProTable
scroll={{ x: "100%", y: 'calc(100vh - 370px)' }} scroll={{ x: "100%", y: 'calc(100vh - 370px)' }}
rowKey={(record) => { rowKey={(record) => {
return `${record?.COMMODITY_ID}` return `${record?.COMMODITY_ID}`
@ -405,7 +450,8 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
USERDEFINEDTYPE_IDS: selectedId, USERDEFINEDTYPE_IDS: selectedId,
UPPER_STATE: params?.UPPER_STATE, UPPER_STATE: params?.UPPER_STATE,
DUTY_PARAGRAPH: params?.DUTY_PARAGRAPH === "-1" ? "" : params?.DUTY_PARAGRAPH, DUTY_PARAGRAPH: params?.DUTY_PARAGRAPH === "-1" ? "" : params?.DUTY_PARAGRAPH,
COMMODITY_TYPE: 4000 COMMODITY_TYPE: 4000,
COMMODITY_STATE: 1,
}, },
PageIndex: 1, PageIndex: 1,
PageSize: 999999, PageSize: 999999,
@ -454,27 +500,28 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
</div> </div>
{/* 添加商品的悬浮框 */} {/* 添加商品的悬浮框 */}
<Modal <Modal
title={ title={currentRow ? '更新商品管理' : '新建商品管理'}
<div // title={
style={{ // <div
width: '100%', // style={{
cursor: 'move', // width: '100%',
}} // cursor: 'move',
onMouseOver={() => { // }}
if (disabled) { // onMouseOver={() => {
setDraggleDisabled(false) // if (disabled) {
} // setDraggleDisabled(false)
}} // }
onMouseOut={() => { // }}
setDraggleDisabled(true) // onMouseOut={() => {
}} // setDraggleDisabled(true)
// }}
onFocus={() => { }} // onFocus={() => { }}
onBlur={() => { }} // onBlur={() => { }}
> // >
{currentRow ? '更新商品管理' : '新建商品管理'} // {currentRow ? '更新商品管理' : '新建商品管理'}
</div> // </div>
} // }
destroyOnClose={true} destroyOnClose={true}
width={'70%'} width={'70%'}
visible={modalVisible} visible={modalVisible}
@ -486,7 +533,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
onCancel={() => { onCancel={() => {
handleConfirmLoading(false) handleConfirmLoading(false)
handleModalVisible(false) handleModalVisible(false)
setBRAND_NAMEList([]) // setBRAND_NAMEList([])
}} }}
footer={<div style={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}> footer={<div style={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
@ -506,7 +553,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
handleModalVisible(false) handleModalVisible(false)
setBRAND_NAMEList([]) setBRAND_NAMEList([])
}}> </Button> }}> </Button>
<Button type={"primary"} onClick={() => { <Button type={"primary"} loading={confirmLoading} onClick={() => {
formRef?.current?.validateFields().then(() => { formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true) handleConfirmLoading(true)
formRef?.current?.submit() formRef?.current?.submit()
@ -520,15 +567,15 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
formRef?.current?.submit() formRef?.current?.submit()
}) })
}} }}
modalRender={(modal) => { // modalRender={(modal) => {
return <Draggable // return <Draggable
disabled={disabled} // disabled={disabled}
bounds={bounds} // bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)} // onStart={(event, uiData) => onDraggaleStart(event, uiData)}
> // >
<div ref={draggleRef}>{modal}</div> // <div ref={draggleRef}>{modal}</div>
</Draggable> // </Draggable>
}} // }}
> >
<ProForm <ProForm
layout={'horizontal'} layout={'horizontal'}
@ -536,23 +583,20 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
autoFocusFirstInput autoFocusFirstInput
submitter={false} submitter={false}
preserve={false} preserve={false}
initialValues={currentRow} initialValues={currentRow ? currentRow : {
OPERATE_PERSON: currentUser?.Name,
UPPER_STATE: currentUser?.SupplierID ? 0 : ""
}}
onFinish={async (values) => { onFinish={async (values) => {
let newValue: COMMODITYModel = { ...values }; let newValue: any = { ...values };
if (currentRow) { if (currentRow) {
// 编辑数据 // 编辑数据
newValue = { ...values, COMMODITY_ID: currentRow.COMMODITY_ID }; newValue = { ...values, COMMODITY_ID: currentRow.COMMODITY_ID };
} }
// 如果有开关,要把开关的代码写进去 // 如果有开关,要把开关的代码写进去
const success = await handleAddUpdate(newValue as COMMODITYModel); await handleAddUpdate(newValue);
handleConfirmLoading(false) handleModalVisible(false);
if (success) {
if (actionRef.current) {
actionRef.current.reload();
}
handleModalVisible(false);
}
}} }}
> >
<Row gutter={8}> <Row gutter={8}>
@ -587,6 +631,8 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
name="BRAND_ID" name="BRAND_ID"
label="商品品牌" label="商品品牌"
request={async () => { request={async () => {
console.log('BRAND_NAMEListBRAND_NAMEListBRAND_NAMEList', BRAND_NAMEList);
if (BRAND_NAMEList && BRAND_NAMEList.length > 0) { if (BRAND_NAMEList && BRAND_NAMEList.length > 0) {
return BRAND_NAMEList return BRAND_NAMEList
} else { } else {
@ -602,20 +648,23 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
SortStr: "BRAND_INDEX,OPERATE_DATE" SortStr: "BRAND_INDEX,OPERATE_DATE"
} }
const data = await handleGetBRANDList(req) const data = await handleGetBRANDList(req)
console.log('datadatadatadatadata', data);
if (data.List && data.List.length > 0) { if (data.List && data.List.length > 0) {
setBRAND_NAMEList(data.List) let list: any = []
return data.List data.List.forEach((item: any) => {
list.push({ label: item.BRAND_NAME, value: `${item.BRAND_NAME}-${item.BRAND_ID}` })
})
setBRAND_NAMEList(list)
return list
} }
setBRAND_NAMEList([])
return [] return []
} }
}} }}
fieldProps={{ fieldProps={{
fieldNames: { // fieldNames: {
label: 'BRAND_NAME', // label: 'BRAND_NAME',
value: 'BRAND_ID' // value: 'BRAND_ID'
}, // },
showSearch: true, showSearch: true,
filterOption: (input, node) => filterOption: (input, node) =>
(node.BRAND_NAME || '').toLowerCase().includes(input.toLowerCase()) (node.BRAND_NAME || '').toLowerCase().includes(input.toLowerCase())
@ -630,7 +679,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
</Col> </Col>
<Col span={12}> <Col span={12}>
<ProFormTreeSelect <ProFormTreeSelect
name="USERDEFINEDTYPE_IDS" name="USERDEFINEDTYPE_ID"
label="商品分类" label="商品分类"
request={async () => { request={async () => {
return leftTreeData return leftTreeData
@ -648,15 +697,52 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
/> />
</Col> </Col>
<Col span={12}> <Col span={12}>
<ProFormSelect <ProFormTreeSelect
name="COMMODITY_SUPPLIER" name="MERCHANTS_ID"
label="供货商户" label="供货商户"
request={async () => {
if (COMMODITYSUPPLIERLIST && COMMODITYSUPPLIERLIST.length > 0) {
return COMMODITYSUPPLIERLIST
} else {
const req = {
searchParameter: {
OWNERUNIT_ID: currentUser?.OwnerUnitId,
PROVINCE_CODE: currentUser?.ProvinceCode,
MERCHANTS_TYPE: ""
},
PageIndex: 1,
PageSize: 999999,
}
const data = await handeGetMERCHANTSList(req);
console.log('datadatadatadatadata', data);
if (data.List && data.List.length > 0) {
let list: any = []
data.List.forEach((item: any) => {
list.push({ label: item.MERCHANTS_NAME, value: `${item.MERCHANTS_NAME}-${item.MERCHANTS_ID}` })
})
setCOMMODITYSUPPLIERLIST(list)
return list
}
setCOMMODITYSUPPLIERLIST([])
return []
}
}}
fieldProps={{
// fieldNames: {
// label: 'MERCHANTS_NAME',
// value: 'MERCHANTS_ID'
// },
showSearch: true,
filterTreeNode: (input, node) =>
(node.MERCHANTS_NAME || '').toLowerCase().includes(input.toLowerCase())
}}
rules={[ rules={[
{ {
required: true, required: true,
message: "请选择供货商户" message: "请选择供货商户"
} }
]} ]}
/> />
</Col> </Col>
<Divider orientation="left"></Divider> <Divider orientation="left"></Divider>
@ -798,7 +884,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
/> />
</Col> </Col>
<Col span={6}> <Col span={6}>
<ProFormMoney <ProFormDigit
name="COMMODITY_POINT" name="COMMODITY_POINT"
label="兑换积分" label="兑换积分"
/> />
@ -812,7 +898,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
/> />
</Col> </Col>
<Col span={6}> <Col span={6}>
<ProFormSelect <ProFormText
name="DELIVER_AREA" name="DELIVER_AREA"
label="配送区域" label="配送区域"
/> />
@ -833,8 +919,13 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
<Divider orientation="left"></Divider> <Divider orientation="left"></Divider>
<Col span={12}> <Col span={12}>
<ProFormDateRangePicker <ProFormDateRangePicker
width={'lg'}
name="UPPER_DATE" name="UPPER_DATE"
label="上架时间" label="上架时间"
rules={[{
required: true,
message: "请选择上架时间!"
}]}
/> />
</Col> </Col>
<Col span={6}> <Col span={6}>
@ -879,6 +970,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
{ label: "未上架", value: 0 }, { label: "未上架", value: 0 },
{ label: "已上架", value: 1 }, { label: "已上架", value: 1 },
]} ]}
disabled={currentUser?.SupplierID ? true : false}
/> />
</Col> </Col>
<Col span={6}> <Col span={6}>
@ -888,6 +980,13 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
options={[ options={[
{ label: "正式数据", value: 1 }, { label: "正式数据", value: 1 },
{ label: "测试数据", value: 0 }, { label: "测试数据", value: 0 },
{ label: "品诺数据", value: 2 },
]}
rules={[
{
required: true,
message: "请选择数据形式!"
}
]} ]}
/> />
</Col> </Col>
@ -895,6 +994,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
<ProFormText <ProFormText
name="OPERATE_PERSON" name="OPERATE_PERSON"
label="操作人员" label="操作人员"
disabled
/> />
</Col> </Col>
</Row> </Row>
@ -939,6 +1039,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
const data = await handeGetCOMMODITY_MULTIList(req) const data = await handeGetCOMMODITY_MULTIList(req)
console.log('多规格管理', data); console.log('多规格管理', data);
return selectedRows
}} }}
/> />
@ -954,7 +1055,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
setShowAddSpecsModal(false) setShowAddSpecsModal(false)
}} }}
onOk={async () => { // 提交框内的数据 onOk={async () => { // 提交框内的数据
setShowAddSpecsModal(false)
}} }}
> >
<ProTable <ProTable
@ -962,18 +1063,38 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
pagination={false} pagination={false}
options={false} options={false}
columns={addSpecsCoumns} columns={addSpecsCoumns}
scroll={{ x: "100%" }} scroll={{ x: "100%", y: '400px' }}
rowKey={"COMMODITY_MULTI_ID"}
rowSelection={{ rowSelection={{
type: 'checkbox', // 多选,单选用 'radio' type: 'checkbox', // 多选,单选用 'radio'
onChange: (selectedRowKeys, selectedRows) => { onChange: (selectedRowKeys, selectedRows) => {
console.log(selectedRowKeys, selectedRows); setSelectedRowKeys(selectedRowKeys)
setSelectedRows(selectedRows)
}, },
}} }}
request={async () => {
const req = {
searchParameter: {
OWNERUNIT_ID: currentUser?.OwnerUnitId,
PROVINCE_CODE: "",
GOODSTYPE: 6000,
USERDEFINEDTYPE_STATE: 1
},
PageIndex: 1,
PageSize: 999999,
}
const data = await handeGetCOMMODITY_MULTIList(req);
console.log('datadatadatadata', data);
let list = data.List
if (list && list.length > 0) {
return { data: list, success: true }
}
return { data: [], success: true }
}}
/> />
</Modal> </Modal>
</div> </div>
</div> </div>
); );

View File

@ -9,7 +9,7 @@ import Draggable from 'react-draggable';
import SubMenu from "antd/lib/menu/SubMenu"; import SubMenu from "antd/lib/menu/SubMenu";
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions'; import ProDescriptions from '@ant-design/pro-descriptions';
import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from '@ant-design/pro-form'; import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form';
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout'; import { PageContainer } from '@ant-design/pro-layout';
import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd'; import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd';
@ -22,6 +22,8 @@ import type { FormInstance } from 'antd';
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
import PageTitleBox from "@/components/PageTitleBox"; import PageTitleBox from "@/components/PageTitleBox";
import { handeDeleteCOMMODITY_MULTI, handeSynchroCOMMODITY_MULTI, handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service';
import { render } from 'react-dom';
const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
@ -38,6 +40,10 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动 const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const draggleRef = React.createRef<any>() const draggleRef = React.createRef<any>()
// 添加处理的类型 1 为类别 2 为 规格
const [dataType, setDataType] = useState<number>(0)
// 表格数据
const [tableData, setTableData] = useState<any>()
const onDraggaleStart = (event, uiData) => { const onDraggaleStart = (event, uiData) => {
const { clientWidth, clientHeight } = window.document.documentElement; const { clientWidth, clientHeight } = window.document.documentElement;
@ -55,59 +61,100 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
// 定义列表字段内容 // 定义列表字段内容
const columns: any = [ const columns: any = [
{
dataIndex: 'PROVINCE_CODE',
title: '省份编码',
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'COMMODITY_NAME',
title: '商品名称',
align: 'center',
hideInSearch: true,
},
{ {
dataIndex: 'USERDEFINEDTYPE_NAME', dataIndex: 'USERDEFINEDTYPE_NAME',
title: '类别名称', title: '类别名称',
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
width: 200,
ellipsis: true,
render: (_, record) => {
return record?.COMMODITY_NAME || record?.USERDEFINEDTYPE_NAME || "-"
}
}, },
{ {
dataIndex: 'COMMODITY_STATE', dataIndex: 'USERDEFINEDTYPE_INDEX',
title: '商品状态', title: '类别索引',
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
width: 150,
ellipsis: true,
},
{
dataIndex: 'USERDEFINEDTYPE_STATE',
title: '有效状态',
align: 'center',
width: 150,
ellipsis: true,
valueEnum: {
"1": "有效",
"0": "无效"
},
initialValue: "1",
render: (_, record) => {
return record?.COMMODITY_STATE === 1 || record?.USERDEFINEDTYPE_STATE === 1 ? '有效' : '无效'
}
},
{
dataIndex: 'USERDEFINEDTYPE_DATE',
title: '添加时间',
width: 200,
ellipsis: true,
align: 'center',
hideInSearch: true,
render: (_, record) => {
return record?.USERDEFINEDTYPE_DATE ? moment(record?.USERDEFINEDTYPE_DATE).format('YYYY-MM-DD HH:mm:ss') : "-"
}
}, },
{ {
dataIndex: 'OPERATE_DATE', dataIndex: 'OPERATE_DATE',
title: '操作时间', title: '操作时间',
valueType: 'fromNow', width: 200,
align: 'center', align: 'center',
ellipsis: true,
hideInSearch: true, hideInSearch: true,
render: (_, record) => {
return record?.OPERATE_DATE ? moment(record?.OPERATE_DATE).format('YYYY-MM-DD HH:mm:ss') : "-"
}
}, },
{ {
dataIndex: 'COMMODITY_DESC', dataIndex: 'USERDEFINEDTYPE_DESC',
title: '备注说明', title: '备注说明',
width: 250,
align: 'center', align: 'center',
ellipsis: true,
hideInSearch: true, hideInSearch: true,
render: (_, record) => {
return record?.COMMODITY_DESC || record?.USERDEFINEDTYPE_DESC
}
}, },
{ {
dataIndex: 'STAFF_NAME', dataIndex: 'STAFF_NAME',
title: '操作员名称', title: '操作员名称',
width: 150,
align: 'center', align: 'center',
ellipsis: true,
hideInSearch: true, hideInSearch: true,
}, },
{ {
dataIndex: 'option', dataIndex: 'option',
title: '操作', title: '操作',
width: 150,
valueType: 'option', valueType: 'option',
align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record) => { render: (_, record) => {
return ( return (
<Space> <Space>
<a <a
onClick={() => { onClick={() => {
if (record?.COMMODITY_MULTI_ID) {
setDataType(2)
} else {
setDataType(1)
}
console.log('recordrecord', record);
setCurrentRow({ ...record }); setCurrentRow({ ...record });
handleModalVisible(true); handleModalVisible(true);
}} }}
@ -117,7 +164,11 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
<Popconfirm <Popconfirm
title="确认删除该商品多规格列表信息吗?" title="确认删除该商品多规格列表信息吗?"
onConfirm={async () => { onConfirm={async () => {
await handelDelete(record.COMMODITY_MULTI_ID); if (record?.COMMODITY_MULTI_ID) {
await handelDeleteSpecifications(record.COMMODITY_MULTI_ID);
} else {
await handelDelete(record.USERDEFINEDTYPE_ID);
}
}} }}
> >
<a></a> <a></a>
@ -128,53 +179,161 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
}, },
]; ];
// const handelDelete = async (commodity_multiid: number) => {
// const result = await delcommodity_multi({ commodity_multiid: commodity_multiid });
// if (result.Result_Code !== 100) { // 删除类别
// message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); const handelDelete = async (id: number) => {
// } else { const result = await handlDeleteUSERDEFINEDTYPE({ USERDEFINEDTYPEId: id });
// message.success('删除成功!');
// actionRef.current?.reload()
// }
// };
// const handleAddUpdate = async (fields: COMMODITY_MULTIModel) => { if (result.Result_Code !== 100) {
// const hide = message.loading('正在提交...'); message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
} else {
message.success('删除成功!');
actionRef.current?.reload()
}
};
// 删除规格
const handelDeleteSpecifications = async (id: any) => {
const result = await handeDeleteCOMMODITY_MULTI({ COMMODITY_MULTIId: id });
// const result = await updatecommodity_multi(fields); if (result.Result_Code !== 100) {
// hide(); message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
// if (result.Result_Code !== 100) { } else {
// message.error(`${result.Result_Desc}` || `${result.Result_Code}:提交失败`); message.success('删除成功!');
// return false; actionRef.current?.reload()
// } }
// return result.Result_Data ? result.Result_Data : true; }
// };
// 同步类别
const handleAddUpdate = async (res: any) => {
let req: any = {}
if (currentRow?.USERDEFINEDTYPE_ID) {
req = {
...currentRow,
...res,
GOODSTYPE: 6000,
OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'),
STAFF_ID: currentUser?.ID,
STAFF_NAME: currentUser?.Name
}
} else {
req = {
...res,
GOODSTYPE: 6000,
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
STAFF_ID: currentUser?.ID,
STAFF_NAME: currentUser?.Name,
USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
OWNERUNIT_ID: currentUser?.OwnerUnitId,
PROVINCE_CODE: currentUser?.ProvinceCode
}
}
console.log('reqreqreqreq', req);
const data = await handlSynchroUSERDEFINEDTYPE(req)
handleConfirmLoading(false)
if (data.Result_Code === 100) {
message.success("新增成功!")
setCurrentRow(undefined)
formRef?.current?.resetFields()
handleModalVisible(false)
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
};
const handleAddUpdateSpecifications = async (res: any) => {
console.log('res', res);
let req: any = {}
if (currentRow?.COMMODITY_MULTI_ID) {
req = {
...currentRow,
...res,
OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'),
STAFF_ID: currentUser?.ID,
STAFF_NAME: currentUser?.Name
}
} else {
req = {
...res,
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
STAFF_ID: currentUser?.ID,
STAFF_NAME: currentUser?.Name,
PROVINCE_CODE: currentUser?.ProvinceCode
}
}
console.log('reqreqreqreq', req);
const data = await handeSynchroCOMMODITY_MULTI(req)
handleConfirmLoading(false)
if (data.Result_Code === 100) {
message.success("新增成功!")
setCurrentRow(undefined)
formRef?.current?.resetFields()
handleModalVisible(false)
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}
// 递归处理表格数据
const transformMultiRuleToChildren = (data: any) => {
if (!Array.isArray(data)) {
return data;
}
return data.map(item => {
// 创建新对象,避免修改原对象
const newItem = { ...item };
// 如果存在 MultiRuleList则转换为 children
if (newItem.MultiRuleList) {
newItem.children = transformMultiRuleToChildren(newItem.MultiRuleList);
// 如果需要保留原 MultiRuleList 可以注释下面这行
// delete newItem.MultiRuleList;
}
// 递归处理其他可能的嵌套数组
Object.keys(newItem).forEach(key => {
if (Array.isArray(newItem[key]) && key !== 'children') {
newItem[key] = transformMultiRuleToChildren(newItem[key]);
}
});
return newItem;
});
}
return ( return (
<div> <div>
<div style={{ backgroundColor: '#fff', display: 'flex' }}> <div style={{ backgroundColor: '#fff', display: 'flex' }}>
<ProTable<COMMODITY_MULTIModel> <ProTable
style={{ height: 'calc(100vh - 135px)', background: '#fff' }} scroll={{ x: "100%", y: 'calc(100vh - 410px)' }}
scroll={{ y: 'calc(100vh - 410px)' }}
rowKey={(record) => { rowKey={(record) => {
return `${record?.COMMODITY_MULTI_ID}` return `${record?.USERDEFINEDTYPE_ID}-${record?.COMMODITY_MULTI_ID}`
}} }}
formRef={formRef} formRef={formRef}
headerTitle={<PageTitleBox props={props} />} // 列表表头 headerTitle={<PageTitleBox props={props} />} // 列表表头
actionRef={actionRef} actionRef={actionRef}
bordered
search={{ span: 6, labelWidth: 'auto' }} search={{ span: 6, labelWidth: 'auto' }}
pagination={false}
// 请求数据 // 请求数据
request={async (params, sorter) => { request={async (params, sorter) => {
const req = {
const searchWholeParams = { OWNERUNIT_ID: currentUser?.OwnerUnitId,
searchParameter: { ...params }, PROVINCE_CODE: "",
sortstr: sortstr.length ? sortstr.toString() : "", GOODSTYPE: 6000,
pagesize: 999999 USERDEFINEDTYPE_STATE: params?.USERDEFINEDTYPE_STATE
} }
setSearchParams(searchWholeParams) console.log('req', req);
const data = await getList(searchWholeParams);
return data; const data = await handlGetUSERDEFINEDTYPEList(req);
setTableData(data)
if (data && data.length > 0) {
let list: any = transformMultiRuleToChildren(data)
console.log('listlistlistlist', list);
return { data: list, success: true, total: data.length }
}
return { data: [], success: true }
}} }}
columns={columns} columns={columns}
toolbar={{ toolbar={{
@ -185,15 +344,27 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
icon={<PlusOutlined />} icon={<PlusOutlined />}
type="primary" type="primary"
onClick={() => { onClick={() => {
setDataType(1)
handleModalVisible(true); handleModalVisible(true);
}} }}
> >
</Button>,
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
setDataType(2)
handleModalVisible(true);
}}
>
</Button>, </Button>,
], ],
}} }}
/> />
<Modal <Modal
title={ title={
<div <div
@ -213,7 +384,7 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
onFocus={() => { }} onFocus={() => { }}
onBlur={() => { }} onBlur={() => { }}
> >
{currentRow ? '更新商品多规格' : '新建商品多规格'} {dataType === 1 ? currentRow ? '编辑商品类别' : '新建商品类别' : currentRow ? '编辑规格类型' : '新建规格类型'}
</div> </div>
} }
destroyOnClose={true} destroyOnClose={true}
@ -227,6 +398,7 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
onCancel={() => { onCancel={() => {
handleConfirmLoading(false) handleConfirmLoading(false)
handleModalVisible(false) handleModalVisible(false)
setDataType(0)
}} }}
onOk={async () => { // 提交框内的数据 onOk={async () => { // 提交框内的数据
@ -247,112 +419,190 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
> >
<ProForm <ProForm
layout={'horizontal'} layout={'horizontal'}
wrapperCol={{ span: 16 }} // 表单项 填写部分所占的栅格数
labelCol={{ span: 6 }} // 表单项 标题所占的栅格数
formRef={formRef} formRef={formRef}
autoFocusFirstInput autoFocusFirstInput
submitter={false} submitter={false}
preserve={false} preserve={false}
initialValues={currentRow} // initialValues={currentRow}
onFinish={async (values) => { request={async () => {
let newValue: COMMODITY_MULTIModel = { ...values }; return currentRow ? {
if (currentRow) { ...currentRow,
// 编辑数据 } : dataType === 1 ? {
newValue = { ...values, COMMODITY_MULTI_ID: currentRow.COMMODITY_MULTI_ID }; USERDEFINEDTYPE_STATE: 1
} } : {
// 如果有开关,要把开关的代码写进去 COMMODITY_STATE: 1
const success = await handleAddUpdate(newValue as COMMODITY_MULTIModel);
handleConfirmLoading(false)
if (success) {
if (actionRef.current) {
actionRef.current.reload();
}
handleModalVisible(false);
} }
}} }}
onFinish={async (values) => {
let newValue: any = { ...values };
if (currentRow) {
// 编辑数据
if (dataType === 1) {
// 同步类别
newValue = { ...values, USERDEFINEDTYPE_ID: currentRow?.USERDEFINEDTYPE_ID };
} else if (dataType === 2) {
// 同步规格
newValue = { ...values, COMMODITY_MULTI_ID: currentRow?.COMMODITY_MULTI_ID };
}
}
console.log('dataTypedataTypedataTypedataType', dataType);
if (dataType === 1) {
// 同步类别
await handleAddUpdate(newValue);
} else if (dataType === 2) {
// 同步规格
await handleAddUpdateSpecifications(newValue);
}
handleConfirmLoading(false)
}}
> >
<Row>
<Col span={12}> {
<ProFormMoney dataType === 1 ?
width="lg" // 新增编辑类别
fieldProps={{ <Row gutter={8}>
moneySymbol: false, <Col span={12}>
}} <ProFormTreeSelect
name="PROVINCE_CODE" label={"上级类别"}
label="省份编码" name={"USERDEFINEDTYPE_PID"}
/> rules={[
</Col> {
<Col span={12}> required: true,
<ProFormText message: "请选择上级类别!"
name="COMMODITY_NAME" }
label="商品名称" ]}
/> request={() => {
</Col> let list: any = JSON.parse(JSON.stringify(tableData))
<Col span={12}> list.unshift({ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: "-1" })
<ProFormText return list
name="USERDEFINEDTYPE_NAME" }}
label="类别名称" fieldProps={{
/> fieldNames: {
</Col> label: 'USERDEFINEDTYPE_NAME',
<Col span={12}> value: 'USERDEFINEDTYPE_ID',
<ProFormSelect children: 'MultiRuleList'
name="COMMODITY_STATE" },
label="商品状态" showSearch: true,
/> filterTreeNode: (input, node) =>
</Col> (node.USERDEFINEDTYPE_NAME || '').toLowerCase().includes(input.toLowerCase())
<Col span={12}> }}
<ProFormDatePicker />
name="OPERATE_DATE" </Col>
label="操作时间" <Col span={12}>
width="lg" <ProFormText
/> name="USERDEFINEDTYPE_NAME"
</Col> label="类别名称"
<Col span={24}> rules={[
<ProFormTextArea {
name="COMMODITY_DESC" required: true,
label="备注说明" message: "请输入类别名称!"
labelCol={{ span: 3 }} }
wrapperCol={{ span: 20 }} ]}
/> />
</Col> </Col>
<Col span={12}> <Col span={12}>
<ProFormText <ProFormDigit
name="STAFF_NAME" name="USERDEFINEDTYPE_INDEX"
label="操作员名称" label="类别索引"
/> />
</Col> </Col>
<Col style={{ display: 'none' }}> <Col span={12}>
<ProFormText <ProFormSelect
name="COMMODITY_MULTI_ID" name="USERDEFINEDTYPE_STATE"
label="多规格内码" label="有效状态"
/> options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]}
</Col> />
<Col style={{ display: 'none' }}> </Col>
<ProFormText <Col span={12}>
name="SERVERPART_ID" <ProFormText
label="服务区内码" name="STAFF_NAME"
/> label="操作员名称"
</Col> initialValue={currentUser?.Name}
<Col style={{ display: 'none' }}> disabled
<ProFormText />
name="SERVERPARTSHOP_ID" </Col>
label="门店内码" <Col span={24}>
/> <ProFormTextArea
</Col> name="USERDEFINEDTYPE_DESC"
<Col style={{ display: 'none' }}> label="备注说明"
<ProFormText />
name="USERDEFINEDTYPE_ID" </Col>
label="类别内码" </Row> :
/> // 新增编辑规格
</Col> <Row gutter={8}>
<Col style={{ display: 'none' }}> <Col span={12}>
<ProFormText <ProFormTreeSelect
name="STAFF_ID" label={"类别名称"}
label="操作员" name={"USERDEFINEDTYPE_ID"}
/> rules={[
</Col> {
</Row> required: true,
message: "请选择上级类别!"
}
]}
request={() => {
let list: any = JSON.parse(JSON.stringify(tableData))
list.unshift({ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: "-1" })
console.log('listlistlist', list);
return list
}}
fieldProps={{
fieldNames: {
label: 'USERDEFINEDTYPE_NAME',
value: 'USERDEFINEDTYPE_ID',
children: 'MultiRuleList'
},
showSearch: true,
filterTreeNode: (input, node) =>
(node.USERDEFINEDTYPE_NAME || '').toLowerCase().includes(input.toLowerCase()),
onChange: (value, label, extra) => {
// 设置label到表单
formRef.current?.setFieldsValue({
USERDEFINEDTYPE_NAME: label[0]
});
}
}}
/>
</Col>
<Col span={12} style={{ display: "none" }}>
<ProFormText
name="USERDEFINEDTYPE_NAME"
label="规格名称"
/>
</Col>
<Col span={12}>
<ProFormText
name="COMMODITY_NAME"
label="规格名称"
rules={[
{
required: true,
message: "请输入类别名称!"
}
]}
/>
</Col>
<Col span={12}>
<ProFormSelect
name="COMMODITY_STATE"
label="有效状态"
options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]}
/>
</Col>
<Col span={24}>
<ProFormTextArea
name="COMMODITY_DESC"
label="备注说明"
/>
</Col>
</Row>
}
</ProForm> </ProForm>
</Modal> </Modal>
</div> </div>

View File

@ -1,5 +1,4 @@
// 供应商分类 // 供应商分类
import React, { useRef, useState, Suspense } from 'react'; import React, { useRef, useState, Suspense } from 'react';
import moment from 'moment'; // 时间相关引用,没有使用可以删除 import moment from 'moment'; // 时间相关引用,没有使用可以删除
import numeral from "numeral"; // 数字相关引用,没有使用可以删除 import numeral from "numeral"; // 数字相关引用,没有使用可以删除
@ -22,7 +21,7 @@ import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { FormInstance } from 'antd'; import type { FormInstance } from 'antd';
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
import { handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service'; import { handlDeleteAUTOTYPE, handlDeleteUSERDEFINEDTYPE, handlGetNestingAUTOTYPEList, handlGetUSERDEFINEDTYPEList, handlSynchroAUTOTYPE, handlSynchroUSERDEFINEDTYPE } from '../service';
import PageTitleBox from '@/components/PageTitleBox'; import PageTitleBox from '@/components/PageTitleBox';
import { uploadPicture } from '@/services/picture'; import { uploadPicture } from '@/services/picture';
import defaultIcon from '../../../assets/brand/defaultIcon.png' import defaultIcon from '../../../assets/brand/defaultIcon.png'
@ -91,22 +90,16 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
// hideInDescriptions: true, // hideInDescriptions: true,
// }, // },
{ {
dataIndex: 'USERDEFINEDTYPE_NAME', dataIndex: 'AUTOTYPE_NAME',
title: '供应商名称', title: '供应商名称',
align: 'center', align: 'center',
width: 300, width: 300,
ellipsis: true, ellipsis: true,
hideInSearch: true, hideInSearch: true,
hideInDescriptions: true, hideInDescriptions: true,
render: (_, record) => {
return <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
<img style={{ width: '30px', height: '30px', marginRight: '5px', borderRadius: '50%' }} src={record?.USERDEFINEDTYPE_ICO || defaultIcon} />
<span style={{ width: '240px', display: "inline-block", whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', textAlign: 'left' }}>{record?.USERDEFINEDTYPE_NAME}</span>
</div>
}
}, },
{ {
dataIndex: '', dataIndex: 'AUTOTYPE_CODE',
title: '类别代码', title: '类别代码',
align: 'center', align: 'center',
width: 120, width: 120,
@ -114,7 +107,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
hideInSearch: true, hideInSearch: true,
}, },
{ {
dataIndex: 'USERDEFINEDTYPE_INDEX', dataIndex: 'AUTOTYPE_INDEX',
title: '类别索引', title: '类别索引',
align: 'center', align: 'center',
width: 120, width: 120,
@ -122,7 +115,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
hideInSearch: true, hideInSearch: true,
}, },
{ {
dataIndex: 'USERDEFINEDTYPE_STATE', dataIndex: 'AUTOTYPE_VALID',
title: '有效状态', title: '有效状态',
align: 'center', align: 'center',
width: 120, width: 120,
@ -166,14 +159,6 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
<Space> <Space>
<a <a
onClick={() => { onClick={() => {
console.log('recordrecordrecord', record);
if (record?.USERDEFINEDTYPE_ICO) {
setFileList([{
name: "",
url: record?.USERDEFINEDTYPE_ICO
}])
}
setCurrentRow({ ...record }); setCurrentRow({ ...record });
handleModalVisible(true); handleModalVisible(true);
}} }}
@ -183,7 +168,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
<Popconfirm <Popconfirm
title="确认删除该商品自定义类别列表信息吗?" title="确认删除该商品自定义类别列表信息吗?"
onConfirm={async () => { onConfirm={async () => {
handelDelete(record.USERDEFINEDTYPE_ID); handelDelete(record.AUTOTYPE_ID);
}} }}
> >
<a></a> <a></a>
@ -206,9 +191,9 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
// 删除商品类别 // 删除商品类别
const handelDelete = async (id: any) => { const handelDelete = async (id: any) => {
const req: any = { const req: any = {
USERDEFINEDTYPEId: id AUTOTYPEId: id
} }
const result = await handlDeleteUSERDEFINEDTYPE(req) const result = await handlDeleteAUTOTYPE(req)
if (result.Result_Code !== 100) { if (result.Result_Code !== 100) {
message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
} else { } else {
@ -220,15 +205,14 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
// 同步商品列表 // 同步商品列表
const handleAddUpdate = async (res: any) => { const handleAddUpdate = async (res: any) => {
let req: any = {} let req: any = {}
if (currentRow?.USERDEFINEDTYPE_ID) { if (currentRow?.AUTOTYPE_ID) {
req = { req = {
...currentRow, ...currentRow,
...res, ...res,
GOODSTYPE: 1000, AUTOTYPE_TYPEID: 4000,
USERDEFINEDTYPE_ICO: fileList && fileList.length > 0 ? fileList[0].url : "", // PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[0] : "",
PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[0] : "", // PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[1] : "",
PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[1] : "", // PROVINCE_CODE: currentUser?.ProvinceCode,
PROVINCE_CODE: currentUser?.ProvinceCode,
STAFF_ID: currentUser?.ID, STAFF_ID: currentUser?.ID,
STAFF_NAME: currentUser?.Name, STAFF_NAME: currentUser?.Name,
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
@ -236,18 +220,17 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
} else { } else {
req = { req = {
...res, ...res,
GOODSTYPE: 1000, AUTOTYPE_TYPEID: 4000,
USERDEFINEDTYPE_ICO: fileList && fileList.length > 0 ? fileList[0].url : "", // PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[0] : "",
PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[0] : "", // PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[1] : "",
PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[1] : "",
PROVINCE_CODE: currentUser?.ProvinceCode, PROVINCE_CODE: currentUser?.ProvinceCode,
STAFF_ID: currentUser?.ID, STAFF_ID: currentUser?.ID,
STAFF_NAME: currentUser?.Name, STAFF_NAME: currentUser?.Name,
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), // USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
} }
} }
const data = await handlSynchroUSERDEFINEDTYPE(req) const data = await handlSynchroAUTOTYPE(req)
handleConfirmLoading(false) handleConfirmLoading(false)
if (data.Result_Code === 100) { if (data.Result_Code === 100) {
message.success("新增成功!") message.success("新增成功!")
@ -271,7 +254,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
style={{ height: 'calc(100vh - 135px)', background: '#fff' }} style={{ height: 'calc(100vh - 135px)', background: '#fff' }}
scroll={{ y: 'calc(100vh - 410px)' }} scroll={{ y: 'calc(100vh - 410px)' }}
rowKey={(record) => { rowKey={(record) => {
return `${record?.USERDEFINEDTYPE_PID}-${record?.USERDEFINEDTYPE_ID}` return `${record?.USERDEFINEDTYPE_PID}-${record?.AUTOTYPE_ID}`
}} }}
formRef={formRef} formRef={formRef}
headerTitle={<PageTitleBox props={props} />} // 列表表头 headerTitle={<PageTitleBox props={props} />} // 列表表头
@ -283,13 +266,13 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
const req = { const req = {
OWNERUNIT_ID: currentUser?.OwnerUnitId, OWNERUNIT_ID: currentUser?.OwnerUnitId,
PROVINCE_CODE: "", PROVINCE_CODE: "",
GOODSTYPE: 1000, AUTOTYPE_TYPEID: 4000,
USERDEFINEDTYPE_STATE: params?.USERDEFINEDTYPE_STATE AUTOTYPE_VALID: params?.AUTOTYPE_VALID
// SearchKey: "" // SearchKey: ""
} }
console.log('reqreq', req); console.log('reqreq', req);
const data = await handlGetUSERDEFINEDTYPEList(req); const data = await handlGetNestingAUTOTYPEList(req);
console.log('datadatadatadatadata', data); console.log('datadatadatadatadata', data);
if (data && data.length > 0) { if (data && data.length > 0) {
setTypeTreeData(data) setTypeTreeData(data)
@ -391,20 +374,17 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
submitter={false} submitter={false}
preserve={false} preserve={false}
initialValues={currentRow ? currentRow : { initialValues={currentRow ? currentRow : {
USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
OWNERUNIT_NAME: currentUser?.OwnerUnitName OWNERUNIT_NAME: currentUser?.OwnerUnitName,
AUTOTYPE_VALID: 1
}} }}
onFinish={async (values) => { onFinish={async (values) => {
let newValue = { ...values }; let newValue = { ...values };
if (currentRow) { if (currentRow) {
// 编辑数据 // 编辑数据
newValue = { ...values, USERDEFINEDTYPE_ID: currentRow.USERDEFINEDTYPE_ID }; newValue = { ...values, AUTOTYPE_ID: currentRow.AUTOTYPE_ID };
} }
console.log('fileListfileList', fileList);
console.log('newValuenewValuenewValue', newValue);
// 如果有开关,要把开关的代码写进去 // 如果有开关,要把开关的代码写进去
await handleAddUpdate(newValue); await handleAddUpdate(newValue);
@ -415,38 +395,51 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
<Row gutter={8}> <Row gutter={8}>
<Col span={12}> <Col span={12}>
<ProFormTreeSelect <ProFormTreeSelect
name="USERDEFINEDTYPE_PID" name="AUTOTYPE_PID"
label="上级类别" label="上级类别"
request={async () => { request={async () => {
// 获取数据
let list: any[] = [];
if (typeTreeData && typeTreeData.length > 0) { if (typeTreeData && typeTreeData.length > 0) {
let list: any = [{ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }, ...typeTreeData] list = [{ AUTOTYPE_NAME: "默认类别", AUTOTYPE_ID: -1 }, ...typeTreeData];
return list
} else { } else {
const req = { const req = {
OWNERUNIT_ID: currentUser?.OwnerUnitId, OWNERUNIT_ID: currentUser?.OwnerUnitId,
PROVINCE_CODE: "", PROVINCE_CODE: "",
GOODSTYPE: 1000, GOODSTYPE: 1000,
} };
const data = await handlGetUSERDEFINEDTYPEList(req); const data = await handlGetUSERDEFINEDTYPEList(req);
console.log('datadatadatadatadata', data);
if (data.List && data.List.length > 0) { if (data.List && data.List.length > 0) {
data.List.unshirft({ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }) data.List.unshift({ AUTOTYPE_NAME: "默认类别", AUTOTYPE_ID: -1 });
setTypeTreeData(data.List) setTypeTreeData(data.List);
return data.List list = data.List;
} else { } else {
return [{ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }] list = [{ AUTOTYPE_NAME: "默认类别", AUTOTYPE_ID: -1 }];
} }
} }
// 递归禁用当前节点
const disableCurrent = (nodes: any[]): any[] =>
nodes.map(node => {
const disabled = node.AUTOTYPE_ID === currentRow?.AUTOTYPE_ID;
return {
...node,
disabled,
children: node.children ? disableCurrent(node.children) : undefined,
};
});
return disableCurrent(list);
}} }}
fieldProps={{ fieldProps={{
fieldNames: { fieldNames: {
label: 'USERDEFINEDTYPE_NAME', label: 'AUTOTYPE_NAME',
value: 'USERDEFINEDTYPE_ID', value: 'AUTOTYPE_ID',
children: 'children' children: 'children'
}, },
showSearch: true, showSearch: true,
filterTreeNode: (input, node) => filterTreeNode: (input, node) =>
(node.USERDEFINEDTYPE_NAME || '').toLowerCase().includes(input.toLowerCase()) (node.AUTOTYPE_NAME || '').toLowerCase().includes(input.toLowerCase())
}} }}
rules={[ rules={[
{ {
@ -458,7 +451,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
</Col> </Col>
<Col span={12}> <Col span={12}>
<ProFormText <ProFormText
name="USERDEFINEDTYPE_NAME" name="AUTOTYPE_NAME"
label="类别名称" label="类别名称"
rules={[ rules={[
{ {
@ -470,7 +463,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
</Col> </Col>
<Col span={12}> <Col span={12}>
<ProFormDigit <ProFormDigit
name="USERDEFINEDTYPE_INDEX" name="AUTOTYPE_INDEX"
label="类别索引" label="类别索引"
rules={[ rules={[
{ {
@ -482,7 +475,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
</Col> </Col>
<Col span={12}> <Col span={12}>
<ProFormSelect <ProFormSelect
name="USERDEFINEDTYPE_STATE" name="AUTOTYPE_VALID"
label="有效状态" label="有效状态"
options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]} options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]}
rules={[ rules={[
@ -496,7 +489,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
<Col span={12}> <Col span={12}>
<ProFormText <ProFormText
name="USERDEFINEDTYPE_DATE" name="OPERATE_DATE"
label="添加时间" label="添加时间"
disabled disabled
/> />
@ -510,7 +503,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }>
</Col> </Col>
<Col span={24}> <Col span={24}>
<ProFormTextArea <ProFormTextArea
name="USERDEFINEDTYPE_DESC" name="AUTOTYPE_DESC"
label="备注" label="备注"
/> />
</Col> </Col>

View File

@ -11,7 +11,7 @@ import { getServerpartTree } from "@/services/options";
import useRequest from "@ahooksjs/use-request"; import useRequest from "@ahooksjs/use-request";
import './style.less' import './style.less'
import { getMerchantShopTree } from "@/pages/Setting/Users/service"; import { getMerchantShopTree } from "@/pages/Setting/Users/service";
import { handlGetUSERDEFINEDTYPEList } from "../../service"; import { handlGetNestingAUTOTYPEList, handlGetUSERDEFINEDTYPEList } from "../../service";
type DetailProps = { type DetailProps = {
@ -37,7 +37,25 @@ const LeftSelectMallType = ({ setSelectedId, reload, actionRef, currentUser, wid
const [isShowAllInTree, setIsShowAllInTree] = useState<boolean>(false) const [isShowAllInTree, setIsShowAllInTree] = useState<boolean>(false)
// 加载服务区树 // 加载服务区树
const { loading: treeLoading, data: treeViews } = useRequest(async () => { const { loading: treeLoading, data: treeViews } = useRequest(async () => {
const req = {
OWNERUNIT_ID: currentUser?.OwnerUnitId,
PROVINCE_CODE: "",
AUTOTYPE_TYPEID: 4000,
AUTOTYPE_VALID: 1
}
console.log('reqreq', req);
const data = await handlGetNestingAUTOTYPEList(req);
console.log('datadatadatadatadata212', data);
setTreeView(data)
// 拿个类型的枚举
if (data && data.length > 0) {
let obj: any = {}
data.forEach((item: any) => {
obj[item.AUTOTYPE_CODE] = item.AUTOTYPE_NAME
})
setData(obj)
}
}) })
// 显示服务区树搜索框 // 显示服务区树搜索框
const [showServiceSearchBox, setShowServiceSearchBox] = useState<boolean>(false) const [showServiceSearchBox, setShowServiceSearchBox] = useState<boolean>(false)
@ -193,13 +211,9 @@ const LeftSelectMallType = ({ setSelectedId, reload, actionRef, currentUser, wid
// defaultExpandAll={isShowAllInTree ? false : true} // defaultExpandAll={isShowAllInTree ? false : true}
// defaultExpandedKeys={isShowAllInTree ? treeShowRow && treeShowRow.length > 0 ? treeShowRow : ['0-0'] : []} // defaultExpandedKeys={isShowAllInTree ? treeShowRow && treeShowRow.length > 0 ? treeShowRow : ['0-0'] : []}
onCheck={(checkedKeys: React.Key[] | any, info) => { onCheck={(checkedKeys: React.Key[] | any, info) => {
console.log('checkedKeyscheckedKeyscheckedKeys', checkedKeys);
console.log('infoinfoinfoinfoinfoinfo', info);
// 多选逻辑 // 多选逻辑
// const selectedIds = info.checkedNodes.filter((n: any) => n?.USERDEFINEDTYPE_PID !== -1) // const selectedIds = info.checkedNodes.filter((n: any) => n?.USERDEFINEDTYPE_PID !== -1)
const selectedIds = info.checkedNodes.filter((n: any) => n?.USERDEFINEDTYPE_ID) const selectedIds = info.checkedNodes.filter((n: any) => n?.USERDEFINEDTYPE_ID)
console.log('selectedIdsselectedIds', selectedIds);
setSelectedId(selectedIds.map((n: any) => n?.USERDEFINEDTYPE_ID)?.toString() || '') setSelectedId(selectedIds.map((n: any) => n?.USERDEFINEDTYPE_ID)?.toString() || '')
if (reload) { if (reload) {
actionRef?.current?.reload() actionRef?.current?.reload()
@ -209,8 +223,8 @@ const LeftSelectMallType = ({ setSelectedId, reload, actionRef, currentUser, wid
} }
}} }}
fieldNames={{ fieldNames={{
title: "USERDEFINEDTYPE_NAME", title: "AUTOTYPE_NAME",
key: "USERDEFINEDTYPE_ID" key: "AUTOTYPE_CODE"
}} }}
/> : ''} /> : ''}
</ProCard> </ProCard>

View File

@ -61,6 +61,8 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
hideInSearch: true, hideInSearch: true,
width: 150, width: 150,
ellipsis: true, ellipsis: true,
valueType: "select",
valueEnum: leftTreeData
}, },
{ {
dataIndex: 'MERCHANTS_NAME', dataIndex: 'MERCHANTS_NAME',
@ -213,6 +215,7 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
searchParameter: { searchParameter: {
OWNERUNIT_ID: currentUser?.OwnerUnitId, OWNERUNIT_ID: currentUser?.OwnerUnitId,
PROVINCE_CODE: currentUser?.ProvinceCode, PROVINCE_CODE: currentUser?.ProvinceCode,
MERCHANTS_TYPE: params?.MERCHANTS_TYPE ? params?.MERCHANTS_TYPE : ""
}, },
PageIndex: 1, PageIndex: 1,
PageSize: 999999, PageSize: 999999,
@ -224,6 +227,7 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
} }
return { data: [], success: true } return { data: [], success: true }
}} }}
pagination={false}
columns={columns} columns={columns}
toolbar={{ toolbar={{
actions: [ actions: [
@ -338,6 +342,13 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
<ProFormSelect <ProFormSelect
name="MERCHANTS_TYPE" name="MERCHANTS_TYPE"
label="商户类型" label="商户类型"
request={() => {
let list: any = []
for (let key in leftTreeData) {
list.push({ label: leftTreeData[key], value: key })
}
return list
}}
rules={[ rules={[
{ {
required: true, required: true,

View File

@ -203,6 +203,42 @@ export async function handlDeleteBRAND(params: any) {
return data return data
} }
// 获取供应商的分类列表 树形
export async function handlGetNestingAUTOTYPEList(params: any) {
const data = await requestEncryption(`/MemberBasic/GetNestingAUTOTYPEList`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return wrapTreeNode(data.Result_Data.List)
}
// 同步供应商信息
export async function handlSynchroAUTOTYPE(params: any) {
const data = await requestEncryption(`/MemberBasic/SynchroAUTOTYPE`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return data
}
// 删除供应商信息
export async function handlDeleteAUTOTYPE(params: any) {
const data = await requestEncryption(`/MemberBasic/DeleteAUTOTYPE`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return data
}
// 获取商城分类管理(自定义类别的那个) 树形 // 获取商城分类管理(自定义类别的那个) 树形
export async function handlGetUSERDEFINEDTYPEList(params: any) { export async function handlGetUSERDEFINEDTYPEList(params: any) {
@ -439,4 +475,42 @@ export async function handeDeleteSCENICAREA(params: any) {
return [] return []
} }
return data return data
} }
// 同步规格
export async function handeSynchroCOMMODITY_MULTI(params: any) {
const data = await requestEncryption(`/MallBasic/SynchroCOMMODITY_MULTI`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return data
}
// 删除多规格
export async function handeDeleteCOMMODITY_MULTI(params: any) {
const data = await requestEncryption(`/MallBasic/DeleteCOMMODITY_MULTI`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return data
}
// 获取商品多规格关联表列表
export async function handeGetRTCOMMODITY_MULTIList(params: any) {
const data = await requestEncryption(`/MemberConfig/GetRTCOMMODITY_MULTIList`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return data
}

View File

@ -104,7 +104,7 @@ requestEncryption.interceptors.request.use((url, opt: any) => {
} }
} else { } else {
if ((url.indexOf('Synchro') > -1 || url.indexOf('Save') > -1) && if ((url.indexOf('Synchro') > -1 || url.indexOf('Save') > -1) &&
url.indexOf('Picture/SaveImgFile') === -1) { url.indexOf('Picture/SaveImgFile') === -1 && !requestEncryption) {
options.data = { options.data = {
...options.data, ...options.data,
STAFF_ID: currentUser.ID, STAFF_ID: currentUser.ID,