You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

981 lines
48 KiB
Vue

<template>
<div class="app-container">
<!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="类型" prop="type">
<el-input
v-model="queryParams.type"
placeholder="请输入类型"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="UPS安装柜体名称" prop="upsInstallationCabinetName">
<el-input
v-model="queryParams.upsInstallationCabinetName"
placeholder="请输入UPS安装柜体名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="参照位置" prop="referenceLocation">
<el-input
v-model="queryParams.referenceLocation"
placeholder="请输入参照位置"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="现UPS来源" prop="currentUps">
<el-input
v-model="queryParams.currentUps"
placeholder="请输入现UPS来源"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="取电" prop="powerSource">
<el-input
v-model="queryParams.powerSource"
placeholder="请输入取电"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="涉及区域" prop="affectedArea">
<el-input
v-model="queryParams.affectedArea"
placeholder="请输入涉及区域"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input
v-model="queryParams.remarks"
placeholder="请输入备注"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="第1次" prop="replacement1">
<el-input
v-model="queryParams.replacement1"
placeholder="请输入第1次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="第2次" prop="replacement2">
<el-input
v-model="queryParams.replacement2"
placeholder="请输入第2次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="第3次" prop="replacement3">
<el-input
v-model="queryParams.replacement3"
placeholder="请输入第3次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="第4次" prop="replacement4">
<el-input
v-model="queryParams.replacement4"
placeholder="请输入第4次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="第5次" prop="replacement5">
<el-input
v-model="queryParams.replacement5"
placeholder="请输入第5次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="第6次" prop="replacement6">
<el-input
v-model="queryParams.replacement6"
placeholder="请输入第6次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="第7次" prop="replacement7">
<el-input
v-model="queryParams.replacement7"
placeholder="请输入第7次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="第8次" prop="replacement8">
<el-input
v-model="queryParams.replacement8"
placeholder="请输入第8次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="第9次" prop="replacement9">
<el-input
v-model="queryParams.replacement9"
placeholder="请输入第9次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="第10次" prop="replacement10">
<el-input
v-model="queryParams.replacement10"
placeholder="请输入第10次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="第11次" prop="replacement11">
<el-input
v-model="queryParams.replacement11"
placeholder="请输入第11次"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="第12次" prop="replacement12">
<el-input
v-model="queryParams.replacement12"
placeholder="请输入第12次"
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="['ems/info:upsBatteryLifecycle: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="['ems/info:upsBatteryLifecycle: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="['ems/info:upsBatteryLifecycle: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="['ems/info:upsBatteryLifecycle:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['ems/info:upsBatteryLifecycle:add']"
>导入</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="upsBatteryLifecycleList" @selection-change="handleSelectionChange" @row-contextmenu="handleRowContextMenu" class="context-menu-table">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" width="60" v-if="columns[0].visible">
<template slot-scope="scope">
{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column label="类型" align="center" prop="type" v-if="columns[1].visible"/>
<el-table-column label="UPS安装柜体名称" align="center" prop="upsInstallationCabinetName" v-if="columns[2].visible"/>
<el-table-column label="参照位置" align="center" prop="referenceLocation" v-if="columns[3].visible"/>
<el-table-column label="位置描述" align="center" prop="locationDescription" v-if="columns[4].visible"/>
<el-table-column label="现UPS来源" align="center" prop="currentUps" v-if="columns[5].visible"/>
<el-table-column label="取电" align="center" prop="powerSource" v-if="columns[6].visible"/>
<el-table-column label="涉及区域" align="center" prop="affectedArea" v-if="columns[7].visible"/>
<el-table-column label="备注" align="center" prop="remarks" v-if="columns[8].visible"/>
<el-table-column label="第1次" align="center" prop="replacement1" v-if="columns[9].visible"/>
<el-table-column label="第2次" align="center" prop="replacement2" v-if="columns[10].visible"/>
<el-table-column label="第3次" align="center" prop="replacement3" v-if="columns[11].visible"/>
<el-table-column label="第4次" align="center" prop="replacement4" v-if="columns[12].visible"/>
<el-table-column label="第5次" align="center" prop="replacement5" v-if="columns[13].visible"/>
<el-table-column label="第6次" align="center" prop="replacement6" v-if="columns[14].visible"/>
<el-table-column label="第7次" align="center" prop="replacement7" v-if="columns[15].visible"/>
<el-table-column label="第8次" align="center" prop="replacement8" v-if="columns[16].visible"/>
<el-table-column label="第9次" align="center" prop="replacement9" v-if="columns[17].visible"/>
<el-table-column label="第10次" align="center" prop="replacement10" v-if="columns[18].visible"/>
<el-table-column label="第11次" align="center" prop="replacement11" v-if="columns[19].visible"/>
<el-table-column label="第12次" align="center" prop="replacement12" v-if="columns[20].visible"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleViewDetail(scope.row)"
>详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ems/info:upsBatteryLifecycle:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ems/info:upsBatteryLifecycle: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"
/>
<!-- 添加 或修改 行李系统UPS电池生命周期对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="类型" prop="type">
<el-input v-model="form.type" placeholder="请输入类型" />
</el-form-item>
<el-form-item label="UPS安装柜体名称" prop="upsInstallationCabinetName">
<el-input v-model="form.upsInstallationCabinetName" placeholder="请输入UPS安装柜体名称" />
</el-form-item>
<el-form-item label="参照位置" prop="referenceLocation">
<el-input v-model="form.referenceLocation" placeholder="请输入参照位置" />
</el-form-item>
<el-form-item label="位置描述" prop="locationDescription">
<el-input v-model="form.locationDescription" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="现UPS来源" prop="currentUps">
<el-input v-model="form.currentUps" placeholder="请输入现UPS来源" />
</el-form-item>
<el-form-item label="取电" prop="powerSource">
<el-input v-model="form.powerSource" placeholder="请输入取电" />
</el-form-item>
<el-form-item label="涉及区域" prop="affectedArea">
<el-input v-model="form.affectedArea" placeholder="请输入涉及区域" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" placeholder="请输入备注" />
</el-form-item>
<el-form-item label="第1次" prop="replacement1">
<el-date-picker
v-model="form.replacement1"
type="date"
placeholder="请选择第1次日期"
value-format="yyyy/MM/dd"
format="yyyy/MM/dd"
/>
</el-form-item>
<el-form-item label="第2次" prop="replacement2">
<el-date-picker
v-model="form.replacement2"
type="date"
placeholder="请选择第2次日期"
value-format="yyyy/MM/dd"
format="yyyy/MM/dd"
/>
</el-form-item>
<el-form-item label="第3次" prop="replacement3">
<el-date-picker
v-model="form.replacement3"
type="date"
placeholder="请选择第3次日期"
value-format="yyyy/MM/dd"
format="yyyy/MM/dd"
/>
</el-form-item>
<el-form-item label="第4次" prop="replacement4">
<el-date-picker
v-model="form.replacement4"
type="date"
placeholder="请选择第4次日期"
value-format="yyyy/MM/dd"
format="yyyy/MM/dd"
/>
</el-form-item>
<el-form-item label="第5次" prop="replacement5">
<el-date-picker
v-model="form.replacement5"
type="date"
placeholder="请选择第5次日期"
value-format="yyyy/MM/dd"
format="yyyy/MM/dd"
/>
</el-form-item>
<el-form-item label="第6次" prop="replacement6">
<el-date-picker
v-model="form.replacement6"
type="date"
placeholder="请选择第6次日期"
value-format="yyyy/MM/dd"
format="yyyy/MM/dd"
/>
</el-form-item>
<el-form-item label="第7次" prop="replacement7">
<el-date-picker
v-model="form.replacement7"
type="date"
placeholder="请选择第7次日期"
value-format="yyyy/MM/dd"
format="yyyy/MM/dd"
/>
</el-form-item>
<el-form-item label="第8次" prop="replacement8">
<el-date-picker
v-model="form.replacement8"
type="date"
placeholder="请选择第8次日期"
value-format="yyyy/MM/dd"
format="yyyy/MM/dd"
/>
</el-form-item>
<el-form-item label="第9次" prop="replacement9">
<el-date-picker
v-model="form.replacement9"
type="date"
placeholder="请选择第9次日期"
value-format="yyyy/MM/dd"
format="yyyy/MM/dd"
/>
</el-form-item>
<el-form-item label="第10次" prop="replacement10">
<el-date-picker
v-model="form.replacement10"
type="date"
placeholder="请选择第10次日期"
value-format="yyyy/MM/dd"
format="yyyy/MM/dd"
/>
</el-form-item>
<el-form-item label="第11次" prop="replacement11">
<el-date-picker
v-model="form.replacement11"
type="date"
placeholder="请选择第11次日期"
value-format="yyyy/MM/dd"
format="yyyy/MM/dd"
/>
</el-form-item>
<el-form-item label="第12次" prop="replacement12">
<el-date-picker
v-model="form.replacement12"
type="date"
placeholder="请选择第12次日期"
value-format="yyyy/MM/dd"
format="yyyy/MM/dd"
/>
</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="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<!-- <div class="el-upload__tip" slot="tip">
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的数据
</div> -->
<span>仅允许导入xls、xlsx格式文件。</span>
<!-- <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link> -->
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</div>
</el-dialog>
<!-- 详情抽屉 -->
<el-drawer
title="UPS电池生命周期详情"
:visible.sync="detailDrawer"
direction="rtl"
size="60%"
:before-close="() => detailDrawer = false"
>
<div style="padding: 20px;">
<el-descriptions :column="1" border>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">类型</span>
</template>
{{ currentRecord.type || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">UPS安装柜体名称</span>
</template>
{{ currentRecord.upsInstallationCabinetName || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">参照位置</span>
</template>
{{ currentRecord.referenceLocation || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">位置描述</span>
</template>
<div style="max-height: 100px; overflow-y: auto;">
{{ currentRecord.locationDescription || '-' }}
</div>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">现UPS来源</span>
</template>
{{ currentRecord.currentUps || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">取电</span>
</template>
{{ currentRecord.powerSource || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">涉及区域</span>
</template>
{{ currentRecord.affectedArea || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">备注</span>
</template>
<div style="max-height: 100px; overflow-y: auto;">
{{ currentRecord.remarks || '-' }}
</div>
</el-descriptions-item>
<!-- 更换记录 -->
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block; color: #409eff;">更换记录</span>
</template>
<span style="color: #409eff;">以下为12次更换记录</span>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">第1次</span>
</template>
{{ currentRecord.replacement1 || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">第2次</span>
</template>
{{ currentRecord.replacement2 || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">第3次</span>
</template>
{{ currentRecord.replacement3 || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">第4次</span>
</template>
{{ currentRecord.replacement4 || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">第5次</span>
</template>
{{ currentRecord.replacement5 || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">第6次</span>
</template>
{{ currentRecord.replacement6 || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">第7次</span>
</template>
{{ currentRecord.replacement7 || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">第8次</span>
</template>
{{ currentRecord.replacement8 || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">第9次</span>
</template>
{{ currentRecord.replacement9 || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">第10次</span>
</template>
{{ currentRecord.replacement10 || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">第11次</span>
</template>
{{ currentRecord.replacement11 || '-' }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<span style="font-weight: bold; width: 90px; display: inline-block;">第12次</span>
</template>
{{ currentRecord.replacement12 || '-' }}
</el-descriptions-item>
</el-descriptions>
</div>
</el-drawer>
<!-- 右击菜单 -->
<div
v-show="contextMenu.visible"
:style="{
position: 'fixed',
top: contextMenu.top + 'px',
left: contextMenu.left + 'px',
zIndex: 9999
}"
class="context-menu"
@click.stop
>
<div class="context-menu-item" @click="contextMenuViewDetail">
<i class="el-icon-view"></i> 查看详情
</div>
<div
class="context-menu-item"
@click="contextMenuEdit"
v-if="checkPermi(['ems/info:upsBatteryLifecycle:edit'])"
>
<i class="el-icon-edit"></i> 修改
</div>
<div
class="context-menu-item"
@click="contextMenuDelete"
v-if="checkPermi(['ems/info:upsBatteryLifecycle:remove'])"
>
<i class="el-icon-delete"></i>
</div>
</div>
</div>
</template>
<script>
import { listUpsBatteryLifecycle, getUpsBatteryLifecycle, delUpsBatteryLifecycle, addUpsBatteryLifecycle, updateUpsBatteryLifecycle } from "@/api/ems/info/upsBatteryLifecycle";
import { getToken } from "@/utils/auth";
import { checkPermi } from "@/utils/permission";
export default {
name: "UpsBatteryLifecycle",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 行李系统UPS电池生命周期表格数据
upsBatteryLifecycleList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
type: null,
upsInstallationCabinetName: null,
referenceLocation: null,
locationDescription: null,
currentUps: null,
powerSource: null,
affectedArea: null,
remarks: null,
replacement1: null,
replacement2: null,
replacement3: null,
replacement4: null,
replacement5: null,
replacement6: null,
replacement7: null,
replacement8: null,
replacement9: null,
replacement10: null,
replacement11: null,
replacement12: null
},
// 表单参数
form: {},
// 表单校验
rules: {
upsInstallationCabinetName: [
{ required: true, message: "UPS安装柜体名称不能为空", trigger: "blur" }
],
referenceLocation: [
{ required: true, message: "参照位置不能为空", trigger: "blur" }
]
},
columns: [
{ key: 0, label: `序号`, visible: true },
{ key: 1, label: `类型`, visible: true },
{ key: 2, label: `UPS安装柜体名称`, visible: true },
{ key: 3, label: `参照位置`, visible: true },
{ key: 4, label: `位置描述`, visible: true },
{ key: 5, label: `现UPS来源`, visible: true },
{ key: 6, label: `取电`, visible: true },
{ key: 7, label: `涉及区域`, visible: true },
{ key: 8, label: `备注`, visible: true },
{ key: 9, label: `第1次`, visible: true },
{ key: 10, label: `第2次`, visible: true },
{ key: 11, label: `第3次`, visible: true },
{ key: 12, label: `第4次`, visible: true },
{ key: 13, label: `第5次`, visible: true },
{ key: 14, label: `第6次`, visible: true },
{ key: 15, label: `第7次`, visible: true },
{ key: 16, label: `第8次`, visible: true },
{ key: 17, label: `第9次`, visible: true },
{ key: 18, label: `第10次`, visible: true },
{ key: 19, label: `第11次`, visible: true },
{ key: 20, label: `第12次`, visible: true },
],
// 导入参数
upload: {
// 是否显示弹出层(导入)
open: false,
// 弹出层标题(导入)
title: "",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/ems/info/upsBatteryLifecycle/importData"
},
// 详情抽屉
detailDrawer: false,
currentRecord: {},
// 右击菜单
contextMenu: {
visible: false,
top: 0,
left: 0,
row: null
}
};
},
created() {
this.getList();
},
mounted() {
document.addEventListener('click', this.hideContextMenu);
},
beforeDestroy() {
document.removeEventListener('click', this.hideContextMenu);
},
methods: {
/** 查询行李系统UPS电池生命周期列表 */
getList() {
this.loading = true;
listUpsBatteryLifecycle(this.queryParams).then(response => {
this.upsBatteryLifecycleList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
type: null,
upsInstallationCabinetName: null,
referenceLocation: null,
locationDescription: null,
currentUps: null,
powerSource: null,
affectedArea: null,
remarks: null,
replacement1: null,
replacement2: null,
replacement3: null,
replacement4: null,
replacement5: null,
replacement6: null,
replacement7: null,
replacement8: null,
replacement9: null,
replacement10: null,
replacement11: null,
replacement12: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
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 = "添加 行李系统UPS电池生命周期";
},
/** 修改 按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getUpsBatteryLifecycle(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改 行李系统UPS电池生命周期";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateUpsBatteryLifecycle(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addUpsBatteryLifecycle(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除行李系统UPS电池生命周期编号为"' + ids + '"的数据项?').then(function() {
return delUpsBatteryLifecycle(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('ems/info/upsBatteryLifecycle/export', {
...this.queryParams
}, `upsBatteryLifecycle_${new Date().getTime()}.xlsx`)
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = "UPS电池生命周期导入";
this.upload.open = true;
},
/** 下载模板操作 */
importTemplate() {
this.download('ems/info/upsBatteryLifecycle/importTemplate', {
}, `upsBatteryLifecycle_template_${new Date().getTime()}.xlsx`)
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
},
// 查看详情
handleViewDetail(row) {
this.currentRecord = { ...row };
this.detailDrawer = true;
},
// 处理表格行右击事件
handleRowContextMenu(row, column, event) {
event.preventDefault();
this.contextMenu.row = row;
this.contextMenu.visible = true;
// 计算菜单位置
const x = event.clientX;
const y = event.clientY;
const menuWidth = 120;
const menuHeight = 120;
const windowWidth = window.innerWidth;
const windowHeight = window.innerHeight;
this.contextMenu.left = (x + menuWidth > windowWidth) ? x - menuWidth : x;
this.contextMenu.top = (y + menuHeight > windowHeight) ? y - menuHeight : y;
},
// 隐藏右击菜单
hideContextMenu() {
this.contextMenu.visible = false;
},
// 右击菜单 - 查看详情
contextMenuViewDetail() {
if (this.contextMenu.row) {
this.handleViewDetail(this.contextMenu.row);
}
this.hideContextMenu();
},
// 右击菜单 - 修改
contextMenuEdit() {
if (this.contextMenu.row && this.checkPermi(['ems/info:upsBatteryLifecycle:edit'])) {
this.handleUpdate(this.contextMenu.row);
}
this.hideContextMenu();
},
// 右击菜单 - 删除
contextMenuDelete() {
if (this.contextMenu.row && this.checkPermi(['ems/info:upsBatteryLifecycle:remove'])) {
this.handleDelete(this.contextMenu.row);
}
this.hideContextMenu();
},
// 权限检查方法
checkPermi(permissions) {
return checkPermi(permissions);
}
}
};
</script>
<style scoped>
.context-menu-table tbody tr:hover {
cursor: context-menu;
}
.context-menu {
background: white;
border: 1px solid #ebeef5;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
padding: 4px 0;
min-width: 120px;
}
.context-menu-item {
padding: 8px 16px;
cursor: pointer;
font-size: 14px;
color: #606266;
display: flex;
align-items: center;
}
.context-menu-item:hover {
background-color: #f5f7fa;
color: #409eff;
}
.context-menu-item i {
margin-right: 8px;
font-size: 14px;
}
.el-descriptions__label {
width: 90px !important;
}
@media (max-width: 768px) {
.el-drawer {
width: 90% !important;
}
}
@media print {
.context-menu {
display: none !important;
}
}
</style>