opt:大屏打印功能-新增打印机管理页面支持多打印机
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
package org.nl.system.controller.printer;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.system.service.printer.ISysPrinterService;
|
||||
import org.nl.system.service.printer.dao.SysPrinter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhaoyf
|
||||
* @date 2026-05-07
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/printer")
|
||||
@Api("打印机管理")
|
||||
public class SysPrinterController {
|
||||
|
||||
@Autowired
|
||||
private ISysPrinterService iSysPrinterService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询所有打印机")
|
||||
@ApiOperation("查询打印机")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(iSysPrinterService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<Object> all(){
|
||||
return new ResponseEntity<>(iSysPrinterService.list(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增打印机")
|
||||
@ApiOperation("新增")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SysPrinter param){
|
||||
iSysPrinterService.create(param);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改打印机参数")
|
||||
@ApiOperation("修改打印机参数")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SysPrinter param){
|
||||
iSysPrinterService.update(param);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除打印机")
|
||||
@ApiOperation("删除打印机")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
List<String> Ids = Arrays.asList(ids);
|
||||
iSysPrinterService.deleteAll(Ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.nl.system.service.printer;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.system.service.printer.dao.SysPrinter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author zhaoyf
|
||||
* @date 2026-05-07
|
||||
**/
|
||||
public interface ISysPrinterService extends IService<SysPrinter> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<SysPrinter>
|
||||
*/
|
||||
IPage<SysPrinter> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(SysPrinter entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(SysPrinter entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package org.nl.system.service.printer.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author zhaoyf
|
||||
* @date 2026-05-07
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sys_printer")
|
||||
public class SysPrinter implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String ip;
|
||||
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean is_active;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Boolean is_delete;
|
||||
|
||||
/**
|
||||
* 创建者ID
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改者ID
|
||||
*/
|
||||
private String update_id;
|
||||
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
private String update_name;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.system.service.printer.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.system.service.printer.dao.SysPrinter;
|
||||
|
||||
/**
|
||||
* @author zhaoyf
|
||||
* @date 2026-05-07
|
||||
**/
|
||||
public interface SysPrinterMapper extends BaseMapper<SysPrinter> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.system.service.printer.dao.mapper.SysPrinterMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.nl.system.service.printer.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author zhaoyf
|
||||
* @date 2026-05-07
|
||||
**/
|
||||
@Data
|
||||
public class SysPrinterDto implements Serializable {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.system.service.printer.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.system.service.printer.dao.SysPrinter;
|
||||
|
||||
/**
|
||||
* @author zhaoyf
|
||||
* @date 2026-05-07
|
||||
**/
|
||||
public class SysPrinterQuery extends BaseQuery<SysPrinter> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.nl.system.service.printer.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.printer.ISysPrinterService;
|
||||
import org.nl.system.service.printer.dao.SysPrinter;
|
||||
import org.nl.system.service.printer.dao.mapper.SysPrinterMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author zhaoyf
|
||||
* @date 2026-05-07
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SysPrinterServiceImpl extends ServiceImpl<SysPrinterMapper, SysPrinter> implements ISysPrinterService {
|
||||
|
||||
@Autowired
|
||||
private SysPrinterMapper sysPrinterMapper;
|
||||
|
||||
@Override
|
||||
public IPage<SysPrinter> queryAll(Map whereJson, PageQuery page){
|
||||
LambdaQueryWrapper<SysPrinter> lam = new LambdaQueryWrapper<>();
|
||||
IPage<SysPrinter> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
sysPrinterMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(SysPrinter entity) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
entity.setCreate_id(currentUserId);
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
sysPrinterMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(SysPrinter entity) {
|
||||
SysPrinter dto = sysPrinterMapper.selectById(entity.getId());
|
||||
if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
sysPrinterMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(List<String> ids) {
|
||||
// 真删除
|
||||
sysPrinterMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,4 +17,6 @@ public class PrintEntityDto {
|
||||
private String MaterialCode;
|
||||
@JsonProperty("username")
|
||||
private String username;
|
||||
private String ip;
|
||||
private Integer port;
|
||||
}
|
||||
|
||||
@@ -1724,17 +1724,15 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
|
||||
@Override
|
||||
public void print(PrintEntityDto printEntityDto) {
|
||||
String ip = sysParamServiceImpl.findByCode("printerIP").getValue();
|
||||
String port = sysParamServiceImpl.findByCode("printerPort").getValue();
|
||||
if (ip == null || StringUtils.isBlank(ip)) {
|
||||
if (printEntityDto.getIp() == null || StringUtils.isBlank(printEntityDto.getIp())) {
|
||||
throw new BadRequestException("打印出错:未配置打印机IP(printerIP)");
|
||||
}
|
||||
if (port == null || StringUtils.isBlank(port)) {
|
||||
if (printEntityDto.getPort() == null) {
|
||||
throw new BadRequestException("打印出错:未配置打印机端口(printerPort)");
|
||||
}
|
||||
try (Socket client = new Socket()) {
|
||||
// 3. 设置超时时间,防止网络不通时线程卡死 (单位:毫秒)
|
||||
client.connect(new InetSocketAddress(ip, Integer.parseInt(port)), 3000); // 连接超时 3秒
|
||||
client.connect(new InetSocketAddress(printEntityDto.getIp(), printEntityDto.getPort()), 3000); // 连接超时 3秒
|
||||
client.setSoTimeout(10000); // 读取超时 10秒
|
||||
|
||||
try (OutputStream outputStream = client.getOutputStream()) {
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<script type="text/javascript" src="<%= BASE_URL %>config.js"></script>
|
||||
<script type="text/javascript" src="/banmaSDK/BrowserPrint-3.1.250.min.js"></script>
|
||||
<script type="text/javascript" src="/banmaSDK/BrowserPrint-Zebra-1.1.250.min.js"></script>
|
||||
<title><%= webpackConfig.name %></title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
128
lms/nladmin-ui/src/views/system/printer/index.vue
Normal file
128
lms/nladmin-ui/src/views/system/printer/index.vue
Normal file
@@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="550px"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="100px">
|
||||
<el-form-item label="打印机名称" prop="name">
|
||||
<el-input v-model="form.name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="IP地址" prop="ip">
|
||||
<el-input v-model="form.ip" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="端口" prop="port">
|
||||
<el-input v-model="form.port" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="description">
|
||||
<el-input v-model="form.remark" style="width: 380px;" rows="5" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="mini"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column v-if="false" prop="id" label="id" />
|
||||
<el-table-column prop="name" label="打印机名称" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="ip" label="IP地址" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="port" label="端口" min-width="270" show-overflow-tooltip />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column v-permission="['admin','param:edit','param:del']" label="操作" width="150px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudPrinter from '@/views/system/printer/printer'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
const defaultForm = {
|
||||
ip: null,
|
||||
name: null,
|
||||
port: null,
|
||||
remark: null
|
||||
}
|
||||
export default {
|
||||
name: 'Printer',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: '打印机管理', url: 'api/printer', idField: 'id', sort: 'id,desc', crudMethod: { ...crudPrinter },
|
||||
optShow: {
|
||||
add: true,
|
||||
edit: true,
|
||||
del: true,
|
||||
download: false,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
add: ['admin', 'printer:add'],
|
||||
edit: ['admin', 'printer:edit'],
|
||||
del: ['admin', 'printer:del']
|
||||
},
|
||||
|
||||
rules: {
|
||||
ip: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
port: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// this.webSocket()
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
34
lms/nladmin-ui/src/views/system/printer/printer.js
Normal file
34
lms/nladmin-ui/src/views/system/printer/printer.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/printer',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/printer/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/printer',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getValueByCode(code) {
|
||||
return request({
|
||||
url: 'api/printer/getValueByCode/' + code,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getValueByCode }
|
||||
@@ -404,6 +404,25 @@
|
||||
<div class="pop-h1">确认打印内容</div>
|
||||
<div class="filter-items">
|
||||
<div class="info-list" style="color: #F0F3F4">
|
||||
|
||||
<div class="info-item">
|
||||
<div class="info-label">打印机</div>
|
||||
<div class="info-value">
|
||||
<el-row class="filter-wraper" style="margin-bottom: 0" type="flex" justify="space-between">
|
||||
<el-col style="width: 100%;" class="select-wraper">
|
||||
<el-select v-model="printer" :popper-append-to-body="false" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in printers"
|
||||
:key="item.name"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
class="option-wraper"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 订单号 竖向行 -->
|
||||
<div class="info-item">
|
||||
<div class="info-label">订单号</div>
|
||||
@@ -449,6 +468,25 @@
|
||||
<div class="pop-h1">自定义打印</div>
|
||||
<div class="filter-items">
|
||||
<div class="info-list" style="color: #F0F3F4">
|
||||
<!-- 订单号 竖向行 -->
|
||||
<div class="info-item">
|
||||
<div class="info-label">打印机</div>
|
||||
<div class="info-value">
|
||||
<el-row class="filter-wraper" style="margin-bottom: 0" type="flex" justify="space-between">
|
||||
<el-col style="width: 100%;" class="select-wraper">
|
||||
<el-select v-model="printer" :popper-append-to-body="false" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in printers"
|
||||
:key="item.name"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
class="option-wraper"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 订单号 竖向行 -->
|
||||
<div class="info-item">
|
||||
<div class="info-label">订单号</div>
|
||||
@@ -493,7 +531,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudProduceScreen from './produceScreen'
|
||||
import crudProduceScreen, {getAllPrinter, sendPrint} from './produceScreen'
|
||||
import {getAgvStatus} from '@/api/agv_alarm'
|
||||
// import crudProduceScreen from './mork'
|
||||
|
||||
@@ -527,6 +565,8 @@ export default {
|
||||
printShow: false,
|
||||
customPrintShow: false,
|
||||
printData: {},
|
||||
printers: [],
|
||||
printer: '',
|
||||
customPrintData: {
|
||||
order_code: '',
|
||||
create_time: new Date().toLocaleString() || '',
|
||||
@@ -637,23 +677,43 @@ export default {
|
||||
},
|
||||
doPrint(row) {
|
||||
console.log(row)
|
||||
this.getAllPrinter()
|
||||
this.printShow = true
|
||||
this.printData = row
|
||||
this.printData.username = JSON.parse(localStorage.getItem('screenData')).username || ''
|
||||
},
|
||||
confirmCustomPrint() {
|
||||
console.log(this.customPrintData)
|
||||
this.sendPrint(this.customPrintData)
|
||||
this.customPrintShow = false
|
||||
},
|
||||
confirmPrint() {
|
||||
console.log(this.printData)
|
||||
this.sendPrint(this.printData)
|
||||
this.printShow = false
|
||||
this.printData = {}
|
||||
},
|
||||
customPrint() {
|
||||
this.getAllPrinter()
|
||||
this.customPrintData.create_time = new Date().toLocaleString()
|
||||
this.customPrintShow = true
|
||||
},
|
||||
sendPrint(data) {
|
||||
console.log(this.printer)
|
||||
const printer = this.printers.filter(item => item.name === this.printer)
|
||||
console.log(printer)
|
||||
data.ip = printer[0].ip
|
||||
data.port = printer[0].port
|
||||
sendPrint(data).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
},
|
||||
getAllPrinter() {
|
||||
getAllPrinter().then(res => {
|
||||
console.log(res)
|
||||
this.printers = res
|
||||
})
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
if (val) {
|
||||
if (val.is_lock === '1') { // 如果点击的是占用状态的行,重置相关数据
|
||||
@@ -1165,6 +1225,7 @@ export default {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* 左侧标签区 - 固定宽度,整洁 */
|
||||
|
||||
@@ -143,6 +143,21 @@ export function getExceptionMessage(deviceCode) {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
//17.打印标签
|
||||
export function sendPrint(data) {
|
||||
return request({
|
||||
url: 'api/handheld/print',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//18.获取所有打印机
|
||||
export function getAllPrinter() {
|
||||
return request({
|
||||
url: 'api/printer/all',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
authLogin, getUserOrDevice, deviceInLogin, regionOrder, fabMaterial, callMater, callEmp, fabOrders, sendMater, sendVehicle, getPointVehicle, loginOut, selectMaterialAndJpg, selectCacheTask, deletevehiclemessage, getExceptionMessage
|
||||
|
||||
Reference in New Issue
Block a user