|
|
|
|
|
|
|
|
<n-card> |
|
|
<n-card> |
|
|
<headSearch :info="data.info" @search="handleSearch" /> |
|
|
<headSearch :info="data.info" @search="handleSearch" /> |
|
|
<data-table |
|
|
<data-table |
|
|
|
|
|
ref="tableRef" |
|
|
:columns="data.columns" |
|
|
:columns="data.columns" |
|
|
:row-key="(row) => row.id" |
|
|
:row-key="(row) => row.id" |
|
|
:request="loadDataTable" |
|
|
:request="loadDataTable" |
|
|
|
|
|
|
|
|
@positive-click="deleteUsers('plural')" |
|
|
@positive-click="deleteUsers('plural')" |
|
|
> |
|
|
> |
|
|
<template #trigger> |
|
|
<template #trigger> |
|
|
<n-button type="primary" @click="deleteUsers"> 删除 </n-button> |
|
|
|
|
|
|
|
|
<n-button type="primary"> 删除 </n-button> |
|
|
</template> |
|
|
</template> |
|
|
确认要批量删除吗? |
|
|
|
|
|
|
|
|
确认要删除选中数据吗? |
|
|
</n-popconfirm> |
|
|
</n-popconfirm> |
|
|
</template> |
|
|
</template> |
|
|
</data-table> |
|
|
</data-table> |
|
|
|
|
|
|
|
|
v-if="data.modalShow" |
|
|
v-if="data.modalShow" |
|
|
v-model:visible="data.modalShow" |
|
|
v-model:visible="data.modalShow" |
|
|
:row="rowData" |
|
|
:row="rowData" |
|
|
@done="loadDataTable" |
|
|
|
|
|
|
|
|
@done="handleSearch" |
|
|
/> |
|
|
/> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
props: { |
|
|
props: { |
|
|
negativeText: '取消', |
|
|
negativeText: '取消', |
|
|
positiveText: '确认', |
|
|
positiveText: '确认', |
|
|
onPositiveClick: deleteSingle.bind(row) |
|
|
|
|
|
|
|
|
onPositiveClick: deleteSingle.bind(null, row.id) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
], |
|
|
], |
|
|
|
|
|
|
|
|
data.modalShow = true |
|
|
data.modalShow = true |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const params = ref({ |
|
|
|
|
|
page: 1, |
|
|
|
|
|
limit: 10 |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
const params = ref({}) |
|
|
|
|
|
|
|
|
const tableRef = ref() |
|
|
const tableRef = ref() |
|
|
|
|
|
|
|
|
function handleSearch(data) { |
|
|
function handleSearch(data) { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
return await getUserList(_params) |
|
|
return await getUserList(_params) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 新增用户 |
|
|
function handleUser() { |
|
|
function handleUser() { |
|
|
data.rowData = {} |
|
|
data.rowData = {} |
|
|
data.modalShow = true |
|
|
data.modalShow = true |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function deleteUsers(type) { |
|
|
|
|
|
console.log(type) |
|
|
|
|
|
// deleteUser({ data: [] }).then((res) => { |
|
|
|
|
|
// if (res.code === 0) { |
|
|
|
|
|
// $message.success(res.data.msg) |
|
|
|
|
|
// this.reload() |
|
|
|
|
|
// } else { |
|
|
|
|
|
// $message.error(res.data.msg) |
|
|
|
|
|
// } |
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
|
// 选择表格数据 |
|
|
|
|
|
const selectedIds = ref([]) |
|
|
|
|
|
function handleCheck(rowKeys) { |
|
|
|
|
|
selectedIds.value = rowKeys |
|
|
} |
|
|
} |
|
|
function deleteSingle(type, row) { |
|
|
|
|
|
console.log(type, row, '++000+++') |
|
|
|
|
|
|
|
|
// 批量删除用户 |
|
|
|
|
|
function deleteUsers() { |
|
|
|
|
|
if (selectedIds.value.length) { |
|
|
|
|
|
deleteData(selectedIds.value) |
|
|
|
|
|
} else { |
|
|
|
|
|
$message.warning('请至少选中一条数据') |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 单个删除数据 |
|
|
|
|
|
function deleteSingle(id) { |
|
|
|
|
|
deleteData([id]) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const checkedRows = ref([]) |
|
|
|
|
|
function handleCheck(rowKeys) { |
|
|
|
|
|
checkedRows.value = rowKeys |
|
|
|
|
|
console.log(rowKeys) |
|
|
|
|
|
|
|
|
// 删除用户接口 |
|
|
|
|
|
function deleteData(data) { |
|
|
|
|
|
deleteUser(data).then((res) => { |
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
handleSearch() |
|
|
|
|
|
$message.success(res.data.msg) |
|
|
|
|
|
} else { |
|
|
|
|
|
$message.error(res.data.msg) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(e => { |
|
|
|
|
|
console.log(e) |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
|
|
|
|
|
|
loadDataTable, |
|
|
loadDataTable, |
|
|
handleUser, |
|
|
handleUser, |
|
|
...toRefs(data), |
|
|
...toRefs(data), |
|
|
|
|
|
tableRef, |
|
|
handleSearch, |
|
|
handleSearch, |
|
|
deleteUsers, |
|
|
deleteUsers, |
|
|
handleCheck |
|
|
|
|
|
|
|
|
handleCheck, |
|
|
|
|
|
selectedIds, |
|
|
|
|
|
deleteData |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |