if (typeof Promise !== "undefined" && !Promise.prototype.finally) { Promise.prototype.finally = function(callback) { const promise = this.constructor; return this.then( (value) => promise.resolve(callback()).then(() => value), (reason) => promise.resolve(callback()).then(() => { throw reason; }) ); }; } ; if (typeof uni !== "undefined" && uni && uni.requireGlobal) { const global = uni.requireGlobal(); ArrayBuffer = global.ArrayBuffer; Int8Array = global.Int8Array; Uint8Array = global.Uint8Array; Uint8ClampedArray = global.Uint8ClampedArray; Int16Array = global.Int16Array; Uint16Array = global.Uint16Array; Int32Array = global.Int32Array; Uint32Array = global.Uint32Array; Float32Array = global.Float32Array; Float64Array = global.Float64Array; BigInt64Array = global.BigInt64Array; BigUint64Array = global.BigUint64Array; } ; if (uni.restoreGlobal) { uni.restoreGlobal(Vue, weex, plus, setTimeout, clearTimeout, setInterval, clearInterval); } (function(vue) { "use strict"; function requireNativePlugin(name) { return weex.requireModule(name); } function formatAppLog(type, filename, ...args) { if (uni.__log__) { uni.__log__(type, filename, ...args); } else { console[type].apply(console, [...args, filename]); } } const BASE_API = "http://192.168.60.99:8004/"; const config = { BASE_API }; function login(username, password) { return new Promise((resolve, reject) => { uni.request({ url: BASE_API + "api/admin/auth/login", method: "POST", data: { username, password }, success: resolve, fail: reject }); }); } function getUserInfo() { const token = uni.getStorageSync("token"); return new Promise((resolve, reject) => { uni.request({ url: BASE_API + "api/admin/auth/me", method: "POST", data: { token }, success: resolve, fail: reject }); }); } function getMaterialInfo(id) { const token = uni.getStorageSync("token"); return new Promise((resolve, reject) => { uni.request({ url: BASE_API + "api/admin/inventory/show", method: "GET", data: { id, token }, success: resolve, fail: reject }); }); } function getInventoryTaskList(data) { const token = uni.getStorageSync("token"); return new Promise((resolve, reject) => { uni.request({ url: BASE_API + "api/admin/inventory/index", method: "GET", data: { ...data, token }, success: resolve, fail: reject }); }); } function saveInventoryCheck(data) { const token = uni.getStorageSync("token"); return new Promise((resolve, reject) => { formatAppLog("log", "at api.js:87", "confirm接口"); uni.request({ url: BASE_API + "api/admin/material-infos-plan-link/confirm", method: "POST", data: { ...data, token }, success: resolve, fail: reject }); }); } function uploadFile(filePath) { const token = uni.getStorageSync("token"); return new Promise((resolve, reject) => { uni.uploadFile({ url: BASE_API + "api/admin/upload-file", filePath, name: "file", formData: { token }, success: (res) => { try { const data = JSON.parse(res.data); resolve(data); } catch (e) { reject(e); } }, fail: reject }); }); } const _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; let keyDownTime = 1; let runtimeBarcodeFlag = false; let runtimeAsyncFlag = false; let runtimeVoiceFlag = true; const _sfc_main$5 = { data() { return { currentDate: "", taskList: [], showH5Scan: false, html5QrCode: null, scanType: "", // 'inventory' or 'view' // 标签盘点相关数据 btn1Info: "开始盘点", tagsAmount: 0, //读取到的标签总数 btn2Disabled: false, //禁用按键 btn3Disabled: false, //禁用按键 cbDisabled: false, //是否禁用 dataList: [], // list展示的标签列表,首次最多加载offset个,待上拉加载更多时,加载tempList中的数据 pageNum: 100, // 每页加载数量 offset: 50, // 第一页加载的数量/已加载的数量 epcList: [], // 过滤所用列表,只存标签的EPC信息 tempList: [], // 标签缓存列表,缓存标签信息,等待上拉至列表底部时,按页加载缓存列表中的数据 asyncFlag: false, // 异步盘点标志 voiceFlag: true, // 声音播放标志 barcodeFlag: false, // 二维码扫描标志 main: null, // Android主Activity hhwUHFController: null, // UHF控制器 globalEvent: null, // 事件监听 receiver: null // Android广播接收器 }; }, created() { runtimeAsyncFlag = this.asyncFlag; runtimeVoiceFlag = this.voiceFlag; runtimeBarcodeFlag = this.barcodeFlag; }, onLoad() { this.updateDate(); this.initAndroidComponents(); this.initUHFEvent(); }, onShow() { formatAppLog("log", "at pages/index/index.vue:156", "inventory Show"); this.initBarcodeScan(); this.disableBarcodeScanKey(); this.registerKeyReceiver(); }, onHide() { formatAppLog("log", "at pages/index/index.vue:167", "inventory Hide"); if (this.main && this.receiver) { this.main.unregisterReceiver(this.receiver); } }, methods: { updateDate() { const now = /* @__PURE__ */ new Date(); const year = now.getFullYear(); const month = String(now.getMonth() + 1).padStart(2, "0"); const day = String(now.getDate()).padStart(2, "0"); this.currentDate = `${year}-${month}-${day}`; }, handleScan(type) { this.scanType = type; uni.scanCode({ success: (res) => { let id = res.result.trim(); formatAppLog("log", "at pages/index/index.vue:271", "id2:", id); id = this.normalizeScannedId(id); if (!id) { uni.showToast({ title: "二维码无效", icon: "none" }); return; } if (!/^\d+$/.test(id)) { uni.showToast({ title: "二维码信息错误", icon: "none" }); return; } if (type === "inventory") { uni.navigateTo({ url: `/pages/inventory/inventory?code=${encodeURIComponent(id)}` }); } else { uni.navigateTo({ url: `/pages/inventory/inventory?code=${encodeURIComponent(id)}&view=1` }); } }, fail: () => { uni.showToast({ title: "扫码失败", icon: "none" }); } }); }, scanInventory() { this.handleScan("inventory"); }, scanView() { this.handleScan("view"); }, closeH5Scan() { this.showH5Scan = false; if (this.html5QrCode) { this.html5QrCode.stop().then(() => { this.html5QrCode.clear(); }); } }, goTaskDetail(item) { if (!item) { return; } if (!item.raw) { uni.showToast({ title: "暂无更多详情", icon: "none" }); return; } const raw = item.raw; const title = raw.zichanmingcheng || raw.name || item.title || ""; const time = raw.updated_at || raw.created_at || ""; const status = raw.status || ""; const statusText = raw.status_text || item.statusText || ""; uni.navigateTo({ url: `/pages/task-detail/task-detail?title=${encodeURIComponent(title)}&time=${encodeURIComponent(time)}&status=${status}&statusText=${encodeURIComponent(statusText)}` }); }, // 初始化Android组件 initAndroidComponents() { try { this.main = plus.android.runtimeMainActivity(); this.hhwUHFController = getApp().globalData.hhwUHFController; this.globalEvent = getApp().globalData.globalEvent; } catch (e) { formatAppLog("error", "at pages/index/index.vue:339", "初始化Android组件失败:", e); } }, // 初始化UHF事件监听 initUHFEvent() { if (this.globalEvent) { this.globalEvent.addEventListener("uhf_tag_event", (e) => { this.handleUHFEvent(e); }); } }, // 处理UHF事件 handleUHFEvent(e) { formatAppLog("log", "at pages/index/index.vue:355", e.tag_info_list); var result = e.tag_info_list; if (result == null) { var event = e.inventory_event; if (event == "stopInventory") { uni.showToast({ title: "停止盘点", icon: "none" }); this.btn2Disabled = false; this.btn3Disabled = false; this.cbDisabled = false; this.btn1Info = "开始盘点"; } return; } for (var i = 0; i < result.length; i++) { var id = i; var epcHex = this.bytes2HexString(result[i].EpcId); var epc = this.hexToString(epcHex); var rssi = result[i].RSSI; var tag = { id, epc, count: 1, rssi }; var index = this.epcList.indexOf(epc); if (index == -1) { tag.id = this.epcList.length; if (this.dataList.length < this.offset) { this.dataList.push(tag); } this.tempList.push(tag); this.epcList.push(epc); } else { tag.id = index; tag.count = this.tempList[index].count + 1; if (index < this.dataList.length) { this.$set(this.dataList, index, tag); } this.$set(this.tempList, index, tag); } } this.tagsAmount = this.epcList.length; }, // 注册按键接收器 registerKeyReceiver() { if (!this.main) return; var IntentFilter = plus.android.importClass("android.content.IntentFilter"); var filter = new IntentFilter(); filter.addAction("android.rfid.FUN_KEY"); this.receiver = plus.android.implements("io.dcloud.feature.internal.reflect.BroadcastReceiver", { onReceive: (context, intent) => { plus.android.importClass(intent); var code = intent.getIntExtra("keyCode", 0); var keyDown = intent.getBooleanExtra("keydown", false); if (keyDown && keyDownTime == 1 && code == 137) { formatAppLog("log", "at pages/index/index.vue:416", "inventory", "receive keyUp code: " + code); if (runtimeBarcodeFlag) { this.startBarcodeScan(); } else { this.startInventory(); } keyDownTime++; } else if (!keyDown) { if (runtimeBarcodeFlag) { this.stopBarcodeScan(); } else { this.stopInventory(); } keyDownTime = 1; } } }); this.main.registerReceiver(this.receiver, filter); }, // 屏蔽二维码扫描扳机 disableBarcodeScanKey() { if (!this.main) return; var Intent = plus.android.importClass("android.content.Intent"); var intent = new Intent("com.rfid.KEY_SET"); var keyValueArray = ["137"]; intent.putExtra("keyValueArray", keyValueArray); intent.putExtra("137", false); this.main.sendBroadcast(intent); }, // 字节数组转十六进制字符 bytes2HexString(byteArray) { return Array.from(byteArray, function(byte) { return ("0" + (byte & 255).toString(16)).slice(-2); }).join(""); }, // 十六进制字符串转字节数组 hexString2Bytes(str) { var pos = 0; var len = str.length; if (len % 2 != 0) { return null; } len /= 2; var hexA = new Array(); for (var i = 0; i < len; i++) { var s = str.substr(pos, 2); var v = parseInt(s, 16); hexA.push(v); pos += 2; } return hexA; }, // 十六进制字符串转原始数字字符串(反向操作:parseInt(id, 10).toString(16)) hexToString(hexStr) { if (!hexStr) return ""; let clean = hexStr.replace(/\s+/g, "").toUpperCase(); const num = parseInt(clean, 16); if (isNaN(num)) { return hexStr; } return num.toString(); }, // 格式化物资列表数据 formatMaterialList(res) { const list = res && res.data && res.data.list && res.data.list.data ? res.data.list.data : []; formatAppLog("log", "at pages/index/index.vue:490", "list:", list); return list.map((item) => ({ // 用于跳转的ID,后端字段兼容 id: item.id || item.material_info_id || item.inventory_id || "", // 表格展示字段 zichanmingcheng: item.zichanmingcheng || "", total_num: item.total_num ?? item.inventorys_total ?? item.zaikushuliang ?? 0 })); }, // 规范化扫码ID:允许 "3715.000" => "3715" normalizeScannedId(value) { if (!value) return ""; const v = String(value).trim(); if (/^\d+$/.test(v)) return v; if (/^\d+(?:\.\d+)?$/.test(v)) { const num = Number(v); if (!Number.isNaN(num) && Number.isFinite(num)) { return Math.trunc(num).toString(); } } return ""; }, // 从物资列表进入盘点页面 goInventoryFromList(item) { const code = item && (item.id || item.material_info_id || item.inventory_id); if (!code) { uni.showToast({ title: "无法获取物资ID", icon: "none" }); return; } uni.navigateTo({ url: `/pages/inventory/inventory?code=${encodeURIComponent(code)}` }); }, // 初始化二维码扫描 initBarcodeScan() { if (!this.main) return; var Intent = plus.android.importClass("android.content.Intent"); var intent = new Intent("com.rfid.SCAN_INIT"); this.main.sendBroadcast(intent); }, // 触发二维码扫描 startBarcodeScan() { if (!this.main) return; var Intent = plus.android.importClass("android.content.Intent"); var intent = new Intent("com.rfid.SCAN_CMD"); this.main.sendBroadcast(intent); }, // 暂停二维码扫描 stopBarcodeScan() { if (!this.main) return; var Intent = plus.android.importClass("android.content.Intent"); var intent = new Intent("com.rfid.STOP_SCAN"); this.main.sendBroadcast(intent); }, // 处理盘点按钮点击 handleInventory() { if (this.btn1Info == "开始盘点") { this.startInventory(); } else { this.stopInventory(); } }, // 开始盘点 startInventory() { if (!this.hhwUHFController) { uni.showToast({ title: "UHF控制器未初始化", icon: "none" }); return; } this.btn2Disabled = true; this.btn3Disabled = true; this.cbDisabled = true; this.btn1Info = "停止盘点"; this.hhwUHFController.setCancleInventoryFilter(); if (runtimeAsyncFlag) { this.hhwUHFController.startInventory(30, 0, true, 0, runtimeVoiceFlag, (result) => { formatAppLog("log", "at pages/index/index.vue:581", "inventory inventory", "startInventory " + result); }); } else { formatAppLog("log", "at pages/index/index.vue:585", "async_flag"); this.hhwUHFController.startInventory(30, 0, false, 0, runtimeVoiceFlag, (result) => { formatAppLog("log", "at pages/index/index.vue:587", "inventory inventory", "startInventory " + result); }); } }, // 停止盘点 stopInventory() { if (!this.hhwUHFController) { return; } if (runtimeAsyncFlag) { this.hhwUHFController.stopInventory(true); } else { this.hhwUHFController.stopInventory(false); } }, // 清空标签 clearTags() { this.dataList = []; this.tempList = []; this.epcList = []; this.tagsAmount = 0; this.offset = 50; this.taskList = []; }, // 查看物资 viewMaterials() { const idsSource = this.epcList.length ? this.epcList : this.dataList.map((item) => item.epc).filter(Boolean); if (!idsSource.length) { uni.showToast({ title: "请先获取标签数据", icon: "none" }); return; } const ids = idsSource.join(","); uni.showLoading({ title: "查询中..." }); getInventoryTaskList({ ids, page: 1, page_size: 999 }).then((res) => { uni.hideLoading(); formatAppLog("log", "at pages/index/index.vue:632", "res:", res); const materialList = this.formatMaterialList(res); if (materialList.length === 0) { this.taskList = []; uni.showToast({ title: "未查询到物资信息", icon: "none" }); return; } this.taskList = materialList; }).catch((err) => { formatAppLog("error", "at pages/index/index.vue:645", "viewMaterials error", err); uni.hideLoading(); uni.showToast({ title: "获取物资失败", icon: "none" }); }); }, // 加载更多 loadmore() { formatAppLog("log", "at pages/index/index.vue:655", "inventory loadmore", "dataList size1: " + this.dataList.length, "temList size: " + this.tempList.length); if (this.dataList.length >= this.tempList.length) { formatAppLog("log", "at pages/index/index.vue:657", "inventory loadmore", "nomore"); return; } var size; if (this.tempList.length - this.offset >= this.pageNum) { size = this.pageNum; } else { size = this.tempList.length - this.offset; } for (var i = this.offset; i < size + this.offset; i++) { this.dataList.push(this.tempList[i]); } this.offset = this.offset + size; }, // 异步选项改变 onAsyncChange(e) { this.asyncFlag = e.detail.value[0] === "async_checkbox"; runtimeAsyncFlag = this.asyncFlag; }, // 声音选项改变 onVoiceChange(e) { this.voiceFlag = e.detail.value[0] === "voice_checkbox"; runtimeVoiceFlag = this.voiceFlag; }, // 二维码扫描选项改变 onBarcodeChange(e) { this.barcodeFlag = e.detail.value[0] === "barcode_checkbox"; runtimeBarcodeFlag = this.barcodeFlag; } } }; function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "index-bg" }, [ vue.createElementVNode("view", { class: "index-content" }, [ vue.createElementVNode("view", { class: "btn-group" }, [ vue.createElementVNode("button", { class: "main-btn", onClick: _cache[0] || (_cache[0] = (...args) => $options.scanInventory && $options.scanInventory(...args)) }, "扫码盘点"), vue.createElementVNode("button", { class: "main-btn outline", onClick: _cache[1] || (_cache[1] = (...args) => $options.scanView && $options.scanView(...args)) }, "扫码查看") ]), vue.createElementVNode("view", { class: "inventory-section" }, [ vue.createElementVNode("view", { class: "inventory-header" }, [ vue.createElementVNode("text", { class: "inventory-title" }, "标签盘点"), vue.createElementVNode( "text", { class: "tags-amount" }, "标签数量: " + vue.toDisplayString($data.tagsAmount), 1 /* TEXT */ ) ]), vue.createElementVNode( "scroll-view", { class: "tag-list", "scroll-y": "", onScrolltolower: _cache[2] || (_cache[2] = (...args) => $options.loadmore && $options.loadmore(...args)), "lower-threshold": "50" }, [ vue.createElementVNode("view", { class: "list-item-head" }, [ vue.createElementVNode("text", { class: "list-item-text-id" }, "序号"), vue.createElementVNode("text", { class: "list-item-text-epc" }, "标签信息"), vue.createElementVNode("text", { class: "list-item-text-count" }, "次数"), vue.createElementVNode("text", { class: "list-item-text-rssi" }, "信号强度") ]), (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList($data.dataList, (item) => { return vue.openBlock(), vue.createElementBlock("view", { class: "list-item", key: item.id }, [ vue.createElementVNode( "text", { class: "list-item-text-id" }, vue.toDisplayString(item.id + 1), 1 /* TEXT */ ), vue.createElementVNode( "text", { class: "list-item-text-epc" }, vue.toDisplayString(item.epc), 1 /* TEXT */ ), vue.createElementVNode( "text", { class: "list-item-text-count" }, vue.toDisplayString(item.count), 1 /* TEXT */ ), vue.createElementVNode( "text", { class: "list-item-text-rssi" }, vue.toDisplayString(item.rssi), 1 /* TEXT */ ) ]); }), 128 /* KEYED_FRAGMENT */ )) ], 32 /* NEED_HYDRATION */ ), vue.createElementVNode("view", { class: "inventory-options" }), vue.createElementVNode("view", { class: "inventory-btn-box" }, [ vue.createElementVNode( "button", { type: "primary", onClick: _cache[3] || (_cache[3] = (...args) => $options.handleInventory && $options.handleInventory(...args)), class: "inventory-btn" }, vue.toDisplayString($data.btn1Info), 1 /* TEXT */ ), vue.createElementVNode("button", { type: "primary", disabled: $data.btn2Disabled, onClick: _cache[4] || (_cache[4] = (...args) => $options.viewMaterials && $options.viewMaterials(...args)), class: "inventory-btn" }, "查看物资", 8, ["disabled"]) ]), vue.createElementVNode("view", null, [ vue.createElementVNode("button", { type: "primary", disabled: $data.btn3Disabled, onClick: _cache[5] || (_cache[5] = (...args) => $options.clearTags && $options.clearTags(...args)), class: "inventory-btn clear-btn" }, "清空", 8, ["disabled"]) ]) ]), vue.createElementVNode("view", { class: "task-section" }, [ vue.createElementVNode("view", { class: "task-title" }, "物资列表"), vue.createElementVNode("view", { class: "task-list" }, [ vue.createElementVNode("view", { class: "task-item", style: { "font-weight": "600" } }, [ vue.createElementVNode("view", { class: "task-info" }, [ vue.createElementVNode("text", { class: "task-name" }, "物资名称") ]), vue.createElementVNode("view", { class: "task-info", style: { "flex-direction": "row", "align-items": "center", "gap": "8rpx" } }, [ vue.createElementVNode("text", { class: "task-time" }, "库存") ]), vue.createElementVNode("view", { class: "task-info", style: { "width": "120rpx", "text-align": "right" } }, [ vue.createElementVNode("text", { class: "task-time" }, "操作") ]) ]), (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList($data.taskList, (item, idx) => { return vue.openBlock(), vue.createElementBlock("view", { class: "task-item", key: idx }, [ vue.createElementVNode("view", { class: "task-info" }, [ vue.createElementVNode( "text", { class: "task-name" }, vue.toDisplayString(item.zichanmingcheng), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "task-info", style: { "flex-direction": "row", "align-items": "center", "gap": "8rpx" } }, [ vue.createElementVNode( "text", { class: "task-time" }, vue.toDisplayString(item.total_num), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "task-info", style: { "width": "120rpx", "display": "flex", "justify-content": "flex-end" } }, [ vue.createElementVNode("button", { size: "mini", type: "primary", onClick: vue.withModifiers(($event) => $options.goInventoryFromList(item), ["stop"]) }, "盘点", 8, ["onClick"]) ]) ]); }), 128 /* KEYED_FRAGMENT */ )) ]) ]), $data.showH5Scan ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, class: "h5-scan-modal" }, [ vue.createElementVNode("div", { id: "reader", style: { "width": "300px", "height": "300px", "margin": "0 auto" } }), vue.createElementVNode("button", { onClick: _cache[6] || (_cache[6] = (...args) => $options.closeH5Scan && $options.closeH5Scan(...args)) }, "关闭") ])) : vue.createCommentVNode("v-if", true) ]) ]); } const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4], ["__file", "/Users/mac/Documents/朗业/2025/h-苏州河道处/y-应急保障/stocktaking/pages/index/index.vue"]]); const _sfc_main$4 = { data() { return { userInfo: {} }; }, onShow() { getUserInfo().then((response) => { if (response.data) { formatAppLog("log", "at pages/profile/profile.vue:36", "返回数据", response.data); this.userInfo = response.data; } else { uni.showToast({ title: response.data.errmsg || "获取信息失败", icon: "none" }); } }).catch(() => { uni.showToast({ title: "网络错误", icon: "none" }); }); }, methods: { logout() { uni.removeStorageSync("token"); uni.reLaunch({ url: "/pages/login/login" }); } } }; function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "profile-container" }, [ vue.createElementVNode("view", { class: "avatar-section" }, [ vue.createElementVNode("image", { class: "avatar", src: $data.userInfo.avatar || "/static/profile/avatar.png", mode: "aspectFill" }, null, 8, ["src"]) ]), vue.createElementVNode("view", { class: "info-section" }, [ vue.createElementVNode("view", { class: "info-item" }, [ vue.createElementVNode("text", { class: "label" }, "用户名:"), vue.createElementVNode( "text", { class: "value" }, vue.toDisplayString($data.userInfo.username || "-"), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "info-item" }, [ vue.createElementVNode("text", { class: "label" }, "姓名:"), vue.createElementVNode( "text", { class: "value" }, vue.toDisplayString($data.userInfo.name || "-"), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "info-item" }, [ vue.createElementVNode("text", { class: "label" }, "部门:"), vue.createElementVNode( "text", { class: "value" }, vue.toDisplayString($data.userInfo.department && $data.userInfo.department.name || "-"), 1 /* TEXT */ ) ]) ]), vue.createElementVNode("button", { class: "logout-btn", onClick: _cache[0] || (_cache[0] = (...args) => $options.logout && $options.logout(...args)) }, "退出登录") ]); } const PagesProfileProfile = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3], ["__file", "/Users/mac/Documents/朗业/2025/h-苏州河道处/y-应急保障/stocktaking/pages/profile/profile.vue"]]); const _sfc_main$3 = { data() { return { username: "", password: "" }; }, methods: { handleLogin() { if (!this.username || !this.password) { uni.showToast({ title: "请输入用户名和密码", icon: "none" }); return; } uni.showLoading({ title: "登录中...", mask: true }); login(this.username, this.password).then((response) => { uni.hideLoading(); formatAppLog("log", "at pages/login/login.vue:41", response); if (response.data && response.data.errcode !== void 0) { uni.showToast({ title: response.data.errmsg || "登录失败", icon: "none" }); } else if (response.data) { formatAppLog("log", "at pages/login/login.vue:48", response.data.access_token); if (response.data.access_token) { uni.setStorageSync("token", response.data.access_token); } uni.showToast({ title: "登录成功", icon: "success", duration: 1500 }); setTimeout(() => { uni.switchTab({ url: "/pages/index/index" }); }, 1500); } }).catch(() => { uni.hideLoading(); uni.showToast({ title: "网络错误", icon: "none" }); }); } } }; function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "login-bg" }, [ vue.createElementVNode("view", { class: "login-card" }, [ vue.createElementVNode("view", { class: "login-title" }, "欢迎登录"), vue.createElementVNode("view", { class: "login-subtitle" }, "河道防汛物资管理系统"), vue.createElementVNode("view", { class: "form-group" }, [ vue.createElementVNode("text", { class: "form-label" }, "用户名"), vue.withDirectives(vue.createElementVNode( "input", { class: "form-input", type: "text", "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.username = $event), placeholder: "请输入用户名" }, null, 512 /* NEED_PATCH */ ), [ [vue.vModelText, $data.username] ]) ]), vue.createElementVNode("view", { class: "form-group" }, [ vue.createElementVNode("text", { class: "form-label" }, "密码"), vue.withDirectives(vue.createElementVNode( "input", { class: "form-input", type: "password", "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.password = $event), placeholder: "请输入密码" }, null, 512 /* NEED_PATCH */ ), [ [vue.vModelText, $data.password] ]) ]), vue.createElementVNode("button", { class: "login-btn", onClick: _cache[2] || (_cache[2] = (...args) => $options.handleLogin && $options.handleLogin(...args)) }, "登 录") ]) ]); } const PagesLoginLogin = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__file", "/Users/mac/Documents/朗业/2025/h-苏州河道处/y-应急保障/stocktaking/pages/login/login.vue"]]); const _sfc_main$2 = { data() { return { result: "" }; }, methods: { doScan() { uni.scanCode({ success: (res) => { this.result = res.result; }, fail: () => { uni.showToast({ title: "扫码失败", icon: "none" }); } }); } } }; function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "scan-bg" }, [ vue.createElementVNode("view", { class: "scan-title" }, "扫码盘点"), vue.createElementVNode("button", { class: "scan-btn", onClick: _cache[0] || (_cache[0] = (...args) => $options.doScan && $options.doScan(...args)) }, "点击开始扫码"), $data.result ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "scan-result" }, [ vue.createElementVNode("text", { class: "result-label" }, "扫码结果:"), vue.createElementVNode( "text", { class: "result-value" }, vue.toDisplayString($data.result), 1 /* TEXT */ ) ])) : vue.createCommentVNode("v-if", true) ]); } const PagesScanScan = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__file", "/Users/mac/Documents/朗业/2025/h-苏州河道处/y-应急保障/stocktaking/pages/scan/scan.vue"]]); const _sfc_main$1 = { data() { return { isViewMode: false, stockQty: "", countQty: "", remark: "", photo: "", photos: [], material_info_id: "", // 物资信息 firstCategory: "-", secondCategory: "-", categoryName: "-", materialName: "-", materialCode: "-", materialType: "-", materialSpec: "-", materialSize: "-", unit: "-", // 库存信息 batchNumber: "-", sequenceNumber: "-", waitNum: "-", // 物资明细 productionDate: "-", storageDate: "-", materialStatus: "-", reserveMethod: "-", warehouseName: "-", shelfName: "-", shelfLayer: "-", levelCategory: "-", propertyInfo: "-", isFixedAsset: "-", fixedAssetCode: "-", reserveYears: "-", storageRequirement: "-", maintenanceRequirement: "-", maintenanceFrequency: "-", material_infos_plan_id: "", materialId: "" }; }, onLoad(options) { this.isViewMode = options.view === "1"; this.date = this.getToday(); this.materialId = options.code; formatAppLog("log", "at pages/inventory/inventory.vue:196", "materialId:", this.materialId); if (this.materialId) { getMaterialInfo(this.materialId).then((response) => { formatAppLog("log", "at pages/inventory/inventory.vue:199", "response:", response); if (response.data) { const data = response.data; this.material_info_id = data.wuzibianma_material_infos_wuzibianma_relation.id; const relation = data.wuzibianma_material_infos_wuzibianma_relation || {}; const fenleiDetail = relation.fenlei_detail || {}; const wuzizhuangtaiDetail = data.wuzizhuangtai_detail || {}; const chubeifangshiDetail = data.chubeifangshi_detail || {}; const dengjifenleiDetail = data.dengjifenlei_detail || {}; const chanquanxinxiDetail = data.chanquanxinxi_detail || {}; const materialstorages = data.materialstorages || {}; const shelfs = data.shelfs || {}; const equipmentMaintainConfig = data.equipment_maintain_config || {}; const materialInfoType = data.material_info_type || ""; if (materialInfoType) { const parts = materialInfoType.split("-"); this.firstCategory = parts[0] || "-"; this.secondCategory = parts.length > 1 ? parts[1] : parts[0] || "-"; } this.categoryName = fenleiDetail.name || "-"; this.materialName = data.zichanmingcheng || "-"; this.materialCode = data.wuzibianma || "-"; this.materialType = data.wuzileixing || "-"; this.materialSpec = relation.guigexinghao || data.guigexinghao || "-"; this.materialSize = relation.wuziguige || "-"; this.unit = relation.jiliangdanwei || data.jiliangdanwei || "-"; this.batchNumber = data.rukupici || "-"; this.stockQty = data.zaikushuliang || data.inventorys_total || "0"; this.sequenceNumber = data.shunxuhao || "-"; this.waitNum = data.wait_num || "-"; this.productionDate = data.shengchanriqi || "-"; this.storageDate = data.rukuriqi || "-"; this.materialStatus = wuzizhuangtaiDetail.value || "-"; this.reserveMethod = chubeifangshiDetail.value || "-"; this.warehouseName = materialstorages.cangkumingcheng || "-"; this.shelfName = shelfs.huojiamingcheng || "-"; this.shelfLayer = data.huojiaceng || "-"; this.levelCategory = dengjifenleiDetail.value || "-"; this.propertyInfo = chanquanxinxiDetail.value || "-"; this.isFixedAsset = data.shifouweigudingzichan || "-"; this.fixedAssetCode = data.gudingzichanbianma || "-"; this.reserveYears = data.chubeinianxian || "-"; this.storageRequirement = data.cunfangyaoqiu || "-"; this.maintenanceRequirement = data.weihuyaoqiu || "-"; this.maintenanceFrequency = equipmentMaintainConfig.name || "-"; this.material_infos_plan_id = data.material_infos_plan_id || ""; } else { uni.showToast({ title: "未获取到物资信息", icon: "none" }); } }).catch(() => { uni.showToast({ title: "获取物资信息失败", icon: "none" }); }); } }, methods: { getToday() { const now = /* @__PURE__ */ new Date(); const y = now.getFullYear(); const m = String(now.getMonth() + 1).padStart(2, "0"); const d = String(now.getDate()).padStart(2, "0"); return `${y}-${m}-${d}`; }, choosePhoto() { if (this.photos.length >= 3) { uni.showToast({ title: "最多上传3张照片", icon: "none" }); return; } uni.chooseImage({ count: 3 - this.photos.length, success: (res) => { this.photos = [...this.photos, ...res.tempFilePaths]; } }); }, deletePhoto(index) { this.photos.splice(index, 1); }, async submit() { if (!this.countQty) { uni.showToast({ title: "请输入盘点数量", icon: "none" }); return; } if (!/^(0|[1-9][0-9]*)$/.test(this.countQty)) { uni.showToast({ title: "盘点数量必须为0或正整数", icon: "none" }); return; } uni.showLoading({ title: "提交中..." }); let file_ids = []; for (let i = 0; i < this.photos.length; i++) { try { const res = await uploadFile(this.photos[i]); if (res && res.id) { file_ids.push(res.id); } } catch (e) { uni.hideLoading(); uni.showToast({ title: "图片上传失败", icon: "none" }); return; } } const data = { status: "1", material_info_id: this.material_info_id, // 或实际物资id字段 inventory_id: this.materialId, check_num: this.countQty, remark: this.remark, file_ids // 其他参数如 material_infos_plan_id、status、check_date 可按需补充 }; formatAppLog("log", "at pages/inventory/inventory.vue:370", "data:", data); saveInventoryCheck(data).then((res) => { formatAppLog("log", "at pages/inventory/inventory.vue:373", "res:", res); uni.hideLoading(); if (res && (!res.data || res.data.errcode === void 0)) { uni.showToast({ title: "盘点提交成功", icon: "success" }); setTimeout(() => { uni.reLaunch({ url: "/pages/index/index" }); }, 1200); } else { uni.showToast({ title: res.data.errmsg || "提交失败", icon: "none" }); } }).catch(() => { uni.hideLoading(); uni.showToast({ title: "提交失败", icon: "none" }); }); } } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("view", { class: "inventory-bg" }, [ vue.createElementVNode("view", { class: "inventory-card" }, [ vue.createElementVNode("view", { class: "readonly-group" }, [ vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "一级分类"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.firstCategory), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "二级分类"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.secondCategory), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "所属种类"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.categoryName), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "物资名称"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.materialName), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "物资类型"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.materialType), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "物资型号"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.materialSpec), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "物资规格"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.materialSize), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "单位"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.unit), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "入库批次"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.batchNumber), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "在库数量"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.stockQty) + vue.toDisplayString($data.unit ? " " + $data.unit : ""), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "顺序号"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.sequenceNumber), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "待出库"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.waitNum), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "生产日期"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.productionDate), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "入库日期"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.storageDate), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "物资状态"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.materialStatus), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "储备方式"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.reserveMethod), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "所在仓库"), vue.createElementVNode( "view", { class: "readonly-value" }, vue.toDisplayString($data.warehouseName), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "所在货架"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.shelfName), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "所在货架层"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.shelfLayer), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "等级分类"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.levelCategory), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "产权信息"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.propertyInfo), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "是否为固定资产"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.isFixedAsset), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "固定资产编码"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.fixedAssetCode), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "储备年限"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.reserveYears), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "存放要求"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.storageRequirement), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "维护要求"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.maintenanceRequirement), 1 /* TEXT */ ) ]), vue.createElementVNode("view", { class: "readonly-item" }, [ vue.createElementVNode("text", { class: "readonly-label" }, "保养频次"), vue.createElementVNode( "text", { class: "readonly-value" }, vue.toDisplayString($data.maintenanceFrequency), 1 /* TEXT */ ) ]) ]), !$data.isViewMode ? (vue.openBlock(), vue.createElementBlock("view", { key: 0, class: "form-group" }, [ vue.createElementVNode("text", { class: "form-label" }, "盘点数量"), vue.withDirectives(vue.createElementVNode( "input", { class: "form-input", type: "number", "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.countQty = $event), placeholder: "请输入盘点数量" }, null, 512 /* NEED_PATCH */ ), [ [vue.vModelText, $data.countQty] ]) ])) : vue.createCommentVNode("v-if", true), !$data.isViewMode ? (vue.openBlock(), vue.createElementBlock("view", { key: 1, class: "form-group" }, [ vue.createElementVNode("text", { class: "form-label" }, "盘点备注"), vue.withDirectives(vue.createElementVNode( "textarea", { class: "form-textarea", "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.remark = $event), placeholder: "请输入备注信息" }, null, 512 /* NEED_PATCH */ ), [ [vue.vModelText, $data.remark] ]) ])) : vue.createCommentVNode("v-if", true), !$data.isViewMode ? (vue.openBlock(), vue.createElementBlock("view", { key: 2, class: "form-group" }, [ vue.createElementVNode("text", { class: "form-label" }, "照片上传"), vue.createElementVNode("view", { class: "photo-upload" }, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList($data.photos, (photo, index) => { return vue.openBlock(), vue.createElementBlock("view", { key: index, class: "photo-preview" }, [ vue.createElementVNode("image", { src: photo, mode: "aspectFill", class: "photo-img" }, null, 8, ["src"]), vue.createElementVNode("view", { class: "photo-del", onClick: ($event) => $options.deletePhoto(index) }, [ vue.createElementVNode("text", { class: "delete-icon" }, "×") ], 8, ["onClick"]) ]); }), 128 /* KEYED_FRAGMENT */ )), $data.photos.length < 3 ? (vue.openBlock(), vue.createElementBlock("button", { key: 0, class: "photo-btn", onClick: _cache[2] || (_cache[2] = (...args) => $options.choosePhoto && $options.choosePhoto(...args)) }, [ vue.createElementVNode("text", { class: "iconfont icon-camera" }), vue.createElementVNode("text", { class: "btn-text" }, "上传照片") ])) : vue.createCommentVNode("v-if", true) ]) ])) : vue.createCommentVNode("v-if", true), !$data.isViewMode ? (vue.openBlock(), vue.createElementBlock("button", { key: 3, class: "submit-btn", onClick: _cache[3] || (_cache[3] = (...args) => $options.submit && $options.submit(...args)) }, "提交盘点")) : vue.createCommentVNode("v-if", true) ]) ]); } const PagesInventoryInventory = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "/Users/mac/Documents/朗业/2025/h-苏州河道处/y-应急保障/stocktaking/pages/inventory/inventory.vue"]]); __definePage("pages/index/index", PagesIndexIndex); __definePage("pages/profile/profile", PagesProfileProfile); __definePage("pages/login/login", PagesLoginLogin); __definePage("pages/scan/scan", PagesScanScan); __definePage("pages/inventory/inventory", PagesInventoryInventory); let main = plus.android.runtimeMainActivity(); if (uni.getSystemInfoSync().platform == "android") { plus.runtime.quit = function() { setTimeout(() => { main.finish(); }, 10); }; } var hhwUHFController; const _sfc_main = { globalData: { hhwUHFController: requireNativePlugin("HL-HHWUHFController"), globalEvent: requireNativePlugin("globalEvent") }, onLaunch: function() { formatAppLog("log", "at App.vue:18", "App Launch"); hhwUHFController = getApp().globalData.hhwUHFController; const token = uni.getStorageSync("token"); if (!token) { uni.reLaunch({ url: "/pages/login/login" }); formatAppLog("log", "at App.vue:25", "App Launch token1234", token); } else { uni.reLaunch({ url: "/pages/index/index" }); } }, onShow: function() { formatAppLog("log", "at App.vue:31", "App Show"); hhwUHFController.setDebuggable(true, (result) => { formatAppLog("log", "at App.vue:34", "App Show", "setDebuggable: " + result); }); var enterTime = Date.now(); var outTime = enterTime; hhwUHFController.initUhf((result) => { outTime = Date.now(); formatAppLog("log", "at App.vue:41", "App Show", "initUHF: " + result, "cusTime: " + (outTime - enterTime)); uni.showToast({ title: "初始化成功", icon: "none", duration: 1e3 }); }); }, onHide: function() { formatAppLog("log", "at App.vue:50", "App Hide"); hhwUHFController.closeUhf((result) => { formatAppLog("log", "at App.vue:53", "App Hide", "closeUhf: " + result); uni.showToast({ title: "关闭成功", icon: "none", duration: 1e3 }); }); } }; const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/mac/Documents/朗业/2025/h-苏州河道处/y-应急保障/stocktaking/App.vue"]]); function createApp() { const app = vue.createVueApp(App); app.config.globalProperties.$config = config; return { app }; } const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp(); uni.Vuex = __Vuex__; uni.Pinia = __Pinia__; __app__.provide("__globalStyles", __uniConfig.styles); __app__._component.mpType = "app"; __app__._component.render = () => { }; __app__.mount("#app"); })(Vue);