diff --git a/src/main/resources/views/platform/zhgh/activity/sports/applyUser/applyUser.js b/src/main/resources/views/platform/zhgh/activity/sports/applyUser/applyUser.js index 6dbd781..a484838 100644 --- a/src/main/resources/views/platform/zhgh/activity/sports/applyUser/applyUser.js +++ b/src/main/resources/views/platform/zhgh/activity/sports/applyUser/applyUser.js @@ -350,15 +350,15 @@ var ACTIVITY_SPORTS_APPLY_USER = { userList: [], addUserDialogVisible: false, - lsUserList:[], - unitOptions:[] + lsUserList: [], + unitOptions: [] } }, methods: { - doAddUser(){ + doAddUser() { this.$refs["lsryform"].validate(async (valid) => { if (valid) { - const birthDate = moment(this.formData.birthday); + const birthDate = this.$moment(this.formData.birthday); const age = this.$moment().diff(birthDate, 'years'); const data = { isAddUser: true, @@ -366,14 +366,10 @@ var ACTIVITY_SPORTS_APPLY_USER = { unitname: this.unitOptions.find(x => x.id === this.formData.unitId).name, ...this.formData } - //如果添加的人不在数据库 - const user = this.lsUserList.find(l => l.id === this.formData.userId) - if (!user) { - const newUser = this.leftApplyUserList.find(a => a.id === this.formData.userId) - if (newUser) { - this.notifyWarning('该用户已存在左侧选择框内,请从左侧选择框内选择!') - return - } + const newUser = this.userList.find(a => a.id === this.formData.userId) + if (newUser) { + this.notifyWarning('该用户已存在左侧选择框内,请从左侧选择框内选择!') + return } this.applyUserList.push(data) this.flushApplyUser(this.applyUserList) @@ -388,23 +384,6 @@ var ACTIVITY_SPORTS_APPLY_USER = { }, async addUserChange(val) { const user = this.lsUserList.find(l => l.id === val) - /* let loginname = "GHLS" + moment().format('YYYY') + "001" - //如果数据库找不到此人 - if (!user) { - const lsryUser = await this.getGhLsRy() - //如果有临时人员 - if (lsryUser) { - let str = lsryUser.loginname; - let prefix = "GHLS"; - // 找到"GHLS"在字符串中首次出现的位置 - let index = str.indexOf(prefix); - // 如果"GHLS"确实存在于字符串中,并且不是在字符串开头 - if (index !== -1 && index + prefix.length < str.length) { - loginname = prefix + (Number(str.slice(index + prefix.length)) + 1); - } - - } - }*/ this.$set(this.formData, 'eventId', this.eventData.eventId) this.$set(this.formData, 'activityId', this.activityTableData.activityId) this.$set(this.formData, 'team', this.applyFromData.teamName) @@ -421,9 +400,11 @@ var ACTIVITY_SPORTS_APPLY_USER = { this.$set(this.formData, 'status', 2) }, async querySearchAsync(queryString) { - const leftApplyUserList = this.leftApplyUserList.map(m => m.loginname) - const rightApplyUserList = this.rightApplyUserList.map(m => m.loginname) - const loginnames = leftApplyUserList.concat(rightApplyUserList) + /* const leftApplyUserList = this.leftApplyUserList.map(m => m.loginname) + const rightApplyUserList = this.rightApplyUserList.map(m => m.loginname) + const loginnames = leftApplyUserList.concat(rightApplyUserList)*/ + + const loginnames = this.applyUserTableData.map(m => m.loginname) const {code, data} = await $.get("/platform/activity/apply/getSysUser", { loginnames: JSON.stringify(loginnames), queryString: queryString