设备上下架开发

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