This commit is contained in:
zds
2022-10-11 14:54:13 +08:00
parent 900b4a9e1e
commit 325fb89b69
14 changed files with 153 additions and 27 deletions

View File

@@ -151,7 +151,7 @@ import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
import AddDialog from '@/views/wms/sb/repair/devicerepair/AddDialog'
import { getDepts } from '@/api/system/dept'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import { mapGetters } from 'vuex'
export default {
@@ -186,21 +186,24 @@ export default {
}
},
computed: {
...mapGetters([
'user'
])
...mapGetters({
user: 'user'
})
},
created() {
debugger
const param = {
'materOpt_code': this.materOpt_code
}
crudMaterialbase.getMaterOptType(param).then(res => {
this.class_idStr = res.class_idStr
this.crud.query.class_idStr = this.class_idStr
this.crud.toQuery()
this.queryClassId()
})
this.getDepts()
this.query.dept_id = this.user.dept.id
this.getSupDepts(this.user.dept.id)
this.crud.toQuery()
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
@@ -283,6 +286,25 @@ export default {
return obj
})
})
},
getSupDepts(deptId) {
debugger
var number = parseFloat(deptId)
getDeptSuperior(number).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
}
}
}