import { defineComponent, computed, ref, reactive, mergeProps, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrRenderStyle, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderList, ssrInterpolate, ssrRenderClass } from 'vue/server-renderer'; import { u as useApi } from './useApi-D_CttG2t.mjs'; import { u as useToast } from './useToast-CS21XT61.mjs'; import { u as useAuthStore } from './auth-QFkCoU1C.mjs'; import './server.mjs'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'pinia'; import 'perfect-debounce'; import './useLoading-D4zrSa2m.mjs'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "device", __ssrInlineRender: true, setup(__props) { useApi(); useToast(); const auth = useAuthStore(); const isSuperAdmin = computed(() => auth.identity === 1); const canCreate = computed(() => auth.identity > 0 && auth.identity <= 2); const brands = ref([]); const products = ref([]); const allProducts = ref([]); const notes = ref([]); const devices = ref([]); const devTotal = ref(0); const devPage = ref(0); const devPageSize = ref(200); const activeTab = ref("production"); const view = ref("main"); const filterBrand = ref(0); const filterProduct = ref(0); const filterStart = ref(""); const filterEnd = ref(""); const statBatch = ref("-"); const statDevices = ref("-"); const statLast = ref("-"); const notesCountText = ref(""); const notesLoading = ref(false); const notesError = ref(""); const codeStatus = ref("1"); const codeSort = ref("usedtime"); const codeBatch = ref(""); const codeCode = ref(""); const codeMac = ref(""); const codeUid = ref(""); const codePageSizeSel = ref("200"); const codePageSizeCustom = ref(null); const devicesError = ref(""); const selectAll = ref(false); const selectedCodes = ref([]); const selectedCount = computed(() => selectedCodes.value.length); ref(null); const cBrand = ref(0); const cProduct = ref(0); const cBindmac = ref(false); const cNumber = ref(null); const cMacaddresses = ref(""); const cRemark = ref(""); const submitting = ref(false); ref(null); const csvFileName = ref(""); ref(null); const emailSending = ref(false); const email = reactive({ to: "", cc: "", subject: "", content: "" }); ref(null); const revokeCtx = ref(null); const revokeConfirmInput = ref(""); const revokeError = ref(""); const revokeSubmitting = ref(false); const revokeConfirmTarget = computed(() => revokeCtx.value ? String(revokeCtx.value.batchno || revokeCtx.value.batchid || "") : ""); const revokeConfirmOk = computed(() => !!revokeCtx.value && revokeConfirmInput.value.trim() === revokeConfirmTarget.value); const totalPages = computed(() => Math.max(1, Math.ceil(devTotal.value / devPageSize.value))); const pgInfoText = computed(() => filterProduct.value ? "第 " + (devPage.value + 1) + " / " + totalPages.value + " 页" : "-"); const filterProductOptions = computed(() => { return filterBrand.value ? products.value.filter((p) => p.brandid === filterBrand.value) : products.value; }); const createProductOptions = computed(() => { return cBrand.value ? products.value.filter((p) => p.brandid === cBrand.value) : []; }); function fmtTime(ts) { if (!ts) return "-"; const d = new Date(ts * 1e3); return d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0") + " " + String(d.getHours()).padStart(2, "0") + ":" + String(d.getMinutes()).padStart(2, "0"); } function nameOfBrand(id) { const b = brands.value.find((x) => x.id === id); return b ? b.brand : String(id || ""); } function nameOfProduct(id) { const p = allProducts.value.find((x) => x.id === id); return p ? p.devicename : String(id || ""); } function hexId(id) { return id ? Number(id).toString(16).toUpperCase() : ""; } function serialRange(n) { const a = n.serialstart != null && n.serialstart !== "" ? String(n.serialstart) : ""; const b = n.serialend != null && n.serialend !== "" ? String(n.serialend) : ""; if (!a && !b) return "-"; return a + " - " + b; } return (_ctx, _push, _parent, _attrs) => { _push(`
`); if (canCreate.value) { _push(``); } else { _push(``); } _push(`
命中批次数
${ssrInterpolate(statBatch.value)}
生产授权码总数
${ssrInterpolate(statDevices.value)}
最近一次生产时间
${ssrInterpolate(statLast.value)}

生产记录(按批次)

${ssrInterpolate(notesCountText.value)}
`); if (notesLoading.value) { _push(``); } else if (notesError.value) { _push(``); } else if (!notes.value.length) { _push(``); } else { _push(``); ssrRenderList(notes.value, (n, i) => { _push(``); }); _push(``); } _push(`
生产时间品牌商产品批次号序号区间起始MAC结束MAC数量操作
加载中…
查询失败: ${ssrInterpolate(notesError.value)}
暂无数据
${ssrInterpolate(fmtTime(n.ts))}${ssrInterpolate(nameOfBrand(n.brandid))}${ssrInterpolate(nameOfProduct(n.productid))}${ssrInterpolate(n.batchno || "")}${ssrInterpolate(serialRange(n))}${ssrInterpolate(n.startmac || "")}${ssrInterpolate(n.endmac || "")}${ssrInterpolate(n.devicenum || 0)}
`); if (isSuperAdmin.value) { _push(``); } else { _push(``); } _push(`

授权码记录

`); if (!filterProduct.value) { _push(``); } else if (devicesError.value) { _push(``); } else if (!devices.value.length) { _push(``); } else { _push(``); ssrRenderList(devices.value, (d, i) => { _push(``); }); _push(``); } _push(`
授权码类型批次MAC状态封禁用户UID激活时间操作
请先选择产品
查询失败: ${ssrInterpolate(devicesError.value)}
暂无数据
${ssrInterpolate(d.code || "")}${ssrInterpolate(d.codetype === 0 ? "授权码" : "设备码")}${ssrInterpolate(d.batchid)}${ssrInterpolate(d.devicemac || "")}`); if (d.status === 0) { _push(`未使用`); } else if (d.status === 1) { _push(`已使用`); } else { _push(`已过期`); } _push(``); if (d.disabled !== 0) { _push(`已禁用`); } else { _push(`正常`); } _push(`${ssrInterpolate(d.uid || "")}${ssrInterpolate(d.usedtime ? fmtTime(d.usedtime) : "-")}
`); if (d.disabled !== 0) { _push(``); } else { _push(``); } if (d.status !== 0) { _push(``); } else { _push(``); } _push(`
${ssrInterpolate(filterProduct.value ? "共 " + devTotal.value + " 条" : "-")}
${ssrInterpolate(pgInfoText.value)}

生成授权码

上传 CSV 文件,系统将读取第一列作为 MAC 地址

`); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/device.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as default }; //# sourceMappingURL=device-BBb3lo0K.mjs.map