若干bug修复
parent
a567d36025
commit
e105f75dc0
12
src/main.js
12
src/main.js
|
@ -54,6 +54,18 @@ Vue.config.productionTip = false
|
|||
Vue.use(Element, {
|
||||
size: Cookies.get('size') || 'small' // set element-ui default size
|
||||
})
|
||||
|
||||
// 树数据结构去除空子级
|
||||
Vue.prototype.removeEmptyChildren = function(data) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].nodes && data[i].nodes.length > 0) {
|
||||
this.removeEmptyChildren(data[i].nodes)
|
||||
} else {
|
||||
delete data[i].nodes
|
||||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
/* eslint-disable no-new */
|
||||
new Vue({
|
||||
el: '#app',
|
||||
|
|
|
@ -5,18 +5,47 @@
|
|||
:append-to-body="appendToBody"
|
||||
:before-close="beforeClose"
|
||||
title="推送"
|
||||
width="500px"
|
||||
width="1000px"
|
||||
destroy-on-close>
|
||||
<el-form label-position="right" label-width="100px">
|
||||
<el-form-item prop="TERRITORIALITY" label="单位 ">
|
||||
<el-select v-model="corp_id" placeholder="请选择单位 " style="width: 90%" @change="getInfo">
|
||||
<el-option
|
||||
v-for="item in jituanDanweiTreeData"
|
||||
:key="item.CORPINFO_ID"
|
||||
:label="item.CORP_NAME"
|
||||
:value="JSON.stringify(item)"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form label-position="right" label-width="150px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="TERRITORIALITY" label="单位 ">
|
||||
<el-select v-model="corp_id" placeholder="请选择单位 " style="width: 90%" @change="getInfo">
|
||||
<el-option
|
||||
v-for="item in jituanDanweiTreeData"
|
||||
:key="item.CORPINFO_ID"
|
||||
:label="item.CORP_NAME"
|
||||
:value="JSON.stringify(item)"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="TERRITORIALITY" label="指定监管部门:">
|
||||
<Treeselect
|
||||
:options="departmentTree"
|
||||
:normalizer="normalizer"
|
||||
v-model="form.APPOINT_DEPARTMENT_ID"
|
||||
placeholder="请选择部门"
|
||||
no-options-text="暂无数据"
|
||||
no-children-text="暂无数据"
|
||||
style="width: 100%;"
|
||||
@select="getPeopleList($event)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="TERRITORIALITY" label="指定监管部门审批人:">
|
||||
<el-select v-model="form.user" style="width: 300px" placeholder="请选择" @change="chooseUser">
|
||||
<el-option v-for="item in peopleList" :key="item.USER_ID" :value="JSON.stringify(item)" :label="item.NAME"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">关 闭</el-button>
|
||||
|
@ -48,7 +77,28 @@ export default {
|
|||
corp_id: null,
|
||||
corp_name: '',
|
||||
heirloom: {},
|
||||
listFlag: false
|
||||
listFlag: false,
|
||||
departmentTree: [],
|
||||
peopleList: [],
|
||||
normalizer(node) {
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.name,
|
||||
children: node.nodes
|
||||
}
|
||||
},
|
||||
form: {
|
||||
STATUS: null,
|
||||
APPOINT_CORP_ID: '',
|
||||
APPOINT_CORP_NAME: '',
|
||||
APPOINT_DEPARTMENT_ID: null,
|
||||
APPOINT_DEPARTMENT_NAME: '',
|
||||
APPOINT_USER_ID: '',
|
||||
APPOINT_USER_NAME: '',
|
||||
user: '',
|
||||
tm: new Date().getTime(),
|
||||
list: []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -80,22 +130,19 @@ export default {
|
|||
},
|
||||
getInfo(e) {
|
||||
const info = JSON.parse(e)
|
||||
this.corp_name = info.CORP_NAME
|
||||
this.form.APPOINT_CORP_ID = info.CORPINFO_ID
|
||||
this.form.APPOINT_CORP_NAME = info.CORP_NAME
|
||||
this.getDepartmentTree()
|
||||
},
|
||||
beforeClose() {
|
||||
this.corp_id = null
|
||||
this.visible = false
|
||||
},
|
||||
sendMessage() {
|
||||
const corp_id = JSON.parse(this.corp_id).CORPINFO_ID
|
||||
this.form.list = this.heirloom
|
||||
console.log(this.form)
|
||||
requestFN(
|
||||
'/trainingbatch/sendMessage',
|
||||
{
|
||||
list: this.heirloom,
|
||||
corp_id: corp_id,
|
||||
corp_name: this.corp_name,
|
||||
tm: new Date().getTime()
|
||||
}
|
||||
'/trainingbatch/sendMessage', this.form
|
||||
).then((data) => {
|
||||
if (data.code !== '0') {
|
||||
this.$message.error(data.msg)
|
||||
|
@ -105,7 +152,36 @@ export default {
|
|||
this.$emit('refresh', '')
|
||||
}
|
||||
})
|
||||
},
|
||||
getDepartmentTree() {
|
||||
requestFN(
|
||||
'/companyApi/department/listTree',
|
||||
{ CORPINFO_ID: this.form.APPOINT_CORP_ID }
|
||||
).then((data) => {
|
||||
this.departmentTree = this.removeEmptyChildren(JSON.parse(data.zTreeNodes))
|
||||
}).catch((e) => {
|
||||
console.log(e)
|
||||
})
|
||||
},
|
||||
getPeopleList(e) {
|
||||
this.form.APPOINT_DEPARTMENT_NAME = e.name
|
||||
requestFN(
|
||||
'/companyApi/user/listAll',
|
||||
{
|
||||
DEPARTMENT_ID: e.id
|
||||
}
|
||||
).then((data) => {
|
||||
this.peopleList = data.userList
|
||||
}).catch((e) => {
|
||||
console.log(e)
|
||||
})
|
||||
},
|
||||
chooseUser(e) {
|
||||
const entity = JSON.parse(e)
|
||||
this.form.APPOINT_USER_ID = entity.USER_ID
|
||||
this.form.APPOINT_USER_NAME = entity.NAME
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue