index.vue 5.5 KB

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