权限:移除业务物理删除入口
This commit is contained in:
@@ -27,10 +27,9 @@
|
||||
@click="handleUpdate()" v-hasPermi="['master:customer:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5"><el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['master:customer:remove']">删除</el-button></el-col>
|
||||
</el-row>
|
||||
<el-row v-if="userStore.admin === true && !testBatchStore.isTestMode" :gutter="10" class="mb8 master-toolbar">
|
||||
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog">纳入测试批次</el-button></el-col>
|
||||
<el-col :span="1.5"><el-button type="warning" plain icon="FolderAdd" :disabled="!selectedIds.length" @click="openAdoptionDialog" v-hasPermi="['system:testbatch:adopt']">纳入测试批次</el-button></el-col>
|
||||
</el-row>
|
||||
|
||||
<el-alert v-if="loadError" :title="loadError" type="error" :closable="false" show-icon class="mb8" />
|
||||
@@ -51,10 +50,6 @@
|
||||
v-if="proxy.$auth.hasPermiAnd(['master:customer:query', 'master:customer:edit'])"
|
||||
link type="primary" icon="Edit" :disabled="detailLoading" @click="handleUpdate(scope.row)" v-hasPermi="['master:customer:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.canRemove === true"
|
||||
link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['master:customer:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -117,7 +112,7 @@
|
||||
</style>
|
||||
|
||||
<script setup name="Customer">
|
||||
import { addCustomer, delCustomer, getCustomer, listCustomer, updateCustomer } from "@/api/master/customer";
|
||||
import { addCustomer, getCustomer, listCustomer, updateCustomer } from "@/api/master/customer";
|
||||
import TestBatchAdoptionDialog from '@/components/TestBatchAdoptionDialog'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import useTestBatchStore from '@/store/modules/testBatch'
|
||||
@@ -130,7 +125,6 @@ const adoptionDialogRef = ref()
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
const customerList = ref([]);
|
||||
const selectedIds = ref([]);
|
||||
const removableIds = ref([]);
|
||||
const loading = ref(false);
|
||||
const detailLoading = ref(false);
|
||||
const submitLoading = ref(false);
|
||||
@@ -138,7 +132,6 @@ const loadError = ref("");
|
||||
const formError = ref("");
|
||||
const open = ref(false);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
let listGeneration = 0;
|
||||
@@ -223,11 +216,7 @@ function handleQuery() { queryParams.value.pageNum = 1; getList(); }
|
||||
function resetQuery() { proxy.resetForm("queryRef"); handleQuery(); }
|
||||
function handleSelectionChange(selection) {
|
||||
selectedIds.value = selection.map((item) => item.customerId);
|
||||
removableIds.value = selection
|
||||
.filter((item) => item.canRemove === true)
|
||||
.map((item) => item.customerId);
|
||||
single.value = selectedIds.value.length !== 1;
|
||||
multiple.value = removableIds.value.length === 0;
|
||||
}
|
||||
|
||||
function openAdoptionDialog() { adoptionDialogRef.value?.open() }
|
||||
@@ -309,15 +298,5 @@ function submitUpdate() {
|
||||
}).finally(() => { submitLoading.value = false; });
|
||||
});
|
||||
}
|
||||
function handleDelete(row) {
|
||||
const targetIds = row?.customerId ? (row.canRemove === true ? [row.customerId] : []) : removableIds.value;
|
||||
if (!targetIds.length) { proxy.$modal.msgWarning("请选择允许删除的客户"); return; }
|
||||
proxy.$modal.confirm(`是否确认删除客户编号为“${targetIds.join(",")}”的数据项?`).then(() =>
|
||||
delCustomer(targetIds.join(","))
|
||||
).then(() => { proxy.$modal.msgSuccess("删除成功"); getList(); }).catch((error) => {
|
||||
if (error !== "cancel" && error !== "close") loadError.value = "客户删除失败,请稍后重试";
|
||||
});
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user