index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. <template>
  2. <!-- 设备列表 -->
  3. <div class="devicePage flex-col">
  4. <div class="listBox">
  5. <s-header :name="sys ? sys.title : $t('device.managementCenter')" :noback="true" :isFixed="false"></s-header>
  6. <van-list v-model:loading="loading" v-model:error="error" :error-text="$t('public.requestFailed')"
  7. :finished="finished" :finished-text="$t('public.noMore')" offset="100" :immediate-check="false" @load="onLoad">
  8. <div class="deviceBox1 flex-col">
  9. <div class="searchRow flex-row justify-between">
  10. <div class="flex-col">
  11. <div class="flex-row justify-between bd3">
  12. <div class="flex-col outer4"></div>
  13. <span class="flex-col txt2">
  14. {{ $t("device.dataOverview") }}</span>
  15. </div>
  16. </div>
  17. <div class="flex-col">
  18. <div class="main5 flex-row justify-between">
  19. <van-popover v-model:show="showPopover" placement="left-start" theme="dark" :actions="actions"
  20. @select="selectLabel">
  21. <template #reference>
  22. <van-icon name="bars" class="fixed-icon o-pr-15" size="23" color="#2e87c8" />
  23. </template>
  24. </van-popover>
  25. <img class="label2" src="../../assets/device/searchIcon.png" @click="searchClick" />
  26. <!-- <div class="TextGroup2 flex-col">
  27. <span class="txt3">{{ $t("device.search") }}</span>
  28. </div> -->
  29. </div>
  30. </div>
  31. </div>
  32. <img class="pic1" src="../../assets/device/line.png" />
  33. <div class="o-plr-15 o-ptb-20">
  34. <div class="bd1 flex-col">
  35. <div class="box2 l-f l-flex-c l-flex-j-a">
  36. <div @click="eqeStatusClk(1)" class="TextGroup3 flex-col">
  37. <div class="group1 flex-col justify-between align-center">
  38. <span class="word4">{{ equipStatus.machineUseNum }}</span>
  39. <span class="info1">{{
  40. $t("device.totalNumberOfRuns")
  41. }}</span>
  42. </div>
  43. </div>
  44. <div @click="eqeStatusClk('')" class="TextGroup4 flex-col">
  45. <div class="main6 flex-col justify-between align-center">
  46. <span class="word5">{{ equipStatus.machineTotalNum }}</span>
  47. <span class="word6">{{
  48. $t("device.totalNumberOfEquipment")
  49. }}</span>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="deviceBox2 flex-col justify-between">
  57. <van-tabs v-model:active="active" @click-tab="clickLabel" class="tabs2 o-pb-15" color="#2e87c8">
  58. <van-tab :title="$t('device.whole')" name="">
  59. </van-tab>
  60. <van-tab v-for="item in labelList" :name="item.id" :key="item" :title="item.name">
  61. </van-tab>
  62. </van-tabs>
  63. <div class="section1 flex-col">
  64. <div class="outer1 flex-col o-plr-15">
  65. <div v-for="item in list" :key="item" class="o-pb-20">
  66. <div class="bd1 l-flex-between">
  67. <div class="l-flex-RC">
  68. <div class="layer1 flex-col"></div>
  69. <div class="txtBox">
  70. <span class="txt1">{{ item.name == null ? item.clientId.slice(-6) : item.name }}</span>
  71. </div>
  72. </div>
  73. <div class="l-flex-RC">
  74. <div v-if="item.hasTodayAlarm" class="l-flex-between o-pl-5">
  75. <div class="box4 flex-col "></div>
  76. <span class="o-pl-2" style="color: #fe5d55">{{ $t("device.alarmClock") }}</span>
  77. </div>
  78. <div class="layer2 flex-col" :class="{
  79. deviceOn: item.eqeStatus === 1,
  80. layerLeft: item.hasTodayAlarm,
  81. }"></div>
  82. </div>
  83. </div>
  84. <span class="txt1 o-mt-10">{{ $t("device.affiliatedMerchants") }}:{{
  85. item.adminUserName
  86. }}</span>
  87. <span class="txt1 o-mt-10 kBordBott">{{ $t("device.machineUniqueCode") }}:{{
  88. item.clientId
  89. }}</span>
  90. <div class="contentBottomCon" v-if="item.checkType">
  91. <img class="pic1" referrerpolicy="no-referrer" src="../../assets/home/line.png" />
  92. <!-- 睡眠状态 -->
  93. <div class="word4 flex-row justify-between o-ptb-4 kBordBott">
  94. <span class="info1 o-ptb-5 kBordBott">{{ $t("device.sleepState") }}:{{
  95. item.isSleep
  96. ? $t("device.sleeping")
  97. : $t("device.notSleeping")
  98. }}</span>
  99. </div>
  100. <div v-if="item.isSleep" class="layer3 o-ptb-7">
  101. <span class="word1">
  102. <div v-if="!sleepDescBoxShow">
  103. <van-field colon center class="word2" v-model="item.sleepDesc"
  104. :placeholder="$t('device.sleepDescPlace')" :label="$t('device.sleepDesc')" label-width="auto">
  105. <template #button class="button_1">
  106. <van-button size="small" type="primary" @click="sleepDescChg(item.sleepDesc, item.id)">{{
  107. $t("device.confirm") }}
  108. </van-button>
  109. <van-button size="small" type="primary" @click="editSleepDesc()">{{ $t("device.cancel")
  110. }}</van-button>
  111. </template>
  112. </van-field>
  113. <!-- </span> -->
  114. </div>
  115. <div v-else>
  116. <span class="word3 o-pr-10">{{ $t("device.sleepDesc") }}:</span>
  117. <span class="word3">{{ item.sleepDesc == null ? $t("device.SuspendBusiness") :
  118. item.sleepDesc }}</span>
  119. <van-icon name="edit" size="18" class="editIcon" @click="editSleepDesc()" />
  120. </div>
  121. </span>
  122. </div>
  123. <!-- <span class="txt5 o-ptb-10 kBordBott l-flex-RC"><span>一键重启炉头:</span>
  124. <van-button type="primary">重启</van-button>
  125. </span> -->
  126. <!-- 炉头状态 -->
  127. <div class="word4 o-ptb-8">
  128. <span class="word3 o-pr-5" v-if="item.machineType == '0' || item.machineType == null">{{
  129. $t("device.furnHeadStatus") }}: </span>
  130. <span class="word3 o-pr-5" v-else>{{ $t("device.deviceStatus") }}: </span>
  131. <span>{{ item.eqeStatus === 1 ? $t("device.opened") : $t("device.closed") }}
  132. </span>
  133. <!-- <div class="l-flex-RC">
  134. <van-button type="primary">开启</van-button>
  135. <van-button type="primary">关闭</van-button>
  136. </div> -->
  137. </div>
  138. <!-- <span class="txt5 o-ptb-10 kBordBott l-flex-RC"><span>远程开门:</span>
  139. <van-button type="primary">开门</van-button>
  140. </span> -->
  141. <!-- 设备地址 -->
  142. <!-- <span class="txt1 o-ptb-7">{{ item.fullName }}</span> -->
  143. <!-- 定位: -->
  144. <!-- <div>
  145. <span v-if="item.latitude" class="txt5 o-ptb-7 kBordBott l-flex-RC">
  146. <span class="info1">{{
  147. $t("device.position") }}:</span>
  148. <van-button @click="viewPosiClk(item)" type="primary">{{
  149. $t("device.view")
  150. }}</van-button>
  151. </span>
  152. </div> -->
  153. <!-- 定位: -->
  154. <div>
  155. <span v-if="item.latitude" class="txt5 o-ptb-3 kBordBott l-flex-RC">
  156. <span class="info1">{{ $t("device.position") }}:</span>
  157. <a class="clickable-link o-ptb-7" @click="viewPosiClk(item)">{{ item.fullName }}</a>
  158. </span>
  159. </div>
  160. <!-- 机器参数 -->
  161. <van-row class="layer5 o-pt-7 kBordBott" justify="space-between"
  162. v-if="(item.machineType == '0' || item.machineType == null) && item.equimentType != 'P30'">
  163. <van-col class="word5" style="margin-bottom: 12px;">{{ $t("device.furnaceHeadTemperature") }}:{{
  164. item.furnaceTm
  165. }}{{ $t("device.degree") }}</van-col>
  166. <van-col class="word5" style="margin-bottom: 12px;">{{ $t("device.temperatureInCabinet") }}:{{
  167. item.cabinetTm
  168. }}{{ $t("device.degree") }}</van-col>
  169. <van-col class="word5" style="margin-bottom: 12px;">{{ $t("device.humidityInCabinet") }}:{{
  170. item.cabinetHd
  171. }}{{ $t("device.humidity") }}</van-col>
  172. </van-row>
  173. <van-row class="layer5 o-pt-7 kBordBott" justify="space-between" v-if="item.machineType == '1'">
  174. <van-col class="word5" style="margin-bottom: 12px;">{{ $t("device.stirringTemperature") }}:{{
  175. item.stirTm
  176. }}{{ $t("device.degree") }}</van-col>
  177. <van-col class="word5" style="margin-bottom: 12px;">{{ $t("device.cornGeneratorTemperature") }}:{{
  178. item.cornGeneratorTm
  179. }}{{ $t("device.degree") }}</van-col>
  180. <van-col class="word5" style="margin-bottom: 12px;">{{ $t("device.cupQuantity") }}:{{ item.cupQuantity
  181. }}</van-col>
  182. </van-row>
  183. <template v-if="item.isMaterialUse === '1' && (item.machineType == '0' || item.machineType == null)">
  184. <van-row justify="space-between" class="sugarTxt o-pt-7 kBordBott">
  185. <van-col style="margin-bottom: 12px;">
  186. {{ $t("device.whiteSugar") }}:{{ Format_calcuDecial(item.whiteSugar) }}%
  187. </van-col>
  188. <van-col>
  189. {{ $t("device.redSugar") }}:{{ Format_calcuDecial(item.redSugar) }}%
  190. </van-col>
  191. <van-col>
  192. {{ $t("device.yellowSugar") }}:{{ Format_calcuDecial(item.yellowSugar) }}%
  193. </van-col>
  194. <van-col style="margin-bottom: 8px;">
  195. {{ $t("device.blueSugar") }}:{{ Format_calcuDecial(item.blueSugar) }}%
  196. </van-col>
  197. </van-row>
  198. <div class="info1 o-ptb-5 kBordBott">
  199. <span>{{ $t("device.stick") }}:{{
  200. Format_calcuDecial(item.stick)
  201. }}%</span>
  202. </div>
  203. <van-row gutter="50" class="sugarTxt o-ptb-7 kBordBott">
  204. <van-col>
  205. {{ $t("device.water") }}:{{ Format_calcuDecial(item.water) }}%
  206. </van-col>
  207. <van-col>
  208. {{ $t("device.wasteWater") }}:{{ Format_calcuDecial(item.wasteWater) }}%
  209. </van-col>
  210. </van-row>
  211. <!-- 一键补料 -->
  212. <span class="info1 o-ptb-5 kBordBott l-flex-RC"><span>{{ $t("device.oneKeyFeed") }}:</span>
  213. <!-- <van-button @click="replenishmentClk(item)" type="primary">{{ $t("device.replenishment") }}
  214. </van-button> -->
  215. <a class="replenishment o-ptb-7" @click="replenishmentClk(item)">{{ $t("device.replenishment")
  216. }}</a>
  217. </span>
  218. </template>
  219. <!-- 最近刷新时间 -->
  220. <span class="info1 o-ptb-7 kBordBott">{{ $t("device.lastRefreshTime") }}:{{
  221. showDateTime(item.lastUpdateTime)
  222. }}</span>
  223. <!-- 音量 -->
  224. <span v-if="item.machineType != '2'" class="info2 o-ptb-7 kBordBott">{{ $t("device.volume") }}:{{
  225. item.volume }}</span>
  226. <!-- 报警内容 -->
  227. <div class="l-flex-RC o-ptb-7">
  228. <span class="info3 kBordBott">{{ $t("device.alarmContent") }}:</span>
  229. <div class="info4 l-flex-RC">
  230. <span class="info5 o-pr-10 kBordBott">{{
  231. item.alarmList && item.alarmList[0]
  232. ? item.alarmList[0].alarmContent
  233. : $t("device.alarmContentNoData")
  234. }}
  235. </span>
  236. <van-button v-if="item.alarmList && item.alarmList[0]" type="primary" size="small" color="#07c160"
  237. :text="$t('device.eliminateAlarm')" @click="clearAlarm(item.alarmList[0])"></van-button>
  238. </div>
  239. </div>
  240. <div class="editDeviceBtnCon l-flex-center o-mt-10">
  241. <div class="l-flex-RC" @click="deviceSet(item)">
  242. <span class="c-text-14">{{
  243. $t("device.editDevice")
  244. }}</span>
  245. <div class="box2 flex-col"></div>
  246. </div>
  247. <div class="l-flex-RC o-ml-30" @click="deviceOprShow(item)">
  248. <span class="c-text-14">{{
  249. $t("device.commonOperations")
  250. }}</span>
  251. <div class="box2 flex-col"></div>
  252. </div>
  253. </div>
  254. </div>
  255. <div class="bd6 l-flex-center o-ptb-7" @click="item.checkType = !item.checkType">
  256. <div class="l-flex-RC">
  257. <span class="info2 o-mr-2">{{
  258. item.checkType ? $t("device.stow") : $t("device.seeMore")
  259. }}</span>
  260. <div class="group2 flex-col" :class="{ checkType: item.checkType }"></div>
  261. </div>
  262. </div>
  263. </div>
  264. <van-back-top style="background-color: #2d87c8;" @click="backTop" right="5vw" bottom="10vh" />
  265. </div>
  266. </div>
  267. </div>
  268. </van-list>
  269. </div>
  270. <deviceOper ref="oprRef" @operfinish="operFinish"></deviceOper>
  271. <!-- 搜索弹出框 -->
  272. <deviceSearch ref="searchRef" @search="search($event)"></deviceSearch>
  273. <div style="height: 50px;"></div>
  274. </div>
  275. </template>
  276. <script>
  277. import {
  278. Api_postMachineNum,
  279. } from "../../service/home";
  280. import { onMounted, reactive, toRefs, ref, onActivated } from "vue";
  281. import { showFailToast, showSuccessToast, showToast, showDialog } from "vant";
  282. import sHeader from "../../components/SimpleHeader";
  283. import { getLoginUser, Format_calcuDecial, styleUrl } from "../../common/js/utils";
  284. import {
  285. getDeviceList,
  286. eliminate,
  287. Api_getReplenishment,
  288. changeSleepDesc,
  289. } from "../../service/device/index";
  290. import deviceSearch from "./deviceSearch";
  291. import deviceOper from "./deviceOper";
  292. import { onBeforeRouteLeave, useRouter } from "vue-router";
  293. import dateUtil from "../../utils/dateUtil";
  294. import { useI18n } from "vue-i18n";
  295. import { onBeforeUnmount } from "vue";
  296. import { Api_getLabelList } from "../../service/labelMan";
  297. export default {
  298. name: "device",
  299. components: { sHeader, deviceSearch, deviceOper },
  300. setup() {
  301. const { t } = useI18n();
  302. const searchRef = ref(null);
  303. const oprRef = ref(null);
  304. const list = ref([]);
  305. const loading = ref(true);
  306. const error = ref(false);
  307. const finished = ref(false);
  308. const router = useRouter();
  309. const sys = ref(null);
  310. const user = getLoginUser();
  311. const verticalScrollPosition = ref(0);
  312. const labelList = ref([]);
  313. // 返回顶部
  314. const backTop = () => {
  315. window.scrollY = 0;
  316. }
  317. onActivated(() => {
  318. // 当组件被激活时,可能是从 keep-alive 缓存中激活的
  319. // 这时重新添加滚动事件监听器
  320. console.log("进入时的位置", verticalScrollPosition.value);
  321. document.documentElement.scrollTop = verticalScrollPosition.value;
  322. document.body.scrollTop = verticalScrollPosition.value;
  323. window.scrollY = verticalScrollPosition.value;
  324. // window.addEventListener('scroll', handleScroll);
  325. });
  326. onBeforeRouteLeave(() => {
  327. verticalScrollPosition.value = document.documentElement.scrollTop || document.body.scrollTop || window.scrollY;
  328. console.log("离开时的位置", verticalScrollPosition.value);
  329. })
  330. // 在组件卸载前清除定时器
  331. onBeforeUnmount(() => {
  332. clearInterval(updateDataInterval);
  333. });
  334. const updateDataInterval = () => {
  335. // 每隔5分钟更新数据
  336. setInterval(() => {
  337. init();
  338. if (oprRef.value) {
  339. oprRef.value.closeOper();
  340. }
  341. // verticalScrollPosition.value = 0;
  342. }, 5 * 60 * 1000); // 5分钟的毫秒数
  343. };
  344. //控制睡眠描述的显示隐藏
  345. const sleepDescBoxShow = ref(true);
  346. // 页面列表查询参数
  347. let searchParams = reactive({
  348. id: "", // 用户账户id
  349. // adminName: '', // 用户登录名
  350. current: 1, // 页数
  351. size: 10, // 页大小
  352. todayDate: dateUtil.formateDate(new Date(), "yyyy-MM-dd"), // 当天时间
  353. labelId: "", // 分组标签
  354. });
  355. // 初始化页面获取列表
  356. onMounted(() => {
  357. sleepDescBoxShow.value = true;
  358. init();
  359. updateDataInterval();
  360. // window.addEventListener('scroll', handleScroll);
  361. // 加载样式
  362. styleUrl('device');
  363. });
  364. // 初始化
  365. const init = () => {
  366. // 获取设备情况
  367. getMachineNum();
  368. getLabelList();
  369. if (localStorage.getItem("loginSys")) {
  370. const loginSysString = localStorage.getItem("loginSys");
  371. sys.value = JSON.parse(loginSysString);
  372. }
  373. list.value = [];
  374. searchParams.current = 1;
  375. if (user) {
  376. searchParams.id = user.id;
  377. // if (user.isAdmined) {
  378. // searchParams.adminName = user.username;
  379. // }
  380. getList();
  381. }
  382. };
  383. // 获取设备标签
  384. const getLabelList = async () => {
  385. // console.log("adminId>>>>", user.id);
  386. Api_getLabelList({
  387. adminId: user.id,
  388. type: "1"
  389. }).then((res) => {
  390. const { data } = res.data;
  391. labelList.value = data;
  392. })
  393. }
  394. // 获取设备列表数据
  395. const getList = async () => {
  396. finished.value = false;
  397. const { data } = await getDeviceList(Object.assign({}, searchParams));
  398. if (data.code === "00000") {
  399. if (searchParams.current === 0) {
  400. list.value = [];
  401. }
  402. // 列表值叠加
  403. list.value = list.value.concat(
  404. data.data.records.map((item) => {
  405. if (item.sleepDesc == null) {
  406. item.sleepDesc = t("device.SuspendBusiness");
  407. }
  408. return {
  409. ...item,
  410. checkType: false,
  411. };
  412. })
  413. );
  414. if (list.value.length === data.data.total) {
  415. finished.value = true;
  416. }
  417. loading.value = false;
  418. } else {
  419. showFailToast(data.message);
  420. }
  421. };
  422. // 滚动加载
  423. const onLoad = () => {
  424. if (!finished.value) {
  425. // console.log("滚动加载")
  426. searchParams.current = searchParams.current + 1;
  427. getList();
  428. }
  429. };
  430. // 搜索点击
  431. const searchClick = () => {
  432. searchRef.value.showSearch();
  433. };
  434. // 搜索条件触发查询
  435. const search = (e) => {
  436. list.value = [];
  437. loading.value = true;
  438. searchParams.current = 1;
  439. searchParams = Object.assign(searchParams, e);
  440. getList();
  441. getMachineNum();
  442. };
  443. // 跳转设备编辑
  444. const deviceSet = (e) => {
  445. router.push({ path: "deviceSet", query: { deviceId: e.id } });
  446. };
  447. // 常用操作弹窗展示触发
  448. const deviceOprShow = (e) => {
  449. oprRef.value.showOper(e);
  450. };
  451. // 消除报警
  452. const clearAlarm = async (e) => {
  453. const params = {
  454. id: e.id,
  455. name: e.name,
  456. selfName: e.selfName,
  457. areaId: e.areaId,
  458. channel: e.channel,
  459. contactName: e.contactName,
  460. contactPhone: e.contactPhone,
  461. flowers: e.flowers,
  462. operationalName: e.operationalName,
  463. operationalPhone: e.operationalPhone,
  464. timeRuleId: e.timeRuleId,
  465. };
  466. const { data } = await eliminate(Object.assign({}, params));
  467. if (data.code) {
  468. showSuccessToast(t("device.successfullyEliminatedTheAlarm"));
  469. e.alarmList = [];
  470. } else {
  471. showFailToast(data.message);
  472. }
  473. console.log("/tEquipment/eliminate", e);
  474. };
  475. const showDateTime = (date) => {
  476. if (!date) {
  477. return "";
  478. }
  479. const currentDate = new Date(dateUtil.formateDate(new Date(date), "yyyy/MM/dd hh:mm:ss"));
  480. return dateUtil.timeZoneDate(currentDate);
  481. };
  482. // 点击查看定位
  483. const viewPosiClk = (row) => {
  484. console.log("row 是 >>>", row);
  485. if (row.latitude) {
  486. router.push({
  487. path: "viewPosition",
  488. query: {
  489. latitude: row.latitude,
  490. longitude: row.longitude,
  491. fullName: row.fullName,
  492. },
  493. });
  494. } else {
  495. showToast(`${t("device.noPosition")}!!!`);
  496. }
  497. };
  498. // 点击补料
  499. const replenishmentClk = (row) => {
  500. console.log("row >>>", row);
  501. Api_getReplenishment({ equipmentId: row.id }).then((res) => {
  502. console.log("res >>>", res);
  503. // Toast(res.data.message);
  504. showDialog({
  505. message: t('device.sentSuccessfully'),
  506. }).then(() => {
  507. //返回上一页
  508. router.go(0);
  509. });
  510. setTimeout(() => {
  511. getList();
  512. }, 500);
  513. });
  514. };
  515. // 操作弹窗完成的回调
  516. const operFinish = () => {
  517. init();
  518. };
  519. // 设备状况
  520. const equipStatus = ref({});
  521. // 获取设备情况
  522. const getMachineNum = () => {
  523. Api_postMachineNum({
  524. adminId: user.id,
  525. companyType: searchParams.companyType
  526. }).then((res) => {
  527. equipStatus.value = res.data.data || {};
  528. });
  529. };
  530. // 点击运行总数和总设备数
  531. const eqeStatusClk = (val) => {
  532. searchParams.eqeStatus = val;
  533. // 初始化
  534. searchParams.current = 1;
  535. list.value = [];
  536. getList();
  537. };
  538. // 点击修改图标
  539. const editSleepDesc = () => {
  540. sleepDescBoxShow.value = !sleepDescBoxShow.value;
  541. }
  542. // 点击睡眠描述的确定按钮
  543. const sleepDescChg = async (sleepDesc, id) => {
  544. console.log(sleepDesc);
  545. if (!sleepDesc) {
  546. showToast(t("device.sleepDescPlace"));
  547. } else {
  548. const { data } = await changeSleepDesc({
  549. equipmentId: id,
  550. sleepDesc,
  551. });
  552. if (data.code === "00000") {
  553. sleepDescBoxShow.value = true;
  554. showToast(data.message);
  555. // setTimeout(() => {
  556. // gettAdminGetRelation();
  557. // }, 500);
  558. }
  559. }
  560. }
  561. // 点击标签
  562. const active = ref("");
  563. const clickLabel = (item) => {
  564. console.log(item);
  565. list.value = [];
  566. searchParams.current = 1;
  567. searchParams.labelId = item.name;
  568. getList();
  569. }
  570. // 分组管理
  571. const showPopover = ref(false);
  572. const actions = [
  573. { text: t("device.group"), value: '0' },
  574. { text: t("device.addGroup"), value: '1' },
  575. ];
  576. const selectLabel = (action) => {
  577. // showToast(action.value);
  578. if (action.value == '0') {
  579. router.push('/labelMan');
  580. }
  581. if (action.value == '1') {
  582. router.push("/labelManAdd");
  583. }
  584. }
  585. return {
  586. ...toRefs(searchParams),
  587. list,
  588. loading,
  589. error,
  590. finished,
  591. onLoad,
  592. searchRef,
  593. searchClick,
  594. search,
  595. deviceSet,
  596. clearAlarm,
  597. oprRef,
  598. deviceOprShow,
  599. showDateTime,
  600. sys,
  601. viewPosiClk,
  602. replenishmentClk,
  603. Format_calcuDecial,
  604. operFinish,
  605. equipStatus,
  606. eqeStatusClk,
  607. editSleepDesc,
  608. sleepDescBoxShow,
  609. sleepDescChg,
  610. backTop,
  611. user,
  612. labelList,
  613. clickLabel,
  614. active,
  615. actions,
  616. showPopover,
  617. selectLabel
  618. };
  619. },
  620. };
  621. </script>
  622. <style lang="less" scoped>
  623. @import "../../common/style/common";
  624. @import "../../styles/device/index";
  625. </style>