Browse Source

设备入库接口对接

renmy 3 years ago
parent
commit
b56f09c506

+ 29 - 11
src/api/device/storage.js

@@ -2,18 +2,36 @@ import request from '@/utils/request'
 
 //设备入库分页
 export function getInfoList(data) {
-  return request({
-    url: '/api/v1/applibrarylog/pageQuery',
-    method: 'post',
-    data
-  })
+    return request({
+        url: '/api/v1/applibrarylog/pageQuery',
+        method: 'post',
+        data
+    })
 }
 
-//新增入库
+//新增电池入库
 export function addStorageIn(data) {
-  return request({
-    url: '/api/v1/applibrarylog/save',
-    method: 'post',
-    data
-  })
+    return request({
+        url: '/api/v1/applibrarylog/save',
+        method: 'post',
+        data
+    })
+}
+
+//批次待入库列表
+export function batchStorageList(data) {
+    return request({
+        url: '/api/v1/applibrarylog/showAppDevice',
+        method: 'post',
+        data
+    })
+}
+
+//批量入库电池
+export function batchStorageAdd(data) {
+    return request({
+        url: '/api/v1/applibrarylog/appDevice',
+        method: 'post',
+        data
+    })
 }

+ 7 - 7
src/views/device/configure/batteryCode.vue

@@ -51,7 +51,7 @@
 
 					<el-table-column align="center" label="操作" width="180">
 						<template slot-scope="scope">
-							<el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button>
+							<!-- <el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button> -->
 							<el-button @click="cerateHandle(scope.row.id, 2)" type="text">修改</el-button>
 							<el-button v-if="scope.row.status === 1" @click="delHandle(scope.row)" type="text">停用</el-button>
 							<el-button v-else @click="delHandle(scope.row)" type="text">启用</el-button>
@@ -110,7 +110,7 @@
 
 					<el-table-column align="center" label="操作" width="180">
 						<template slot-scope="scope">
-							<el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button>
+							<!-- <el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button> -->
 							<el-button @click="cerateHandle(scope.row.id, 2)" type="text">修改</el-button>
 							<el-button v-if="scope.row.status === 1" @click="delHandle(scope.row)" type="text">停用</el-button>
 							<el-button v-else @click="delHandle(scope.row)" type="text">启用</el-button>
@@ -169,7 +169,7 @@
 
 					<el-table-column align="center" label="操作" width="180">
 						<template slot-scope="scope">
-							<el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button>
+							<!-- <el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button> -->
 							<el-button @click="cerateHandle(scope.row.id, 2)" type="text">修改</el-button>
 							<el-button v-if="scope.row.status === 1" @click="delHandle(scope.row)" type="text">停用</el-button>
 							<el-button v-else @click="delHandle(scope.row)" type="text">启用</el-button>
@@ -228,7 +228,7 @@
 
 					<el-table-column align="center" label="操作" width="180">
 						<template slot-scope="scope">
-							<el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button>
+							<!-- <el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button> -->
 							<el-button @click="cerateHandle(scope.row.id, 2)" type="text">修改</el-button>
 							<el-button v-if="scope.row.status === 1" @click="delHandle(scope.row)" type="text">停用</el-button>
 							<el-button v-else @click="delHandle(scope.row)" type="text">启用</el-button>
@@ -287,7 +287,7 @@
 
 					<el-table-column align="center" label="操作" width="180">
 						<template slot-scope="scope">
-							<el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button>
+							<!-- <el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button> -->
 							<el-button @click="cerateHandle(scope.row.id, 2)" type="text">修改</el-button>
 							<el-button v-if="scope.row.status === 1" @click="delHandle(scope.row)" type="text">停用</el-button>
 							<el-button v-else @click="delHandle(scope.row)" type="text">启用</el-button>
@@ -341,7 +341,7 @@
 
 					<el-table-column align="center" label="操作" width="180">
 						<template slot-scope="scope">
-							<el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button>
+							<!-- <el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button> -->
 							<el-button @click="cerateHandle(scope.row.id, 2)" type="text">修改</el-button>
 							<el-button v-if="scope.row.status === 1" @click="delHandle(scope.row)" type="text">停用</el-button>
 							<el-button v-else @click="delHandle(scope.row)" type="text">启用</el-button>
