equipmentInspection.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <template>
  2. <view>
  3. <u-navbar title="设备检验" class="head">
  4. <view class="tabs" slot="bottom">
  5. <u-tabs bar-width="80" inactive-color="#777777" active-color="#101010" :list="list" :is-scroll="false"
  6. :current="current" @change="change"></u-tabs>
  7. <!-- <view class="screen" @click="changeShow()">
  8. 筛选<u-icon size="24" name="arrow-down" color="#777777"></u-icon>
  9. </view>
  10. <view class="options" v-if="this.show==true" @click="changeShow()">
  11. 选项3
  12. </view> -->
  13. </view>
  14. </u-navbar>
  15. <view class="listHead">
  16. <scroll-view scroll-y="true" @scrolltolower="onReachBottom()">
  17. <view class="list1">
  18. <view class="item" v-for="(item,i) in list[current].list" @click="ckInfo(item)" :key="i">
  19. <template v-if="list[current].isold">
  20. <view class="group">
  21. <view class="name">
  22. 检验日期:
  23. </view>
  24. <view class="value">
  25. {{item.createTime}}
  26. </view>
  27. </view>
  28. <view class="group">
  29. <view class="name">
  30. 检验人:
  31. </view>
  32. <view class="value">
  33. {{item.createByName}}
  34. </view>
  35. </view>
  36. </template>
  37. <template v-else>
  38. <view class="title">
  39. {{item.title}} <span class="titlespan" >编号:{{showCode(item)}}</span>
  40. </view>
  41. <view class="group">
  42. <view class="name">
  43. 上次检验日期:
  44. </view>
  45. <view class="value">
  46. {{item.experimentLastTime}}
  47. </view>
  48. </view>
  49. <view class="group">
  50. <view class="name">
  51. 检验周期:
  52. </view>
  53. <view class="value">
  54. {{item.experimentPeriod?item.experimentPeriod+'天':''}}
  55. </view>
  56. </view>
  57. </template>
  58. </view>
  59. <u-divider v-if="list[current].recordsTotal==list[current].list.length"
  60. :isnone="list[current].recordsTotal==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
  61. </view>
  62. </scroll-view>
  63. </view>
  64. <view class="bottom">
  65. <u-button type="primary" @click="addInfo">仓储检验</u-button>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. import * as API from '@/apis/pagejs/storeManagement.js'
  71. export default {
  72. data() {
  73. return {
  74. list: [{
  75. name: '待检验',
  76. pageIndex: 1,
  77. pageSize: 20,
  78. recordsTotal: 1,
  79. healthStatus: "5",
  80. iscount:true,
  81. count:0,
  82. list: []
  83. }, {
  84. name: '超期未完成',
  85. pageIndex: 1,
  86. pageSize: 20,
  87. recordsTotal: 1,
  88. healthStatus: "6",
  89. iscount:true,
  90. count:0,
  91. list: []
  92. }, {
  93. name: '检验历史',
  94. pageIndex: 1,
  95. pageSize: 20,
  96. recordsTotal: 1,
  97. healthStatus: "0",
  98. iscount:false,
  99. isold:true,
  100. count:0,
  101. list: []
  102. },
  103. {
  104. iscount:false,
  105. name: '不合格设备',
  106. pageIndex: 1,
  107. pageSize: 20,
  108. count:0,
  109. recordsTotal: 1,
  110. healthStatus: "2",
  111. list: []
  112. }
  113. ],
  114. current: 0,
  115. show: false
  116. }
  117. },
  118. onReachBottom() {
  119. var obj = this.list[this.current]
  120. if (obj.list.length < obj.recordsTotal) {
  121. this.myLoadmore();
  122. }
  123. },
  124. onReady() {
  125. this.getList()
  126. this.getNum()
  127. },
  128. methods: {
  129. addInfo(){
  130. var url = "./planDetail";
  131. uni.navigateTo({
  132. url: url,
  133. events: {
  134. refreshData: () => {
  135. this.init()
  136. }
  137. }
  138. })
  139. },
  140. getNum(){
  141. API.deviceList({
  142. pageIndex: 1,
  143. pageSize: 0,
  144. healthStatus: 6,
  145. }).then((res) => {
  146. uni.hideLoading();
  147. if(this.list[1].iscount){
  148. this.list[1].count=res.data.recordsTotal
  149. }
  150. }).catch(error => {
  151. uni.showToast({
  152. title: error,
  153. icon: "none"
  154. })
  155. })
  156. },
  157. getList() {
  158. uni.showLoading({
  159. title: "加载中",
  160. mask: true,
  161. })
  162. var isold= this.list[this.current].isold
  163. var list = this.list[this.current].list
  164. var obj = this.list[this.current]
  165. var listForm = {
  166. ...obj
  167. }
  168. delete listForm.list
  169. if(isold){
  170. this.inspectionList(listForm)
  171. }else{
  172. //listForm.projectName = this.queryContent;
  173. API.deviceList(listForm).then((res) => {
  174. uni.hideLoading();
  175. if (listForm.pageIndex == 1) {
  176. list = res.data.data;
  177. } else {
  178. list = [
  179. ...list,
  180. ...res.data.data
  181. ];
  182. }
  183. if(this.list[this.current].iscount){
  184. this.list[this.current].count=res.data.recordsTotal
  185. }
  186. if(this.current==0){
  187. this.carhelp.set("badgeList_deviceList",res.data.recordsTotal)
  188. }
  189. this.list[this.current].list = list
  190. this.list[this.current].recordsTotal = res.data.recordsTotal;
  191. }).catch(error => {
  192. uni.showToast({
  193. title: error,
  194. icon: "none"
  195. })
  196. })
  197. }
  198. },
  199. inspectionList(listForm){
  200. var list = this.list[this.current].list
  201. //listForm.projectName = this.queryContent;
  202. API.inspectionList(listForm).then((res) => {
  203. uni.hideLoading();
  204. if (listForm.pageIndex == 1) {
  205. list = res.data.data;
  206. } else {
  207. list = [
  208. ...list,
  209. ...res.data.data
  210. ];
  211. }
  212. if(this.list[this.current].iscount){
  213. this.list[this.current].count=res.data.recordsTotal
  214. }
  215. this.list[this.current].list = list
  216. this.list[this.current].recordsTotal = res.data.recordsTotal;
  217. }).catch(error => {
  218. uni.showToast({
  219. title: error,
  220. icon: "none"
  221. })
  222. })
  223. },
  224. myLoadmore() {
  225. this.list[this.current].pageIndex += 1;
  226. this.getList();
  227. },
  228. init() {
  229. this.current = 0
  230. for(var i in this.list){
  231. this.list[i].pageIndex = 1
  232. this.list[i].list=[]
  233. }
  234. this.getNum()
  235. this.getList()
  236. },
  237. ckInfo(item) {
  238. var url = "/pages/otherFunctions/equipmentRetrieval/equipmentInfo?id=" + item.id;
  239. if(this.list[this.current].isold){
  240. url="./inspectionRecord?id=" + item.id;
  241. }
  242. uni.navigateTo({
  243. url: url,
  244. // events: {
  245. // refreshData: () => {
  246. // this.init()
  247. // }
  248. // }
  249. })
  250. },
  251. change(index) {
  252. this.current = index;
  253. var list = this.list[this.current].list
  254. if (list.length == 0) {
  255. this.getList();
  256. }
  257. },
  258. changeShow() {
  259. this.show = !this.show
  260. }
  261. }
  262. }
  263. </script>
  264. <style lang="scss" scoped>
  265. page {
  266. padding-bottom: 100rpx;
  267. }
  268. .listHead{
  269. padding-bottom:60px;
  270. }
  271. .head {
  272. background: linear-gradient(180deg, rgba(190, 211, 240, 1) 0%, rgba(244, 244, 246, 1) 100%) !important;
  273. ::v-deep .u-navbar {
  274. //background: 0!important;
  275. background: linear-gradient(180deg, rgba(190, 211, 240, 1) 0%, rgba(244, 244, 246, 1) 100%) !important;
  276. height: 210rpx;
  277. //padding: 0 32rpx;
  278. }
  279. ::v-deep .u-border-bottom:after {
  280. height: 0;
  281. }
  282. .tabs {
  283. padding: 0 32rpx
  284. }
  285. }
  286. .tabs {
  287. //display: flex;flex-wrap: wrap;
  288. justify-content: space-between;
  289. align-items: center;
  290. ::v-deep .u-tabs {
  291. background: 0 !important;
  292. //width: 480rpx;
  293. }
  294. ::v-deep .u-tab-bar {
  295. background-color: #2A8EFB !important;
  296. }
  297. .screen {
  298. color: #415058;
  299. position: relative;
  300. font-family: Microsoft Yahei;
  301. ::v-deep .uicon-arrow-down {
  302. margin-left: 4rpx;
  303. }
  304. }
  305. .options {
  306. width: 120rpx;
  307. height: 60rpx;
  308. line-height: 60rpx;
  309. text-align: center;
  310. background-color: #fff;
  311. color: rgba(65, 80, 88, 1);
  312. font-family: Microsoft Yahei;
  313. position: absolute;
  314. top: 160rpx;
  315. right: 24rpx;
  316. box-shadow: 5px 5px 10px gray;
  317. }
  318. }
  319. .list1,
  320. .list2,
  321. .list3 {
  322. padding: 0 32rpx;
  323. margin-top: 60px;
  324. margin-bottom: 10px;
  325. .item {
  326. border-radius: 8px;
  327. background-color: rgba(255, 255, 255, 1);
  328. padding: 32rpx;
  329. margin-bottom: 24rpx;
  330. .title {
  331. color: rgba(51, 51, 51, 1);
  332. font-size: 36rpx;
  333. margin-bottom: 16rpx;
  334. .titlespan{
  335. font-size: 36rpx;
  336. float: right;
  337. }
  338. }
  339. .group {
  340. display: flex;flex-wrap: wrap;
  341. color: rgba(119, 119, 119, 1);
  342. margin-top: 16rpx;
  343. font-weight: bold;
  344. }
  345. }
  346. }
  347. .bottom {
  348. position: fixed;
  349. bottom: 0;
  350. left: 0;
  351. right: 0;
  352. background-color: #fff;
  353. padding: 16rpx 32rpx;
  354. uni-button {
  355. height: 88rpx;
  356. line-height: 88rpx;
  357. border-radius: 8px;
  358. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 0%, rgba(16, 98, 213, 1) 100%);
  359. color: rgba(255, 255, 255, 1);
  360. font-size: 32rpx;
  361. font-family: Microsoft Yahei;
  362. }
  363. }
  364. </style>