Commit f1314728 authored by linweijiong's avatar linweijiong

fix:报表需求

parent 78968125
{"userRegister":{"useType":[{"memberTypeId":1,"memberTypeName":"企业供应商","businessTypes":[{"businessTypeId":2,"businessTypeName":"采购商"},{"businessTypeId":3,"businessTypeName":"供应商"}]},{"memberTypeId":2,"memberTypeName":"个人供应商","businessTypes":[]},{"memberTypeId":3,"memberTypeName":"渠道企业供应商","businessTypes":[]},{"memberTypeId":4,"memberTypeName":"渠道个人供应商","businessTypes":[]}]},"web":{"shopInfo":[{"id":1,"name":"金发采购门户","type":6,"environment":1,"property":1,"self":null,"memberOperate":0,"openMro":0,"logoUrl":"https://minio.es1688.com/srm-uat/srm/008ded90668502ebfdc11a473885a727.png","describe":null,"state":1,"url":"srm","isDefault":1,"createTime":1659955762359}],"orderMode":[{"id":20,"platformType":3,"platformWayName":"框架合同下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":19,"platformType":3,"platformWayName":"未知","isPitchOn":1,"platformTypeName":"下单模式"},{"id":18,"platformType":3,"platformWayName":"未知","isPitchOn":1,"platformTypeName":"下单模式"},{"id":17,"platformType":3,"platformWayName":"未知","isPitchOn":1,"platformTypeName":"下单模式"},{"id":16,"platformType":3,"platformWayName":"请购单合同下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":15,"platformType":3,"platformWayName":"请购单下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":14,"platformType":3,"platformWayName":"采购招标合同下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":13,"platformType":3,"platformWayName":"采购竞价合同下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":12,"platformType":3,"platformWayName":"采购询价合同下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":11,"platformType":3,"platformWayName":"渠道积分下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":10,"platformType":3,"platformWayName":"积分下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":9,"platformType":3,"platformWayName":"渠道现货手工下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":8,"platformType":3,"platformWayName":"渠道现货进货单下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":7,"platformType":3,"platformWayName":"渠道直采手工下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":6,"platformType":3,"platformWayName":"渠道直采进货单下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":5,"platformType":3,"platformWayName":"合并订单下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":4,"platformType":3,"platformWayName":"需求报价下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":3,"platformType":3,"platformWayName":"询价报价下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":2,"platformType":3,"platformWayName":"手工下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":1,"platformType":3,"platformWayName":"进货单下单","isPitchOn":1,"platformTypeName":"下单模式"}],"orderType":[{"id":18,"platformType":4,"platformWayName":"框架合同订单","isPitchOn":1,"platformTypeName":"订单类型"},{"id":15,"platformType":4,"platformWayName":"手工物料订单","isPitchOn":1,"platformTypeName":"订单类型"},{"id":14,"platformType":4,"platformWayName":"请购单合同","isPitchOn":1,"platformTypeName":"订单类型"},{"id":8,"platformType":4,"platformWayName":"渠道积分兑换","isPitchOn":1,"platformTypeName":"订单类型"}]},"global":{"siteInfo":{"id":1,"name":"金发采购商城","logo":"https://minio.es1688.com/srm-uat/srm/008ded90668502ebfdc11a473885a727.png","siteUrl":"jinfa1102-platform-test.shushangyun.com","symbol":"¥","language":"China","enableMultiTenancy":0},"imConfig":null},"publicSelect":{"siteList":[{"name":"简体中文-ZH","key":"zh-CN","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/china.png"},{"name":"English-EN","key":"en-US","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png"},{"name":"한국어-KO","key":"ko-KR","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png"}]}}
{"userRegister":{"useType":[{"memberTypeId":1,"memberTypeName":"企业供应商","businessTypes":[{"businessTypeId":2,"businessTypeName":"采购商"},{"businessTypeId":3,"businessTypeName":"供应商"}]},{"memberTypeId":2,"memberTypeName":"个人供应商","businessTypes":[]},{"memberTypeId":3,"memberTypeName":"渠道企业供应商","businessTypes":[]},{"memberTypeId":4,"memberTypeName":"渠道个人供应商","businessTypes":[]}]},"web":{"shopInfo":[{"id":1,"name":"金发采购门户","type":6,"environment":1,"property":1,"self":null,"memberOperate":0,"openMro":0,"logoUrl":"https://minio.es1688.com/srm-uat/srm/008ded90668502ebfdc11a473885a727.png","describe":null,"state":1,"url":"srm","isDefault":1,"createTime":1659955762359}],"orderMode":[{"id":20,"platformType":3,"platformWayName":"框架合同下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":19,"platformType":3,"platformWayName":"商品样品订单下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":18,"platformType":3,"platformWayName":"物料样品订单下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":17,"platformType":3,"platformWayName":"手工物料订单下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":16,"platformType":3,"platformWayName":"请购单合同下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":15,"platformType":3,"platformWayName":"请购单下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":14,"platformType":3,"platformWayName":"采购招标合同下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":13,"platformType":3,"platformWayName":"采购竞价合同下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":12,"platformType":3,"platformWayName":"采购询价合同下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":11,"platformType":3,"platformWayName":"渠道积分下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":10,"platformType":3,"platformWayName":"积分下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":9,"platformType":3,"platformWayName":"渠道现货手工下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":8,"platformType":3,"platformWayName":"渠道现货进货单下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":7,"platformType":3,"platformWayName":"渠道直采手工下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":6,"platformType":3,"platformWayName":"渠道直采进货单下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":5,"platformType":3,"platformWayName":"合并订单下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":4,"platformType":3,"platformWayName":"需求报价下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":3,"platformType":3,"platformWayName":"询价报价下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":2,"platformType":3,"platformWayName":"手工下单","isPitchOn":1,"platformTypeName":"下单模式"},{"id":1,"platformType":3,"platformWayName":"进货单下单","isPitchOn":1,"platformTypeName":"下单模式"}],"orderType":[{"id":18,"platformType":4,"platformWayName":"框架合同订单","isPitchOn":1,"platformTypeName":"订单类型"},{"id":17,"platformType":4,"platformWayName":"商品样品订单","isPitchOn":1,"platformTypeName":"订单类型"},{"id":16,"platformType":4,"platformWayName":"物料样品订单","isPitchOn":1,"platformTypeName":"订单类型"},{"id":15,"platformType":4,"platformWayName":"手工物料订单","isPitchOn":1,"platformTypeName":"订单类型"},{"id":14,"platformType":4,"platformWayName":"请购单合同","isPitchOn":1,"platformTypeName":"订单类型"},{"id":13,"platformType":4,"platformWayName":"跨境电商进口","isPitchOn":1,"platformTypeName":"订单类型"},{"id":12,"platformType":4,"platformWayName":"请购单采购","isPitchOn":1,"platformTypeName":"订单类型"},{"id":11,"platformType":4,"platformWayName":"采购招标合同","isPitchOn":1,"platformTypeName":"订单类型"},{"id":10,"platformType":4,"platformWayName":"采购竞价合同","isPitchOn":1,"platformTypeName":"订单类型"},{"id":9,"platformType":4,"platformWayName":"采购询价合同","isPitchOn":1,"platformTypeName":"订单类型"},{"id":8,"platformType":4,"platformWayName":"渠道积分兑换","isPitchOn":1,"platformTypeName":"订单类型"},{"id":7,"platformType":4,"platformWayName":"积分兑换","isPitchOn":1,"platformTypeName":"订单类型"},{"id":6,"platformType":4,"platformWayName":"渠道现货","isPitchOn":1,"platformTypeName":"订单类型"},{"id":5,"platformType":4,"platformWayName":"渠道直采","isPitchOn":1,"platformTypeName":"订单类型"},{"id":4,"platformType":4,"platformWayName":"集采","isPitchOn":1,"platformTypeName":"订单类型"},{"id":3,"platformType":4,"platformWayName":"现货采购","isPitchOn":1,"platformTypeName":"订单类型"},{"id":2,"platformType":4,"platformWayName":"需求采购","isPitchOn":1,"platformTypeName":"订单类型"},{"id":1,"platformType":4,"platformWayName":"询价采购","isPitchOn":1,"platformTypeName":"订单类型"}]},"global":{"siteInfo":{"id":1,"name":"金发采购商城","logo":"https://minio.es1688.com/srm-uat/srm/acb055afd56378d5c5c67bf6e884b7ed.png","siteUrl":"jinfa1102-platform-test.shushangyun.com","symbol":"¥","language":"China","enableMultiTenancy":0},"imConfig":null},"publicSelect":{"siteList":[{"name":"简体中文-ZH","key":"zh-CN","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/china.png"},{"name":"English-EN","key":"en-US","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png"},{"name":"한국어-KO","key":"ko-KR","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png"}]}}
......@@ -21,6 +21,7 @@ import OrderRoute from './orderRoute'; // 订单能力
import customerAbilityRoute from './customerAbilityRoute'; // 客户能力
import asyncRoutes from '../router.config.json';
import ProcurementRoute from './procurementRoute'; //请购单
import statisticRoute from './statisticRoute'; //报表服务
// import { callForBidsRoute } from './procurementRoute/callForBids';
// import { purchaseInquiryRoute } from './procurementRoute/purchaseInquiry';
......@@ -78,6 +79,7 @@ const routes = isDev
BalancedRoute,
MemberRoute,
OrderRoute,
statisticRoute,
AuthConfigRoute
]
: asyncRoutes;
......
// import { RouterChild } from '../utils/index';
const statisticRoute = {
path: '/memberCenter/statisticAbility',
name: '报表',
icon: 'commodity',
routes: [
/* 商品报表 */
{
path: '/memberCenter/statisticAbility/commodity',
name: '商品统计',
routes: [
// {
// path: '/memberCenter/statisticAbility/commodity/materialReport',
// name: '物料报表',
// component: '@/pages/contract/ElectronicSignature/apply',
// },
{
path: '/memberCenter/statisticAbility/commodity/priceReport',
name: '价格报表',
component: '@/pages/statistic/priceManage/priceReport',
}
],
},
/* 供应商报表 */
{
path: '/memberCenter/statisticAbility/supplierAggregate',
name: '供应商统计',
routes: [
{
path: '/memberCenter/statisticAbility/supplierAggregate/complaintReport',
name: '投诉报表',
component: '@/pages/statistic/complaintReport',
},
// {
// path: '/memberCenter/statisticAbility/supplierAggregate/appraisal',
// name: '考评统计',
// component: '@/pages/statistic/appraisal',
// },
// {
// path:
// '/memberCenter/contract/ElectronicSignature/enterpriseCertified',
// name: 'enterpriseCertified',
// hideInMenu: true,
// component:
// '@/pages/contract/ElectronicSignature/enterpriseCertified/index',
// },
],
},
/* 请购单报表 */
{
path: '/memberCenter/statisticAbility/purchaseStatistics',
name: '请购单统计',
routes: [
{
path: '/memberCenter/statisticAbility/purchaseStatistics/purchaseReport',
name: '请购单执行报表',
component: '@/pages/statistic/purchaseStatistics/purchaseReport',
},
{
path: '/memberCenter/statisticAbility/purchaseStatistics/purchaseRound',
name: '采购周期测算',
component: '@/pages/statistic/purchaseStatistics/purchaseRound',
},
],
},
/* 合同统计 */
{
path: '/memberCenter/statisticAbility/contractStatistics',
name: '合同统计',
routes: [
{
path: '/memberCenter/statisticAbility/contractStatistics/buyerSrmContract',
name: '合同执行报表(采购商)',
component: '@/pages/statistic/contractStatistics/buyerSrmContract',
},
{
path: '/memberCenter/statisticAbility/contractStatistics/contractExpend',
name: '合同采购支出分析(采购商)',
component: '@/pages/statistic/contractStatistics/contractExpend',
},
],
},
/* 订单统计 */
{
path: '/memberCenter/statisticAbility/orderStatistics',
name: '订单统计',
routes: [
{
path: '/memberCenter/statisticAbility/orderStatistics/orderSrm',
name: '订单报表(SRM)',
component: '@/pages/statistic/orderStatistics/orderSrm',
},
{
path: '/memberCenter/statisticAbility/orderStatistics/proportionAnalysis',
name: '订单采购量占比分析',
component: '@/pages/statistic/orderStatistics/proportionAnalysis',
},
],
},
/* 结算统计 */
{
path: '/memberCenter/statisticAbility/settleStatistics',
name: '结算统计',
routes: [
{
path: '/memberCenter/statisticAbility/settleStatistics/readySettleRanking',
name: '待结算采购排行',
component: '@/pages/statistic/settleStatistics/readySettleRanking',
},
{
path: '/memberCenter/statisticAbility/settleStatistics/settleAuditPage',
name: '财务按期付款时效',
component: '@/pages/statistic/settleStatistics/settleAuditPage',
},
],
},
/* 审核统计 */
{
path: '/memberCenter/statisticAbility/auditStatistics',
name: '审核统计',
routes: [
{
path: '/memberCenter/statisticAbility/auditStatistics/audit',
name: '审核统计',
component: '@/pages/statistic/auditStatistics/auditPage',
},
],
},
],
}
export default statisticRoute
......@@ -11,6 +11,7 @@ module.exports = {
"jinfa-1102": {
SITE_ID: '1',
BACK_GATEWAY: 'http://jinfa1102-gateway-test.shushangyun.com:12880',
STATEMENT_URL: 'http://10.0.1.205:5000',
USE_ROUTE_CONFIG: true,
SOCKET_URL: 'ws://jinfa1102-gateway-test.shushangyun.com:12880',
YAPI_URL: 'http://10.0.1.181:7070/'
......
......@@ -145,6 +145,7 @@ export const componentExport = {
CustomSlider,
CustomRadio,
Search,
Reset,
CustomInputSearch,
CustomCategorySearch,
Submit,
......
.statementDashboard {
width: 100%;
margin: 0 auto;
}
.statementDashboard iframe {
width: 100%;
height: 100vh;
border: 0;
}
/* eslint-disable @typescript-eslint/dot-notation */
/**
* 内嵌iframe的报表控件
*/
// import { utils } from '@common/module'
import { getAuth } from '@/utils/auth';
// import { encryptedByAES } from '@linkseeks/crypto'
import { encryptedByAES } from '@/utils/cryptoAes';
import React, { useEffect, useRef } from 'react'
import styles from './index.less'
// const { microData } = microApp
// const { getAuth } = utils
export type StatementProps = {
/**
* 传参
*/
params: Object
/**
* 是否显示顶部导航栏
*/
standalone?: number
/**
* 内嵌链接
*/
url: string
/**
* 会员ID
*/
memberId?: string
/**
* 会员角色Id
*/
memberRoleId?: string
}
const Statement: React.FC<StatementProps> = ({
params,
standalone = 2,
url,
memberId = getAuth().memberId,
memberRoleId = getAuth().memberRoleId,
}) => {
const ref = useRef<any>()
// const baseUrl='http://10.0.1.205:5000'
// const { memberId, memberRoleId } = getAuth()
console.log('params:', params, 'memberId', memberId, 'memberRoleId', memberRoleId)
const authParams = encryptedByAES(`${memberId},${memberRoleId}`, true)
// const STATEMENT_URL = microData.getData(true)?.STATEMENT_URL
const constantLink = `${process.env.STATEMENT_URL}${url}?standalone=${standalone}&tenantId=${authParams}`
// const constantLink = `${STATEMENT_URL}${url}?standalone=${standalone}`
const ejectIframeSrouce = (source) => {
const blobMe = URL['createObjectURL'](new Blob([''], { type: 'text/html' }))
const elIframe = document['createElement']('iframe')
elIframe.setAttribute('frameborder', '0')
elIframe.setAttribute('width', '100%')
elIframe.setAttribute('height', '100vh')
elIframe.setAttribute('allowfullscreen', 'true')
elIframe.setAttribute('webkitallowfullscreen', 'true')
elIframe.setAttribute('mozallowfullscreen', 'true')
elIframe.setAttribute('src', blobMe)
const idOne = 'ls_' + Date.now()
ref.current = idOne
elIframe['setAttribute']('id', idOne)
document.getElementById('statementIframe').appendChild(elIframe)
document['getElementById'](idOne)['contentWindow']['document'].write(
`<script type="text/javascript">location.href = "${source}"\<\/script\>`,
)
}
useEffect(() => {
ejectIframeSrouce(constantLink)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
useEffect(() => {
document.getElementById(ref.current)['src'] = `${constantLink}&${Object.keys(params)
.map((key) => `${key}=${params[key]}`)
.join('&')}`
// 重载iframe src
}, [params])
return <div className={styles.statementDashboard} id="statementIframe" />
}
export default Statement
import { FormEffectHooks, FormPath } from '@formily/antd'
// import {
// getProductCustomerGetCustomerCategoryTree,
// getProductMemberShopCategoryConfigGetCategoryTree,
// getProductSelfShopRuleCategoryGetCategoryTree,
// } from '@linkseeks/apis'
import { getProductCustomerGetCustomerCategoryTree } from '@/services/ProductV2Api';
const { onFormInit$ } = FormEffectHooks
function convertDataToEnhanced(
treeData: CategoryTreeResponseType,
key?: string,
): CategoryTreeResponseType {
const ret: CategoryTreeResponseType = []
// 跳过检查
if (!treeData || !treeData.length) {
return ret
}
formatedTreeData(treeData, ret, key)
return ret
}
function formatedTreeData(
treeData: CategoryTreeResponseType,
hash: CategoryTreeResponseType,
key?: string,
) {
treeData.forEach((item) => {
const entity = {
...item,
id: key ? item[key] : +item.id, // 转数值,会员那边需要的数值,不然回填会匹配不上
children: [],
}
if (item.children) {
formatedTreeData(item.children, entity.children, key)
}
hash.push(entity)
})
}
type CategoryTreeResponseType = {
/**
* id
*/
id: string | number
/**
* 父节点id
*/
parentId: string
/**
* 节点名称
*/
title: string
/**
* 是否选中
*/
checked: boolean
/**
* 图片url路径
*/
imageUrl: string
/**
* 排序
*/
sort: number
/**
* 子节点集合 ,Node
*/
children: CategoryTreeResponseType
}[]
export type OptionsType = {
fieldName: string
featchApi?: any
categoryParams?: any
}
export const useCustomerCategoriesBusinessEffects = (
context,
actions,
options: OptionsType,
route = 'props.x-component-props.options',
key,
) => {
const { fieldName, categoryParams } = options
const { sourceShopType, ...param } = categoryParams || {}
let apiFn = getProductCustomerGetCustomerCategoryTree
// if (sourceShopType) {
// apiFn =
// sourceShopType === 1
// ? getProductSelfShopRuleCategoryGetCategoryTree
// : getProductMemberShopCategoryConfigGetCategoryTree
// }
// 初始会员品类数据
onFormInit$().subscribe(() => {
// 请求会员品类数据
apiFn(param)
.then((res) => {
if (res.code === 1000) {
const { data = [] } = res
actions.setFieldState(fieldName, (state) => {
FormPath.setIn(
state,
route,
convertDataToEnhanced(data as unknown as CategoryTreeResponseType, key),
)
})
}
})
.catch((err) => {
console.warn(err)
})
})
}
......@@ -845,4 +845,14 @@ export default {
'order.warehouseHouse.message': '请选择下单仓库',
'order.orderProductPosition': '下单仓位',
'order.warehouseHouse.tips': '确认收货时默认选择该仓库',
'currency.title': '币种',
'evaluation.range.time.range': '考评范围时间区间',
'temporal.interval': '时间区间',
'contract.statistics.contractNo': '合同编码',
'contract.statistics.categoryCode': '品类标识',
'contract.statistics.category': '品类',
'contract.statistics.currencyId': '币种ID',
'contract.statistics.contractType': '合同类型',
'order.statistics.quoteNo': '关联单据编号',
}
import React, { useState, useEffect } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Button, Card, message, Space } from 'antd'
import Statement from '@/components/statisticsStatement'
import { useIntl } from 'umi'
import moment from 'moment'
import isEmpty from 'lodash/isEmpty'
import NiceForm from '@/components/NiceForm'
import { createFormActions } from '@formily/antd'
// import HeaderSelectCompany from '@/components/HeaderSelectCompany'
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
// import {
// getManagePaasCurrencyPaasCurrencyAll,
// postReportDxExportMemberEvaluation,
// } from '@linkseeks/apis'
// import { createDownloadLink, handleExportFile } from '@/utils/downloads'
import { getAuth } from '@/utils/auth'
import {getMemberAbilityMaintenancePageitems} from '@/services/MemberV2Api';
/**
* 考评统计
*/
const actions = createFormActions()
const Index = () => {
const intl = useIntl()
const [params, setParams] = useState<any>({})
const [selectedCompany, setSelectedCompany] = useState<any>()
const presuppose = {
[intl.formatMessage({ id: 'order.statistics.today' })]: [moment(), moment()],
[intl.formatMessage({ id: 'order.statistics.oneWeek' })]: [
moment().startOf('week'),
moment().endOf('week'),
],
[intl.formatMessage({ id: 'order.statistics.oneMonth' })]: [
moment().startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.threeMonth' })]: [
moment(new Date()).subtract(2, 'months').startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.halfYear' })]: [
moment(new Date()).subtract(5, 'months').startOf('month'),
moment().endOf('month'),
],
}
const handleSubmit = (values) => {
const obj = { ...values }
for (const key in obj) {
if (isEmpty(obj[key])) {
delete obj[key]
}
if (moment.isMoment(obj[key])) {
obj[key] = moment(obj[key]).format('YYYY-MM-DD')
}
}
setParams(obj)
}
const handleReset = () => {
setParams({})
}
useEffect(() => {
actions.submit()
}, [])
const searchSchema = {
type: 'object',
properties: {
flexLayout: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
className: 'order_srm_element',
rowStyle: {
flexWrap: 'nowrap',
justifyContent: 'flex-start',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
vendor: {
type: 'string',
title: intl.formatMessage({ id: 'order.statistics.vendor' }),
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
},
},
templateId: {
type: 'string',
title: '考评模板',
'x-component-props': {
placeholder: '选择考评模板',
},
},
'[startDate, endDate]': {
title: intl.formatMessage({ id: 'evaluation.range.time.range' }),
'x-component': 'DateRangePicker',
'x-component-props': {
placeholder: [
intl.formatMessage({ id: 'order.statistics.startDate' }),
intl.formatMessage({ id: 'order.statistics.endDate' }),
],
allowClear: true,
showTime: false,
ranges: '{{presuppose}}',
},
// default: [moment().subtract(29, 'day').startOf('day'), moment().startOf('day')],
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: intl.formatMessage({ id: 'trademark.schema.submit' }),
},
},
reset: {
'x-component': 'Reset',
'x-component-props': {
advanced: false,
},
},
ctl: {
type: 'object',
'x-component': 'ExportBtn',
},
},
},
},
}
const getCurrencyIdList = async () => {
const res = await getMemberAbilityMaintenancePageitems()
if (res.code === 1000) {
const List = res?.data?.currencyType || []
return {
templateId: List.map((item) => ({
label: item.text,
value: String(item.id),
})),
}
}
return {
templateId: [],
}
}
const handleExport = () => {
const newPrams = {
name: params?.vendor,
startDate: params?.startDate,
endDate: params?.endDate,
companyId: selectedCompany?.companyId || getAuth().memberId,
roleId: selectedCompany?.memberRoleId || getAuth().memberRoleId,
}
// handleExportFile({ api: postReportDxExportMemberEvaluation, params: newPrams })
}
return (
<PageHeaderWrapper
// subTitle={
// <HeaderSelectCompany
// onOk={(selectedRows) => {
// setSelectedCompany(selectedRows)
// actions.submit()
// }}
// />
// }
>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Card>
<NiceForm
actions={actions}
schema={searchSchema}
onSubmit={(values) => handleSubmit(values)}
onReset={handleReset}
components={{
ExportBtn: () => {
return (
<div>
<Button onClick={handleExport}>
{intl.formatMessage({
id: 'commodity.products.menuMore.6',
})}
</Button>
</div>
)
},
}}
expressionScope={{
presuppose,
}}
effects={($, actions) => {
useAsyncInitSelect(['templateId'], getCurrencyIdList)
}}
/>
</Card>
<Card>
<Statement
url="/superset/dashboard/evaluation"
params={params}
/>
</Card>
</Space>
</PageHeaderWrapper>
)
}
export default Index
.ant-row.sc-crXcEl.ceYLiT {
.ant-col {
.ant-row {
margin-bottom: 0;
}
}
}
import React, { useState,useEffect,useRef } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Cascader, Space } from 'antd'
import Statement from '@/components/statisticsStatement'
import { useIntl } from 'umi'
import moment from 'moment'
import isEmpty from 'lodash/isEmpty'
import './index.less'
import NiceForm from '@/components/NiceForm'
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
// import HeaderSelectCompany from '@/components/HeaderSelectCompany'
import { useCustomerCategoriesBusinessEffects } from '@/formSchema/effects/useCustomerCategoriesBusinessEffectsStatistics'
// import { getManagePaasCurrencyPaasCurrencyAll } from '@linkseeks/apis'
import { createFormActions,FormEffectHooks } from '@formily/antd'
import { getMemberAbilityMaintenancePageitems } from '@/services/MemberV2Api';
import { getReportVerificationEnums } from '@/services/ReportV2Api';
const {
onFieldValueChange$,
} = FormEffectHooks;
const searchActions = createFormActions()
const Index = () => {
const intl = useIntl()
const [params, setParams] = useState({})
// const [dataSoruce, setDataSoruce] = useState<any>([])
const [selected, setSelected] = useState<any>()
const dataSoruce = useRef<any[]>([])
const presuppose = {
[intl.formatMessage({ id: 'order.statistics.today' })]: [moment(), moment()],
[intl.formatMessage({ id: 'order.statistics.oneWeek' })]: [
moment().startOf('week'),
moment().endOf('week'),
],
[intl.formatMessage({ id: 'order.statistics.oneMonth' })]: [
moment().startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.threeMonth' })]: [
moment(new Date()).subtract(2, 'months').startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.halfYear' })]: [
moment(new Date()).subtract(5, 'months').startOf('month'),
moment().endOf('month'),
],
}
const handleSubmit = (values) => {
const obj = { ...values }
for (const key in obj) {
// if (isEmpty(obj[key])) {
// delete obj[key]
// }
if (moment.isMoment(obj[key])) {
obj[key] = moment(obj[key]).format('YYYY-MM-DD')
}
}
setParams(obj)
}
const handleReset = () => {
setParams({})
}
const searchSchema = {
type: 'object',
properties: {
flexLayout: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
className: 'order_srm_element',
rowStyle: {
justifyContent: 'flex-start',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
userName: {
type: 'string',
title: '审核人姓名',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
},
},
type: {
type: 'string',
title: '审核类型',
'x-component-props': {
placeholder: '请选择',
},
},
operate: {
type: 'string',
title: '审核状态',
'x-component-props': {
placeholder: '请选择',
disabled:true
},
},
agree: {
type: 'string',
title: '审核结果',
'x-component-props': {
placeholder: '请选择',
},
enum: [
{
label: '审核通过',
value: 1
},
{
label: '审核不通过',
value: 0
}
]
},
'[startDate, endDate]': {
title: intl.formatMessage({ id: 'order.statistics.timeRange' }),
'x-component': 'DateRangePicker',
'x-component-props': {
placeholder: [
intl.formatMessage({ id: 'order.statistics.startDate' }),
intl.formatMessage({ id: 'order.statistics.endDate' }),
],
allowClear: true,
showTime: false,
ranges: '{{presuppose}}',
},
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: intl.formatMessage({ id: 'trademark.schema.submit' }),
},
},
reset: {
'x-component': 'Reset',
'x-component-props': {
advanced: false,
},
},
},
},
},
}
// 初始化高级筛选选项
const fetchSearchItems = async () => {
const res = await getReportVerificationEnums()
if (res.code === 1000) {
const List = res?.data || []
return {
type: List.map((item) => ({
label: item.name,
value: String(item.key),
})),
operate:[],
}
}
return {
type: [],
// operate:[]
}
}
const fetchItems = async () => {
const res = await getReportVerificationEnums()
if (res.code === 1000) {
dataSoruce.current=res.data
// setDataSoruce(res.data)
}
}
useEffect(() => {
fetchItems()
}, [])
return (
<PageHeaderWrapper
// subTitle={
// <HeaderSelectCompany
// onOk={(selectedRows) => {
// setSelectedCompany(selectedRows)
// searchActions.submit()
// }}
// />
// }
>
<Space direction="vertical" size={16}>
<Card>
<NiceForm
actions={searchActions}
schema={searchSchema}
onSubmit={(values) => handleSubmit(values)}
onReset={handleReset}
components={{ Cascader }}
effects={($, actions) => {
useAsyncInitSelect(['type'], fetchSearchItems)
// 初始化品类数据
// useCustomerCategoriesBusinessEffects(
// $,
// actions,
// {
// fieldName: 'categoryCode',
// },
// undefined,
// 'fullId',
// )
onFieldValueChange$('type').subscribe(result => {
if(result.value){
const list=dataSoruce.current.filter(item=>item.key==result.value)[0].operates.map((item) => ({
label: item.name,
value: String(item.key),
}))
searchActions.setFieldState('operate', (fieldState) => {
fieldState.props.enum = list;
fieldState.props['x-component-props'] = {...fieldState.props['x-component-props'],disabled:false};
});
}
})
}}
expressionScope={{
presuppose,
}}
/>
</Card>
<Card>
<Statement
url="/superset/dashboard/verification"
params={params}
/>
</Card>
</Space>
</PageHeaderWrapper>
)
}
export default Index
.ant-row.sc-crXcEl.ceYLiT {
.ant-col {
.ant-row {
margin-bottom: 0;
}
}
}
import React, { useState } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Cascader, Space, Button } from 'antd'
import Statement from '@/components/statisticsStatement'
import { useIntl } from 'umi'
import moment from 'moment'
// import isEmpty from 'lodash/isEmpty'
import './index.less'
import NiceForm from '@/components/NiceForm'
// import HeaderSelectCompany from '@/components/HeaderSelectCompany'
// import { CONTRACTTYPE } from '../vendorSrmContract'
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
// import {
// getManagePaasCurrencyPaasCurrencyAll,
// getReportDxProcessingBuyerSrmContract,
// } from '@linkseeks/apis'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
// import { handleExportFile } from '@/utils/downloads'
import { searchSchema } from './schemas'
import { createFormActions } from '@formily/antd'
import { useCustomerCategoriesBusinessEffects } from '@/formSchema/effects/useCustomerCategoriesBusinessEffectsStatistics'
import {getMemberAbilityMaintenancePageitems} from '@/services/MemberV2Api';
const searchActions = createFormActions()
/**
* 合同执行报表采购商
*/
export const CONTRACTTYPE = {
// "采购询价合同"
采购询价合同: 1,
// "采购招标合同"
采购招标合同: 2,
// "采购竞价合同"
采购竞价合同: 3,
// "请购单合同"
请购单合同: 4,
// "框架合同"
框架合同: 5,
}
const Index = () => {
const intl = useIntl()
const [params, setParams] = useState({})
const [selectedCompany, setSelectedCompany] = useState<any>()
const presuppose = {
[intl.formatMessage({ id: 'order.statistics.today' })]: [moment(), moment()],
[intl.formatMessage({ id: 'order.statistics.oneWeek' })]: [
moment().startOf('week'),
moment().endOf('week'),
],
[intl.formatMessage({ id: 'order.statistics.oneMonth' })]: [
moment().startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.threeMonth' })]: [
moment(new Date()).subtract(2, 'months').startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.halfYear' })]: [
moment(new Date()).subtract(5, 'months').startOf('month'),
moment().endOf('month'),
],
}
const handleSubmit = (values) => {
const obj = { ...values }
for (const key in obj) {
// if (isEmpty(obj[key])) {
// delete obj[key]
// }
if (moment.isMoment(obj[key])) {
obj[key] = moment(obj[key]).format('YYYY-MM-DD')
}
if (key == 'categoryCode') {
let list = obj[key]
obj[key] = list[list.length - 1]
}
}
setParams(obj)
}
const handleReset = () => {
setParams({})
}
// 初始化高级筛选选项
const fetchSearchItems = async () => {
const res = await getMemberAbilityMaintenancePageitems()
if (res.code === 1000) {
const { data } = res
return {
contractType: Object.keys(CONTRACTTYPE).map((item) => ({
label: item,
value: CONTRACTTYPE[item],
})),
currencyId: data?.currencyType?.map((item) => ({ label: item.text, value: item.id })),
}
}
return {
currencyId: [],
contractType: [],
}
}
const onExport = async () => {
const values = (await searchActions.submit()).values
const params = { ...values }
for (const key in params) {
if (moment.isMoment(params[key])) {
params[key] = moment(params[key]).format('YYYY-MM-DD')
}
}
// handleExportFile({
// api: getReportDxProcessingBuyerSrmContract,
// params,
// })
}
const ExportBtn = () => (
<Button type="primary" style={{ width: 100 }} onClick={onExport}>
{intl.formatMessage({
id: 'saleOrder.daochu',
defaultMessage: '导出',
})}
</Button>
)
return (
<PageHeaderWrapper
// subTitle={
// <HeaderSelectCompany
// onOk={(selectedRows) => {
// setSelectedCompany(selectedRows)
// searchActions.submit()
// }}
// />
// }
>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Card>
<NiceForm
schema={searchSchema}
actions={searchActions}
onSubmit={(values) => handleSubmit(values)}
components={{ Cascader, ExportBtn }}
onReset={handleReset}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'vendor', FORM_FILTER_PATH)
useAsyncInitSelect(['currencyId', 'contractType'], fetchSearchItems)
// 初始化品类数据
useCustomerCategoriesBusinessEffects(
$,
actions,
{
fieldName: 'categoryCode',
},
undefined,
'fullId',
)
}}
expressionScope={{
presuppose,
}}
/>
</Card>
<Card>
<Statement
url="/superset/dashboard/buyerSrmContract"
params={params}
/>
</Card>
</Space>
</PageHeaderWrapper>
)
}
export default Index
import { getIntl } from 'umi'
import { FORM_FILTER_PATH } from '@/formSchema/const'
const intl = getIntl()
export const searchSchema = {
type: 'object',
properties: {
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'ExportBtn',
},
vendor: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'order.statistics.vendor' }),
align: 'flex-end',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'wrap',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
productNo: {
type: 'string',
'x-component-props': {
style: { width: 168 },
placeholder: intl.formatMessage({ id: 'order.statistics.productNo' }),
},
},
productName: {
type: 'string',
'x-component-props': {
style: { width: 168 },
placeholder: intl.formatMessage({ id: 'order.statistics.productName' }),
},
},
// categoryName: {
// type: 'string',
// 'x-component-props': {
// style: { width: 168 },
// placeholder: intl.formatMessage({ id: 'contract.statistics.category' }),
// },
// },
categoryCode: {
type: 'string',
'x-component': 'Cascader',
'x-component-props': {
placeholder: intl.formatMessage({
id: 'contract.statistics.categoryCode',
}),
showSearch: true,
style: { width: '174px' },
fieldNames: { label: 'title', value: 'fullId', children: 'children' },
},
},
contractType: {
type: 'string',
'x-component-props': {
style: { width: 168 },
placeholder: intl.formatMessage({ id: 'contract.statistics.contractType' }),
},
},
currencyId: {
type: 'string',
'x-component-props': {
style: { width: 168 },
placeholder: intl.formatMessage({ id: 'currency.title' }),
},
},
'[startDate, endDate]': {
// title: intl.formatMessage({ id: 'order.statistics.timeRange' }),
'x-component': 'DateRangePicker',
'x-component-props': {
style: { width: 368 },
placeholder: [
intl.formatMessage({ id: 'order.statistics.startDate' }),
intl.formatMessage({ id: 'order.statistics.endDate' }),
],
allowClear: true,
showTime: false,
ranges: '{{presuppose}}',
},
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: intl.formatMessage({
id: 'purchaseRequisition.chaxun',
}),
},
},
// reset: {
// 'x-component': 'Reset',
// 'x-component-props': {
// advanced: false,
// },
// },
},
},
},
},
},
}
.ant-row.sc-crXcEl.ceYLiT {
.ant-col {
.ant-row {
margin-bottom: 0;
}
}
}
import React, { useState, useEffect } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Space } from 'antd'
import { useIntl } from 'umi'
import moment from 'moment'
import isEmpty from 'lodash/isEmpty'
import './index.less'
import NiceForm from '@/components/NiceForm'
import { createFormActions } from '@formily/antd'
import Statement from '@/components/statisticsStatement'
// import HeaderSelectCompany from '@common/components/HeaderSelectCompany'
/**
* 供应商能力 投诉报表
*/
const action = createFormActions()
const Index = () => {
const intl = useIntl()
const [params, setParams] = useState({})
const [selectedCompany, setSelectedCompany] = useState<any>()
const presuppose = {
[intl.formatMessage({ id: 'order.statistics.today' })]: [moment(), moment()],
[intl.formatMessage({ id: 'order.statistics.oneWeek' })]: [
moment().startOf('week'),
moment().endOf('week'),
],
[intl.formatMessage({ id: 'order.statistics.oneMonth' })]: [
moment().startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.threeMonth' })]: [
moment(new Date()).subtract(2, 'months').startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.halfYear' })]: [
moment(new Date()).subtract(5, 'months').startOf('month'),
moment().endOf('month'),
],
}
const handleSubmit = (values) => {
const obj = { ...values }
for (const key in obj) {
if (isEmpty(obj[key])) {
delete obj[key]
}
if (moment.isMoment(obj[key])) {
obj[key] = moment(obj[key]).format('YYYY-MM-DD')
}
}
setParams(obj)
}
const handleReset = () => {
setParams({})
}
useEffect(() => {
// 调用默认查询
action.submit()
}, [])
const searchSchema = {
type: 'object',
properties: {
flexLayout: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
className: 'order_srm_element',
rowStyle: {
flexWrap: 'nowrap',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
'[startDate, endDate]': {
title: intl.formatMessage({ id: 'order.statistics.timeRange' }),
'x-component': 'DateRangePicker',
'x-component-props': {
placeholder: [
intl.formatMessage({ id: 'order.statistics.startDate' }),
intl.formatMessage({ id: 'order.statistics.endDate' }),
],
allowClear: true,
showTime: false,
ranges: '{{presuppose}}',
// 窗口固定父级下面
getPopupContainer: (triggerNode) => triggerNode.parentNode,
},
default: [moment().subtract(59, 'day').startOf('day'), moment().startOf('day')],
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: intl.formatMessage({ id: 'trademark.schema.submit' }),
},
},
reset: {
'x-component': 'Reset',
'x-component-props': {
advanced: false,
},
},
},
},
},
}
return (
<PageHeaderWrapper
// subTitle={
// <HeaderSelectCompany
// onOk={(selectedRows) => {
// setSelectedCompany(selectedRows)
// action.submit()
// }}
// />
// }
>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Card>
<NiceForm
actions={action}
schema={searchSchema}
onSubmit={(values) => handleSubmit(values)}
onReset={handleReset}
expressionScope={{
presuppose,
}}
/>
</Card>
<Card>
<Statement
url="/superset/dashboard/complaint"
params={params}
//
//
/>
</Card>
</Space>
</PageHeaderWrapper>
)
}
export default Index
.ant-row.sc-crXcEl.ceYLiT {
.ant-col {
.ant-row {
margin-bottom: 0;
}
}
}
import React, { useState } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Cascader, Space, Button } from 'antd'
import Statement from '@/components/statisticsStatement'
import { useIntl } from 'umi'
import moment from 'moment'
// import isEmpty from 'lodash/isEmpty'
import './index.less'
import NiceForm from '@/components/NiceForm'
// import HeaderSelectCompany from '@/components/HeaderSelectCompany'
// import { CONTRACTTYPE } from '../vendorSrmContract'
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
// import {
// getManagePaasCurrencyPaasCurrencyAll,
// getReportDxProcessingBuyerSrmContract,
// } from '@linkseeks/apis'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { handleExportFile } from '@/utils/downloads'
import { searchSchema } from './schemas'
import { createFormActions } from '@formily/antd'
import { useCustomerCategoriesBusinessEffects } from '@/formSchema/effects/useCustomerCategoriesBusinessEffectsStatistics'
import {getMemberAbilityMaintenancePageitems,getMemberParameterManageGetArrivalArea} from '@/services/MemberV2Api';
import {getReportDxProcessingBuyerSrmContractExport} from '@/services/ReportV2Api';
import {getContractManageStatusList,getContractSelectDeliveryTypeList} from '@/services/ContractV2Api';
const searchActions = createFormActions()
/**
* 合同执行报表采购商
*/
export const CONTRACTTYPE = {
// "采购询价合同"
采购询价合同: 1,
// "采购招标合同"
采购招标合同: 2,
// "采购竞价合同"
采购竞价合同: 3,
// "请购单合同"
请购单合同: 4,
// "框架合同"
框架合同: 5,
}
const Index = () => {
const intl = useIntl()
const [params, setParams] = useState({})
const [selectedCompany, setSelectedCompany] = useState<any>()
const presuppose = {
[intl.formatMessage({ id: 'order.statistics.today' })]: [moment(), moment()],
[intl.formatMessage({ id: 'order.statistics.oneWeek' })]: [
moment().startOf('week'),
moment().endOf('week'),
],
[intl.formatMessage({ id: 'order.statistics.oneMonth' })]: [
moment().startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.threeMonth' })]: [
moment(new Date()).subtract(2, 'months').startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.halfYear' })]: [
moment(new Date()).subtract(5, 'months').startOf('month'),
moment().endOf('month'),
],
}
const handleSubmit = (values) => {
const obj = { ...values }
for (const key in obj) {
// if (isEmpty(obj[key])) {
// delete obj[key]
// }
if (moment.isMoment(obj[key])) {
obj[key] = moment(obj[key]).format('YYYY-MM-DD')
}
if (key == 'categoryCode') {
let list = obj[key]
obj[key] = list[list.length - 1]
}
}
if(obj.left){
obj.left=0
}else{
delete obj.left
}
setParams(obj)
}
const handleReset = () => {
setParams({})
}
// 初始化高级筛选选项
const fetchSearchItems = async () => {
const res = await getMemberAbilityMaintenancePageitems()
if (res.code === 1000) {
const { data } = res
return {
contractType: Object.keys(CONTRACTTYPE).map((item) => ({
label: item,
value: CONTRACTTYPE[item],
})),
currencyType: data?.currencyType.map((item) => ({ label: item.text, value: item.id })),
}
}
return {
currencyType: [],
contractType: [],
}
}
const getManageGetArrivalArea = async () => {
const res = await getMemberParameterManageGetArrivalArea()
if (res.code === 1000) {
const List = res?.data || []
return {
area: List.map((item) => ({
label: item.name,
value: String(item.key),
})),
}
}
return {
area: [],
}
}
const getDeliveryType = async () => {
const res = await getContractSelectDeliveryTypeList()
if (res.code === 1000) {
const List = res?.data || []
return {
deliveryType: List.map((item) => ({
label: item.text,
value: String(item.id),
})),
}
}
return {
deliveryType: [],
}
}
const getStatus = async () => {
const res = await getContractManageStatusList()
if (res.code === 1000) {
const List = res?.data?.outerList || []
return {
status: List.map((item) => ({
label: item.message,
value: String(item.code),
})),
}
}
return {
status: [],
}
}
const onExport = async () => {
const values = (await searchActions.submit()).values
const params = { ...values }
for (const key in params) {
if (moment.isMoment(params[key])) {
params[key] = moment(params[key]).format('YYYY-MM-DD')
}
}
if(params.left){
params.left=0
}else{
delete params.left
}
handleExportFile({
api: '/report/dx/processingBuyerSrmContractExport',
params,
})
}
const ExportBtn = () => (
<Button type="primary" style={{ width: 100 }} onClick={onExport}>
{intl.formatMessage({
id: 'saleOrder.daochu',
defaultMessage: '导出',
})}
</Button>
)
return (
<PageHeaderWrapper
// subTitle={
// <HeaderSelectCompany
// onOk={(selectedRows) => {
// setSelectedCompany(selectedRows)
// searchActions.submit()
// }}
// />
// }
>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Card>
<NiceForm
schema={searchSchema}
actions={searchActions}
onSubmit={(values) => handleSubmit(values)}
components={{ Cascader, ExportBtn }}
onReset={handleReset}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'vendor', FORM_FILTER_PATH)
useAsyncInitSelect(['currencyType', 'contractType'], fetchSearchItems)
useAsyncInitSelect(['area'], getManageGetArrivalArea)
useAsyncInitSelect(['deliveryType'], getDeliveryType)
useAsyncInitSelect(['status'], getStatus)
// 初始化品类数据
useCustomerCategoriesBusinessEffects(
$,
actions,
{
fieldName: 'categoryCode',
},
undefined,
'fullId',
)
}}
expressionScope={{
presuppose,
}}
/>
</Card>
<Card>
<Statement
url="/superset/dashboard/buyerSrmContract"
params={params}
// memberRoleId={selectedCompany?.memberRoleId}
/>
</Card>
</Space>
</PageHeaderWrapper>
)
}
export default Index
import { getIntl } from 'umi'
import { FORM_FILTER_PATH } from '@/formSchema/const'
const intl = getIntl()
export const searchSchema = {
type: 'object',
properties: {
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'ExportBtn',
},
vendor: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'order.statistics.vendor' }),
align: 'flex-end',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'wrap',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
productNo: {
type: 'string',
'x-component-props': {
style: { width: 168 },
placeholder: intl.formatMessage({ id: 'order.statistics.productNo' }),
},
},
contractNo: {
type: 'string',
'x-component-props': {
style: { width: 168 },
placeholder: '合同编号',
},
},
productName: {
type: 'string',
'x-component-props': {
style: { width: 168 },
placeholder: intl.formatMessage({ id: 'order.statistics.productName' }),
},
},
sapNo: {
type: 'string',
title: 'SAP物料编码',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
style: { width: '120px' },
},
},
manager: {
type: 'string',
title: '产品经理',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
style: { width: '120px' },
},
},
sapContractNo: {
type: 'string',
title: 'SAP合同编号',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
style: { width: '120px' },
},
},
status: {
type: 'string',
title: '合同状态',
'x-component-props': {
placeholder: '请选择',
style: { width: '120px' },
},
},
// categoryName: {
// type: 'string',
// 'x-component-props': {
// style: { width: 168 },
// placeholder: intl.formatMessage({ id: 'contract.statistics.category' }),
// },
// },
categoryCode: {
type: 'string',
'x-component': 'Cascader',
'x-component-props': {
placeholder: intl.formatMessage({
id: 'contract.statistics.categoryCode',
}),
showSearch: true,
style: { width: '174px' },
fieldNames: { label: 'title', value: 'fullId', children: 'children' },
},
},
contractType: {
type: 'string',
'x-component-props': {
style: { width: 168 },
placeholder: intl.formatMessage({ id: 'contract.statistics.contractType' }),
},
},
currencyType: {
type: 'string',
'x-component-props': {
style: { width: 168 },
placeholder: intl.formatMessage({ id: 'currency.title' }),
},
},
deliveryType: {
type: 'string',
'x-component-props': {
style: { width: 168 },
placeholder: '配送方式',
},
},
area: {
type: 'string',
title: '到货区域',
'x-component-props': {
placeholder: '请选择',
},
},
left: {
title: '合同未执行完成',
default: false,
"x-component": 'CheckboxSingle',
'x-component-props': {
placeholder: '请选择',
},
},
'[startDate, endDate]': {
// title: intl.formatMessage({ id: 'order.statistics.timeRange' }),
'x-component': 'DateRangePicker',
'x-component-props': {
style: { width: 368 },
placeholder: [
intl.formatMessage({ id: 'order.statistics.startDate' }),
intl.formatMessage({ id: 'order.statistics.endDate' }),
],
allowClear: true,
showTime: false,
ranges: '{{presuppose}}',
},
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: intl.formatMessage({
id: 'purchaseRequisition.chaxun',
}),
},
},
// reset: {
// 'x-component': 'Reset',
// 'x-component-props': {
// advanced: false,
// },
// },
},
},
},
},
},
}
.ant-row.sc-crXcEl.ceYLiT {
.ant-col {
.ant-row {
margin-bottom: 0;
}
}
}
.ant-row.sc-crXcEl.ceYLiT {
.ant-col {
.ant-row {
margin-bottom: 0;
}
}
}
This diff is collapsed.
.ant-row.sc-crXcEl.ceYLiT {
.ant-col {
.ant-row {
margin-bottom: 0;
}
}
}
import React, { useState, useEffect } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Space } from 'antd'
import Statement from '@/components/statisticsStatement'
import { useIntl } from 'umi'
import moment from 'moment'
import isEmpty from 'lodash/isEmpty'
import './index.less'
import NiceForm from '@/components/NiceForm'
import { createFormActions } from '@formily/antd'
// import HeaderSelectCompany from '@common/components/HeaderSelectCompany'
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
// import { getManagePaasCurrencyPaasCurrencyAll } from '@linkseeks/apis'
import {getMemberAbilityMaintenancePageitems} from '@/services/MemberV2Api';
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
/**
* 价格报表
*/
const actions = createFormActions()
const Index = () => {
const intl = useIntl()
const [params, setParams] = useState({})
const [selectedCompany, setSelectedCompany] = useState<any>()
const presuppose = {
[intl.formatMessage({ id: 'order.statistics.today' })]: [moment(), moment()],
[intl.formatMessage({ id: 'order.statistics.oneWeek' })]: [
moment().startOf('week'),
moment().endOf('week'),
],
[intl.formatMessage({ id: 'order.statistics.oneMonth' })]: [
moment().startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.threeMonth' })]: [
moment(new Date()).subtract(2, 'months').startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.halfYear' })]: [
moment(new Date()).subtract(5, 'months').startOf('month'),
moment().endOf('month'),
],
}
const handleSubmit = (values) => {
const obj = { ...values }
for (const key in obj) {
if (isEmpty(obj[key])) {
delete obj[key]
}
if (moment.isMoment(obj[key])) {
obj[key] = moment(obj[key]).format('YYYY-MM-DD')
}
}
setParams(obj)
}
const handleReset = () => {
setParams({})
}
useEffect(() => {
actions.submit()
}, [])
const searchSchema = {
type: 'object',
properties: {
megalayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
vendor: {
type: 'string',
'x-component': 'Search',
'x-mega-props': {},
'x-component-props': {
placeholder: intl.formatMessage({ id: 'order.statistics.vendor' }),
align: 'flex-left',
},
},
},
},
// flexLayout: {
// type: 'object',
// 'x-component': 'flex-layout',
// 'x-component-props': {
// className: 'order_srm_element',
// rowStyle: {
// flexWrap: 'nowrap',
// },
// colStyle: {
// marginLeft: 20,
// },
// },
// properties: {
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
justifyContent: 'flex-start',
// flexWrap: 'nowrap',
},
colStyle: {
//改变间隔
marginRight: 16,
},
},
properties: {
productNo: {
type: 'string',
title: intl.formatMessage({ id: 'order.statistics.productNo' }),
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
},
},
productName: {
type: 'string',
title: intl.formatMessage({ id: 'order.statistics.productName' }),
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
},
},
sapNo: {
type: 'string',
title: 'SAP物料编码',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
},
},
manager: {
type: 'string',
title: '产品经理',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
},
},
area: {
type: 'string',
title: '到货区域',
'x-component-props': {
placeholder: '请选择',
},
},
currencyType: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: `${intl.formatMessage({
id: 'currency.title',
})}`,
allowClear: true,
// style: {
// width: 160,
// },
},
},
'[startDate, endDate]': {
title: intl.formatMessage({ id: 'order.statistics.timeRange' }),
'x-component': 'DateRangePicker',
'x-component-props': {
placeholder: [
intl.formatMessage({ id: 'order.statistics.startDate' }),
intl.formatMessage({ id: 'order.statistics.endDate' }),
],
allowClear: true,
showTime: false,
ranges: '{{presuppose}}',
},
default: [moment().subtract(29, 'day').startOf('day'), moment().startOf('day')],
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: intl.formatMessage({ id: 'trademark.schema.submit' }),
},
},
reset: {
'x-component': 'Reset',
'x-component-props': {
children: '重置',
// advanced: false,
},
},
},
// },
// },
},
},
}
const getCurrencyIdList = async () => {
const res = await getMemberAbilityMaintenancePageitems()
if (res.code === 1000) {
const List = res?.data?.currencyType || []
return {
currencyType: List.map((item) => ({
// label: item.currencyName,
label: item.text,
value: String(item.id),
})),
}
}
return {
currencyType: [],
}
}
return (
<PageHeaderWrapper
// subTitle={
// <HeaderSelectCompany
// onOk={(selectedRows) => {
// setSelectedCompany(selectedRows)
// actions.submit()
// }}
// />
// }
>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Card>
<NiceForm
actions={actions}
schema={searchSchema}
onSubmit={(values) => handleSubmit(values)}
onReset={handleReset}
expressionScope={{
presuppose,
}}
effects={($, actions) => {
useAsyncInitSelect(['currencyType'], getCurrencyIdList)
useStateFilterSearchLinkageEffect($, actions, 'vendor', FORM_FILTER_PATH)
}}
/>
</Card>
<Card>
<Statement
url="/superset/dashboard/materialTrend"
params={params}
/>
</Card>
</Space>
</PageHeaderWrapper>
)
}
export default Index
import React, { useState, useEffect } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Cascader, Space,Button } from 'antd'
import Statement from '@/components/statisticsStatement'
import { useIntl } from 'umi'
import moment from 'moment'
import isEmpty from 'lodash/isEmpty'
import NiceForm from '@/components/NiceForm'
import { createFormActions } from '@formily/antd'
// import HeaderSelectCompany from '@/components/HeaderSelectCompany'
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
// import { getManagePaasCurrencyPaasCurrencyAll } from '@linkseeks/apis'
import { useCustomerCategoriesBusinessEffects } from '@/formSchema/effects/useCustomerCategoriesBusinessEffectsStatistics'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import {getMemberAbilityMaintenancePageitems} from '@/services/MemberV2Api';
import {getReportDxPurchaseExecutionDetailsExport} from '@/services/ReportV2Api';
import { handleExportFile } from '@/utils/downloads'
/**
* 请购单报表
*/
const actions = createFormActions()
const Index = () => {
const intl = useIntl()
const [params, setParams] = useState({})
const [selectedCompany, setSelectedCompany] = useState<any>()
const presuppose = {
[intl.formatMessage({ id: 'order.statistics.today' })]: [moment(), moment()],
[intl.formatMessage({ id: 'order.statistics.oneWeek' })]: [
moment().startOf('week'),
moment().endOf('week'),
],
[intl.formatMessage({ id: 'order.statistics.oneMonth' })]: [
moment().startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.threeMonth' })]: [
moment(new Date()).subtract(2, 'months').startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.halfYear' })]: [
moment(new Date()).subtract(5, 'months').startOf('month'),
moment().endOf('month'),
],
}
const handleSubmit = (values) => {
const obj = { ...values }
for (const key in obj) {
if (isEmpty(obj[key])) {
delete obj[key]
}
if (moment.isMoment(obj[key])) {
obj[key] = moment(obj[key]).format('YYYY-MM-DD')
}
if (key == 'categoryCode' && obj[key]?.length) {
let list = obj[key]
obj[key] = list[list.length - 1]
}
}
setParams(obj)
}
const handleReset = () => {
setParams({})
}
const onExport = async () => {
const values = (await actions.submit()).values
const params = { ...values }
for (const key in params) {
if (moment.isMoment(params[key])) {
params[key] = moment(params[key]).format('YYYY-MM-DD')
}
}
// if(params.left){
// params.left=0
// }else{
// delete params.left
// }
handleExportFile({
api: '/report/dx/purchaseExecutionDetailsExport',
params,
})
}
const ExportBtn = () => (
<Button type="primary" style={{ width: 100 }} onClick={onExport}>
{intl.formatMessage({
id: 'saleOrder.daochu',
defaultMessage: '导出',
})}
</Button>
)
useEffect(() => {
actions.submit()
}, [])
const searchSchema = {
type: 'object',
properties: {
megalayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'ExportBtn',
},
vendor: {
type: 'string',
'x-component': 'Search',
'x-mega-props': {},
'x-component-props': {
placeholder: intl.formatMessage({ id: 'order.statistics.vendor' }),
align: 'flex-left',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
justifyContent: 'flex-start',
flexWrap: 'nowrap',
},
colStyle: {
//改变间隔
marginRight: 16,
},
},
properties: {
productNo: {
type: 'string',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.code' }),
},
},
productName: {
type: 'string',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.name' }),
},
},
categoryCode: {
type: 'string',
'x-component': 'Cascader',
'x-component-props': {
placeholder: intl.formatMessage({
id: 'material.category',
defaultMessage: '品类',
}),
allowClear: true,
style: { width: '150px' },
showSearch: true,
fieldNames: { label: 'title', value: 'fullId', children: 'children' },
getPopupContainer: () => document.querySelector('main'),
},
},
currencyType: {
type: 'string',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'currency.title' }),
},
},
'[startDate, endDate]': {
title: intl.formatMessage({ id: 'temporal.interval' }),
'x-component': 'DateRangePicker',
'x-component-props': {
placeholder: [
intl.formatMessage({ id: 'order.statistics.startDate' }),
intl.formatMessage({ id: 'order.statistics.endDate' }),
],
allowClear: true,
showTime: false,
ranges: '{{presuppose}}',
},
// default: [moment().subtract(29, 'day').startOf('day'), moment().startOf('day')],
},
sumbit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: intl.formatMessage({ id: 'trademark.schema.submit' }),
},
},
},
},
},
}
const getCurrencyIdList = async () => {
const res = await getMemberAbilityMaintenancePageitems()
if (res.code === 1000) {
const List = res?.data?.currencyType || []
return {
currencyType: List.map((item) => ({
label: item.text,
value: String(item.id),
})),
}
}
return {
currencyType: [],
}
}
return (
<PageHeaderWrapper
// subTitle={
// <HeaderSelectCompany
// onOk={(selectedRows) => {
// setSelectedCompany(selectedRows)
// actions.submit()
// }}
// />
// }
>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Card>
<NiceForm
actions={actions}
schema={searchSchema}
components={{ Cascader , ExportBtn}}
onSubmit={(values) => handleSubmit(values)}
onReset={handleReset}
expressionScope={{
presuppose,
}}
effects={($, actions) => {
useAsyncInitSelect(['currencyType'], getCurrencyIdList)
useStateFilterSearchLinkageEffect($, actions, 'vendor', FORM_FILTER_PATH)
// 初始化品类数据
useCustomerCategoriesBusinessEffects(
$,
actions,
{
fieldName: 'categoryCode',
},
undefined,
'fullId',
)
}}
/>
</Card>
<Card>
<Statement
url="/superset/dashboard/requestPurchase"
params={params}
/>
</Card>
</Space>
</PageHeaderWrapper>
)
}
export default Index
import React, { useState, useEffect } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Cascader, Space,Button } from 'antd'
import Statement from '@/components/statisticsStatement'
import { useIntl } from 'umi'
import moment from 'moment'
import isEmpty from 'lodash/isEmpty'
import NiceForm from '@/components/NiceForm'
import { createFormActions } from '@formily/antd'
// import HeaderSelectCompany from '@/components/HeaderSelectCompany'
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
// import { getManagePaasCurrencyPaasCurrencyAll } from '@linkseeks/apis'
import { useCustomerCategoriesBusinessEffects } from '@/formSchema/effects/useCustomerCategoriesBusinessEffectsStatistics'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import {getMemberAbilityMaintenancePageitems} from '@/services/MemberV2Api';
import { handleExportFile } from '@/utils/downloads'
/**
* 请购单周期测算
*/
const actions = createFormActions()
const Index = () => {
const intl = useIntl()
const [params, setParams] = useState({})
const [selectedCompany, setSelectedCompany] = useState<any>()
const presuppose = {
[intl.formatMessage({ id: 'order.statistics.today' })]: [moment(), moment()],
[intl.formatMessage({ id: 'order.statistics.oneWeek' })]: [
moment().startOf('week'),
moment().endOf('week'),
],
[intl.formatMessage({ id: 'order.statistics.oneMonth' })]: [
moment().startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.threeMonth' })]: [
moment(new Date()).subtract(2, 'months').startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.halfYear' })]: [
moment(new Date()).subtract(5, 'months').startOf('month'),
moment().endOf('month'),
],
}
const handleSubmit = (values) => {
const obj = { ...values }
for (const key in obj) {
// if (isEmpty(obj[key])) {
// delete obj[key]
// }
if (moment.isMoment(obj[key])) {
obj[key] = moment(obj[key]).format('YYYY-MM-DD')
}
if (key == 'categoryCode' && obj[key]?.length) {
let list = obj[key]
obj[key] = list[list.length - 1]
}
}
setParams(obj)
}
const handleReset = () => {
setParams({})
}
useEffect(() => {
actions.submit()
}, [])
const searchSchema = {
type: 'object',
properties: {
megalayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'ExportBtn',
},
vendor: {
type: 'string',
'x-component': 'Search',
'x-mega-props': {},
'x-component-props': {
placeholder: intl.formatMessage({ id: 'order.statistics.vendor' }),
align: 'flex-left',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
justifyContent: 'flex-start',
flexWrap: 'nowrap',
},
colStyle: {
//改变间隔
marginRight: 16,
},
},
properties: {
productNo: {
type: 'string',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.code' }),
},
},
productName: {
type: 'string',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.name' }),
},
},
categoryCode: {
type: 'string',
'x-component': 'Cascader',
'x-component-props': {
placeholder: intl.formatMessage({
id: 'material.category',
defaultMessage: '品类',
}),
allowClear: true,
style: { width: '150px' },
showSearch: true,
fieldNames: { label: 'title', value: 'fullId', children: 'children' },
getPopupContainer: () => document.querySelector('main'),
},
},
// currencyId: {
// type: 'string',
// 'x-component-props': {
// placeholder: intl.formatMessage({ id: 'currency.title' }),
// },
// },
'[startDate, endDate]': {
title: '请购单创建时间区间',
'x-component': 'DateRangePicker',
'x-component-props': {
placeholder: [
intl.formatMessage({ id: 'order.statistics.startDate' }),
intl.formatMessage({ id: 'order.statistics.endDate' }),
],
allowClear: true,
showTime: false,
ranges: '{{presuppose}}',
},
// default: [moment().subtract(29, 'day').startOf('day'), moment().startOf('day')],
},
'[receiveStartDate, receiveEndDate]': {
title: '首次收货时间区间',
'x-component': 'DateRangePicker',
'x-component-props': {
placeholder: [
intl.formatMessage({ id: 'order.statistics.startDate' }),
intl.formatMessage({ id: 'order.statistics.endDate' }),
],
allowClear: true,
showTime: false,
ranges: '{{presuppose}}',
},
// default: [moment().subtract(29, 'day').startOf('day'), moment().startOf('day')],
},
sumbit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: intl.formatMessage({ id: 'trademark.schema.submit' }),
},
},
},
},
},
}
const getCurrencyIdList = async () => {
const res = await getMemberAbilityMaintenancePageitems()
if (res.code === 1000) {
const List = res?.data?.currencyType || []
return {
currencyId: List.map((item) => ({
label: item.text,
value: String(item.id),
})),
}
}
return {
currencyId: [],
}
}
const onExport = async () => {
const values = (await actions.submit()).values
const params = { ...values }
for (const key in params) {
if (moment.isMoment(params[key])) {
params[key] = moment(params[key]).format('YYYY-MM-DD')
}
}
// if(params.left){
// params.left=0
// }else{
// delete params.left
// }
handleExportFile({
api: '/report/dx/purchaseCycleExport',
params,
})
}
const ExportBtn = () => (
<Button type="primary" style={{ width: 100 }} onClick={onExport}>
{intl.formatMessage({
id: 'saleOrder.daochu',
defaultMessage: '导出',
})}
</Button>
)
return (
<PageHeaderWrapper
// subTitle={
// <HeaderSelectCompany
// onOk={(selectedRows) => {
// setSelectedCompany(selectedRows)
// actions.submit()
// }}
// />
// }
>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Card>
<NiceForm
actions={actions}
schema={searchSchema}
components={{ Cascader , ExportBtn}}
onSubmit={(values) => handleSubmit(values)}
onReset={handleReset}
expressionScope={{
presuppose,
}}
effects={($, actions) => {
useAsyncInitSelect(['currencyId'], getCurrencyIdList)
useStateFilterSearchLinkageEffect($, actions, 'vendor', FORM_FILTER_PATH)
// 初始化品类数据
useCustomerCategoriesBusinessEffects(
$,
actions,
{
fieldName: 'categoryCode',
},
undefined,
'fullId',
)
}}
/>
</Card>
<Card>
<Statement
url="/superset/dashboard/purchasePeriod"
params={params}
/>
</Card>
</Space>
</PageHeaderWrapper>
)
}
export default Index
.ant-row.sc-crXcEl.ceYLiT {
.ant-col {
.ant-row {
margin-bottom: 0;
}
}
}
import React, { useState } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Cascader, Space } from 'antd'
import Statement from '@/components/statisticsStatement'
import { useIntl } from 'umi'
import moment from 'moment'
import isEmpty from 'lodash/isEmpty'
import './index.less'
import NiceForm from '@/components/NiceForm'
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
// import HeaderSelectCompany from '@/components/HeaderSelectCompany'
import { useCustomerCategoriesBusinessEffects } from '@/formSchema/effects/useCustomerCategoriesBusinessEffectsStatistics'
// import { getManagePaasCurrencyPaasCurrencyAll } from '@linkseeks/apis'
import { createFormActions } from '@formily/antd'
import {getMemberAbilityMaintenancePageitems} from '@/services/MemberV2Api';
/**
* 结算 待结算采购排行
*/
const searchActions = createFormActions()
const Index = () => {
const intl = useIntl()
const [params, setParams] = useState({})
const [selectedCompany, setSelectedCompany] = useState<any>()
const presuppose = {
[intl.formatMessage({ id: 'order.statistics.today' })]: [moment(), moment()],
[intl.formatMessage({ id: 'order.statistics.oneWeek' })]: [
moment().startOf('week'),
moment().endOf('week'),
],
[intl.formatMessage({ id: 'order.statistics.oneMonth' })]: [
moment().startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.threeMonth' })]: [
moment(new Date()).subtract(2, 'months').startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.halfYear' })]: [
moment(new Date()).subtract(5, 'months').startOf('month'),
moment().endOf('month'),
],
}
const handleSubmit = (values) => {
const obj = { ...values }
// for (const key in obj) {
// if (isEmpty(obj[key])) {
// delete obj[key]
// }
// if (moment.isMoment(obj[key])) {
// obj[key] = moment(obj[key]).format('YYYY-MM-DD')
// }
// }
for (const key in obj) {
// if (isEmpty(obj[key])) {
// delete obj[key]
// }
if (moment.isMoment(obj[key])) {
obj[key] = moment(obj[key]).format('YYYY-MM-DD')
}
if (key == 'categoryCode') {
let list = obj[key]
obj[key] = list[list.length - 1]
}
}
console.log('obj==>',obj);
setParams(obj)
}
const handleReset = () => {
setParams({})
}
const searchSchema = {
type: 'object',
properties: {
flexLayout: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
className: 'order_srm_element',
rowStyle: {
justifyContent: 'flex-start',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
productNo: {
type: 'string',
title: intl.formatMessage({ id: 'order.statistics.productNo' }),
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
},
},
productName: {
type: 'string',
title: intl.formatMessage({ id: 'order.statistics.productName' }),
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
},
},
sapNo: {
type: 'string',
title: 'SAP物料编码',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
},
},
categoryCode: {
type: 'string',
'x-component': 'Cascader',
'x-component-props': {
placeholder: intl.formatMessage({
id: 'contract.statistics.categoryCode',
}),
showSearch: true,
style: { width: '174px' },
fieldNames: { label: 'title', value: 'fullId', children: 'children' },
},
},
currencyType: {
type: 'string',
title: intl.formatMessage({ id: 'currency.title' }),
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
},
},
'[startDate, endDate]': {
title: intl.formatMessage({ id: 'order.statistics.timeRange' }),
'x-component': 'DateRangePicker',
'x-component-props': {
placeholder: [
intl.formatMessage({ id: 'order.statistics.startDate' }),
intl.formatMessage({ id: 'order.statistics.endDate' }),
],
allowClear: true,
showTime: false,
ranges: '{{presuppose}}',
},
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: intl.formatMessage({ id: 'trademark.schema.submit' }),
},
},
reset: {
'x-component': 'Reset',
'x-component-props': {
advanced: false,
},
},
},
},
},
}
// 初始化高级筛选选项
const fetchSearchItems = async () => {
const res = await getMemberAbilityMaintenancePageitems()
if (res.code === 1000) {
const List = res?.data?.currencyType || []
return {
currencyType: List.map((item) => ({
label: item.text,
value: String(item.id),
})),
}
}
return {
currencyType: [],
}
}
return (
<PageHeaderWrapper
// subTitle={
// <HeaderSelectCompany
// onOk={(selectedRows) => {
// setSelectedCompany(selectedRows)
// searchActions.submit()
// }}
// />
// }
>
<Space direction="vertical" size={16}>
<Card>
<NiceForm
actions={searchActions}
schema={searchSchema}
onSubmit={(values) => handleSubmit(values)}
onReset={handleReset}
components={{ Cascader }}
effects={($, actions) => {
useAsyncInitSelect(['currencyType'], fetchSearchItems)
// 初始化品类数据
useCustomerCategoriesBusinessEffects(
$,
actions,
{
fieldName: 'categoryCode',
},
undefined,
'fullId',
)
}}
expressionScope={{
presuppose,
}}
/>
</Card>
<Card>
<Statement
url="/superset/dashboard/orderSettlement"
params={params}
/>
</Card>
</Space>
</PageHeaderWrapper>
)
}
export default Index
.ant-row.sc-crXcEl.ceYLiT {
.ant-col {
.ant-row {
margin-bottom: 0;
}
}
}
import React, { useState } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Cascader, Space,Button } from 'antd'
import Statement from '@/components/statisticsStatement'
import { useIntl } from 'umi'
import moment from 'moment'
import isEmpty from 'lodash/isEmpty'
import './index.less'
import NiceForm from '@/components/NiceForm'
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
// import HeaderSelectCompany from '@/components/HeaderSelectCompany'
import { useCustomerCategoriesBusinessEffects } from '@/formSchema/effects/useCustomerCategoriesBusinessEffectsStatistics'
// import { getManagePaasCurrencyPaasCurrencyAll } from '@linkseeks/apis'
import { createFormActions } from '@formily/antd'
import {getMemberAbilityMaintenancePageitems} from '@/services/MemberV2Api';
import { handleExportFile } from '@/utils/downloads'
/**
* 合同采购支出分析
*/
const searchActions = createFormActions()
const Index = () => {
const intl = useIntl()
const [params, setParams] = useState({})
const presuppose = {
[intl.formatMessage({ id: 'order.statistics.today' })]: [moment(), moment()],
[intl.formatMessage({ id: 'order.statistics.oneWeek' })]: [
moment().startOf('week'),
moment().endOf('week'),
],
[intl.formatMessage({ id: 'order.statistics.oneMonth' })]: [
moment().startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.threeMonth' })]: [
moment(new Date()).subtract(2, 'months').startOf('month'),
moment().endOf('month'),
],
[intl.formatMessage({ id: 'order.statistics.halfYear' })]: [
moment(new Date()).subtract(5, 'months').startOf('month'),
moment().endOf('month'),
],
}
const handleSubmit = (values) => {
const obj = { ...values }
for (const key in obj) {
// if (isEmpty(obj[key])) {
// delete obj[key]
// }
if (moment.isMoment(obj[key])) {
obj[key] = moment(obj[key]).format('YYYY-MM-DD')
}
}
setParams(obj)
}
const handleReset = () => {
setParams({})
}
const searchSchema = {
type: 'object',
properties: {
flexLayout: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
className: 'order_srm_element',
rowStyle: {
justifyContent: 'flex-start',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
ctl: {
type: 'object',
'x-component': 'ExportBtn',
},
vendor: {
type: 'string',
title: intl.formatMessage({ id: 'order.statistics.vendor' }),
'x-component-props': {
placeholder: intl.formatMessage({ id: 'common.enter' }),
},
},
status: {
type: 'string',
title: '付款状态',
'x-component-props': {
placeholder: '请选择',
},
enum: [
{
label: '待对账',
value: 1
},
{
label: '待付款',
value: 2
},
{
label: '待收款',
value: 3
},
{
label: '已完成',
value: 4
}
]
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: intl.formatMessage({ id: 'trademark.schema.submit' }),
},
},
reset: {
'x-component': 'Reset',
'x-component-props': {
advanced: false,
},
},
},
},
},
}
// 初始化高级筛选选项
const fetchSearchItems = async () => {
const res = await getMemberAbilityMaintenancePageitems()
if (res.code === 1000) {
const List = res?.data?.currencyType || []
return {
currencyId: List.map((item) => ({
label: item.text,
value: String(item.id),
}))
}
}
return {
currencyId: [],
}
}
const onExport = async () => {
const values = (await searchActions.submit()).values
const params = { ...values }
for (const key in params) {
if (moment.isMoment(params[key])) {
params[key] = moment(params[key]).format('YYYY-MM-DD')
}
}
// if(params.left){
// params.left=0
// }else{
// delete params.left
// }
handleExportFile({
api: '/report/dx/settlePeriodExport',
params,
})
}
const ExportBtn = () => (
<Button type="primary" style={{ width: 100 }} onClick={onExport}>
{intl.formatMessage({
id: 'saleOrder.daochu',
defaultMessage: '导出',
})}
</Button>
)
return (
<PageHeaderWrapper
// subTitle={
// <HeaderSelectCompany
// onOk={(selectedRows) => {
// setSelectedCompany(selectedRows)
// searchActions.submit()
// }}
// />
// }
>
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Card>
<NiceForm
actions={searchActions}
schema={searchSchema}
onSubmit={(values) => handleSubmit(values)}
onReset={handleReset}
components={{ Cascader,ExportBtn }}
effects={($, actions) => {
useAsyncInitSelect(['currencyId'], fetchSearchItems)
// 初始化品类数据
// useCustomerCategoriesBusinessEffects(
// $,
// actions,
// {
// fieldName: 'categoryCode',
// },
// undefined,
// 'fullId',
// )
}}
expressionScope={{
presuppose,
}}
/>
</Card>
<Card>
<Statement
url="/superset/dashboard/settlePeriod"
params={params}
/>
</Card>
</Space>
</PageHeaderWrapper>
)
}
export default Index
import { message } from 'antd'
import { getAuth } from '@/utils/auth'
const { token } = (getAuth() || {})
export const createDownloadLink = (blob: Blob, fileName: string) => {
let url = window.URL.createObjectURL(blob)
let downloadElement = document.createElement('a')
downloadElement.style.display = 'none'
downloadElement.href = url
downloadElement.download = fileName
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(url)
}
interface ExportFileProps {
/** api */
api: any
/** 请求参数 */
params: any
options?: any
}
/**
* excel导出
* @param api
* @param params
* @param options
*/
export const handleExportFile = async (props: ExportFileProps) => {
const { api, params, options } = props
let exportParams = ''
Object.keys(params).forEach(item => {
if (params[item]) {
exportParams += `&${item}=${params[item]}`
}
})
window.open(`${process.env.BACK_GATEWAY}${api}?token=${token}${exportParams}`, '_blank')
// let a: any = document.createElement('a')
// document.body.appendChild(a)
// a.style = 'display: none'
// await api(
// { ...params, ...options, },
// { responseType: 'blob', getResponse: true, ctlType: 'none' },
// ).then((res: any) => {
// const { data, response } = res
// console.log('response==>',res);
// const filename = response.headers['content-disposition'].split('=')[1]
// let blob = new Blob([response.data], { type: 'application/vnd.ms-excel' })
// const url = window.URL.createObjectURL(blob)
// a.href = url
// a.download = filename
// a.click()
// window.URL.revokeObjectURL(url)
// })
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment