中航光电热表web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

416 lines
10 KiB

<template>
5 months ago
<div>
<avue-crud
:option="option"
:table-loading="loading"
:data="data"
v-model="form"
v-model:page="page"
ref="crud"
@row-del="rowDel"
@row-update="rowUpdate"
5 months ago
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
<template #menu-left>
<el-button type="primary" @click="moldAddFn(null, true)">新增</el-button>
5 months ago
<!-- <el-button type="danger" icon="el-icon-delete" @click="handleDelete">
</el-button> -->
5 months ago
</template>
<template #menu-right>
<el-button type="primary" @click="handleImport">导入 </el-button>
5 months ago
</template>
</avue-crud>
<!-- 导入 -->
<basic-import
v-if="isShowImport"
title="导入"
:isShow="isShowImport"
templateUrl="/blade-desk/bsDosingRec/downloadExcelTemplate"
templateName="废气加药记录导入模板.xls"
importUrl="/blade-desk/bsDosingRec/importExcel"
3 months ago
@closeDialog="closeImportDialog"
:basicImportSearch="search"
5 months ago
></basic-import>
<!-- 新增 -->
<addEditDialogDosingRecord
v-if="addOpen"
:showDialog="addOpen"
@closeDialog="closeDialog"
:moldAddMore="moldAddMore"
:dosingManList="dosingManList"
@submitData="handleSubmitData"
>
</addEditDialogDosingRecord>
5 months ago
</div>
</template>
<script>
5 months ago
import basicImport from '@/components/basic-import/main.vue';
import addEditDialogDosingRecord from './addEditDialogDosingRecord.vue';
import {
getList,
remove,
add,
update,
getDosingManList,
} from '@/api/safetyManagement/dosingRecord.js';
export default {
5 months ago
components: {
basicImport,
addEditDialogDosingRecord,
5 months ago
},
5 months ago
data() {
return {
dosingManList: [],
addOpen: false, //新增弹窗
moldAddMore: false,
5 months ago
isShowImport: false,
loading: false,
5 months ago
selectionList: [],
search: {
dorType: '1',
},
5 months ago
option: {
addBtn: false,
5 months ago
height: 'auto',
5 months ago
calcHeight: 32,
tip: false,
simplePage: true,
searchShow: true,
searchMenuSpan: 6,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
index: true,
selection: true,
viewBtn: false,
delBtn: false,
5 months ago
editBtnText: '修改',
addBtnIcon: ' ',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
viewBtnText: '详情',
5 months ago
labelWidth: 120,
menuWidth: 80,
5 months ago
dialogWidth: 1040,
dialogClickModal: false,
searchEnter: true,
excelBtn: false,
filterBtn: true,
searchShowBtn: false,
columnSort: true,
excelBtn: true,
columnSort: true,
index: false,
showOverflowTooltip: true,
5 months ago
searchLabelPosition: 'left',
searchLabelPosition: 'left',
5 months ago
searchGutter: 24,
searchSpan: 6,
menuAlign: 'center',
5 months ago
gridBtn: false,
5 months ago
searchMenuPosition: 'right',
align: 'center',
5 months ago
column: [
{
5 months ago
label: '设施',
prop: 'device',
5 months ago
sortable: true,
filter: true,
3 months ago
width: 210,
5 months ago
search: true,
rules: [
{
required: true,
message: '请输入设施',
5 months ago
trigger: 'blur',
5 months ago
},
],
3 months ago
searchLabelWidth: 50,
5 months ago
},
{
5 months ago
label: '药品',
prop: 'drug',
5 months ago
search: true,
sortable: true,
filter: true,
3 months ago
width: 210,
5 months ago
rules: [
{
required: true,
message: '请输入药品',
5 months ago
trigger: 'blur',
5 months ago
},
],
3 months ago
searchLabelWidth: 50,
5 months ago
},
{
5 months ago
label: '剂量(kg)',
prop: 'dose',
5 months ago
search: true,
sortable: true,
filter: true,
3 months ago
width: 210,
5 months ago
rules: [
{
required: true,
message: '请输入剂量(kg)',
5 months ago
trigger: 'blur',
5 months ago
},
],
3 months ago
searchLabelWidth: 70,
5 months ago
},
{
5 months ago
label: '加药时间',
prop: 'queryDosingTime',
5 months ago
search: true,
3 months ago
width: 210,
5 months ago
sortable: true,
filter: true,
3 months ago
hide: true,
editDisplay: false,
type: 'datetime',
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
rules: [
{
required: true,
message: '请选择加药时间',
trigger: 'blur',
},
],
searchRange: true,
3 months ago
searchLabelWidth: 80,
},
{
label: '加药时间',
prop: 'dosingTime',
// search: true,
sortable: true,
filter: true,
type: 'datetime',
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
5 months ago
rules: [
{
required: true,
message: '请选择加药时间',
5 months ago
trigger: 'blur',
5 months ago
},
],
},
{
5 months ago
label: '加药人',
3 months ago
prop: 'dosingMan',
search: true,
3 months ago
width: 210,
searchLabelWidth: 60,
5 months ago
sortable: true,
filter: true,
type: 'select',
3 months ago
dicData: [],
5 months ago
rules: [
{
required: true,
message: '请选择加药人',
5 months ago
trigger: 'blur',
5 months ago
},
],
3 months ago
props: {
label: 'name',
value: 'id',
3 months ago
},
5 months ago
},
{
5 months ago
label: '备注',
prop: 'memo',
5 months ago
search: false,
sortable: true,
filter: true,
},
],
},
form: {},
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
};
},
3 months ago
mounted() {
this.fetchDosingManList();
3 months ago
},
5 months ago
methods: {
3 months ago
// 加药人
fetchDosingManList() {
getDosingManList({
current: 1,
size: 10000000,
roleId: '2008474700619563009',
3 months ago
}).then(res => {
const result = res.data.data.records;
this.dosingManList = result;
console.log('加药人result', result);
3 months ago
this.option.column.forEach(col => {
if (col.prop === 'dosingMan') {
col.dicData = this.dosingManList;
}
});
});
3 months ago
},
// 新增
moldAddFn(row, flag) {
this.addOpen = true;
this.moldAddMore = flag;
},
//关闭弹窗
closeDialog() {
this.addOpen = false;
this.onLoad(this.page);
3 months ago
},
// 关闭导入弹窗
closeImportDialog() {
this.isShowImport = false;
this.onLoad(this.page);
},
//更新
rowUpdate(row, index, done, loading) {
update(row).then(
() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
done();
},
error => {
window.console.log(error);
loading();
}
);
},
// 处理子组件提交的数据
handleSubmitData(data) {
add(data).then(
res => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
this.addOpen = false;
done();
},
error => {
window.console.log(error);
loading();
}
);
},
5 months ago
// 点击导入按钮
handleImport() {
this.isShowImport = true;
5 months ago
},
//刷新
refreshChange() {
this.onLoad(this.page, this.query);
},
//删除
5 months ago
handleDelete() {
if (this.selectionList.length === 0) {
5 months ago
this.$message.warning('请选择至少一条数据');
5 months ago
return;
}
5 months ago
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return remove(this.ids);
})
.then(() => {
// 刷新表格数据并重载
this.data = [];
this.parentId = 0;
this.$refs.crud.refreshTable();
this.$refs.crud.toggleSelection();
// 表格数据重载
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
});
},
5 months ago
// 多选
selectionChange(list) {
this.selectionList = list;
},
//搜索
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
// 搜索重置
searchReset() {
this.query = {};
this.onLoad(this.page);
},
// 加载页面数据
onLoad(page, params = {}) {
5 months ago
this.loading = true;
this.query = { ...this.query, dorType: 1 }; //类型:1、废气加药;2、废水加药
const requestParams = Object.assign({}, params, this.query);
// 后端要字符串类型
if (requestParams.queryDosingTime && Array.isArray(requestParams.queryDosingTime)) {
requestParams.queryDosingTime = requestParams.queryDosingTime.join(',');
}
getList(page.currentPage, page.pageSize, requestParams)
.then(res => {
// this.data = [
// {
// bsTower: null,
// device: '121',
// dorId: 141,
// dorType: 1,
// dose: 121.0,
// dosingMan: {
// userId: 521,
// userName: '测试',
// },
// dosingTime: '2023-09-13 00:00:00',
// drug: '212',
// handleResult: 1,
// handleResultTitle: '手动新增',
// keyValue: 141,
// memo: '11',
// },
// ];
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
})
.catch(() => {
this.loading = false;
});
5 months ago
},
},
};
</script>
5 months ago
<style lang="scss" scoped></style>