Browse Source

【nev-pc】客户退拆暂存

ag_report_nev
安虹睿 1 year ago
parent
commit
4f259d2b56
  1. 1
      fe/PC/src/components/currenForm/index.vue
  2. 452
      fe/PC/src/views/finishedProductManage/dismantle/StepsFormTree/index.vue
  3. 280
      fe/PC/src/views/finishedProductManage/dismantle/StepsFormTree/index_tabletree.vue
  4. 549
      fe/PC/src/views/finishedProductManage/dismantle/StepsFormTree/index_tree.vue
  5. 143
      fe/PC/src/views/finishedProductManage/dismantle/customerDismantleJob-tabletree.vue
  6. 515
      fe/PC/src/views/finishedProductManage/dismantle/customerDismantleJob-tree.vue
  7. 101
      fe/PC/src/views/finishedProductManage/dismantle/customerDismantleJob.vue

1
fe/PC/src/components/currenForm/index.vue

@ -439,6 +439,7 @@
:loading="loading" :loading="loading"
:style="{float:item.float}" :style="{float:item.float}"
@click="submitForm(index,item)" @click="submitForm(index,item)"
:disabled="item.disabled"
>{{ item.label }}</el-button >{{ item.label }}</el-button
> >
</div> </div>

452
fe/PC/src/views/finishedProductManage/dismantle/StepsFormTree/index.vue

