deviceOper.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <template>
  2. <!-- 设备常见操作弹窗 -->
  3. <van-dialog class-name="operDialog" width="350px" v-model:show="show" :showConfirmButton="false"
  4. :showCancelButton="false" :closeOnClickOverlay="true">
  5. <slot name="title">
  6. <div class="van-dialog__header" style="padding-bottom: 1em;">{{ $t("device.commonOperations") }}</div>
  7. <div class="txt1" style="padding: 0.2em 1em">
  8. {{ $t("device.equipmentName") }}: {{ device.name != null ? device.name : $t("device.equipmentNameTips") }}
  9. </div>
  10. <div class="txt1" style="padding: 0.2em 1em">
  11. {{ $t("device.equipmentNo") }}: {{ device.clientId.slice(-6) }}
  12. </div>
  13. </slot>
  14. <van-icon name="cross" class="close" @click="show = false" />
  15. <div class="group4 flex-col"></div>
  16. <div class="operBox">
  17. <!-- 重启炉头 -->
  18. <div class="operItem" @click="restartFurnace()">
  19. <div class="operIcon">
  20. <img class="operImg" src="../../assets/device/operIcon/restart.png" />
  21. </div>
  22. <div v-if="device.machineType === '0' || device.machineType === null" class="operText">{{
  23. $t("device.restartFurnaceHead") }}</div>
  24. <div v-else class="operText">{{ $t("device.restart") }}</div>
  25. </div>
  26. <!-- 睡眠 -->
  27. <div class="operItem" @click="sleepEquipmentFun()">
  28. <div class="operIcon">
  29. <img class="operImg" src="../../assets/device/operIcon/sleep.png" />
  30. </div>
  31. <div class="operText">{{ sleepTitle }}</div>
  32. </div>
  33. <!-- 开启炉头/设备 -->
  34. <div v-if="device.machineType != '2'" class="operItem" @click="openOffFurnace(1)">
  35. <div class="operIcon">
  36. <img class="operImg" src="../../assets/device/operIcon/onOff.png" />
  37. </div>
  38. <div v-if="device.machineType === '0' || device.machineType === null" class="operText">{{
  39. $t("device.openFurnHead") }}</div>
  40. <div v-else class="operText">{{ $t("device.openDevice") }}</div>
  41. </div>
  42. <!-- 关闭炉头/设备 -->
  43. <div class="operItem" @click="openOffFurnace(0)">
  44. <div class="operIcon">
  45. <img class="operImg" src="../../assets/device/operIcon/onOff.png" />
  46. </div>
  47. <div v-if="device.machineType === '0' || device.machineType === null" class="operText">{{
  48. $t("device.closeFurnHead") }}</div>
  49. <div v-else class="operText">{{ $t("device.closeDevice") }}</div>
  50. </div>
  51. <!-- 雪糕机制冷模式 -->
  52. <div v-if="device.machineType == '2'" class="operItem" @click="updateWorkingMode(0)">
  53. <div class="operIcon">
  54. <img class="operImg" src="../../assets/device/operIcon/refrigeration.png" />
  55. </div>
  56. <div class="operText">{{ $t("device.refrigeration") }}</div>
  57. </div>
  58. <!-- 雪糕机搅拌模式 -->
  59. <div v-if="device.machineType == '2'" class="operItem" @click="updateWorkingMode(1)">
  60. <div class="operIcon">
  61. <img class="operImg" src="../../assets/device/operIcon/stir.png" />
  62. </div>
  63. <div class="operText">{{ $t("device.stir") }}</div>
  64. </div>
  65. <!-- 雪糕机保鲜模式 -->
  66. <div v-if="device.machineType == '2'" class="operItem" @click="updateWorkingMode(2)">
  67. <div class="operIcon">
  68. <img class="operImg" src="../../assets/device/operIcon/keepFresh.png" />
  69. </div>
  70. <div class="operText">{{ $t("device.keepFresh") }}</div>
  71. </div>
  72. <!-- 雪糕机解冻模式 -->
  73. <div v-if="device.machineType == '2'" class="operItem" @click="updateWorkingMode(3)">
  74. <div class="operIcon">
  75. <img class="operImg" src="../../assets/device/operIcon/thaw.png" />
  76. </div>
  77. <div class="operText">{{ $t("device.thaw") }}</div>
  78. </div>
  79. <!-- <div class="operItem" @click="openDoorFun()">
  80. <div class="operIcon">
  81. <img
  82. class="operImg"
  83. src="../../assets/device/operIcon/openDoor.png"
  84. />
  85. </div>
  86. <div class="operText">{{ $t("device.remoteDoorOpening") }}</div>
  87. </div> -->
  88. <!-- 远程开门 -->
  89. <div class="operItem" @click="openDoorFun()">
  90. <div class="operIcon">
  91. <img class="operImg" src="../../assets/device/operIcon/openDoor.png" />
  92. </div>
  93. <div class="operText">{{ $t("device.remoteDoorOpening") }}</div>
  94. </div>
  95. <!-- 远程做糖 -->
  96. <div class="operItem" @click="doSugar()">
  97. <div class="operIcon">
  98. <img class="operImg" src="../../assets/device/operIcon/doSugar.png" />
  99. </div>
  100. <div v-if="device.machineType === '0' || device.machineType === null" class="operText">{{
  101. $t("device.remoteSugarMaking") }}</div>
  102. <div v-else class="operText">{{ $t("device.remoteProduction") }}</div>
  103. </div>
  104. <!-- 定时开关 -->
  105. <div class="operItem" @click="alarmClock()" v-if="device.equimentType != 'SI320'">
  106. <div class="operIcon">
  107. <img class="operImg" src="../../assets/device/operIcon/alarmClock.png" />
  108. </div>
  109. <div class="operText">{{ $t("device.timeSwitch") }}</div>
  110. </div>
  111. <!-- 音量调节 -->
  112. <div class="operItem" @click="modulation()">
  113. <div class="operIcon">
  114. <img class="operImg" src="../../assets/device/operIcon/modulation.png" />
  115. </div>
  116. <div class="operText">{{ $t("device.modulation") }}</div>
  117. </div>
  118. <!-- <div v-if="user.ifForeign == '0'" class="operItem" @click="recharge()">
  119. <div class="operIcon">
  120. <img class="operImg" src="../../assets/device/operIcon/recharge.png" />
  121. </div>
  122. <div class="operText">{{ $t("device.equipmentRecharge") }}</div>
  123. </div> -->
  124. <div class="operItem" @click="paramSetPush()" v-if="device.equimentType != 'SI320' && device.machineType != '2'">
  125. <div class="operIcon">
  126. <img class="operImg" src="../../assets/device/operIcon/paramsSet.png" />
  127. </div>
  128. <div class="operText">{{ $t("device.parameterSetting") }}</div>
  129. </div>
  130. <div v-if="user.ifForeign == '0'" class="operItem" @click="saveProportionPush()">
  131. <div class="operIcon">
  132. <img class="operImg" src="../../assets/device/operIcon/saveProportion.png" />
  133. </div>
  134. <div class="operText">{{ $t("device.addDistributor") }}</div>
  135. </div>
  136. <div v-if="isRole('M17')" class="operItem" @click="tuojiEquipmentFun()">
  137. <div class="operIcon">
  138. <img class="operImg" src="../../assets/device/operIcon/tuoji.png" />
  139. </div>
  140. <div class="operText">{{ $t("device.sysOffline") }}</div>
  141. </div>
  142. <div class="operItem" @click="modifyPriceClk()">
  143. <div class="operIcon">
  144. <img class="operImg" src="../../assets/device/operIcon/editPrice.png" />
  145. </div>
  146. <div class="operText">{{ $t("device.modifyPrice") }}</div>
  147. </div>
  148. <!-- 物料监控 -->
  149. <div class="operItem" @click="materialMonitorClk()" v-if="device.equimentType != 'SI320'">
  150. <div class="operIcon">
  151. <img v-if="materialIcon === '0'" class="operImg" src="../../assets/device/operIcon/materialMonitor.png" />
  152. <img v-else class="operImg" src="../../assets/device/operIcon/materialMonitorOff.png" />
  153. <!-- <img class="operImg" src="../../assets/device/operIcon/materialMonitor.png" /> -->
  154. </div>
  155. <!-- <div class="operText">{{ $t("device.materialMonitor") }}</div> -->
  156. <div class="operText">{{ materialTitle }}</div>
  157. </div>
  158. <!-- 屏蔽/展示商品 -->
  159. <div class="operItem" @click="showGoodsClk()" v-if="device.equimentType != 'SI320'">
  160. <div class="operIcon">
  161. <img class="operImg" src="../../assets/device/operIcon/showGoods.png" />
  162. </div>
  163. <div class="operText">{{ $t("device.showGoods") }}</div>
  164. </div>
  165. <!-- DIY花型 -->
  166. <!-- v-if="device.equimentType == 'MG320' || device.equimentType == 'MG330'" -->
  167. <div class="operItem" v-if="user.type < 1" @click="diyFlowerClk()">
  168. <div class="operIcon">
  169. <img class="operImg" src="../../assets/device/operIcon/diyFlower.png" />
  170. </div>
  171. <div class="operText">{{ $t("device.diyFlower") }}</div>
  172. </div>
  173. <!-- 修改机器密码 -->
  174. <div v-if="user.type < 3" class="operItem" @click="changePasswordClk()">
  175. <div class="operIcon">
  176. <img class="operImg" src="../../assets/device/operIcon/password.png" />
  177. </div>
  178. <div class="operText">{{ $t("device.changePassword") }}</div>
  179. </div>
  180. <!-- 删除设备 -->
  181. <div v-if="user.type < 2" class="operItem" @click="deleteDevice()">
  182. <div class="operIcon">
  183. <img class="operImg" src="../../assets/device/operIcon/deletedevice.png" />
  184. </div>
  185. <div class="operText">{{ $t("device.deleteDevice") }}</div>
  186. </div>
  187. <!-- 日志功能 -->
  188. <div v-if="user.type < 2" class="operItem" @click="viewLogs()">
  189. <div class="operIcon">
  190. <img class="operImg" src="../../assets/device/operIcon/viewLogs.png" />
  191. </div>
  192. <div class="operText">{{ $t("device.viewLogs") }}</div>
  193. </div>
  194. <!-- 定制logo -->
  195. <div v-if="user.type < 2" class="operItem" @click="customLogo()">
  196. <div class="operIcon">
  197. <img class="operImg" src="../../assets/device/operIcon/customLogo.png" />
  198. </div>
  199. <div class="operText">{{ $t("device.customLogo.customLogo") }}</div>
  200. </div>
  201. <!-- 远程重启触摸屏 -->
  202. <div class="operItem" @click="restartAndroid()">
  203. <div class="operIcon">
  204. <img class="operImg" src="../../assets/device/operIcon/restartAndroid.png" />
  205. </div>
  206. <div class="operText">{{ $t("device.restartAndroid") }}</div>
  207. </div>
  208. <!-- 查看定位 -->
  209. <!-- <div class="operItem" @click="viewPosiClk()">
  210. <div class="operIcon">
  211. <img class="operImg" src="../../assets/device/operIcon/location.png" />
  212. </div>
  213. <div class="operText">{{ $t("device.viewPositioning") }}</div>
  214. </div> -->
  215. <!-- 设备清洗提醒 -->
  216. <div class="operItem" v-if="device.machineType === '0' || device.machineType === null" @click="alramCleanClk()">
  217. <div class="operIcon">
  218. <img class="operImg" src="../../assets/device/operIcon/alarmClean.png" />
  219. </div>
  220. <div class="operText">{{ $t("device.alarmClean") }}</div>
  221. </div>
  222. <!-- 远程退币 -->
  223. <div class="operItem"
  224. v-if="(device.machineType === '0' || device.machineType === null) && (user.ifForeign == 1 || user.type == 0)"
  225. @click="returnCoinClk()">
  226. <div class="operIcon">
  227. <img class="operImg" src="../../assets/device/operIcon/coin.png" />
  228. </div>
  229. <div class="operText">{{ $t("device.returnCoin") }}</div>
  230. </div>
  231. </div>
  232. </van-dialog>
  233. <van-dialog v-model:show="operCheckShow" :title="$t('device.operationConfirmation')" :showConfirmButton="false"
  234. :showCancelButton="false">
  235. <div class="operCheckBox">
  236. <div class="block5 flex-col"></div>
  237. <span class="word10">{{
  238. $t("device.pleaseConfirmAgainWhetherToOperate")
  239. }}</span>
  240. <div class="block6 flex-row justify-between">
  241. <div class="mod7 flex-col" @click="operCheckClear()">
  242. <span class="info5">{{ $t("device.IllThinkAboutItAgain") }}</span>
  243. </div>
  244. <div class="mod8 flex-col" @click="operCheck()">
  245. <span class="info6">{{ $t("device.confirm") }}</span>
  246. </div>
  247. </div>
  248. </div>
  249. </van-dialog>
  250. </template>
  251. <script>
  252. import { onMounted, ref } from "vue";
  253. import {
  254. setFurnace,
  255. sleepEquipment,
  256. // openDoor,
  257. Api_openDoor,
  258. deviceTuoji,
  259. delOneDevice,
  260. enableMaterial,
  261. restartScreen,
  262. machineReset,
  263. changeWorkingMode,
  264. } from "../../service/device";
  265. import { showFailToast, showSuccessToast } from "vant";
  266. import { useRouter } from "vue-router";
  267. import { useI18n } from "vue-i18n";
  268. import { getLoginUser, styleUrl } from "@/common/js/utils";
  269. export default {
  270. emits: ['operfinish'],
  271. setup(props, { emit }) {
  272. // 点击修改价格
  273. const modifyPriceClk = () => {
  274. router.push({
  275. path: "modifyPrice",
  276. query: { deviceId: device.value.id, name: device.value.name },
  277. });
  278. };
  279. // 点击屏蔽/展示商品
  280. const showGoodsClk = () => {
  281. router.push({
  282. path: "showGoods",
  283. query: { deviceId: device.value.id, name: device.value.name },
  284. });
  285. };
  286. // 点击DIY花型
  287. const diyFlowerClk = () => {
  288. router.push({
  289. path: "diyFlower",
  290. query: { deviceId: device.value.id, name: device.value.name, diyFlowerStatus: device.value.diyFlowerStatus, flower: device.value.flowers },
  291. });
  292. };
  293. // 点击设备清洗提醒
  294. const alarmCleanClk = () => {
  295. router.push({
  296. path: "alarmClean",
  297. query: { deviceId: device.value.id, name: device.value.name, clientId: device.value.clientId, cleanFunction: device.value.cleanFunction },
  298. });
  299. };
  300. // 点击远程退币
  301. const returnCoinClk = () => {
  302. router.push({
  303. path: "returnCoin",
  304. query: { deviceId: device.value.id, name: device.value.name, clientId: device.value.clientId },
  305. });
  306. };
  307. const { t } = useI18n();
  308. const user = getLoginUser();
  309. const router = useRouter();
  310. const show = ref(false);
  311. const operCheckShow = ref(false);
  312. const device = ref({});
  313. const operType = ref("");
  314. // 睡眠按钮文字
  315. const sleepTitle = ref(t("device.turnOnSleep"));
  316. // 物料监控按钮文字
  317. const materialTitle = ref(t("device.materialMonitorOn"));
  318. // 睡眠图标
  319. const sleepIcon = ref('0');
  320. // 物料监控图标
  321. const materialIcon = ref('0');
  322. // 工作模式
  323. const workMode = ref(null);
  324. // 初始化页面获取列表
  325. onMounted(async () => {
  326. // 加载样式
  327. styleUrl('deviceOper');
  328. });
  329. // 当前弹窗父组件触发
  330. const showOper = (e) => {
  331. device.value = e;
  332. show.value = true;
  333. // isSleep=true,机器属于休眠状态,按钮是关闭休眠
  334. if (device.value.isSleep) {
  335. sleepTitle.value = t("device.turnOffSleep");
  336. } else {
  337. sleepTitle.value = t("device.turnOnSleep");
  338. }
  339. // 物料监控
  340. // isMaterialUse = "1"时,物料监控已开启
  341. if (device.value.isMaterialUse === '1') {
  342. materialTitle.value = t("device.materialMonitorOn");
  343. materialIcon.value = '0';
  344. } else {
  345. materialTitle.value = t("device.materialMonitorOff");
  346. materialIcon.value = '1';
  347. }
  348. };
  349. const closeOper = () => {
  350. show.value = false;
  351. }
  352. // 重启炉头
  353. const restartFurnace = () => {
  354. operType.value = 1;
  355. operCheckShow.value = true;
  356. };
  357. // 睡眠
  358. const sleepEquipmentFun = () => {
  359. operType.value = 2;
  360. operCheckShow.value = true;
  361. };
  362. // 点击的是开启炉头还是关闭 1开启 0关闭
  363. const clkOpenOrClose = ref(1);
  364. // 开启关闭炉头
  365. const openOffFurnace = (idx) => {
  366. clkOpenOrClose.value = idx;
  367. operType.value = 3;
  368. operCheckShow.value = true;
  369. };
  370. // 远程开门
  371. /* const openDoorFun = () => {
  372. operType.value = 4;
  373. operCheckShow.value = true;
  374. }; */
  375. const openDoorFun = () => {
  376. if (device.value.machineType === '2') {
  377. operType.value = 4;
  378. operCheckShow.value = true;
  379. } else {
  380. // router.push({ path: "openDoor", query: { deviceId: device.value.id } });
  381. router.push({ path: "openDoor", query: { deviceId: device.value.id, machineType: device.value.machineType } });
  382. }
  383. };
  384. // 日志功能
  385. const viewLogs = () => {
  386. router.push({ path: "viewLogs", query: { deviceId: device.value.id } });
  387. };
  388. // 定制logo
  389. const customLogo = () => {
  390. router.push({ path: "customLogo", query: { deviceId: device.value.id } });
  391. }
  392. // 音量调节
  393. const modulation = () => {
  394. router.push({ path: "modulation", query: { deviceId: device.value.id } });
  395. };
  396. // 远程做糖
  397. const doSugar = () => {
  398. router.push({ path: "doSugar", query: { deviceId: device.value.id, machineType: device.value.machineType } });
  399. };
  400. // 定时开关
  401. const alarmClock = () => {
  402. router.push({ path: "alarmClock", query: { deviceId: device.value.id } });
  403. };
  404. // 跳转 - 设备充值
  405. const recharge = () => {
  406. router.push({ path: "recharge", query: { deviceId: device.value.id } });
  407. };
  408. // 跳转 - 参数设置
  409. const paramSetPush = () => {
  410. router.push({ path: "paramsSet", query: { deviceId: device.value.id, machineType: device.value.machineType, name: device.value.name } });
  411. };
  412. // 跳转 - 添加分销人
  413. const saveProportionPush = () => {
  414. router.push({
  415. path: "distributionDetail",
  416. query: { deviceId: device.value.id, clientId: device.value.clientId },
  417. });
  418. };
  419. // 系统脱机
  420. const tuojiEquipmentFun = () => {
  421. operType.value = 5;
  422. operCheckShow.value = true;
  423. };
  424. // 修改机器密码
  425. const changePasswordClk = () => {
  426. router.push({
  427. path: "devicePassword",
  428. query: { deviceId: device.value.id, name: device.value.name },
  429. });
  430. };
  431. // 删除设备
  432. const deleteDevice = () => {
  433. operType.value = 6;
  434. operCheckShow.value = true;
  435. };
  436. // 物料监控
  437. const materialMonitorClk = () => {
  438. operType.value = 7;
  439. operCheckShow.value = true;
  440. };
  441. // 重启触摸屏
  442. const restartAndroid = () => {
  443. operType.value = 9;
  444. operCheckShow.value = true;
  445. };
  446. // 切换工作模式
  447. const updateWorkingMode = (value) => {
  448. workMode.value = value;
  449. operType.value = 10;
  450. operCheckShow.value = true;
  451. };
  452. // 取消操作
  453. const operCheckClear = () => {
  454. operCheckShow.value = false;
  455. };
  456. // 功能操作 - 确认操作
  457. const operCheck = async () => {
  458. // 重启
  459. if (operType.value === 1) {
  460. if (device.value.machineType === '2') {
  461. const { data } = await machineReset({
  462. equipmentId: device.value.id,
  463. });
  464. if (data.code) {
  465. showSuccessToast(t("device.enableMaterialSucceed"));
  466. operCheckShow.value = false;
  467. } else {
  468. showFailToast(data.message);
  469. }
  470. } else {
  471. const { data } = await setFurnace({
  472. equipmentId: device.value.id,
  473. eqeStatus: 1,
  474. });
  475. if (data.code) {
  476. showSuccessToast(t("device.restartSucceeded"));
  477. operCheckShow.value = false;
  478. } else {
  479. showFailToast(data.message);
  480. }
  481. }
  482. }
  483. // 睡眠
  484. if (operType.value === 2) {
  485. let eqeStatus = 1;
  486. // isSleep=true,机器属于休眠状态,按钮是关闭休眠
  487. if (device.value.isSleep) {
  488. eqeStatus = 0;
  489. }
  490. const { data } = await sleepEquipment({
  491. equipmentId: device.value.id,
  492. eqeStatus,
  493. });
  494. if (data.code) {
  495. showSuccessToast(t("device.sleepSuccessfully"));
  496. operCheckShow.value = false;
  497. } else {
  498. showFailToast(data.message);
  499. }
  500. }
  501. // 开机|关机
  502. if (operType.value === 3) {
  503. device.value.eqeStatus = clkOpenOrClose.value;
  504. const { data } = await setFurnace({
  505. equipmentId: device.value.id,
  506. eqeStatus: device.value.eqeStatus,
  507. });
  508. if (data.code) {
  509. showSuccessToast(
  510. `${device.value.eqeStatus === 0
  511. ? t("device.close")
  512. : t("device.open")
  513. }${t("device.success")}`
  514. );
  515. device.value.eqeStatus = device.value.eqeStatus === 0 ? 1 : 0;
  516. operCheckShow.value = false;
  517. } else {
  518. showFailToast(data.message);
  519. }
  520. }
  521. // 远程开门
  522. if (operType.value === 4) {
  523. // const { data } = await openDoor({ equipmentId: device.value.id });
  524. const { data } = await Api_openDoor({ equipmentId: device.value.id, type: 0, status: 1 });
  525. if (data.code) {
  526. showSuccessToast(t("device.remoteDoorOpeningSucceeded"));
  527. operCheckShow.value = false;
  528. } else {
  529. showFailToast(data.message);
  530. }
  531. }
  532. // 系统脱机
  533. if (operType.value === 5) {
  534. const { data } = await deviceTuoji({ id: device.value.id, clientId: device.value.clientId, adminUserName: user.username });
  535. if (data.code) {
  536. showSuccessToast(t("device.sysOffSuccess"));
  537. operCheckShow.value = false;
  538. } else {
  539. showFailToast(data.message);
  540. }
  541. }
  542. // 删除设备
  543. if (operType.value === 6) {
  544. const { data } = await delOneDevice({
  545. equipmentId: device.value.id,
  546. adminId: user.id,
  547. });
  548. if (data.code) {
  549. showSuccessToast(t("device.deleteDeviceSucceed"));
  550. operCheckShow.value = false;
  551. } else {
  552. showFailToast(t("device.deleteDeviceFailed"));
  553. }
  554. }
  555. // 启用物料监控
  556. if (operType.value === 7) {
  557. let materialMonitorStatus = 0; // 0默认是未开启
  558. // isMaterialUse是1时,物料监控已启用,按钮是关闭功能
  559. if (device.value.isMaterialUse === "1") {
  560. materialMonitorStatus = 1; // 1代表已开启
  561. }
  562. const { data } = await enableMaterial({
  563. equipmentId: device.value.id,
  564. materialMonitorStatus
  565. });
  566. if (data.code === '00000') {
  567. showSuccessToast(t("device.enableMaterialSucceed"));
  568. operCheckShow.value = false;
  569. } else {
  570. showFailToast(t("device.enableMaterialFailed"));
  571. }
  572. }
  573. // 重启触摸屏
  574. if (operType.value === 9) {
  575. const { data } = await restartScreen({
  576. equipmentId: device.value.id,
  577. });
  578. if (data.code === '00000') {
  579. showSuccessToast(t("device.Succeed"));
  580. operCheckShow.value = false;
  581. } else {
  582. showFailToast(t("device.Failed"));
  583. }
  584. }
  585. // 切换雪糕机工作模式
  586. if (operType.value === 10) {
  587. const { data } = await changeWorkingMode({
  588. equipmentId: device.value.id,
  589. workingMode: workMode.value,
  590. });
  591. if (data.code === '00000') {
  592. showSuccessToast(t("device.Succeed"));
  593. operCheckShow.value = false;
  594. } else {
  595. showFailToast(t("device.Failed"));
  596. }
  597. }
  598. setTimeout(() => {
  599. // 关闭弹窗
  600. show.value = false;
  601. // 触发操作完成回调
  602. emit("operfinish", true);
  603. }, 2000);
  604. };
  605. const isRole = (key) => {
  606. return user.menuCodeList.filter((type) => key === type).length > 0;
  607. };
  608. return {
  609. user,
  610. device,
  611. show,
  612. operCheckShow,
  613. showOper,
  614. closeOper,
  615. restartFurnace,
  616. operCheckClear,
  617. operCheck,
  618. sleepEquipmentFun,
  619. openOffFurnace,
  620. openDoorFun,
  621. modulation,
  622. customLogo,
  623. doSugar,
  624. alarmClock,
  625. recharge,
  626. paramSetPush,
  627. saveProportionPush,
  628. tuojiEquipmentFun,
  629. isRole,
  630. modifyPriceClk,
  631. showGoodsClk,
  632. diyFlowerClk,
  633. sleepTitle,
  634. materialTitle,
  635. viewLogs,
  636. deleteDevice,
  637. restartAndroid,
  638. // viewPosiClk,
  639. changePasswordClk,
  640. sleepIcon,
  641. materialIcon,
  642. materialMonitorClk,
  643. updateWorkingMode,
  644. alarmCleanClk,
  645. returnCoinClk,
  646. };
  647. },
  648. components: {},
  649. };
  650. </script>
  651. <style lang="less" scoped>
  652. @import "../../common/style/common";
  653. </style>