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-DMQewX5_.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 factories = 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 filterFactory = 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 cFactory = ref(0); const cProduct = ref(0); const cBindmac = ref(false); const cNumber = ref(null); const cMacaddresses = 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 revokeConfirmOk = computed(() => !!revokeCtx.value && revokeConfirmInput.value.trim() === String(revokeCtx.value.probatch)); 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 filterFactory.value ? products.value.filter((p) => p.factoryid === filterFactory.value) : products.value; }); const createProductOptions = computed(() => { return cFactory.value ? products.value.filter((p) => p.factoryid === cFactory.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 nameOfFactory(id) { const f = factories.value.find((x) => x.id === id); return f ? f.factory : 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() : ""; } return (_ctx, _push, _parent, _attrs) => { _push(`
| 生产时间 | 厂家 | 产品 | 批次 | 起始MAC | 结束MAC | 数量 | 操作 |
|---|---|---|---|---|---|---|---|
| 加载中… | |||||||
| 查询失败: ${ssrInterpolate(notesError.value)} | |||||||
| 暂无数据 | |||||||
| ${ssrInterpolate(fmtTime(n.ts))} | ${ssrInterpolate(nameOfFactory(n.factoryid))} | ${ssrInterpolate(nameOfProduct(n.productid))} | ${ssrInterpolate(n.probatch || 0)} | ${ssrInterpolate(n.startmac || "")} | ${ssrInterpolate(n.endmac || "")} | ${ssrInterpolate(n.devicetnum || 0)} | `);
if (isSuperAdmin.value) {
_push(``);
} else {
_push(``);
}
_push(` |
| 授权码 | 类型 | 批次 | MAC | 状态 | 封禁 | 用户UID | 激活时间 | 操作 | |
|---|---|---|---|---|---|---|---|---|---|
| 请先选择产品 | |||||||||
| 查询失败: ${ssrInterpolate(devicesError.value)} | |||||||||
| 暂无数据 | |||||||||
| ${ssrInterpolate(d.code || "")} | ${ssrInterpolate(d.codetype === 0 ? "授权码" : "设备码")} | ${ssrInterpolate(d.probatch)} | ${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(` | |