index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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,7,8",
  59. userId: "",
  60. },
  61. totals: 0,
  62. statusList: [
  63. { label: "全部", value: null },
  64. { label: "电梯自检", value: "1" },
  65. { label: "消防自检", value: "2" },
  66. { label: "电柜检查", value: "3" },
  67. { label: "电器线路", value: "4" },
  68. ],
  69. };
  70. },
  71. onShow() {
  72. // this.getByCodes();
  73. this.search.userId = getUserLocalStorageInfo().user.id;
  74. this.getreadList();
  75. },
  76. methods: {
  77. getDicType(value) {
  78. if (!value) return "未知类型";
  79. let safety_inspection_type = this.dic_SelectList.safety_inspection_type;
  80. let index = safety_inspection_type.findIndex((e) => e.value == value);
  81. return safety_inspection_type[index].label;
  82. },
  83. junmpMyMechantsDetails(routeParam, type, readType) {
  84. console.log(type);
  85. console.log(readType);
  86. console.log(routeParam);
  87. if (readType == 8) {
  88. uni.navigateTo({
  89. url:
  90. "/pages/subPackages/announcement/detail?" +
  91. routeParam +
  92. "&readStatus=" +
  93. 0,
  94. });
  95. }
  96. if (readType == 7) {
  97. uni.navigateTo({
  98. url: "/pages/subPackages/parkActivities/detail?" + routeParam,
  99. });
  100. }
  101. if (readType == 6) {
  102. let param = routeParam.split(",");
  103. uni.navigateTo({
  104. url: "/pages/subPackages/repairprocessing-app/detail?id=" + param[1],
  105. });
  106. }
  107. if (type == 6) {
  108. uni.navigateTo({
  109. url:
  110. "/pages/subPackages/repairprocessing-app/detail?id=" + routeParam,
  111. });
  112. }
  113. if (type == 5) {
  114. uni.navigateTo({
  115. url:
  116. "/pages/subPackages/merchants/components/mymechantsdetails?id=" +
  117. routeParam,
  118. });
  119. }
  120. },
  121. jumpReport() {
  122. uni.navigateTo({
  123. url: "/pages/subPackages/secureselftest/report?id=" + null,
  124. });
  125. },
  126. // async getMoreListData() {
  127. // let that = this;
  128. // if (that.total == that.readList.length) {
  129. // return;
  130. // }
  131. // that.search.pageNum = that.search.pageNum + 1;
  132. // let list = await readList(that.search);
  133. // if (list.rows == 0) {
  134. // that.$showToast("没有更多数据了");
  135. // } else {
  136. // list.rows.forEach((e) => {
  137. // that.readList.push(e);
  138. // });
  139. // }
  140. // },
  141. onReachBottom() {
  142. this.getMoreListData();
  143. }, //下拉执行的时候触发 (下拉刷新)
  144. onChange(e) {
  145. this.search.type = e.detail.name == null ? "" : e.detail.name;
  146. this.getreadList();
  147. },
  148. endDate() {
  149. return this.getDate("end");
  150. },
  151. startDate() {
  152. return this.getDate("start");
  153. },
  154. async getByCodes() {
  155. let data = await getByCodes(JSON.stringify(this.dic_key));
  156. this.dic_SelectList = this.$common.handleDicList(data);
  157. this.getreadList();
  158. },
  159. getDate(type) {
  160. const date = new Date();
  161. let year = date.getFullYear();
  162. let month = date.getMonth() + 1;
  163. let day = date.getDate();
  164. if (type === "start") {
  165. year = year - 60;
  166. } else if (type === "end") {
  167. year = year + 2;
  168. }
  169. month = month > 9 ? month : "0" + month;
  170. day = day > 9 ? day : "0" + day;
  171. return `${year}-${month}-${day}`;
  172. },
  173. async getreadList() {
  174. this.search.pageSize = 10;
  175. this.search.pageNum = 1;
  176. let list = await readList(this.search);
  177. // /wx/SafetyController/readList
  178. this.readList = list.rows;
  179. this.totals = list.total;
  180. },
  181. jumpAddCompanyPage() {
  182. uni.navigateTo({
  183. url: "/pages/subPackages/addCompany/addCompany",
  184. });
  185. },
  186. jumpPage(e) {
  187. uni.navigateTo({
  188. url: "/pages/subPackages/companyDetails/companyDetails?id=" + e,
  189. });
  190. },
  191. },
  192. };
  193. </script>
  194. <style lang="scss">
  195. .chooseyears {
  196. width: 326rpx;
  197. height: 56rpx;
  198. background: rgba(29, 24, 188, 0.05);
  199. border-radius: 8rpx 8rpx 8rpx 8rpx;
  200. text-align: center;
  201. line-height: 56rpx;
  202. display: flex;
  203. color: #1d18bc;
  204. }
  205. .searchbox {
  206. display: block;
  207. background: white;
  208. }
  209. .chaochuyincang {
  210. white-space: nowrap;
  211. overflow: hidden;
  212. text-overflow: ellipsis;
  213. }
  214. .secureselftest {
  215. .custom-class {
  216. background: white;
  217. }
  218. }
  219. </style>