Commit 9fc27800 by lichengming

修改了收样管理项目负责人下拉

parent f6e85977
......@@ -140,6 +140,7 @@ export default {
personType: '',
packList: [],
soilList: [],
projectLeaderName: [],
currentIndex: -1,
id: '',
modalTitle: '',
......@@ -313,29 +314,26 @@ export default {
}
},
_projectLeaderChange(msg, data) {
if (this.$string(this.id).isEmpty()) {
// 添加的时候选择单位
switch (msg) {
case 'select':
this._leaderMatch(data)
break
case 'query':
this._leaderQuery(data)
break
}
} else if (this.projectLeaderData.indexOf(data) !== -1) {
this._queryUserList(data)
} else {
this._leaderQuery(data)
// 添加的时候选择单位
console.log(msg, data)
switch (msg) {
case 'select':
this._leaderMatch(data)
break
case 'query':
this._leaderQuery(data)
break
}
},
_leaderMatch(data) {
console.log('选中', data)
this.formObj.projectLeader = data.realname
if (data.id) {
this.formObj.projectLeaderId = data.id
}
},
_leaderQuery(query) {
this.formObj.projectLeader = query.realname
this._queryUserList(query)
},
_projectMatch(data) {
......@@ -582,6 +580,11 @@ export default {
if (this.formObj.registrantId) {
data.registrantId = this.formObj.registrantId
}
if (this.projectLeaderName.indexOf(data.projectLeader) === -1) {
console.log('没有这个人')
data.projectLeader = undefined
data.projectLeaderId = undefined
}
console.log('saveData', data)
this._save(data)
} else {
......@@ -592,6 +595,11 @@ export default {
if (this.formObj.registrantId) {
data.registrantId = this.formObj.registrantId
}
if (this.projectLeaderName.indexOf(data.projectLeader) === -1) {
console.log('没有这个人')
data.projectLeader = undefined
data.projectLeaderId = undefined
}
this._edit(data)
}
} else {
......@@ -644,6 +652,7 @@ export default {
this.edit = true
console.log(formObj)
this._getProjectList()
this._getLeaderList()
this.showBtn = false
this.showModal = true
this.$refs.formObj.resetFields()
......@@ -704,6 +713,9 @@ export default {
const result = await soilSample.getUserList()
if (result) {
this.projectLeaderData = result.records
for (let i = 0; i < result.records.length; i++) {
this.projectLeaderName.push(result.records[i].realname)
}
}
},
_getQueryList: async function(data) {
......@@ -718,7 +730,10 @@ export default {
}
},
_queryUserList: async function(query) {
console.log(query)
if (query.realname === '') {
this.$forceUpdate()
this.formObj.projectLeader = ''
}
const result = await soilSample.queryUserList(query)
if (result) {
this.projectLeaderData = result.records
......
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