index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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,11",
  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 == 11) {
  101. uni.navigateTo({
  102. url:
  103. "/pages/subPackages/venueRoom/audit?" +
  104. routeParam +
  105. "&readOnlyType=" +
  106. 1,
  107. });
  108. }
  109. if (type == 10) {
  110. uni.navigateTo({
  111. url: "/pages/subPackages/meetingroom/audit?" + routeParam,
  112. });
  113. }
  114. },
  115. jumpReport() {
  116. uni.navigateTo({
  117. url: "/pages/subPackages/secureselftest/report?id=" + null,
  118. });
  119. },
  120. async getMoreListData() {
  121. let that = this;
  122. that.search.pageNum = that.search.pageNum + 1;
  123. let list = await handleList(that.search);
  124. if (list.rows == 0) {
  125. that.$showToast("没有更多数据了");
  126. } else {
  127. list.rows.forEach((e) => {
  128. that.todoList.push(e);
  129. });
  130. }
  131. },
  132. onReachBottom() {
  133. this.getMoreListData();
  134. }, //下拉执行的时候触发 (下拉刷新)
  135. onChange(e) {
  136. this.search.type = e.detail.name == null ? "" : e.detail.name;
  137. this.gettodoList();
  138. },
  139. endDate() {
  140. return this.getDate("end");
  141. },
  142. startDate() {
  143. return this.getDate("start");
  144. },
  145. async getByCodes() {
  146. let data = await getByCodes(JSON.stringify(this.dic_key));
  147. this.dic_SelectList = this.$common.handleDicList(data);
  148. this.gettodoList();
  149. },
  150. getDate(type) {
  151. const date = new Date();
  152. let year = date.getFullYear();
  153. let month = date.getMonth() + 1;
  154. let day = date.getDate();
  155. if (type === "start") {
  156. year = year - 60;
  157. } else if (type === "end") {
  158. year = year + 2;
  159. }
  160. month = month > 9 ? month : "0" + month;
  161. day = day > 9 ? day : "0" + day;
  162. return `${year}-${month}-${day}`;
  163. },
  164. async gettodoList() {
  165. this.search.pageSize = 10;
  166. this.search.pageNum = 1;
  167. let list = await handleList(this.search);
  168. // /wx/SafetyController/handleList
  169. this.todoList = list.rows;
  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>