index.vue 5.3 KB

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