@ -50,51 +50,36 @@
@submitForm="editFormClick(arguments)" @submitForm="editFormClick(arguments)"
> >
<template> <template>
<el-form-item class="formTable-box " prop="details" v-if="active == 1"> <el-form-item class="formTable-box" prop="details" v-if="active == 1">
<b style="font-size:20px;padding-bottom:10px">父级物料代码{{ propsData.details[0].itemCode }}</b> <!-- <b style="font-size:20px;padding-bottom:10px">父级物料代码{{ propsData.details[0].itemCode }}</b> -->
<el-table <el-tree
height="85%" :check-strictly="true"
ref="bomTree_Ref" ref="bomTree_Ref"
:size="'normal'"
style="width:70%;min-width:800px"
:data="CreateFormData.details" :data="CreateFormData.details"
style="width: 100%;margin-bottom: 20px;" show-checkbox
row-key="id" node-key="id"
:border="true"
default-expand-all default-expand-all
@select="tableHandleSelect" @check="handleNodeCheck"
@select-all="tableHandleSelectAll" :expand-on-click-node="false">
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"> <div class="custom-tree-node" slot-scope="{ node, data }">
<el-table-column <div class="itemCode">{{ data.itemCode }}</div>
type="selection" <div class="right">
:selectable="((row,index)=>{return index != 0})" <div class="qty">{{ data.qty }}</div>
width="55"> <div class="locationCode">
</el-table-column> <filterSelect
<el-table-column v-if="data.id != CreateFormData.details[0].id"
:prop="detailsTableColumns[0].prop" :selectModel="data[detailsTableColumns[2].prop]"
:label="detailsTableColumns[0].label" :selectItem="detailsTableColumns[2]"
width="auto" :tableScope="node"
> @filterOptionSelectHandle="(item,props,val)=>{filterOptionSelectHandle(item,props,val,data)}"
</el-table-column> @filterClearHandle="(item)=>{filterClearHandle(item,data)}"
<el-table-column ></filterSelect>
:prop="detailsTableColumns[1].prop" </div>
:label="detailsTableColumns[1].label" </div>
width="auto"> </div>
</el-table-column> </el-tree>
<el-table-column
:prop="detailsTableColumns[2].prop"
:label="detailsTableColumns[2].label"
>
<template slot-scope="scope">
<filterSelect
v-if="scope.$index != 0"
:selectModel="scope.row[detailsTableColumns[2].prop]"
:selectItem="detailsTableColumns[2]"
:tableScope="scope"
@filterOptionSelectHandle="(item,props,val)=>{filterOptionSelectHandle(item,props,val,scope)}"
@filterClearHandle="(item)=>{filterClearHandle(item,scope)}"
></filterSelect>
</template>
</el-table-column>
</el-table>
</el-form-item> </el-form-item>
</template> </template>
</curren-Form> </curren-Form>
@ -138,9 +123,9 @@
<el-button type="primary" size="medium" @click="resubmit()" <el-button type="primary" size="medium" @click="resubmit()"
>重新提交</el-button >重新提交</el-button
> >
<el-button type="primary" size="medium" @click="active--" <!-- <el-button type="primary" size="medium" @click="resultToLast()"
>上一步</el-button >上一步</el-button
> > -->
<el-button type="primary" size="medium" @click="close(1)" <el-button type="primary" size="medium" @click="close(1)"
>退出</el-button >退出</el-button
> >
@ -177,7 +162,22 @@ export default {
}else if(val == 1){ }else if(val == 1){
this.editHandle=[ this.editHandle=[
{ label: "上一步", name: "cancel" }, { label: "上一步", name: "cancel" },
{ label: "提交", type: "primary", name: "determine" }, { label: "提交", type: "primary", name: "determine",disabled:true },
];
}
},
//
canCommit(val){
console.log(171,val)
if(val && this.active == 1){
this.editHandle=[
{ label: "上一步", name: "cancel" },
{ label: "提交", type: "primary", name: "determine",disabled:false },
];
}else{
this.editHandle=[
{ label: "上一步", name: "cancel" },
{ label: "提交", type: "primary", name: "determine",disabled:true },
]; ];
} }
}, },
@ -358,8 +358,10 @@ export default {
parentId:'parentId', parentId:'parentId',
// id:'itemCode', // id:'itemCode',
// parentId:'parentCode', // parentId:'parentCode',
children:'children' children:'children',
parent:'parent'
}, },
canCommit:false,
} }
}, },
mounted () { mounted () {
@ -371,12 +373,94 @@ export default {
} }
}, },
methods: { methods: {
// // tree
toggleSelection(rows,type){ toggleCheckSelect(rows,type){
rows.forEach(row => { rows.forEach(row => {
row.isCheck = type row.isCheck = type
this.$refs.bomTree_Ref.toggleRowSelection(row,type); this.$refs.bomTree_Ref.setChecked(row,type);
}); });
this.$nextTick(()=>{
this.checkCanCommit()
})
},
// 1 ==> ××
// 2 ==> /×
// 3 ==>
// 4 ==>
handleNodeCheck(row,node){
if(row.id == this.CreateFormData.details[0].id){
// todo:
// let _selectData = this.getBomAllSelect()
// //
// if(_selectData.length <= 0){ this.isAllCheck = false }
// //
// let _selectsIds = []
// _selectData.forEach(item=>{_selectsIds.push(item.id)})
// let _lastData = this.getLastFloors(this.CreateFormData.details)
// let _lastIds = []
// _lastData.forEach(item=>{_lastIds.push(item.id)})
// if (_selectsIds.length !== _lastIds.length) { this.isAllCheck = false }
// console.log(403,_selectsIds.every((item) => _lastIds.includes(item)))
// if(_selectsIds.every((item) => _lastIds.includes(item))){
// this.isAllCheck = false
// }else{
// this.isAllCheck = true
// }
//
if(this.isAllCheck){
this.isAllCheck = !this.isAllCheck
console.log("全不选")
this.$refs.bomTree_Ref.setCheckedKeys([]);
this.selectData = []
this.setAllDataNotCheck()
this.$nextTick(()=>{
this.checkCanCommit()
})
}
//
else{
this.isAllCheck = !this.isAllCheck
console.log("全选")
//
this.selectData = this.getLastFloors(this.CreateFormData.details)
this.$refs.bomTree_Ref.setCheckedKeys([]);
this.setAllDataNotCheck()
this.toggleCheckSelect(this.selectData,true)
}
}else{
//
if(node.checkedKeys.indexOf(row.id) >= 0){
row.isCheck = true
console.log("勾选", row)
//
let _allChildren = this.getAllChildren(row[this.config.children], this.config.children)
//
let _allParents = this.getAllParents(row.parentId)
// ()
let _allPeerNoSon = this.getPeerByFilter(row,false)
this.$nextTick(()=>{
// 1×
if(_allChildren){ this.toggleCheckSelect(_allChildren,false) }
// 2×
if(_allParents){ this.toggleCheckSelect(_allParents,false) }
// 3
if(_allPeerNoSon){ this.toggleCheckSelect(_allPeerNoSon,true) }
})
}
//
else {
console.log("取消勾选")
//
row.isCheck = false
// ()
let _allPeerNoSon = this.getPeerByFilter(row,false)
this.$nextTick(()=>{
//
if(_allPeerNoSon){ this.toggleCheckSelect(_allPeerNoSon,false) }
})
}
}
}, },
// filterSelectoption // filterSelectoption
filterOptionSelectHandle(item,props,val,scope){ filterOptionSelectHandle(item,props,val,scope){
@ -386,158 +470,63 @@ export default {
filterClearHandle(item,scope){ filterClearHandle(item,scope){
this.$emit("clear", item,scope); this.$emit("clear", item,scope);
}, },
// //
findAllPeer(row,data){ getAllChildren(nodes, childProperty) {
let _peerArr = null// if(!nodes)return[]
if(!data){data = this.CreateFormData.details} let allNodes = [];
for(let i = 0;i<data.length;i++){ (function getNodes(nodes) {
console.log(393,data[i][this.config.id],row[this.config.parentId],data[i]) nodes.forEach(node => {
if(data[i][this.config.id] == row[this.config.parentId]){ allNodes.push(node);
_peerArr = data[i][this.config.children]; if (node[childProperty]) {
break getNodes(node[childProperty]);
} }
else{ });
if(data[i][this.config.children] && data[i][this.config.children].length > 0){ })(nodes);
const _res = this.findAllPeer(row,data[i][this.config.children]) return allNodes;
if(_res) _peerArr = _res },
} //
} getAllParents(id,list) {
} if(!list){list = this.CreateFormData.details}
console.log(405,_peerArr,row[this.config.parentId]) for (let i in list) {
return _peerArr if (list[i].id == id) {
}, return [list[i]]
//
findChildren(row,data){
let _childrenArr = null//
if(!data){data = this.CreateFormData.details}
for(let i = 0;i<data.length;i++){
if(data[i][this.config.id] == row[this.config.id]){
_childrenArr = data[i][this.config.children];
break
} }
else{ if (list[i][this.config.children]) {
if(data[i][this.config.children] && data[i][this.config.children].length > 0){ let node = this.getAllParents(id,list[i][this.config.children]);
const _res = this.findChildren(row,data[i][this.config.children]) if (node !== undefined) {
if(_res) _childrenArr = _res return node.concat(list[i])
} }
} }
} }
return _childrenArr
}, },
// chilred //
findPeerForCheckHandle(row,data){ getAllPeer(row,data){
// debugger
if(!data){data = this.CreateFormData.details}
let _peerArr = null// let _peerArr = null//
if(!data){data = this.CreateFormData.details}
for(let i = 0;i<data.length;i++){ for(let i = 0;i<data.length;i++){
if(data[i][this.config.id] == row[this.config.parentId]){ if(data[i][this.config.id] == row[this.config.parentId]){
// _peerArr = data[i][this.config.children];
_peerArr = []
data[i][this.config.children].forEach(item=>{
if(item[this.config.children] && item[this.config.children].length > 0){
let sonHasCheck = 0
item[this.config.children].forEach(son=>{
if(son.isCheck){sonHasCheck ++}
})
if(sonHasCheck == 0){
item.isCheck=true
_peerArr.push(item)
}
}else{
item.isCheck=true
_peerArr.push(item)
}
})
break break
} }
else { else{
if(data[i][this.config.children] && data[i][this.config.children].length > 0){ if(data[i][this.config.children] && data[i][this.config.children].length > 0){
const _res = this.findPeerForCheckHandle(row,data[i][this.config.children]) const _res = this.getAllPeer(row,data[i][this.config.children])
if(_res) _peerArr = _res if(_res) _peerArr = _res
} }
} }
} }
return _peerArr return _peerArr
}, },
// // /
findParentRow(row,data){ getPeerByFilter(row,hasSon){
if(!data){data = this.CreateFormData.details} let childProperty = this.config.children
let _parentRow = null// let _allPeer = this.getAllPeer(row)//
for(let i = 0;i<data.length;i++){ let _peerExcSelf = _allPeer.filter(item=>{return item.id != row.id})//
if(data[i][this.config.id] == row[this.config.parentId]){ //
_parentRow = data[i] let _peerHasSon = _peerExcSelf.filter(item=>{return item[childProperty] && item[childProperty].length > 0})
break //
}else{ let _peerNoSon = _peerExcSelf.filter(item=>{return !item[childProperty] || item[childProperty].length <= 0})
if(data[i][this.config.children] && data[i][this.config.children].length > 0){ return hasSon ? _peerHasSon : _peerNoSon
const _res = this.findParentRow(row,data[i][this.config.children])
if(_res) _parentRow = _res
}
}
}
return _parentRow
},
// 1
// 2
// 3
// 4
//
tableHandleSelect(selection, row){
this.selectData = selection
const isCheck = selection.length && selection.indexOf(row) !== -1
if(selection.length <= 0){}
if (isCheck) {
row.isCheck = true
console.log("勾选",selection, row)
let _peerArr = this.findPeerForCheckHandle(row)
let _parentRow = this.findParentRow(row)
let _parentPeerArr = _parentRow ? this.findPeerForCheckHandle(_parentRow) : []
let _allCheck = [..._peerArr,..._parentPeerArr]
let _childrenArr = this.findChildren(row)
// +
this.$nextTick(()=>{
// 1+
if(_allCheck){ this.toggleSelection(_allCheck,true) }
// 2
this.toggleSelection([_parentRow],false)
// 3
if(_childrenArr){ this.toggleSelection(_childrenArr,false) }
})
}else{
//
row.isCheck = false
console.log("取消勾选",selection, row)
let _peerArr = this.findAllPeer(row)//arr
let _parentRow = this.findParentRow(row)//row
let _parentPeerArr = _parentRow ? this.findAllPeer(_parentRow) : []//arr
//
let _parentPeerShow = 0
_parentPeerArr.forEach(item=>{if(item.isCheck){_parentPeerShow ++}})
// let _parentPeerSonArr = []//arr
// if(_parentPeerArr){
// _parentPeerArr.forEach(item=>{
// if(this.findChildren(item)){
// _parentPeerSonArr = [..._parentPeerSonArr,...this.findChildren(item)]
// }
// })
// }
console.log("父节点",_parentRow)
console.log("父级同级",_parentPeerArr)
console.log("同级",_peerArr)
// ,,
this.$nextTick(()=>{
// 1
if(_peerArr){ this.toggleSelection(_peerArr,false) }
console.log(111,this.CreateFormData.details)
// 2,
if((_parentPeerShow > 0 || row.parentId == _parentRow.id) && _parentRow.id != _parentRow.parentId){
this.toggleSelection([_parentRow],true)
}
// // 3
// if(_parentPeerSonArr){
// this.toggleSelection(_parentPeerSonArr,false)
// }
})
}
}, },
// //
getLastFloors(root, onePathDeep = 1, deepArr = []){ getLastFloors(root, onePathDeep = 1, deepArr = []){
@ -553,21 +542,45 @@ export default {
} }
return deepArr; return deepArr;
}, },
// // ischeckfalse
tableHandleSelectAll(selection){ setAllDataNotCheck(data){
this.isAllCheck = !this.isAllCheck if(!data)data = this.CreateFormData.details
if(this.isAllCheck){ data.forEach(item=>{
console.log("全选",selection) item.isCheck = false;
// if(item.children){
this.selectData = this.getLastFloors(this.CreateFormData.details) this.setAllDataNotCheck(item.children)
this.$refs.bomTree_Ref.clearSelection(); }
this.toggleSelection(this.selectData,true) })
}else{ },
console.log("全不选",selection) //
this.$refs.bomTree_Ref.clearSelection(); checkCanCommit(){
this.selectData = [] let _allselect = this.getBomAllSelect()
this.CreateFormData.details.forEach(item=>{item.isCheck = false}) console.log(540,_allselect)
if(_allselect.length <= 0){
this.canCommit = false
return
} }
let _last = this.getLastFloors(this.CreateFormData.details)
let _isError = 0
_last.forEach(last_item=>{
let _currentAllParents = this.getAllParents(last_item.parentId)
//
if(last_item.isCheck){
_currentAllParents.forEach(parent_item=>{
if(parent_item.isCheck)_isError++
})
}
//
else{
let _parentIsCheck = 0
_currentAllParents.forEach(parent_item=>{
if(parent_item.isCheck)_parentIsCheck++
})
if(_parentIsCheck != 1){ _isError++ }
}
})
console.log(547,_isError)
this.canCommit = (_isError == 0)
}, },
//退 //退
close (val) { close (val) {
@ -600,6 +613,7 @@ export default {
this.loading = false this.loading = false
}) })
}, },
//
getBomAllSelect(data){ getBomAllSelect(data){
if(!data){ if(!data){
data = this.CreateFormData.details data = this.CreateFormData.details
@ -613,7 +627,6 @@ export default {
this.getBomAllSelect(item.children) this.getBomAllSelect(item.children)
} }
}) })
console.log(616,this.selectData)
return this.selectData return this.selectData
}, },
editFormClick (val) { editFormClick (val) {
@ -649,8 +662,6 @@ export default {
parent.PalletlFunction(this.active).then(res => { parent.PalletlFunction(this.active).then(res => {
// //
this.loading = false this.loading = false
console.log(6666,this.CreateFormData.details)
console.log(6666222,this.getBomAllSelect())
parent.stepsSubmit().then(res => { parent.stepsSubmit().then(res => {
this.pageStatus = 'success' this.pageStatus = 'success'
this.active++ this.active++
@ -691,6 +702,12 @@ export default {
this.loading = false this.loading = false
}) })
}, },
resultToLast(){
this.active--;
this.isAllCheck = false,
this.selectData = [],
this.setAllDataNotCheck()
},
// //
openAddNew () { openAddNew () {
const parent = this.$parent const parent = this.$parent
@ -717,12 +734,33 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./style/index.scss"; @import "./style/index.scss";
// todo: ::v-deep .el-tree-node__content{
::v-deep .el-checkbox{ margin-bottom:15px;
&.is-disabled{ padding-top: 5px;
.el-checkbox__inner{ }
visible:hidden .custom-tree-node {
} flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
.right{
flex: 1;
display: flex;
align-items: center;
justify-content: flex-end;
font-size: 14px;
padding-right: 8px;
}
.qty{
padding-right:200px
}
&:hover{
background:#ccdcf9
} }
} }
</style> </style>

280
fe/PC/src/views/finishedProductManage/dismantle/StepsFormTree/index_ischeck.vue → fe/PC/src/views/finishedProductManage/dismantle/StepsFormTree/index_tabletree.vue

@ -138,9 +138,9 @@
<el-button type="primary" size="medium" @click="resubmit()" <el-button type="primary" size="medium" @click="resubmit()"
>重新提交</el-button >重新提交</el-button
> >
<el-button type="primary" size="medium" @click="active--" <!-- <el-button type="primary" size="medium" @click="resultToLast()"
>上一步</el-button >上一步</el-button
> > -->
<el-button type="primary" size="medium" @click="close(1)" <el-button type="primary" size="medium" @click="close(1)"
>退出</el-button >退出</el-button
> >
@ -177,7 +177,21 @@ export default {
}else if(val == 1){ }else if(val == 1){
this.editHandle=[ this.editHandle=[
{ label: "上一步", name: "cancel" }, { label: "上一步", name: "cancel" },
{ label: "提交", type: "primary", name: "determine" }, { label: "提交", type: "primary", name: "determine",disabled:true },
];
}
},
//
canCommit(val){
if(val && this.active == 1){
this.editHandle=[
{ label: "上一步", name: "cancel" },
{ label: "提交", type: "primary", name: "determine",disabled:false },
];
}else{
this.editHandle=[
{ label: "上一步", name: "cancel" },
{ label: "提交", type: "primary", name: "determine",disabled:true },
]; ];
} }
}, },
@ -358,8 +372,10 @@ export default {
parentId:'parentId', parentId:'parentId',
// id:'itemCode', // id:'itemCode',
// parentId:'parentCode', // parentId:'parentCode',
children:'children' children:'children',
parent:'parent'
}, },
canCommit:false,
} }
}, },
mounted () { mounted () {
@ -371,11 +387,16 @@ export default {
} }
}, },
methods: { methods: {
// //
toggleSelection(rows,type){ toggleSelection(rows,type){
rows.forEach(row => { rows.forEach(row => {
row.isCheck = type
this.$refs.bomTree_Ref.toggleRowSelection(row,type); this.$refs.bomTree_Ref.toggleRowSelection(row,type);
}); });
this.$nextTick(()=>{
this.checkCanCommit()
})
}, },
// filterSelectoption // filterSelectoption
filterOptionSelectHandle(item,props,val,scope){ filterOptionSelectHandle(item,props,val,scope){
@ -385,144 +406,99 @@ export default {
filterClearHandle(item,scope){ filterClearHandle(item,scope){
this.$emit("clear", item,scope); this.$emit("clear", item,scope);
}, },
// //
findAllPeer(row,data,isCheck){ getAllChildren(nodes, childProperty) {
let _peerArr = []// if(!nodes)return[]
if(!data){data = this.CreateFormData.details} let allNodes = [];
for(let i = 0;i<data.length;i++){ (function getNodes(nodes) {
if(data[i][this.config.id] == row[this.config.parentId]){ nodes.forEach(node => {
data[i].isCheck = isCheck allNodes.push(node);
_peerArr = data[i][this.config.children]; if (node[childProperty]) {
break getNodes(node[childProperty]);
} }
else{ });
if(data[i][this.config.children] && data[i][this.config.children].length > 0){ })(nodes);
const _res = this.findAllPeer(row,data[i][this.config.children],isCheck) return allNodes;
if(_res) _peerArr = _res },
} //
} getAllParents(id,list) {
} if(!list){list = this.CreateFormData.details}
return _peerArr for (let i in list) {
}, if (list[i].id == id) {
// return [list[i]]
findChildren(row,data,isCheck){
let _childrenArr = []//
if(!data){data = this.CreateFormData.details}
for(let i = 0;i<data.length;i++){
if(data[i][this.config.id] == row[this.config.id]){
data[i].isCheck = isCheck
_childrenArr = data[i][this.config.children];
break
} }
else{ if (list[i][this.config.children]) {
if(data[i][this.config.children] && data[i][this.config.children].length > 0){ let node = this.getAllParents(id,list[i][this.config.children]);
const _res = this.findChildren(row,data[i][this.config.children],isCheck) if (node !== undefined) {
if(_res) _childrenArr = _res return node.concat(list[i])
} }
} }
} }
return _childrenArr
}, },
// chilred //
findPeerForCheckHandle(row,data,isCheck){ getAllPeer(row,data){
// debugger
if(!data){data = this.CreateFormData.details}
let _peerArr = null// let _peerArr = null//
if(!data){data = this.CreateFormData.details}
for(let i = 0;i<data.length;i++){ for(let i = 0;i<data.length;i++){
if(data[i][this.config.id] == row[this.config.parentId]){ if(data[i][this.config.id] == row[this.config.parentId]){
// _peerArr = data[i][this.config.children];
_peerArr = []
data[i][this.config.children].forEach(item=>{
if(item[this.config.children] && item[this.config.children].length > 0){
let sonHasCheck = 0
item[this.config.children].forEach(son=>{
if(son.isCheck){sonHasCheck ++}
})
if(sonHasCheck == 0){
item.isCheck=isCheck
_peerArr.push(item)
}
}else{
item.isCheck=isCheck
_peerArr.push(item)
}
})
break break
} }
else { else{
if(data[i][this.config.children] && data[i][this.config.children].length > 0){ if(data[i][this.config.children] && data[i][this.config.children].length > 0){
const _res = this.findPeerForCheckHandle(row,data[i][this.config.children],isCheck) const _res = this.getAllPeer(row,data[i][this.config.children])
if(_res) _peerArr = _res if(_res) _peerArr = _res
} }
} }
} }
return _peerArr return _peerArr
}, },
// // /
findParentRow(row,data,isCheck){ getPeerByFilter(row,hasSon){
if(!data){data = this.CreateFormData.details} let childProperty = this.config.children
let _parentRow = null// let _allPeer = this.getAllPeer(row)//
for(let i = 0;i<data.length;i++){ let _peerExcSelf = _allPeer.filter(item=>{return item.id != row.id})//
if(data[i][this.config.id] == row[this.config.parentId]){ //
data[i].isCheck = isCheck let _peerHasSon = _peerExcSelf.filter(item=>{return item[childProperty] && item[childProperty].length > 0})
_parentRow = data[i] //
break let _peerNoSon = _peerExcSelf.filter(item=>{return !item[childProperty] || item[childProperty].length <= 0})
}else{ return hasSon ? _peerHasSon : _peerNoSon
if(data[i][this.config.children] && data[i][this.config.children].length > 0){ },
const _res = this.findParentRow(row,data[i][this.config.children],isCheck) // 1 ==> ××
if(_res) _parentRow = _res // 2 ==> /×
} // 3 ==>
} // 4 ==>
} //
return _parentRow
},
// 1
// 2
// 3
// 4
// todo:toggleSelectionisCheck
tableHandleSelect(selection, row){ tableHandleSelect(selection, row){
this.selectData = selection
const isCheck = selection.length && selection.indexOf(row) !== -1 const isCheck = selection.length && selection.indexOf(row) !== -1
if(selection.length <= 0){} if(selection.length <= 0){}
if (isCheck) { if (isCheck) {
row.isCheck = true row.isCheck = true
console.log("勾选",selection, row) console.log("勾选",selection, row)
let _peerArr = this.findPeerForCheckHandle(row,false,true) //
let _parentRow = this.findParentRow(row,false,false) let _allChildren = this.getAllChildren(row[this.config.children], this.config.children)
let _parentPeerArr = _parentRow ? this.findPeerForCheckHandle(_parentRow,false,true) : [] //
let _allCheck = [..._peerArr,..._parentPeerArr] let _allParents = this.getAllParents(row.parentId)
let _childrenArr = this.findChildren(row,false,false) // ()
// let _allPeerNoSon = this.getPeerByFilter(row,false)
this.$nextTick(()=>{ this.$nextTick(()=>{
this.toggleSelection(_allCheck,true) // 1×
this.toggleSelection([_parentRow],false) if(_allChildren){ this.toggleSelection(_allChildren,false) }
this.toggleSelection(_childrenArr,false) // 2×
if(_allParents){ this.toggleSelection(_allParents,false) }
// 3
if(_allPeerNoSon){ this.toggleSelection(_allPeerNoSon,true) }
}) })
}else{ }else{
// //
row.isCheck = false row.isCheck = false
let _peerArr = this.findAllPeer(row,false,false)//arr console.log("取消勾选",selection, row)
let _parentRow = this.findParentRow(row)//row // ()
let _parentPeerArr = _parentRow ? this.findAllPeer(_parentRow,false,true) : []//arr let _allPeerNoSon = this.getPeerByFilter(row,false)
let _parentPeerSonArr = []//arr
_parentPeerArr.forEach(item=>{
_parentPeerSonArr = [..._parentPeerSonArr,...this.findChildren(item,false,false)]
})
let _parentPeerShow = 0
//
_parentPeerArr.forEach(item=>{
if(item.isCheck){_parentPeerShow ++}
if(item.id == _parentRow.id){_parentPeerShow ++}
})
console.log(517,_parentRow)
// ,,
this.$nextTick(()=>{ this.$nextTick(()=>{
this.toggleSelection(_peerArr,false) //
if(_parentPeerShow > 0 && _parentRow.parentId != _parentRow.id)this.toggleSelection([_parentRow],true) if(_allPeerNoSon){ this.toggleSelection(_allPeerNoSon,false) }
this.toggleSelection(_parentPeerSonArr,false)
}) })
console.log("取消勾选",selection, row)
} }
}, },
// //
@ -539,6 +515,16 @@ export default {
} }
return deepArr; return deepArr;
}, },
// ischeckfalse
setAllDataNotCheck(data){
if(!data)data = this.CreateFormData.details
data.forEach(item=>{
item.isCheck = false;
if(item.children){
this.setAllDataNotCheck(item.children)
}
})
},
// //
tableHandleSelectAll(selection){ tableHandleSelectAll(selection){
this.isAllCheck = !this.isAllCheck this.isAllCheck = !this.isAllCheck
@ -547,16 +533,46 @@ export default {
// //
this.selectData = this.getLastFloors(this.CreateFormData.details) this.selectData = this.getLastFloors(this.CreateFormData.details)
this.$refs.bomTree_Ref.clearSelection(); this.$refs.bomTree_Ref.clearSelection();
this.selectData.forEach(item=>{ this.toggleSelection(this.selectData,true)
item.isCheck = true
this.$refs.bomTree_Ref.toggleRowSelection(item,true);
})
}else{ }else{
console.log("全不选",selection) console.log("全不选",selection)
this.$refs.bomTree_Ref.clearSelection(); this.$refs.bomTree_Ref.clearSelection();
this.selectData = [] this.selectData = []
this.CreateFormData.details.forEach(item=>{item.isCheck = false}) this.setAllDataNotCheck()
this.$nextTick(()=>{
this.checkCanCommit()
})
}
},
//
checkCanCommit(){
let _allselect = this.getBomAllSelect()
console.log(540,_allselect)
if(_allselect.length <= 0){
this.canCommit = false
return
} }
let _last = this.getLastFloors(this.CreateFormData.details)
let _isError = 0
_last.forEach(last_item=>{
let _currentAllParents = this.getAllParents(last_item.parentId)
//
if(last_item.isCheck){
_currentAllParents.forEach(parent_item=>{
if(parent_item.isCheck)_isError++
})
}
//
else{
let _parentIsCheck = 0
_currentAllParents.forEach(parent_item=>{
if(parent_item.isCheck)_parentIsCheck++
})
if(_parentIsCheck != 1){ _isError++ }
}
})
console.log(547,_isError)
this.canCommit = (_isError == 0)
}, },
//退 //退
close (val) { close (val) {
@ -589,6 +605,22 @@ export default {
this.loading = false this.loading = false
}) })
}, },
//
getBomAllSelect(data){
if(!data){
data = this.CreateFormData.details
this.selectData = []
}
data.forEach(item=>{
if(item.isCheck){
this.selectData.push(item)
}
if(item.children){
this.getBomAllSelect(item.children)
}
})
return this.selectData
},
editFormClick (val) { editFormClick (val) {
// Moment(this.CreateFormData.arriveTime).format() // Moment(this.CreateFormData.arriveTime).format()
// if (val[0] == 0) { // if (val[0] == 0) {
@ -662,6 +694,12 @@ export default {
this.loading = false this.loading = false
}) })
}, },
resultToLast(){
this.active--;
this.isAllCheck = false,
this.selectData = [],
this.setAllDataNotCheck()
},
// //
openAddNew () { openAddNew () {
const parent = this.$parent const parent = this.$parent
@ -688,4 +726,12 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./style/index.scss"; @import "./style/index.scss";
// todo:
::v-deep .el-checkbox{
&.is-disabled{
.el-checkbox__inner{
visible:hidden
}
}
}
</style> </style>

549
fe/PC/src/views/finishedProductManage/dismantle/StepsFormTree/index_tree.vue

@ -1,549 +0,0 @@
<template>
<el-dialog
:title="formTitle"
v-loading="loading"
v-if="displayDialog.newDialog"
:visible="true"
:fullscreen="true"
:append-to-body="false"
:modal="false"
:modal-append-to-body="false"
:show-close="true"
@close="close(0)"
>
<div id="StepsFormTree">
<el-steps
:active="active"
process-status="finish"
finish-status="success"
:align-center="true"
>
<el-step
v-for="(item, index) in stepFilters"
:key="index"
:title="item"
></el-step>
</el-steps>
<curren-Form
v-if="active == 0"
class="page1"
size="medium"
ref="page1"
:searchData="CreateFormData"
:searchForm="CreateForm"
:searchOptions="Options"
:searchHandle="editHandle"
:rules="Rules"
@changeInput="changeInput"
@changeSelect="changeSelect"
@push="DataPush(arguments)"
@submitForm="editFormClick(arguments)"
>
</curren-Form>
<curren-Form
v-if="active === 1"
class="page2"
size="medium"
:searchData="CreateFormData"
:searchHandle="editHandle"
:rules="Rules"
@submitForm="editFormClick(arguments)"
>
<template>
<el-form-item class="formTable-box " prop="details" v-if="active == 1">
<b style="font-size:20px;padding-bottom:10px">父级物料代码{{ propsData.details[0].itemCode }}</b>
<el-tree
:check-strictly="true"
ref="bomTree_Ref"
:size="'normal'"
style="width:800px"
:data="CreateFormData.details"
show-checkbox
node-key="id"
default-expand-all
@check="handleNodeCheck"
:expand-on-click-node="false">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div>{{ data.itemCode }}</div>
<div class="right">
<div class="qty">{{ data.qty }}</div>
<div class="locationCode">
<filterSelect
:selectModel="data[detailsTableColumns[2].prop]"
:selectItem="detailsTableColumns[2]"
:tableScope="node"
@filterOptionSelectHandle="(item,props,val)=>{filterOptionSelectHandle(item,props,val,data)}"
@filterClearHandle="(item)=>{filterClearHandle(item,data)}"
></filterSelect>
</div>
</div>
</div>
</el-tree>
</el-form-item>
</template>
</curren-Form>
<div
v-if="active === step.length - 1 && pageStatus === 'success'"
class="page4"
>
<el-result
icon="success"
title="成功提示"
:subTitle="formTitle + '成功'"
>
<template slot="extra">
<!-- <el-button type="primary" size="medium" @click="tuoFormPrint"
>打印托标签</el-button
>
<el-button type="primary" size="medium" @click="xbqFormPrint"
>打印箱标签</el-button
> -->
<el-button
v-for="item in successHandle"
:key="item.label"
:type="item.type"
size="medium"
@click="item.click()"
>{{ item.label }}</el-button
>
<!-- @click="successClick(item.click())" -->
<el-button type="primary" size="medium" @click="close(1)"
>退出</el-button
>
</template>
</el-result>
</div>
<div
v-if="active === step.length - 1 && pageStatus === 'error'"
class="page4"
>
<el-result icon="error" title="错误提示" :subTitle="formTitle + '失败'">
<template slot="extra">
<el-button type="primary" size="medium" @click="resubmit()"
>重新提交</el-button
>
<el-button type="primary" size="medium" @click="active--"
>上一步</el-button
>
<el-button type="primary" size="medium" @click="close(1)"
>退出</el-button
>
</template>
</el-result>
</div>
</div>
</el-dialog>
</template>
<script>
import currenForm from "@/components/currenForm"
import currenTable from "@/components/currenTable"
import filterSelect from "@/components/filterSelect"
export default {
name: 'StepsFormTree',
components: {
currenForm,
currenTable,
filterSelect
},
watch: {
active (val) {
if(val == 0){
if(this.hideFirstActiveCancel){
this.editHandle=[
{ label: "下一步", type: "primary", name: "determine" },
];
}else{
this.editHandle=[
{ label: "取消", name: "cancel" },
{ label: "下一步", type: "primary", name: "determine" },
];
}
}else if(val == 1){
this.editHandle=[
{ label: "上一步", name: "cancel" },
{ label: "提交", type: "primary", name: "determine" },
];
}
},
stepArray(newVal, oldVal){
this.step = newVal
}
},
filters: {
formData (val) {
let data = JSON.parse(JSON.stringify(val))
val.forEach((key, index) => {
data[index].disabled = "true"
delete data[index].focus
if (key.type == "autocomplete" || key.type == "import") {
data[index].type = "input"
}
});
return data
},
formDataDetails (val) {
let data = JSON.parse(JSON.stringify(val))
val.forEach((key, index) => {
data[index].disabled = true
delete data[index].focus
delete data[index].rules
if (key.type == "autocomplete" || key.type == "import") {
delete data[index].type
} else if (key.type == "objectAutocomplete") {
data[index].type = "object"
} else if (key.prop == "containerCode" && key.type == "input") {
data[index].disabled = false
} else if (key.isChange) {
//
data[index].disabled = false
}
});
return data
}
},
props: {
//
formTitle: {
type: String,
default: ''
},
//
displayDialog: {
type: Object,
default: () => {
return {
newDialog: false
}
}
},
//
propsData: {
type: Object,
default: () => {
return {}
}
},
//
CreateFormData: {
type: Object,
default: () => {
return {}
}
},
//form
CreateForm: {
type: Array,
default: () => {
return []
}
},
//
Rules: {
type: Object,
default: () => {
return {}
}
},
//
Options: {
type: Object,
default: () => {
return {}
}
},
//table
detailsTableColumns: {
type: Array,
default: () => {
return []
}
},
//
childTableData: {
type: Array,
default: () => {
return []
}
},
//
successHandle: {
type: Array,
default: () => {
return []
}
},
//
stepArray: {
type: Array,
default: () => {
return ["总体信息", "明细", "结果"]
}
},
//
addClickButton: {
type: Boolean,
default: () => {
return true
}
},
//
importFormButton: {
type: Boolean,
default: () => {
return false
}
},
//
isShowDeleteButton: {
type: Boolean,
default: () => {
return true
}
},
//
isHideFirstActiveCancel:{
type: Boolean,
default: () => {
return false
}
},
},
computed: {
stepFilters () {
let stepFilters = []
const routeName = this.$route.meta.title
this.step.forEach(key => {
stepFilters.push(routeName.concat(key))
})
return stepFilters
},
},
data () {
return {
active: 0,
formReveal: 1,
activeStep: 1,
pageStatus: '',
addClick: this.addClickButton,//
importForm:this.importFormButton,//
showDeleteButton: this.isShowDeleteButton,//-
hideFirstActiveCancel:this.isHideFirstActiveCancel,//
loading: false,
session: null,
step: this.stepArray,
editHandle: [
{ label: "取消", name: "cancel" },
{ label: "下一步", type: "primary", name: "determine" },
],
isAllCheck:false,//
selectData:[],//
config:{
id:'id',
parentId:'parentId',
// id:'itemCode',
// parentId:'parentCode',
children:'children'
},
}
},
mounted () {
this.session = JSON.parse(JSON.stringify(this.CreateFormData))
if(this.hideFirstActiveCancel){
this.editHandle=[
{ label: "下一步", type: "primary", name: "determine" },
];
}
},
methods: {
handleNodeCheck(data,node){
console.log(data,node)
},
// filterSelectoption
filterOptionSelectHandle(item,props,val,scope){
this.$emit("push", item,props,val,scope);
},
// // filterSelectto
filterClearHandle(item,scope){
this.$emit("clear", item,scope);
},
//
getLastFloors(root, onePathDeep = 1, deepArr = []){
for (let i = 0; i < root.length; i++) {
if (root[i] == null) return 0
// children
if (!root[i][this.config.children]?.length) {
deepArr.push(root[i])
} else {
onePathDeep++
this.getLastFloors(root[i][this.config.children], onePathDeep, deepArr)
}
}
return deepArr;
},
//退
close (val) {
this.isAllCheck = false
this.selectData = []
this.active = 0
// const pageRef = this.Refs[1]
const data = JSON.parse(JSON.stringify(this.session))
this.$emit('close', data, val)
},
//autoComplete
DataPush (val) {
this.$emit("DataPush", val)
},
// //
// tuoFormPrint () {
// this.$emit('tuoFormPrint')
// },
// //
// xbqFormPrint () {
// this.$emit('xbqFormPrint')
// },
getCheckedNodesHandle(){
return this.$refs.bomTree_Ref.getCheckedNodes()
},
successClick (val) {
this.loading = true
val.then(res => {
this.loading = false
}, reason => {
this.loading = false
}).catch(err=>{
this.loading = false
})
},
editFormClick (val) {
// Moment(this.CreateFormData.arriveTime).format()
// if (val[0] == 0) {
if (val[2].name == "cancel") {
if (this.active == 0) {
// debugger
// this.active = ''
this.close(0)
} else {
// if (this.active == 2) {
// this.active = this.active - this.activeStep
// } else {
this.active--
// }
}
} else {
val[1].validate((valid) => {
if (valid) {
const parent = this.$parent
if(this.active == 0){
parent.PalletlFunction(this.active).then(res => {
//
this.active++
this.loading = false
}, reason => {
this.loading = false
}).catch(err=>{
this.loading = false
})
}else{
parent.PalletlFunction(this.active).then(res => {
//
this.loading = false
parent.stepsSubmit().then(res => {
this.pageStatus = 'success'
this.active++
this.loading = false
}, reason => {
this.loading = false
if(reason=="return")return
this.pageStatus = 'error'
this.active++
this.loading = false
}).catch(err=>{
this.loading = false
})
}, reason => {
this.loading = false
}).catch(err=>{
this.loading = false
})
}
} else {
this.$errorMsg('请检查表单')
}
})
}
},
resubmit(){
const parent = this.$parent
this.loading = true
parent.stepsSubmit().then(res => {
this.pageStatus = 'success'
this.loading = false
}, reason => {
this.loading = false
if(reason=="return")return
this.pageStatus = 'error'
this.loading = false
}).catch(err=>{
this.loading = false
})
},
//
openAddNew () {
const parent = this.$parent
parent.openAddNew()
},
//
openImportForm(){
const parent = this.$parent
parent.openImportFormHandle()
// this.displayDialog.importDialog = true
},
childTable (e, val) {
const parent = this.$parent
parent.childTable(e, val)
},
changeInput(prop,val){
this.$emit("changeInput", prop, val)
},
changeSelect(prop,val){
this.$emit("changeSelect", prop, val)
},
}
}
</script>
<style lang="scss" scoped>
@import "./style/index.scss";
// todo:
::v-deep .el-checkbox{
&.is-disabled{
.el-checkbox__inner{
visible:hidden
}
}
}
::v-deep .el-tree-node__content{
margin-bottom:10px
}
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
.right{
flex: 1;
display: flex;
align-items: center;
justify-content: flex-end;
font-size: 14px;
padding-right: 8px;
}
.qty{
padding-right:200px
}
}
</style>

143
fe/PC/src/views/finishedProductManage/dismantle/customerDismantleJob-new.vue → fe/PC/src/views/finishedProductManage/dismantle/customerDismantleJob-tabletree.vue

@ -180,6 +180,7 @@ export default {
locationErpCode:undefined, locationErpCode:undefined,
locationGroup:undefined, locationGroup:undefined,
warehouseCode:undefined, warehouseCode:undefined,
parentId:undefined
}], }],
successHandle:[ successHandle:[
{ {
@ -189,8 +190,8 @@ export default {
}) })
} }
], ],
bomList:null,
submitRes:null,// submitRes:null,//
getBomLoading:false,//bom
}; };
}, },
mounted () { mounted () {
@ -198,7 +199,6 @@ export default {
}, },
methods: { methods: {
FormTreePush(item,props,val,scope){ FormTreePush(item,props,val,scope){
console.log(props)
if(props.prop == "locationCode"){ if(props.prop == "locationCode"){
scope.row.locationCode = val scope.row.locationCode = val
scope.row.locationArea = item.areaCode scope.row.locationArea = item.areaCode
@ -208,41 +208,39 @@ export default {
} }
}, },
FormTreeClear(item,scope){ FormTreeClear(item,scope){
console.log(item)
if(item.prop == "locationCode"){ if(item.prop == "locationCode"){
scope.row.locationCode = null scope.row.locationCode = null
} }
}, },
// bom // bom
buildTree(list){ buildTree(jsonArr){
let pidStr = 'parentCode'; //
let idStr = 'itemCode'; const result = [];
let childrenStr = 'children'; const id = 'id';
const parentId = 'parentId';
const children = 'children';
const len = jsonArr.length;
let listOjb = {}; // {key: obj} // id()
let treeList = []; // const hash = {};
jsonArr.forEach(item => {
// {key: obj}便 hash[item[id]] = item;
for (let i = 0; i < list.length; i++) { });
listOjb[list[i][idStr]] = list[i]
}
for (let j = 0; j < list.length; j++) { for (let j = 0; j < len; j++) {
// jsonArr[j].parent = jsonArr[j - 1]
let haveParent = listOjb[list[j][pidStr]] const jsonArrItem = jsonArr[j];
if (haveParent) { const hashItem = hash[jsonArrItem[parentId]];
// childrenchildren if (hashItem) {
!haveParent[childrenStr] && (haveParent[childrenStr] = []) // children
// !hashItem[children] && (hashItem[children] = []);
haveParent[childrenStr].push(list[j]) hashItem[children].push(jsonArrItem);
} else { } else {
// result.push(jsonArrItem);
treeList.push(list[j])
} }
} }
return treeList return result;
}, },
drawerbuttonHandle(val){ drawerbuttonHandle(val){
// //
if (val == "handle") { if (val == "handle") {
@ -259,6 +257,7 @@ export default {
locationErpCode:undefined, locationErpCode:undefined,
locationGroup:undefined, locationGroup:undefined,
warehouseCode:undefined, warehouseCode:undefined,
parentId:undefined
}] }]
this.theEvent = "edit" this.theEvent = "edit"
this.displayDialog.newDialog = true this.displayDialog.newDialog = true
@ -321,62 +320,16 @@ export default {
this.Loading.appMainLoading = false this.Loading.appMainLoading = false
}) })
}, },
//
checkSelectDG(list){
for (let i = 0; i < list.length; i++) {
}
},
//
checkSelectData(){
// todo:
let _isSelectData = this.$refs.StepsFormTree_Ref.selectData
let _select_ids = []
_isSelectData.forEach(item=>{_select_ids.push(item.id)})
if(!_isSelectData || _isSelectData.length <= 0){
this.$warningMsg("请选择数据")
return
}
// this.bomList.forEach(item=>{
// if()
// })
// this.checkSelectDG(_isSelectData)
console.log(111,_isSelectData)
console.log(222,this.bomList)
console.log(333,_select_ids)
return
this.submitHttp()
},
//
submitHttp(){
this.bomList.forEach((item,index)=>{
let _item = {
itemCode: item.component,
qty: _tableList[index].qty,
locationCode: _tableList[index].rawLocationCode,
locationArea: _tableList[index].rawLocationArea,
locationGroup: _tableList[index].rawLocationGroup,
locationErpCode: _tableList[index].rawLocationErpCode,
warehouseCode: _tableList[index].warehouseCode,
}
_data.details[0].materialDetails.push(_item)
})
this.Loading.appMainLoading = true
this.submitRes = null
productionRecycleJobHandle(_jobInfo.id,_data).then(res => {
this.Loading.appMainLoading = false
this.submitRes = res
resolve();
}).catch(err => {
this.Loading.appMainLoading = false
reject();
})
},
stepsSubmit (val) { stepsSubmit (val) {
// //
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let _tableList = this.CreateFormData.details let _isSelectData = this.$refs.StepsFormTree_Ref.getBomAllSelect()
if(!_isSelectData || _isSelectData.length <= 0){
this.$warningMsg("请选择数据")
return
}
let _empty = 0 let _empty = 0
_tableList.forEach(item=>{ _isSelectData.forEach(item=>{
if(!item.locationCode || item.locationCode.length <= 0){ if(!item.locationCode || item.locationCode.length <= 0){
_empty ++ _empty ++
} }
@ -390,7 +343,28 @@ export default {
let _data = JSON.parse(JSON.stringify(_jobInfo)) let _data = JSON.parse(JSON.stringify(_jobInfo))
_data.details[0].materialDetails = [],// _data.details[0].materialDetails = [],//
_data.details[0].qty = Number(this.CreateFormData.qty) _data.details[0].qty = Number(this.CreateFormData.qty)
this.checkSelectData() _isSelectData.forEach((item,index)=>{
let _item = {
itemCode: item.itemCode,
qty: item.qty,
locationCode: item.locationCode,
locationArea: item.locationArea,
locationGroup: item.locationGroup,
locationErpCode: item.locationErpCode,
warehouseCode: item.warehouseCode,
}
_data.details[0].materialDetails.push(_item)
})
this.Loading.appMainLoading = true
this.submitRes = null
productionRecycleJobHandle(_jobInfo.id,_data).then(res => {
this.Loading.appMainLoading = false
this.submitRes = res
resolve();
}).catch(err => {
this.Loading.appMainLoading = false
reject();
})
}); });
}, },
stepsCloseHandle(data){ stepsCloseHandle(data){
@ -406,11 +380,13 @@ export default {
let _itemInfo = this.propsData.details[0] let _itemInfo = this.propsData.details[0]
getBomByComponentTree(_itemInfo.itemCode) getBomByComponentTree(_itemInfo.itemCode)
.then(res=>{ .then(res=>{
this.bomList = res
this.Loading.appMainLoading = false this.Loading.appMainLoading = false
if(res.length > 0){ if(res.length > 0){
let _first = this.propsData.details[0]
this.CreateFormData.details = [] this.CreateFormData.details = []
let _faterLevelId = null//bomID
res.forEach(item=>{ res.forEach(item=>{
if(item.product == _first.itemCode){ _faterLevelId = item.remark }
let _item={ let _item={
id:item.id, id:item.id,
itemCode:item.component, itemCode:item.component,
@ -422,16 +398,17 @@ export default {
locationGroup:_itemInfo.rawLocationGroup, locationGroup:_itemInfo.rawLocationGroup,
locationErpCode:_itemInfo.rawLocationErpCode, locationErpCode:_itemInfo.rawLocationErpCode,
warehouseCode:_itemInfo.warehouseCode, warehouseCode:_itemInfo.warehouseCode,
parentId:item.remark
} }
this.CreateFormData.details.push(_item) this.CreateFormData.details.push(_item)
}) })
let _first = this.propsData.details[0]
let _tree = [{ let _tree = [{
id: _first.id, id: _faterLevelId,
itemCode: _first.itemCode, itemCode: _first.itemCode,
parentCode: _first.itemCode, parentCode: _first.itemCode,
isCheck: false, isCheck: false,
children:this.buildTree(JSON.parse(JSON.stringify(this.CreateFormData.details))) children:this.buildTree(JSON.parse(JSON.stringify(this.CreateFormData.details))),
parentId:_faterLevelId
}] }]
this.CreateFormData.details = _tree this.CreateFormData.details = _tree
// this.CreateFormData.details = this.buildTree(JSON.parse(JSON.stringify(this.CreateFormData.details))) // this.CreateFormData.details = this.buildTree(JSON.parse(JSON.stringify(this.CreateFormData.details)))

515
fe/PC/src/views/finishedProductManage/dismantle/customerDismantleJob-tree.vue

@ -1,515 +0,0 @@
<template>
<div class="page-box" v-loading="Loading.appMainLoading">
<tablePagination
:currenButtonData="currenButtonData"
:tableData="tableData"
:tableLoading="Loading.tableLoading"
:tableColumns="tableColumns"
@rowDrop="rowDrop"
:totalCount="totalCount"
:multipleSelection="multipleSelection"
:MaxResultCount="PageListParams.MaxResultCount"
@topbutton="topbutton"
@inlineDialog="inlineDialog"
@sortChange="sortChange"
@alertoldSkipCount="alertoldSkipCount"
@alterResultCount="alterResultCount"
@handleSelectionChange="handleSelectionChange"
:currentPageProps="oldSkipCount"
:quicklySearchOption="quicklySearchOption"
@quicklySearchClick="quicklySearchClick"
@quicklySearchClear="quicklySearchClear"
:primarySearchOption="primarySearchOption"
@overallSearchFormClick="overallSearchFormClick"
:httpOverallSearchData="httpOverallSearchData"
>
</tablePagination>
<curren-Drawer
:title="tableColumns"
:DrawerLoading="Loading.DrawerLoading"
:drawer="displayDialog.detailsDialog"
:propsData="propsData"
:Butttondata="DrawerButtonData"
:tabsDesTions="tabsDesTions"
@drawerShut="(val) => (displayDialog.detailsDialog = val)"
@drawerbutton="drawerbuttonHandle"
@handleCommand="drawerHandle"
@close-value="closeValue"
:tableColumns="detailsTableColumns"
:totalCount="totalCountDetails"
:MaxResultCount="MaxResultCountDetails"
@alterResultCountDetails="alterResultCountDetails"
@alertoldSkipCountDetails="alertoldSkipCountDetails"
:dropdownTabsData="[]"
:firstTabs="firstTabs"
></curren-Drawer>
<!--编辑-->
<StepsFormTree
ref="StepsFormTree_Ref"
:propsData="propsData"
:formTitle="formTitle"
:displayDialog="displayDialog"
:CreateFormData="CreateFormData"
:CreateForm="CreateForm"
:Rules="editRules.cerateRule"
:Options="editOptions"
:detailsTableColumns="AddDetailsTableColumns"
:childTableData="childTableData"
@push="FormTreePush"
@clear="FormTreeClear"
@close="stepsCloseHandle(arguments)"
:isShowDeleteButton="false"
:addClickButton="false"
:successHandle="successHandle"
></StepsFormTree>
</div>
</template>
<script>
import {
getDetailed,
getPageList,
getBomByComponentTree,
productRecycleNoteExport,
productionRecycleJobHandle,
// productionRecycleJobComplete
} from "@/api/wms-api";
import { tableMixins } from "@/mixins/TableMixins"
import { LoadingMixins } from "@/mixins/LoadingMixins"
import { drawerMixins } from "@/mixins/drawerMixins"
import { TableHeaderMixins } from "@/mixins/TableHeaderMixins"
import { mixins } from "@/mixins/mixins"
import { filterSelectMixins } from '@/mixins/filter-Select'
import store from '@/store'
import StepsFormTree from './StepsFormTree'
export default {
name: "customerDismantleJob",
mixins: [
tableMixins,
LoadingMixins,
drawerMixins,
TableHeaderMixins,
mixins,
filterSelectMixins,
],
computed: {
hideButton: function () {
return function (val) {
let data = true
val.forEach(key => {
if (this.propsData.jobStatus == key) {
data = false
}
})
return data
}
},
},
components:{StepsFormTree},
data () {
return {
URL: 'wms/store/production-recycle-job',
//
currenButtonData: [
// this.defaultAddBtn(),//
//
this.defaultExportBtn(),
this.defaultFieldSettingBtn(),//
this.defaultFreshBtn(),//
this.defaultFilterBtn(),//
],
DrawerButtonData: [
{
type: 'warning',
label: '执行',
name: "handle",
// ++
hide: () => { return this.hideButton([1,2,4]) },
size: 'mini'
},
// {
// type: 'success',
// label: '',
// name: "complete",
// // todo:
// hide: () => { return this.hideButton([1]) },
// size: 'mini'
// },
],
//
CreateFormData: {
qty:null,
details:[]
},
CreateForm: [
{ type: "inputNumber", label: "数量", prop: "qty",colSpan: 12,min:1},
],
editRules: {
cerateRule: {
qty: [
{ required: true, trigger: "blur", message: "不可为空" },
{
type: "number",
trigger: ["blur"],
validator: (rule, value, callback) => {
//
let _InventoryQty = Number(this.propsData.details[0].qty) - Number(this.propsData.details[0].executedQty)
if(_InventoryQty < value){
return callback(new Error(`数量不能大于未完成数量${_InventoryQty}`))
}else{
callback()
}
}
}
],
},
},
AddDetailsTableColumns: [
{ label: "子物料代码", prop: "itemCode",width:"auto",align:'left' },
{ label: "数量", prop: 'qty',width:"auto" },
{ type: "filterSelect", label: "目标库位", prop: "locationCode", optionsLabel: "name", optionsValue: "code",
focus: (type,val) => { return this.getFilterList(type, val, "basedata/Location",this.isFilter("type", "5"))},
// searchButton: (val) => { this.showSerarchPage(val, 'basedata/Location', 'InventoryBalance', '', this.CreateFormData) },
width:"auto",size:"mini"
},
],
childTableData:[{
itemCode:undefined,
qty:undefined,
locationCode:undefined,
locationArea:undefined,
locationErpCode:undefined,
locationGroup:undefined,
warehouseCode:undefined,
parentId:undefined
}],
successHandle:[
{
label:"下载报告",
click:(()=>{
this.downloadReport()
})
}
],
bomList:null,
submitRes:null,//
getBomLoading:false,//bom
};
},
mounted () {
this.paging();
},
methods: {
FormTreePush(item,props,val,scope){
console.log(203,props)
console.log(2034,scope)
if(props.prop == "locationCode"){
scope.locationCode = val
scope.locationArea = item.areaCode
scope.locationErpCode = item.erpLocationCode
scope.locationGroup = item.locationGroupCode
scope.warehouseCode = item.warehouseCode
}
},
FormTreeClear(item,scope){
console.log(item)
if(item.prop == "locationCode"){
scope.locationCode = null
}
},
// bom
buildTree(jsonArr){
// console.log(220,this.getCycleColor(10,true,'1'))
//
const result = [];
const id = 'id';
const parentId = 'parentId';
const children = 'children';
const len = jsonArr.length;
// id()
const hash = {};
jsonArr.forEach(item => {
hash[item[id]] = item;
});
for (let j = 0; j < len; j++) {
jsonArr[j].parent = jsonArr[j - 1]
const jsonArrItem = jsonArr[j];
const hashItem = hash[jsonArrItem[parentId]];
if (hashItem) {
// children
!hashItem[children] && (hashItem[children] = []);
hashItem[children].push(jsonArrItem);
} else {
result.push(jsonArrItem);
}
}
return result;
},
drawerbuttonHandle(val){
//
if (val == "handle") {
this.formTitle = this.$route.meta.title + "执行";
this.CreateFormData = JSON.parse(JSON.stringify(this.propsData));
//
let _qty = Number(this.propsData.details[0].qty) - Number(this.propsData.details[0].executedQty)
this.$set(this.CreateFormData, "qty", _qty)
this.childTableData = [{
itemCode:undefined,
qty:undefined,
locationCode:undefined,
locationArea:undefined,
locationErpCode:undefined,
locationGroup:undefined,
warehouseCode:undefined,
parentId:undefined
}]
this.theEvent = "edit"
this.displayDialog.newDialog = true
}
//
// else if(val == "complete"){
// // todo:,wsm-apiproductionRecycleJobComplete
// this.Loading.appMainLoading = true
// productionRecycleJobComplete(this.propsData.id).then(res => {
// this.Loading.appMainLoading = false
// this.paging()
// this.displayDialog.detailsDialog = false
// }).catch(err => {
// this.Loading.appMainLoading = false
// })
// }
else{
this.drawerbutton(val)
}
},
//
isFilter (val, data) {
let filter = [
{
logic: "And",
column: val,
action: "==",
value: data
}
]
return filter
},
//
downloadReport(){
//
let _data = {
maxResultCount: 20,
skipCount: 0,
sorting: "",
route: "wms/store/product-recycle-note/export-product-recycle",
function: "客户退拆记录",//
condition: {
filters: [
{
logic: "And",
column: "number",
action: "==",
value: this.submitRes.remark
}
]
}
}
this.Loading.appMainLoading = true
productRecycleNoteExport(_data)
.then(res=>{
this.Loading.appMainLoading = false
this.blob(res,'客户退拆记录报告')//
})
.catch(err=>{
this.Loading.appMainLoading = false
})
},
//
checkSelectDG(list){
for (let i = 0; i < list.length; i++) {
}
},
//
checkSelectData(){
console.log(335,this.$refs.StepsFormTree_Ref.getCheckedNodesHandle())
// todo:
// todo:
let _isSelectData = this.$refs.StepsFormTree_Ref.selectData
let _select_ids = []
_isSelectData.forEach(item=>{_select_ids.push(item.id)})
if(!_isSelectData || _isSelectData.length <= 0){
this.$warningMsg("请选择数据")
return
}
console.log(111,_isSelectData)
console.log(222,this.bomList)
console.log(333,_select_ids)
// this.bomList.forEach(item=>{
// if()
// })
// this.checkSelectDG(_isSelectData)
return
this.submitHttp()
},
//
submitHttp(){
this.bomList.forEach((item,index)=>{
let _item = {
itemCode: item.component,
qty: _tableList[index].qty,
locationCode: _tableList[index].rawLocationCode,
locationArea: _tableList[index].rawLocationArea,
locationGroup: _tableList[index].rawLocationGroup,
locationErpCode: _tableList[index].rawLocationErpCode,
warehouseCode: _tableList[index].warehouseCode,
}
_data.details[0].materialDetails.push(_item)
})
this.Loading.appMainLoading = true
this.submitRes = null
productionRecycleJobHandle(_jobInfo.id,_data).then(res => {
this.Loading.appMainLoading = false
this.submitRes = res
resolve();
}).catch(err => {
this.Loading.appMainLoading = false
reject();
})
},
//
getCycleColor(number,isCreate,alpha = 1,colors,append){
// let _color_item = {
// r:parseInt(Math.random() * 255),
// g:parseInt(Math.random() * 255),
// b:parseInt(Math.random() * 255)
// }
// let _colors = colors || ['#3ca170','#5470c6', '#91cd77','#ef6567', '#f9c956','#75bedc','#529FDB','#FF8000','#88D36C','#FCC12B',
// '#D38C6C','#AB9DF3','#40C03A','#ED94F5','#6CBED3']
let _colors = [
{r:"1",g:"110",b:"244"},
{r:"60",g:"161",b:"112"},
{r:"84",g:"112",b:"198"},
{r:"145",g:"205",b:"119"},
{r:"239",g:"101",b:"103"},
{r:"249",g:"201",b:"86"},
{r:"117",g:"190",b:"220"},
{r:"82",g:"159",b:"219"},
{r:"255",g:"128",b:"0"},
{r:"136",g:"211",b:"108"},
{r:"252",g:"193",b:"43"},
{r:"211",g:"140",b:"108"},
{r:"171",g:"157",b:"243"},
{r:"64",g:"192",b:"58"},
{r:"237",g:"148",b:"245"},
{r:"108",g:"190",b:"211"},
]
if(colors){_colors = append ? _colors.concat(colors) : colors}
let _all = []
let _length = number ? Math.ceil(number/_colors.length) : 1
for(let i = 0;i<_length;i++){
_all= _all.concat(_colors)
}
if(isCreate){
let _create = []
_all.forEach(item=>{
let _item = `rgba(${item.r},${item.g},${item.b},${alpha})`
_create.push(_item)
})
_all = _create
}
return _all
},
stepsSubmit (val) {
//
return new Promise((resolve, reject) => {
let _tableList = this.CreateFormData.details
let _empty = 0
console.log(381,_tableList)
_tableList.forEach(item=>{
if(!item.locationCode || item.locationCode.length <= 0){
_empty ++
}
})
if(_empty > 0){
this.$errorMsg("目标库位不可为空")
return
}
let _jobInfo = this.propsData
let _itemInfo = this.propsData.details[0]
let _data = JSON.parse(JSON.stringify(_jobInfo))
_data.details[0].materialDetails = [],//
_data.details[0].qty = Number(this.CreateFormData.qty)
this.checkSelectData()
});
},
stepsCloseHandle(data){
//
this.displayDialog.detailsDialog = false
this.stepsClose(data)
},
PalletlFunction (val) {
return new Promise((resolve, reject) => {
if(val == 0){
this.Loading.appMainLoading = true
// bom
let _itemInfo = this.propsData.details[0]
getBomByComponentTree(_itemInfo.itemCode)
.then(res=>{
this.bomList = res
this.Loading.appMainLoading = false
if(res.length > 0){
let _first = this.propsData.details[0]
this.CreateFormData.details = []
let _faterLevelId = null//bomID
res.forEach(item=>{
if(item.product == _first.itemCode){ _faterLevelId = item.remark }
let _item={
id:item.id,
itemCode:item.component,
parentCode:item.product,
// detailsqtyqty
qty:Number(item.componentQty) * Number(this.CreateFormData.qty),
locationCode:_itemInfo.rawLocationCode,
locationArea:_itemInfo.rawLocationArea,
locationGroup:_itemInfo.rawLocationGroup,
locationErpCode:_itemInfo.rawLocationErpCode,
warehouseCode:_itemInfo.warehouseCode,
parentId:item.remark
}
this.CreateFormData.details.push(_item)
})
// let _tree = [{
// id: _faterLevelId,
// itemCode: _first.itemCode,
// parentCode: _first.itemCode,
// isCheck: false,
// children:this.buildTree(JSON.parse(JSON.stringify(this.CreateFormData.details))),
// parentId:_faterLevelId
// }]
// this.CreateFormData.details = _tree
this.CreateFormData.details = this.buildTree(JSON.parse(JSON.stringify(this.CreateFormData.details)))
resolve();
}else{
this.$errorMsg(`并未找到${_itemInfo.itemCode}对应的bom数据`)
reject()
}
})
.catch(err=>{
this.Loading.appMainLoading = false
reject()
})
}
//
if(val == 1){
resolve()
}
});
},
}
};
</script>
<style lang="scss" scoped>
@import "../../../styles/basicData.scss";
</style>

101
fe/PC/src/views/finishedProductManage/dismantle/customerDismantleJob.vue

@ -169,7 +169,7 @@ export default {
{ type: "filterSelect", label: "目标库位", prop: "locationCode", optionsLabel: "name", optionsValue: "code", { type: "filterSelect", label: "目标库位", prop: "locationCode", optionsLabel: "name", optionsValue: "code",
focus: (type,val) => { return this.getFilterList(type, val, "basedata/Location",this.isFilter("type", "5"))}, focus: (type,val) => { return this.getFilterList(type, val, "basedata/Location",this.isFilter("type", "5"))},
// searchButton: (val) => { this.showSerarchPage(val, 'basedata/Location', 'InventoryBalance', '', this.CreateFormData) }, // searchButton: (val) => { this.showSerarchPage(val, 'basedata/Location', 'InventoryBalance', '', this.CreateFormData) },
width:"auto", width:"auto",size:'mini'
}, },
], ],
childTableData:[{ childTableData:[{
@ -190,7 +190,6 @@ export default {
}) })
} }
], ],
bomList:null,
submitRes:null,// submitRes:null,//
getBomLoading:false,//bom getBomLoading:false,//bom
}; };
@ -200,19 +199,17 @@ export default {
}, },
methods: { methods: {
FormTreePush(item,props,val,scope){ FormTreePush(item,props,val,scope){
console.log(props)
if(props.prop == "locationCode"){ if(props.prop == "locationCode"){
scope.row.locationCode = val scope.locationCode = val
scope.row.locationArea = item.areaCode scope.locationArea = item.areaCode
scope.row.locationErpCode = item.erpLocationCode scope.locationErpCode = item.erpLocationCode
scope.row.locationGroup = item.locationGroupCode scope.locationGroup = item.locationGroupCode
scope.row.warehouseCode = item.warehouseCode scope.warehouseCode = item.warehouseCode
} }
}, },
FormTreeClear(item,scope){ FormTreeClear(item,scope){
console.log(item)
if(item.prop == "locationCode"){ if(item.prop == "locationCode"){
scope.row.locationCode = null scope.locationCode = null
} }
}, },
// bom // bom
@ -323,64 +320,16 @@ export default {
this.Loading.appMainLoading = false this.Loading.appMainLoading = false
}) })
}, },
//
checkSelectDG(list){
for (let i = 0; i < list.length; i++) {
}
},
//
checkSelectData(){
// todo:
// todo:
let _isSelectData = this.$refs.StepsFormTree_Ref.selectData
let _select_ids = []
_isSelectData.forEach(item=>{_select_ids.push(item.id)})
if(!_isSelectData || _isSelectData.length <= 0){
this.$warningMsg("请选择数据")
return
}
console.log(111,_isSelectData)
console.log(222,this.bomList)
console.log(333,_select_ids)
// this.bomList.forEach(item=>{
// if()
// })
// this.checkSelectDG(_isSelectData)
return
this.submitHttp()
},
//
submitHttp(){
this.bomList.forEach((item,index)=>{
let _item = {
itemCode: item.component,
qty: _tableList[index].qty,
locationCode: _tableList[index].rawLocationCode,
locationArea: _tableList[index].rawLocationArea,
locationGroup: _tableList[index].rawLocationGroup,
locationErpCode: _tableList[index].rawLocationErpCode,
warehouseCode: _tableList[index].warehouseCode,
}
_data.details[0].materialDetails.push(_item)
})
this.Loading.appMainLoading = true
this.submitRes = null
productionRecycleJobHandle(_jobInfo.id,_data).then(res => {
this.Loading.appMainLoading = false
this.submitRes = res
resolve();
}).catch(err => {
this.Loading.appMainLoading = false
reject();
})
},
stepsSubmit (val) { stepsSubmit (val) {
// //
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let _tableList = this.CreateFormData.details let _isSelectData = this.$refs.StepsFormTree_Ref.getBomAllSelect()
if(!_isSelectData || _isSelectData.length <= 0){
this.$warningMsg("请选择数据")
return
}
let _empty = 0 let _empty = 0
console.log(381,_tableList) _isSelectData.forEach(item=>{
_tableList.forEach(item=>{
if(!item.locationCode || item.locationCode.length <= 0){ if(!item.locationCode || item.locationCode.length <= 0){
_empty ++ _empty ++
} }
@ -394,7 +343,28 @@ export default {
let _data = JSON.parse(JSON.stringify(_jobInfo)) let _data = JSON.parse(JSON.stringify(_jobInfo))
_data.details[0].materialDetails = [],// _data.details[0].materialDetails = [],//
_data.details[0].qty = Number(this.CreateFormData.qty) _data.details[0].qty = Number(this.CreateFormData.qty)
this.checkSelectData() _isSelectData.forEach((item,index)=>{
let _item = {
itemCode: item.itemCode,
qty: item.qty,
locationCode: item.locationCode,
locationArea: item.locationArea,
locationGroup: item.locationGroup,
locationErpCode: item.locationErpCode,
warehouseCode: item.warehouseCode,
}
_data.details[0].materialDetails.push(_item)
})
this.Loading.appMainLoading = true
this.submitRes = null
productionRecycleJobHandle(_jobInfo.id,_data).then(res => {
this.Loading.appMainLoading = false
this.submitRes = res
resolve();
}).catch(err => {
this.Loading.appMainLoading = false
reject();
})
}); });
}, },
stepsCloseHandle(data){ stepsCloseHandle(data){
@ -410,7 +380,6 @@ export default {
let _itemInfo = this.propsData.details[0] let _itemInfo = this.propsData.details[0]
getBomByComponentTree(_itemInfo.itemCode) getBomByComponentTree(_itemInfo.itemCode)
.then(res=>{ .then(res=>{
this.bomList = res
this.Loading.appMainLoading = false this.Loading.appMainLoading = false
if(res.length > 0){ if(res.length > 0){
let _first = this.propsData.details[0] let _first = this.propsData.details[0]

Loading…
Cancel
Save