362 lines
11 KiB
Vue
362 lines
11 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<SearchForm :model="queryParams" ref="queryForm" size="mini" :maxShow="3" label-width="68px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
|
|
|
|
<el-form-item label="" prop="packNo">
|
|
<el-input
|
|
v-model="queryParams.packNo"
|
|
:placeholder="$t('合包号')"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="打印状态" prop="printStatus">
|
|
<el-select v-model="queryParams.printStatus" placeholder="打印状态" >
|
|
<el-option :key="1" label="已打印" value="1" ></el-option>
|
|
<el-option :key="2" label="未打印" value="0" ></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</SearchForm>
|
|
|
|
|
|
<XdTable v-loading="loading"
|
|
border stripe
|
|
size="mini"
|
|
:data="emisTmsPackList"
|
|
:showSearch.sync="showSearch"
|
|
:queryParams="queryParams"
|
|
:total="total"
|
|
@queryTable="getList"
|
|
@selection-change="handleSelectionChange"
|
|
@sort-change="handleSortChange"
|
|
>
|
|
|
|
<div slot="toolbar">
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
plain
|
|
size="mini"
|
|
@click="handleAddPack"
|
|
v-hasPermi="['emis:emisTmsPack:add']"
|
|
>新增条码</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
plain
|
|
size="mini"
|
|
:disabled="multiple"
|
|
@click="handlePrintPreview"
|
|
v-hasPermi="['emis:emisTmsPack:edit']"
|
|
>打印预览</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
plain
|
|
size="mini"
|
|
:disabled="multiple"
|
|
@click="handleBatchPrint"
|
|
v-hasPermi="['emis:emisTmsPack:edit']"
|
|
>打印</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="danger"
|
|
plain
|
|
icon="el-icon-delete"
|
|
size="mini"
|
|
:disabled="multiple"
|
|
@click="handleDelete"
|
|
v-hasPermi="['emis:emisTmsPack:remove']"
|
|
>删除</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<TanexPrinterPanel ref="tanexPrinter" :isShowPinters="true" :isShowTpl="false" :isShowSubBillRange="false" @onPrint="handleBatchPrint"></TanexPrinterPanel>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
|
<el-table-column :label="$t('合包号')" align="center" prop="packNo" min-width="100" />
|
|
<!-- <el-table-column :label="$t('发出网点')" align="center" prop="sendStiteCode" min-width="100" /> -->
|
|
<!-- <el-table-column :label="$t('合包状态')" align="center" prop="packStatus" min-width="100" /> -->
|
|
<el-table-column :label="$t('打印状态')" align="center" prop="printStatus" min-width="100" >
|
|
<template slot-scope="scope">
|
|
<div v-if="scope.row.printStatus == 1" style="color:red;">
|
|
<span class="el-tag el-tag--success">已打印</span>
|
|
</div>
|
|
<div v-if="scope.row.printStatus == 0" style="color:red;">
|
|
<span class="el-tag">待打印</span>
|
|
</div>
|
|
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column :label="$t('条码')" align="center" prop="barcode" min-width="200" >
|
|
<template slot-scope="scope">
|
|
<div>
|
|
<barcode :value="scope.row.packNo" :options="{ height: 25,fontSize:12 }" tag="svg"></barcode>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column :label="$t('创建者')" align="center" prop="createByName" min-width="100" />
|
|
<el-table-column :label="$t('创建时间')" align="center" prop="createTime" min-width="100" />
|
|
<el-table-column :label="$t('创建网点')" align="center" prop="createSiteName" min-width="100" />
|
|
|
|
</XdTable>
|
|
|
|
<!-- <el-drawer
|
|
:destroy-on-close="true"
|
|
v-model="outerVisible"
|
|
title="打印预览内容(单张)"
|
|
>
|
|
<PrinPage id="printMe" :arrList="prinList" v-show="false" />
|
|
<div v-if="!prinList.length">暂无打印数据</div>
|
|
<template #footer>
|
|
<span class="dialog-footer">
|
|
<el-button type="primary" icon="Printer" v-print="printObj"
|
|
>打印条码</el-button
|
|
>
|
|
</span>
|
|
</template>
|
|
</el-drawer> -->
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { listEmisTmsPack, getPackNo, delEmisTmsPack, addEmisTmsPack } from "@/api/emis/emisTmsPack";
|
|
import Barcode from '@/components/Barcode/index';
|
|
import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
|
|
import TanexPrinterPanel from '@/views/emis/EmisBaseTools/TanexPrinterPanel.vue';
|
|
export default {
|
|
name: "emisTmsPack",
|
|
components: { elDateSimplePicker,TanexPrinterPanel,Barcode },
|
|
dicts: [
|
|
],
|
|
data() {
|
|
return {
|
|
// 遮罩层
|
|
loading: true,
|
|
// 选中数组
|
|
ids: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 创建时间搜索
|
|
dateTimeRange:[],
|
|
// 总条数
|
|
total: 0,
|
|
// TMS合包表格数据
|
|
emisTmsPackList: [],
|
|
currentSelection:[],
|
|
|
|
currentId:null,
|
|
openForm: false,
|
|
titleForm: "",
|
|
|
|
// 弹出展示层
|
|
id:null,
|
|
titleView:"",
|
|
openView: false,
|
|
// 更新网点时间范围
|
|
daterangePrintDate: [],
|
|
// 更新网点时间范围
|
|
daterangeCreateTime: [],
|
|
// 更新网点时间范围
|
|
daterangeUpdateTime: [],
|
|
// 查询参数
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 20,
|
|
packNo: null,
|
|
packStatus: '0',
|
|
printStatus: '0',
|
|
},
|
|
};
|
|
},
|
|
created() {
|
|
this.getList();
|
|
},
|
|
methods: {
|
|
handleAddPack() {
|
|
|
|
this.$prompt('请输入需要生成的合包数量', "操作确认", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
closeOnClickModal: false,
|
|
inputPattern: /[1-9][0-9]{0,1}/,
|
|
inputErrorMessage: "数量介于 1 和 99 之间"
|
|
}).then(async ({ value }) => {
|
|
if(!value){
|
|
this.$modal.msgSuccess("输入错误,数量介于 1 和 99 之间" );
|
|
return
|
|
}
|
|
|
|
if(value<1 || value>99){
|
|
this.$modal.msgSuccess("输入错误,数量介于 1 和 99 之间" );
|
|
return
|
|
}
|
|
|
|
this.loading = true;
|
|
for(let i=0;i<value;i++){
|
|
// console.log("===>",value)
|
|
let resPack = await getPackNo();
|
|
if(!resPack || resPack.code != 200){
|
|
this.$message.error(resPack && resPack.msg || "未知错误");
|
|
this.loading = false;
|
|
return;
|
|
}
|
|
|
|
let postData={
|
|
packNo: resPack.data,
|
|
packStatus: '0',
|
|
printStatus:'0'
|
|
}
|
|
|
|
let res=await addEmisTmsPack(postData);
|
|
if(!res || res.code != 200){
|
|
this.$message.error(res && res.msg || "未知错误");
|
|
this.loading = false;
|
|
return;
|
|
}
|
|
}
|
|
|
|
this.loading = false;
|
|
this.$modal.msgSuccess("增加成功");
|
|
|
|
this.getList();
|
|
|
|
}).catch(() => {});
|
|
},
|
|
handleBatchPrint(){
|
|
this.$confirm("确定打印?", "提示", {
|
|
cancelButtonText: "不打印",
|
|
confirmButtonText: "确定打印",
|
|
type: "warning",
|
|
distinguishCancelAndClose: true,
|
|
closeOnClickModal: false
|
|
}).then(() => {
|
|
let orderList=[];
|
|
this.currentSelection.forEach(item=>{
|
|
orderList.push(item.packNo);
|
|
});
|
|
console.log("===>packe==>",orderList);
|
|
|
|
this.$refs.tanexPrinter.batchPrint(orderList,"THB");
|
|
// this.$refs.tanexPrinter.batchPrint(orderList,null,false);
|
|
}).catch(() => {});
|
|
|
|
},
|
|
handlePrintPreview(){
|
|
let orderList=[];
|
|
this.currentSelection.forEach(item=>{
|
|
orderList.push(item.packNo);
|
|
});
|
|
this.$refs.tanexPrinter.printPreview(orderList,false,"THB");
|
|
},
|
|
handleDownPDF(){
|
|
let orderList=[];
|
|
this.currentSelection.forEach(item=>{
|
|
orderList.push(item.packNo);
|
|
});
|
|
this.$refs.tanexPrinter.downPDF(orderList,false,"THB");
|
|
},
|
|
/** 查询TMS合包列表 */
|
|
getList() {
|
|
this.loading = true;
|
|
listEmisTmsPack(this.queryParams).then(response => {
|
|
this.emisTmsPackList = response.rows;
|
|
this.total = response.total;
|
|
this.loading = false;
|
|
});
|
|
},
|
|
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
this.queryParams.pageNum = 1;
|
|
this.getList();
|
|
},
|
|
/** 重置按钮操作 */
|
|
resetQuery() {
|
|
this.resetForm("queryForm");
|
|
this.handleQuery();
|
|
},
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
this.currentSelection=selection;
|
|
this.ids = selection.map(item => item.id)
|
|
this.single = selection.length!==1
|
|
this.multiple = !selection.length
|
|
},
|
|
// 排序 查询字段是表格中字段名字 动态取值排序顺序
|
|
handleSortChange(column) {
|
|
this.queryParams.orderByColumn = column.prop;
|
|
this.queryParams.isAsc = column.order;
|
|
this.getList();
|
|
},
|
|
/** 新增按钮操作 */
|
|
handleAdd(row) {
|
|
this.currentId=null;
|
|
this.openForm= true;
|
|
this.titleForm = "新增";
|
|
},
|
|
handleFormChanged(){
|
|
this.openForm = false;
|
|
this.getList();
|
|
},
|
|
cancelForm(){
|
|
this.openForm = false;
|
|
},
|
|
/** 删除按钮操作 */
|
|
handleDelete(row) {
|
|
const ids = row.id || this.ids;
|
|
this.$modal.confirm('是否确认删除').then(function() {
|
|
return delEmisTmsPack(ids);
|
|
}).then(() => {
|
|
this.getList();
|
|
this.$modal.msgSuccess("删除成功");
|
|
}).catch(() => {});
|
|
},
|
|
|
|
/** 列索引函数 */
|
|
getIndex($index) {
|
|
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
|
|
},
|
|
/** 时间搜索响应函数 */
|
|
dateTimeChange(value){
|
|
this.dateTimeRange=value;
|
|
},
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
@media print {
|
|
@page {
|
|
size: auto; /* 重置页面大小,避免出现空白页 */
|
|
margin-top: 0; /* 取消页眉 */
|
|
margin-bottom: 0; /* 取消页脚 */
|
|
margin-left: 0; margin-right: 0; /* 取消默认左右页边距 */
|
|
}
|
|
}
|
|
|
|
.el-divider{
|
|
margin-top: 0px;
|
|
background: 0 0;
|
|
border-top: 1px solid #E6EBF5;
|
|
}
|
|
.el-divider__text {
|
|
color: #0955ee;
|
|
cursor: pointer;
|
|
}
|
|
</style>
|
|
|