|
@ -17,9 +17,10 @@ |
|
|
<el-form-item label="发布范围"> |
|
|
<el-form-item label="发布范围"> |
|
|
<el-tree class="form_item" |
|
|
<el-tree class="form_item" |
|
|
ref="tree" |
|
|
ref="tree" |
|
|
|
|
|
node-key="orgId" |
|
|
style="background-color:#f7f7f7" |
|
|
style="background-color:#f7f7f7" |
|
|
:props="props" |
|
|
:props="props" |
|
|
:data="data" |
|
|
:data="treeData" |
|
|
show-checkbox |
|
|
show-checkbox |
|
|
:default-expand-all="false" /> |
|
|
:default-expand-all="false" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -32,12 +33,11 @@ |
|
|
@click="publishProject"> |
|
|
@click="publishProject"> |
|
|
<i class="el-icon-document-checked el-icon--right">发布</i> |
|
|
<i class="el-icon-document-checked el-icon--right">发布</i> |
|
|
</el-button> |
|
|
</el-button> |
|
|
<!-- <el-button class="publish-btn" |
|
|
<!-- <el-button type="danger" |
|
|
size="medium" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
@click="resolveAgency"> |
|
|
@click="resolveAgency"> |
|
|
<i class="el-icon-document-checked el-icon--right">获取组织</i> |
|
|
禁用 |
|
|
</el-button> --> |
|
|
</el-button> --> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div v-if="publishStatus" |
|
|
<div v-if="publishStatus" |
|
@ -70,9 +70,28 @@ |
|
|
<div> |
|
|
<div> |
|
|
<p class="success-title">恭喜您,发布成功!</p> |
|
|
<p class="success-title">恭喜您,发布成功!</p> |
|
|
</div> |
|
|
</div> |
|
|
<div> |
|
|
|
|
|
|
|
|
<el-form label-width="150px"> |
|
|
|
|
|
<el-form-item label="小程序端"> |
|
|
|
|
|
<span style="margin-left:30px;float:left">{{publishClient}}</span> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="发布范围"> |
|
|
|
|
|
<el-tree style="background-color:#f7f7f7" |
|
|
|
|
|
class="form_item" |
|
|
|
|
|
ref="selTree" |
|
|
|
|
|
node-key="orgId" |
|
|
|
|
|
:default-checked-keys="publishAgency" |
|
|
|
|
|
:props="props" |
|
|
|
|
|
:data="selTreeData" |
|
|
|
|
|
show-checkbox |
|
|
|
|
|
:default-expand-all="false" /> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
|
|
|
|
<!-- <div> |
|
|
<p class="link-text"> {{ writeLink }}</p> |
|
|
<p class="link-text"> {{ writeLink }}</p> |
|
|
</div> |
|
|
</div> --> |
|
|
<el-row> |
|
|
<el-row> |
|
|
<el-col :offset="2" |
|
|
<el-col :offset="2" |
|
|
:span="6"> |
|
|
:span="6"> |
|
@ -88,6 +107,7 @@ |
|
|
@click="stopPublishProject"> |
|
|
@click="stopPublishProject"> |
|
|
停止发布 |
|
|
停止发布 |
|
|
</el-button> |
|
|
</el-button> |
|
|
|
|
|
|
|
|
</el-col> |
|
|
</el-col> |
|
|
<!-- <el-col :span="12"> |
|
|
<!-- <el-col :span="12"> |
|
|
<el-button type="warning" |
|
|
<el-button type="warning" |
|
@ -125,20 +145,26 @@ export default { |
|
|
children: 'subOrgList' |
|
|
children: 'subOrgList' |
|
|
}, |
|
|
}, |
|
|
count: 1, |
|
|
count: 1, |
|
|
data: [], |
|
|
treeData: [], |
|
|
|
|
|
|
|
|
|
|
|
selTreeData: [],//回显选中的组织 |
|
|
|
|
|
|
|
|
selAgencyList: [], |
|
|
selAgencyList: [], |
|
|
agencyArrayCopy: [] |
|
|
agencyArrayCopy: [], |
|
|
|
|
|
publishClient: '', |
|
|
|
|
|
publishAgency: []//问卷的发布范围 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
mounted () { |
|
|
async mounted () { |
|
|
this.projectKey = this.$route.query.key |
|
|
this.projectKey = this.$route.query.key |
|
|
let url = window.location.protocol + '//' + window.location.host |
|
|
let url = window.location.protocol + '//' + window.location.host |
|
|
this.writeLink = `${url}/${process.env.VUE_APP_PUBLIC_PATH}/s/${this.projectKey}` |
|
|
this.writeLink = `${url}/${process.env.VUE_APP_PUBLIC_PATH}/s/${this.projectKey}` |
|
|
this.getProjectStatus() |
|
|
await this.loadAgencyList() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
|
|
|
clientChange (label) { |
|
|
clientChange (label) { |
|
|
this.clientType = label |
|
|
this.clientType = label |
|
|
this.loadAgencyList() |
|
|
this.loadAgencyList() |
|
@ -151,17 +177,69 @@ export default { |
|
|
agencyId: customerId |
|
|
agencyId: customerId |
|
|
} |
|
|
} |
|
|
this.$api.post(`/data/aggregator/org/agencytree`, params).then((res) => { |
|
|
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 = { |
|
|
|
|
|
projectKey: this.projectKey, |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
this.$api.post(`/data/aggregator/questionnaire/getrange`, params).then((res) => { |
|
|
|
|
|
if (res.data.client) { |
|
|
|
|
|
if (res.data.client === 'resi') { |
|
|
|
|
|
this.publishClient = '居民端' |
|
|
|
|
|
} else if (res.data.client === 'gov') { |
|
|
|
|
|
this.publishClient = '工作端' |
|
|
|
|
|
} else { |
|
|
|
|
|
this.publishClient = '未知' |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
this.publishClient = '未知' |
|
|
|
|
|
} |
|
|
|
|
|
// this.processSelTreeData(this.selTreeData) |
|
|
|
|
|
this.publishAgency = res.data.orgList || [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.processSelTreeData(this.selTreeData) |
|
|
|
|
|
this.$refs.selTree.setCheckedKeys(this.publishAgency) |
|
|
|
|
|
this.processSelTreeData(this.selTreeData) |
|
|
|
|
|
// this.$refs.selTree.setCheckedNodes(this.publishAgency) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
disableditem () { |
|
|
|
|
|
this.processSelTreeData(this.selTreeData) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
processSelTreeData (array) { |
|
|
|
|
|
|
|
|
|
|
|
array.forEach(element => { |
|
|
|
|
|
element.disabled = true |
|
|
|
|
|
if (element.subOrgList && element.subOrgList.length > 0) { |
|
|
|
|
|
this.processSelTreeData(element.subOrgList) |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
console.log(this.selTreeData) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
//解析树选择的数据 |
|
|
//解析树选择的数据 |
|
|
resolveAgency () { |
|
|
resolveAgency () { |
|
|
|
|
|
|
|
|
let selAll = this.$refs.tree.getCheckedNodes(false, false) |
|
|
let selAll = this.$refs.tree.getCheckedNodes(false, false) |
|
|
// console.log(selAll) |
|
|
console.log(selAll) |
|
|
|
|
|
|
|
|
this.selAgencyList = [] |
|
|
this.selAgencyList = [] |
|
|
this.agencyArrayCopy = JSON.parse(JSON.stringify(this.data)) |
|
|
this.agencyArrayCopy = JSON.parse(JSON.stringify(this.treeData)) |
|
|
|
|
|
|
|
|
selAll.forEach(element => { |
|
|
selAll.forEach(element => { |
|
|
// debugger |
|
|
// debugger |
|
@ -169,27 +247,28 @@ export default { |
|
|
this.resursionTree(this.agencyArrayCopy, orgId) |
|
|
this.resursionTree(this.agencyArrayCopy, orgId) |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
console.log(this.selAgencyList) |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//递归树 |
|
|
//递归树 |
|
|
resursionTree (orgArray, orgId) { |
|
|
resursionTree (orgArray, orgId) { |
|
|
for (let i = 0; i < orgArray.length; i++) { |
|
|
for (let i = 0; i < orgArray.length; i++) { |
|
|
let item = orgArray[i] |
|
|
let item = orgArray[i] |
|
|
// debugger |
|
|
|
|
|
if (item && item.orgId === orgId) { |
|
|
if (item && item.orgId === orgId) { |
|
|
// debugger |
|
|
orgArray[i].orgIds = orgArray[i].orgPids |
|
|
|
|
|
orgArray[i].subOrgList = [] |
|
|
|
|
|
|
|
|
this.selAgencyList.push(orgArray[i]) |
|
|
this.selAgencyList.push(orgArray[i]) |
|
|
orgArray[i] = {} |
|
|
orgArray[i] = {} |
|
|
break |
|
|
break |
|
|
|
|
|
|
|
|
} else if (item.subOrgList && item.subOrgList.length > 0) { |
|
|
} else if (item.subOrgList && item.subOrgList.length > 0) { |
|
|
// debugger |
|
|
|
|
|
this.resursionTree(item.subOrgList, orgId) |
|
|
this.resursionTree(item.subOrgList, orgId) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// console.log(this.agencyArrayCopy) |
|
|
console.log(this.selAgencyList) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
@ -198,15 +277,16 @@ export default { |
|
|
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/${this.projectKey}`).then(res => { |
|
|
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/${this.projectKey}`).then(res => { |
|
|
if (res.data.status == 2) { |
|
|
if (res.data.status == 2) { |
|
|
this.publishStatus = true |
|
|
this.publishStatus = true |
|
|
|
|
|
this.getPublishAgency() |
|
|
} else { |
|
|
} else { |
|
|
this.publishStatus = false |
|
|
this.publishStatus = false |
|
|
this.loadAgencyList() |
|
|
|
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
publishProject () { |
|
|
publishProject () { |
|
|
this.resolveAgency() |
|
|
this.resolveAgency() |
|
|
if (this.data.length > 0 && this.selAgencyList.length === 0) { |
|
|
if (this.treeData.length > 0 && this.selAgencyList.length === 0) { |
|
|
this.$message( |
|
|
this.$message( |
|
|
{ |
|
|
{ |
|
|
message: "请选择发布范围", |
|
|
message: "请选择发布范围", |
|
@ -225,6 +305,7 @@ export default { |
|
|
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/publish`, |
|
|
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/publish`, |
|
|
params).then(() => { |
|
|
params).then(() => { |
|
|
this.publishStatus = true |
|
|
this.publishStatus = true |
|
|
|
|
|
this.getPublishAgency() |
|
|
this.$parent.getProjectStatus() |
|
|
this.$parent.getProjectStatus() |
|
|
this.msgSuccess('发布成功') |
|
|
this.msgSuccess('发布成功') |
|
|
}) |
|
|
}) |
|
@ -274,16 +355,22 @@ export default { |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
<style lang="scss" scoped> |
|
|
|
|
|
.age_title { |
|
|
|
|
|
width: 100px; |
|
|
|
|
|
align-items: left; |
|
|
|
|
|
} |
|
|
.publish-container { |
|
|
.publish-container { |
|
|
width: 100%; |
|
|
width: 100vw; |
|
|
height: 100%; |
|
|
height: 100%; |
|
|
padding: 0; |
|
|
padding: 0; |
|
|
margin: 0; |
|
|
margin: 0; |
|
|
background-color: #f7f7f7; |
|
|
background-color: #f7f7f7; |
|
|
min-height: 84vh; |
|
|
min-height: 84vh; |
|
|
display: flex; |
|
|
display: flex; |
|
|
align-items: center; |
|
|
padding-top: 150px; |
|
|
justify-content: center; |
|
|
padding-left: 350px; |
|
|
|
|
|
// align-items: center; |
|
|
|
|
|
// justify-content: center; |
|
|
} |
|
|
} |
|
|
.publish-btn-view { |
|
|
.publish-btn-view { |
|
|
width: 800px; |
|
|
width: 800px; |
|
|