index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div class="secureselftest">
  3. <div class="list">
  4. <!-- <div v-if="readList.length == 0"> -->
  5. <div
  6. class="list-row"
  7. v-for="(item, index) in readList"
  8. @click="
  9. junmpMyMechantsDetails(
  10. item.routeParam,
  11. item.handleType,
  12. item.readType
  13. )
  14. "
  15. :key="index"
  16. >
  17. <div class="cell_1">
  18. <div class="width100 height44rpx mb16rpx">
  19. <div class="first_title">
  20. {{ item.title }}
  21. </div>
  22. </div>
  23. <div class="width100 height40rpx">
  24. <div class="second_title" style="width: 100%">
  25. {{ item.createdAt }}
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. <!-- </div> -->
  31. <!-- <div v-else> -->
  32. <van-empty
  33. v-if="readList.length == 0"
  34. class="disblock marginauto"
  35. style="background: white"
  36. description="暂无数据"
  37. />
  38. <!-- </div> -->
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import { readList, getByCodes, getUserLocalStorageInfo } from "@/js_sdk/http";
  44. import vanEmpty from "../../../wxcomponents/weapp/dist/empty/index";
  45. export default {
  46. components: {
  47. vanEmpty,
  48. },
  49. data() {
  50. return {
  51. dic_key: ["safety_inspection_type"],
  52. dic_SelectList: {},
  53. active: 0,
  54. readList: [],
  55. search: {
  56. pageSize: 10,
  57. pageNum: 1,
  58. types: "5,6",
  59. userId: "",
  60. },
  61. statusList: [
  62. { label: "全部", value: null },
  63. { label: "电梯自检", value: "1" },
  64. { label: "消防自检", value: "2" },
  65. { label: "电柜检查", value: "3" },
  66. { label: "电器线路", value: "4" },
  67. ],
  68. };
  69. },
  70. onShow() {
  71. // this.getByCodes();
  72. this.search.userId = getUserLocalStorageInfo().user.id;
  73. this.getreadList();
  74. },
  75. methods: {
  76. getDicType(value) {
  77. if (!value) return "未知类型";
  78. let safety_inspection_type = this.dic_SelectList.safety_inspection_type;
  79. let index = safety_inspection_type.findIndex((e) => e.value == value);
  80. return safety_inspection_type[index].label;
  81. },
  82. junmpMyMechantsDetails(routeParam, type, readType) {
  83. console.log(type);
  84. console.log(routeParam);
  85. if (readType == 6) {
  86. let param = routeParam.split(",");
  87. console.log(param);
  88. uni.navigateTo({
  89. url: "/pages/subPackages/repairprocessing-app/detail?id=" + param[1],
  90. });
  91. }
  92. if (type == 6) {
  93. uni.navigateTo({
  94. url:
  95. "/pages/subPackages/repairprocessing-app/detail?id=" + routeParam,
  96. });
  97. }
  98. if (type == 5) {
  99. uni.navigateTo({
  100. url:
  101. "/pages/subPackages/merchants/components/mymechantsdetails?id=" +
  102. 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 readList(that.search);
  115. if (list.rows == 0) {
  116. that.$showToast("没有更多数据了");
  117. } else {
  118. list.rows.forEach((e) => {
  119. that.readList.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.getreadList();
  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.getreadList();
  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 getreadList() {
  156. this.search.pageSize = 10;
  157. this.search.pageNum = 1;
  158. let list = await readList(this.search);
  159. // /wx/SafetyController/readList
  160. this.readList = 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>