|
|
|
|
@ -0,0 +1,457 @@
|
|
|
|
|
<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="序列号" prop="serial">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.serial"
|
|
|
|
|
placeholder="请输入序列号"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="仪器名称" prop="instrumentIdArray">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.instrumentIdArray"
|
|
|
|
|
placeholder="请选择类型"
|
|
|
|
|
multiple
|
|
|
|
|
:style="{ width: '100%' }"
|
|
|
|
|
clearable
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in instrumentList"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
:label="item.name"
|
|
|
|
|
:value="item.id">
|
|
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="绑定状态" prop="bindingStatus">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.bindingStatus"
|
|
|
|
|
placeholder="请选择状态"
|
|
|
|
|
:style="{ width: '100%' }"
|
|
|
|
|
clearable
|
|
|
|
|
>
|
|
|
|
|
<el-option label="全部" value="" />
|
|
|
|
|
<el-option label="已绑定" value="0" />
|
|
|
|
|
<el-option label="未绑定" value="1" />
|
|
|
|
|
<el-option label="已解绑" value="1" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="有效状态" prop="validStatus">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.validStatus"
|
|
|
|
|
placeholder="请选择状态"
|
|
|
|
|
:style="{ width: '100%' }"
|
|
|
|
|
clearable
|
|
|
|
|
>
|
|
|
|
|
<el-option label="全部" value="" />
|
|
|
|
|
<el-option label="有效" value="1" />
|
|
|
|
|
<el-option label="无效" value="0" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="来源" prop="source">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.source"
|
|
|
|
|
placeholder="请输入来源"
|
|
|
|
|
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-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
plain
|
|
|
|
|
icon="el-icon-plus"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleAdd"
|
|
|
|
|
v-hasPermi="['system:instrumentSerial:add']"
|
|
|
|
|
>新增</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<!-- <el-col :span="1.5">-->
|
|
|
|
|
<!-- <el-button-->
|
|
|
|
|
<!-- type="success"-->
|
|
|
|
|
<!-- plain-->
|
|
|
|
|
<!-- icon="el-icon-edit"-->
|
|
|
|
|
<!-- size="mini"-->
|
|
|
|
|
<!-- :disabled="single"-->
|
|
|
|
|
<!-- @click="handleUpdate"-->
|
|
|
|
|
<!-- v-hasPermi="['system:instrumentSerial: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="['system:instrumentSerial:remove']"-->
|
|
|
|
|
<!-- >删除</el-button>-->
|
|
|
|
|
<!-- </el-col>-->
|
|
|
|
|
<!-- <el-col :span="1.5">-->
|
|
|
|
|
<!-- <el-button-->
|
|
|
|
|
<!-- type="warning"-->
|
|
|
|
|
<!-- plain-->
|
|
|
|
|
<!-- icon="el-icon-download"-->
|
|
|
|
|
<!-- size="mini"-->
|
|
|
|
|
<!-- @click="handleExport"-->
|
|
|
|
|
<!-- v-hasPermi="['system:instrumentSerial:export']"-->
|
|
|
|
|
<!-- >导出</el-button>-->
|
|
|
|
|
<!-- </el-col>-->
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="serialList" @selection-change="handleSelectionChange">
|
|
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
<el-table-column label="序号" align="center" prop="id" />
|
|
|
|
|
<el-table-column label="序列号" align="center" prop="serial" />
|
|
|
|
|
<el-table-column label="仪器" align="center" prop="instrumentName" />
|
|
|
|
|
<el-table-column label="绑定状态" align="center" prop="bindingStatus" >
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span v-show="scope.row.bindingStatus == 0">已绑定</span>
|
|
|
|
|
<span v-show="scope.row.bindingStatus == 1">未绑定</span>
|
|
|
|
|
<span v-show="scope.row.bindingStatus == 2">已解绑</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="有效状态" align="center" prop="validStatus" >
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span v-show="scope.row.validStatus == 0">无效</span>
|
|
|
|
|
<span v-show="scope.row.validStatus == 1">有效</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="来源" align="center" prop="remark" />
|
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
|
v-hasPermi="['system:instrumentSerial:edit']"
|
|
|
|
|
>编辑</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-view"
|
|
|
|
|
@click="detailShow(scope.row)"
|
|
|
|
|
v-hasPermi="['system:instrumentSerial:remove']"
|
|
|
|
|
>绑定记录</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-share"
|
|
|
|
|
@click="codeShow(scope.row)"
|
|
|
|
|
v-hasPermi="['system:instrumentSerial:remove']"
|
|
|
|
|
>二维码</el-button>
|
|
|
|
|
</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="open" width="500px" append-to-body>
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
|
<!-- <el-form-item label="仪器id" prop="instrumentId">-->
|
|
|
|
|
<!-- <el-input v-model="form.instrumentId" placeholder="请输入仪器id" />-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item label="仪器型号" prop="instrumentName">
|
|
|
|
|
<el-select :disabled="isDisabled(form)"
|
|
|
|
|
v-model="form.instrumentId"
|
|
|
|
|
placeholder="请选择型号"
|
|
|
|
|
:style="{ width: '100%' }"
|
|
|
|
|
clearable
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in instrumentList"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
:label="item.name"
|
|
|
|
|
:value="item.id">
|
|
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="序列号" prop="serial" >
|
|
|
|
|
<el-input v-model="form.serial" placeholder="请输入序列号" :disabled="isDisabled(form)" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
|
|
<el-input v-model="form.remark" placeholder="请输入备注" maxlength="50"/>
|
|
|
|
|
</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>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
<!-- 详情记录对话框 -->
|
|
|
|
|
<el-dialog :title="detailTitle" :visible.sync="detailOpen" width="880px" append-to-body>
|
|
|
|
|
<el-table v-loading="loading" :data="userInstrumentLogList">
|
|
|
|
|
<el-table-column label="序号" align="center" prop="id" />
|
|
|
|
|
<el-table-column label="会员昵称" align="center" prop="wxUserMember.nickName" />
|
|
|
|
|
<el-table-column label="手机号码" align="center" prop="wxUserMember.mobile" />
|
|
|
|
|
<el-table-column label="用户编号" align="center" prop="wxUserMember.id" />
|
|
|
|
|
<el-table-column label="仪器名称" align="center" prop="instrumentName" />
|
|
|
|
|
<el-table-column label="仪器序列号" align="center" prop="serial" />
|
|
|
|
|
<el-table-column label="类型" align="center" prop="bindingStatus" >
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span v-show="scope.row.bindingStatus == 0">已绑定</span>
|
|
|
|
|
<span v-show="scope.row.bindingStatus == 1">未绑定</span>
|
|
|
|
|
<span v-show="scope.row.bindingStatus == 2">已解绑</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作时间" align="center" prop="createTime" >
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<pagination
|
|
|
|
|
v-show="logTotal>0"
|
|
|
|
|
:total="logTotal"
|
|
|
|
|
:page.sync="queryLogParams.pageNum"
|
|
|
|
|
:limit.sync="queryLogParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 二维码-->
|
|
|
|
|
<el-dialog :title="codeTitle" :visible.sync="codeOpen" width="780px" append-to-body>
|
|
|
|
|
<div class="demo-image__lazy">
|
|
|
|
|
<el-image :key="codeUrl" :src="codeUrl" :preview-src-list="[codeUrl]" lazy></el-image>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { listSerial, getSerial, delSerial, addSerial, updateSerial } from "@/api/system/instrumentSerial";
|
|
|
|
|
import {listInstrument} from "@/api/system/instrument";
|
|
|
|
|
import {listLog} from "@/api/system/userInstrumentLog"
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "Serial",
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
codeUrl: "",
|
|
|
|
|
// 二维码标题
|
|
|
|
|
codeTitle: "二维码",
|
|
|
|
|
// 二维码弹窗
|
|
|
|
|
codeOpen: false,
|
|
|
|
|
// 详情标题
|
|
|
|
|
detailTitle: "记录详情",
|
|
|
|
|
// 详情弹窗
|
|
|
|
|
detailOpen: false,
|
|
|
|
|
// 用户仪器绑定日记表格数据
|
|
|
|
|
userInstrumentLogList: [],
|
|
|
|
|
// 仪器列表
|
|
|
|
|
instrumentList: [],
|
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
|
|
|
|
// 选中数组
|
|
|
|
|
ids: [],
|
|
|
|
|
// 非单个禁用
|
|
|
|
|
single: true,
|
|
|
|
|
// 非多个禁用
|
|
|
|
|
multiple: true,
|
|
|
|
|
// 显示搜索条件
|
|
|
|
|
showSearch: true,
|
|
|
|
|
// 总条数
|
|
|
|
|
total: 0,
|
|
|
|
|
logTotal: 0,
|
|
|
|
|
// 仪器序列号关联表格数据
|
|
|
|
|
serialList: [],
|
|
|
|
|
// 弹出层标题
|
|
|
|
|
title: "",
|
|
|
|
|
// 是否显示弹出层
|
|
|
|
|
open: false,
|
|
|
|
|
queryLogParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
userInstrumentId: null,
|
|
|
|
|
},
|
|
|
|
|
// 查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
instrumentId: null,
|
|
|
|
|
source: null,
|
|
|
|
|
instrumentName: null,
|
|
|
|
|
serial: null,
|
|
|
|
|
bindingStatus: null,
|
|
|
|
|
validStatus: null,
|
|
|
|
|
status: null,
|
|
|
|
|
instrumentIdArray: null,
|
|
|
|
|
},
|
|
|
|
|
// 表单参数
|
|
|
|
|
form: {},
|
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
|
|
|
|
instrumentId: [
|
|
|
|
|
{ required: true, message: "仪器id不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
instrumentName: [
|
|
|
|
|
{ required: true, message: "仪器名称不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
serial: [
|
|
|
|
|
{ required: true, message: "序列号不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
bindingStatus: [
|
|
|
|
|
{ required: true, message: "绑定状态,1未绑定,2已解绑不能为空", trigger: "change" }
|
|
|
|
|
],
|
|
|
|
|
validStatus: [
|
|
|
|
|
{ required: true, message: "序列号有效状态,1有效,0无效不能为空", trigger: "change" }
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.queryInstrument();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
isDisabled(row){
|
|
|
|
|
if (row.id) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
},
|
|
|
|
|
queryInstrument(){
|
|
|
|
|
listInstrument({}).then(response => {
|
|
|
|
|
this.instrumentList = response.rows;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 查询仪器序列号关联列表 */
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
listSerial(this.queryParams).then(response => {
|
|
|
|
|
this.serialList = response.rows;
|
|
|
|
|
this.total = response.total;
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 取消按钮
|
|
|
|
|
cancel() {
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
},
|
|
|
|
|
// 表单重置
|
|
|
|
|
reset() {
|
|
|
|
|
this.form = {
|
|
|
|
|
id: null,
|
|
|
|
|
instrumentId: null,
|
|
|
|
|
instrumentName: null,
|
|
|
|
|
serial: null,
|
|
|
|
|
bindingStatus: null,
|
|
|
|
|
validStatus: null,
|
|
|
|
|
status: null,
|
|
|
|
|
createBy: null,
|
|
|
|
|
createTime: null,
|
|
|
|
|
remark: null
|
|
|
|
|
};
|
|
|
|
|
this.resetForm("form");
|
|
|
|
|
},
|
|
|
|
|
/** 展示详情 */
|
|
|
|
|
detailShow(row){
|
|
|
|
|
this.queryLogParams.serial = row.serial;
|
|
|
|
|
listLog(this.queryLogParams).then(response => {
|
|
|
|
|
this.detailOpen = true;
|
|
|
|
|
this.userInstrumentLogList = response.rows;
|
|
|
|
|
this.logTotal = response.total;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.queryParams.pageNum = 1;
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
resetQuery() {
|
|
|
|
|
this.resetForm("queryForm");
|
|
|
|
|
this.handleQuery();
|
|
|
|
|
},
|
|
|
|
|
// 多选框选中数据
|
|
|
|
|
handleSelectionChange(selection) {
|
|
|
|
|
this.ids = selection.map(item => item.id)
|
|
|
|
|
this.single = selection.length!==1
|
|
|
|
|
this.multiple = !selection.length
|
|
|
|
|
},
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
handleAdd() {
|
|
|
|
|
this.reset();
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "添加仪器序列号关联";
|
|
|
|
|
},
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
|
handleUpdate(row) {
|
|
|
|
|
this.reset();
|
|
|
|
|
const id = row.id || this.ids
|
|
|
|
|
getSerial(id).then(response => {
|
|
|
|
|
this.form = response.data;
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "修改仪器序列号关联";
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (this.form.id != null) {
|
|
|
|
|
updateSerial(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
addSerial(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
const ids = row.id || this.ids;
|
|
|
|
|
this.$modal.confirm('是否确认删除仪器序列号关联编号为"' + ids + '"的数据项?').then(function() {
|
|
|
|
|
return delSerial(ids);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
},
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
handleExport() {
|
|
|
|
|
this.download('system/serial/export', {
|
|
|
|
|
...this.queryParams
|
|
|
|
|
}, `serial_${new Date().getTime()}.xlsx`)
|
|
|
|
|
},
|
|
|
|
|
codeShow(row){
|
|
|
|
|
this.codeUrl = process.env.VUE_APP_BASE_API + '/system/qrcode/create?serial=' + row.serial;
|
|
|
|
|
this.codeOpen = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|