assetRecord.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div class="app-container">
  3. <el-row style="margin-bottom: 20px">
  4. <el-col :span="24">
  5. <el-button type="primary" @click="backToDetail">返回</el-button>
  6. <span style="margin: 0 20px 0 50px">搜索</span>
  7. <el-input
  8. placeholder="输入资产编号搜索"
  9. v-model="keyword"
  10. clearable
  11. @keyup.enter.native="changeKeyword"
  12. style="width:200px"
  13. ></el-input>
  14. <!-- @blur="changeKeyword" -->
  15. <el-button style="float:right" @click="exportRecord">导出</el-button>
  16. </el-col>
  17. </el-row>
  18. <!-- 标签页 -->
  19. <el-tabs v-model="tabsName">
  20. <el-tab-pane label="处置记录" name="0">
  21. <!-- 处置记录列表 -->
  22. <el-table :data="operationData" v-loading="loading" width="100%">
  23. <el-table-column type="index" width="40"></el-table-column>
  24. <el-table-column prop="modelNo" label="资产编号" width="160"></el-table-column>
  25. <el-table-column prop="userName" label="处置人" width="80"></el-table-column>
  26. <el-table-column prop="indate" label="处置时间" width="100"></el-table-column>
  27. <el-table-column prop="content" label="处置详情"></el-table-column>
  28. </el-table>
  29. <!-- 页码区域 -->
  30. <el-pagination
  31. @size-change="handleSizeChange1"
  32. @current-change="handleCurrentChange1"
  33. :current-page="pageIndex1"
  34. :page-sizes="[20, 50, 100]"
  35. :page-size="20"
  36. layout="total, sizes, prev, pager, next, jumper"
  37. :total="total1"
  38. background
  39. style="float:right"
  40. ></el-pagination>
  41. </el-tab-pane>
  42. <!-- 维护记录 -->
  43. <el-tab-pane label="维护记录" name="1">
  44. <!-- 维护记录列表 -->
  45. <el-table :data="maintainData" v-loading="loading" width="100%">
  46. <el-table-column type="index" width="40"></el-table-column>
  47. <el-table-column prop="modelNo" label="资产编号"></el-table-column>
  48. <el-table-column prop="operator" label="维护人" width="80"></el-table-column>
  49. <el-table-column prop="operator" label="维护人联系方式" width="120"></el-table-column>
  50. <el-table-column prop="operator" label="维护厂家" width="100"></el-table-column>
  51. <el-table-column prop="operator" label="维护厂家联系方式" width="140"></el-table-column>
  52. <el-table-column prop="indate" label="处置时间" width="100"></el-table-column>
  53. </el-table>
  54. <!-- 页码区域 -->
  55. <el-pagination
  56. @size-change="handleSizeChange2"
  57. @current-change="handleCurrentChange2"
  58. :current-page="pageIndex2"
  59. :page-sizes="[20, 50, 100]"
  60. :page-size="20"
  61. layout="total, sizes, prev, pager, next, jumper"
  62. :total="total2"
  63. background
  64. style="float:right"
  65. ></el-pagination>
  66. </el-tab-pane>
  67. </el-tabs>
  68. </div>
  69. </template>
  70. <script>
  71. import request from "@/utils/request";
  72. export default {
  73. data() {
  74. return {
  75. assetId: this.$route.params.id,
  76. maintainData: [],
  77. operationData: [],
  78. keyword: "",
  79. loading: false,
  80. tabsName: 0,
  81. //分页相关
  82. pageIndex1: 1,
  83. pageSize1: 20,
  84. total1: 0,
  85. pageIndex2: 1,
  86. pageSize2: 20,
  87. total2: 0
  88. };
  89. },
  90. methods: {
  91. //获取处置记录
  92. getManagementRecord() {
  93. this.loading = true;
  94. request({
  95. url: "/maintain-record/getOperationRecordByPage",
  96. method: "post",
  97. params: {
  98. id: this.assetId,
  99. pageIndex: this.pageIndex1,
  100. pageSize: this.pageSize1,
  101. keyword: this.keyword
  102. }
  103. })
  104. .then(response => {
  105. this.operationData = response.data.records;
  106. this.total1 = response.data.total;
  107. this.loading = false;
  108. })
  109. .catch(error => {
  110. this.loading = false;
  111. });
  112. },
  113. //获取维修记录
  114. getMaintainRecord() {
  115. this.loading = true;
  116. request({
  117. url: "/maintain-record/getMaintainRecordByPage",
  118. method: "post",
  119. params: {
  120. id: this.assetId,
  121. pageIndex: this.pageIndex2,
  122. pageSize: this.pageSize2,
  123. keyword: this.keyword
  124. }
  125. })
  126. .then(response => {
  127. this.maintainData = response.data.records;
  128. this.total2 = response.data.total;
  129. this.loading = false;
  130. })
  131. .catch(error => {
  132. this.loading = false;
  133. });
  134. },
  135. //导出记录
  136. exportRecord() {
  137. this.loading = true;
  138. request({
  139. url: "/maintain-record/exportExcel",
  140. method: "post",
  141. params: {
  142. id: this.assetId,
  143. type: this.tabsName
  144. }
  145. })
  146. .then(response => {
  147. location.href = "http://localhost:9102/img" + response.data;
  148. this.loading = false;
  149. })
  150. .catch(error => {
  151. this.loading = false;
  152. });
  153. },
  154. downloadFile() {},
  155. //改变关键字
  156. changeKeyword() {
  157. this.getManagementRecord();
  158. this.getMaintainRecord();
  159. },
  160. //页码规格变更1
  161. handleSizeChange1(val) {
  162. this.pageSize1 = val;
  163. this.getManagementRecord();
  164. },
  165. //页码页数变更1
  166. handleCurrentChange1(val) {
  167. this.pageIndex1 = val;
  168. this.getManagementRecord();
  169. },
  170. //页码规格变更2
  171. handleSizeChange2(val) {
  172. this.pageSize2 = val;
  173. this.getMaintainRecord();
  174. },
  175. //页码页数变更2
  176. handleCurrentChange2(val) {
  177. this.pageIndex2 = val;
  178. this.getMaintainRecord();
  179. },
  180. //回到前一个页面
  181. backToDetail() {
  182. this.$router.go(-1);
  183. }
  184. },
  185. mounted() {
  186. this.getManagementRecord();
  187. this.getMaintainRecord();
  188. }
  189. };
  190. </script>
  191. <style scoped>
  192. </style>