|
|
|
|
@ -65,6 +65,28 @@
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-select v-model="batchOperateValue" placeholder="批量操作" size="mini" clearable>
|
|
|
|
|
<el-option label="导出数据" :value="1"></el-option>
|
|
|
|
|
<el-option label="导出全量数据" :value="2"></el-option>
|
|
|
|
|
<el-option label="批量导入序列号创建" :value="3"></el-option>
|
|
|
|
|
<el-option label="删除批量数据" :value="4"></el-option>
|
|
|
|
|
<el-option label="删除全量数据" :value="5"></el-option>
|
|
|
|
|
<el-option label="修改批量数据" :value="6"></el-option>
|
|
|
|
|
<el-option label="修改全量数据" :value="7"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
plain
|
|
|
|
|
icon="el-icon-warning"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="batchOperate()"
|
|
|
|
|
>确认
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
@ -240,11 +262,55 @@
|
|
|
|
|
<el-image :key="codeUrl" :src="codeUrl" :preview-src-list="[codeUrl]" lazy></el-image>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
<!-- 导出字段选择弹窗 -->
|
|
|
|
|
<el-dialog title="自定义导出字段" :visible.sync="exportFieldsVisible" width="50%"
|
|
|
|
|
:before-close="cancelExportFieldsDialog">
|
|
|
|
|
<el-form ref="form" label-width="150px">
|
|
|
|
|
<el-form-item label="全部字段" prop="allFields">
|
|
|
|
|
<el-switch v-model="allFields" @click.native="isExportAllFields()"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<el-form :inline="true" ref="form" :model="exportFieldList" label-width="150px">
|
|
|
|
|
<el-form-item label="序号 " prop="nickname">
|
|
|
|
|
<el-switch v-model="exportFieldList.id" :active-value="'id'" :inactive-value="null"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="仪器 " prop="instrumentName">
|
|
|
|
|
<el-switch v-model="exportFieldList.instrumentName" active-value="instrumentName" :inactive-value="null"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="来源 " prop="source">
|
|
|
|
|
<el-switch v-model="exportFieldList.source" active-value="source" :inactive-value="null"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="序列号 " prop="serial">
|
|
|
|
|
<el-switch v-model="exportFieldList.serial" active-value="serial" :inactive-value="null"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="有效状态 " prop="validStatus">
|
|
|
|
|
<el-switch v-model="exportFieldList.validStatus" active-value="validStatus" :inactive-value="null"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="创建时间 " prop="createTime">
|
|
|
|
|
<el-switch v-model="exportFieldList.createTime" active-value="createTime" :inactive-value="null"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button @click="cancelExportFieldsDialog()">取 消</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitBatchOperate">确 定</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
<el-dialog title="修改状态" :visible.sync="validStatusVisible" width="400px">
|
|
|
|
|
<div style="margin-left: 10%" >
|
|
|
|
|
<el-radio v-model="updateValidStatusForm.validStatus" label="1">有效</el-radio>
|
|
|
|
|
<el-radio v-model="updateValidStatusForm.validStatus" label="0">无效</el-radio>
|
|
|
|
|
</div>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button @click="cancelUpdateStatusDialog()">取 消</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitBatchOperate">确 定</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { listSerial, getSerial, delSerial, addSerial, updateSerial } from "@/api/system/instrumentSerial";
|
|
|
|
|
import { listSerial, getSerial, delSerial, addSerial, updateSerial,delSerialAll,updateStatus } from "@/api/system/instrumentSerial";
|
|
|
|
|
import {listInstrument} from "@/api/system/instrument";
|
|
|
|
|
import {listLog} from "@/api/system/userInstrumentLog"
|
|
|
|
|
|
|
|
|
|
@ -265,6 +331,8 @@ export default {
|
|
|
|
|
userInstrumentLogList: [],
|
|
|
|
|
// 仪器列表
|
|
|
|
|
instrumentList: [],
|
|
|
|
|
// 有效无效展示框
|
|
|
|
|
validStatusVisible: false,
|
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
|
|
|
|
// 选中数组
|
|
|
|
|
@ -284,11 +352,32 @@ export default {
|
|
|
|
|
title: "",
|
|
|
|
|
// 是否显示弹出层
|
|
|
|
|
open: false,
|
|
|
|
|
batchOperateValue: null,
|
|
|
|
|
// 字段隐藏
|
|
|
|
|
exportFieldsVisible : false,
|
|
|
|
|
allFields: false,
|
|
|
|
|
// 需要导出的字段
|
|
|
|
|
exportFieldList: {
|
|
|
|
|
id: null,
|
|
|
|
|
instrumentName: null,
|
|
|
|
|
source: null,
|
|
|
|
|
serial: null,
|
|
|
|
|
validStatus: null,
|
|
|
|
|
createTime: null,
|
|
|
|
|
},
|
|
|
|
|
exportFieldsForm: {
|
|
|
|
|
instrumentSerialIdList: null,
|
|
|
|
|
exportFields: null,
|
|
|
|
|
},
|
|
|
|
|
queryLogParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
userInstrumentId: null,
|
|
|
|
|
},
|
|
|
|
|
updateValidStatusForm: {
|
|
|
|
|
validStatus: "1",
|
|
|
|
|
instrumentSerialIdList: null,
|
|
|
|
|
},
|
|
|
|
|
// 查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
@ -451,7 +540,134 @@ export default {
|
|
|
|
|
codeShow(row){
|
|
|
|
|
this.codeUrl = process.env.VUE_APP_BASE_API + '/system/qrcode/create?serial=' + row.serial;
|
|
|
|
|
this.codeOpen = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 批量操作
|
|
|
|
|
batchOperate() {
|
|
|
|
|
if (this.batchOperateValue == null) {
|
|
|
|
|
this.$message.error("请选择您的操作");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (this.batchOperateValue == 1) {
|
|
|
|
|
if (this.ids.length == 0) {
|
|
|
|
|
this.$message.error("请选择数据");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.exportFieldsVisible = true;
|
|
|
|
|
}
|
|
|
|
|
if (this.batchOperateValue == 2) {
|
|
|
|
|
this.exportFieldsVisible = true;
|
|
|
|
|
}
|
|
|
|
|
if (this.batchOperateValue == 4) {
|
|
|
|
|
if (this.ids.length == 0) {
|
|
|
|
|
this.$message.error("请选择数据");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.$modal.confirm('确定将选择的数据删除?【请谨慎操作,一旦成功将无法撤销】').then(function() {
|
|
|
|
|
return delSerial(ids);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
}
|
|
|
|
|
if (this.batchOperateValue == 5) {
|
|
|
|
|
this.$modal.confirm('确定将【全量】的数据删除?【请谨慎操作,一旦成功将无法撤销】').then(function() {
|
|
|
|
|
return delSerialAll();
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
}
|
|
|
|
|
if (this.batchOperateValue == 6 ) {
|
|
|
|
|
if (this.ids.length == 0) {
|
|
|
|
|
this.$message.error("请选择数据");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.validStatusVisible = true;
|
|
|
|
|
}
|
|
|
|
|
if (this.batchOperateValue == 7 ) {
|
|
|
|
|
this.validStatusVisible = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 取消操作
|
|
|
|
|
cancelExportFieldsDialog() {
|
|
|
|
|
this.allFields = false;
|
|
|
|
|
this.exportFieldsVisible = false
|
|
|
|
|
this.exportFieldList = {
|
|
|
|
|
id: null,
|
|
|
|
|
instrumentName: null,
|
|
|
|
|
source: null,
|
|
|
|
|
serial: null,
|
|
|
|
|
validStatus: null,
|
|
|
|
|
createTime: null,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 批量操作
|
|
|
|
|
submitBatchOperate() {
|
|
|
|
|
// 导出用户数据
|
|
|
|
|
if (this.batchOperateValue == 1) {
|
|
|
|
|
let exportFields = Object.values(this.exportFieldList).filter(val => val != null);
|
|
|
|
|
if (exportFields.length == 0) {
|
|
|
|
|
this.$modal.msgError("请选择导出字段");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.exportFieldsForm.instrumentSerialIdList = this.ids;
|
|
|
|
|
this.exportFieldsForm.exportFields = exportFields;
|
|
|
|
|
this.download('/system/instrumentSerial/batchExport', {
|
|
|
|
|
...this.exportFieldsForm
|
|
|
|
|
}, `仪器序列号_${new Date().getTime()}.xlsx`);
|
|
|
|
|
this.cancelExportFieldsDialog();
|
|
|
|
|
}
|
|
|
|
|
if (this.batchOperateValue == 2) {
|
|
|
|
|
let exportFields = Object.values(this.exportFieldList).filter(val => val != null);
|
|
|
|
|
if (exportFields.length == 0) {
|
|
|
|
|
this.$modal.msgError("请选择导出字段");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.queryParams.instrumentSerialIdList = null;
|
|
|
|
|
this.queryParams.exportFields = exportFields;
|
|
|
|
|
this.download('/system/instrumentSerial/batchExport', {
|
|
|
|
|
...Object.assign({}, this.queryParams, {exportFields: exportFields})
|
|
|
|
|
}, `仪器序列号_${new Date().getTime()}.xlsx`)
|
|
|
|
|
this.cancelExportFieldsDialog();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.batchOperateValue == 6) {
|
|
|
|
|
this.updateValidStatusForm.instrumentSerialIdList = this.ids;
|
|
|
|
|
updateStatus(this.updateValidStatusForm).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("更新成功");
|
|
|
|
|
this.validStatusVisible = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (this.batchOperateValue == 7) {
|
|
|
|
|
this.updateValidStatusForm.instrumentSerialIdList = null;
|
|
|
|
|
updateStatus(this.updateValidStatusForm).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("更新成功");
|
|
|
|
|
this.validStatusVisible = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
isExportAllFields() {
|
|
|
|
|
if (this.allFields) {
|
|
|
|
|
this.exportFieldList.instrumentName = "instrumentName";
|
|
|
|
|
this.exportFieldList.id = "id";
|
|
|
|
|
this.exportFieldList.source = "source";
|
|
|
|
|
this.exportFieldList.validStatus = "validStatus";
|
|
|
|
|
this.exportFieldList.serial = "serial";
|
|
|
|
|
this.exportFieldList.createTime = "createTime";
|
|
|
|
|
} else {
|
|
|
|
|
this.exportFieldList.instrumentName = null;
|
|
|
|
|
this.exportFieldList.id = null;
|
|
|
|
|
this.exportFieldList.source = null;
|
|
|
|
|
this.exportFieldList.serial = null;
|
|
|
|
|
this.exportFieldList.validStatus = null;
|
|
|
|
|
this.exportFieldList.createTime = null;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
cancelUpdateStatusDialog (){
|
|
|
|
|
this.validStatusVisible = false;
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|