This commit is contained in:
@zuopngfei 2025-11-05 18:37:01 +08:00
parent 4bbf595d2b
commit bf6b7f5fcb
3 changed files with 55 additions and 5 deletions

View File

@ -2,3 +2,5 @@ NODE_ENV = 'development'
VITE_APP_BASE_API = 'https://mini-chat.1024tool.vip/api'
VITE_SERVE = "https://mini-chat.1024tool.vip/api/"
VITE_APP_BASE_API_img = "https://mini-chat.1024tool.vip/"

View File

@ -125,13 +125,13 @@
<el-dialog v-model="dialogLog" title="绑定小程序" width="1000px" align-center :before-close="handleClose" destroy-on-close>
<div class="dialog-box">
<el-table :data="logList" style="width: 100%" max-height="500px" row-key="id"
<el-table ref="appTableRef" :data="logList" style="width: 100%" max-height="500px" row-key="id"
@selection-change="appSelectionChange">
<template #empty>
<span v-if="tableLoading">加载中...</span>
<span v-if="!tableLoading">暂无数据</span>
</template>
<el-table-column type="selection" width="55" :reserve-selection="true" />
<el-table-column type="selection" width="55" :reserve-selection="true" :selectable="isSelectable" />
<el-table-column prop="avatar" label="头像" align="center">
<template #default="scoped">
<el-image style="width: 30px;display: block;margin: auto;border-radius: 4px;"
@ -381,15 +381,46 @@ const logList = ref([])
let robot_data = ''
const tableLoading = ref(false)
let appSelects = []
const appTableRef = ref(null)
const bandAppIds = ref([])
//
const setSelectedApps = () => {
nextTick(() => {
if (appTableRef.value && logList.value.length > 0) {
logList.value.forEach(row => {
if (bandAppIds.value.includes(row.id)) {
appTableRef.value.toggleRowSelection(row, true)
}
})
}
})
}
const openLog = async () => {
dialogLog.value = true
appSelects = []
tableLoading.value = true
const res = await appList(logQuery)
tableLoading.value = false
logList.value = res.list
total.value = res.total
//
if (bandAppIds.value.length === 0 || logQuery.page === 1) {
const res2 = await appList({
admin_id: robot_data.id,
page: 1,
page_size: 100
})
bandAppIds.value = res2.list.map(item => item.id)
// appSelects
appSelects = [...bandAppIds.value]
}
//
setSelectedApps()
}
const handleBindApp = (row) => {
@ -397,11 +428,28 @@ const handleBindApp = (row) => {
dialogLog.value = true
logQuery.page = 1
logQuery.page_size = 10
//
bandAppIds.value = []
appSelects = []
//
nextTick(() => {
if (appTableRef.value) {
appTableRef.value.clearSelection()
}
})
openLog()
}
const isSelectable = (row) => {
// ID,
return !bandAppIds.value.includes(row.id)
}
const appSelectionChange = (e) => {
appSelects = e.map(item => item.id)
// ID
const selectedIds = e.map(item => item.id)
// ID
appSelects = [...new Set([...bandAppIds.value, ...selectedIds])]
}
const saveBind = (val) => {

View File

@ -404,7 +404,7 @@ const submitRobot = async () => {
}
const handleDelete = (item, index) => {
const handeleDelete = (item, index) => {
ElMessageBox.confirm(
'确认删除该小程序吗?',
'提示',