diff --git a/config/routes.ts b/config/routes.ts index cb47071..ad99775 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -957,6 +957,12 @@ export default [ name: 'HomepageAds', component: './travelMember/HomepageAds/index' }, + // 服务区详情 + { + path: 'serverpartInfo', + name: 'serverpartInfo', + component: './travelMember/serverpartInfo/index' + }, ] }, { diff --git a/src/layouts/BasicLayout.tsx b/src/layouts/BasicLayout.tsx index bcbb6e2..2739bf7 100644 --- a/src/layouts/BasicLayout.tsx +++ b/src/layouts/BasicLayout.tsx @@ -205,6 +205,21 @@ const BasicLayout: React.FC = (props) => { // 拿到所有枚举的方法 const handleGetAllFieldEnum = async () => { + // 承载情况 + getFieldEnumTree({ FieldExplainField: 'LOAD_BEARING' }).then((LOADBEARING: any) => { + if (LOADBEARING && LOADBEARING.length > 0) { + const obj: any = {} + const list: any = [] + LOADBEARING.forEach((item: any) => { + list.push({ label: item.label, value: item.value }) + obj[item.value] = item.label + }) + session.set('LOADBEARINGList', list); + session.set('LOADBEARINGObj', obj); + session.set('LOADBEARINGTree', LOADBEARING); + } + }) + // 成长值规则类型 getFieldEnumTree({ FieldExplainField: 'GROWTH_TYPE' }).then((GROWTHSETTINGTYPE: any) => { if (GROWTHSETTINGTYPE && GROWTHSETTINGTYPE.length > 0) { diff --git a/src/pages/market/marketResearch/index.tsx b/src/pages/market/marketResearch/index.tsx index cc36a2e..3a26e43 100644 --- a/src/pages/market/marketResearch/index.tsx +++ b/src/pages/market/marketResearch/index.tsx @@ -1,82 +1,82 @@ -import type { CurrentUser} from "umi"; -import {connect} from "umi"; -import type {ConnectState} from "@/models/connect"; -import type {ActionType} from "@ant-design/pro-table"; +import type { CurrentUser } from "umi"; +import { connect } from "umi"; +import type { ConnectState } from "@/models/connect"; +import type { ActionType } from "@ant-design/pro-table"; import ProTable from "@ant-design/pro-table"; -import React, {useEffect, useRef, useState} from "react"; -import type {FormInstance} from "antd"; -import {Button, Drawer, message, Space,Image,Popconfirm,Upload} from "antd"; +import React, { useEffect, useRef, useState } from "react"; +import type { FormInstance } from "antd"; +import { Button, Drawer, message, Space, Image, Popconfirm, Upload } from "antd"; import './style.less' -import ProForm, {ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton,ProFormTreeSelect} from "@ant-design/pro-form"; +import ProForm, { ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton, ProFormTreeSelect } from "@ant-design/pro-form"; import { handleApplyBIDProinst, handleGetApproveBIDProinst, handleGetBUSINESSAPPROVALDetail, handleGetBusinessProcessList, handleGetRejectBIDProinst, handleGetSupplierDDL, handleGetWAREHOUSEList, handleGetWAREHOUSETree, handleSynchroBUSINESSAPPROVAL } from "@/pages/market/marketResearch/service"; -import {getServerpartTree} from "@/services/options"; +import { getServerpartTree } from "@/services/options"; import moment from "moment/moment"; -import {deletePicture, GetPictureList, handleUploadPicture} from "@/pages/supplier/inspectionReport/service"; +import { deletePicture, GetPictureList, handleUploadPicture } from "@/pages/supplier/inspectionReport/service"; import fileIcon from '@/assets/fileIcon.svg' import LoadingBox from "@/pages/reports/Finance/businessAnalysis/components/loading"; -import {handleGetAPPROVALROUTEDetail} from "@/pages/reports/revenueConfirmation/components/service"; -import {handleGetBIZPSPLITMONTHDetail} from "@/pages/examine/monthSettlement/service"; -import {handleGetAPPROVALROUTEList} from "@/pages/Setting/serviceConfig/service"; -import {handleGetGetBUSINESSAPPROVALDetail} from "@/pages/reports/ShopExpenseDetail/service"; +import { handleGetAPPROVALROUTEDetail } from "@/pages/reports/revenueConfirmation/components/service"; +import { handleGetBIZPSPLITMONTHDetail } from "@/pages/examine/monthSettlement/service"; +import { handleGetAPPROVALROUTEList } from "@/pages/Setting/serviceConfig/service"; +import { handleGetGetBUSINESSAPPROVALDetail } from "@/pages/reports/ShopExpenseDetail/service"; import ReviewProcess from "@/pages/reports/revenueConfirmation/components/ReviewProcess"; -const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { +const marketResearch: React.FC<{ currentUser: CurrentUser }> = (props) => { const { currentUser } = props const actionRef = useRef(); const formRef = useRef(); const detailFormRef = useRef(); // 上传附件的抽屉 - const [showDrawer,setShowDrawer] = useState(false) + const [showDrawer, setShowDrawer] = useState(false) // 选择的行数据 - const [currentRow,setCurrentRow] = useState() + const [currentRow, setCurrentRow] = useState() // 附件列表 - const [fileList,setFileList] = useState() + const [fileList, setFileList] = useState() // 附件列表的加载效果 - const [fileListLoading,setFileListLoading] = useState(false) + const [fileListLoading, setFileListLoading] = useState(false) // 服务区 管理处的选择列表 - const [serviceSelectList,setServiceSelectList] = useState() - const [managerSelectList,setManagerSelectList] = useState() + const [serviceSelectList, setServiceSelectList] = useState() + const [managerSelectList, setManagerSelectList] = useState() // 是否显示审批人选择框 - const [showSelectPerson,setShowSelectPerson] = useState(false) + const [showSelectPerson, setShowSelectPerson] = useState(false) // 选择的服务区 - const [selectServerpart,setSelectServerpart] = useState() + const [selectServerpart, setSelectServerpart] = useState() // 选择的管理处 - const [selectManagerId,setSelectManagerId] = useState() - const [getType,setGetType] = useState(0) // 3为查看详情 - const [proinstRow,setProinstRow] = useState() - const [showDescModal,setShowDescModal] = useState(false) + const [selectManagerId, setSelectManagerId] = useState() + const [getType, setGetType] = useState(0) // 3为查看详情 + const [proinstRow, setProinstRow] = useState() + const [showDescModal, setShowDescModal] = useState(false) // 流程状态 - const [isMerchantState,setIsMerchantState] = useState('') + const [isMerchantState, setIsMerchantState] = useState('') // 审批人数组 - const [APPROVALSTAFFIDList,setAPPROVALSTAFFIDList] = useState() + const [APPROVALSTAFFIDList, setAPPROVALSTAFFIDList] = useState() // 判断是否有驳回状态, 有驳回按照驳回的走 没驳回直接1000的驳回 - const [handleHaveReject,setHandleHaveReject] = useState(false) + const [handleHaveReject, setHandleHaveReject] = useState(false) // 审批环节数组 - const [stateList,setStateList] = useState() + const [stateList, setStateList] = useState() // 显示审核流程抽屉 - const [showReviewProcess,setShowReviewProcess] = useState(false) + const [showReviewProcess, setShowReviewProcess] = useState(false) const columns: any = [ { - title:'业务名称', - dataIndex:'BusinessProcess_Name', + title: '业务名称', + dataIndex: 'BusinessProcess_Name', width: 250, - ellipsis:true, - render:(_,record)=>{ - return { - const data = await handleGetBUSINESSAPPROVALDetail({BUSINESSAPPROVALId: record?.BusinessApproval_ID}) + ellipsis: true, + render: (_, record) => { + return { + const data = await handleGetBUSINESSAPPROVALDetail({ BUSINESSAPPROVALId: record?.BusinessApproval_ID }) setGetType(3) setProinstRow(record) const res = data - if (res.SERVERPART_IDS && res.SERVERPART_IDS.indexOf(',')!==-1){ - const [serverid,managerid] = res.SERVERPART_IDS.split(',') + if (res.SERVERPART_IDS && res.SERVERPART_IDS.indexOf(',') !== -1) { + const [serverid, managerid] = res.SERVERPART_IDS.split(',') res.Serverpart_ID = Number(serverid) res.managerId = Number(managerid) } @@ -86,7 +86,7 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { APPROVALSTAFF_ID: `${res.APPOVED_NAME}-${res.APPOVED_IDS}`, BusinessApprovalId: record?.BusinessApproval_ID }) - console.log('CurrentRow',{ + console.log('CurrentRow', { ...record, ...res, }) @@ -95,14 +95,14 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { } }, { - title:'审批环节', - dataIndex:'BusinessProcess_State', + title: '审批环节', + dataIndex: 'BusinessProcess_State', valueType: 'select', width: 150, - ellipsis:true, - request: async ()=>{ + ellipsis: true, + request: async () => { const req: any = { - SearchParameter:{ + SearchParameter: { APPROVALROUTE_VALID: 1, OPERATION_TYPES: 13 }, @@ -110,19 +110,19 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { PageSize: 999999 } const data = await handleGetAPPROVALROUTEList(req) - console.log('data',data) - if (data && data.length>0){ + console.log('data', data) + if (data && data.length > 0) { const list: any = [] let merchantState: string = '' - data.forEach((item: any)=>{ - if (item.USER_PATTERN===2000){ - if (merchantState){ + data.forEach((item: any) => { + if (item.USER_PATTERN === 2000) { + if (merchantState) { merchantState += `,${item.APPROVALROUTE_STATE}` - }else{ + } else { merchantState = item.APPROVALROUTE_STATE } } - list.push({label: item.APPROVALROUTE_NAME,value: item.APPROVALROUTE_STATE}) + list.push({ label: item.APPROVALROUTE_NAME, value: item.APPROVALROUTE_STATE }) }) setIsMerchantState(merchantState) setStateList(list) @@ -150,41 +150,41 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { } }, { - title:'服务区名称', - dataIndex:'Serverpart_Name', + title: '服务区名称', + dataIndex: 'Serverpart_Name', width: 130, - ellipsis:true, + ellipsis: true, hideInSearch: true, - render:(_,record)=>{ - return record?.Serverpart_Name?record?.Serverpart_Name.split(',')[0]:'' + render: (_, record) => { + return record?.Serverpart_Name ? record?.Serverpart_Name.split(',')[0] : '' } }, { - title:'管理处名称', - dataIndex:'管理处名称', + title: '管理处名称', + dataIndex: '管理处名称', width: 130, - ellipsis:true, + ellipsis: true, hideInSearch: true, - render:(_,record)=>{ - return record?.Serverpart_Name?record?.Serverpart_Name.split(',')[1]:'' + render: (_, record) => { + return record?.Serverpart_Name ? record?.Serverpart_Name.split(',')[1] : '' } }, { - title:'备注说明', - dataIndex:'BusinessProcess_Desc', + title: '备注说明', + dataIndex: 'BusinessProcess_Desc', width: 300, - ellipsis:true, + ellipsis: true, hideInSearch: true, }, { - title:'供应商名称', - dataIndex:'BusinessProcess_ID', + title: '供应商名称', + dataIndex: 'BusinessProcess_ID', width: 200, - ellipsis:true, + ellipsis: true, hideInSearch: true, valueType: 'select', - request:async ()=>{ + request: async () => { const req: any = { ProvinceCode: currentUser?.ProvinceCode } @@ -193,24 +193,24 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { } }, { - title:'申请人', - dataIndex:'Staff_Name', + title: '申请人', + dataIndex: 'Staff_Name', width: 100, - ellipsis:true, + ellipsis: true, hideInSearch: true, }, { - title:'待审核人', + title: '待审核人', width: 100, - dataIndex:'ApproveStaff_Name', - ellipsis:true, + dataIndex: 'ApproveStaff_Name', + ellipsis: true, hideInSearch: true, }, { - title:'申请时间', - dataIndex:'BusinessProcess_StartDate', + title: '申请时间', + dataIndex: 'BusinessProcess_StartDate', width: 150, - ellipsis:true, + ellipsis: true, hideInSearch: true, }, { @@ -226,12 +226,12 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { { - const data = await handleGetBUSINESSAPPROVALDetail({BUSINESSAPPROVALId: record?.BusinessApproval_ID}) + const data = await handleGetBUSINESSAPPROVALDetail({ BUSINESSAPPROVALId: record?.BusinessApproval_ID }) setGetType(1) setProinstRow(record) const res = data - if (res.SERVERPART_IDS && res.SERVERPART_IDS.indexOf(',')!==-1){ - const [serverid,managerid] = res.SERVERPART_IDS.split(',') + if (res.SERVERPART_IDS && res.SERVERPART_IDS.indexOf(',') !== -1) { + const [serverid, managerid] = res.SERVERPART_IDS.split(',') res.Serverpart_ID = Number(serverid) res.managerId = Number(managerid) } @@ -241,7 +241,7 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { APPROVALSTAFF_ID: `${res.APPOVED_NAME}-${res.APPOVED_IDS}`, BusinessApprovalId: record?.BusinessApproval_ID }) - console.log('CurrentRow',{ + console.log('CurrentRow', { ...record, ...res, }) @@ -253,12 +253,12 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { { - const data = await handleGetBUSINESSAPPROVALDetail({BUSINESSAPPROVALId: record?.BusinessApproval_ID}) + const data = await handleGetBUSINESSAPPROVALDetail({ BUSINESSAPPROVALId: record?.BusinessApproval_ID }) setGetType(2) setProinstRow(record) const res = data - if (res.SERVERPART_IDS && res.SERVERPART_IDS.indexOf(',')!==-1){ - const [serverid,managerid] = res.SERVERPART_IDS.split(',') + if (res.SERVERPART_IDS && res.SERVERPART_IDS.indexOf(',') !== -1) { + const [serverid, managerid] = res.SERVERPART_IDS.split(',') res.Serverpart_ID = Number(serverid) res.managerId = Number(managerid) } @@ -268,7 +268,7 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { APPROVALSTAFF_ID: `${res.APPOVED_NAME}-${res.APPOVED_IDS}`, BusinessApprovalId: record?.BusinessApproval_ID }) - console.log('CurrentRow',{ + console.log('CurrentRow', { ...record, ...res, }) @@ -284,35 +284,35 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { ] // 上传图片方法 - const handleUpFile = async (id: string,file: any)=>{ - if(file && file.length>0){ + const handleUpFile = async (id: string, file: any) => { + if (file && file.length > 0) { const formData = new FormData() - file.forEach((item: any)=>{ - formData.append('files[]',item.originFileObj) + file.forEach((item: any) => { + formData.append('files[]', item.originFileObj) }) - formData.append('TableId',id) - formData.append('TableType','1128') - const data= await handleUploadPicture(formData) - console.log('data',data) + formData.append('TableId', id) + formData.append('TableType', '1128') + const data = await handleUploadPicture(formData) + console.log('data', data) } } // 查询图片列表 - const handleGetPictureList = async (id: string)=>{ + const handleGetPictureList = async (id: string) => { setFileListLoading(true) const req: any = { TableId: id, TableType: 1128, } const data = await GetPictureList(req) - console.log('data',data) + console.log('data', data) setFileList(data) setFileListLoading(false) } // 获得审批人列表的方法 - const handleGetPersonList = async (serverpartId: any,managerId: any)=>{ - if (serverpartId && managerId){ + const handleGetPersonList = async (serverpartId: any, managerId: any) => { + if (serverpartId && managerId) { const id: string = `${serverpartId},${managerId}` const req: any = { OperationType: 13, @@ -323,34 +323,35 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { } const data = await handleGetAPPROVALROUTEDetail(req) const list: any = [] - if (data.UserList && data.UserList.length>0){ - data.UserList.forEach((item: any)=>{ - list.push({label: item.USER_NAME,value: `${item.USER_NAME}-${item.USER_ID}`}) + if (data.UserList && data.UserList.length > 0) { + data.UserList.forEach((item: any) => { + list.push({ label: item.USER_NAME, value: `${item.USER_NAME}-${item.USER_ID}` }) }) } + setAPPROVALSTAFFIDList(list) } } // 审核是1 驳回是2 - const handleGetToExamine = async (res: any)=>{ + const handleGetToExamine = async (res: any) => { let req: any = {} let data: any = {} // 审核 - if (getType===1){ - req={ + if (getType === 1) { + req = { businessApprovalID: currentRow?.BUSINESSAPPROVAL_ID, - curProinstState:currentRow?.BUSINESSAPPROVAL_STATE, + curProinstState: currentRow?.BUSINESSAPPROVAL_STATE, approveedInfo: res.desc, approveedStaffId: currentUser?.ID, approveedStaffName: currentUser?.Name, nextId: res.nextPerson, } data = await handleGetApproveBIDProinst(req) - }else if(getType===2){ + } else if (getType === 2) { // 驳回 const backObj = JSON.parse(res.targetProinstState) - req={ + req = { businessApprovalID: currentRow?.BUSINESSAPPROVAL_ID, approveedStaffId: backObj?.APPROVALSTAFF_ID, approveedStaffName: backObj?.APPROVALSTAFF_NAME, @@ -359,8 +360,8 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { } data = await handleGetRejectBIDProinst(req) } - console.log('data',data) - if(data.Result_Code===100){ + console.log('data', data) + if (data.Result_Code === 100) { message.success(data.Result_Desc) detailFormRef.current?.resetFields() setCurrentRow(undefined) @@ -368,18 +369,18 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { setShowDrawer(false) setGetType(0) actionRef.current?.reload() - }else{ + } else { message.error(data.Result_Desc) } } useEffect(() => { - if (showDrawer){ + if (showDrawer) { // 拿到下一阶段人的数据 - handleGetPersonList(currentRow?.Serverpart_ID,currentRow?.managerId) + handleGetPersonList(currentRow?.Serverpart_ID, currentRow?.managerId) // 图片的数组 - if (currentRow){ + if (currentRow) { handleGetPictureList(currentRow?.BUSINESSAPPROVAL_ID) } } @@ -393,8 +394,8 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { formRef={formRef} columns={columns} bordered - request={async(params: any)=>{ - console.log('params',params) + request={async (params: any) => { + console.log('params', params) const req: any = { SearchParameter: { // ...params, @@ -405,20 +406,20 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { BusinessProcess_StartDate: params.StartDate || '', BusinessProcess_EndDate: params.EndDate || '', }, - keyWord:{ - Key:'BusinessProcess_Name', + keyWord: { + Key: 'BusinessProcess_Name', Value: params?.BusinessProcess_Name || '' } } const data = await handleGetBusinessProcessList(req) - if (data && data.length>0){ - return {data, success: true} + if (data && data.length > 0) { + return { data, success: true } } - return {data:[],success: true} + return { data: [], success: true } }} toolbar={{ - actions:[ - ] @@ -454,7 +455,7 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { initialValues={currentRow} > { - getType===3? + getType === 3 ? = (props) => { options: stateList }} /> - :'' + : '' } 0} + readonly={getType > 0} rules={[ { required: true, - message:'请输入业务名称' + message: '请输入业务名称' } ]} /> @@ -482,11 +483,11 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { 0} + readonly={getType > 0} rules={[ { required: true, - message:'请选择服务区' + message: '请选择服务区' } ]} fieldProps={{ @@ -495,23 +496,23 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { title: "label", }, // showSearch: true, - onChange:(e: any)=>{ - if (e){ + onChange: (e: any) => { + if (e) { setSelectServerpart(e) - handleGetPersonList(e,selectManagerId) - }else{ + handleGetPersonList(e, selectManagerId) + } else { setSelectServerpart(null) } } }} - request={async()=>{ + request={async () => { const req: any = { wareHouseType: 2, showSite: false } const data = await handleGetWAREHOUSETree(req) setServiceSelectList(data) - if (data && data.length>0){ + if (data && data.length > 0) { return data } return [] @@ -521,7 +522,7 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { 0} + readonly={getType > 0} fieldProps={{ treeDefaultExpandAll: true, fieldNames: { @@ -529,56 +530,56 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { }, // showSearch: true, // options: serviceSelectList, - onChange:(e: any)=>{ - if (e){ + onChange: (e: any) => { + if (e) { setSelectManagerId(e) - handleGetPersonList(selectServerpart,e) - }else{ + handleGetPersonList(selectServerpart, e) + } else { setSelectManagerId(null) } } }} - request={async()=>{ - if (getType>0){ + request={async () => { + if (getType > 0) { const id = currentRow?.SERVERPART_IDS.split(',')[1] || '' const name = currentRow?.SERVERPART_NAME.split(',')[1] || '' - return [{label: name,value: id}] + return [{ label: name, value: id }] } - const req: any = { - wareHouseType: 1, - showSite: false - } - const data = await handleGetWAREHOUSETree(req) - setManagerSelectList(data) - if (data && data.length>0){ - return data - } - return [] + const req: any = { + wareHouseType: 1, + showSite: false + } + const data = await handleGetWAREHOUSETree(req) + setManagerSelectList(data) + if (data && data.length > 0) { + return data + } + return [] }} rules={[ { required: true, - message:'请选择管理处' + message: '请选择管理处' } ]} /> { - getType===3? - :'' + getType === 3 ? + : '' } { - selectServerpart && selectManagerId || getType>0? + selectServerpart && selectManagerId || getType > 0 ? 0} + label={getType === 3 ? '待审批人' : '审批人'} + readonly={getType > 0} rules={[ { required: true, @@ -588,13 +589,13 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { fieldProps={{ options: APPROVALSTAFFIDList }} - />:'' + /> : '' } 0} + readonly={getType > 0} /> {/* 要驳回的状态 */} @@ -620,19 +621,19 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { const list: any = [] data.rejectList.forEach((item: any) => { - list.push({label: item.APPROVALROUTE_NAME,value: JSON.stringify(item)}) + list.push({ label: item.APPROVALROUTE_NAME, value: JSON.stringify(item) }) }) return list } setHandleHaveReject(false) return [] }} - />:'' + /> : '' } { - getType===1 && currentRow?.NextState!==9000 && currentRow?.BUSINESSAPPROVAL_STATE!==9000? + getType === 1 && currentRow?.NextState !== 9000 && currentRow?.BUSINESSAPPROVAL_STATE !== 9000 ? = (props) => { message: '请选择下一环节审批人' } ]} - request={async ()=>{ + request={async () => { // merchantState 判断哪几个状态是商户的 商户调用拿到 商户下面的全部人列表选择一个 不是商户的 就根据选择了的人去指定一个人 // 接口直接返回就不用判断了 const req: any = { @@ -650,38 +651,38 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { } const data = await handleGetBUSINESSAPPROVALDetail(req) const list: any = [] - if (data.UserList && data.UserList.length>0){ - data.UserList.forEach((item: any)=>{ - list.push({label:item.USER_NAME,value: item.USER_ID}) + if (data.UserList && data.UserList.length > 0) { + data.UserList.forEach((item: any) => { + list.push({ label: item.USER_NAME, value: item.USER_ID }) }) } return list }} /> - :'' + : '' } { - getType>0 ? - getType===3?'': - - : 0 ? + getType === 3 ? '' : + + : 0} + readonly={getType > 0} fieldProps={{ name: 'file', - beforeUpload: (file: any)=>{ + beforeUpload: (file: any) => { const isEXE = file.type === 'application/octet-stream' if (isEXE) { message.error(`不支持上传exe文件!`); @@ -695,8 +696,8 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { { getType === 0 ? -
- -
:getType>0? -
- -
:'' + : getType > 0 ? +
+ +
: '' } { - getType>0? - :'' + }}>查看流程进度 : '' }