@@ -398,7 +398,7 @@
 
 					<el-table-column align="center" label="操作" width="180">
 						<template slot-scope="scope">
-							<el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button>
+							<!-- <el-button @click="cerateHandle(scope.row.id, 1)" type="text">查看</el-button> -->
 							<el-button @click="cerateHandle(scope.row.id, 2)" type="text">修改</el-button>
 							<el-button v-if="scope.row.status === 1" @click="delHandle(scope.row)" type="text">停用</el-button>
 							<el-button v-else @click="delHandle(scope.row)" type="text">启用</el-button>

+ 1 - 1
src/views/device/info/index.vue

@@ -269,7 +269,7 @@ export default {
 
     //下载模板
     excelTemplateHandle() {
-      window.location.href = `${this.url}/api/v1/appdevice/excelTemplate?name=battery.xls`
+      window.location.href = `${this.url}/api/v1/appdevice/excelTemplate?name=电池发货单-2021年XX月XX日.xls`
     }
   }
 }

+ 13 - 7
src/views/device/storage/batchWarehousing.vue

@@ -49,9 +49,9 @@
         </template>
       </el-table-column>
 
-      <el-table-column label="已入库" prop="model" width="80">
+      <el-table-column label="已入库" width="80">
         <template slot-scope="scope">
-          {{ scope.row.into }}
+          {{ scope.row.in_storage }}
         </template>
       </el-table-column>
 
@@ -67,13 +67,13 @@
         </template>
       </el-table-column>
 
-      <el-table-column align="center" prop="updateTime" label="发货时间">
+      <el-table-column align="center" label="发货时间">
         <template slot-scope="scope">
           <span>{{ scope.row.to }}</span>
         </template>
       </el-table-column>
 
-			<el-table-column align="center" prop="updateTime" label="录入时间">
+			<el-table-column align="center" label="录入时间">
         <template slot-scope="scope">
           <span>{{ scope.row.to }}</span>
         </template>
@@ -81,7 +81,7 @@
 
       <el-table-column align="center" label="操作" width="180">
         <template slot-scope="scope">
-          <el-button @click="gotoHandle(scope.row.id)" type="text">入库</el-button>
+          <el-button @click="gotoHandle(scope.row)" type="text">入库</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -159,8 +159,14 @@ export default {
     },
 
     /**跳转入库页面 */
-    gotoHandle() {
-      this.$router.push('/device/storage/warehousing')
+    gotoHandle(row) {
+      this.$router.push({path:'/device/storage/warehousing',
+        query: {
+          batchId: row.batch_num,
+          total: row.total,
+          storage: row.in_storage
+        }
+      })
     }
   }
 }

+ 2 - 4
src/views/device/storage/create.vue

@@ -24,7 +24,8 @@ export default {
       //表单对象
       dataForm: {
         id: '',
-        sn: ''
+        sn: '',
+        status: 1
       },
     }
   },
