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

311 lines
8.3 KiB
Vue
Raw Normal View History

2023-12-12 13:36:08 +08:00
<template>
2024-01-22 09:18:46 +08:00
<div class="app-container" id="labelBindingHistory">
2023-12-20 20:17:03 +08:00
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
2024-03-21 11:28:17 +08:00
<el-form-item label="关键字" prop="keyWord">
2023-12-12 13:36:08 +08:00
<el-input
2024-03-21 11:28:17 +08:00
v-model="queryParams.keyWord"
2023-12-12 13:36:08 +08:00
placeholder="请输入关键字"
2024-03-11 14:57:03 +08:00
clearable maxlength="50"
2023-12-12 13:36:08 +08:00
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
2023-12-19 04:26:18 +08:00
<el-form-item label="设备类型" prop="typeId">
2023-12-12 13:36:08 +08:00
<el-select
2023-12-19 04:26:18 +08:00
v-model="queryParams.typeId"
placeholder="请选择设备类型"
clearable filterable
2023-12-12 13:36:08 +08:00
style="width: 240px"
>
<el-option
2023-12-19 04:26:18 +08:00
v-for="typeItem in typeList"
:key="typeItem.typeId"
:label="typeItem.typeName"
:value="typeItem.typeId"
2023-12-12 13:36:08 +08:00
/>
</el-select>
</el-form-item>
2023-12-19 04:26:18 +08:00
<el-form-item label="规格型号" prop="modelId">
2023-12-12 13:36:08 +08:00
<el-select
2023-12-19 04:26:18 +08:00
v-model="queryParams.modelId"
placeholder="请选择规格型号"
2024-02-26 18:43:14 +08:00
clearable filterable
2023-12-12 13:36:08 +08:00
style="width: 240px"
>
<el-option
2023-12-19 04:26:18 +08:00
v-for="model in modelList"
:key="model.typeId"
:label="model.typeName"
:value="model.typeId"
2023-12-12 13:36:08 +08:00
/>
</el-select>
</el-form-item>
2023-12-20 20:17:03 +08:00
2023-12-12 13:36:08 +08:00
<el-form-item>
2023-12-20 20:17:03 +08:00
<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
>
2023-12-12 13:36:08 +08:00
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
2023-12-20 20:17:03 +08:00
>导出</el-button
>
2023-12-12 13:36:08 +08:00
</el-form-item>
</el-form>
2023-12-20 20:17:03 +08:00
<el-table
v-loading="loading"
:data="historyList"
@selection-change="handleSelectionChange"
>
2023-12-12 13:36:08 +08:00
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" type="index" />
2023-12-20 20:17:03 +08:00
<el-table-column
label="标签类型"
align="center"
prop="name"
:show-overflow-tooltip="true"
/>
<el-table-column label="标签编号" align="center" prop="labelCode">
2023-12-12 13:36:08 +08:00
<template slot-scope="scope">
2023-12-20 20:17:03 +08:00
<span
style="color: blue; cursor: pointer"
@click="labelUploadCode(scope.row)"
>
{{ scope.row.labelCode }}</span
>
2023-12-12 13:36:08 +08:00
</template>
</el-table-column>
2023-12-20 20:17:03 +08:00
<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" />
2023-12-12 13:36:08 +08:00
<el-table-column label="操作类型" align="center" prop="status">
<template slot-scope="scope">
2023-12-22 17:13:57 +08:00
{{ scope.row.status == 0 ? '停用' : '正常' }}
<!-- <dict-tag
2023-12-20 20:17:03 +08:00
:options="dict.type.sys_normal_disable"
:value="scope.row.status"
2023-12-22 17:13:57 +08:00
/> -->
2023-12-12 13:36:08 +08:00
</template>
</el-table-column>
</el-table>
<pagination
2023-12-20 20:17:03 +08:00
v-show="total > 0"
2023-12-12 13:36:08 +08:00
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
2024-03-15 16:30:03 +08:00
<!-- 标签下载对话框 -->
<el-dialog
:title="title"
:visible.sync="uploadOpen"
width="500px"
2024-03-19 11:12:02 +08:00
append-to-body :close-on-click-modal="false"
2024-03-15 16:30:03 +08:00
>
<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>
2023-12-12 13:36:08 +08:00
</div>
</template>
<script>
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
2023-12-20 20:17:03 +08:00
import { listLabelHistoryList } from "@/api/store/label";
2023-12-19 04:26:18 +08:00
import { getTypeList } from "@/api/store/warehousing";
2024-03-15 16:30:03 +08:00
import QRCode from 'qrcodejs2'
2023-12-12 13:36:08 +08:00
export default {
2024-01-22 09:18:46 +08:00
name: "LabelBindingHistory",
2023-12-12 13:36:08 +08:00
dicts: ['sys_normal_disable'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
typeList: [],
2023-12-19 04:26:18 +08:00
modelList: [],
// 字典表格数据
historyList: [],
2023-12-12 13:36:08 +08:00
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
labelType: undefined,
2023-12-12 13:36:08 +08:00
dictType: undefined,
status: undefined
},
// 表单参数
form: {},
// 表单校验
rules: {
labelType: [
2023-12-12 13:36:08 +08:00
{ required: true, message: "字典名称不能为空", trigger: "blur" }
],
dictType: [
{ required: true, message: "字典类型不能为空", trigger: "blur" }
]
2024-03-15 16:30:03 +08:00
},
rowObj: {},
labelmaCode: '',
uploadOpen: false,
2024-03-21 11:28:17 +08:00
qrUrl:'http://112.29.103.165:21624/qrCode/qrCodePage?qrCode=',
2023-12-12 13:36:08 +08:00
};
},
created() {
this.getList();
2023-12-19 04:26:18 +08:00
this.getTypeList();
2023-12-12 13:36:08 +08:00
},
methods: {
2023-12-19 04:26:18 +08:00
/** 查询下拉 */
getTypeList() {
2023-12-20 20:17:03 +08:00
getTypeList({ level: '3' }).then(response => {
this.typeList = response.data;
}
);
getTypeList({ level: '4' }).then(response => {
this.modelList = response.data;
}
);
},
2023-12-12 13:36:08 +08:00
/** 查询字典类型列表 */
getList() {
this.loading = true;
2023-12-19 04:26:18 +08:00
listLabelHistoryList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
2023-12-20 20:17:03 +08:00
this.historyList = response.rows;
this.total = response.total;
this.loading = false;
}
2023-12-12 13:36:08 +08:00
);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
2024-03-21 11:28:17 +08:00
2023-12-12 13:36:08 +08:00
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.labelId)
2023-12-20 20:17:03 +08:00
this.single = selection.length != 1
2023-12-12 13:36:08 +08:00
this.multiple = !selection.length
},
2024-03-21 11:28:17 +08:00
2024-03-15 16:30:03 +08:00
//二维码查看
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)
},
2023-12-12 13:36:08 +08:00
/** 导出按钮操作 */
handleExport() {
2024-03-21 11:28:17 +08:00
this.download('base/maLabelBind/export', {
...this.queryParams
}, `二维码绑定历史_${new Date().getTime()}.xlsx`)
2023-12-12 13:36:08 +08:00
},
2024-03-21 11:28:17 +08:00
2023-12-12 13:36:08 +08:00
}
};
</script>
2024-01-12 10:07:35 +08:00
<style lang="scss" scoped>
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
2024-03-15 16:30:03 +08:00
.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;
}
2024-01-12 10:07:35 +08:00
</style>