Commit 01693467 authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/xiangwei/horse into master

parents ca982234 7c9a62c0
......@@ -41,13 +41,14 @@
no-connectors
v-model:ticked="defaultArray"
@update:ticked="tickedTree"
/>
</div>
<div class="col-6 q-px-sm">
<div class="list-title">已选择的部门或成员</div>
<div class="q-pb-none col-12 list-box">
<div
v-for="(item,index) in defaultArray"
v-for="(item,index) in selectArray"
:key="index"
class="list-item"
>
......@@ -55,14 +56,14 @@
<q-icon
name="work"
color="primary"
v-if="item.slice(0, 1) == 1"
v-if="item.Id.slice(0, 1) == 1"
/>
<q-icon
name="person"
color="accent"
v-if="item.slice(0, 1) == 2"
v-if="item.Id.slice(0, 1) == 2"
/>
<span class="q-ml-sm">{{ item.split('-')[1] }}</span>
<span class="q-ml-sm">{{ item.Name }}</span>
</div>
<q-icon name="cancel" @click="delItem(index)"></q-icon>
</div>
......@@ -84,6 +85,10 @@ import { ref } from 'vue'
interface parmas {
[key: string]: any
}
interface SelectParams{
Id:number,
Name:string
}
export default {
props: {
modelValue: {
......@@ -136,43 +141,48 @@ export default {
setup(props, ctx) {
let tree = ref<any>(null);
let list = ref<Array<string>>([])
let selectArray = ref<Array<SelectParams>>([])
let hideDialog = () => {
ctx.emit("update:modelValue", false)
}
let findChild = (arr: parmas) => {
arr.map((e) => {
if (e[props.childrenKey] && e[props.childrenKey].length > 0) {
let parentId = e[props.nodeKey]
let flag= tree.value.isTicked (parentId)
// let childArr = e[props.childrenKey].map(_e => _e[props.nodeKey])
// let flag2 = childArr.every(_e => {
// return props.defaultArray.toString().indexOf(_e) != -1
// })
console.log(147,parentId, flag)
findChild(e[props.childrenKey])
}
})
const getselectArray=(arr: parmas)=>{
for(var i = 0;i<arr.length;i++){
let j = arr[i]
let flag= tree.value.isTicked (j.newId)
if(flag==true){
selectArray.value.push({Id:j.newId , Name:j.DeptName})
}else{
if(j.ChildList && j.ChildList.length>0){
getselectArray(j.ChildList)
}
}
}
}
let tickedTree = (val) => {
ctx.emit("update:defaultArray", val)
console.log('defaultArray',val)
findChild(props.treeData)
setTimeout(()=>{
selectArray.value=[]
getselectArray(props.treeData)
console.log(selectArray.value,'selectArray')
},100)
}
let delItem = (i: number) => {
props.defaultArray.splice(i, 1)
}
return {
tree,
hideDialog,
tickedTree,
delItem,
list
list,
getselectArray,
selectArray
}
}
}
......
......@@ -67,7 +67,8 @@ const editRuleModule = () => {
// 重组唯一id
if (data.dataTree.length == 0) return
data.dataTree.forEach(x => {
x.newId = x.DataType + '-' +x. DeptName + '-' + x.DeptId
// x.newId = x.DataType + '-' +x. DeptName + '-' + x.DeptId
x.newId = x.DataType + '-' + x.DeptId
if (x.ChildList && x.ChildList.length > 0) {
getChildList(x.ChildList)
}
......@@ -76,7 +77,8 @@ const editRuleModule = () => {
}
const getChildList = (ChildList: Array<any>) => {
ChildList.forEach(x => {
x.newId = x.DataType + '-' + x.DeptName + '-' + x.DeptId
// x.newId = x.DataType + '-' + x.DeptName + '-' + x.DeptId
x.newId = x.DataType + '-' + x.DeptId
if (x.ChildList && x.ChildList.length > 0) {
getChildList(x.ChildList)
}
......
......@@ -47,7 +47,6 @@ export default defineComponent({
setup() {
let tab = ref<string>('phase')
if( router.currentRoute.value.query && router.currentRoute.value.query.type){
// let type = router.currentRoute.value.query.type;
tab.value = router.currentRoute.value.query.type as string
}
......
......@@ -62,7 +62,7 @@
// components: { ExampleComponent },
setup() {
let { setTitle, msg, addMsg, resetSearch } = groupingManageModule()
setTitle('难受', false)
// setTitle('难受', false)
const changePage = () => {
console.log('打印')
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment