devicesmgt/sgzb-ui/src/views/store/label/labelBindingHistory.vue

288 lines
8.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container" id="labelBindingHistory">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="关键字" prop="keyWord">
<el-input
v-model="queryParams.keyWord"
placeholder="请输入关键字"
clearable maxlength="50"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备类型" prop="typeId">
<el-select
v-model="queryParams.typeId"
placeholder="请选择设备类型"
clearable filterable
style="width: 240px"
>
<el-option
v-for="typeItem in typeList"
:key="typeItem.typeId"
:label="typeItem.typeName"
:value="typeItem.typeId"
/>
</el-select>
</el-form-item>
<el-form-item label="规格型号" prop="modelId">
<el-select
v-model="queryParams.modelId"
placeholder="请选择规格型号"
clearable filterable
style="width: 240px"
>
<el-option
v-for="model in modelList"
:key="model.typeId"
:label="model.typeName"
:value="model.typeId"
/>
</el-select>
</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="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button
>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="historyList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" type="index" />
<el-table-column label="标签类型" align="center" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="标签编号" align="center" prop="labelCode">
<template slot-scope="scope">
<span style="color: blue; cursor: pointer" @click="labelUploadCode(scope.row)" >
{{ scope.row.labelCode }}
</span>
</template>
</el-table-column>
<el-table-column label="物品种类" align="center" prop="kindName" :show-overflow-tooltip="true"/>
<el-table-column label="物品名称" align="center" prop="modelName" />
<el-table-column label="规格型号" align="center" prop="typeName" :show-overflow-tooltip="true"/>
<el-table-column label="设备编码" align="center" prop="maCode" />
<el-table-column label="绑定人员" align="center" prop="userName" :show-overflow-tooltip="true"/>
<el-table-column label="操作人员" align="center" prop="userName" />
<el-table-column label="绑定时间" align="center" prop="bindTime" />
<el-table-column label="操作类型" align="center" prop="status">
<template slot-scope="scope">
{{ scope.row.status == 0 ? '停用' : '正常' }}
<!-- <dict-tag
:options="dict.type.sys_normal_disable"
:value="scope.row.status"
/> -->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 标签下载对话框 -->
<el-dialog
:title="title"
:visible.sync="uploadOpen"
width="500px"
append-to-body :close-on-click-modal="false"
>
<div style="text-align: center">
<div class="uploadImg">
<div id="qrcode" class="qrcode" ref="codeItem"></div>
</div>
<div class="maCode">设备编号{{ rowObj.maCode }}</div>
</div>
</el-dialog>
</div>
</template>
<script>
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
import { listLabelHistoryList } from "@/api/store/label";
import { getTypeList } from "@/api/store/warehousing";
import QRCode from 'qrcodejs2'
export default {
name: "LabelBindingHistory",
dicts: ['sys_normal_disable'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
typeList: [],
modelList: [],
// 字典表格数据
historyList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
labelType: undefined,
dictType: undefined,
status: undefined
},
// 表单参数
form: {},
// 表单校验
rules: {
labelType: [
{ required: true, message: "字典名称不能为空", trigger: "blur" }
],
dictType: [
{ required: true, message: "字典类型不能为空", trigger: "blur" }
]
},
rowObj: {},
labelmaCode: '',
uploadOpen: false,
qrUrl:'http://192.168.0.14:21624/qrCode/qrCodePage?qrCode=',
};
},
created() {
this.getList();
this.getTypeList();
},
methods: {
/** 查询下拉 */
getTypeList() {
getTypeList({ level: '3' }).then(response => {
this.typeList = response.data;
}
);
getTypeList({ level: '4' }).then(response => {
this.modelList = response.data;
}
);
},
/** 查询字典类型列表 */
getList() {
this.loading = true;
listLabelHistoryList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.historyList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.labelId)
this.single = selection.length != 1
this.multiple = !selection.length
},
//二维码查看
labelUploadCode(row) {
// if (row.maCode == null) {
// this.$message.error('当前设备没有设备编码');
// return
// }
// this.labelCodeName = ''
this.rowObj = row
this.uploadOpen = true;
this.title = "二维码查看";
this.labelmaCode = row.labelCode
let str = this.qrUrl+row.labelCode
this.$nextTick(() => {
// this.selectionList.forEach((item, index) => {
this.$refs.codeItem.innerHTML = "";
var qrcode = new QRCode(this.$refs.codeItem, {
text: str, //二维码内容
width: 256,
height: 256,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H,
})
// });
}, 500)
},
/** 导出按钮操作 */
handleExport() {
this.download('base/maLabelBind/export', {
...this.queryParams
}, `二维码绑定历史_${new Date().getTime()}.xlsx`)
},
}
};
</script>
<style lang="scss" scoped>
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
.uploadImg {
display: flex;
align-items: center;
justify-content: center;
}
.maCode {
margin-top: 15px;
font-size: 18px;
}
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
</style>