assetsOperation.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <div class="detail">
  3. <mt-header class="detail_head" fixed title="操作记录">
  4. <router-link to="" slot="left">
  5. <mt-button icon="back" v-on:click="jumpBack()"></mt-button>
  6. </router-link>
  7. <mt-button slot="right" v-on:click="exportExcel()">导出</mt-button>
  8. </mt-header>
  9. <div class="detail_body">
  10. <mt-navbar v-model="selected" class="tab_head" v-on:click.native="changeTab">
  11. <mt-tab-item id="tab1">处置记录</mt-tab-item>
  12. <mt-tab-item id="tab2">维护记录</mt-tab-item>
  13. </mt-navbar>
  14. <mt-tab-container v-model="selected">
  15. <mt-tab-container-item id="tab1">
  16. <div class="noList" v-if="disList.length==0">
  17. <img src="../../assets/image/noList.png">
  18. </div>
  19. <ul v-else class="recordBox" v-infinite-scroll="loadMoreDis" infinite-scroll-disabled="loading" infinite-scroll-distance="10">
  20. <li v-for="item in disList" class="one_recordBox detailBox">
  21. <div class="record_head">
  22. <div>{{item.modelNo}}</div>
  23. <span v-if="item.goodState == 0">未用</span>
  24. <span v-if="item.goodState == 1">在用</span>
  25. <span v-if="item.goodState == 3">报废</span>
  26. </div>
  27. <div class="record_body">
  28. <div>处置人:{{item.userName}}</div>
  29. <div>处置时间:{{item.indate}}</div>
  30. <div>操作:{{item.content}}</div>
  31. </div>
  32. </li>
  33. <div class="order" v-if="haveMoreDis">
  34. <span class="line"></span>
  35. <span class="txt">没有更多了</span>
  36. <span class="line"></span>
  37. </div>
  38. </ul>
  39. </mt-tab-container-item>
  40. <mt-tab-container-item id="tab2">
  41. <div class="noList" v-if="maiList.length==0">
  42. <img src="../../assets/image/noList.png">
  43. </div>
  44. <ul v-else class="recordBox" v-infinite-scroll="loadMoreMai" infinite-scroll-disabled="loading" infinite-scroll-distance="10">
  45. <li v-for="item in maiList" class="one_recordBox detailBox">
  46. <div class="record_head">
  47. {{item.modelNo}}
  48. </div>
  49. <div class="record_body">
  50. <div>维护人:{{item.operator}}</div>
  51. <div>联系方式:{{item.operatorPhone}}</div>
  52. <div>维护厂家:{{item.company}}</div>
  53. <div>联系方式:{{item.companyPhone}}</div>
  54. </div>
  55. </li>
  56. <div class="order" v-if="haveMoreDis">
  57. <span class="line"></span>
  58. <span class="txt">没有更多了</span>
  59. <span class="line"></span>
  60. </div>
  61. </ul>
  62. </mt-tab-container-item>
  63. </mt-tab-container>
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. export default {
  69. data() {
  70. return {
  71. id: this.$route.params.id,
  72. selected: "tab1",
  73. disList: [],
  74. disPageNum: 1,
  75. disPages: 1,
  76. haveMoreDis: false,
  77. maiList: [],
  78. maiPageNum: 1,
  79. maiPages: 1,
  80. haveMoreMai: false,
  81. }
  82. },
  83. methods: {
  84. // 处置记录
  85. getListDis() {
  86. this.$indicator.open();
  87. this.http.post(this.port.assets.disposalRecord, {
  88. 'id': this.id,
  89. 'pageNum': 1
  90. } ,
  91. res => {
  92. this.$indicator.close();
  93. if (res.code == "ok") {
  94. this.disList = res.data.list;
  95. this.disPages = res.data.pages==0?1:res.data.pages;
  96. } else {
  97. this.$toast({
  98. message: res.msg,
  99. duration: 2000
  100. });
  101. }
  102. }, error => {
  103. this.$indicator.close();
  104. this.$toast({
  105. message: error,
  106. duration: 2000
  107. });
  108. })
  109. },
  110. loadMoreDis() {
  111. if(this.disPageNum == this.disPages) {
  112. this.haveMoreDis = true;
  113. } else if(this.disPageNum < this.disPages) {
  114. this.$indicator.open();
  115. this.http.post(this.port.assets.disposalRecord, {
  116. 'id': this.id,
  117. 'pageNum': ++this.disPageNum
  118. } ,
  119. res => {
  120. this.$indicator.close();
  121. if (res.code == "ok") {
  122. this.disPages = res.data.pages==0?1:res.data.pages;
  123. if(res.data.list.length != 0) {
  124. for(var i in res.data.list) {
  125. this.disList.push(res.data.list[i]);
  126. }
  127. }
  128. } else {
  129. this.$toast({
  130. message: res.msg,
  131. duration: 2000
  132. });
  133. }
  134. }, error => {
  135. this.$indicator.close();
  136. this.$toast({
  137. message: error,
  138. duration: 2000
  139. });
  140. })
  141. }
  142. },
  143. // 维护记录
  144. getListMai() {
  145. this.$indicator.open();
  146. this.http.post(this.port.assets.maintainRecord, {
  147. 'id': this.id,
  148. 'pageNum': 1
  149. } ,
  150. res => {
  151. this.$indicator.close();
  152. if (res.code == "ok") {
  153. this.maiList = res.data.list;
  154. this.maiPages = res.data.pages==0?1:res.data.pages;
  155. } else {
  156. this.$toast({
  157. message: res.msg,
  158. duration: 2000
  159. });
  160. }
  161. }, error => {
  162. this.$indicator.close();
  163. this.$toast({
  164. message: error,
  165. duration: 2000
  166. });
  167. })
  168. },
  169. loadMoreMai() {
  170. if(this.maiPageNum == this.maiPages) {
  171. this.haveMoreMai = true;
  172. } else if(this.maiPageNum < this.maiPages) {
  173. this.$indicator.open();
  174. this.http.post(this.port.assets.maintainRecord, {
  175. 'id': this.id,
  176. 'pageNum': ++this.maiPageNum
  177. } ,
  178. res => {
  179. this.$indicator.close();
  180. if (res.code == "ok") {
  181. this.maiPages = res.data.pages==0?1:res.data.pages;
  182. if(res.data.list.length != 0) {
  183. for(var i in res.data.list) {
  184. this.maiList.push(res.data.list[i]);
  185. }
  186. }
  187. } else {
  188. this.$toast({
  189. message: res.msg,
  190. duration: 2000
  191. });
  192. }
  193. }, error => {
  194. this.$indicator.close();
  195. this.$toast({
  196. message: error,
  197. duration: 2000
  198. });
  199. })
  200. }
  201. },
  202. changeTab() {
  203. if(this.selected == "tab1") {
  204. this.getListDis();
  205. } else {
  206. this.getListMai();
  207. }
  208. },
  209. // 导出
  210. exportExcel() {
  211. this.$indicator.open();
  212. if(this.selected == "tab1") {
  213. this.http.downloadFile(this.port.assets.exportDis, {
  214. 'id': this.id,
  215. } ,
  216. res => {
  217. this.$indicator.close();
  218. let url = window.URL.createObjectURL(new Blob([res]))
  219. let link = document.createElement('a')
  220. link.style.display = 'none'
  221. link.href = url
  222. link.setAttribute('download', '操作记录.xlsx')
  223. document.body.appendChild(link)
  224. link.click()
  225. }, error => {
  226. this.$indicator.close();
  227. this.$toast({
  228. message: error,
  229. duration: 2000
  230. });
  231. })
  232. } else {
  233. this.http.downloadFile(this.port.assets.exportMain, {
  234. 'id': this.id,
  235. } ,
  236. res => {
  237. this.$indicator.close();
  238. this.$indicator.close();
  239. let url = window.URL.createObjectURL(new Blob([res]))
  240. let link = document.createElement('a')
  241. link.style.display = 'none'
  242. link.href = url
  243. link.setAttribute('download', '操作记录.xlsx')
  244. document.body.appendChild(link)
  245. link.click()
  246. }, error => {
  247. this.$indicator.close();
  248. this.$toast({
  249. message: error,
  250. duration: 2000
  251. });
  252. })
  253. }
  254. },
  255. jumpBack() {
  256. this.$router.go(-1);
  257. }
  258. },
  259. created() {
  260. this.getListDis();
  261. },
  262. mounted() {
  263. }
  264. }
  265. </script>
  266. <style scoped>
  267. body {
  268. background: #EFEFEF;
  269. }
  270. .detail_head {
  271. background: #fff;
  272. color: #333;
  273. height: 0.4rem;
  274. }
  275. .detail_body {
  276. margin-top: 0.8rem;
  277. padding-bottom: 0.15rem;
  278. }
  279. .tab_head {
  280. position: fixed;
  281. width: 100%;
  282. top: 0.4rem;
  283. z-index: 110;
  284. border-bottom: 1px solid #ddd;
  285. }
  286. .detail {
  287. background: #EFEFEF;
  288. }
  289. .detailBox {
  290. background: #fff;
  291. margin-bottom: 0.11rem;
  292. }
  293. .recordBox {
  294. margin: 0.12rem 0 0 0;
  295. }
  296. .one_recordBox {
  297. padding: 0.12rem 0.2rem;
  298. }
  299. .record_head {
  300. color: #5FA1F0;
  301. padding: 0 0 0.1rem 0;
  302. border-bottom: 1px solid #ccc;
  303. }
  304. .record_head > div {
  305. width: 85%;
  306. display: inline-block;
  307. vertical-align: middle;
  308. }
  309. .record_head span {
  310. color: #939393;
  311. float: right;
  312. vertical-align: middle;
  313. }
  314. .record_body {
  315. color: #777;
  316. font-size: 0.12rem;
  317. line-height: 0.23rem;
  318. margin-top: 0.12rem;
  319. }
  320. .noList {
  321. text-align: center;
  322. padding: 1.5rem 0;
  323. }
  324. .noList img {
  325. width: 1.2rem;
  326. height: 1.2rem;
  327. }
  328. .order {
  329. height: 0.6rem;
  330. line-height: 0.6rem;
  331. text-align: center;
  332. }
  333. .order .line {
  334. display: inline-block;
  335. width: 1.2rem;
  336. border-top: 1px solid #ccc ;
  337. vertical-align: middle;
  338. }
  339. .order .txt {
  340. color: #ccc;
  341. font-size: 0.13rem;
  342. vertical-align: middle;
  343. }
  344. </style>