修改打印机状态接口
This commit is contained in:
parent
df3546c378
commit
f3554b2b4a
|
|
@ -14,7 +14,18 @@ export function tbPrintMachine(data, method = 'post') {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 打印机切换
|
||||||
|
|
||||||
|
export function switchtbPrintMachine(data, method = 'post') {
|
||||||
|
return request({
|
||||||
|
url: '/api/shop-config/printer/update-status',
|
||||||
|
method: method,
|
||||||
|
data: {
|
||||||
|
shopId: localStorage.getItem('shopId'),
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 打印机列表
|
* 打印机列表
|
||||||
* @returns
|
* @returns
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="200">
|
<el-table-column label="操作" width="200">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button type="text" icon="el-icon-edit"
|
<el-button type="text" icon="el-icon-edit" @click="toUrl(scope.row)">编辑</el-button>
|
||||||
@click="toUrl(scope.row)">编辑</el-button>
|
|
||||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||||
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
|
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
|
||||||
slot="reference">删除</el-button>
|
slot="reference">删除</el-button>
|
||||||
|
|
@ -75,7 +74,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { devices, models, subTypes } from './devices'
|
import { devices, models, subTypes } from './devices'
|
||||||
import addDevice from './components/addDevice'
|
import addDevice from './components/addDevice'
|
||||||
import { tbPrintMachineGet, tbPrintMachine, delTableHandle } from '@/api/devices'
|
import { tbPrintMachineGet, switchtbPrintMachine, delTableHandle } from '@/api/devices'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -123,7 +122,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toUrl(item) {
|
toUrl(item) {
|
||||||
this.$router.push({ path: '/shop/devices/details', query:{id:item.id}})
|
this.$router.push({ path: '/shop/devices/details', query: { id: item.id } })
|
||||||
},
|
},
|
||||||
// 切换状态
|
// 切换状态
|
||||||
async statusChange(e, row) {
|
async statusChange(e, row) {
|
||||||
|
|
@ -131,7 +130,11 @@ export default {
|
||||||
this.tableData.loading = true
|
this.tableData.loading = true
|
||||||
const data = { ...row }
|
const data = { ...row }
|
||||||
data.status = e
|
data.status = e
|
||||||
await tbPrintMachine(data, 'put')
|
if (data.id) {
|
||||||
|
delete data.createdAt
|
||||||
|
delete data.updatedAt
|
||||||
|
}
|
||||||
|
await switchtbPrintMachine(data)
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue