|
|
@@ -66,7 +66,7 @@ class CurrencyDetail extends Component {
|
|
|
super()
|
|
|
|
|
|
this.state = {
|
|
|
- billGroupModelList: [],
|
|
|
+ billGroupList: [],
|
|
|
modalOpen: false,
|
|
|
modalDataSource: new ListView.DataSource({
|
|
|
rowHasChanged: (row1, row2) => row1 !== row2,
|
|
|
@@ -78,6 +78,7 @@ class CurrencyDetail extends Component {
|
|
|
|
|
|
componentDidMount () {
|
|
|
document.title = '新增单据'
|
|
|
+ this.props.onRef && this.props.onRef(this)
|
|
|
const { userState, match, master, caller, id } = this.props
|
|
|
mMaster = match ? match.params.master :
|
|
|
master ? master : userState.accountCode
|
|
|
@@ -124,20 +125,20 @@ class CurrencyDetail extends Component {
|
|
|
{/* fontSize: '16px',*/}
|
|
|
{/* }}*/}
|
|
|
{/* onClick={this.onSubmitClick}>提交</Button>}*/}
|
|
|
- {this.props.children}
|
|
|
+ {formItems.length > 0 && this.props.children}
|
|
|
{this.getDbfindModal()}
|
|
|
</div>
|
|
|
)
|
|
|
}
|
|
|
|
|
|
getFormItems = () => {
|
|
|
- const { billGroupModelList } = this.state
|
|
|
+ const { billGroupList } = this.state
|
|
|
let formItems = []
|
|
|
- if (!isObjEmpty(billGroupModelList)) {
|
|
|
+ if (!isObjEmpty(billGroupList)) {
|
|
|
//从表的起始Groupindex
|
|
|
let gridStartIndex = -1
|
|
|
- for (let g = 0; g < billGroupModelList.length; g++) {
|
|
|
- let billGroup = billGroupModelList[g]
|
|
|
+ for (let g = 0; g < billGroupList.length; g++) {
|
|
|
+ let billGroup = billGroupList[g]
|
|
|
if (!isObjNull(billGroup)) {
|
|
|
let showBillFields = billGroup.showBillFields
|
|
|
if (!isObjNull(showBillFields) &&
|
|
|
@@ -352,29 +353,29 @@ class CurrencyDetail extends Component {
|
|
|
* 放大镜选项选中
|
|
|
*/
|
|
|
onDbfindSelect = (selectModel, rowData) => {
|
|
|
- const { billGroupModelList } = this.state
|
|
|
+ const { billGroupList } = this.state
|
|
|
let groupIndex = selectModel.groupIndex
|
|
|
let childIndex = selectModel.childIndex
|
|
|
let selectData = rowData
|
|
|
if (selectModel.type === 'C') {
|
|
|
- if (!isObjEmpty(billGroupModelList) &&
|
|
|
- !isObjNull(billGroupModelList[groupIndex])) {
|
|
|
- let billGroup = billGroupModelList[groupIndex]
|
|
|
+ if (!isObjEmpty(billGroupList) &&
|
|
|
+ !isObjNull(billGroupList[groupIndex])) {
|
|
|
+ let billGroup = billGroupList[groupIndex]
|
|
|
billGroup.showBillFields[childIndex].value = selectData.value
|
|
|
billGroup.showBillFields[childIndex].display = selectData.display
|
|
|
}
|
|
|
this.setState({
|
|
|
- billGroupModelList,
|
|
|
+ billGroupList,
|
|
|
modalOpen: false,
|
|
|
selectModel: {},
|
|
|
})
|
|
|
} else {
|
|
|
let dataObj = selectData.obj
|
|
|
let isForm = selectModel.isForm
|
|
|
- if (!isObjEmpty(billGroupModelList) &&
|
|
|
- !isObjNull(billGroupModelList[groupIndex])) {
|
|
|
+ if (!isObjEmpty(billGroupList) &&
|
|
|
+ !isObjNull(billGroupList[groupIndex])) {
|
|
|
if (isForm == true) {
|
|
|
- billGroupModelList.forEach((billGroup, index) => {
|
|
|
+ billGroupList.forEach((billGroup, index) => {
|
|
|
if (!isObjNull(billGroup) && billGroup.isForm) {
|
|
|
let showBillFields = billGroup.showBillFields
|
|
|
let hideBillFields = billGroup.hideBillFields
|
|
|
@@ -395,7 +396,7 @@ class CurrencyDetail extends Component {
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
- let billGroup = billGroupModelList[groupIndex]
|
|
|
+ let billGroup = billGroupList[groupIndex]
|
|
|
if (!isObjNull(billGroup)) {
|
|
|
let showBillFields = billGroup.showBillFields
|
|
|
let hideBillFields = billGroup.hideBillFields
|
|
|
@@ -416,9 +417,9 @@ class CurrencyDetail extends Component {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- // console.log(billGroupModelList)
|
|
|
+ // console.log(billGroupList)
|
|
|
this.setState({
|
|
|
- billGroupModelList,
|
|
|
+ billGroupList,
|
|
|
modalOpen: false,
|
|
|
selectModel: {},
|
|
|
})
|
|
|
@@ -454,15 +455,15 @@ class CurrencyDetail extends Component {
|
|
|
* @param groupIndex
|
|
|
*/
|
|
|
onAddClick = groupIndex => {
|
|
|
- const { billGroupModelList } = this.state
|
|
|
- billGroupModelList[groupIndex].lastInType = false
|
|
|
+ const { billGroupList } = this.state
|
|
|
+ billGroupList[groupIndex].lastInType = false
|
|
|
|
|
|
let newBillGroup = this.newGridBillGroup(groupIndex,
|
|
|
- billGroupModelList[groupIndex])
|
|
|
- billGroupModelList.push(newBillGroup)
|
|
|
- console.log('newgroup', billGroupModelList)
|
|
|
+ billGroupList[groupIndex])
|
|
|
+ billGroupList.push(newBillGroup)
|
|
|
+ console.log('newgroup', billGroupList)
|
|
|
this.setState({
|
|
|
- billGroupModelList,
|
|
|
+ billGroupList,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -554,39 +555,39 @@ class CurrencyDetail extends Component {
|
|
|
* @param groupIndex
|
|
|
*/
|
|
|
deleteGroup (groupIndex) {
|
|
|
- const { billGroupModelList } = this.state
|
|
|
- let deleteGroup = billGroupModelList[groupIndex]
|
|
|
+ const { billGroupList } = this.state
|
|
|
+ let deleteGroup = billGroupList[groupIndex]
|
|
|
let isLastGroup = deleteGroup.lastInType
|
|
|
if (isLastGroup == true && groupIndex - 1 >= 0) {
|
|
|
- let billGroup = billGroupModelList[groupIndex - 1]
|
|
|
+ let billGroup = billGroupList[groupIndex - 1]
|
|
|
if (deleteGroup.isForm == false && (billGroup.isForm == true)) {
|
|
|
//明细删除光了,要默认添加一个空明细表
|
|
|
deleteGroup.groupIndex = groupIndex - 1
|
|
|
deleteGroup.gridIndex = 0
|
|
|
let newGridGroup = this.newGridBillGroup(groupIndex - 1, deleteGroup)
|
|
|
newGridGroup.isDeleteAble = false
|
|
|
- billGroupModelList.splice(groupIndex, 1)
|
|
|
- billGroupModelList.push(newGridGroup)
|
|
|
+ billGroupList.splice(groupIndex, 1)
|
|
|
+ billGroupList.push(newGridGroup)
|
|
|
} else {
|
|
|
billGroup.lastInType = true
|
|
|
- billGroupModelList.splice(groupIndex, 1)
|
|
|
+ billGroupList.splice(groupIndex, 1)
|
|
|
}
|
|
|
} else {
|
|
|
- billGroupModelList.splice(groupIndex, 1)
|
|
|
+ billGroupList.splice(groupIndex, 1)
|
|
|
}
|
|
|
|
|
|
this.setState({
|
|
|
- billGroupModelList,
|
|
|
+ billGroupList,
|
|
|
}, () => {
|
|
|
this.forceUpdate()
|
|
|
})
|
|
|
}
|
|
|
|
|
|
onInputClick = (groupIndex, childIndex) => {
|
|
|
- const { billGroupModelList } = this.state
|
|
|
- if (!isObjNull(billGroupModelList) &&
|
|
|
- !isObjNull(billGroupModelList[groupIndex])) {
|
|
|
- let billGroup = billGroupModelList[groupIndex]
|
|
|
+ const { billGroupList } = this.state
|
|
|
+ if (!isObjNull(billGroupList) &&
|
|
|
+ !isObjNull(billGroupList[groupIndex])) {
|
|
|
+ let billGroup = billGroupList[groupIndex]
|
|
|
if (!isObjNull(billGroup.showBillFields) &&
|
|
|
!isObjNull(billGroup.showBillFields[childIndex])) {
|
|
|
let billModel = billGroup.showBillFields[childIndex]
|
|
|
@@ -766,10 +767,10 @@ class CurrencyDetail extends Component {
|
|
|
}
|
|
|
|
|
|
onTextChange = (groupIndex, childIndex, value, display) => {
|
|
|
- const { billGroupModelList } = this.state
|
|
|
- if (!isObjNull(billGroupModelList) &&
|
|
|
- !isObjNull(billGroupModelList[groupIndex])) {
|
|
|
- let billGroup = billGroupModelList[groupIndex]
|
|
|
+ const { billGroupList } = this.state
|
|
|
+ if (!isObjNull(billGroupList) &&
|
|
|
+ !isObjNull(billGroupList[groupIndex])) {
|
|
|
+ let billGroup = billGroupList[groupIndex]
|
|
|
if (!isObjNull(billGroup.showBillFields) &&
|
|
|
!isObjNull(billGroup.showBillFields[childIndex])) {
|
|
|
billGroup.showBillFields[childIndex].value = value
|
|
|
@@ -779,16 +780,16 @@ class CurrencyDetail extends Component {
|
|
|
}
|
|
|
}
|
|
|
this.setState({
|
|
|
- billGroupModelList,
|
|
|
+ billGroupList,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
onSubmitClick = () => {
|
|
|
- const { billGroupModelList } = this.state
|
|
|
- if (!isObjEmpty(billGroupModelList)) {
|
|
|
+ const { billGroupList } = this.state
|
|
|
+ if (!isObjEmpty(billGroupList)) {
|
|
|
let formFields = [], gridGroupFields = []
|
|
|
- for (let i = 0; i < billGroupModelList.length; i++) {
|
|
|
- let billGroup = billGroupModelList[i]
|
|
|
+ for (let i = 0; i < billGroupList.length; i++) {
|
|
|
+ let billGroup = billGroupList[i]
|
|
|
if (isObjNull(billGroup)) {
|
|
|
continue
|
|
|
}
|
|
|
@@ -1006,11 +1007,11 @@ class CurrencyDetail extends Component {
|
|
|
Toast.hide()
|
|
|
// let billGroupModels = this.handlerBill(response)
|
|
|
// this.setState({
|
|
|
- // billGroupModelList: billGroupModels,
|
|
|
+ // billGroupList: billGroupModels,
|
|
|
// })
|
|
|
const billGroupList = analysisFormData(response.data, isDetail)
|
|
|
this.setState({
|
|
|
- billGroupModelList: billGroupList,
|
|
|
+ billGroupList: billGroupList,
|
|
|
})
|
|
|
}).catch(error => {
|
|
|
Toast.hide()
|