Commit 82014a56 by peii

开票申请各种修改

parent 06fbb2a7
...@@ -10,7 +10,8 @@ import { ...@@ -10,7 +10,8 @@ import {
SET_VERSION_APK, SET_VERSION_APK,
SET_DOMAIN_FROM_ORIGIN, SET_DOMAIN_FROM_ORIGIN,
SET_SYSPROFILE, SET_SYSPROFILE,
SET_NAVIGATION SET_NAVIGATION,
SET_ORGANIZATION
} from '../base/ActionTypes'; } from '../base/ActionTypes';
import { GetRequest, PostRequest } from '../network/RequestUtils'; import { GetRequest, PostRequest } from '../network/RequestUtils';
import { getUrlParams, show, showWarnErrorMessage, showErrorMessage, isNotBlank } from '../utils/Utils'; import { getUrlParams, show, showWarnErrorMessage, showErrorMessage, isNotBlank } from '../utils/Utils';
...@@ -214,3 +215,27 @@ export function setNavigation(navigation) { ...@@ -214,3 +215,27 @@ export function setNavigation(navigation) {
navigation navigation
} }
} }
/**
* @description: 请求授权组织
* @param {*}
* @return {*}
*/
export function getOrganizationData() {
return (dispatch, getState) => {
let {global_domain_config, token } = getState().login
const params = {access_token:token}
GetRequest(global_domain_config, getUrlParams('/authorized_inventory/search', params)).then(res => {
dispatch(setOrganization(R.pathOr([], ['data', 'organizations'])(res)))
})
}
}
export function setOrganization(organizations) {
return {
type: SET_ORGANIZATION,
organizations
}
}
\ No newline at end of file
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* @FilePath: /BoneHouse_Business_APP/app/base/ActionTypes.js * @FilePath: /BoneHouse_Business_APP/app/base/ActionTypes.js
* @Author: peii * @Author: peii
* @Date: 2022-01-04 10:18:02 * @Date: 2022-01-04 10:18:02
* @LastEditTime: 2022-01-07 16:42:55 * @LastEditTime: 2022-01-11 21:06:24
* @LastEditors: peii * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: * @Description:
*/ */
...@@ -21,6 +21,7 @@ export const SET_VERSION_APK="SET_VERSION_APK" ...@@ -21,6 +21,7 @@ export const SET_VERSION_APK="SET_VERSION_APK"
export const GET_SYSPROFILE = "GET_SYSPROFILE" export const GET_SYSPROFILE = "GET_SYSPROFILE"
export const SET_SYSPROFILE = "SET_SYSPROFILE" export const SET_SYSPROFILE = "SET_SYSPROFILE"
export const SET_NAVIGATION = "SET_NAVIGATION" export const SET_NAVIGATION = "SET_NAVIGATION"
export const SET_ORGANIZATION = "SET_ORGANIZATION"
//-----------self order--------------------- //-----------self order---------------------
export const SELF_ORDER_LIST_NO = "SELF_ORDER_LIST_NO" export const SELF_ORDER_LIST_NO = "SELF_ORDER_LIST_NO"
export const SELF_ORDER_LIST_DOING = "SELF_ORDER_LIST_DOING" export const SELF_ORDER_LIST_DOING = "SELF_ORDER_LIST_DOING"
......
...@@ -13,7 +13,7 @@ import { ...@@ -13,7 +13,7 @@ import {
safe_view, safe_view,
font_family_regular, font_family_regular,
} from '../../base/BaseStyle' } from '../../base/BaseStyle'
import { exitLoginStatus, requestSysProfile, setNavigation } from '../../action/LoginAction' import { exitLoginStatus, requestSysProfile, setNavigation, getOrganizationData } from '../../action/LoginAction'
import { getLendOrderCodeValues } from '../../action/SelfAction' import { getLendOrderCodeValues } from '../../action/SelfAction'
import { getSettlementStatus, getInvoiceStatus, getArInvoiceStatus } from '../../action/SettlementAction' import { getSettlementStatus, getInvoiceStatus, getArInvoiceStatus } from '../../action/SettlementAction'
import HeadBackItem from '../common/HeadBackItem' import HeadBackItem from '../common/HeadBackItem'
...@@ -125,6 +125,7 @@ class HomePage extends Component { ...@@ -125,6 +125,7 @@ class HomePage extends Component {
componentDidMount() { componentDidMount() {
this.getMenuRuleInfo() this.getMenuRuleInfo()
this.getSysConfigValue() this.getSysConfigValue()
this.props.getOrganizationData()
this.props.setNavigation(this.props.navigation) this.props.setNavigation(this.props.navigation)
this.getSettlementStatus() this.getSettlementStatus()
this.getLendOrderCodeValues() this.getLendOrderCodeValues()
...@@ -389,6 +390,9 @@ const mapDispatchToProps = dispatch => ({ ...@@ -389,6 +390,9 @@ const mapDispatchToProps = dispatch => ({
getLendOrderCodeValues: () => { getLendOrderCodeValues: () => {
dispatch(getLendOrderCodeValues()) dispatch(getLendOrderCodeValues())
}, },
getOrganizationData: () => {
dispatch(getOrganizationData())
}
}) })
export default connect(mapStateToProps, mapDispatchToProps)(HomePage) export default connect(mapStateToProps, mapDispatchToProps)(HomePage)
...@@ -10,7 +10,8 @@ import { ...@@ -10,7 +10,8 @@ import {
SET_VERSION_APK, SET_VERSION_APK,
SET_DOMAIN_FROM_ORIGIN, SET_DOMAIN_FROM_ORIGIN,
SET_SYSPROFILE, SET_SYSPROFILE,
SET_NAVIGATION SET_NAVIGATION,
SET_ORGANIZATION
} from '../../base/ActionTypes'; } from '../../base/ActionTypes';
// 登录状态 // 登录状态
...@@ -29,7 +30,8 @@ const defaultState = { ...@@ -29,7 +30,8 @@ const defaultState = {
SUR_MOBILE_HISTORY_SALE_PRICE_SHOW_FLAG: 'Y', SUR_MOBILE_HISTORY_SALE_PRICE_SHOW_FLAG: 'Y',
SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG: 0, SUR_MOBILE_INV_PRODUCT_LINE_CATEGORY_FLAG: 0,
OBS_MOBILE_APP_TITLE: '骨科智慧仓' OBS_MOBILE_APP_TITLE: '骨科智慧仓'
} },
organizations: []
} }
// 默认sysProfile,放state里时,会被持久化影响后面更新不了 // 默认sysProfile,放state里时,会被持久化影响后面更新不了
...@@ -98,6 +100,12 @@ export default login = (state = defaultState, action) => { ...@@ -98,6 +100,12 @@ export default login = (state = defaultState, action) => {
return Object.assign({}, state, { return Object.assign({}, state, {
navigation: action.navigation navigation: action.navigation
}) })
case SET_ORGANIZATION:
return Object.assign({}, state, {
organizations: action.organizations
})
default: // need this for default case default: // need this for default case
return state return state
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/components/modals/filter/filter.tsx * @FilePath: /BoneHouse_Business_APP/src/components/modals/filter/filter.tsx
* @Author: peii * @Author: peii
* @Date: 2021-12-19 10:49:42 * @Date: 2021-12-19 10:49:42
* @LastEditTime: 2022-01-11 09:03:17 * @LastEditTime: 2022-01-11 21:37:26
* @LastEditors: PEII * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: 过滤弹窗 * @Description: 过滤弹窗
...@@ -74,6 +74,8 @@ export default class FilterModal extends React.Component<IProps, IState> { ...@@ -74,6 +74,8 @@ export default class FilterModal extends React.Component<IProps, IState> {
onChange={this.props.setData} onChange={this.props.setData}
itemStyle={g(styles, 'filter-item__bd')} itemStyle={g(styles, 'filter-item__bd')}
modalCallback={this.modalCallback.bind(this)} modalCallback={this.modalCallback.bind(this)}
key={item.field}
fields={filterItems}
/> />
</View> </View>
) )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/direct/collections.tsx * @FilePath: /BoneHouse_Business_APP/src/pages/invoice/direct/collections.tsx
* @Author: peii * @Author: peii
* @Date: 2021-12-27 09:59:21 * @Date: 2021-12-27 09:59:21
* @LastEditTime: 2022-01-10 19:03:39 * @LastEditTime: 2022-01-11 22:01:26
* @LastEditors: PEII * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: 基于消耗单的直销开票查询汇总 * @Description: 基于消耗单的直销开票查询汇总
...@@ -124,6 +124,8 @@ class Direction extends Component<IProps, IState> { ...@@ -124,6 +124,8 @@ class Direction extends Component<IProps, IState> {
const params = R.filter(isNotBlank)({ const params = R.filter(isNotBlank)({
...args, ...args,
...pagination, ...pagination,
limit_from: pagination.start_index,
limit_to: pagination.limit,
}) })
if (!isRefresh && !isNext) { if (!isRefresh && !isNext) {
this.setState({ loading: true }) this.setState({ loading: true })
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/direct/components/filter.tsx * @FilePath: /BoneHouse_Business_APP/src/pages/invoice/direct/components/filter.tsx
* @Author: peii * @Author: peii
* @Date: 2021-12-19 10:49:42 * @Date: 2021-12-19 10:49:42
* @LastEditTime: 2022-01-11 09:30:03 * @LastEditTime: 2022-01-11 21:49:26
* @LastEditors: PEII * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: 过滤弹窗 * @Description: 过滤弹窗
...@@ -129,28 +129,41 @@ class Filter extends React.Component<IProps, IState> { ...@@ -129,28 +129,41 @@ class Filter extends React.Component<IProps, IState> {
*/ */
setFieldItems() { setFieldItems() {
let { filterItems, data } = this.state let { filterItems, data } = this.state
const { userInfo, sysProfiles, otherFilterItems = [] } = this.props const { sysProfiles, otherFilterItems = [], organizations = [] } = this.props
const showOrg = sysProfiles.OBS_SHOW_ORG_FLAG !== 'N' const showOrg = sysProfiles.OBS_SHOW_ORG_FLAG !== 'N'
data.org_code = userInfo.department_code && R.take(3, userInfo.department_code) let options = R.map(
R.applySpec({
value: R.prop('org_code'),
label: R.prop('org_name'),
}),
)(organizations)
if (R.length(organizations) === 1) {
data.org_code = R.path([0, 'value'])(options)
}
filterItems = R.concat(filterItems)(otherFilterItems) filterItems = R.concat(filterItems)(otherFilterItems)
this.setState({ filterItems, data }) this.setState({ filterItems, data })
// if (!showOrg) return if (!showOrg) {
if (isBlank(data.org_code)) {
show('请先选择组织')
}
return
}
const item = { const item = {
field: 'org_code', field: 'org_code',
label: '组织', label: '组织',
type: FieldType.SELECT, type: FieldType.SELECT,
options: [], options,
display: showOrg, display: showOrg,
rules: [{ required: true, message: '请选择组织' }], rules: [{ required: true, message: '请选择组织' }],
callback: () => { callback: () => {
data.customer_code = '' data.customer_code = ''
this.getCustomers() this.getCustomers()
} },
} }
filterItems = R.prepend(item, filterItems) filterItems = R.prepend(item, filterItems)
this.getOrganizations(showOrg)
this.setState({ filterItems, data }) this.setState({ filterItems, data })
} }
...@@ -158,6 +171,7 @@ class Filter extends React.Component<IProps, IState> { ...@@ -158,6 +171,7 @@ class Filter extends React.Component<IProps, IState> {
* @description: 请求组织信息 * @description: 请求组织信息
* @param {*} * @param {*}
* @return {*} * @return {*}
* @deprecated
*/ */
async getOrganizations(showOrg) { async getOrganizations(showOrg) {
const res = await api.getOrganizations() const res = await api.getOrganizations()
...@@ -174,9 +188,6 @@ class Filter extends React.Component<IProps, IState> { ...@@ -174,9 +188,6 @@ class Filter extends React.Component<IProps, IState> {
), ),
R.pathOr([], ['data', 'organizations']), R.pathOr([], ['data', 'organizations']),
)(res) )(res)
if (!showOrg && R.length(item.options) !== 1) {
show('请先选组织')
}
this.setState({ filterItems }) this.setState({ filterItems })
} }
...@@ -187,6 +198,8 @@ class Filter extends React.Component<IProps, IState> { ...@@ -187,6 +198,8 @@ class Filter extends React.Component<IProps, IState> {
*/ */
async getCustomers() { async getCustomers() {
const { data, filterItems } = this.state const { data, filterItems } = this.state
if (isBlank(data.org_code)) return
const params = { const params = {
org_code: data.org_code, org_code: data.org_code,
seller_code: this.props.userInfo.user_name, seller_code: this.props.userInfo.user_name,
...@@ -215,12 +228,16 @@ class Filter extends React.Component<IProps, IState> { ...@@ -215,12 +228,16 @@ class Filter extends React.Component<IProps, IState> {
* @return {*} * @return {*}
*/ */
resetHandler() { resetHandler() {
const { userInfo } = this.props const { organizations = [] } = this.props
if (organizations.length !== 1) {
return show('请先选择组织')
}
this.setState( this.setState(
{ {
data: { data: {
// seller_code: userInfo.user_name, // seller_code: userInfo.user_name,
org_code: R.take(3, userInfo.department_code), org_code: R.pathOr('', [0, 'org_code'])(organizations)
}, },
}, },
() => {}, () => {},
...@@ -269,6 +286,7 @@ class Filter extends React.Component<IProps, IState> { ...@@ -269,6 +286,7 @@ class Filter extends React.Component<IProps, IState> {
const mapStateToProps = state => ({ const mapStateToProps = state => ({
userInfo: state.login.userInfo, userInfo: state.login.userInfo,
sysProfiles: state.login.sysProfiles, sysProfiles: state.login.sysProfiles,
organizations: state.login.organizations,
}) })
const mapDispatchToProps = dispatch => ({}) const mapDispatchToProps = dispatch => ({})
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/direct/index.tsx * @FilePath: /BoneHouse_Business_APP/src/pages/invoice/direct/index.tsx
* @Author: peii * @Author: peii
* @Date: 2021-12-27 09:59:21 * @Date: 2021-12-27 09:59:21
* @LastEditTime: 2022-01-11 02:18:03 * @LastEditTime: 2022-01-11 22:01:13
* @LastEditors: PEII * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: 基于消耗单的直销开票申请 * @Description: 基于消耗单的直销开票申请
...@@ -108,6 +108,8 @@ class Direction extends Component<IProps, IState> { ...@@ -108,6 +108,8 @@ class Direction extends Component<IProps, IState> {
const params = R.filter(isNotBlank)({ const params = R.filter(isNotBlank)({
...args, ...args,
...pagination, ...pagination,
limit_from: pagination.start_index,
limit_to: pagination.limit,
}) })
if (!isRefresh && !isNext) { if (!isRefresh && !isNext) {
this.setState({ loading: true }) this.setState({ loading: true })
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/distribution/collection_detail.tsx * @FilePath: /BoneHouse_Business_APP/src/pages/invoice/distribution/collection_detail.tsx
* @Author: peii * @Author: peii
* @Date: 2021-12-29 11:26:53 * @Date: 2021-12-29 11:26:53
* @LastEditTime: 2022-01-11 08:38:02 * @LastEditTime: 2022-01-11 23:48:04
* @LastEditors: PEII * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: 开票申请详情 * @Description: 开票申请详情
...@@ -123,8 +123,8 @@ class InvoiceApplyDetail extends Component<IProps> { ...@@ -123,8 +123,8 @@ class InvoiceApplyDetail extends Component<IProps> {
<Text style={g(styles, 'item-info__text')}>物料名称: {item.customer_item_name}</Text> <Text style={g(styles, 'item-info__text')}>物料名称: {item.customer_item_name}</Text>
<Text style={g(styles, 'item-info__text')}>通用名称: {item.customer_general_name}</Text> <Text style={g(styles, 'item-info__text')}>通用名称: {item.customer_general_name}</Text>
<Text style={g(styles, 'item-info__text')}>规格型号: {item.customer_specification}</Text> <Text style={g(styles, 'item-info__text')}>规格型号: {item.customer_specification}</Text>
<Text style={g(styles, 'item-info__text')}>存储条件: {item.storage_condition_name}</Text> {/* <Text style={g(styles, 'item-info__text')}>存储条件: {item.storage_condition_name}</Text>
<Text style={g(styles, 'item-info__text')}>注册证号: {item.reg_number}</Text> <Text style={g(styles, 'item-info__text')}>注册证号: {item.reg_number}</Text> */}
<Text style={g(styles, 'item-info__text', 'item-info-line__text')}>数量: {item.quantity}</Text> <Text style={g(styles, 'item-info__text', 'item-info-line__text')}>数量: {item.quantity}</Text>
<Text style={g(styles, 'item-info__text', 'item-info-line__text')}>金额: {item.invoice_amount}</Text> <Text style={g(styles, 'item-info__text', 'item-info-line__text')}>金额: {item.invoice_amount}</Text>
</View> </View>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/distribution/components/filter.tsx * @FilePath: /BoneHouse_Business_APP/src/pages/invoice/distribution/components/filter.tsx
* @Author: peii * @Author: peii
* @Date: 2021-12-19 10:49:42 * @Date: 2021-12-19 10:49:42
* @LastEditTime: 2022-01-11 09:22:40 * @LastEditTime: 2022-01-11 21:46:15
* @LastEditors: PEII * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: 过滤弹窗 * @Description: 过滤弹窗
...@@ -101,20 +101,33 @@ class Filter extends React.Component<IProps, IState> { ...@@ -101,20 +101,33 @@ class Filter extends React.Component<IProps, IState> {
*/ */
setFieldItems() { setFieldItems() {
let { filterItems, data } = this.state let { filterItems, data } = this.state
const { userInfo, sysProfiles, otherFilterItems = [], prefixFilterItems = [] } = this.props const { userInfo, sysProfiles, otherFilterItems = [], prefixFilterItems = [], organizations = [] } = this.props
const showOrg = sysProfiles.OBS_SHOW_ORG_FLAG !== 'N' const showOrg = sysProfiles.OBS_SHOW_ORG_FLAG !== 'N'
data.org_code = userInfo.department_code && R.take(3, userInfo.department_code)
let options = R.map(
R.applySpec({
value: R.prop('org_code'),
label: R.prop('org_name'),
}),
)(organizations)
if (R.length(organizations) === 1) {
data.org_code = R.path([0, 'value'])(options)
}
filterItems = [...prefixFilterItems, ...filterItems, ...otherFilterItems] filterItems = [...prefixFilterItems, ...filterItems, ...otherFilterItems]
this.setState({ filterItems, data }) this.setState({ filterItems, data })
// if (!showOrg) return if (!showOrg) {
if (isBlank(data.org_code)) {
show('请先选择组织')
}
return
}
const item = { const item = {
field: 'org_code', field: 'org_code',
label: '组织', label: '组织',
type: FieldType.SELECT, type: FieldType.SELECT,
options: [], options,
display: showOrg, display: showOrg,
rules: [{ required: true, message: '请选择组织' }], rules: [{ required: true, message: '请选择组织' }],
callback: () => { callback: () => {
...@@ -123,7 +136,6 @@ class Filter extends React.Component<IProps, IState> { ...@@ -123,7 +136,6 @@ class Filter extends React.Component<IProps, IState> {
}, },
} }
filterItems = R.insert(0, item, filterItems) filterItems = R.insert(0, item, filterItems)
this.getOrganizations(showOrg)
this.setState({ filterItems, data }) this.setState({ filterItems, data })
} }
...@@ -131,6 +143,7 @@ class Filter extends React.Component<IProps, IState> { ...@@ -131,6 +143,7 @@ class Filter extends React.Component<IProps, IState> {
* @description: 请求组织信息 * @description: 请求组织信息
* @param {*} * @param {*}
* @return {*} * @return {*}
* @deprecated
*/ */
async getOrganizations(showOrg) { async getOrganizations(showOrg) {
const res = await api.getOrganizations() const res = await api.getOrganizations()
...@@ -147,9 +160,6 @@ class Filter extends React.Component<IProps, IState> { ...@@ -147,9 +160,6 @@ class Filter extends React.Component<IProps, IState> {
), ),
R.pathOr([], ['data', 'organizations']), R.pathOr([], ['data', 'organizations']),
)(res) )(res)
if (!showOrg && R.length(item.options) !== 1) {
show('请先选组织')
}
this.setState({ filterItems }) this.setState({ filterItems })
} }
...@@ -160,6 +170,8 @@ class Filter extends React.Component<IProps, IState> { ...@@ -160,6 +170,8 @@ class Filter extends React.Component<IProps, IState> {
*/ */
async getCustomers() { async getCustomers() {
const { data, filterItems } = this.state const { data, filterItems } = this.state
if (isBlank(data.org_code)) return
const params = { const params = {
org_code: data.org_code, org_code: data.org_code,
seller_code: data.seller_code, seller_code: data.seller_code,
...@@ -188,12 +200,16 @@ class Filter extends React.Component<IProps, IState> { ...@@ -188,12 +200,16 @@ class Filter extends React.Component<IProps, IState> {
* @return {*} * @return {*}
*/ */
resetHandler() { resetHandler() {
const { userInfo } = this.props const { userInfo, organizations = [] } = this.props
if (organizations.length !== 1) {
return show('请先选择组织')
}
this.setState( this.setState(
{ {
data: { data: {
seller_code: userInfo.user_name, seller_code: userInfo.user_name,
org_code: R.take(3, userInfo.department_code), org_code: R.pathOr('', [0, 'org_code'])(organizations),
}, },
}, },
() => {}, () => {},
...@@ -241,6 +257,7 @@ class Filter extends React.Component<IProps, IState> { ...@@ -241,6 +257,7 @@ class Filter extends React.Component<IProps, IState> {
const mapStateToProps = state => ({ const mapStateToProps = state => ({
userInfo: state.login.userInfo, userInfo: state.login.userInfo,
sysProfiles: state.login.sysProfiles, sysProfiles: state.login.sysProfiles,
organizations: state.login.organizations,
}) })
const mapDispatchToProps = dispatch => ({}) const mapDispatchToProps = dispatch => ({})
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/invoice/distribution/index.tsx * @FilePath: /BoneHouse_Business_APP/src/pages/invoice/distribution/index.tsx
* @Author: peii * @Author: peii
* @Date: 2021-12-27 09:59:21 * @Date: 2021-12-27 09:59:21
* @LastEditTime: 2022-01-11 09:20:24 * @LastEditTime: 2022-01-12 00:39:24
* @LastEditors: PEII * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: 分销开票申请 * @Description: 分销开票申请
...@@ -125,7 +125,7 @@ class Distribution extends Component<IProps, IState> { ...@@ -125,7 +125,7 @@ class Distribution extends Component<IProps, IState> {
R.propOr([], 'status'), R.propOr([], 'status'),
)(this.props) )(this.props)
args.invoice_flag = 'Y' args.invoice_flag = 'N'
args.header_status = status args.header_status = status
const params = R.filter(isNotBlank)({ const params = R.filter(isNotBlank)({
...args, ...args,
...@@ -160,7 +160,7 @@ class Distribution extends Component<IProps, IState> { ...@@ -160,7 +160,7 @@ class Distribution extends Component<IProps, IState> {
async getLineData(order, loading = false) { async getLineData(order, loading = false) {
const params = { const params = {
settlement_number: order.settlement_number, settlement_number: order.settlement_number,
invoice_flag: 'Y', invoice_flag: 'N',
} }
this.setState({ loading }) this.setState({ loading })
const res = await api.getSettlementLines(params) const res = await api.getSettlementLines(params)
...@@ -259,47 +259,49 @@ class Distribution extends Component<IProps, IState> { ...@@ -259,47 +259,49 @@ class Distribution extends Component<IProps, IState> {
async submitHandler() { async submitHandler() {
const { data, filterData } = this.state const { data, filterData } = this.state
const list = R.filter(R.anyPass([R.propEq('_checked', true), R.propEq('_indeterminate', true)]))(data) const list = R.filter(R.anyPass([R.propEq('_checked', true), R.propEq('_indeterminate', true)]))(data)
const len = R.compose(
R.length, // const len = R.compose(
R.keys, // R.length,
R.groupBy(it => it.org_code + it.customer_code + it.bill_to_site_code), // R.keys,
)(list) // R.groupBy(it => it.org_code + it.customer_code + it.bill_to_site_code),
if (len === 0) { // )(list)
return show('请选择要开票的物料') // if (len === 0) {
} // return show('请选择要开票的物料')
if (len > 1) { // }
return show('存在不同的开票') // if (len > 1) {
} // return show('存在不同的开票')
const lines = R.compose( // }
R.unnest, const submitData = R.map(
R.map(item => { R.applySpec({
return R.compose( settlement_number: R.prop('settlement_number'),
lines: R.compose(
R.map( R.map(
R.applySpec({ R.applySpec({
settlement_number: R.always(item.settlement_number),
line_number: R.prop('line_number'), line_number: R.prop('line_number'),
invoice_quantity: R.prop('quantity'), quantity: R.prop('quantity'),
}), }),
), ),
R.filter(R.propEq('_checked', true)), R.filter(R.propEq('_checked', true)),
R.propOr([], 'lines'), R.propOr([], 'lines'),
)(item) ),
}), }),
)(list) )(list)
const bill_to_site = this.getBillToSite(filterData.customer_code) // const bill_to_site = this.getBillToSite(filterData.customer_code)
const bill_to_site_code = bill_to_site && bill_to_site.bill_to_site_code // const bill_to_site_code = bill_to_site && bill_to_site.bill_to_site_code
const params = { const params = {
org_code: filterData.org_code, // org_code: filterData.org_code,
customer_code: filterData.customer_code, // customer_code: filterData.customer_code,
bill_to_site_code, // bill_to_site_code,
lines, // lines,
process_code: 'APPLY_INVOICE',
data: submitData,
} }
this.setState({ submitting: true }) this.setState({ submitting: true })
const res = await api.postArInvoiceCreate(params) const res = await api.postSettlementUpdate(params)
this.setState({ submitting: false }) this.setState({ submitting: false })
if (res.error_code) return if (res.error_code) return
show('申请提交成功') show('申请提交成功')
this.props.navigation.pop() this.props.navigation.pop()
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/settlement/components/filter.tsx * @FilePath: /BoneHouse_Business_APP/src/pages/settlement/components/filter.tsx
* @Author: peii * @Author: peii
* @Date: 2021-12-19 10:49:42 * @Date: 2021-12-19 10:49:42
* @LastEditTime: 2022-01-11 09:29:12 * @LastEditTime: 2022-01-11 21:52:18
* @LastEditors: PEII * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: 过滤弹窗 * @Description: 过滤弹窗
...@@ -113,28 +113,42 @@ class Filter extends React.Component<IProps, IState> { ...@@ -113,28 +113,42 @@ class Filter extends React.Component<IProps, IState> {
*/ */
setFieldItems() { setFieldItems() {
let { filterItems, data } = this.state let { filterItems, data } = this.state
const { userInfo, sysProfiles, otherFilterItems = [] } = this.props const { sysProfiles, otherFilterItems = [], organizations = [] } = this.props
const showOrg = sysProfiles.OBS_SHOW_ORG_FLAG !== 'N' const showOrg = sysProfiles.OBS_SHOW_ORG_FLAG !== 'N'
data.org_code = userInfo.department_code && R.take(3, userInfo.department_code)
let options = R.map(
R.applySpec({
value: R.prop('org_code'),
label: R.prop('org_name'),
}),
)(organizations)
if (R.length(organizations) === 1) {
data.org_code = R.path([0, 'value'])(options)
}
filterItems = R.concat(filterItems)(otherFilterItems) filterItems = R.concat(filterItems)(otherFilterItems)
this.setState({ filterItems, data }) this.setState({ filterItems, data })
// if (!showOrg) return if (!showOrg) {
if (isBlank(data.org_code)) {
show('请先选择组织')
}
return
}
const item = { const item = {
field: 'org_code', field: 'org_code',
label: '组织', label: '组织',
type: FieldType.SELECT, type: FieldType.SELECT,
options: [], options,
display: showOrg, display: showOrg,
rules: [{ required: true, message: '请选择组织' }], rules: [{ required: true, message: '请选择组织' }],
callback: () => { callback: () => {
data.customer_code = '' data.customer_code = ''
this.getCustomers() this.getCustomers()
} },
} }
filterItems = R.insert(1, item, filterItems) filterItems = R.insert(1, item, filterItems)
this.getOrganizations(showOrg)
this.setState({ filterItems, data }) this.setState({ filterItems, data })
} }
...@@ -142,6 +156,7 @@ class Filter extends React.Component<IProps, IState> { ...@@ -142,6 +156,7 @@ class Filter extends React.Component<IProps, IState> {
* @description: 请求组织信息 * @description: 请求组织信息
* @param {*} * @param {*}
* @return {*} * @return {*}
* @deprecated
*/ */
async getOrganizations(showOrg) { async getOrganizations(showOrg) {
const res = await api.getOrganizations() const res = await api.getOrganizations()
...@@ -158,9 +173,6 @@ class Filter extends React.Component<IProps, IState> { ...@@ -158,9 +173,6 @@ class Filter extends React.Component<IProps, IState> {
), ),
R.pathOr([], ['data', 'organizations']), R.pathOr([], ['data', 'organizations']),
)(res) )(res)
if (!showOrg && R.length(item.options) !== 1) {
show('请先选组织')
}
this.setState({ filterItems }) this.setState({ filterItems })
} }
...@@ -171,6 +183,8 @@ class Filter extends React.Component<IProps, IState> { ...@@ -171,6 +183,8 @@ class Filter extends React.Component<IProps, IState> {
*/ */
async getCustomers() { async getCustomers() {
const { data, filterItems } = this.state const { data, filterItems } = this.state
if (isBlank(data.org_code)) return
const params = { const params = {
org_code: data.org_code, org_code: data.org_code,
seller_code: data.seller_code, seller_code: data.seller_code,
...@@ -198,12 +212,15 @@ class Filter extends React.Component<IProps, IState> { ...@@ -198,12 +212,15 @@ class Filter extends React.Component<IProps, IState> {
* @return {*} * @return {*}
*/ */
resetHandler() { resetHandler() {
const { userInfo } = this.props const { userInfo, organizations = [] } = this.props
if (organizations.length !== 1) {
return show('请先选择组织')
}
this.setState( this.setState(
{ {
data: { data: {
seller_code: userInfo.user_name, seller_code: userInfo.user_name,
org_code: R.take(3, userInfo.department_code), org_code: R.pathOr('', [0, 'org_code'])(organizations),
}, },
}, },
() => {}, () => {},
...@@ -250,6 +267,7 @@ class Filter extends React.Component<IProps, IState> { ...@@ -250,6 +267,7 @@ class Filter extends React.Component<IProps, IState> {
const mapStateToProps = state => ({ const mapStateToProps = state => ({
userInfo: state.login.userInfo, userInfo: state.login.userInfo,
sysProfiles: state.login.sysProfiles, sysProfiles: state.login.sysProfiles,
organizations: state.login.organizations,
}) })
const mapDispatchToProps = dispatch => ({}) const mapDispatchToProps = dispatch => ({})
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* @FilePath: /BoneHouse_Business_APP/src/services/api.ts * @FilePath: /BoneHouse_Business_APP/src/services/api.ts
* @Author: peii * @Author: peii
* @Date: 2021-12-19 16:06:26 * @Date: 2021-12-19 16:06:26
* @LastEditTime: 2022-01-07 11:03:44 * @LastEditTime: 2022-01-11 18:20:31
* @LastEditors: peii * @LastEditors: PEII
* @Vision: 1.0 * @Vision: 1.0
* @Description: 未重构完全暂用的所有请求 * @Description: 未重构完全暂用的所有请求
*/ */
...@@ -94,6 +94,18 @@ export default { ...@@ -94,6 +94,18 @@ export default {
}, },
/** /**
* @description: 分销开票申请
* @param {*}
* @return {*}
*/
postSettlementUpdate(data: {
process_code: string
data: { settlement_number: string; lines: { line_number: string; quantity: number }[] }[]
}) {
return request({ url: `${v}/sale/sal_settlement/update`, data, method: 'post' })
},
/**
* @description: 请求应收发票汇总 * @description: 请求应收发票汇总
* @param {*} * @param {*}
* @return {*} * @return {*}
......
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 sign in to comment