设备上下架开发

This commit is contained in:
liang.chao 2024-11-23 17:44:59 +08:00
parent 4c10944e92
commit f9fa2c5c71
2 changed files with 327 additions and 280 deletions

View File

@ -52,6 +52,15 @@ export function removeDevice(data) {
}) })
} }
//上下架(批量)
export function updateUpDown(data) {
return request({
url: '/material-mall/dev/updateUpDown',
method: 'post',
data: data,
})
}

View File

@ -74,13 +74,15 @@
<el-button <el-button
type="success" plain type="success" plain
size="mini" @click="equipmentAdd" size="mini" @click="equipmentAdd"
>装备新建</el-button> >装备新建
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" plain type="warning" plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleUpdateUpDown(null,2)"
>批量上架</el-button> >批量上架</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -88,11 +90,14 @@
type="warning" plain type="warning" plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
>批量下架</el-button> @click="handleUpdateUpDown(null,3)"
>批量下架
</el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="tableList" ref="multipleTable" row-key="maId" @selection-change="handleSelectionChange" border> <el-table v-loading="loading" :data="tableList" ref="multipleTable" row-key="maId"
<el-table-column type="selection" width="55" align="center" :reserve-selection="true" /> @selection-change="handleSelectionChange" border>
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"/>
<el-table-column label="序号" align="center" width="80" type="index"> <el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span> <span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
@ -121,8 +126,17 @@
编辑 编辑
</el-button> </el-button>
<el-button <el-button
size="mini" type="warning" > size="mini" type="warning">
<span
v-if="scope.row.maStatus == 2"
@click="handleUpdateUpDown(scope.row,3)">
下架 下架
</span>
<span
v-if="scope.row.maStatus == 3"
@click="handleUpdateUpDown(scope.row,2)">
上架
</span>
</el-button> </el-button>
<el-button size="mini" type="danger" @click="delDev(scope.row)"> <el-button size="mini" type="danger" @click="delDev(scope.row)">
删除 删除
@ -139,11 +153,12 @@
@pagination="getList" @pagination="getList"
/> />
</div> </div>
</template> </template>
<script> <script>
import { getDevList,removeDevice } from "@/api/lessor/equipment"; import {getDevList, removeDevice,updateUpDown} from "@/api/lessor/equipment";
export default {
export default {
name: "", name: "",
dicts: ['ma_machine_status'], dicts: ['ma_machine_status'],
data() { data() {
@ -156,25 +171,26 @@
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
statusList:[{id:'1',name:'状态1'},{id:'2',name:'状态2'},{id:'3',name:'状态3'}], statusList: [{id: '1', name: '状态1'}, {id: '2', name: '状态2'}, {id: '3', name: '状态3'}],
ids:[], ids: [],
// //
total: 0, total: 0,
// //
tableList: [], tableList: [],
maIds: [],
// //
title: "", title: "",
// //
open: false, open: false,
// //
dateRange:[], dateRange: [],
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
deviceName:undefined, deviceName: undefined,
code:undefined, code: undefined,
keyWord:undefined, keyWord: undefined,
status:undefined, status: undefined,
}, },
}; };
}, },
@ -185,12 +201,12 @@
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
if(this.dateRange.length>0){ if (this.dateRange.length > 0) {
this.queryParams.startTime=this.dateRange[0] this.queryParams.startTime = this.dateRange[0]
this.queryParams.endTime=this.dateRange[1] this.queryParams.endTime = this.dateRange[1]
}else{ } else {
this.queryParams.startTime=undefined this.queryParams.startTime = undefined
this.queryParams.endTime=undefined this.queryParams.endTime = undefined
} }
getDevList(this.queryParams).then(response => { getDevList(this.queryParams).then(response => {
this.tableList = response.rows; this.tableList = response.rows;
@ -201,8 +217,8 @@
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm");
this.dateRange=[] this.dateRange = []
this.queryParams.keyWord=null; this.queryParams.keyWord = null;
this.handleQuery(); this.handleQuery();
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
@ -217,7 +233,7 @@
this.multiple = !selection.length this.multiple = !selection.length
}, },
// //
equipmentAdd(){ equipmentAdd() {
let query = {} let query = {}
this.$tab.closeOpenPage({ this.$tab.closeOpenPage({
path: '/lessor/equipmentDetail', path: '/lessor/equipmentDetail',
@ -225,16 +241,35 @@
}) })
}, },
// //
handleUpdate(row){ handleUpdate(row) {
console.log(row) console.log(row)
let query = { maId:row.maId,isView:"false" } let query = {maId: row.maId, isView: "false"}
this.$tab.closeOpenPage({ this.$tab.closeOpenPage({
path: '/lessor/equipmentDetail', path: '/lessor/equipmentDetail',
query, query,
}) })
}, },
//
handleUpdateUpDown(row,maStatus) {
this.$modal.confirm('是否确认?').then(() => {
let maIds = []
if (!row){
maIds = this.ids
} else {
maIds.push(row.maId)
}
if (maIds.length == 0){
this.$modal.msgError('请选择要操作的数据')
return
}
return updateUpDown({maIds,maStatus})
}).then(() => {
this.handleQuery()
}).catch(() => {
})
},
// //
handleView(row){ handleView(row) {
console.log(row) console.log(row)
// let query = { Id:row.id,taskId: row.taskId,isView:"true" } // let query = { Id:row.id,taskId: row.taskId,isView:"true" }
// this.$tab.closeOpenPage({ // this.$tab.closeOpenPage({
@ -247,7 +282,7 @@
// ...this.queryParams // ...this.queryParams
// }, `_${new Date().getTime()}.xlsx`) // }, `_${new Date().getTime()}.xlsx`)
}, },
delDev(row){ delDev(row) {
this.$modal.confirm('是否确认删除所选择的装备?').then(() => { this.$modal.confirm('是否确认删除所选择的装备?').then(() => {
return removeDevice([row.maId]) return removeDevice([row.maId])
}).then(() => { }).then(() => {
@ -259,28 +294,31 @@
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.uploadImg { .uploadImg {
padding-top: 20px; padding-top: 20px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.deviceCode {
.deviceCode {
margin-top: 10px; margin-top: 10px;
padding-bottom: 20px; padding-bottom: 20px;
font-size: 18px; font-size: 18px;
} }
::v-deep.el-table .fixed-width .el-button--mini {
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important; width: 60px !important;
margin-bottom: 10px; margin-bottom: 10px;
} }
//css
::v-deep.disabled { //css
::v-deep.disabled {
.el-upload--picture-card { .el-upload--picture-card {
display: none; display: none;
} }
} }
</style> </style>