refec: app密钥,客户管理批量删除

This commit is contained in:
dh186609 2023-02-17 14:23:35 +08:00
parent a49da81d89
commit 10f72d263f
4 changed files with 36 additions and 38 deletions

View File

@ -23,10 +23,11 @@ export function getObj(id?: string) {
})
}
export function delObj(id?: string) {
export function delObj(ids?: object) {
return request({
url: '/admin/appsocial/' + id,
method: 'delete'
url: '/admin/appsocial/',
method: 'delete',
data:ids
})
}

View File

@ -23,10 +23,11 @@ export function getObj(id: string) {
})
}
export function delObj(id: string) {
export function delObj(ids?: object) {
return request({
url: '/admin/appuser/' + id,
method: 'delete'
url: '/admin/appuser/',
method: 'delete',
data:ids
})
}

View File

@ -27,7 +27,7 @@
{{ $t('common.exportBtn') }}
</el-button>
<el-button formDialogRef :disabled="multiple" icon="Delete" type="primary" class="ml10"
v-auth="'app_social_details_del'" @click="handleDelete(undefined)">
v-auth="'app_social_details_del'" @click="handleDelete(selectObjs)">
{{ $t('common.delBtn') }}
</el-button>
<right-toolbar v-model:showSearch="showSearch" class="ml10" style="float: right;margin-right: 20px"
@ -52,7 +52,7 @@
<el-button text type="primary" v-auth="'app_social_details_edit'"
@click="formDialogRef.openDialog(scope.row.id)">{{ $t('common.editBtn') }}
</el-button>
<el-button text type="primary" v-auth="'app_social_details_del'" @click="handleDelete(scope.row)">{{
<el-button text type="primary" v-auth="'app_social_details_del'" @click="handleDelete([scope.row.id])">{{
$t('common.delBtn')
}}
</el-button>
@ -86,7 +86,7 @@ const formDialogRef = ref()
const queryRef = ref()
const showSearch = ref(true)
//
const selectObjs = ref([])
const selectObjs = ref([]) as any
const multiple = ref(true)
const state: BasicTableProps = reactive<BasicTableProps>({
@ -116,9 +116,11 @@ const resetQuery = () => {
}
//
const handleSelectionChange = (val: any) => {
selectObjs.value = val
multiple.value = !val.length
const handleSelectionChange = (objs: any) => {
objs.forEach((val: any) => {
selectObjs.value.push(val.id)
});
multiple.value = !objs.length
}
// excel
@ -127,17 +129,10 @@ const exportExcel = () => {
}
//
const handleDelete = (row: any) => {
if (!row) {
selectObjs.value.forEach((val: any) => {
handleDelete(val)
});
return
}
useMessageBox().confirm(t('common.delConfirmText') + row.id)
const handleDelete = (ids: any) => {
useMessageBox().confirm(t('common.delConfirmText'))
.then(() => {
delObj(row.id).then(() => {
delObj(ids).then(() => {
getDataList();
useMessage().success(t('common.delSuccessText'));
}).catch((err: any) => {

View File

@ -31,7 +31,7 @@
{{ $t('common.exportBtn') }}
</el-button>
<el-button :disabled="multiple" icon="Delete" type="primary" class="ml10" v-auth="'sys_user_del'"
@click="handleDelete(undefined)">
@click="handleDelete(selectObjs)">
{{ $t('common.delBtn') }}
</el-button>
<right-toolbar v-model:showSearch="showSearch" class="ml10" style="float: right;margin-right: 20px"
@ -65,7 +65,7 @@
$t('common.editBtn')
}}
</el-button>
<el-button text type="primary" @click="handleDelete(scope.row)" v-auth="'sys_user_del'">
<el-button text type="primary" @click="handleDelete([scope.row.userId])" v-auth="'sys_user_del'">
{{ $t('common.delBtn') }}
</el-button>
</template>
@ -104,7 +104,7 @@ const showSearch = ref(true)
// rows
const selectObjs = ref([]);
const selectObjs = ref([]) as any;
//
const multiple = ref(true);
@ -134,9 +134,11 @@ const resetQuery = () => {
//
const handleSelectionChange = (val: any) => {
selectObjs.value = val
multiple.value = !val.length
const handleSelectionChange = (objs: any) => {
objs.forEach((val: any) => {
selectObjs.value.push(val.userId)
});
multiple.value = !objs.length
}
// excel
@ -145,17 +147,16 @@ const exportExcel = () => {
}
//
const handleDelete = (row: any) => {
if (!row) {
selectObjs.value.forEach(val => {
handleDelete(val)
});
return
}
useMessageBox().confirm(`${t('common.delConfirmText')}${row.username} ?`).then(() => {
const handleDelete = (ids: string[]) => {
// if (!row) {
// selectObjs.value.forEach(val => {
// handleDelete(val)
// });
// return
// }
useMessageBox().confirm(t('common.delConfirmText')).then(() => {
//
delObj(row.userId).then(() => {
delObj(ids).then(() => {
getDataList();
useMessage().success(t('common.delSuccessText'))
}).catch(err => {