mounted() {
this.getList()
//自动刷新获取数据
this.timer = setInterval(() => {
this.getList()
}, 10000)
},
beforeDestroy() {
// 清除定时器
clearInterval(this.timer)
this.timer = null
},
<el-select
v-model="queryParams.userIds"
placeholder="请选择"
clearable
id="inputVal"
multiple
@change="doClick"
@blur="isOpenSHow"
value-key="userId"
>
<el-option
v-for="item in users"
:key="item.userId"
:label="item.userName"
:value="item"
>
</el-option>
</el-select>
下拉框数据是要字符串 然后提交的时候需要userId
doClick(val) {
console.log(val, "dd")
let oInput = document.createElement("input")
let arr
if (val) {
arr = val.map(r => {
console.log(r, "r")
return r.userName
})
console.log(arr, "arr
}
arr.join(",")
// 创建节点
oInput.value = arr
// 复制
document.body.appendChild(oInput)
// 追加到页面
oInput.select()
// 选择内容
document.execCommand("Copy")
this.CopyName = val
// this.$message({
// message: "复制成功",
// type: "success"
// })
// 提示信息 alert都行比
oInput.remove()
},
handleSave() {
console.log(" this.queryParams.userIds", this.queryParams.userIds)
let qq = []
this.queryParams.userIds.map(r => {
qq.push(r.userId)
})
qq = qq.toString()
let params = {
year: this.queryParams.year,
month: this.queryParams.month,
controlRoomId: this.queryParams.controlRoomId,
userIds: qq,
table: this.table.tableData
}
console.log("params", params)
addPbbc(params).then(res => {
console.log("res,res", res)
})
},