index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <div class="secureselftest">
  3. <div class="list">
  4. <!-- <div v-if="todoList.length == 0"> -->
  5. <div class="list-row" v-for="(item, index) in todoList"
  6. @click="junmpMyMechantsDetails(item.routeParam, item.handleType)" :key="index">
  7. <div class="cell_1">
  8. <div class="width100 height44rpx mb16rpx">
  9. <div class="first_title">
  10. {{ item.title }}
  11. </div>
  12. </div>
  13. <div class="width100 height40rpx">
  14. <div class="second_title" style="width: 100%">
  15. {{ item.createdAt }}
  16. </div>
  17. </div>
  18. </div>
  19. </div>
  20. <!-- </div> -->
  21. <!-- <div v-else> -->
  22. <van-empty v-if="todoList.length == 0" class="disblock marginauto" style="background: white" description="暂无数据" />
  23. <!-- </div> -->
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import { handleList, getByCodes, getUserLocalStorageInfo } from "@/js_sdk/http";
  29. import vanEmpty from "../../../wxcomponents/weapp/dist/empty/index";
  30. export default {
  31. components: {
  32. vanEmpty,
  33. },
  34. data() {
  35. return {
  36. dic_key: ["safety_inspection_type"],
  37. dic_SelectList: {},
  38. active: 0,
  39. todoList: [],
  40. search: {
  41. pageSize: 10,
  42. pageNum: 1,
  43. types: "8,9,10,11",
  44. userId: "",
  45. },
  46. statusList: [
  47. { label: "全部", value: null },
  48. { label: "电梯自检", value: "1" },
  49. { label: "消防自检", value: "2" },
  50. { label: "电柜检查", value: "3" },
  51. { label: "电器线路", value: "4" },
  52. ],
  53. };
  54. },
  55. onShow() {
  56. // this.getByCodes();
  57. this.search.userId = getUserLocalStorageInfo().user.id;
  58. this.gettodoList();
  59. },
  60. methods: {
  61. getDicType(value) {
  62. if (!value) return "未知类型";
  63. let safety_inspection_type = this.dic_SelectList.safety_inspection_type;
  64. let index = safety_inspection_type.findIndex((e) => e.value == value);
  65. return safety_inspection_type[index].label;
  66. },
  67. junmpMyMechantsDetails(routeParam, type) {
  68. console.log(routeParam, type);
  69. if (type == 8) {
  70. uni.navigateTo({
  71. url: "/pages/subPackages/repairprocessing-app/detail?id=" + routeParam,
  72. });
  73. return
  74. }
  75. if (type == 9) {
  76. let param = routeParam.split(",");
  77. console.log(param);
  78. if (param[0] == "报事报修待派单") {
  79. console.log("报事报修待派单");
  80. uni.navigateTo({
  81. url: "/pages/subPackages/repairDispatch-app/detail?id=" + param[0],
  82. });
  83. }
  84. // if (param[0] == "报事报修待处理") {
  85. console.log("报事报修待处理");
  86. uni.navigateTo({
  87. url:
  88. "/pages/subPackages/repairprocessing-app/detail?" + param,
  89. });
  90. }
  91. // }
  92. if (type == 11) {
  93. uni.navigateTo({
  94. url:
  95. "/pages/subPackages/venueRoom/audit?" +
  96. routeParam +
  97. "&readOnlyType=" +
  98. 1,
  99. });
  100. }
  101. if (type == 10) {
  102. uni.navigateTo({
  103. url: "/pages/subPackages/meetingroom/audit?" + routeParam,
  104. });
  105. }
  106. },
  107. jumpReport() {
  108. uni.navigateTo({
  109. url: "/pages/subPackages/secureselftest/report?id=" + null,
  110. });
  111. },
  112. async getMoreListData() {
  113. let that = this;
  114. that.search.pageNum = that.search.pageNum + 1;
  115. let list = await handleList(that.search);
  116. if (list.rows == 0) {
  117. that.$showToast("没有更多数据了");
  118. } else {
  119. list.rows.forEach((e) => {
  120. that.todoList.push(e);
  121. });
  122. }
  123. },
  124. onReachBottom() {
  125. this.getMoreListData();
  126. }, //下拉执行的时候触发 (下拉刷新)
  127. onChange(e) {
  128. this.search.type = e.detail.name == null ? "" : e.detail.name;
  129. this.gettodoList();
  130. },
  131. endDate() {
  132. return this.getDate("end");
  133. },
  134. startDate() {
  135. return this.getDate("start");
  136. },
  137. async getByCodes() {
  138. let data = await getByCodes(JSON.stringify(this.dic_key));
  139. this.dic_SelectList = this.$common.handleDicList(data);
  140. this.gettodoList();
  141. },
  142. getDate(type) {
  143. const date = new Date();
  144. let year = date.getFullYear();
  145. let month = date.getMonth() + 1;
  146. let day = date.getDate();
  147. if (type === "start") {
  148. year = year - 60;
  149. } else if (type === "end") {
  150. year = year + 2;
  151. }
  152. month = month > 9 ? month : "0" + month;
  153. day = day > 9 ? day : "0" + day;
  154. return `${year}-${month}-${day}`;
  155. },
  156. async gettodoList() {
  157. this.search.pageSize = 10;
  158. this.search.pageNum = 1;
  159. let list = await handleList(this.search);
  160. // /wx/SafetyController/handleList
  161. this.todoList = list.rows;
  162. },
  163. jumpAddCompanyPage() {
  164. uni.navigateTo({
  165. url: "/pages/subPackages/addCompany/addCompany",
  166. });
  167. },
  168. jumpPage(e) {
  169. uni.navigateTo({
  170. url: "/pages/subPackages/companyDetails/companyDetails?id=" + e,
  171. });
  172. },
  173. },
  174. };
  175. </script>
  176. <style lang="scss">
  177. .chooseyears {
  178. width: 326rpx;
  179. height: 56rpx;
  180. background: rgba(29, 24, 188, 0.05);
  181. border-radius: 8rpx 8rpx 8rpx 8rpx;
  182. text-align: center;
  183. line-height: 56rpx;
  184. display: flex;
  185. color: #1d18bc;
  186. }
  187. .searchbox {
  188. display: block;
  189. background: white;
  190. }
  191. .chaochuyincang {
  192. white-space: nowrap;
  193. overflow: hidden;
  194. text-overflow: ellipsis;
  195. }
  196. .secureselftest {
  197. .custom-class {
  198. background: white;
  199. }
  200. }
  201. </style>