|
@@ -14,7 +14,7 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<template #extra>
|
|
<template #extra>
|
|
- <el-button type="danger" :disabled="tableCheckedKeys.length <= 0" @click="batchDel">批量删除</el-button>
|
|
|
|
|
|
+ <el-button type="danger" :disabled="tableCheckedKeys.length <= 0" @click="batchDel">删除</el-button>
|
|
</template>
|
|
</template>
|
|
<hc-table
|
|
<hc-table
|
|
:column="tableColumn" :datas="tableData" :loading="tableLoading" is-check
|
|
:column="tableColumn" :datas="tableData" :loading="tableLoading" is-check
|
|
@@ -61,9 +61,10 @@
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import { onMounted, ref, watch } from 'vue'
|
|
import { onMounted, ref, watch } from 'vue'
|
|
|
|
+import { HcDelMsg } from 'hc-vue3-ui'
|
|
import { useAppStore } from '~src/store'
|
|
import { useAppStore } from '~src/store'
|
|
import { getErtractInfo } from '~api/other'
|
|
import { getErtractInfo } from '~api/other'
|
|
-import { getArrValue, getObjValue, isNullES } from 'js-fast-way'
|
|
|
|
|
|
+import { arrToId, getArrValue, getObjValue, isNullES } from 'js-fast-way'
|
|
import mainApi from '~api/tentative/material/testSample'
|
|
import mainApi from '~api/tentative/material/testSample'
|
|
|
|
|
|
//参数
|
|
//参数
|
|
@@ -242,11 +243,34 @@ const disposeClose = () => {
|
|
|
|
|
|
//删除
|
|
//删除
|
|
const rowDel = (row) => {
|
|
const rowDel = (row) => {
|
|
-
|
|
|
|
|
|
+ HcDelMsg(async (resolve) => {
|
|
|
|
+ const { error, code, msg } = await mainApi.sampleRemove(row.id)
|
|
|
|
+ resolve()
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ window.$message.success('删除成功')
|
|
|
|
+ getTableData().then()
|
|
|
|
+ } else {
|
|
|
|
+ window.$message.error(msg ?? '删除失败')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
//批量删除
|
|
//批量删除
|
|
const batchDel = () => {
|
|
const batchDel = () => {
|
|
-
|
|
|
|
|
|
+ const rows = tableCheckedKeys.value
|
|
|
|
+ if (rows.length <= 0) {
|
|
|
|
+ window.$message.warning('请先勾选要删除的数据')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ HcDelMsg(async (resolve) => {
|
|
|
|
+ const { error, code, msg } = await mainApi.sampleRemove(arrToId(rows))
|
|
|
|
+ resolve()
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ window.$message.success('删除成功')
|
|
|
|
+ getTableData().then()
|
|
|
|
+ } else {
|
|
|
|
+ window.$message.error(msg ?? '删除失败')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|