@@ -38,9 +39,6 @@ export default {
     }
   },
   methods: {
-    changeHandle() {
-      this.dataForm.contactWay = ''
-    },
     init () {
       this.visible = true
       this.$nextTick(() => {

+ 4 - 4
src/views/device/storage/index.vue

@@ -70,15 +70,15 @@
       fit
       highlight-current-row
     >
-			<el-table-column label="设备SN" sortable="custom">
+			<el-table-column label="设备SN">
         <template slot-scope="scope">
-          {{ scope.row.intime }}
+          {{ scope.row.sn }}
         </template>
       </el-table-column>
 
-      <el-table-column label="入库时间" prop="plateNumber">
+      <el-table-column label="入库时间">
         <template slot-scope="scope">
-          {{ scope.row.code }}
+          {{ scope.row.addTime }}
         </template>
       </el-table-column>
 

+ 42 - 35
src/views/device/storage/warehousing.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
     <h1><i class="el-icon-arrow-left" @click="goBack"></i>批次入库</h1>
 		<div class="top-info">
-			共计电池 <span>1864</span>,未入库电池 <span>200</span>批次号: 录入时间:
+			共计电池 <span>{{totalData}}</span>,未入库电池 <span>200</span>批次号: 录入时间:
 		</div>
 		<el-form :inline="true" :model="listQuery" @keyup.enter.native="handleFilter()">
 			<el-row style="float: right;">
@@ -30,37 +30,37 @@
 
 			<el-table-column label="电池SN">
         <template slot-scope="scope">
-          {{ scope.row.intime }}
+          {{ scope.row.sn }}
         </template>
       </el-table-column>
 
       <el-table-column label="设备号IMEI">
         <template slot-scope="scope">
-          {{ scope.row.code }}
+          {{ scope.row.imei }}
         </template>
       </el-table-column>
 
       <el-table-column label="电池类型">
         <template slot-scope="scope">
-          {{ scope.row.total}}
+          {{ scope.row.typeTitle}}
         </template>
       </el-table-column>
 
       <el-table-column label="PACK厂">
         <template slot-scope="scope">
-          {{ scope.row.dt }}
+          {{ scope.row.packTitle }}
         </template>
       </el-table-column>
 
       <el-table-column label="产品规格" prop="model" width="80">
         <template slot-scope="scope">
-          {{ scope.row.into }}
+          {{ scope.row.packTitle }}
         </template>
       </el-table-column>
 
       <el-table-column label="产品拓展">
         <template slot-scope="scope">
-          {{ scope.row.create }}
+          {{ scope.row.expandTitle }}
         </template>
       </el-table-column>
 
@@ -72,13 +72,13 @@
 
       <el-table-column align="center" prop="updateTime" label="发货时间">
         <template slot-scope="scope">
-          <span>{{ scope.row.to }}</span>
+          <span>{{ scope.row.deliverTime }}</span>
         </template>
       </el-table-column>
 
 			<el-table-column align="center" prop="updateTime" label="入库时间">
         <template slot-scope="scope">
-          <span>{{ scope.row.to }}</span>
+          <span>{{ scope.row.addTime }}</span>
         </template>
       </el-table-column>
     </el-table>
@@ -91,7 +91,7 @@
 </template>
 
 <script>
-import { postJson, getSort } from '@/api/page'
+import { batchStorageList, batchStorageAdd } from '@/api/device/storage'
 import Create from '@/views/device/storage/create.vue'
 
 export default {
@@ -111,13 +111,27 @@ export default {
         importance: undefined,
         title: undefined,
         type: undefined,
-        sort: '+id'
+        sort: '+id',
+        batchName: ''
       },
 			/**批量选中的数据列表 */
 			multipleSelection: [],
+      //总电池数量
+      totalData: 0,
+      //已入库电池
+      storage: 0
     }
   },
   created() {
+    if (this.$route.query.batchId !== undefined) {
+      this.listQuery.batchName = this.$route.query.batchId
+    }
+    if (this.$route.query.total !== undefined) {
+      this.totalData = this.$route.query.total
+    }
+		if (this.$route.query.storage !== undefined) {
+      this.storage = this.$route.query.storage
+    }
     this.getDataList()
   },
   methods: {
@@ -128,7 +142,17 @@ export default {
     },
     /**请求列表数据 */
     getDataList() {
-
+      this.loading = true
+      batchStorageList(this.listQuery).then(response => {
+        if (response.code === 200) {
+          this.data = response.data
+          this.total = response.total
+          this.loading = false
+        } else {
+          this.loading = false
+          return this.$message.error(response.message)
+        }
+      })
     },
 		// 分页, 每页条数
     pageSizeChangeHandle (val) {
@@ -152,30 +176,13 @@ export default {
       return row.disabled === false
     },
 
-    fetchData() {
-      this.page.loading = false
-      postJson('/api/v1/carinfo/pageQuery', this.page.param).then(response => {
-        if (response.code === 200) {
-          this.page.data = response.data
-          this.page.total = response.total
-          this.page.loading = false
-        }
-      })
-    },
-
-    del(val) {
-      this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        postJson('/api/v1/carinfo/delete', { id: val }).then(response => {
-          if (response.code === 200) {
-            this.fetchData()
-          }
-        })
+    //批量新增电池
+    cerateHandle: debounce(function () {
+      if(this.multipleSelection.length === 0) return this.$message.warning("请选择电池") 
+      batchStorageAdd().then(res => {
+        
       })
-    }
+    }) 
   }
 }
 </script>