中航光电热表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.

353 lines
8.8 KiB

8 months ago
<template>
<basic-container>
7 months ago
<avue-crud
:option="option"
:table-loading="loading"
:data="data"
v-model="form"
v-model:page="page"
ref="crud"
@row-del="rowDel"
@row-save="rowSave"
@row-update="rowUpdate"
7 months ago
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
8 months ago
<template #menu-left>
<el-button type="primary" @click="handleAdd">新增 </el-button>
7 months ago
<el-button type="danger" icon="el-icon-delete" @click="handleDelete"
>删除
8 months ago
</el-button>
</template>
<template #menu-right>
6 months ago
<el-button type="primary" icon="el-icon-upload" @click="handleImport"
7 months ago
>导入
8 months ago
</el-button>
</template>
</avue-crud>
6 months ago
<!-- 导入 -->
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport"
templateUrl="/blade-desk/bsEpciuInspectionPoint/downloadExcelTemplate"
templateName="环保巡检点配置表模板.xlsx"
importUrl="/blade-desk/bsEpciuInspectionPoint/importExcel"
@closeDialog="closeImportDialog"></basic-import>
<!-- 新增弹窗 -->
<addInspectDailog v-if="showDialog" :showDialog="showDialog" :moldAddMore="moldAddMore" @closeDialog="closeDialog"
:title="title"></addInspectDailog>
8 months ago
</basic-container>
</template>
<script>
import basicImport from '@/components/basic-import/main.vue';
import { getList, add, remove, update } from '@/api/safetyManagement/equipmentInspectionPoint';
import addInspectDailog from './addInspectDailog.vue'
8 months ago
export default {
6 months ago
components: {
basicImport,
addInspectDailog
6 months ago
},
8 months ago
data() {
return {
6 months ago
isShowImport:false,
8 months ago
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
selectionList: [],
8 months ago
data: [],
option: {
7 months ago
height: "auto",
8 months ago
calcHeight: 32,
tip: false,
7 months ago
size: "medium",
8 months ago
simplePage: true,
searchShow: true,
searchMenuSpan: 6,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
index: true,
selection: true,
viewBtn: false,
delBtn: false,
addBtn: false,
8 months ago
editBtn: true,
7 months ago
editBtnText: "修改",
addBtnIcon: " ",
viewBtnIcon: " ",
delBtnIcon: " ",
editBtnIcon: " ",
8 months ago
labelWidth: 120,
menuWidth: 150,
dialogWidth: 600,
dialogClickModal: false,
searchEnter: true,
excelBtn: false,
filterBtn: true,
searchShowBtn: false,
columnSort: true,
excelBtn: true,
columnSort: true,
index: false,
showOverflowTooltip: true,
7 months ago
searchLabelPosition: "left",
searchLabelPosition: "left",
searchGutter: 24,
searchSpan: 6,
menuAlign: "left",
gridBtn: false,
searchMenuPosition: "right",
align: "center",
8 months ago
column: [
{
7 months ago
label: "巡检点编号",
prop: "insNum",
8 months ago
sortable: true,
filter: true,
span: 24,
search: true,
searchLabelWidth: 90,
rules: [
{
required: false,
7 months ago
message: "请输入巡检点编号",
trigger: "blur",
8 months ago
},
],
},
{
7 months ago
label: "巡检点位置",
prop: "insSite",
8 months ago
sortable: true,
filter: true,
span: 24,
search: true,
searchLabelWidth: 90,
rules: [
{
required: false,
7 months ago
message: "请输入巡检点位置",
trigger: "blur",
8 months ago
},
],
},
{
7 months ago
label: "巡检点类型",
prop: "insType",
sortable: true,
filter: true,
span: 24,
search: true,
searchLabelWidth: 90,
type: 'select',
dicData: [
{ label: '废水巡检点', value: '1' },
{ label: '废气巡检点', value: '2' },
],
rules: [
{
required: false,
7 months ago
message: "请输入巡检点位置",
trigger: "blur",
},
],
},
{
label: "巡检周期(h)",
prop: "insCycle",
sortable: true,
filter: true,
span: 24,
search: false,
searchLabelWidth: 90,
// type: 'number',
rules: [
{
required: false,
message: "请输入巡检周期(h)",
trigger: "blur",
},
],
},
8 months ago
{
7 months ago
label: "上次检验日期",
prop: "lastInsCycle",
8 months ago
sortable: true,
filter: true,
span: 24,
search: false,
display: false,
searchLabelWidth: 100,
},
{
7 months ago
label: "备注",
prop: "memo",
8 months ago
sortable: true,
filter: true,
span: 24,
search: false,
7 months ago
type: "textarea",
8 months ago
searchLabelWidth: 90,
rows: 3,
rules: [
{
required: false,
7 months ago
message: "请输入备注",
trigger: "blur",
8 months ago
},
],
},
7 months ago
],
8 months ago
},
title: '新增',
showDialog: false,
moldAddMore: false,
7 months ago
};
8 months ago
},
computed: {
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(',');
},
},
8 months ago
methods: {
6 months ago
// 点击导入按钮
handleImport() {
this.isShowImport = true
},
// 关闭导入弹窗
closeImportDialog() {
this.isShowImport = false;
this.onLoad(this.page);
},
// 保存
rowSave(row, done, loading) {
add(row).then(
res => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
done();
8 months ago
},
error => {
window.console.log(error);
loading();
}
);
},
//删除
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning('请选择至少一条数据');
return;
}
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: '操作成功!',
});
});
},
//更新
rowUpdate(row, index, done, loading) {
update(row).then(
() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
done();
8 months ago
},
error => {
window.console.log(error);
loading();
}
);
},
//选择行
selectionChange(list) {
this.selectionList = list;
},
// 搜索重置
searchReset() {
this.query = {}
this.onLoad(this.page)
},
selectionClear() {
this.selectionList = [];
this.$refs.table.clearSelection();
},
// 加载页面数据
onLoad(page, params = {}) {
this.loading = true;
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(
(res) => {
this.data = res.data.data.records;
this.loading = false;
this.page.total = res.data.data.total;
}
);
},
//刷新
refreshChange() {
this.onLoad(this.page, this.query);
},
//搜索
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params)
done()
},
// 关闭弹窗
5 months ago
closeDialog(isRefresh=false) {
this.showDialog = false;
5 months ago
if (isRefresh) {
this.onLoad(this.page);
}
},
// 新增
handleAdd() {
this.title = '新增';
// this.tableData = [];
this.showDialog = true;
this.moldAddMore = true;
7 months ago
},
},
};
8 months ago
</script>
7 months ago
<style></style>