|
@@ -0,0 +1,469 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <h1><i class="el-icon-arrow-left" @click="goBack"></i>电池编码管理</h1>
|
|
|
+ <div class="top-info">
|
|
|
+ 示例:CQX7208JY21570001,C(1位)=设备类型、QX(2-3位)=归属方、72(4-5位)=电压等级、08(6-7位)=电流等级、JY(8-9位)=生产厂家、2157(10-13位)=生产日期、0001(14-17位)=序列号
|
|
|
+ </div>
|
|
|
+ <el-tabs v-model="activeName" @tab-click="handleClick">
|
|
|
+ <el-tab-pane label="设备类型" name="first">
|
|
|
+ <el-form :inline="true" @keyup.enter.native="handleFilter()">
|
|
|
+ <el-row>
|
|
|
+ <el-form-item style="float: right;">
|
|
|
+ <el-button type="primary" @click="cerateHandle()">新增</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="data"
|
|
|
+ element-loading-text="Loading"
|
|
|
+ :header-cell-style="{background:'rgba(242, 242, 242, 1)',borderColor:'rgba(242, 242, 242, 1);',textAlign:'center'}"
|
|
|
+ :cell-style="{'text-align':'center'}"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ >
|
|
|
+ <el-table-column label="序号" type="index" width="50"></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="产品类型">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.snTypeDesc }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="代码" prop="plateNumber">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.snTypeCode }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="添加时间" prop="deptId">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.addTime}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="最后修改时间" prop="vin">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.updateTime }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <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, 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>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <el-pagination style="float: right; margin-top: 30px;" :current-page="listQuery.index" :page-sizes="[10, 20, 50, 100]" :page-size="listQuery.length" :total="total"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle"
|
|
|
+ @current-change="pageCurrentChangeHandle">
|
|
|
+ </el-pagination>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="归属方" name="second">
|
|
|
+ <el-form :inline="true" @keyup.enter.native="handleFilter()">
|
|
|
+ <el-row>
|
|
|
+ <el-form-item style="float: right;">
|
|
|
+ <el-button type="primary" @click="cerateHandle()">新增</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="data"
|
|
|
+ element-loading-text="Loading"
|
|
|
+ :header-cell-style="{background:'rgba(242, 242, 242, 1)',borderColor:'rgba(242, 242, 242, 1);',textAlign:'center'}"
|
|
|
+ :cell-style="{'text-align':'center'}"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ >
|
|
|
+ <el-table-column label="序号" type="index" width="50"></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="制造商全称">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.snTypeDesc }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="代码" prop="plateNumber">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.snTypeCode }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="添加时间" prop="deptId">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.addTime}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="最后修改时间" prop="vin">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.updateTime }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <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, 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>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <el-pagination style="float: right; margin-top: 30px;" :current-page="listQuery.index" :page-sizes="[10, 20, 50, 100]" :page-size="listQuery.length" :total="total"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle"
|
|
|
+ @current-change="pageCurrentChangeHandle">
|
|
|
+ </el-pagination>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="电压等级" name="third">
|
|
|
+ <el-form :inline="true" @keyup.enter.native="handleFilter()">
|
|
|
+ <el-row>
|
|
|
+ <el-form-item style="float: right;">
|
|
|
+ <el-button type="primary" @click="cerateHandle()">新增</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="data"
|
|
|
+ element-loading-text="Loading"
|
|
|
+ :header-cell-style="{background:'rgba(242, 242, 242, 1)',borderColor:'rgba(242, 242, 242, 1);',textAlign:'center'}"
|
|
|
+ :cell-style="{'text-align':'center'}"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ >
|
|
|
+ <el-table-column label="序号" type="index" width="50"></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="制造商全称">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.snTypeDesc }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="代码" prop="plateNumber">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.snTypeCode }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="添加时间" prop="deptId">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.addTime}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="最后修改时间" prop="vin">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.updateTime }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <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, 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>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <el-pagination style="float: right; margin-top: 30px;" :current-page="listQuery.index" :page-sizes="[10, 20, 50, 100]" :page-size="listQuery.length" :total="total"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle"
|
|
|
+ @current-change="pageCurrentChangeHandle">
|
|
|
+ </el-pagination>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="电流等级" name="fourth">
|
|
|
+ <el-form :inline="true" @keyup.enter.native="handleFilter()">
|
|
|
+ <el-row>
|
|
|
+ <el-form-item style="float: right;">
|
|
|
+ <el-button type="primary" @click="cerateHandle()">新增</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="data"
|
|
|
+ element-loading-text="Loading"
|
|
|
+ :header-cell-style="{background:'rgba(242, 242, 242, 1)',borderColor:'rgba(242, 242, 242, 1);',textAlign:'center'}"
|
|
|
+ :cell-style="{'text-align':'center'}"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ >
|
|
|
+ <el-table-column label="序号" type="index" width="50"></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="化学体系">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.snTypeDesc }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="化学代码" prop="plateNumber">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.snTypeCode }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="添加时间" prop="deptId">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.addTime}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="最后修改时间" prop="vin">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.updateTime }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <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, 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>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <el-pagination style="float: right; margin-top: 30px;" :current-page="listQuery.index" :page-sizes="[10, 20, 50, 100]" :page-size="listQuery.length" :total="total"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle"
|
|
|
+ @current-change="pageCurrentChangeHandle">
|
|
|
+ </el-pagination>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="生产厂家" name="fifth">
|
|
|
+ <el-form :inline="true" @keyup.enter.native="handleFilter()">
|
|
|
+ <el-row>
|
|
|
+ <el-form-item style="float: right;">
|
|
|
+ <el-button type="primary" @click="cerateHandle()">新增</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="data"
|
|
|
+ element-loading-text="Loading"
|
|
|
+ :header-cell-style="{background:'rgba(242, 242, 242, 1)',borderColor:'rgba(242, 242, 242, 1);',textAlign:'center'}"
|
|
|
+ :cell-style="{'text-align':'center'}"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ highlight-current-row
|
|
|
+ >
|
|
|
+ <el-table-column label="序号" type="index" width="50"></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="化学体系">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.snTypeDesc }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="化学代码" prop="plateNumber">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.snTypeCode }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="添加时间" prop="deptId">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.addTime}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="最后修改时间" prop="vin">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.updateTime }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <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, 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>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <el-pagination style="float: right; margin-top: 30px;" :current-page="listQuery.index" :page-sizes="[10, 20, 50, 100]" :page-size="listQuery.length" :total="total"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle"
|
|
|
+ @current-change="pageCurrentChangeHandle">
|
|
|
+ </el-pagination>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ <add-or-update v-if="addVisible" ref="addOrUpdate" @refreshDataList="getDatalist"></add-or-update>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { batteryCodeList, deleteBatteryCode } from '@/api/device/configure'
|
|
|
+import AddOrUpdate from '@/views/device/configure/code-add-or-update.vue'
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: { AddOrUpdate },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ /**默认tab */
|
|
|
+ activeName: 'first',
|
|
|
+ //加载动画
|
|
|
+ loading: false,
|
|
|
+ //列表数据
|
|
|
+ data: [],
|
|
|
+ //总条数
|
|
|
+ total: 0,
|
|
|
+ /**查询条件对象 */
|
|
|
+ listQuery: {
|
|
|
+ index: 1,
|
|
|
+ length: 20,
|
|
|
+ importance: undefined,
|
|
|
+ title: undefined,
|
|
|
+ type: '设备类型',
|
|
|
+ sort: ''
|
|
|
+ },
|
|
|
+ /**是否显示新增弹窗 */
|
|
|
+ addVisible: false,
|
|
|
+ /**是否显示批量导入弹窗 */
|
|
|
+ upVisible: false,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getDatalist()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ //返回上一页
|
|
|
+ goBack() {
|
|
|
+ this.$store.dispatch('tagsView/delView', this.$route)
|
|
|
+ this.$router.go(-1)
|
|
|
+ },
|
|
|
+ /**tab页切换 */
|
|
|
+ handleClick(tab, event) {
|
|
|
+ this.activeName = tab.name
|
|
|
+ this.data = []
|
|
|
+ this.total = 0
|
|
|
+ if(tab.name === 'first') {
|
|
|
+ this.listQuery.type = '设备类型'
|
|
|
+ } else if(tab.name === 'second') {
|
|
|
+ this.listQuery.type = '归属方'
|
|
|
+ } else if(tab.name === 'third') {
|
|
|
+ this.listQuery.type = '电压等级'
|
|
|
+ } else if(tab.name === 'fourth') {
|
|
|
+ this.listQuery.type = '电流等级'
|
|
|
+ } else if(tab.name === 'fifth') {
|
|
|
+ this.listQuery.type = '生产厂家'
|
|
|
+ }
|
|
|
+ this.getDatalist()
|
|
|
+ },
|
|
|
+ //获取列表数据
|
|
|
+ getDatalist() {
|
|
|
+ this.loading = true
|
|
|
+ batteryCodeList(this.listQuery).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.data = res.data
|
|
|
+ this.total = res.total
|
|
|
+ this.loading = false
|
|
|
+ } else {
|
|
|
+ this.loading = false
|
|
|
+ return this.$message.error(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 分页, 每页条数
|
|
|
+ pageSizeChangeHandle (val) {
|
|
|
+ this.listQuery.index = 1
|
|
|
+ this.listQuery.length = val
|
|
|
+ this.getDatalist()
|
|
|
+ },
|
|
|
+ // 分页, 当前页
|
|
|
+ pageCurrentChangeHandle (val) {
|
|
|
+ this.listQuery.index = val
|
|
|
+ this.getDatalist()
|
|
|
+ },
|
|
|
+
|
|
|
+ //打开新增弹窗
|
|
|
+ cerateHandle(id, type) {
|
|
|
+ this.addVisible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.addOrUpdate.init()
|
|
|
+ this.$refs.addOrUpdate.dataForm.id = id
|
|
|
+ this.$refs.addOrUpdate.title = !type?'新增':(type === 1?'查看':'修改')
|
|
|
+ this.$refs.addOrUpdate.dataForm.snType = this.activeName==='first'?'设备类型':(this.activeName==='second'?'归属方':(this.activeName==='third'?'电压等级':(this.activeName==='fourth'?'电流等级':'生产厂家')))
|
|
|
+ this.$refs.addOrUpdate.type = type
|
|
|
+ this.$refs.addOrUpdate.activeName = this.activeName
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /**启用、停用 */
|
|
|
+ delHandle(row) {
|
|
|
+ let status = null
|
|
|
+ if(row.status === 1) {
|
|
|
+ status = 0
|
|
|
+ } else {
|
|
|
+ status = 1
|
|
|
+ }
|
|
|
+ deleteBatteryCode({id: row.id, status: status}).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.getDatalist()
|
|
|
+ } else {
|
|
|
+ this.loading = false
|
|
|
+ return this.$message.error(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ 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.getDatalist()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .top-info {
|
|
|
+ height: 53px;
|
|
|
+ line-height: 53px;
|
|
|
+ width: 100%;
|
|
|
+ background-color: rgba(242, 242, 242, 1);
|
|
|
+ box-shadow: none;
|
|
|
+ text-align: left;
|
|
|
+ color: #7F7F7F;
|
|
|
+ font-size: 12px;
|
|
|
+ padding-left: 20px;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ >span {
|
|
|
+ color: #0000FF;
|
|
|
+ font-size: 13px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|