附件列表

{ - fileListLoading ? : + fileListLoading ? :
{ fileList && fileList.length > 0 ? @@ -813,9 +814,9 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { return
{ item.ImageUrl.indexOf('.png') !== -1 || item.ImageUrl.indexOf('.jpg') !== -1 || item.ImageUrl.indexOf('.jpeg') !== -1 ? - : + :
- + { window.open(item.ImageUrl) }}>{item.ImageName || ''} @@ -855,7 +856,7 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => {
- {/* 流程进度抽屉 */} + {/* 流程进度抽屉 */} = (props) => { setShowReviewProcess(false); }} destroyOnClose - bodyStyle={{backgroundColor: "#f9f9f9", padding: 16}} + bodyStyle={{ backgroundColor: "#f9f9f9", padding: 16 }} closable={false} > - + @@ -875,6 +876,6 @@ const marketResearch: React.FC<{ currentUser: CurrentUser}> = (props) => { ) } -export default connect(({user,}: ConnectState) => ({ +export default connect(({ user, }: ConnectState) => ({ currentUser: user.currentUser, }))(marketResearch); diff --git a/src/pages/travelMember/MallClassificationManage/index.tsx b/src/pages/travelMember/MallClassificationManage/index.tsx index 7205089..f537fd6 100644 --- a/src/pages/travelMember/MallClassificationManage/index.tsx +++ b/src/pages/travelMember/MallClassificationManage/index.tsx @@ -181,6 +181,11 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined }]) } + if (record?.PRESALE_TYPE) { + setFormPRESALE_TYPE(true) + } + + setCurrentRow({ ...record }); handleModalVisible(true); }} @@ -395,7 +400,11 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined autoFocusFirstInput submitter={false} preserve={false} - initialValues={currentRow ? currentRow : { + initialValues={currentRow ? { + ...currentRow, + PRESALE_TIME: currentRow?.PRESALE_TYPE ? [currentRow?.PRESALE_STARTTIME, currentRow?.PRESALE_ENDTIME] : "" + } : { + USERDEFINEDTYPE_STATE: 1, USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), OWNERUNIT_NAME: currentUser?.OwnerUnitName }} @@ -524,6 +533,12 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined width={'lg'} name="PRESALE_TIME" label="预售时间" + rules={[ + { + required: true, + message: "请选择预售时间" + } + ]} /> : "" diff --git a/src/pages/travelMember/MallEvaluationManage/index.tsx b/src/pages/travelMember/MallEvaluationManage/index.tsx index 173d084..137c127 100644 --- a/src/pages/travelMember/MallEvaluationManage/index.tsx +++ b/src/pages/travelMember/MallEvaluationManage/index.tsx @@ -1,15 +1,279 @@ // 商城评价管理 -import { ConnectState } from "@/models/connect"; -import { connect, CurrentUser } from "umi"; +import React, { useRef, useState, Suspense } from 'react'; +import moment from 'moment'; // 时间相关引用,没有使用可以删除 +import numeral from "numeral"; // 数字相关引用,没有使用可以删除 +import { connect } from 'umi'; + +import useRequest from '@ahooksjs/use-request'; // 请求数据的引用 +import Draggable from 'react-draggable'; +import SubMenu from "antd/lib/menu/SubMenu"; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import ProForm, { ProFormDatePicker, ProFormDateRangePicker, ProFormDateTimePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form'; +import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +import { PageContainer } from '@ant-design/pro-layout'; +import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect, Divider } from 'antd'; + +import type { CurrentUser } from "umi"; +import type { ConnectState } from '@/models/connect'; +import type { ActionType, ProColumns } from '@ant-design/pro-table'; +import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import type { FormInstance } from 'antd'; +import type { COMMODITYModel } from './data'; + +import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 +import { getList, delcommodity, updatecommodity } from './service'; // 接口相关对象的引用 +import PageTitleBox from "@/components/PageTitleBox"; +import { handeDeleteCOMMODITY, handeDeleteMALLCOMMENT, handeGetCOMMODITY_MULTIList, handeGetCOMMODITYDetail, handeGetCOMMODITYList, handeGetMALLCOMMENTList, handeSynchroCOMMODITY, handleGetBRANDList } from '../service'; +import session from '@/utils/session'; +import LeftSelectMallType from '../ProductListingManagement/component/LeftSelectMallType'; + const MallEvaluationManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [showDetail, setShowDetail] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [searchParams, setSearchParams] = useState(); + const [collapsible, setCollapsible] = useState(false) + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + // 拿到左侧树的数据 + const [leftTreeData, setLeftTreeData] = useState() + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + const onDraggaleStart = (event, uiData) => { + const { clientWidth, clientHeight } = window.document.documentElement; + const targetRect = draggleRef.current?.getBoundingClientRect(); + if (!targetRect) { + return; + } + setBounds({ + left: -targetRect.left + uiData.x, + right: clientWidth - (targetRect.right - uiData.x), + top: -targetRect.top + uiData.y, + bottom: clientHeight - (targetRect.bottom - uiData.y), + }); + }; + + // 定义列表字段内容 + const columns: any = [ + { + dataIndex: 'index', + title: '序号', + align: 'center', + width: 70, + ellipsis: true, + valueType: 'index', + hideInSearch: true, + }, + { + dataIndex: 'MERCHANTS_NAME', + title: '商家名称', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'COMMODITY_NAME', + title: '评价商品', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'CREATE_DATE', + title: '评价时间', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + render: (_, record) => { + return record?.CREATE_DATE ? moment(record?.CREATE_DATE).format('YYYY-MM-DD HH:mm:ss') : "" + } + }, + { + dataIndex: 'MEMBERSHIP_NAME', + title: '评价人员', + align: 'center', + hideInSearch: true, + hideInDescriptions: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'MEMBERSHIP_TYPE', + title: '会员类型', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'MALLCOMMENT_SCORE', + title: '评分', + align: 'center', + hideInSearch: true, + width: 120, + ellipsis: true, + }, + { + dataIndex: 'MALLCOMMENT_CONTENT', + title: '评价内容', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'MALLCOMMENT_REPLY', + title: '回复内容', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'option', + title: '操作', + valueType: 'option', + align: 'center', + hideInSearch: true, + width: 120, + fixed: "right", + ellipsis: true, + render: (_, record) => { + return ( + + {/* { + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + > + 编辑 + */} + { + await handelDelete(record.MALLCOMMENT_ID); + }} + > + 删除 + + + ); + }, + }, + ]; + + const handelDelete = async (MALLCOMMENT_ID: number) => { + const result = await handeDeleteMALLCOMMENT({ MALLCOMMENTId: MALLCOMMENT_ID }); + + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + } + }; + + const handleAddUpdate = async (res: any) => { + let req: any = {} + if (currentRow?.USERDEFINEDTYPE_ID) { + req = { + ...currentRow, + ...res, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + PROVINCE_CODE: currentUser?.ProvinceCode, + OPERATE_PERSON: currentUser?.ID, + COMMODITY_TYPE: 4000, + OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } else { + req = { + ...res, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + PROVINCE_CODE: currentUser?.ProvinceCode, + OPERATE_PERSON: currentUser?.ID, + COMMODITY_TYPE: 4000, + OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } + const data = await handeSynchroCOMMODITY(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) + } + }; + return (
+
+ +
+ {/* 最外层的列表 */} + + scroll={{ x: "100%", y: 'calc(100vh - 370px)' }} + rowKey={(record) => { + return `${record?.COMMODITY_ID}` + }} + formRef={formRef} + bordered + headerTitle={} // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + // 请求数据 + request={async (params, sorter) => { + const req: any = { + searchParameter: { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: currentUser?.ProvinceCode, + ISVALID: 1 + }, + PageIndex: 1, + PageSize: 999999, + SortStr: "CREATE_DATE desc" + } + const data = await handeGetMALLCOMMENTList(req) + console.log('datadatadatadatadata', data); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + columns={columns} + toolbar={{ + actions: [ + ], + }} + /> +
+
- ) -} - + ); +}; export default connect(({ user }: ConnectState) => ({ currentUser: user.currentUser }))(MallEvaluationManage); \ No newline at end of file diff --git a/src/pages/travelMember/OrderCategoryManage/index.tsx b/src/pages/travelMember/OrderCategoryManage/index.tsx index 1c982a9..8d25729 100644 --- a/src/pages/travelMember/OrderCategoryManage/index.tsx +++ b/src/pages/travelMember/OrderCategoryManage/index.tsx @@ -1,15 +1,638 @@ // 点餐类别管理 -import { ConnectState } from "@/models/connect"; -import { connect, CurrentUser } from "umi"; +import React, { useRef, useState, Suspense } from 'react'; +import moment from 'moment'; // 时间相关引用,没有使用可以删除 +import numeral from "numeral"; // 数字相关引用,没有使用可以删除 +import { connect } from 'umi'; -const OrderCategoryManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { - return ( -
+import useRequest from '@ahooksjs/use-request'; // 请求数据的引用 +import Draggable from 'react-draggable'; +import SubMenu from "antd/lib/menu/SubMenu"; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form'; +import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +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 type { CurrentUser } from "umi"; +import type { ConnectState } from '@/models/connect'; +import type { ActionType, ProColumns } from '@ant-design/pro-table'; +import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import type { FormInstance } from 'antd'; + +import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 +import { handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service'; +import PageTitleBox from '@/components/PageTitleBox'; +import { uploadPicture } from '@/services/picture'; +import defaultIcon from '../../../assets/brand/defaultIcon.png' + + +const beforeUpload = (file: any) => { + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; + if (!isJpgOrPng) { + message.error('请上传JPEG、jpg、png格式的图片文件!'); + } + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + message.error('图片大小不超过 2MB!'); + } + return isJpgOrPng && isLt2M; } + +const OrderCategoryManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const { confirm } = Modal; + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [showDetail, setShowDetail] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [searchParams, setSearchParams] = useState(); + // 分类的树形结构数据 + const [typeTreeData, setTypeTreeData] = useState() + // 表单里面的是否预售 + const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState(false) + + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + + // 文件列表 + const [fileList, setFileList] = useState([]) + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + + const onDraggaleStart = (event, uiData) => { + const { clientWidth, clientHeight } = window.document.documentElement; + const targetRect = draggleRef.current?.getBoundingClientRect(); + if (!targetRect) { + return; + } + setBounds({ + left: -targetRect.left + uiData.x, + right: clientWidth - (targetRect.right - uiData.x), + top: -targetRect.top + uiData.y, + bottom: clientHeight - (targetRect.bottom - uiData.y), + }); + }; + // 拖动结束 + + // 定义列表字段内容 + const columns: any = [ + // { + // title: '上级类别', + // align: 'center', + // width: 150, + // ellipsis: true, + // dataIndex: 'USERDEFINEDTYPE_PID', + // hideInSearch: true, + // hideInDescriptions: true, + // }, + { + dataIndex: 'USERDEFINEDTYPE_NAME', + title: '类别名称', + align: 'center', + width: 300, + ellipsis: true, + hideInSearch: true, + hideInDescriptions: true, + render: (_, record) => { + return
+ + {record?.USERDEFINEDTYPE_NAME} +
+ } + }, + { + dataIndex: 'USERDEFINEDTYPE_INDEX', + title: '类别索引', + align: 'center', + width: 120, + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'USERDEFINEDTYPE_STATE', + title: '有效状态', + align: 'center', + width: 120, + ellipsis: true, + valueType: "select", + valueEnum: { + "1": "有效", + "0": "无效" + }, + initialValue: "1" + }, + { + dataIndex: 'SCANCODE_ORDER', + title: '上架状态', + align: 'center', + width: 120, + ellipsis: true, + hideInSearch: true, + valueType: "select", + valueEnum: { + "1": "上架", + "0": "下架" + } + }, + { + dataIndex: "PRESALE_TYPE", + title: "是否预售", + align: 'center', + hideInSearch: true, + width: 120, + ellipsis: true, + valueType: "select", + valueEnum: { + "0": "否", + "1": "是" + } + }, + { + dataIndex: 'OWNERUNIT_NAME', + title: '业主单位', + align: 'center', + width: 180, + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'option', + title: '操作', + width: 100, + ellipsis: true, + valueType: 'option', + align: 'center', + hideInSearch: true, + render: (_, record) => { + return ( + + { + console.log('recordrecordrecord', record); + if (record?.USERDEFINEDTYPE_ICO) { + setFileList([{ + name: "", + url: record?.USERDEFINEDTYPE_ICO + }]) + } + + if (record?.PRESALE_TYPE) { + setFormPRESALE_TYPE(true) + } + + + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + > + 编辑 + + { + handelDelete(record.USERDEFINEDTYPE_ID); + }} + > + 删除 + + + ); + }, + }, + ]; + + // 预览上传后的图片 + const handlePreview = async () => { + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + + // 删除点餐类别 + const handelDelete = async (id: any) => { + const req: any = { + USERDEFINEDTYPEId: id + } + const result = await handlDeleteUSERDEFINEDTYPE(req) + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + } + } + + // 同步点餐列表 + const handleAddUpdate = async (res: any) => { + let req: any = {} + if (currentRow?.USERDEFINEDTYPE_ID) { + req = { + ...currentRow, + ...res, + GOODSTYPE: 3000, + USERDEFINEDTYPE_ICO: fileList && fileList.length > 0 ? fileList[0].url : "", + 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] : "", + PROVINCE_CODE: currentUser?.ProvinceCode, + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } else { + req = { + ...res, + GOODSTYPE: 3000, + USERDEFINEDTYPE_ICO: fileList && fileList.length > 0 ? fileList[0].url : "", + 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] : "", + PROVINCE_CODE: currentUser?.ProvinceCode, + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } + const data = await handlSynchroUSERDEFINEDTYPE(req) + handleConfirmLoading(false) + if (data.Result_Code === 100) { + message.success("新增成功!") + setCurrentRow(undefined) + formRef?.current?.resetFields() + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + } + + return ( + + { + return `${record?.USERDEFINEDTYPE_PID}-${record?.USERDEFINEDTYPE_ID}` + }} + formRef={formRef} + headerTitle={} // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + bordered + // 请求数据 + request={async (params, sorter) => { + const req = { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: "", + GOODSTYPE: 3000, + USERDEFINEDTYPE_STATE: params?.USERDEFINEDTYPE_STATE + // SearchKey: "" + } + const data = await handlGetUSERDEFINEDTYPEList(req); + console.log('datadatadatadatadata', data); + if (data && data.length > 0) { + setTypeTreeData(data) + return { data: data, success: true, total: data.length } + } + return { data: [], success: true } + }} + columns={columns} + toolbar={{ + actions: [ + // 新增按钮 + , + ], + }} + /> + + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新点餐自定义类别' : '新建点餐自定义类别'} +
+ } + destroyOnClose={true} + width={900} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + > +
{modal}
+
+ }} + > + { + let newValue = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, USERDEFINEDTYPE_ID: currentRow.USERDEFINEDTYPE_ID }; + } + + + console.log('fileListfileList', fileList); + console.log('newValuenewValuenewValue', newValue); + + // 如果有开关,要把开关的代码写进去 + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + setFormPRESALE_TYPE(false) + }} + > + + + { + if (typeTreeData && typeTreeData.length > 0) { + let list: any = [{ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }, ...typeTreeData] + return list + } else { + const req = { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: "", + GOODSTYPE: 3000, + } + const data = await handlGetUSERDEFINEDTYPEList(req); + console.log('datadatadatadatadata', data); + if (data.List && data.List.length > 0) { + data.List.unshirft({ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }) + setTypeTreeData(data.List) + return data.List + } else { + return [{ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }] + } + } + }} + fieldProps={{ + fieldNames: { + label: 'USERDEFINEDTYPE_NAME', + value: 'USERDEFINEDTYPE_ID', + children: 'children' + }, + showSearch: true, + filterTreeNode: (input, node) => + (node.USERDEFINEDTYPE_NAME || '').toLowerCase().includes(input.toLowerCase()) + }} + rules={[ + { + required: true, + message: "请选择上级类别" + } + ]} + /> + + + + + + + + + + + + + + + { + setFormPRESALE_TYPE(e) + } + }} + /> + + { + formPRESALE_TYPE ? + + + + : "" + } + + { + const formData = new FormData(); + formData.append('files', info.file); + formData.append('TableType', '1215'); + formData.append('ImageName', typeof info.file !== 'string' ? info.file?.name : ''); + if (info.filename) { + const success = await uploadPicture(formData) + if (success) { + const list = [{ + // uid: `${success.ImageId}`, // 注意,这个uid一定不能少,否则上传失败 + name: success.Result_Data.ImageName, + // status: 'done', + url: success.Result_Data.ImageUrl, // url 是展示在页面上的绝对链接 + // imgUrl: success.ImagePath // + success.ImageUrl, + }] + setFileList(list) + } + } else { + message.error("您上传的图片不存在.") + } + }, + onChange: async (info: any) => { + if (info.file.status === 'removed') { + confirm({ + title: '确认删除该图片吗?', + icon: , + async onOk() { + setFileList([]) + + // const deleteLoading = message.loading('正在删除...') + // try { + + // const deleteIndex = fileList?.findIndex((n: any) => n.uid === info.file.uid) + // const success = await deletePicture(info.file?.ImagePath, info.file?.ImageId, '1208') + // if (deleteIndex !== -1) { + // const files = [...fileList] + // files.splice(deleteIndex, 1) + // setFileList(files) + // } + // deleteLoading() + // return true + // } catch (error) { + // deleteLoading() + // return false + // } + } + }); + } + } + }} + /> + + + + + + + + + + + + + + + + ); +}; export default connect(({ user }: ConnectState) => ({ currentUser: user.currentUser }))(OrderCategoryManage); \ No newline at end of file diff --git a/src/pages/travelMember/OrderProductManage/components/OrderCategoryTree.tsx b/src/pages/travelMember/OrderProductManage/components/OrderCategoryTree.tsx new file mode 100644 index 0000000..1702703 --- /dev/null +++ b/src/pages/travelMember/OrderProductManage/components/OrderCategoryTree.tsx @@ -0,0 +1,223 @@ +import { connect } from "umi"; +import type { ConnectState } from "@/models/connect"; +import ProCard from "@ant-design/pro-card"; +import searchIcon from '@/assets/ai/searchIcon.png' +import { useRef, useState } from "react"; +import { MenuFoldOutlined } from "@ant-design/icons"; +import ProForm, { ProFormText } from "@ant-design/pro-form"; +import { Button, Col, FormInstance, Row, Tree } from "antd"; +import close from '@/assets/ai/close.png' +import { getServerpartTree } from "@/services/options"; +import useRequest from "@ahooksjs/use-request"; +import './style.less' +import { getMerchantShopTree } from "@/pages/Setting/Users/service"; +import { handlGetUSERDEFINEDTYPEList } from "../../service"; + + +type DetailProps = { + setSelectedId: any; // 把选择的服务区 可以带给外层 + reload?: boolean; // 选择服务区 是否可以刷新组件之外的内容 + actionRef?: any; // 和reload配合使用 确认要刷新的内容 + currentUser: any; // 当前用户的信息 + width?: number; // 组件的宽度 + otherFun?: any; // 点击之后要进行的其他操作 多个操作可以写在一个方法里面传进来 + setCollapsible: any; // 是否收缩组件 + collapsible: boolean; // 收缩组件的判断依据 + haveTest?: boolean;// 是否有测试服务区 + handleGetLeftTreeData?: any // 拿到树数据的方法 必须要有输出值的 + noWj?: any // 把万佳商贸隐藏 + selectOnly?: boolean// 传入的时候 仅支持单选 + setData?: any // 把树形的数据 传出去 +} +const OrderCategoryTree = ({ setSelectedId, reload, actionRef, currentUser, width, otherFun, setCollapsible, collapsible, haveTest, handleGetLeftTreeData, noWj, selectOnly, setData }: DetailProps) => { + const searchTreeRef = useRef(); + // 默认的服务区树 + const [allTreeViews, setAllTreeViews] = useState() + // 是否要显示全部 + const [isShowAllInTree, setIsShowAllInTree] = useState(false) + // 加载服务区树 + const { loading: treeLoading, data: treeViews } = useRequest(async () => { + + }) + // 显示服务区树搜索框 + const [showServiceSearchBox, setShowServiceSearchBox] = useState(false) + // 实际显示在左侧的服务区树 + const [treeView, setTreeView] = useState() + // 树要展开的行 + const [treeShowRow, setTreeShowRow] = useState() + // 筛选左侧的服务区树 + const handleFilterServiceTree = async (value?: string) => { + const resList: any = JSON.parse(JSON.stringify(allTreeViews)) + setSelectedId('') + if (resList && resList.length > 0 && value) { + setTreeView([]) + const list: any = [] + resList.forEach((item: any) => { + if (item.label.indexOf(value) !== -1) { + list.push(item) + } else { + if (item.children && item.children.length > 0) { + const childrenList: any = [] + item.children.forEach((subItem: any) => { + if (subItem.label.indexOf(value) !== -1) { + childrenList.push(subItem) + } + }) + item.children = childrenList + if (childrenList && childrenList.length > 0) { + list.push(item) + } + } + } + }) + if (list && list.length > 0) { + const keyList: any = ['0-0'] + list.forEach((item: any) => { + keyList.push(item.key) + }) + setTreeShowRow(keyList) + } + setTimeout(() => { + setTreeView(list) + }, 100) + } else { + setTreeView([]) + setTreeShowRow([]) + setTreeView(allTreeViews) + } + } + // 根据传入的服务区id筛选剔除掉这个服务区 + const handleFilterList = (list: any, id: any) => { + let res: any = [] + list.forEach((item: any) => { + if (item.value === id) { + + } else { + res.push(item) + } + }) + console.log('res', res); + return res + } + + // 仅支持单选一个服务区的时候 调用的方法 + const convertTreeForSelectOnly = (treeData: any[]): any[] => { + return treeData.map(item => { + const newItem = { + ...item, + disabled: item.type !== 1, + }; + if (item.children) { + newItem.children = convertTreeForSelectOnly(item.children); + } + return newItem; + }); + }; + + return ( +
+ + {/* { + setShowServiceSearchBox(true) + }} /> */} + { + setCollapsible(!collapsible); + }} /> +
+ { + return [] + } + }} + isKeyPressSubmit + onFinish={(values: any) => { + return handleFilterServiceTree(values?.searchValue || '') + }} + > + + + + + + + + + + + + { + setShowServiceSearchBox(false) + }} /> +
+
} + colSpan={!collapsible ? "300px" : "60px"} + title={!collapsible ? "请选择商城分类" : ""} + headerBordered + collapsed={collapsible} + > + {treeView && treeView.length > 0 ? 0 ? treeShowRow : ['0-0'] : []} + 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_ID) + console.log('selectedIdsselectedIds', selectedIds); + setSelectedId(selectedIds.map((n: any) => n?.USERDEFINEDTYPE_ID)?.toString() || '') + if (reload) { + actionRef?.current?.reload() + } + if (otherFun) { + otherFun(info) + } + }} + fieldNames={{ + title: "USERDEFINEDTYPE_NAME", + key: "USERDEFINEDTYPE_ID" + }} + /> : ''} + +
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser, +}))(OrderCategoryTree); diff --git a/src/pages/travelMember/OrderProductManage/components/style.less b/src/pages/travelMember/OrderProductManage/components/style.less new file mode 100644 index 0000000..2b979a6 --- /dev/null +++ b/src/pages/travelMember/OrderProductManage/components/style.less @@ -0,0 +1,29 @@ +.pageTable-leftnav{ + .leftSelectBox{ + position: relative; + .searchIcon{ + width: 20px; + height: 20px; + cursor: pointer; + margin-right: 15px; + } + .fixedBox{ + position: absolute; + width: 275px; + background: #fff; + right: -10px; + box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05); + border-radius: 8px; + box-sizing: border-box; + padding: 12px; + z-index: 2; + display: flex; + align-items: center; + .noBottom{ + .ant-form-item{ + margin-bottom: 0!important; + } + } + } + } + } \ No newline at end of file diff --git a/src/pages/travelMember/OrderProductManage/index.tsx b/src/pages/travelMember/OrderProductManage/index.tsx index 5a9ecf4..e07cfb3 100644 --- a/src/pages/travelMember/OrderProductManage/index.tsx +++ b/src/pages/travelMember/OrderProductManage/index.tsx @@ -1,15 +1,642 @@ // 点餐商品管理 -import { ConnectState } from "@/models/connect"; -import { connect, CurrentUser } from "umi"; +import React, { useRef, useState, Suspense } from 'react'; +import moment from 'moment'; // 时间相关引用,没有使用可以删除 +import numeral from "numeral"; // 数字相关引用,没有使用可以删除 +import { connect } from 'umi'; -const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { - return ( -
+import useRequest from '@ahooksjs/use-request'; // 请求数据的引用 +import Draggable from 'react-draggable'; +import SubMenu from "antd/lib/menu/SubMenu"; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form'; +import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +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 type { CurrentUser } from "umi"; +import type { ConnectState } from '@/models/connect'; +import type { ActionType, ProColumns } from '@ant-design/pro-table'; +import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import type { FormInstance } from 'antd'; + +import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 +import { handeDeleteCOMMODITY, handeGetCOMMODITYList, handeSynchroCOMMODITY, handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service'; +import PageTitleBox from '@/components/PageTitleBox'; +import { uploadPicture } from '@/services/picture'; +import defaultIcon from '../../../assets/brand/defaultIcon.png' +import OrderCategoryTree from './components/OrderCategoryTree'; + + +const beforeUpload = (file: any) => { + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; + if (!isJpgOrPng) { + message.error('请上传JPEG、jpg、png格式的图片文件!'); + } + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + message.error('图片大小不超过 2MB!'); + } + return isJpgOrPng && isLt2M; } + +const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const { confirm } = Modal; + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [showDetail, setShowDetail] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [searchParams, setSearchParams] = useState(); + // 分类的树形结构数据 + const [typeTreeData, setTypeTreeData] = useState() + // 表单里面的是否预售 + const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState(false) + + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + const [collapsible, setCollapsible] = useState(false) + + // 文件列表 + const [fileList, setFileList] = useState([]) + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + + const onDraggaleStart = (event, uiData) => { + const { clientWidth, clientHeight } = window.document.documentElement; + const targetRect = draggleRef.current?.getBoundingClientRect(); + if (!targetRect) { + return; + } + setBounds({ + left: -targetRect.left + uiData.x, + right: clientWidth - (targetRect.right - uiData.x), + top: -targetRect.top + uiData.y, + bottom: clientHeight - (targetRect.bottom - uiData.y), + }); + }; + // 拖动结束 + + // 定义列表字段内容 + const columns: any = [ + // { + // title: '上级类别', + // align: 'center', + // width: 150, + // ellipsis: true, + // dataIndex: 'USERDEFINEDTYPE_PID', + // hideInSearch: true, + // hideInDescriptions: true, + // }, + { + dataIndex: 'USERDEFINEDTYPE_NAME', + title: '类别名称', + align: 'center', + width: 300, + ellipsis: true, + hideInSearch: true, + hideInDescriptions: true, + render: (_, record) => { + return
+ + {record?.USERDEFINEDTYPE_NAME} +
+ } + }, + { + dataIndex: 'USERDEFINEDTYPE_INDEX', + title: '类别索引', + align: 'center', + width: 120, + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'USERDEFINEDTYPE_STATE', + title: '有效状态', + align: 'center', + width: 120, + ellipsis: true, + valueType: "select", + valueEnum: { + "1": "有效", + "0": "无效" + }, + initialValue: "1" + }, + { + dataIndex: 'SCANCODE_ORDER', + title: '上架状态', + align: 'center', + width: 120, + ellipsis: true, + hideInSearch: true, + valueType: "select", + valueEnum: { + "1": "上架", + "0": "下架" + } + }, + { + dataIndex: "PRESALE_TYPE", + title: "是否预售", + align: 'center', + hideInSearch: true, + width: 120, + ellipsis: true, + valueType: "select", + valueEnum: { + "0": "否", + "1": "是" + } + }, + { + dataIndex: 'OWNERUNIT_NAME', + title: '业主单位', + align: 'center', + width: 180, + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'option', + title: '操作', + width: 100, + ellipsis: true, + valueType: 'option', + align: 'center', + hideInSearch: true, + render: (_, record) => { + return ( + + { + console.log('recordrecordrecord', record); + if (record?.USERDEFINEDTYPE_ICO) { + setFileList([{ + name: "", + url: record?.USERDEFINEDTYPE_ICO + }]) + } + + if (record?.PRESALE_TYPE) { + setFormPRESALE_TYPE(true) + } + + + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + > + 编辑 + + { + handelDelete(record.USERDEFINEDTYPE_ID); + }} + > + 删除 + + + ); + }, + }, + ]; + + // 预览上传后的图片 + const handlePreview = async () => { + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + + const handelDelete = async (commodityid: number) => { + const result = await handeDeleteCOMMODITY({ COMMODITYId: commodityid }); + + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + } + }; + + const handleAddUpdate = async (res: any) => { + let req: any = {} + if (currentRow?.USERDEFINEDTYPE_ID) { + req = { + ...currentRow, + ...res, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + PROVINCE_CODE: currentUser?.ProvinceCode, + OPERATE_PERSON: currentUser?.ID, + COMMODITY_TYPE: 3000, + OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } else { + req = { + ...res, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + PROVINCE_CODE: currentUser?.ProvinceCode, + OPERATE_PERSON: currentUser?.ID, + COMMODITY_TYPE: 3000, + OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } + const data = await handeSynchroCOMMODITY(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) + } + }; + + return ( +
+
+ + +
+ { + return `${record?.USERDEFINEDTYPE_PID}-${record?.USERDEFINEDTYPE_ID}` + }} + formRef={formRef} + headerTitle={} // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + bordered + // 请求数据 + request={async (params, sorter) => { + const req = { + searchParameter: { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: currentUser?.ProvinceCode, + USERDEFINEDTYPE_IDS: selectedId, + UPPER_STATE: params?.UPPER_STATE, + DUTY_PARAGRAPH: params?.DUTY_PARAGRAPH === "-1" ? "" : params?.DUTY_PARAGRAPH, + COMMODITY_TYPE: 3000 + }, + PageIndex: 1, + PageSize: 999999, + } + const data = await handeGetCOMMODITYList(req); + console.log('datadatadatadatadata', data); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + columns={columns} + toolbar={{ + actions: [ + // 新增按钮 + , + ], + }} + /> +
+
+ {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新商品自定义类别' : '新建商品自定义类别'} +
+ } + destroyOnClose={true} + width={900} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + > +
{modal}
+
+ }} + > + { + let newValue = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, USERDEFINEDTYPE_ID: currentRow.USERDEFINEDTYPE_ID }; + } + + + console.log('fileListfileList', fileList); + console.log('newValuenewValuenewValue', newValue); + + // 如果有开关,要把开关的代码写进去 + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + setFormPRESALE_TYPE(false) + }} + > + + + { + if (typeTreeData && typeTreeData.length > 0) { + let list: any = [{ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }, ...typeTreeData] + return list + } else { + const req = { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: "", + GOODSTYPE: 4000, + } + const data = await handlGetUSERDEFINEDTYPEList(req); + console.log('datadatadatadatadata', data); + if (data.List && data.List.length > 0) { + data.List.unshirft({ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }) + setTypeTreeData(data.List) + return data.List + } else { + return [{ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }] + } + } + }} + fieldProps={{ + fieldNames: { + label: 'USERDEFINEDTYPE_NAME', + value: 'USERDEFINEDTYPE_ID', + children: 'children' + }, + showSearch: true, + filterTreeNode: (input, node) => + (node.USERDEFINEDTYPE_NAME || '').toLowerCase().includes(input.toLowerCase()) + }} + rules={[ + { + required: true, + message: "请选择上级类别" + } + ]} + /> + + + + + + + + + + + + + + + { + setFormPRESALE_TYPE(e) + } + }} + /> + + { + formPRESALE_TYPE ? + + + + : "" + } + + { + const formData = new FormData(); + formData.append('files', info.file); + formData.append('TableType', '1215'); + formData.append('ImageName', typeof info.file !== 'string' ? info.file?.name : ''); + if (info.filename) { + const success = await uploadPicture(formData) + if (success) { + const list = [{ + // uid: `${success.ImageId}`, // 注意,这个uid一定不能少,否则上传失败 + name: success.Result_Data.ImageName, + // status: 'done', + url: success.Result_Data.ImageUrl, // url 是展示在页面上的绝对链接 + // imgUrl: success.ImagePath // + success.ImageUrl, + }] + setFileList(list) + } + } else { + message.error("您上传的图片不存在.") + } + }, + onChange: async (info: any) => { + if (info.file.status === 'removed') { + confirm({ + title: '确认删除该图片吗?', + icon: , + async onOk() { + setFileList([]) + + // const deleteLoading = message.loading('正在删除...') + // try { + + // const deleteIndex = fileList?.findIndex((n: any) => n.uid === info.file.uid) + // const success = await deletePicture(info.file?.ImagePath, info.file?.ImageId, '1208') + // if (deleteIndex !== -1) { + // const files = [...fileList] + // files.splice(deleteIndex, 1) + // setFileList(files) + // } + // deleteLoading() + // return true + // } catch (error) { + // deleteLoading() + // return false + // } + } + }); + } + } + }} + /> + + + + + + + + + + + + + + +
+ ); +}; export default connect(({ user }: ConnectState) => ({ currentUser: user.currentUser }))(OrderProductManage); \ No newline at end of file diff --git a/src/pages/travelMember/ProductListingManagement/index.tsx b/src/pages/travelMember/ProductListingManagement/index.tsx index d750ab0..903f30c 100644 --- a/src/pages/travelMember/ProductListingManagement/index.tsx +++ b/src/pages/travelMember/ProductListingManagement/index.tsx @@ -345,6 +345,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop OWNERUNIT_NAME: currentUser?.OwnerUnitName, PROVINCE_CODE: currentUser?.ProvinceCode, OPERATE_PERSON: currentUser?.ID, + COMMODITY_TYPE: 4000, OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), } } else { @@ -354,6 +355,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop OWNERUNIT_NAME: currentUser?.OwnerUnitName, PROVINCE_CODE: currentUser?.ProvinceCode, OPERATE_PERSON: currentUser?.ID, + COMMODITY_TYPE: 4000, OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), } } @@ -402,7 +404,8 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop PROVINCE_CODE: currentUser?.ProvinceCode, USERDEFINEDTYPE_IDS: selectedId, 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 }, PageIndex: 1, PageSize: 999999, diff --git a/src/pages/travelMember/serverpartInfo/components/serverpartInfo.tsx b/src/pages/travelMember/serverpartInfo/components/serverpartInfo.tsx new file mode 100644 index 0000000..66fbf68 --- /dev/null +++ b/src/pages/travelMember/serverpartInfo/components/serverpartInfo.tsx @@ -0,0 +1,910 @@ +import React, { useRef, useState, Suspense, useImperativeHandle, useEffect } from 'react'; +import moment from 'moment'; // 时间相关引用,没有使用可以删除 +import numeral from "numeral"; // 数字相关引用,没有使用可以删除 +import { connect } from 'umi'; +import useRequest from '@ahooksjs/use-request'; // 请求数据的引用 +import Draggable from 'react-draggable'; +import SubMenu from "antd/lib/menu/SubMenu"; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from '@ant-design/pro-form'; +import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +import { PageContainer } from '@ant-design/pro-layout'; +import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect, Divider, Radio } from 'antd'; +import type { CurrentUser } from "umi"; +import type { ConnectState } from '@/models/connect'; +import type { ActionType, ProColumns } from '@ant-design/pro-table'; +import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import type { FormInstance } from 'antd'; +import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 +import { handleGetServerpartInfo, handleNewGetSERVERPARTDetail } from '@/pages/newDataAnalysis/service'; +import session from '@/utils/session'; +import { handleGetNOTICEINFOList } from '@/pages/basicManage/highwayHeadlines/service'; + + +type DetailProps = { + currentRow?: any; + onShow?: boolean; + onRef?: any +} +const SERVERPARTTable = ({ currentRow, onShow, onRef }: DetailProps) => { + const actionRef = useRef(); + const formRef = useRef(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + // 服务区类型 + const [serverPartType, setServerPartType] = useState(2) + // 表单请求服务区的详情 + const [serverPartDetail, setServerPartDetail] = useState() + // 表单请求服务区的详情 + const [formDetailAll, setFormDetailAll] = useState() + + const LOADBEARINGList = session.get('LOADBEARINGList') + + // 拖动结束 + // 站点类型(服务区、加油站、单位部门)枚举解析 + const { data: serverpartsite_typeTree = [] } = useRequest(async () => { + return await getFieldEnumTree({ FieldExplainField: 'SERVERPARTSITE_TYPE', sessionName: 'SERVERPARTSITE_TYPE' }) + }) + // 统计类型(1000:正式,2000:测试,3000:替代)枚举解析 + const { data: datastatistics_typeTree = [] } = useRequest(async () => { + return await getFieldEnumTree({ FieldExplainField: 'DATASTATISTICS_TYPE', sessionName: 'DATASTATISTICS_TYPE' }) + }) + // 服务区类型枚举解析 + const { data: serverpart_typeTree = [] } = useRequest(async () => { + return await getFieldEnumTree({ FieldExplainField: 'SERVERPART_TYPE', sessionName: 'SERVERPART_TYPE' }) + }) + + useImperativeHandle(onRef, () => ({ + formRef, + serverPartDetail, + formDetailAll + })); + + useEffect(() => { + if (onShow) { + + } + }, [onShow]) + + + + return ( +
+ { + if (currentRow?.SERVERPART_ID) { + const req: any = { + ServerpartId: currentRow?.SERVERPART_ID + } + const data = await handleNewGetSERVERPARTDetail(req) + console.log('detaildsdas', data); + + + const carryReq: any = { + SearchParameter: { + NOTICEINFO_TYPES: "3020", + SERVERPART_ID: currentRow?.SERVERPART_ID + } + } + const carryData = await handleGetNOTICEINFOList(carryReq) + console.log('carryDatacarryData', carryData); + + + setServerPartDetail(data) + const regionInfoList: any = data.ServerPartInfo + const serviceA: any = {} + const serviceB: any = {} + if (regionInfoList && regionInfoList.length > 0) { + setServerPartType(regionInfoList.length === 1 ? 1 : 2) + regionInfoList.forEach((item: any, index: number) => { + if (index === 0) { + for (const key in item) { + serviceA[`${key}_A`] = item[key] ? item[key] : item[key] === 0 ? 0 : '' + } + } else { + for (const key in item) { + serviceB[`${key}_B`] = item[key] ? item[key] : item[key] === 0 ? 0 : '' + } + } + }) + } + console.log('serviceA', serviceA); + console.log('serviceB', serviceB); + + const obj: any = { + ...data, + ...data.RtServerPart, + ...serviceA, + ...serviceB, + carryingCapacity: carryData && carryData.length > 0 ? Number(carryData[0].FEEDBACK_CONTENT) : "", + carryingCapacityObj: carryData && carryData.length > 0 ? carryData[0] : "" + } + console.log('dataProForm', obj); + setFormDetailAll(obj) + return obj + } + return {} + }} + onFinish={async (values) => { + }} + > + + 基本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 面积相关 + + + + + + + + + + + + + + + + + { + setServerPartType(Number(e.target.value)) + }} value={serverPartType}> + 服务区单侧 + 服务区双侧 + + + + + + + + { + if (currentRow?.SERVERPART_ID) { + const req: any = { + ServerpartId: currentRow?.SERVERPART_ID + } + const regData = await handleNewGetSERVERPARTDetail(req) + const list: any = regData.ServerPartInfo + + console.log('regData', regData); + console.log('formDetailAll', formDetailAll); + + if (list && list.length > 0) { + const obj: any = session.get('shopregionObj') + const res: any = [] + list.forEach((item: any) => { + if (item.SERVERPART_REGION) { + res.push({ label: obj[item.SERVERPART_REGION], value: item.SERVERPART_REGION }) + } + }) + console.log('res', res); + formRef.current?.setFieldsValue({ currentArea: res[0].value }) + return res + } + } + }} + /> + + + + + + + {/* 下面开始是一个方位区一块的内容 */} + + 面积相关 + + + + + + + + + + + + 加油信息 + + + + + + + + + + + + + 充电信息 + + + + + + + + + + + + + + + + + + + 服务信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 车位信息 + + + + + + + + + + + + + + + + + + 经营信息 + + + + + + + + + + + + + + + + + + + + + { + serverPartType === 2 ? + <> + 对向信息 + + + + { + // let list = session.get('shopregionList') + // return list + if (currentRow?.SERVERPART_ID) { + const req: any = { + ServerpartId: currentRow?.SERVERPART_ID + } + const regData = await handleNewGetSERVERPARTDetail(req) + const list: any = regData.ServerPartInfo + console.log('list', list); + + if (list && list.length > 0) { + const obj: any = session.get('shopregionObj') + + const res: any = [] + list.forEach((item: any) => { + if (item.SERVERPART_REGION) { + res.push({ label: obj[item.SERVERPART_REGION], value: item.SERVERPART_REGION }) + } + }) + console.log('res', res); + const other: any = formRef.current?.getFieldValue('currentArea') + res.forEach((item: any) => { + if (Number(item.value) !== Number(other)) { + formRef.current?.setFieldsValue({ otherArea: item.value }) + } + }) + return res + } + } + }} + /> + + + 面积相关 + + + + + + + + + + + + 加油信息 + + + + + + + + + + + + + 充电信息 + + + + + + + + + + + + + + + + + + + 服务信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 车位信息 + + + + + + + + + + + + + + + + + + 经营信息 + + + + + + + + + + + + + + + + + + + + + + : '' + } + + +
+ ); +}; +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(SERVERPARTTable); diff --git a/src/pages/travelMember/serverpartInfo/index.tsx b/src/pages/travelMember/serverpartInfo/index.tsx new file mode 100644 index 0000000..706f9c1 --- /dev/null +++ b/src/pages/travelMember/serverpartInfo/index.tsx @@ -0,0 +1,299 @@ +import { connect } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { useRef, useState } from "react"; +import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSelectTree"; +import ServerpartInfo from "./components/serverpartInfo"; +import ProCard from "@ant-design/pro-card"; +import { MenuFoldOutlined } from "@ant-design/icons"; +import { Button, message, Tree } from "antd"; +import LoadingBox from "@/pages/reports/Finance/businessAnalysis/components/loading"; +import session from "@/utils/session"; +import moment from 'moment' +import { handleSynchroSERVERPART } from "@/pages/newDataAnalysis/service"; +import useRequest from "@ahooksjs/use-request"; +import { getServerpartTree } from "@/services/options"; +import { handleSynchroNOTICEINFO } from "@/pages/basicManage/highwayHeadlines/service"; + + +const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { currentUser } = props + const [collapsible, setCollapsible] = useState(false) + const [treeView, setTreeView] = useState() + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + // 显示右边的表单 + const [showRightForm, setShowRightForm] = useState(true) + const serverPartRef = useRef() + const shopregionObj = session.get('shopregionObj') + + const { loading: treeLoading, data: treeViews } = useRequest(async () => { + const data = await getServerpartTree(currentUser?.ProvinceCode, currentUser?.CityAuthority, true, true, true) + + let list: any = [] + data.forEach((item: any) => { + if (item.value !== 424) { + list.push(item) + } + }) + setTreeView(list) + return data + }) + + + // 保存方法 + const handleSubmitForm = async () => { + let res: any = serverPartRef.current?.formRef.current?.getFieldsValue() + console.log('res', res); + // 表单查到的详情 更新里面的全部数据 + let detailObj: any = serverPartRef.current?.serverPartDetail + console.log('detailObj', detailObj); + let formDetailAll: any = serverPartRef.current?.formDetailAll + console.log('formDetailAll', formDetailAll); + + // 把分区的数据取出来 + let objA: any = { + SERVERPART_REGION: res?.currentArea, + SERVERPART_REGIONNAME: res?.currentArea ? shopregionObj[res?.currentArea] : '', + + } + let objB: any = { + SERVERPART_REGION: res?.otherArea, + SERVERPART_REGIONNAME: res?.otherArea ? shopregionObj[res?.otherArea] : '' + } + for (let key in res) { + if (key.indexOf('_A') > 0) { + let newKey: string = key.split('_A')[0] + objA[newKey] = res[key] + } else if (key.indexOf('_B') > 0) { + let newKey: string = key.split('_B')[0] + objB[newKey] = res[key] + } + } + // 详情里面本身的服务区数组数据 + let detailServerPartList: any = detailObj?.ServerPartInfo + if (detailServerPartList && detailServerPartList.length === 2) { + detailServerPartList.forEach((item: any) => { + if (Number(item.SERVERPART_REGION) === Number(objA.SERVERPART_REGION)) { + objA.SERVERPARTINFO_ID = item.SERVERPARTINFO_ID + objA.SERVERPART_ID = selectedId + objA.GREENSPACEAREA = item.GREENSPACEAREA + objA.SCENICAREA = item.SCENICAREA + } + if (Number(item.SERVERPART_REGION) === Number(objB.SERVERPART_REGION)) { + objB.SERVERPARTINFO_ID = item.SERVERPARTINFO_ID + objB.SERVERPART_ID = selectedId + objB.GREENSPACEAREA = item.GREENSPACEAREA + objB.SCENICAREA = item.SCENICAREA + } + }) + } else { + if (objB.SERVERPART_REGION) { + objB.SERVERPART_ID = selectedId + } + } + + + const req: any = { + SERVERPART_ID: detailObj?.SERVERPART_ID, + SERVERPART_NAME: res?.SERVERPART_NAME, + SERVERPART_ADDRESS: res?.SERVERPART_ADDRESS, + SERVERPART_INDEX: res?.SERVERPART_INDEX, + EXPRESSWAY_NAME: res?.EXPRESSWAY_NAME, + SELLERCOUNT: detailObj?.SELLERCOUNT, + SERVERPART_AREA: res?.SERVERPART_AREA, + SERVERPART_X: res?.SERVERPART_X, + SERVERPART_Y: res?.SERVERPART_Y, + SERVERPART_TEL: detailObj?.SERVERPART_TEL, + SERVERPART_INFO: res?.SERVERPART_INFO, + PROVINCE_CODE: detailObj?.PROVINCE_CODE, + SERVERPART_CODE: res?.SERVERPART_CODE, + SERVERPART_TYPE: res?.SERVERPART_TYPE, + STARTDATE: res?.STARTDATE, + OWNEDCOMPANY: res?.OWNEDCOMPANY, + FLOORAREA: res?.FLOORAREA, + BUSINESSAREA: detailObj?.BUSINESSAREA, + SHAREAREA: res?.SHAREAREA, + MANAGERCOMPANY: res?.MANAGERCOMPANY, + SPREGIONTYPE_ID: detailObj?.SPREGIONTYPE_ID, + SPREGIONTYPE_NAME: detailObj?.SPREGIONTYPE_NAME, + SPREGIONTYPE_INDEX: detailObj?.SPREGIONTYPE_INDEX, + STATISTICS_TYPE: detailObj?.STATISTICS_TYPE, + FIELDENUM_ID: detailObj?.FIELDENUM_ID, + CITY_CODE: detailObj?.CITY_CODE, + COUNTY_CODE: detailObj?.COUNTY_CODE, + SERVERPART_IPADDRESS: detailObj?.SERVERPART_IPADDRESS, + DAYINCAR: detailObj?.DAYINCAR, + HKBL: detailObj?.HKBL, + TOTALPARKING: detailObj?.TOTALPARKING, + SHORTNAME: detailObj?.SHORTNAME, + REGIONTYPE_ID: detailObj?.REGIONTYPE_ID, + STATISTIC_TYPE: detailObj?.STATISTIC_TYPE, + PROVINCE_NAME: detailObj?.PROVINCE_NAME, + REGIONTYPE_NAME: detailObj?.REGIONTYPE_NAME, + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + SERVERPART_DESC: detailObj?.SERVERPART_DESC, + OWNERUNIT_ID: detailObj?.OWNERUNIT_ID, + OWNERUNIT_NAME: detailObj?.OWNERUNIT_NAME, + RtServerPart: { + RTSERVERPART_ID: detailObj?.RtServerPart?.RTSERVERPART_ID, + SERVERPART_ID: detailObj?.RtServerPart?.SERVERPART_ID, + SERVERPART_ADDRESS: res?.SERVERPART_ADDRESS, + EXPRESSWAY_NAME: res?.EXPRESSWAY_NAME, + SELLERCOUNT: detailObj?.RtServerPart?.SELLERCOUNT, + SERVERPART_X: res?.SERVERPART_X, + SERVERPART_Y: res?.SERVERPART_Y, + SERVERPART_TEL: detailObj?.RtServerPart?.SERVERPART_TEL, + STARTDATE: res?.STARTDATE, + SERVERPART_AREA: res?.SERVERPART_AREA, + FLOORAREA: res?.FLOORAREA, + BUSINESSAREA: detailObj?.RtServerPart?.BUSINESSAREA, + SHAREAREA: res?.SHAREAREA, + TOTALPARKING: detailObj?.RtServerPart?.TOTALPARKING, + OWNEDCOMPANY: res?.OWNEDCOMPANY, + MANAGERCOMPANY: res?.MANAGERCOMPANY, + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + SERVERPART_INFO: res?.SERVERPART_INFO, + CENTERSTAKE_NUM: res?.CENTERSTAKE_NUM, + TAXPAYER_IDENTIFYCODE: res?.TAXPAYER_IDENTIFYCODE, + WATERINTAKE_TYPE: res?.WATERINTAKE_TYPE, + SEWAGEDISPOSAL_TYPE: res?.SEWAGEDISPOSAL_TYPE, + BUSINESS_REGION: detailObj?.RtServerPart?.BUSINESS_REGION, + }, + ServerPartInfo: objB.SERVERPART_REGION ? [objA, objB] : [objA] + } + console.log('req', req); + const data = await handleSynchroSERVERPART(req) + + + if (res.carryingCapacity) { + let carryReq: any = {} + if (formDetailAll?.carryingCapacity) { + carryReq = { + ...formDetailAll.carryingCapacityObj, + NOTICEINFO_TYPE: "3020", + SERVERPART_ID: selectedId, + FEEDBACK_CONTENT: res.carryingCapacity + } + } else { + carryReq = { + NOTICEINFO_TYPE: "3020", + SERVERPART_ID: selectedId, + FEEDBACK_CONTENT: res.carryingCapacity + } + } + console.log('carryReq', carryReq); + const carryData = await handleSynchroNOTICEINFO(carryReq) + console.log('carryData', carryData); + } else { + if (formDetailAll?.carryingCapacity) { + let carryReq: any = { + ...formDetailAll.carryingCapacity, + FEEDBACK_CONTENT: "" + } + console.log('carryReq2', carryReq); + const carryData = await handleSynchroNOTICEINFO(carryReq) + console.log('carryData2', carryData); + } + } + + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + setShowRightForm(false) + setTimeout(() => { + setShowRightForm(true) + }, 1000) + } else { + message.error(data.Result_Desc) + } + } + + return ( +
+
+ { + setCollapsible(!collapsible); + }} rev={undefined} /> + } + > + {treeView && treeView.length > 0 ? { + setShowRightForm(false) + const selectedIds = info.selectedNodes.filter((n: any) => n?.type === 1) + console.log('selectedIds', selectedIds); + + setSelectedId(selectedIds.map(n => n?.value)?.toString() || '') + console.log('serverPartRef', serverPartRef.current?.formRef); + if (selectedIds && selectedIds.length > 0) { + setTimeout(() => { + setShowRightForm(true) + }, 1000) + } else { + setTimeout(() => { + setShowRightForm(true) + }, 1) + serverPartRef.current?.formRef.current?.setFieldsValue({}) + } + + }} + /> : ''} + +
+
+ { + showRightForm ? + : + + } +
+
+ { + selectedId ? + : '' + } +
+ +
+
+
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(serverpartInfo); diff --git a/src/pages/travelMember/service.ts b/src/pages/travelMember/service.ts index 2fac3a7..0ab835a 100644 --- a/src/pages/travelMember/service.ts +++ b/src/pages/travelMember/service.ts @@ -380,3 +380,26 @@ export async function handeGetSALEBILLList(params: any) { return data.Result_Data } +// 获取商城评价列表 +export async function handeGetMALLCOMMENTList(params: any) { + const data = await requestEncryption(`/Comment/GetMALLCOMMENTList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} + +// 删除商品评价列表 +export async function handeDeleteMALLCOMMENT(params: any) { + const data = await requestEncryption(`/Comment/DeleteMALLCOMMENT`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} \ No newline at end of file