deviceEvents.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
  5. const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  6. const _easycom_u_loadmore2 = common_vendor.resolveComponent("u-loadmore");
  7. const _easycom_u_empty2 = common_vendor.resolveComponent("u-empty");
  8. const _easycom_u__input2 = common_vendor.resolveComponent("u--input");
  9. const _easycom_u_button2 = common_vendor.resolveComponent("u-button");
  10. const _easycom_ba_tree_picker2 = common_vendor.resolveComponent("ba-tree-picker");
  11. const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
  12. (_easycom_u_navbar2 + _easycom_u_icon2 + _easycom_u_loadmore2 + _easycom_u_empty2 + _easycom_u__input2 + _easycom_u_button2 + _easycom_ba_tree_picker2 + _easycom_u_popup2)();
  13. }
  14. const _easycom_u_navbar = () => "../../../node-modules/uview-plus/components/u-navbar/u-navbar.js";
  15. const _easycom_u_icon = () => "../../../node-modules/uview-plus/components/u-icon/u-icon.js";
  16. const _easycom_u_loadmore = () => "../../../node-modules/uview-plus/components/u-loadmore/u-loadmore.js";
  17. const _easycom_u_empty = () => "../../../node-modules/uview-plus/components/u-empty/u-empty.js";
  18. const _easycom_u__input = () => "../../../node-modules/uview-plus/components/u--input/u--input.js";
  19. const _easycom_u_button = () => "../../../node-modules/uview-plus/components/u-button/u-button.js";
  20. const _easycom_ba_tree_picker = () => "../../../components/ba-tree-picker/ba-tree-picker.js";
  21. const _easycom_u_popup = () => "../../../node-modules/uview-plus/components/u-popup/u-popup.js";
  22. if (!Math) {
  23. (_easycom_u_navbar + _easycom_u_icon + _easycom_u_loadmore + _easycom_u_empty + _easycom_u__input + _easycom_u_button + _easycom_ba_tree_picker + _easycom_u_popup)();
  24. }
  25. const _sfc_main = {
  26. __name: "deviceEvents",
  27. setup(__props) {
  28. const { proxy } = common_vendor.getCurrentInstance();
  29. const instance = common_vendor.getCurrentInstance();
  30. const {
  31. device_type,
  32. device_online_status,
  33. device_busy_status,
  34. device_active_status
  35. } = proxy.$useDict("device_type", "device_online_status", "device_busy_status", "device_active_status");
  36. const dicts = common_vendor.reactive({
  37. device_type: [],
  38. online_status: [],
  39. busy_status: [],
  40. active_status: []
  41. });
  42. const searchMenu = common_vendor.reactive({
  43. showPopMenu: false,
  44. selStatus: 0,
  45. style: {
  46. marginTop: "174rpx"
  47. },
  48. searchMenu_body_style: {
  49. height: "600rpx"
  50. },
  51. params: {
  52. mercName: void 0,
  53. deviceId: void 0,
  54. deviceType: void 0,
  55. busyState: void 0,
  56. activeState: void 0,
  57. no: void 0
  58. }
  59. });
  60. function openSearchMenu() {
  61. searchMenu.showPopMenu = true;
  62. getTreeData();
  63. }
  64. function resetSearchMenu() {
  65. searchMenu.params.deviceId = void 0;
  66. searchMenu.params.deviceType = void 0;
  67. searchMenu.params.mercName = void 0;
  68. searchMenu.params.no = void 0;
  69. }
  70. function selectCode() {
  71. proxy.$refs.treePicker._show();
  72. }
  73. function doSearch(o) {
  74. if (o == 0)
  75. resetSearchMenu();
  76. setTimeout(function() {
  77. searchMenu.showPopMenu = false;
  78. data.curPage = 1;
  79. getList();
  80. }, 500);
  81. }
  82. common_vendor.ref("");
  83. const data = common_vendor.reactive({
  84. reqUrls: {
  85. list: "/device/device-event-msg/page",
  86. tree: "/sys/sys-code-configure/tree"
  87. },
  88. curPage: 1,
  89. loadmoreStatus: "nomore",
  90. params: {
  91. page: {
  92. current: 1,
  93. size: 10,
  94. orders: [
  95. {
  96. asc: false,
  97. column: "create_time"
  98. }
  99. ]
  100. }
  101. },
  102. fullHeight: 0,
  103. screenHeight: 1920,
  104. // screenWidht:1080,
  105. dataList: [],
  106. total: 0,
  107. treeData1: [
  108. {
  109. id: 1,
  110. name: "公司1",
  111. children: [{
  112. id: 11,
  113. name: "研发部",
  114. children: [{
  115. id: 111,
  116. name: "张三"
  117. }, {
  118. id: 112,
  119. name: "李四"
  120. }]
  121. }, {
  122. id: 12,
  123. name: "综合部"
  124. }]
  125. },
  126. {
  127. id: 2,
  128. name: "公司2",
  129. children: [{
  130. id: 21,
  131. name: "研发部"
  132. }, {
  133. id: 22,
  134. name: "综合部"
  135. }, {
  136. id: 23,
  137. name: "财务部"
  138. }]
  139. },
  140. {
  141. id: 3,
  142. name: "公司3"
  143. },
  144. {
  145. id: 4,
  146. name: "公司4",
  147. children: [{
  148. id: 41,
  149. name: "研发部"
  150. }]
  151. }
  152. ]
  153. });
  154. common_vendor.onMounted(() => {
  155. dicts.device_type = [{ value: null, label: "全部" }].concat(device_type.value);
  156. dicts.online_status = [{ value: null, label: "全部" }].concat(device_online_status.value);
  157. data.screenHeight = common_vendor.index.getSystemInfoSync().windowHeight;
  158. searchMenu.searchMenu_body_style.height = data.screenHeight - 90 + "px";
  159. getList();
  160. const query = common_vendor.index.createSelectorQuery().in(instance);
  161. query.select(".scrollview").boundingClientRect((r) => {
  162. common_vendor.index.getSystemInfo({
  163. success(res) {
  164. const model = res.model;
  165. const modelInclude = [
  166. "iPhone X",
  167. "iPhone XR",
  168. "iPhone XS",
  169. "iPhone XS MAX",
  170. "iPhone 12/13 mini",
  171. "iPhone 12/13 (Pro)",
  172. "iPhone 12/13 Pro Max",
  173. "iPhone 14 Pro Max"
  174. ];
  175. let safeDistance = modelInclude.includes(model);
  176. console.log(res.windowHeight, r.top);
  177. let h = 0;
  178. if (safeDistance) {
  179. h = res.windowHeight - r.top;
  180. } else {
  181. h = res.windowHeight - r.top;
  182. }
  183. data.fullHeight += h + "px";
  184. }
  185. });
  186. }).exec();
  187. });
  188. function scrolltolower() {
  189. if (data.loadmoreStatus == "nomore")
  190. return;
  191. data.curPage++;
  192. getList();
  193. }
  194. function getList() {
  195. return new Promise((resolve, reject) => {
  196. data.params.page.current = data.curPage;
  197. data.params.deviceId = searchMenu.params.deviceId;
  198. data.params.code = searchMenu.params.code;
  199. if (data.curPage == 1) {
  200. data.dataList = [];
  201. }
  202. proxy.$request({
  203. url: data.reqUrls.list,
  204. data: data.params,
  205. method: "post"
  206. }).then((res) => {
  207. console.log("***", res);
  208. if (res.records) {
  209. data.dataList = data.dataList.concat(res.records);
  210. }
  211. data.total = res.total;
  212. if (res.records.length < 10) {
  213. data.loadmoreStatus = "nomore";
  214. } else {
  215. data.loadmoreStatus = "loadmore";
  216. }
  217. resolve(res);
  218. }).catch((err) => {
  219. reject(err);
  220. });
  221. });
  222. }
  223. function getTreeData() {
  224. return new Promise((resolve, reject) => {
  225. proxy.$request({
  226. url: data.reqUrls.tree,
  227. data: { code: [] },
  228. method: "post"
  229. }).then((res) => {
  230. data.treeData = res;
  231. console.log("---***", data.treeData, data.treeData[0], data.treeData[1]);
  232. resolve(res);
  233. }).catch((err) => {
  234. reject(err);
  235. });
  236. });
  237. }
  238. function treeNodeSelectChange(ids, names) {
  239. searchMenu.params.code = ids[0];
  240. }
  241. function gotoDeviceDetail(o) {
  242. }
  243. function rightClick() {
  244. console.log("点击了右侧");
  245. }
  246. return (_ctx, _cache) => {
  247. return common_vendor.e({
  248. a: common_vendor.o(rightClick),
  249. b: common_vendor.p({
  250. title: "设备事件",
  251. titleStyle: "color:#fff;fontSize:36rpx;",
  252. bgColor: "#2C6FF3",
  253. autoBack: true,
  254. leftIconColor: "#fff",
  255. placeholder: true
  256. }),
  257. c: common_vendor.t(data.total),
  258. d: common_vendor.p({
  259. name: "arrow-right",
  260. size: "14"
  261. }),
  262. e: common_vendor.o(openSearchMenu),
  263. f: data.dataList.length > 0
  264. }, data.dataList.length > 0 ? common_vendor.e({
  265. g: common_vendor.f(data.dataList, (item1, index1, i0) => {
  266. return common_vendor.e({
  267. a: item1.deviceName
  268. }, item1.deviceName ? {
  269. b: common_vendor.t(item1.deviceName),
  270. c: common_vendor.t(item1.deviceId)
  271. } : {
  272. d: common_vendor.t(item1.deviceId)
  273. }, {
  274. e: common_vendor.t(item1.mercName),
  275. f: common_vendor.t(item1.code),
  276. g: common_vendor.t(item1.msg),
  277. h: common_vendor.t(item1.createTime),
  278. i: common_vendor.o(($event) => gotoDeviceDetail(item1.deviceId), item1.deviceId),
  279. j: item1.deviceId
  280. });
  281. }),
  282. h: data.dataList.length > 0
  283. }, data.dataList.length > 0 ? {
  284. i: common_vendor.p({
  285. status: data.loadmoreStatus
  286. })
  287. } : {}) : {
  288. j: common_vendor.p({
  289. mode: "data",
  290. text: "数据为空"
  291. })
  292. }, {
  293. k: common_vendor.o(scrolltolower),
  294. l: data.fullHeight,
  295. m: common_vendor.o(($event) => searchMenu.params.deviceId = $event),
  296. n: common_vendor.p({
  297. placeholder: "请输入机器名称,编号",
  298. border: "surround",
  299. modelValue: searchMenu.params.deviceId
  300. }),
  301. o: common_vendor.o(($event) => searchMenu.params.code = $event),
  302. p: common_vendor.p({
  303. placeholder: "事件代码",
  304. border: "surround",
  305. modelValue: searchMenu.params.code
  306. }),
  307. q: common_vendor.o(($event) => selectCode()),
  308. r: common_vendor.p({
  309. size: "normal",
  310. plain: true,
  311. text: "选择"
  312. }),
  313. s: common_vendor.o(($event) => doSearch(0)),
  314. t: common_vendor.p({
  315. size: "normal",
  316. plain: true,
  317. text: "关闭"
  318. }),
  319. v: common_vendor.o(resetSearchMenu),
  320. w: common_vendor.p({
  321. size: "normal",
  322. type: "primary",
  323. plain: true,
  324. text: "重置"
  325. }),
  326. x: common_vendor.o(($event) => doSearch(1)),
  327. y: common_vendor.p({
  328. size: "normal",
  329. type: "primary",
  330. text: "查找"
  331. }),
  332. z: common_vendor.sr("treePicker", "35ae1ae5-11,35ae1ae5-4"),
  333. A: common_vendor.o(treeNodeSelectChange),
  334. B: common_vendor.p({
  335. zindex: "999",
  336. multiple: false,
  337. title: "选择事件",
  338. titleColor: "#ff0000",
  339. localdata: data.treeData,
  340. valueKey: "code",
  341. textKey: "title",
  342. childrenKey: "sonVos"
  343. }),
  344. C: common_vendor.s(searchMenu.searchMenu_body_style),
  345. D: common_vendor.p({
  346. show: searchMenu.showPopMenu,
  347. duration: "0",
  348. customStyle: searchMenu.style,
  349. round: 10,
  350. mode: "right",
  351. duration: 300,
  352. overlay: false
  353. })
  354. });
  355. };
  356. }
  357. };
  358. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-35ae1ae5"], ["__file", "F:/兴元/开门柜项目/平台端管理系统小程序/src/pages/xy_system/devices/deviceEvents.vue"]]);
  359. wx.createPage(MiniProgramPage);