条码信息管理国际化

This commit is contained in:
liuhanqing
2025-07-29 15:21:37 +08:00
parent e1e3ac258e
commit 37a412c042
7 changed files with 238 additions and 107 deletions

View File

@@ -1,26 +1,26 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="条码类型id" prop="formatId">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item :label="$t('traycode.formatId')" prop="formatId">
<el-input
v-model="queryParams.formatId"
placeholder="请输入条码类型id"
:placeholder="$t('traycode.placeholder.formatId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="条码" prop="trayCode">
<el-form-item :label="$t('traycode.trayCode')" prop="trayCode">
<el-input
v-model="queryParams.trayCode"
placeholder="请输入条码"
:placeholder="$t('traycode.placeholder.trayCode')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('traycode.search') }}</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('traycode.reset') }}</el-button>
</el-form-item>
</el-form>
@@ -33,7 +33,7 @@
size="mini"
@click="handleAdd"
v-hasPermi="['bas:traycode:add']"
>新增</el-button>
>{{ $t('traycode.add') }}</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@@ -44,7 +44,7 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['bas:traycode:edit']"
>修改</el-button>
>{{ $t('traycode.edit') }}</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@@ -55,7 +55,7 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['bas:traycode:remove']"
>删除</el-button>
>{{ $t('traycode.delete') }}</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@@ -65,7 +65,7 @@
size="mini"
@click="handleExport"
v-hasPermi="['bas:traycode:export']"
>导出</el-button>
>{{ $t('traycode.export') }}</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@@ -76,7 +76,7 @@
:disabled="multiple"
@click="handleBatchPrint"
v-hasPermi="['bas:traycode:print']"
>批量打印</el-button>
>{{ $t('traycode.batchPrint') }}</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -84,12 +84,12 @@
<el-table ref="table" v-loading="loading" :data="traycodeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="条码类型id" align="center" prop="formatId" />
<el-table-column label="条码" align="center" prop="trayCode" />
<el-table-column :label="$t('traycode.formatId')" align="center" prop="formatId" />
<el-table-column :label="$t('traycode.trayCode')" align="center" prop="trayCode" />
<!-- <el-table-column label="备用字段1" align="center" prop="spare1" />
<el-table-column label="备用字段2" align="center" prop="spare2" />
<el-table-column label="备用字段3" align="center" prop="spare3" /> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column :label="$t('traycode.operation')" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
@@ -97,21 +97,21 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['bas:traycode:edit']"
>修改</el-button>
>{{ $t('traycode.edit') }}</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['bas:traycode:remove']"
>删除</el-button>
>{{ $t('traycode.delete') }}</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-printer"
@click="printBarcode(scope.row)"
v-hasPermi="['bas:traycode:print']"
>打印</el-button>
>{{ $t('traycode.print') }}</el-button>
</template>
</el-table-column>
</el-table>
@@ -126,12 +126,12 @@
<!-- 添加或修改条码信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="条码类型id" prop="formatId">
<el-input v-model="form.formatId" placeholder="请输入条码类型id" />
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item :label="$t('traycode.formatId')" prop="formatId">
<el-input v-model="form.formatId" :placeholder="$t('traycode.placeholder.formatId')" />
</el-form-item>
<el-form-item label="条码" prop="trayCode">
<el-input v-model="form.trayCode" placeholder="请输入条码" />
<el-form-item :label="$t('traycode.trayCode')" prop="trayCode">
<el-input v-model="form.trayCode" :placeholder="$t('traycode.placeholder.trayCode')" />
</el-form-item>
<!-- <el-form-item label="备用字段1" prop="spare1">
<el-input v-model="form.spare1" placeholder="请输入备用字段1" />
@@ -144,8 +144,8 @@
</el-form-item> -->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="submitForm">{{ $t('traycode.confirm') }}</el-button>
<el-button @click="cancel">{{ $t('traycode.cancel') }}</el-button>
</div>
</el-dialog>
</div>
@@ -159,6 +159,8 @@ export default {
name: "Traycode",
data() {
return {
// 设置标题
title: this.$t('traycode.title'),
// 遮罩层
loading: true,
// 选中数组
@@ -246,7 +248,7 @@ export default {
handleAdd() {
this.reset()
this.open = true
this.title = "添加条码信息"
this.title = this.$t('traycode.addTitle')
},
/** 修改按钮操作 */
handleUpdate(row) {
@@ -255,7 +257,7 @@ export default {
getTraycode(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改条码信息"
this.title = this.$t('traycode.editTitle')
})
},
/** 提交按钮 */
@@ -264,13 +266,13 @@ export default {
if (valid) {
if (this.form.id != null) {
updateTraycode(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.$modal.msgSuccess(this.$t('traycode.editSuccess'))
this.open = false
this.getList()
})
} else {
addTraycode(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.$modal.msgSuccess(this.$t('traycode.addSuccess'))
this.open = false
this.getList()
})
@@ -281,11 +283,11 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除条码信息编号为"' + ids + '"的数据项?').then(function() {
this.$modal.confirm(this.$t('traycode.deleteConfirm', { ids })).then(function() {
return delTraycode(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
this.$modal.msgSuccess(this.$t('traycode.deleteSuccess'))
}).catch(() => {})
},
/** 导出按钮操作 */
@@ -300,12 +302,12 @@ export default {
// 获取Lodop打印对象
let LODOP = getLodop()
if (!LODOP) {
this.$modal.msgError("打印控件未安装或启动失败")
this.$modal.msgError(this.$t('traycode.printControlError'))
return
}
LODOP.SET_SHOW_MODE("LANGUAGE", 0);
LODOP.PRINT_INITA(0, 0, 400, 300, "条码打印");
LODOP.PRINT_INITA(0, 0, 400, 300, this.$t('traycode.barcodePrint'));
LODOP.SET_PRINT_PAGESIZE(1, 400, 300, "");
LODOP.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW", 1);
@@ -332,15 +334,15 @@ export default {
LODOP.PREVIEW();
} catch (error) {
console.error('打印失败:', error)
this.$modal.msgError("打印失败: " + error.message)
console.error(this.$t('traycode.printFailed'), error)
this.$modal.msgError(this.$t('traycode.printError', { error: error.message }))
}
},
/** 批量打印按钮操作 */
handleBatchPrint() {
const selection = this.$refs.table.selection;
if (selection.length === 0) {
this.$modal.msgError("请选择要打印的条码");
this.$modal.msgError(this.$t('traycode.selectPrintItems'));
return;
}
console.log(selection)