list.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <!-- @format -->
  2. <template>
  3. <view class="" style="padding-bottom: 20rpx">
  4. <view style="height: 105rpx"></view>
  5. <view class="container">
  6. <view
  7. style="
  8. background: #fff;
  9. width: 100%;
  10. height: 105rpx;
  11. position: fixed;
  12. padding: 20rpx 0;
  13. top: 0rpx;
  14. "
  15. >
  16. <u-search
  17. @change="getList"
  18. v-model="queryParams.searchValue"
  19. shape="round"
  20. placeholder="请输入器具名称"
  21. ></u-search>
  22. </view>
  23. <view style="margin-top: 3rpx">
  24. <view
  25. class="contentItems"
  26. v-for="item of ledgerList"
  27. :key="item.id"
  28. @click="handleDetails(item)"
  29. >
  30. <view class="ledgerName">
  31. <view style="font-weight: bold"> {{ item.name }} </view>
  32. <view style="color: rgb(146, 146, 146)">
  33. {{ item.createTime }}
  34. </view>
  35. </view>
  36. <view class="info">
  37. <view class="verification status">
  38. <view>出厂编号:</view>
  39. <view style="color: #fa3534">{{ item.serialNumber }}</view>
  40. </view>
  41. <view class="appStatus status">
  42. <view>检定状态:</view>
  43. <view
  44. :style="{
  45. color:
  46. verificationColor[verificationStatus(item.checkStatus)],
  47. }"
  48. >{{ verificationStatus(item.checkStatus) }}</view
  49. >
  50. </view>
  51. <view class="status">
  52. <view>申请状态:</view>
  53. <view
  54. :style="{
  55. color:
  56. applicationColor[applicationStatus(item.checkRecordStatus)],
  57. }"
  58. >{{ applicationStatus(item.checkRecordStatus) }}</view
  59. >
  60. </view>
  61. <view class="status">
  62. <view>备案状态:</view>
  63. <view
  64. :style="{
  65. color: recordColor[recordStatus(item.fillingStatus)],
  66. }"
  67. >{{ recordStatus(item.fillingStatus) }}</view
  68. >
  69. </view>
  70. </view>
  71. <!-- <view class="ledgerNameBottom">
  72. <view>在用</view>
  73. </view> -->
  74. <view class="date"></view>
  75. </view>
  76. <view style="height: 10rpx"></view>
  77. </view>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. import { getLedgerList } from "@/api/Ledger";
  83. import { useDict, paraseDict } from "@/utils/index";
  84. export default {
  85. data() {
  86. return {
  87. total: 0,
  88. verificationColor: {
  89. 未检定: "#909399",
  90. 已校准: "#19be6b",
  91. 已检定: "#19be6b",
  92. 不合格: "#fa3534",
  93. 已超期: "#fa3534",
  94. },
  95. applicationColor: {
  96. 已中止: "#fa3534",
  97. 已完成: "#19be6b",
  98. 未申请: "#909399",
  99. 不受理: "#fa3534",
  100. 办理中: "#2979ff",
  101. },
  102. recordColor: {
  103. 已撤回: "#fa3534",
  104. 已接收: "#19be6b",
  105. 待提交: "#2979ff",
  106. 备案中: "#2979ff",
  107. 已拒绝: "#fa3534",
  108. 勿备案: "#fa3534",
  109. 未备案: "#909399",
  110. 免备案: "#909399",
  111. 已退回: "#fa3534",
  112. },
  113. queryParams: {
  114. pageSize: 10,
  115. pageNum: 1,
  116. searchValue: null,
  117. },
  118. ledgerList: [],
  119. verification: [], //检定字典
  120. application: [], //申请字典
  121. record: [], //备案字典
  122. };
  123. },
  124. async onLoad() {
  125. useDict("ejian_instrCheckStatus").then((res) => {
  126. this.verification = res;
  127. });
  128. useDict("ejian_instrCheckRecordStatusV2").then((res) => {
  129. this.application = res;
  130. });
  131. useDict("ejian_instrFillingStatus").then((res) => {
  132. this.record = res;
  133. });
  134. this.getList();
  135. },
  136. computed: {
  137. //检定状态
  138. verificationStatus() {
  139. return (row) => {
  140. return paraseDict(this.verification, row);
  141. };
  142. },
  143. //申请状态
  144. applicationStatus() {
  145. return (row) => {
  146. return paraseDict(this.application, row);
  147. };
  148. },
  149. //备案状态
  150. recordStatus() {
  151. return (row) => {
  152. return paraseDict(this.record, row);
  153. };
  154. },
  155. },
  156. methods: {
  157. handleSearch() {
  158. console.log("搜索");
  159. },
  160. getList() {
  161. getLedgerList({ ...this.queryParams }).then(({ rows, total }) => {
  162. this.ledgerList = rows;
  163. this.total = total;
  164. });
  165. },
  166. handleDetails(row) {
  167. uni.navigateTo({
  168. url: "/pages/Ledger/details?id=" + row.id,
  169. success: (res) => {},
  170. fail: () => {},
  171. complete: () => {},
  172. });
  173. },
  174. onReachBottom() {
  175. //触底事件
  176. if (this.queryParams.pageNum * this.queryParams.pageSize >= this.total) {
  177. uni.showToast({
  178. title: "没有更多数据了",
  179. icon: "none",
  180. duration: 1000,
  181. });
  182. setTimeout(() => {
  183. uni.hideLoading();
  184. }, 500);
  185. } else {
  186. if (this.queryParams.pageNum <= this.queryParams.pageNum - 1) {
  187. setTimeout(() => {
  188. uni.hideLoading();
  189. }, 500);
  190. } else {
  191. uni.showLoading({
  192. title: "加载中",
  193. });
  194. this.queryParams.pageNum++;
  195. getLedgerList({ ...this.queryParams }).then(({ rows, total }) => {
  196. this.ledgerList = [...this.ledgerList, ...rows];
  197. this.total = total;
  198. });
  199. }
  200. setTimeout(() => {
  201. uni.hideLoading();
  202. }, 500);
  203. }
  204. },
  205. },
  206. };
  207. </script>
  208. <style lang="scss">
  209. .status {
  210. display: flex;
  211. color: rgb(146, 146, 146);
  212. align-items: center;
  213. margin: 10rpx 0;
  214. }
  215. .status view:last-child {
  216. font-weight: bold;
  217. margin-left: 20rpx;
  218. }
  219. .ledgerName {
  220. color: black;
  221. font-size: 28rpx;
  222. }
  223. .content {
  224. display: flex;
  225. justify-content: space-between;
  226. }
  227. .info {
  228. }
  229. .ledgerNameBottom {
  230. padding-top: 15rpx;
  231. border-top: 1px solid rgb(242, 242, 242);
  232. display: flex;
  233. & > view:first-child {
  234. width: 260rpx;
  235. color: rgb(146, 146, 146);
  236. }
  237. }
  238. .container {
  239. height: 100vh;
  240. // padding: 80rpx 0 40rpx;
  241. height: 100vh;
  242. background: rgb(243, 244, 249);
  243. .contentItems {
  244. width: 100%;
  245. background: #fff;
  246. margin: 6rpx auto;
  247. padding: 20rpx 30rpx 20rpx;
  248. .ledgerName {
  249. padding-bottom: 10rpx;
  250. border-bottom: 1px solid rgb(242, 242, 242);
  251. display: flex;
  252. & > view:first-child {
  253. width: 260rpx;
  254. overflow: hidden; /* 隐藏溢出的文本 */
  255. white-space: nowrap; /* 禁止文本换行 */
  256. text-overflow: ellipsis; /* 使用省略号表示被截断的文本 */
  257. }
  258. & > view:last-child {
  259. margin-left: auto;
  260. }
  261. }
  262. }
  263. }
  264. </style>