chemicalsInfo.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. <!-- 化学品信息(扫码进入) -->
  2. <template>
  3. <view id="chemicalsInfo">
  4. <view class="info-data-box">
  5. <img class="logo-img" :src="circularLogo">
  6. <view class="title-box">
  7. <view class="title-one-box">
  8. <span>{{newData.chemicalName}}</span>
  9. <span class="color-border">{{newData.chemicalLevel == 1?'管控':'非管控'}}</span>
  10. <span :class="newData.useStatus == 0 || newData.useStatus == -1?'colorA':(
  11. newData.useStatus == 1 || newData.useStatus == 5?'colorB':(
  12. newData.useStatus == 2 ?'colorC':(
  13. newData.useStatus == 3 ?'colorD':(
  14. newData.useStatus == 4 ?'colorE':''))))">
  15. {{newData.useStatus == 0 || newData.useStatus == -1?'未使用':(
  16. newData.useStatus==1 || newData.useStatus==5?'使用中':(
  17. newData.useStatus==2?'超时未归还':(
  18. newData.useStatus==3?'空瓶出库':(
  19. newData.useStatus==4?'废弃出库':''))))}}
  20. </span>
  21. </view>
  22. <view class="title-two-box">编号:{{newData.tagCode}}</view>
  23. <view class="title-three-box">余量:{{newData.surplus}}{{newData.specUnit}}</view>
  24. </view>
  25. </view>
  26. <view class="table-button-max-box">
  27. <view class="table-button-box" @click='tableButtonCheck(1)'
  28. :class="pageType==1?'checkClass':''">
  29. <view>基本信息</view>
  30. <view></view>
  31. </view>
  32. <view class="table-button-box" @click='tableButtonCheck(2)'
  33. :class="pageType==2?'checkClass':''">
  34. <view>使用记录</view>
  35. <view></view>
  36. </view>
  37. </view>
  38. <!-- 基础信息 -->
  39. <view class="info-max-big-box" v-if="pageType == 1">
  40. <view class="info-big-box">
  41. <view class="info-box">
  42. <view>C A S</view>
  43. <view>:</view>
  44. <view>{{newData.casNum}}</view>
  45. </view>
  46. <view class="info-box">
  47. <view>别名</view>
  48. <view>:</view>
  49. <view>{{newData.chemicalNameChar}}</view>
  50. </view>
  51. <view class="info-box">
  52. <view>类别</view>
  53. <view>:</view>
  54. <view>{{newData.chemicalCategory}}</view>
  55. </view>
  56. <view class="info-box">
  57. <view>规格</view>
  58. <view>:</view>
  59. <view>{{newData.specNum}}{{newData.specUnit?newData.specUnit+'/瓶':''}}</view>
  60. </view>
  61. <view class="info-box">
  62. <view>归属人</view>
  63. <view>:</view>
  64. <view>{{newData.belongName}}</view>
  65. </view>
  66. <view class="info-box">
  67. <view style="width:120rpx;">存储位置</view>
  68. <view>:</view>
  69. <view>{{newData.cabinetName}}{{newData.doorName?' - '+newData.doorName:''}}{{newData.layers?' - '+newData.layers:''}}</view>
  70. </view>
  71. </view>
  72. <view class="info-big-box">
  73. <view class="info-box">
  74. <view>学院</view>
  75. <view>:</view>
  76. <view>{{newData.deptName}}</view>
  77. </view>
  78. <view class="info-box">
  79. <view>楼栋</view>
  80. <view>:</view>
  81. <view>{{newData.schoolName}} - {{newData.buildName}}</view>
  82. </view>
  83. <view class="info-box">
  84. <view>实验室</view>
  85. <view>:</view>
  86. <view>{{newData.subName}}{{newData.subRoom?'('+newData.subRoom+')':''}}</view>
  87. </view>
  88. </view>
  89. </view>
  90. <!-- 使用记录 -->
  91. <scroll-view class="info-list-box" v-if="pageType == 2" scroll-y @scrolltolower="scrollGet">
  92. <view class="for-max-big-box" v-for="(item,index) in dataList" :key="index">
  93. <view class="for-title-box">
  94. <view class="time-box">{{item.joinOutTime}}</view>
  95. <view class="position-top-right"
  96. :class="item.type == 0?'colorF':(
  97. item.type == 1?'colorD':(
  98. item.type == 3?'colorD':(
  99. item.type == 4?'colorE':(
  100. item.type == 5?'colorD':(
  101. item.type == 6?'colorG':'')))))">
  102. {{item.type == 0?'归还':(
  103. item.type == 1?'领用':(
  104. item.type == 3?'空瓶出库':(
  105. item.type == 4?'废弃出库':(
  106. item.type == 5?'整瓶领用':(
  107. item.type == 6?'存储':'')))))}}
  108. </view>
  109. <view class="border-box"></view>
  110. <view class="position-left"></view>
  111. <view class="position-right"></view>
  112. </view>
  113. <!-- 领用/整瓶领用 -->
  114. <view class="for-info-box" v-if="item.type == 1 || item.type == 5">
  115. <view class="for-info-min-box">
  116. <view>领用人</view>
  117. <view>:</view>
  118. <view>{{item.useName}}</view>
  119. </view>
  120. <view class="for-info-min-box">
  121. <view>领用量</view>
  122. <view>:</view>
  123. <view>{{item.collectStockNum}}</view>
  124. </view>
  125. <view class="for-info-min-box">
  126. <view style="width:120rpx;">双人认证</view>
  127. <view>:</view>
  128. <view>{{item.oneUserName}}</view>
  129. </view>
  130. </view>
  131. <!-- 存储 -->
  132. <view class="for-info-box" v-if="item.type == 6">
  133. <view class="for-info-min-box">
  134. <view>存储人</view>
  135. <view>:</view>
  136. <view>{{item.useName}}</view>
  137. </view>
  138. <view class="for-info-min-box">
  139. <view>余量</view>
  140. <view>:</view>
  141. <view>{{item.surplus}}</view>
  142. </view>
  143. <view class="for-info-min-box">
  144. <view style="width:120rpx;">双人认证</view>
  145. <view>:</view>
  146. <view>{{item.oneUserName}}</view>
  147. </view>
  148. </view>
  149. <!-- 废弃出库/空瓶出库 -->
  150. <view class="for-info-box" v-if="item.type == 3 ||item.type == 4">
  151. <view class="for-info-min-box">
  152. <view>废弃人</view>
  153. <view>:</view>
  154. <view>{{item.useName}}</view>
  155. </view>
  156. <view class="for-info-min-box">
  157. <view style="width:120rpx;">双人认证</view>
  158. <view>:</view>
  159. <view>{{item.oneUserName}}</view>
  160. </view>
  161. <view class="for-info-min-box">
  162. <view style="width:120rpx;">出库原因</view>
  163. <view>:</view>
  164. <view>{{item.reason}}</view>
  165. </view>
  166. </view>
  167. <!-- 归还 -->
  168. <view class="for-info-box" v-if="item.type == 0">
  169. <view class="for-info-min-box">
  170. <view>归还人</view>
  171. <view>:</view>
  172. <view>{{item.useName}}</view>
  173. </view>
  174. <view class="for-info-min-box">
  175. <view>使用量</view>
  176. <view>:</view>
  177. <view>{{item.usages}}</view>
  178. </view>
  179. <view class="for-info-min-box">
  180. <view>余量</view>
  181. <view>:</view>
  182. <view>{{item.surplus}}</view>
  183. </view>
  184. <view class="for-info-min-box">
  185. <view style="width:120rpx;">双人认证</view>
  186. <view>:</view>
  187. <view>{{item.oneUserName}}</view>
  188. </view>
  189. </view>
  190. </view>
  191. <view class="null-box" v-if="!dataList[0]">
  192. <img :src="imagesUrl('commonality/chemicalsInfoNull.png')">
  193. <view>暂无数据</view>
  194. </view>
  195. <view class="get-null-box" v-if="getDataType">仅展示最近三个月使用记录</view>
  196. </scroll-view>
  197. </view>
  198. </template>
  199. <script>
  200. import {
  201. chemicalAppletSelectStockRecord,
  202. } from '@/pages_basics/api/index.js'
  203. export default {
  204. data() {
  205. return {
  206. circularLogo: uni.getStorageSync('circularLogo'),
  207. newData:{},
  208. pageType:1,
  209. //使用记录 相关
  210. queryParams: {
  211. page: 1,
  212. pageSize: 10,
  213. },
  214. total: 0,
  215. dataList: [],
  216. getDataType: false,
  217. }
  218. },
  219. onLoad(option) {
  220. if(option.item){
  221. let obj = JSON.parse(decodeURIComponent(option.item))
  222. this.$set(this,'newData',obj);
  223. }
  224. },
  225. onShow() {
  226. this.getList();
  227. },
  228. methods: {
  229. tableButtonCheck(type){
  230. if(this.pageType != type){
  231. this.$set(this,'pageType',type);
  232. }
  233. },
  234. //滚动事件
  235. scrollGet() {
  236. let self = this;
  237. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  238. this.$set(this, 'getDataType', true);
  239. } else {
  240. this.queryParams.page += 1;
  241. this.$nextTick(() => {
  242. this.getList();
  243. })
  244. }
  245. },
  246. async getList(){
  247. let self = this;
  248. let obj = JSON.parse(JSON.stringify(this.queryParams))
  249. obj.tagCode = this.newData.code;
  250. const {
  251. data
  252. } = await chemicalAppletSelectStockRecord(obj);
  253. if (data.code == 200) {
  254. if (self.queryParams.page == 1) {
  255. this.$set(this,'dataList',data.data.records);
  256. this.$set(this,'total',data.data.total);
  257. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  258. this.$set(this, 'getDataType', true);
  259. }
  260. } else {
  261. this.$set(this,'dataList',[...this.dataList, ...data.data.records]);
  262. this.$set(this,'total',data.data.total);
  263. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  264. this.$set(this, 'getDataType', true);
  265. }
  266. }
  267. }
  268. },
  269. },
  270. }
  271. </script>
  272. <style lang="stylus" scoped>
  273. #chemicalsInfo {
  274. height: 100%;
  275. display flex;
  276. flex-direction: column;
  277. .info-data-box{
  278. display: flex;
  279. background-color: #fff;
  280. padding-bottom:40rpx;
  281. .logo-img{
  282. width:120rpx;
  283. height:120rpx;
  284. display: inline-block;
  285. margin:40rpx 40rpx 0 30rpx;
  286. }
  287. .title-box{
  288. flex:1;
  289. .title-one-box{
  290. margin:28rpx 47rpx 0 0;
  291. span:nth-child(1){
  292. font-size:30rpx;
  293. color:#333;
  294. line-height:45rpx;
  295. font-size:30rpx;
  296. font-weight:700;
  297. }
  298. span:nth-child(2){
  299. display: inline-block;
  300. min-width:100rpx;
  301. height:34rpx;
  302. line-height:32rpx;
  303. font-size:24rpx;
  304. margin:0 10rpx 0;
  305. text-align: center;
  306. border-radius:6rpx;
  307. }
  308. span:nth-child(3){
  309. display: inline-block;
  310. min-width:120rpx;
  311. height:34rpx;
  312. line-height:32rpx;
  313. font-size:24rpx;
  314. margin:0 10rpx 0;
  315. text-align: center;
  316. border-radius:6rpx;
  317. }
  318. }
  319. .title-two-box{
  320. line-height:50rpx;
  321. font-size:28rpx;
  322. margin-top:10rpx;
  323. }
  324. .title-three-box{
  325. line-height:50rpx;
  326. font-size:28rpx;
  327. }
  328. }
  329. }
  330. .table-button-max-box{
  331. display: flex;
  332. height:100rpx;
  333. .table-button-box{
  334. height:75rpx;
  335. width:120rpx;
  336. margin:25rpx 30rpx 0 30rpx;
  337. view:nth-child(1){
  338. font-size:30rpx;
  339. line-height:50rpx;
  340. height:50rpx;
  341. }
  342. }
  343. .checkClass{
  344. view:nth-child(1){
  345. color:#0183FA;
  346. }
  347. view:nth-child(2){
  348. height:4rpx;
  349. width:90rpx;
  350. margin:0 15rpx;
  351. background-color:#0183FA;
  352. }
  353. }
  354. }
  355. .info-max-big-box{
  356. margin:0 30rpx 0;
  357. .info-big-box{
  358. background-color:#fff;
  359. margin-bottom:20rpx;
  360. border-radius:20rpx;
  361. .info-box:nth-child(1){
  362. border-top:none;
  363. }
  364. .info-box{
  365. display: flex;
  366. border-top:1rpx solid #E0E0E0;
  367. margin:0 30rpx;
  368. view{
  369. line-height:80rpx;
  370. font-size:28rpx;
  371. color:#333;
  372. }
  373. view:nth-child(1){
  374. width:90rpx;
  375. text-align: justify;
  376. word-break: break-all;
  377. text-align-last: justify;
  378. }
  379. view:nth-child(2){
  380. margin-left:5rpx;
  381. }
  382. view:nth-child(3){
  383. flex:1;
  384. text-align: right;
  385. line-height:30rpx;
  386. padding:25rpx 0 25rpx 25rpx;
  387. }
  388. }
  389. }
  390. }
  391. .info-list-box{
  392. flex: 1;
  393. overflow: scroll;
  394. .for-max-big-box{
  395. background-color: #fff;
  396. margin:0 30rpx 20rpx 30rpx;
  397. border-radius:10rpx;
  398. .for-title-box{
  399. height:118rpx;
  400. position: relative;
  401. overflow: hidden;
  402. .time-box{
  403. height:100rpx;
  404. line-height:93rpx;
  405. font-size:28rpx;
  406. color:#333;
  407. padding-left:30rpx;
  408. }
  409. .position-top-right{
  410. position: absolute;
  411. top:0;
  412. right:0;
  413. width:100rpx;
  414. height:36rpx;
  415. line-height:36rpx;
  416. font-size:24rpx;
  417. text-align: center;
  418. border-radius: 0rpx 10rpx 0rpx 6rpx;
  419. }
  420. .colorA{
  421. color:#0183FA;
  422. background: rgba(1,131,250,0.2);
  423. }
  424. .colorB{
  425. color:#07BC11;
  426. background: rgba(7,188,17,0.2);
  427. }
  428. .border-box{
  429. border-top:1rpx dashed #F5F5F5;
  430. height:18rpx;
  431. }
  432. .position-left{
  433. width:30rpx;
  434. height:30rpx;
  435. z-index:1;
  436. position:absolute;
  437. bottom:3rpx;
  438. left:-15rpx;
  439. background-color: #F5F5F5;
  440. border-radius:50%;
  441. }
  442. .position-right{
  443. width:30rpx;
  444. height:30rpx;
  445. z-index:1;
  446. position:absolute;
  447. bottom:3rpx;
  448. right:-15rpx;
  449. background-color: #F5F5F5;
  450. border-radius:50%;
  451. }
  452. }
  453. .for-info-box{
  454. .for-info-min-box{
  455. display: flex;
  456. padding:0 30rpx;
  457. view{
  458. line-height:80rpx;
  459. font-size:28rpx;
  460. color:#333;
  461. }
  462. view:nth-child(1){
  463. width:90rpx;
  464. text-align: justify;
  465. word-break: break-all;
  466. text-align-last: justify;
  467. }
  468. view:nth-child(2){
  469. margin-left:5rpx;
  470. }
  471. view:nth-child(3){
  472. flex:1;
  473. text-align: right
  474. line-height:30rpx;
  475. padding:25rpx 0 25rpx 25rpx;
  476. }
  477. }
  478. }
  479. }
  480. .null-box{
  481. img{
  482. width:300rpx;
  483. height:300rpx;
  484. margin:150rpx 225rpx 0;
  485. display: inline-block;
  486. }
  487. view{
  488. color:#999;
  489. font-size:28rpx;
  490. line-height:40rpx;
  491. text-align: center;
  492. margin-top:15rpx;
  493. }
  494. }
  495. .get-null-box {
  496. height: 100rpx;
  497. line-height: 100rpx;
  498. color: #999;
  499. text-align center
  500. padding-bottom:200rpx;
  501. }
  502. }
  503. //管控/非管控
  504. .color-border{
  505. border:1px solid #0183FA;
  506. background: #fff;
  507. color:#0183FA;
  508. }
  509. //未使用
  510. .colorA{
  511. border:1px solid #EDEDED;
  512. background: #EDEDED;
  513. color:#999;
  514. }
  515. //使用中
  516. .colorB{
  517. border:1px solid rgba(1,131,250,0.2);
  518. background: rgba(1,131,250,0.2);
  519. color:#0183FA;
  520. }
  521. //超时未归还
  522. .colorC{
  523. border:1px solid rgba(255,140,0,0.2);
  524. background: rgba(255,140,0,0.2);
  525. color:#FF8C00;
  526. }
  527. //空瓶出库
  528. .colorD{
  529. border:1px solid rgba(43,128,255,0.2);
  530. background: rgba(43,128,255,0.2);
  531. color:#2B80FF;
  532. }
  533. //废弃出库
  534. .colorE{
  535. border:1px solid #D6D6D6;
  536. background: #D6D6D6;
  537. color:#666666;
  538. }
  539. //归还
  540. .colorF{
  541. border:1px solid rgba(7,188,17,0.2);
  542. background: rgba(7,188,17,0.2);
  543. color:#07BC11;
  544. }
  545. //存储
  546. .colorG{
  547. border:1px solid rgba(0,185,191,0.2);
  548. background: rgba(0,185,191,0.2);
  549. color:#00B9BF;
  550. }
  551. }
  552. </style>