|
|
@ -21,7 +21,7 @@ |
|
|
|
:default-checked-keys="publishAgency" |
|
|
|
style="background-color:#f7f7f7" |
|
|
|
:props="props" |
|
|
|
:data="data" |
|
|
|
:data="treeData" |
|
|
|
show-checkbox |
|
|
|
:default-expand-all="false" /> |
|
|
|
</el-form-item> |
|
|
@ -34,12 +34,7 @@ |
|
|
|
@click="publishProject"> |
|
|
|
<i class="el-icon-document-checked el-icon--right">发布</i> |
|
|
|
</el-button> |
|
|
|
<!-- <el-button class="publish-btn" |
|
|
|
size="medium" |
|
|
|
type="primary" |
|
|
|
@click="resolveAgency"> |
|
|
|
<i class="el-icon-document-checked el-icon--right">获取组织</i> |
|
|
|
</el-button> --> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-if="publishStatus" |
|
|
@ -81,14 +76,13 @@ |
|
|
|
<el-form-item label="发布范围"> |
|
|
|
<el-tree style="background-color:#f7f7f7" |
|
|
|
class="form_item" |
|
|
|
ref="tree" |
|
|
|
ref="selTree" |
|
|
|
node-key="orgId" |
|
|
|
:default-checked-keys="publishAgency" |
|
|
|
:props="props" |
|
|
|
:data="data" |
|
|
|
:data="selTreeData" |
|
|
|
show-checkbox |
|
|
|
:default-expand-all="false" |
|
|
|
disabled /> |
|
|
|
:default-expand-all="false" /> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
|
|
|
@ -147,7 +141,9 @@ export default { |
|
|
|
children: 'subOrgList' |
|
|
|
}, |
|
|
|
count: 1, |
|
|
|
data: [], |
|
|
|
treeData: [], |
|
|
|
|
|
|
|
selTreeData: [],//回显选中的组织 |
|
|
|
|
|
|
|
selAgencyList: [], |
|
|
|
agencyArrayCopy: [], |
|
|
@ -160,7 +156,7 @@ export default { |
|
|
|
let url = window.location.protocol + '//' + window.location.host |
|
|
|
this.writeLink = `${url}/${process.env.VUE_APP_PUBLIC_PATH}/s/${this.projectKey}` |
|
|
|
await this.loadAgencyList() |
|
|
|
this.getProjectStatus() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
@ -177,9 +173,14 @@ export default { |
|
|
|
agencyId: customerId |
|
|
|
} |
|
|
|
this.$api.post(`/data/aggregator/org/agencytree`, params).then((res) => { |
|
|
|
this.data = res.data || [] |
|
|
|
this.treeData = res.data || [] |
|
|
|
this.selTreeData = JSON.parse(JSON.stringify(this.treeData)) |
|
|
|
|
|
|
|
this.getProjectStatus() |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
//获取问卷发布范围 |
|
|
|
getPublishAgency () { |
|
|
|
let params = { |
|
|
@ -200,17 +201,32 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
this.publishAgency = res.data.orgList || [] |
|
|
|
this.$refs.tree.setCheckedNodes(this.publishAgency) |
|
|
|
|
|
|
|
|
|
|
|
// this.processSelTreeData(this.selTreeData) |
|
|
|
// this.$refs.selTree.setCheckedNodes(this.publishAgency) |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
processSelTreeData (array) { |
|
|
|
|
|
|
|
array.forEach(element => { |
|
|
|
element.disabled = true |
|
|
|
if (element.subOrgList && element.subOrgList.length > 0) { |
|
|
|
this.processSelTreeData(element.subOrgList) |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
//解析树选择的数据 |
|
|
|
resolveAgency () { |
|
|
|
let selAll = this.$refs.tree.getCheckedNodes(false, false) |
|
|
|
// console.log(selAll) |
|
|
|
|
|
|
|
this.selAgencyList = [] |
|
|
|
this.agencyArrayCopy = JSON.parse(JSON.stringify(this.data)) |
|
|
|
this.agencyArrayCopy = JSON.parse(JSON.stringify(this.treeData)) |
|
|
|
|
|
|
|
selAll.forEach(element => { |
|
|
|
// debugger |
|
|
@ -218,7 +234,6 @@ export default { |
|
|
|
this.resursionTree(this.agencyArrayCopy, orgId) |
|
|
|
}); |
|
|
|
|
|
|
|
console.log(this.selAgencyList) |
|
|
|
}, |
|
|
|
|
|
|
|
//递归树 |
|
|
@ -256,7 +271,7 @@ export default { |
|
|
|
}, |
|
|
|
publishProject () { |
|
|
|
this.resolveAgency() |
|
|
|
if (this.data.length > 0 && this.selAgencyList.length === 0) { |
|
|
|
if (this.treeData.length > 0 && this.selAgencyList.length === 0) { |
|
|
|
this.$message( |
|
|
|
{ |
|
|
|
message: "请选择发布范围", |
|
|
|