list.vue 6.7 KB

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