|
|
@@ -11,6 +11,12 @@
|
|
|
import TreeUtils from '@/utils/tree'
|
|
|
|
|
|
export default {
|
|
|
+ props: {
|
|
|
+ formData: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {}
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
const { level, userId, userInfo } = this.$store.getters
|
|
|
return {
|
|
|
@@ -31,6 +37,24 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
+ options: {
|
|
|
+ handler(value, old) {
|
|
|
+ if (
|
|
|
+ value &&
|
|
|
+ value.length > 0 &&
|
|
|
+ this.formData.xiLeiId != '' &&
|
|
|
+ typeof this.formData.xiLeiId !== 'undefined' &&
|
|
|
+ this.formData.xiLeiId !== null
|
|
|
+ ) {
|
|
|
+ this.selectDatas = []
|
|
|
+ this.formData.xiLeiId.split(',').forEach((element) => {
|
|
|
+ let mid = this.getFullPath(element)
|
|
|
+ this.selectDatas.push(mid)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ immediate: true
|
|
|
+ },
|
|
|
selectDatas(v) {
|
|
|
const typeId = []
|
|
|
const typeNames = []
|
|
|
@@ -47,6 +71,9 @@ export default {
|
|
|
}
|
|
|
this.$emit('change-data', 'xiLeiId', typeId.join(','))
|
|
|
this.$emit('change-data', 'xiLeiXuanZe', typeNames.join(','))
|
|
|
+ } else {
|
|
|
+ this.$emit('change-data', 'xiLeiId', '')
|
|
|
+ this.$emit('change-data', 'xiLeiXuanZe', '')
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -54,6 +81,28 @@ export default {
|
|
|
this.getPositionList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ getFullPath(val) {
|
|
|
+ let stack = []
|
|
|
+ stack = this.options.map((item) => ({
|
|
|
+ path: [item.ID_],
|
|
|
+ ...item
|
|
|
+ }))
|
|
|
+ while (stack.length) {
|
|
|
+ const curr = stack.pop()
|
|
|
+ const { children, ID_, path } = curr
|
|
|
+ if (ID_ === val) {
|
|
|
+ return curr.path
|
|
|
+ } else if (children?.length) {
|
|
|
+ stack = [
|
|
|
+ ...stack,
|
|
|
+ ...children.map((item) => ({
|
|
|
+ ...item,
|
|
|
+ path: path.concat(item.ID_)
|
|
|
+ }))
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
// 获取本账户所在的部门
|
|
|
getPositionList() {
|
|
|
const { first, second } = this.$store.getters.level || {}
|