手机h5端-提案管理-撰写提案-邀请附议人: 新增清空按钮(如有值),搜索框新增自动搜索事件(300毫秒防抖动),修复取消勾选人员不生效;
This commit is contained in:
+53
-20
@@ -4,15 +4,18 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
|
||||
<van-search
|
||||
v-model="pageForm.searchKeyword"
|
||||
:show-action="false"
|
||||
clearable
|
||||
placeholder="请输入工号或者姓名查询"
|
||||
@input="onSearchInput"
|
||||
@search="doSearch"
|
||||
@clear="clearSearch"
|
||||
></van-search>
|
||||
<van-tabs v-model="isInvite" @click="isInviteClick">
|
||||
<van-tab title="已邀请" name="1"></van-tab>
|
||||
<van-tab title="可邀请" name="0"></van-tab>
|
||||
</van-tabs>
|
||||
|
||||
<van-checkbox-group v-model="tableSelection" v-if="tableData && tableData.length>0">
|
||||
<van-checkbox-group v-model="selectedLoginNames" v-if="tableData && tableData.length>0">
|
||||
<van-cell-group >
|
||||
<van-cell
|
||||
v-for="(item, index) in tableData"
|
||||
@@ -28,9 +31,10 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
|
||||
{{item.unitName}}
|
||||
</span>
|
||||
<van-checkbox
|
||||
:name="item"
|
||||
:name="item.loginName"
|
||||
:ref="'checkboxes'+item.loginName"
|
||||
slot="right-icon"
|
||||
@click.stop
|
||||
v-if="!pageForm.isInvite"></van-checkbox>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
@@ -62,13 +66,21 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
|
||||
},
|
||||
config: {},
|
||||
isInvite: "0",
|
||||
tableSelection: []
|
||||
selectedLoginNames: [],
|
||||
selectedSeconders: {},
|
||||
searchTimer: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async onOpen(record) {
|
||||
this.visible = true
|
||||
this.record = record
|
||||
this.isInvite = "0"
|
||||
this.pageForm.isInvite = false
|
||||
this.pageForm.pageNumber = 1
|
||||
this.pageForm.searchKeyword = null
|
||||
this.selectedLoginNames = []
|
||||
this.selectedSeconders = {}
|
||||
await this.getConfig()
|
||||
this.pageData()
|
||||
|
||||
@@ -77,15 +89,15 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
|
||||
detail(id) {
|
||||
},
|
||||
invite() {
|
||||
if (this.tableSelection.length === 0) {
|
||||
if (this.selectedLoginNames.length === 0) {
|
||||
this.$toast("请先选择附议人后在点击邀请")
|
||||
return
|
||||
}
|
||||
|
||||
const loginNames = [...new Set(this.tableSelection.map((s) => s.loginName))]
|
||||
const userName = [...new Set(this.tableSelection.map((s) => s.userName))]
|
||||
|
||||
console.log(this.tableSelection)
|
||||
const loginNames = [...new Set(this.selectedLoginNames)]
|
||||
const userName = loginNames.map((loginName) => {
|
||||
return this.selectedSeconders[loginName]?.userName || loginName
|
||||
})
|
||||
|
||||
this.$dialog.confirm({
|
||||
title: '提示',
|
||||
@@ -98,7 +110,8 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
|
||||
if (res.code === 0) {
|
||||
this.pageData()
|
||||
this.$toast.success(res.msg)
|
||||
this.tableSelection = []
|
||||
this.selectedLoginNames = []
|
||||
this.selectedSeconders = {}
|
||||
// this.visible = false
|
||||
this.$emit("refresh", null)
|
||||
}
|
||||
@@ -117,20 +130,14 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
this.echoCheckBox()
|
||||
this.cacheCurrentPageSeconders()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 翻页回显勾选
|
||||
echoCheckBox() {
|
||||
this.$nextTick(() => {
|
||||
this.tableData.forEach((item) => {
|
||||
const checkboxRef = this.$refs['checkboxes' + item.loginName]
|
||||
if (checkboxRef && this.tableSelection.map((s) => s.loginName).includes(item.loginName)) {
|
||||
checkboxRef[0].toggle()
|
||||
}
|
||||
})
|
||||
cacheCurrentPageSeconders() {
|
||||
this.tableData.forEach((item) => {
|
||||
this.$set(this.selectedSeconders, item.loginName, item)
|
||||
})
|
||||
},
|
||||
|
||||
@@ -139,13 +146,39 @@ const PROPOSAL_INVITE_SECONDER_COMPONENT = {
|
||||
this.pageData()
|
||||
},
|
||||
|
||||
onSearchInput(val) {
|
||||
clearTimeout(this.searchTimer)
|
||||
this.searchTimer = setTimeout(() => {
|
||||
this.doSearch()
|
||||
}, 300)
|
||||
},
|
||||
|
||||
clearSearch() {
|
||||
clearTimeout(this.searchTimer)
|
||||
this.pageForm.searchKeyword = null
|
||||
this.doSearch()
|
||||
},
|
||||
|
||||
isInviteClick(index, title) {
|
||||
this.pageForm.isInvite = index === "1"
|
||||
this.doSearch()
|
||||
},
|
||||
|
||||
tableRowToggle(index) {
|
||||
console.log(index)
|
||||
if (this.pageForm.isInvite) {
|
||||
return
|
||||
}
|
||||
const item = this.tableData[index]
|
||||
if (!item) {
|
||||
return
|
||||
}
|
||||
this.$set(this.selectedSeconders, item.loginName, item)
|
||||
const checkedIndex = this.selectedLoginNames.indexOf(item.loginName)
|
||||
if (checkedIndex > -1) {
|
||||
this.selectedLoginNames.splice(checkedIndex, 1)
|
||||
} else {
|
||||
this.selectedLoginNames.push(item.loginName)
|
||||
}
|
||||
},
|
||||
|
||||
async getConfig() {
|
||||
|
||||
Reference in New Issue
Block a user