diff --git a/src/ic/ic/sapplybill/card/card.js b/src/ic/ic/sapplybill/card/card.js index cb4ca04..74a6d1c 100644 --- a/src/ic/ic/sapplybill/card/card.js +++ b/src/ic/ic/sapplybill/card/card.js @@ -6,36 +6,36 @@ * @Last Modified by: lizhbo * @Last Modified time: 2019-12-30 13:41:11 */ -import React, { Component } from 'react'; -import { createPage, ajax, high, base } from 'nc-lightapp-front'; -import { initTemplate, transfer } from './init'; -import { headAfterEvent, bodyAfterEvent } from './afterEvents'; -import { headBeforeEvent, bodyBeforeEvent } from './beforeEvents'; -import { btnClickController, buttonController } from './viewController'; +import React, {Component} from 'react'; +import {createPage, ajax, high, base} from 'nc-lightapp-front'; +import {initTemplate, transfer} from './init'; +import {headAfterEvent, bodyAfterEvent} from './afterEvents'; +import {headBeforeEvent, bodyBeforeEvent} from './beforeEvents'; +import {btnClickController, buttonController} from './viewController'; import 'src/scmpub/scmpub/pub/style/common.less'; -import { FIELD, URL, PAGECODE, UISTATE, DISABLEBTNS, BUTTONID_CARD } from '../constance'; -import { getUrlParam } from '../../pub/utils'; +import {FIELD, URL, PAGECODE, UISTATE, DISABLEBTNS, BUTTONID_CARD} from '../constance'; +import {getUrlParam} from '../../pub/utils'; import './index.less'; import btnIsDisableCard from '../../pub/viewController/outbound_card/btnIsDisableCard'; -import { onHandBtnSelected } from '../../pub/btnClicks/onHandSelected'; +import {onHandBtnSelected} from '../../pub/btnClicks/onHandSelected'; import backBtnClick from '../../pub/btnClicks/outboundcard/backBtnClick'; import ExtendRefer from '../../pub/onhandRefer'; -import { getCacheDataByPk, updateCacheData, getDefData } from '../../../../scmpub/scmpub/pub/cache'; +import {getCacheDataByPk, updateCacheData, getDefData} from '../../../../scmpub/scmpub/pub/cache'; import MergePrinting from '../../../../scmpub/scmpub/pub/components/mergePrinting'; import BarCode from '../../pub/components/barcode/index'; -import { RownoUtils } from '../../../../scmpub/scmpub/pub/tool/cardTableTools/RownoUtil'; -import { initLang, getLangByResId } from '../../../../scmpub/scmpub/pub/tool/multiLangUtil'; -import { showSuccessInfo } from '../../../../scmpub/scmpub/pub/tool/messageUtil'; +import {RownoUtils} from '../../../../scmpub/scmpub/pub/tool/cardTableTools/RownoUtil'; +import {initLang, getLangByResId} from '../../../../scmpub/scmpub/pub/tool/multiLangUtil'; +import {showSuccessInfo} from '../../../../scmpub/scmpub/pub/tool/messageUtil'; import commonBodyEvent from '../../pub/afterEvents/commonBodyEvent'; import transtypeUtils from '../../../../scmpub/scmpub/pub/tool/transtypeUtils'; -import { getCardDisableHotKeyBtn } from '../../pub/utils/hotKeysUtil'; +import {getCardDisableHotKeyBtn} from '../../pub/utils/hotKeysUtil'; import inputChange from '../../../../scmpub/scmpub/pub/tool/rownoInputUtil'; -import { commitBtnClick, saveAndCommitBtnClick } from './btnClicks'; -import { createCardTitle } from '../../../../scmpub/scmpub/pub/tool/titleUtil'; +import {commitBtnClick, saveAndCommitBtnClick} from './btnClicks'; +import {createCardTitle} from '../../../../scmpub/scmpub/pub/tool/titleUtil'; -const { BillTrack, NCUploader, ApproveDetail, ApprovalTrans } = high; -const { NCAffix, NCDiv } = base; -const constance = { FIELD, DISABLEBTNS, URL, PAGECODE }; +const {BillTrack, NCUploader, ApproveDetail, ApprovalTrans} = high; +const {NCAffix, NCDiv} = base; +const constance = {FIELD, DISABLEBTNS, URL, PAGECODE}; class SapplyBillCard extends Component { constructor(props) { @@ -45,7 +45,7 @@ class SapplyBillCard extends Component { this.skipCodes = null; //缓存交互式异常类型编码 this.state = { barCodeEnable: false, //条形码value - headRows: { rows: [] }, //存量查拣-表头数据 + headRows: {rows: []}, //存量查拣-表头数据 editable: false, //页面是否可以编辑 billcode: '', status: this.getStatus(), @@ -82,11 +82,21 @@ class SapplyBillCard extends Component { } // 渲染页面后,执行的方法 - componentDidMount() { } + componentDidMount() { + } initData = (isRefresh) => { if (getUrlParam(this.props.getUrlParam, 'type') && !isRefresh) { - this.type = 'ref422x'; + let type = getUrlParam(this.props.getUrlParam, 'type'); + let cbilltype = ''; + if (type == 'ref422x') { + cbilltype = '422X'; + this.type = 'ref422x'; + } else if (type == 'refBljh') { + cbilltype = '55A3'; + this.type = 'refBljh'; + } + let transferIds = this.props.transferTable.getTransferTableSelectedId(); if (transferIds) { let orderbids = new Set(); @@ -97,15 +107,8 @@ class SapplyBillCard extends Component { }); orderhids.add(v.head.pk); }); - let type = getUrlParam(this.props.getUrlParam, 'type'); - let cbilltype = ''; - if (type == 'ref422x') { - cbilltype = '422X'; - } else if (type == 'refBljh') { - cbilltype = '55A3'; - } // let ids = [{ cbilltype: '422X', hids: orderhids, bids: orderbids }]; - let ids = [{ cbilltype: cbilltype, hids: orderhids, bids: orderbids }]; + let ids = [{cbilltype: cbilltype, hids: orderhids, bids: orderbids}]; transfer.call(this, ids); } } else { @@ -125,13 +128,13 @@ class SapplyBillCard extends Component { //不是编辑 if (status == 'edit' && copypk) { //复制 - let data = { pageid: PAGECODE.card, pk: copypk }; + let data = {pageid: PAGECODE.card, pk: copypk}; ajax({ url: URL.copy, data: data, method: 'post', success: (res) => { - this.props.form.setAllFormValue({ [FIELD.formArea]: res.data.billcard.head[FIELD.formArea] }); + this.props.form.setAllFormValue({[FIELD.formArea]: res.data.billcard.head[FIELD.formArea]}); this.props.cardTable.setTableData( FIELD.cardTable, res.data.billcard.body[FIELD.cardTable], @@ -147,7 +150,7 @@ class SapplyBillCard extends Component { } else { billcodeStr = ''; this.props.form.EmptyAllFormValue(FIELD.formArea); - this.props.cardTable.setTableData(FIELD.cardTable, { rows: [] }, null, true, true); + this.props.cardTable.setTableData(FIELD.cardTable, {rows: []}, null, true, true); this.props.BillHeadInfo.setBillHeadInfoVisible({ billCode: billcodeStr //修改单据号---非必传 }); @@ -158,7 +161,7 @@ class SapplyBillCard extends Component { let cacheData = getCacheDataByPk(this.props, FIELD.CacheKey, pk); if (cacheData) { billcodeStr = cacheData.head[FIELD.formArea].rows[0].values.vbillcode.value; - this.props.form.setAllFormValue({ [FIELD.formArea]: cacheData.head[FIELD.formArea] }); + this.props.form.setAllFormValue({[FIELD.formArea]: cacheData.head[FIELD.formArea]}); this.props.cardTable.setTableData( FIELD.cardTable, cacheData.body[FIELD.cardTable], @@ -177,7 +180,7 @@ class SapplyBillCard extends Component { } } //表示是编辑或查看进入,有id(否则就是新增进入) - data = { pk: pk, pageid: PAGECODE.card }; + data = {pk: pk, pageid: PAGECODE.card}; ajax({ url: URL.cardQuery, data: data, @@ -193,11 +196,11 @@ class SapplyBillCard extends Component { } if (!res.data) { billcodeStr = ''; - this.props.form.setAllFormValue(FIELD.formArea, { rows: [{}] }); - this.props.cardTable.setTableData(FIELD.cardTable, { rows: [] }, null, true, true); + this.props.form.setAllFormValue(FIELD.formArea, {rows: [{}]}); + this.props.cardTable.setTableData(FIELD.cardTable, {rows: []}, null, true, true); } else { billcodeStr = res.data.billcard.head[FIELD.formArea].rows[0].values.vbillcode.value; - this.props.form.setAllFormValue({ [FIELD.formArea]: res.data.billcard.head[FIELD.formArea] }); + this.props.form.setAllFormValue({[FIELD.formArea]: res.data.billcard.head[FIELD.formArea]}); this.props.cardTable.setTableData( FIELD.cardTable, res.data.billcard.body[FIELD.cardTable], @@ -239,7 +242,7 @@ class SapplyBillCard extends Component { //切换页面状态 toggleShow = () => { let status = getUrlParam(this.props.getUrlParam, 'status') || UISTATE.browse; - this.setState({ status: status }); + this.setState({status: status}); this.props.form.setFormStatus(FIELD.formArea, status); this.props.cardTable.setStatus(FIELD.cardTable, status); let id = getUrlParam(this.props.getUrlParam, 'id'); @@ -255,12 +258,12 @@ class SapplyBillCard extends Component { }); if (cachpkorg_v && (!pk_org_v || !pk_org_v.value)) { this.props.form.setFormItemsValue(FIELD.formArea, cachpkorg_v); - headAfterEvent.call(this, this.props, FIELD.formArea, 'pk_org_v', { value: cachpkorg_v }); + headAfterEvent.call(this, this.props, FIELD.formArea, 'pk_org_v', {value: cachpkorg_v}); } else if (!pk_org_v || !pk_org_v.value) { this.props.form.EmptyAllFormValue(FIELD.formArea); - this.props.cardTable.setTableData(FIELD.cardTable, { rows: [] }); + this.props.cardTable.setTableData(FIELD.cardTable, {rows: []}); this.props.initMetaByPkorg('pk_org_v'); - this.props.form.setFormItemsDisabled(FIELD.formArea, { pk_org_v: false }); + this.props.form.setFormItemsDisabled(FIELD.formArea, {pk_org_v: false}); } } if (status == 'edit' && !type) { @@ -307,7 +310,7 @@ class SapplyBillCard extends Component { placeholder={getLangByResId(this, '4008PUB-000064') /* 国际化处理: 请输入条形码*/} cannotAddLine={cannotAddLine} setSerMnger={(isLocationManaged, materialSerialMap, materialSnunitMap) => { - this.setState({ isLocationManaged, materialSerialMap, materialSnunitMap }); + this.setState({isLocationManaged, materialSerialMap, materialSnunitMap}); }} {...this.props} /> @@ -315,7 +318,7 @@ class SapplyBillCard extends Component { }; // 控制存量查拣的显示隐藏 toggleOnhandShow = () => { - this.setState({ onhandShow: !this.state.onhandShow }); + this.setState({onhandShow: !this.state.onhandShow}); }; //获取url的status @@ -329,7 +332,7 @@ class SapplyBillCard extends Component { this.curindex = index; let isEdit = this.transferStatus[this.curindex]; //点击转单缩略图的钩子函数 - this.props.form.setAllFormValue({ [FIELD.formArea]: record.head[FIELD.formArea] }, isEdit == 'browse'); + this.props.form.setAllFormValue({[FIELD.formArea]: record.head[FIELD.formArea]}, isEdit == 'browse'); transtypeUtils.setValue.call(this, FIELD.formArea, FIELD.ctrantypeid, FIELD.vtrantypecode); this.props.cardTable.setTableData(FIELD.cardTable, record.body[FIELD.cardTable], null, isEdit == 'browse'); let pk = record.head[FIELD.formArea].rows[0].values.cgeneralhid; @@ -369,24 +372,24 @@ class SapplyBillCard extends Component { getTransferView = () => { let status = this.props.getUrlParam('status') || UISTATE.browse; this.props.controlAutoFocus(true); //取消自动聚焦 - let { headRows = { rows: [] } } = this.state; - let { form, cardTable, button, transferTable, modal } = this.props; - const { createTransferList } = transferTable; - let { createForm } = form; - let { createCardTable } = cardTable; - let { createModal } = modal; + let {headRows = {rows: []}} = this.state; + let {form, cardTable, button, transferTable, modal} = this.props; + const {createTransferList} = transferTable; + let {createForm} = form; + let {createCardTable} = cardTable; + let {createModal} = modal; let buttons = button.getButtons(); - let { showUploader, target } = this.state; + let {showUploader, target} = this.state; let refdatasource = getUrlParam(this.props.getUrlParam, 'type') + 'DataSource'; const MergePrintingProps = { jsonData: this.combineData, toggleConditionModal: () => { - this.setState({ showConditionModal: !this.state.showConditionModal }); + this.setState({showConditionModal: !this.state.showConditionModal}); }, showConditionModal: this.state.showConditionModal }; return ( -