details.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <div class="app-container">
  3. <h1><i class="el-icon-arrow-left" @click="goBack"></i>批次电池详情</h1>
  4. <div class="top-info">
  5. 共计电池 <span>{{totalData}}</span>,未入库电池 <span>{{storage}}</span>,批次号: {{listQuery.batchNum}} ,录入时间: {{inTime}}
  6. </div>
  7. <el-form :inline="true" :model="listQuery" @keyup.enter.native="searchHandle()">
  8. <el-row>
  9. <el-col :span="6">
  10. <el-form-item label="设备IMEI">
  11. <el-input v-model="listQuery.imei" placeholder="请输入设备IMEI" clearable></el-input>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :span="6">
  15. <el-form-item label="设备SN">
  16. <el-input v-model="listQuery.sn" placeholder="请输入设备SN" clearable></el-input>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="6">
  20. <el-form-item label="状态">
  21. <el-select v-model="listQuery.statusStr" @change="changeHandle">
  22. <el-option v-for="item in statusOptins" :key="item.value" :label="item.label" :value="item.value"></el-option>
  23. </el-select>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :span="6">
  27. <div style="float: right;">
  28. <el-form-item>
  29. <el-button type="primary" @click="searchHandle()">搜索</el-button>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button @click="resetForm()">重置</el-button>
  33. </el-form-item>
  34. </div>
  35. </el-col>
  36. </el-row>
  37. </el-form>
  38. <el-table
  39. v-loading="loading"
  40. :data="data"
  41. element-loading-text="Loading"
  42. :header-cell-style="{background:'rgba(242, 242, 242, 1)',borderColor:'rgba(242, 242, 242, 1);',textAlign:'center'}"
  43. :cell-style="{'text-align':'center'}"
  44. fit
  45. highlight-current-row
  46. @sort-change="sortChange"
  47. >
  48. <el-table-column label="电池SN" sortable="custom">
  49. <template slot-scope="scope">
  50. {{ scope.row.sn || '-' }}
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="设备号IMEI" prop="plateNumber">
  54. <template slot-scope="scope">
  55. {{ scope.row.imei || '-' }}
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="电池类型" prop="vin">
  59. <template slot-scope="scope">
  60. {{ scope.row.typeTitle || '-' }}
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="PACK厂">
  64. <template slot-scope="scope">
  65. {{ scope.row.packTitle || '-' }}
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="产品规格">
  69. <template slot-scope="scope">
  70. {{ scope.row.specTitle || '-' }}
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="操作人">
  74. <template slot-scope="scope">
  75. {{ scope.row.operator || '-' }}
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="产品拓展">
  79. <template slot-scope="scope">
  80. {{ scope.row.expandTitle || '-' }}
  81. </template>
  82. </el-table-column>
  83. <el-table-column align="center" label="状态">
  84. <template slot-scope="scope">
  85. <span>{{ scope.row.statusTitle || '-' }}</span>
  86. </template>
  87. </el-table-column>
  88. <el-table-column align="center" label="发货时间">
  89. <template slot-scope="scope">
  90. <span>{{ scope.row.deliverTime || '-' }}</span>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. <el-pagination style="float: right; margin-top: 30px;" :current-page="listQuery.index" :page-sizes="[10, 20, 50, 100]" :page-size="listQuery.length" :total="total"
  95. layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle"
  96. @current-change="pageCurrentChangeHandle">
  97. </el-pagination>
  98. </div>
  99. </template>
  100. <script>
  101. import { getBatteryDetail } from '@/api/device/info'
  102. import AddOrUpdate from '@/views/device/info/info-add-or-update.vue'
  103. import UpLoad from '@/views/device/info/up-load.vue'
  104. export default {
  105. name: 'InfoDetails',
  106. components: { AddOrUpdate, UpLoad },
  107. data() {
  108. return {
  109. /**录入时间 */
  110. inTime: '',
  111. //总条数
  112. total: 0,
  113. //列表加载动画
  114. loading: false,
  115. //列表数据
  116. data: [],
  117. /**查询条件对象 */
  118. listQuery: {
  119. index: 1,
  120. length: 20,
  121. importance: undefined,
  122. batchNum: '',/**批次Id */
  123. imei: '',
  124. status: [],
  125. sn: '',
  126. sort: '',
  127. statusStr: null,
  128. operateID: null
  129. },
  130. //状态选项
  131. statusOptins: [
  132. {label: '全部', value: null},
  133. {label: '已入库', value: 1},
  134. {label: '未入库', value: 0},
  135. {label: '已调拨', value: 2},
  136. {label: '已出库', value: 3},
  137. {label: '已处置', value: 4},
  138. ],
  139. //电池总量
  140. totalData: 0,
  141. //已入库电池
  142. storage: 0,
  143. }
  144. },
  145. created() {
  146. if (this.$route.query.operateId !== undefined) {
  147. this.listQuery.operateID = this.$route.query.operateId
  148. }
  149. if (this.$route.query.batchId !== undefined) {
  150. this.listQuery.batchNum = this.$route.query.batchId
  151. }
  152. if (this.$route.query.inTime !== undefined) {
  153. this.inTime = this.$route.query.inTime
  154. }
  155. if (this.$route.query.total !== undefined) {
  156. this.totalData = this.$route.query.total
  157. }
  158. if (this.$route.query.storage !== undefined) {
  159. this.storage = this.$route.query.storage
  160. }
  161. this.getDataList()
  162. },
  163. methods: {
  164. //选择状态
  165. changeHandle() {
  166. this.listQuery.status = []
  167. this.listQuery.status.push(this.listQuery.statusStr)
  168. },
  169. //搜索
  170. searchHandle() {
  171. this.listQuery.index = 1
  172. this.getDataList()
  173. },
  174. //重置
  175. resetForm() {
  176. this.listQuery = {
  177. index: 1,
  178. length: 20,
  179. importance: undefined,
  180. batchNum: this.listQuery.batchNum,/**批次Id */
  181. imei: '',
  182. status: null,
  183. sn: '',
  184. sort: ''
  185. }
  186. this.getDataList()
  187. },
  188. /**获取列表数据 */
  189. getDataList() {
  190. this.loading = true
  191. getBatteryDetail(this.listQuery).then(response => {
  192. if (response.code === 200) {
  193. this.data = response.data
  194. this.total = response.total
  195. this.loading = false
  196. } else {
  197. this.loading = false
  198. return this.$message.error(response.message)
  199. }
  200. })
  201. },
  202. // 分页, 每页条数
  203. pageSizeChangeHandle (val) {
  204. this.listQuery.index = 1
  205. this.listQuery.length = val
  206. this.getDataList()
  207. },
  208. // 分页, 当前页
  209. pageCurrentChangeHandle (val) {
  210. this.listQuery.index = val
  211. this.getDataList()
  212. },
  213. //打开新增弹窗
  214. cerateHandle() {
  215. this.addVisible = true
  216. this.$nextTick(() => {
  217. this.$refs.addOrUpdate.init()
  218. });
  219. },
  220. /**打开上传弹窗 */
  221. upLoadHandle() {
  222. this.upVisible = true
  223. this.$nextTick(() => {
  224. this.$refs.upLoad.init()
  225. });
  226. },
  227. /**查看详情 */
  228. detailHandle(id) {
  229. this.$router.push({
  230. path: '/device/info/details',
  231. query: {
  232. batchId: id
  233. }
  234. })
  235. },
  236. //返回上一页
  237. goBack() {
  238. this.$store.dispatch('tagsView/delView', this.$route)
  239. this.$router.go(-1)
  240. },
  241. dataFormSubmitHandle() {},
  242. search() {
  243. this.page.param.index = 1
  244. // this.fetchData()
  245. },
  246. fetchData() {
  247. this.page.loading = false
  248. postJson('/api/v1/carinfo/pageQuery', this.page.param).then(response => {
  249. if (response.code === 200) {
  250. this.page.data = response.data
  251. this.page.total = response.total
  252. this.page.loading = false
  253. }
  254. })
  255. },
  256. sortChange(data) {
  257. this.page.param.index = 1
  258. this.page.param.sort = getSort(data)
  259. this.fetchData()
  260. },
  261. add() {
  262. this.$router.push('/car/info/add')
  263. },
  264. edit(val) {
  265. this.$router.push({ path: '/car/info/add', query: { id: val, pageIndex: this.page.param.index, word: this.page.param.title }})
  266. },
  267. del(val) {
  268. this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
  269. confirmButtonText: '确定',
  270. cancelButtonText: '取消',
  271. type: 'warning'
  272. }).then(() => {
  273. postJson('/api/v1/carinfo/delete', { id: val }).then(response => {
  274. if (response.code === 200) {
  275. this.fetchData()
  276. }
  277. })
  278. })
  279. }
  280. }
  281. }
  282. </script>
  283. <style lang="scss" scoped>
  284. .top-info {
  285. height: 53px;
  286. line-height: 53px;
  287. width: 100%;
  288. background-color: rgba(242, 242, 242, 1);
  289. box-shadow: none;
  290. text-align: left;
  291. color: #7F7F7F;
  292. font-size: 13px;
  293. padding-left: 20px;
  294. margin-bottom: 20px;
  295. >span {
  296. color: #0000FF;
  297. font-size: 13px;
  298. }
  299. }
  300. </style>