Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica.cloud.web-education-admin
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
提交
打开侧边栏
com.pica.cloud.education.frontend
pica.cloud.web-education-admin
提交
b605c3f2
提交
b605c3f2
编写于
9月 10, 2019
作者:
zhentian.jia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
重构拼接树
上级
498038d4
变更
3
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
122 行增加
和
86 行删除
+122
-86
env-config.js
src/utils/env-config.js
+6
-6
operation.js
src/utils/operation.js
+35
-0
item-role.vue
src/views/system/item-role.vue
+81
-80
未找到文件。
src/utils/env-config.js
浏览文件 @
b605c3f2
...
...
@@ -30,7 +30,7 @@ export const envConfig = {
reportUrl
:
'https://dev-sc-report.yunqueyi.com/'
,
// reportUrl: 'https://test1-sc-report.yunqueyi.com/',
// reportUrl: 'https://uat-sc-report.yunqueyi.com/',
excelUrl
:
'https://test-file.yunqueyi.com/File/template/
onlineExam
/'
,
excelUrl
:
'https://test-file.yunqueyi.com/File/template/
portal
/'
,
},
dev
:
{
baseUrl
:
'https://dev-sc.yunqueyi.com/'
,
...
...
@@ -46,7 +46,7 @@ export const envConfig = {
workApiUrl
:
'https://dev-work.yunqueyi.com/web'
,
workApiSrc
:
'https://dev-work.yunqueyi.com'
,
reportUrl
:
'https://dev-sc-report.yunqueyi.com/'
,
excelUrl
:
'https://test-file.yunqueyi.com/File/template/
onlineExam
/'
,
excelUrl
:
'https://test-file.yunqueyi.com/File/template/
portal
/'
,
},
test
:
{
baseUrl
:
'https://test1-sc.yunqueyi.com/'
,
...
...
@@ -62,7 +62,7 @@ export const envConfig = {
workApiUrl
:
'https://test1-work.yunqueyi.com/web'
,
workApiSrc
:
'https://test1-work.yunqueyi.com'
,
reportUrl
:
'https://test1-sc-report.yunqueyi.com/'
,
excelUrl
:
'https://test-file.yunqueyi.com/File/template/
onlineExam
/'
,
excelUrl
:
'https://test-file.yunqueyi.com/File/template/
portal
/'
,
},
test2
:
{
baseUrl
:
'https://test2-work.yunqueyi.com/sc/'
,
...
...
@@ -77,7 +77,7 @@ export const envConfig = {
workApiUrl
:
'https://test2-work.yunqueyi.com/web'
,
workApiSrc
:
'https://test2-work.yunqueyi.com'
,
reportUrl
:
'https://test2-sc-report.yunqueyi.com/'
,
excelUrl
:
'https://test-file.yunqueyi.com/File/template/
onlineExam
/'
,
excelUrl
:
'https://test-file.yunqueyi.com/File/template/
portal
/'
,
},
uat
:
{
baseUrl
:
'https://uat-sc.yunqueyi.com/'
,
...
...
@@ -93,7 +93,7 @@ export const envConfig = {
workApiUrl
:
'https://uat-work.yunqueyi.com/web'
,
workApiSrc
:
'https://uat-work.yunqueyi.com'
,
reportUrl
:
'https://uat-sc-report.yunqueyi.com/'
,
excelUrl
:
'https://test-file.yunqueyi.com/File/template/
onlineExam
/'
,
excelUrl
:
'https://test-file.yunqueyi.com/File/template/
portal
/'
,
},
pro
:
{
baseUrl
:
'https://sc.yunqueyi.com/'
,
...
...
@@ -109,6 +109,6 @@ export const envConfig = {
workApiUrl
:
'https://work.yunqueyi.com/web'
,
workApiSrc
:
'https://work.yunqueyi.com'
,
reportUrl
:
'https://sc-report.yunqueyi.com/'
,
excelUrl
:
'https://test-file.yunqueyi.com/File/template/
onlineExam
/'
,
excelUrl
:
'https://test-file.yunqueyi.com/File/template/
portal
/'
,
}
}
src/utils/operation.js
浏览文件 @
b605c3f2
...
...
@@ -588,4 +588,39 @@ export function getComponent(data) {
list
.
push
(
data
[
i
].
value
);
}
return
list
;
}
export
function
getSimpleCheckedNodes
(
store
)
{
const
checkedNodes
=
[];
const
traverse
=
function
(
node
)
{
const
childNodes
=
node
.
root
?
node
.
root
.
childNodes
:
node
.
childNodes
;
childNodes
.
forEach
(
child
=>
{
if
(
child
.
checked
)
{
checkedNodes
.
push
(
child
.
data
);
}
if
(
child
.
indeterminate
)
{
traverse
(
child
);
}
});
};
traverse
(
store
)
return
checkedNodes
;
}
export
function
setSelectedKeys
(
checkedKeys
,
halfCheckedKeys
)
{
let
selected
=
[];
for
(
let
i
=
0
;
i
<
checkedKeys
.
length
;
i
++
)
{
let
obj
=
{
key
:
checkedKeys
[
i
].
id
,
type
:
1
,
};
selected
.
push
(
obj
);
}
for
(
let
j
=
0
;
j
<
halfCheckedKeys
.
length
;
j
++
)
{
let
obj
=
{
key
:
halfCheckedKeys
[
j
],
type
:
2
,
};
selected
.
push
(
obj
);
}
return
selected
;
}
\ No newline at end of file
src/views/system/item-role.vue
浏览文件 @
b605c3f2
...
...
@@ -290,6 +290,7 @@ import { openLoading, closeLoading } from "../../utils/utils";
import
*
as
commonUtil
from
"../../utils/utils"
;
import
{
getExeclUrl
}
from
"@/utils/index"
;
import
{
uploadExcel
}
from
"@/utils/education/educationApi"
;
import
*
as
operationData
from
"../../utils/operation"
;
let
vm
=
null
;
export
default
{
components
:
{
...
...
@@ -393,7 +394,7 @@ export default {
let
downloadUrl
=
""
;
if
(
type
==
"model"
)
{
downloadUrl
=
getExeclUrl
(
"%E
5%AF%BC%E5%85%A5%E9%A2%98%E7%9B%AE
%E6%A8%A1%E6%9D%BF.xlsx"
"%E
6%95%99%E5%9F%B9%E9%A1%B9%E7%9B%AE%E8%A7%92%E8%89%B2%E5%AF%BC%E5%85%A5
%E6%A8%A1%E6%9D%BF.xlsx"
);
}
else
if
(
type
==
"fail"
)
{
downloadUrl
=
vm
.
failExcelUrl
;
...
...
@@ -634,30 +635,23 @@ export default {
},
addArea
(
row
)
{
vm
.
dialogArea
=
true
;
vm
.
treeData
=
[];
vm
.
tagsRegion
=
[];
vm
.
getAdministrative
(
row
);
},
getAdministrative
(
row
)
{
vm
.
doctorId
=
row
.
userId
;
// let req = {
// projectId: vm.formInline.portalProjectId
// };
let
req
=
{
projectId
:
vm
.
formInline
.
portalProjectId
};
openLoading
(
vm
);
// vm.GET("portal/scope/v1/administrative", req).then(res => {
// closeLoading(vm);
// if (res.code == "000000") {
// let administrativeAll = res.data.administrativeAll;
// let administrative = res.data.administrative;
// this.treeData = [];
// this.treeData[0] = administrativeAll;
// this.setTreeData(administrative);
// }
// });
let
req2
=
{
projectId
:
vm
.
formInline
.
portalProjectId
,
doctorId
:
row
.
userId
};
vm
.
GET
(
"portal/portalProjectOrRole/getAttachRegion"
,
req2
).
then
(
res
=>
{
openLoading
(
vm
);
vm
.
GET
(
"portal/portalProjectOrRole/getAttachRegion"
,
req
).
then
(
res
=>
{
closeLoading
(
vm
);
if
(
res
.
code
==
"000000"
)
{
let
administrativeAll
=
res
.
data
.
administrativeAll
;
let
administrative
=
res
.
data
.
administrative
;
...
...
@@ -702,76 +696,83 @@ export default {
}
},
onChecked
()
{
let
cData
=
[],
oldData
=
(
this
.
treeData
.
length
&&
this
.
treeData
.
slice
())
||
[],
checkedKeys
=
this
.
$refs
.
tree
.
getCheckedKeys
(),
halfCheckedKeys
=
this
.
$refs
.
tree
.
getHalfCheckedKeys
(),
savedCheckedKeys
=
this
.
handlerCheckedData
(
oldData
,
checkedKeys
).
map
(
key
=>
{
return
{
type
:
1
,
key
:
key
};
}
),
savedHalfCheckedKeys
=
halfCheckedKeys
.
map
(
key
=>
{
return
{
type
:
2
,
key
:
key
};
}),
allSelectedKeys
=
savedCheckedKeys
.
concat
(
savedHalfCheckedKeys
);
//
let cData = [],
//
oldData = (this.treeData.length && this.treeData.slice()) || [],
//
checkedKeys = this.$refs.tree.getCheckedKeys(),
//
halfCheckedKeys = this.$refs.tree.getHalfCheckedKeys(),
//
savedCheckedKeys = this.handlerCheckedData(oldData, checkedKeys).map(
//
key => {
//
return { type: 1, key: key };
//
}
//
),
//
savedHalfCheckedKeys = halfCheckedKeys.map(key => {
//
return { type: 2, key: key };
//
}),
//
allSelectedKeys = savedCheckedKeys.concat(savedHalfCheckedKeys);
vm
.
allSelectedKeys
=
allSelectedKeys
;
// vm.allSelectedKeys = allSelectedKeys;
console
.
log
(
'getHalfCheckedKeys():'
,
this
.
$refs
.
tree
.
getHalfCheckedKeys
());
console
.
log
(
'getSimpleCheckedNodes():'
,
operationData
.
getSimpleCheckedNodes
(
this
.
$refs
.
tree
.
store
));
let
checkedTree
=
operationData
.
getSimpleCheckedNodes
(
this
.
$refs
.
tree
.
store
);
let
halfCheckedTree
=
this
.
$refs
.
tree
.
getHalfCheckedKeys
()
vm
.
allSelectedKeys
=
operationData
.
setSelectedKeys
(
checkedTree
,
halfCheckedTree
);
console
.
log
(
'vm.allSelectedKeys'
,
vm
.
allSelectedKeys
);
vm
.
initCheckList
(
allSelectedKeys
);
vm
.
initCheckList
(
vm
.
allSelectedKeys
);
},
getTreeCheck
()
{
let
cData
=
[],
oldData
=
(
this
.
treeData
.
length
&&
this
.
treeData
.
slice
())
||
[],
checkedKeys
=
this
.
$refs
.
tree
.
getCheckedKeys
(),
halfCheckedKeys
=
this
.
$refs
.
tree
.
getHalfCheckedKeys
(),
savedCheckedKeys
=
this
.
handlerCheckedData
(
oldData
,
checkedKeys
).
map
(
key
=>
{
return
{
type
:
1
,
key
:
key
};
}
),
savedHalfCheckedKeys
=
halfCheckedKeys
.
map
(
key
=>
{
return
{
type
:
2
,
key
:
key
};
}),
allSelectedKeys
=
savedCheckedKeys
.
concat
(
savedHalfCheckedKeys
);
// console.log('allSelectedKeys值:',allSelectedKeys)
// let cData = [],
// oldData = (this.treeData.length && this.treeData.slice()) || [],
// checkedKeys = this.$refs.tree.getCheckedKeys(),
// halfCheckedKeys = this.$refs.tree.getHalfCheckedKeys(),
// savedCheckedKeys = this.handlerCheckedData(oldData, checkedKeys).map(
// key => {
// return { type: 1, key: key };
// }
// ),
// savedHalfCheckedKeys = halfCheckedKeys.map(key => {
// return { type: 2, key: key };
// }),
// allSelectedKeys = savedCheckedKeys.concat(savedHalfCheckedKeys);
let
checkedTree
=
operationData
.
getSimpleCheckedNodes
(
this
.
$refs
.
tree
.
store
);
let
halfCheckedTree
=
this
.
$refs
.
tree
.
getHalfCheckedKeys
()
let
allSelectedKeys
=
operationData
.
setSelectedKeys
(
checkedTree
,
halfCheckedTree
);
return
allSelectedKeys
;
},
// 递归删除列表中所有子节点
delSubKeysByNode
(
node
,
checkedKeys
)
{
let
idIndex
;
if
(
node
.
children
&&
node
.
children
.
length
)
{
if
(
node
.
children
&&
node
.
children
.
length
)
{
node
.
children
.
forEach
(
elm
=>
{
idIndex
=
checkedKeys
.
findIndex
(
id
=>
{
return
id
===
elm
.
id
;
});
if
(
idIndex
>
-
1
)
{
checkedKeys
.
splice
(
idIndex
,
1
);
}
if
(
elm
.
children
&&
elm
.
children
.
length
)
{
this
.
delSubKeysByNode
(
elm
,
checkedKeys
);
}
});
}
}
},
// 去除子节点
handlerCheckedData
(
oldData
,
checkedKeys
)
{
oldData
.
forEach
(
element
=>
{
for
(
let
i
=
0
;
i
<
checkedKeys
.
length
;
i
++
)
{
// 如果此节点被选中,则删除所有子节点
if
(
element
.
id
===
checkedKeys
[
i
])
{
this
.
delSubKeysByNode
(
element
,
checkedKeys
);
}
else
{
if
(
element
.
children
&&
element
.
children
.
length
)
{
this
.
handlerCheckedData
(
element
.
children
,
checkedKeys
);
}
}
}
});
return
checkedKeys
;
},
//
//
递归删除列表中所有子节点
//
delSubKeysByNode(node, checkedKeys) {
//
let idIndex;
//
if (node.children && node.children.length) {
//
if (node.children && node.children.length) {
//
node.children.forEach(elm => {
//
idIndex = checkedKeys.findIndex(id => {
//
return id === elm.id;
//
});
//
if (idIndex > -1) {
//
checkedKeys.splice(idIndex, 1);
//
}
//
if (elm.children && elm.children.length) {
//
this.delSubKeysByNode(elm, checkedKeys);
//
}
//
});
//
}
//
}
//
},
//
//
去除子节点
//
handlerCheckedData(oldData, checkedKeys) {
//
oldData.forEach(element => {
//
for (let i = 0; i
<
checkedKeys
.
length
;
i
++
)
{
//
// 如果此节点被选中,则删除所有子节点
//
if (element.id === checkedKeys[i]) {
//
this.delSubKeysByNode(element, checkedKeys);
//
} else {
//
if (element.children && element.children.length) {
//
this.handlerCheckedData(element.children, checkedKeys);
//
}
//
}
//
}
//
});
//
return checkedKeys;
//
},
//添加子节点
append
(
data
,
node
)
{
console
.
log
(
"data:"
,
data
);
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录