xunJian.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // 组件引用
  2. import { defineStore } from "pinia";
  3. // 接口引用
  4. import { updatePlan } from "@/api/business/zhaf/xunJian/plan.js";
  5. // 公共方法引用
  6. import modal from "@/plugins/modal.plugins.js";
  7. import common from "@/plugins/common.plugins.js";
  8. import keyListen from "@/plugins/keyListen.plugins.js";
  9. const xunJianStores = defineStore(`storage-xunJian`, {
  10. state: () => ({
  11. planTabs: 0, //巡检计划页 tabs切换值
  12. siteId: null, //巡检计划页 站点id
  13. planSonId: null, //巡检计划页 子计划id
  14. planSonId1: null, //巡检计划页 子计划id
  15. siteNubmber: null, //巡检计划页 站点号码
  16. siteStatus: null, //巡检详情页 定位状态
  17. inspectionStatus: null,//巡检页 是否已巡检状态 1.未巡检 2.已巡检
  18. contentArray: {},
  19. collectDataList: [], //巡检点位采集数据存储
  20. planDataList: [],//巡检计划采集数据存储
  21. modal: {
  22. show: false,
  23. exitPassword: "",
  24. newExitPassword: "Usky-1707",//系统退出密码
  25. }
  26. }),
  27. unistorage: true,
  28. actions: {
  29. //巡检计划循环提交
  30. planForSubmit() {
  31. var _this = this
  32. if (!common.isNetwork()) {
  33. return false;
  34. }
  35. if (_this.planDataList.length > 0) {
  36. _this.planDataList.forEach((e) => {
  37. setTimeout(() => {
  38. updatePlan(e).then((res) => {
  39. if (res.status == "SUCCESS") {
  40. _this.planDataList.splice(_this.planDataList.indexOf(e), 1);
  41. } else {
  42. throw new Error('提交终止!')
  43. }
  44. });
  45. }, 1000);
  46. });
  47. }
  48. },
  49. modalConfirm() {
  50. //#ifdef APP-PLUS
  51. if (!this.modal.exitPassword) {
  52. modal.showToast("密码不能为空");
  53. return;
  54. }
  55. if (this.modal.exitPassword != this.modal.newExitPassword) {
  56. modal.showToast("密码错误");
  57. this.modal.show = true;
  58. return;
  59. }
  60. this.modal.exitPassword = ""
  61. this.modal.show = false;
  62. keyListen.quitApp(); //退出APP
  63. //#endif
  64. }
  65. },
  66. });
  67. export default xunJianStores;