人员选择器需求调整

This commit is contained in:
艾贤凌
2022-01-18 15:58:07 +08:00
parent 96f04bbdca
commit db905fa4e3
5 changed files with 31 additions and 10 deletions

View File

@@ -39,7 +39,7 @@ export default {
document.title = "问卷表单" document.title = "问卷表单"
this.$refs?.TabPage?.show() this.$refs?.TabPage?.show()
this.$nextTick(() => { this.$nextTick(() => {
this.injectJWeixin(['sendChatMessage', 'selectEnterpriseContact', 'shareAppMessage', 'shareWechatMessage']).then(() => { this.injectJWeixin(['sendChatMessage', 'shareAppMessage', 'shareWechatMessage']).then(() => {
this.$dict.load(['questionnaireStatus', 'questionnaireType', 'questionnaireFieldType']) this.$dict.load(['questionnaireStatus', 'questionnaireType', 'questionnaireFieldType'])
}) })
}) })

View File

@@ -40,7 +40,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.injectJWeixin(['sendChatMessage', 'selectEnterpriseContact']) this.injectJWeixin(['sendChatMessage'])
}, },
methods: { methods: {
...mapActions(['injectJWeixin', 'wxInvoke']), ...mapActions(['injectJWeixin', 'wxInvoke']),

View File

@@ -159,16 +159,16 @@ export default {
} }
}, },
methods: { methods: {
...mapActions(['selectEnterpriseContact']), ...mapActions(['selectPrivilegedContact']),
handleSelectUser() { handleSelectUser() {
if (this.clickedUserSelect) return this.$u.toast("正在打开人员选择器") if (this.clickedUserSelect) return this.$u.toast("正在打开人员选择器")
this.clickedUserSelect = true this.clickedUserSelect = true
this.selectEnterpriseContact({ this.selectPrivilegedContact({
fromDepartmentId: 0, fromDepartmentId: 0,
type: ["user"], selectedOpenUserIds: this.form.attendees?.map(e => e.id)
selectedUserIds: this.form.attendees?.map(e => e.id)
}).then(res => { }).then(res => {
this.change(res?.userList || []) this.change(res?.userList || [])
this.form.ticket = res?.selectedTicket || ""
this.clickedUserSelect = false this.clickedUserSelect = false
}).catch(() => { }).catch(() => {
this.clickedUserSelect = false this.clickedUserSelect = false

View File

@@ -105,16 +105,16 @@ export default {
}, },
methods: { methods: {
...mapActions(['selectEnterpriseContact']), ...mapActions(['selectPrivilegedContact']),
handleSelectUser() { handleSelectUser() {
if (this.clickedUserSelect) return this.$u.toast("正在打开人员选择器") if (this.clickedUserSelect) return this.$u.toast("正在打开人员选择器")
this.clickedUserSelect = true this.clickedUserSelect = true
this.selectEnterpriseContact({ this.selectPrivilegedContact({
fromDepartmentId: 0, fromDepartmentId: 0,
type: ["user"], selectedOpenUserIds: this.form.persons?.map(e => e.id)
selectedUserIds: this.form.persons?.map(e => e.id)
}).then(res => { }).then(res => {
this.form.persons = res?.userList || [] this.form.persons = res?.userList || []
this.form.ticket = res?.selectedTicket
this.clickedUserSelect = false this.clickedUserSelect = false
}).catch(() => { }).catch(() => {
this.clickedUserSelect = false this.clickedUserSelect = false

View File

@@ -351,6 +351,27 @@ const store = new Vuex.Store({
}) })
}) })
}, },
selectPrivilegedContact(state, params) {
return new Promise(resolve => {
state.dispatch("injectJWeixin", "selectPrivilegedContact").then(() => {
setTimeout(() => {
let sdk = typeof wx?.invoke == 'function' ? wx : jWeixin
sdk?.invoke("selectEnterpriseContact", {
fromDepartmentId: -1,
mode: "multi",
...params
}, res => {
if (res.err_msg == "selectPrivilegedContact:ok") {
if (typeof res.result == 'string') {
res.result = JSON.parse(res.result)
}
resolve(res.result)
}
})
}, 500)
})
})
},
}, },
getters: { getters: {
getDict: state => key => { getDict: state => key => {