|
|
@@ -10,7 +10,8 @@ import {
|
|
|
getErpShopList,
|
|
|
bindErpShop,
|
|
|
unbindErpShop,
|
|
|
- autoBindErpShop
|
|
|
+ autoBindErpShop,
|
|
|
+ unbindAllErpShop
|
|
|
} from "@/api/erpShop";
|
|
|
import { getDeviceList } from "@/api/device";
|
|
|
|
|
|
@@ -21,6 +22,7 @@ defineOptions({
|
|
|
const loading = ref(false);
|
|
|
const syncing = ref(false);
|
|
|
const autoBinding = ref(false);
|
|
|
+const unbindingAll = ref(false);
|
|
|
const keyword = ref("");
|
|
|
const dataList = ref<any[]>([]);
|
|
|
const total = ref(0);
|
|
|
@@ -113,6 +115,31 @@ async function handleAutoBind() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+async function handleUnbindAll() {
|
|
|
+ try {
|
|
|
+ await ElMessageBox.confirm(
|
|
|
+ "确认解除所有设备与 ERP 店铺的绑定?此操作不可恢复。",
|
|
|
+ "一键解绑",
|
|
|
+ { type: "error", confirmButtonText: "确认解绑", cancelButtonText: "取消" }
|
|
|
+ );
|
|
|
+ } catch { return; }
|
|
|
+
|
|
|
+ unbindingAll.value = true;
|
|
|
+ try {
|
|
|
+ const res = await unbindAllErpShop();
|
|
|
+ if (res.code === 200) {
|
|
|
+ ElMessage.success(res.message || `已解绑 ${res.data} 台设备`);
|
|
|
+ await fetchList();
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.message || "解绑失败");
|
|
|
+ }
|
|
|
+ } catch {
|
|
|
+ ElMessage.error("解绑请求失败");
|
|
|
+ } finally {
|
|
|
+ unbindingAll.value = false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
function openBindDialog(row: any) {
|
|
|
currentErpShop.value = row;
|
|
|
selectedDeviceId.value = row._boundDevice?.id || null;
|
|
|
@@ -197,6 +224,13 @@ onMounted(() => {
|
|
|
>
|
|
|
一键绑定
|
|
|
</el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ :loading="unbindingAll"
|
|
|
+ @click="handleUnbindAll"
|
|
|
+ >
|
|
|
+ 一键解绑
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|