feat(设备管理): 新增设备管理相关功能模块
新增设备类型管理、备品备件管理、设备检修记录等功能模块 新增设备参数管理、备件变动记录、库存变动等功能 新增设备状态管理、检修计划管理等功能 优化图片预览组件,支持从OSS获取图片
This commit is contained in:
383
klp-ui/src/views/mes/eqp/components/pages/device.vue
Normal file
383
klp-ui/src/views/mes/eqp/components/pages/device.vue
Normal file
@@ -0,0 +1,383 @@
|
||||
<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="equipmentName">
|
||||
<el-input v-model="queryParams.equipmentName" placeholder="请输入设备名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备型号" prop="model">
|
||||
<el-input v-model="queryParams.model" placeholder="请输入设备型号" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型" prop="typeId">
|
||||
<el-select v-model="queryParams.typeId" placeholder="请选择设备类型" filterable>
|
||||
<el-option v-for="item in typeList" :key="item.typeId" :label="item.typeName" :value="item.typeId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备编码" prop="equipmentCode">
|
||||
<el-input v-model="queryParams.equipmentCode" placeholder="请输入设备编码" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人" prop="manager">
|
||||
<el-input v-model="queryParams.manager" 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">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
设备图像:<el-switch v-model="preview">
|
||||
</el-switch>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single"
|
||||
@click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
|
||||
@click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" @row-click="handleRowClick" highlight-current-row height="400px" :data="equipmentManagementList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="设备ID" align="center" prop="equipmentId" v-if="false" />
|
||||
<el-table-column label="设备名称" align="center" prop="equipmentName" />
|
||||
<el-table-column label="停用原因" align="center" prop="stopReason" v-if="!isInService" />
|
||||
<el-table-column label="设备去向" align="center" prop="equipmentDestination" v-if="!isInService" />
|
||||
<el-table-column label="退役时间" align="center" prop="retireTime" width="180" v-if="!isInService">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.retireTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备型号" align="center" prop="model" />
|
||||
<el-table-column label="设备类型" align="center" prop="typeName" />
|
||||
<el-table-column label="设备编码" align="center" prop="equipmentCode" />
|
||||
<el-table-column label="设备位置" align="center" prop="location" v-if="isInService" />
|
||||
<el-table-column label="负责人" align="center" prop="manager" />
|
||||
<el-table-column label="图片" align="center" prop="ossId" v-if="preview">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.ossId" fit="fill" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="启用时间" align="center" prop="enableTime" width="180" v-if="isInService">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.enableTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="isInService" type="text" plain icon="el-icon-delete" size="mini" :loading="buttonLoading"
|
||||
@click="handleSetStatus(scope.row)">
|
||||
停用
|
||||
</el-button>
|
||||
<el-button v-else size="mini" type="text" icon="el-icon-caret-right" :loading="buttonLoading"
|
||||
@click="handleSetStatus(scope.row)">启用</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</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" />
|
||||
|
||||
<device-param v-if="currentEquipmentId" :equipmentId="currentEquipmentId" />
|
||||
<el-empty v-else title="请选择设备查看参数"></el-empty>
|
||||
<!-- 添加或修改设备管理(合并在役和退役设备)对话框 -->
|
||||
<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="设备名称" prop="equipmentName">
|
||||
<el-input v-model="form.equipmentName" placeholder="请输入设备名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备型号" prop="model">
|
||||
<el-input v-model="form.model" placeholder="请输入设备型号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型" prop="typeId">
|
||||
<el-select v-model="form.typeId" placeholder="请选择设备类型" filterable>
|
||||
<el-option v-for="item in typeList" :key="item.typeId" :label="item.typeName" :value="item.typeId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备编码" prop="equipmentCode">
|
||||
<el-input v-model="form.equipmentCode" placeholder="请输入设备编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备位置" prop="location" v-if="isInService">
|
||||
<el-input v-model="form.location" placeholder="请输入设备位置" />
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人" prop="manager">
|
||||
<el-input v-model="form.manager" placeholder="请输入负责人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" prop="ossId">
|
||||
<image-upload v-model="form.ossId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="启用时间" prop="enableTime" v-if="isInService">
|
||||
<el-date-picker clearable v-model="form.enableTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择启用时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="停用原因" prop="stopReason" v-if="!isInService">
|
||||
<el-input v-model="form.stopReason" placeholder="请输入停用原因" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备去向" prop="equipmentDestination" v-if="!isInService">
|
||||
<el-input v-model="form.equipmentDestination" placeholder="请输入设备去向" />
|
||||
</el-form-item>
|
||||
<el-form-item label="退役时间" prop="retireTime" v-if="!isInService">
|
||||
<el-date-picker clearable
|
||||
v-model="form.retireTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择退役时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listEquipmentManagement, getEquipmentManagement, delEquipmentManagement, addEquipmentManagement, updateEquipmentManagement } from "@/api/mes/eqp/equipmentManagement";
|
||||
import { listEquipmentType } from "@/api/mes/eqp/equipmentType";
|
||||
import deviceParam from "@/views/mes/eqp/components/pages/deviceParam.vue";
|
||||
|
||||
export default {
|
||||
name: "EquipmentManagement",
|
||||
props: {
|
||||
pageParam: {
|
||||
type: String,
|
||||
default: 'in_service',
|
||||
}
|
||||
},
|
||||
components: {
|
||||
deviceParam,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentEquipmentId: null,
|
||||
// 预览设备图像
|
||||
preview: false,
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备管理(合并在役和退役设备)表格数据
|
||||
equipmentManagementList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
equipmentName: undefined,
|
||||
model: undefined,
|
||||
typeId: undefined,
|
||||
equipmentCode: undefined,
|
||||
location: undefined,
|
||||
manager: undefined,
|
||||
ossId: undefined,
|
||||
status: this.pageParam,
|
||||
enableTime: undefined,
|
||||
stopReason: undefined,
|
||||
equipmentDestination: undefined,
|
||||
retireTime: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
},
|
||||
typeList: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isInService() {
|
||||
return this.pageParam == 'in_service';
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getTypeList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备类型列表 */
|
||||
getTypeList() {
|
||||
listEquipmentType({ pageSize: 1000 }).then(response => {
|
||||
this.typeList = response.rows;
|
||||
});
|
||||
},
|
||||
/** 查询设备管理(合并在役和退役设备)列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listEquipmentManagement(this.queryParams).then(response => {
|
||||
this.equipmentManagementList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleRowClick(row) {
|
||||
this.currentEquipmentId = row.equipmentId;
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
handleSetStatus(row) {
|
||||
const time = new Date().toISOString().slice(0, 19).replace('T', ' ');
|
||||
|
||||
const payload = this.pageParam == 'in_service' ? {
|
||||
equipmentId: row.equipmentId,
|
||||
status: 'retired',
|
||||
retireTime: time,
|
||||
} : {
|
||||
equipmentId: row.equipmentId,
|
||||
status: 'in_service',
|
||||
retireTime: time,
|
||||
}
|
||||
|
||||
updateEquipmentManagement(payload).then(response => {
|
||||
this.$message({
|
||||
message: this.pageParam == 'in_service' ? '设备已启用' : '设备已退役',
|
||||
type: 'success',
|
||||
});
|
||||
this.getList();
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
equipmentId: undefined,
|
||||
equipmentName: undefined,
|
||||
model: undefined,
|
||||
typeId: undefined,
|
||||
equipmentCode: undefined,
|
||||
location: undefined,
|
||||
quantity: undefined,
|
||||
manager: undefined,
|
||||
ossId: undefined,
|
||||
status: this.pageParam,
|
||||
stopReason: undefined,
|
||||
equipmentDestination: undefined,
|
||||
enableTime: undefined,
|
||||
retireTime: undefined,
|
||||
createBy: undefined,
|
||||
updateBy: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
delFlag: undefined,
|
||||
remark: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.equipmentId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加设备";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const equipmentId = row.equipmentId || this.ids
|
||||
getEquipmentManagement(equipmentId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改设备";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.equipmentId != null) {
|
||||
updateEquipmentManagement(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addEquipmentManagement(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const equipmentIds = row.equipmentId || this.ids;
|
||||
this.$modal.confirm('是否确认删除设备管理(合并在役和退役设备)编号为"' + equipmentIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delEquipmentManagement(equipmentIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('eqp/equipmentManagement/export', {
|
||||
...this.queryParams
|
||||
}, `equipmentManagement_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
304
klp-ui/src/views/mes/eqp/components/pages/deviceParam.vue
Normal file
304
klp-ui/src/views/mes/eqp/components/pages/deviceParam.vue
Normal file
@@ -0,0 +1,304 @@
|
||||
<template>
|
||||
<div class="app-container" v-loading="loading">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table :data="equipmentParamList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="参数名称" align="center" prop="paramName" />
|
||||
<el-table-column label="参数类型" align="center" prop="paramType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.eqp_params_type" :value="scope.row.paramType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标准范围" align="center" prop="paramStandard" />
|
||||
<el-table-column label="参数单位" align="center" prop="paramUnit" />
|
||||
<el-table-column label="参数来源" align="center" prop="paramSource">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.eqp_params_from" :value="scope.row.paramSource"/>
|
||||
</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)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 添加或修改设备参数对话框 -->
|
||||
<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="参数名称" prop="paramName">
|
||||
<el-input v-model="form.paramName" placeholder="请输入参数名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="参数类型" prop="paramType">
|
||||
<el-select v-model="form.paramType" placeholder="请选择参数类型">
|
||||
<el-option
|
||||
v-for="dict in dict.type.eqp_params_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="标准范围" prop="paramStandard">
|
||||
<el-input v-model="form.paramStandard" placeholder="请输入标准范围" />
|
||||
</el-form-item>
|
||||
<el-form-item label="参数单位" prop="paramUnit">
|
||||
<el-input v-model="form.paramUnit" placeholder="请输入参数单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="参数来源" prop="paramSource">
|
||||
<el-select v-model="form.paramSource" placeholder="请选择参数来源">
|
||||
<el-option
|
||||
v-for="dict in dict.type.eqp_params_from"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listEquipmentParam, getEquipmentParam, delEquipmentParam, addEquipmentParam, updateEquipmentParam } from "@/api/mes/eqp/equipmentParam";
|
||||
|
||||
|
||||
export default {
|
||||
name: "EquipmentParam",
|
||||
dicts: ['eqp_params_type', 'eqp_params_from'],
|
||||
props: {
|
||||
equipmentId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备参数表格数据
|
||||
equipmentParamList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 999,
|
||||
paramName: undefined,
|
||||
equipmentId: this.equipmentId,
|
||||
paramType: undefined,
|
||||
paramStandard: undefined,
|
||||
paramUnit: undefined,
|
||||
paramSource: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
equipmentId: {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal !== oldVal && newVal !== '') {
|
||||
this.queryParams.equipmentId = newVal;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备参数列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listEquipmentParam(this.queryParams).then(response => {
|
||||
this.equipmentParamList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
paramId: undefined,
|
||||
paramName: undefined,
|
||||
equipmentId: this.equipmentId,
|
||||
paramType: undefined,
|
||||
paramStandard: undefined,
|
||||
paramUnit: undefined,
|
||||
paramSource: undefined,
|
||||
createBy: undefined,
|
||||
updateBy: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
delFlag: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.paramId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加设备参数";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const paramId = row.paramId || this.ids
|
||||
getEquipmentParam(paramId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改设备参数";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.paramId != null) {
|
||||
updateEquipmentParam(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addEquipmentParam(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const paramIds = row.paramId || this.ids;
|
||||
this.$modal.confirm('是否确认删除设备参数编号为"' + paramIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delEquipmentParam(paramIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('eqp/equipmentParam/export', {
|
||||
...this.queryParams
|
||||
}, `equipmentParam_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
266
klp-ui/src/views/mes/eqp/components/pages/partChange.vue
Normal file
266
klp-ui/src/views/mes/eqp/components/pages/partChange.vue
Normal file
@@ -0,0 +1,266 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form v-if="!partId" :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="关联备件" prop="partId">
|
||||
<el-select v-model="queryParams.partId" placeholder="请选择关联备件">
|
||||
<el-option v-for="item in partList" :key="item.partId" :label="item.partName" :value="item.partId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="变动数量" prop="changeQuantity">
|
||||
<el-input
|
||||
v-model="queryParams.changeQuantity"
|
||||
placeholder="请输入变动数量"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="变动原因" prop="reason">
|
||||
<el-input
|
||||
v-model="queryParams.reason"
|
||||
placeholder="请输入变动原因"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="变动时间" prop="changeTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.changeTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择变动时间">
|
||||
</el-date-picker>
|
||||
</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="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="sparePartsChangeList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="关联备件" align="center" prop="partName" />
|
||||
<el-table-column label="变动类型" align="center" prop="changeType" />
|
||||
<el-table-column label="变动数量" align="center" prop="changeQuantity" />
|
||||
<el-table-column label="变动原因" align="center" prop="reason" />
|
||||
<el-table-column label="变动时间" align="center" prop="changeTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.changeTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listSparePartsChange, getSparePartsChange, delSparePartsChange, addSparePartsChange, updateSparePartsChange } from "@/api/mes/eqp/sparePartsChange";
|
||||
import { listSparePart } from "@/api/mes/eqp/sparePart";
|
||||
|
||||
export default {
|
||||
name: "SparePartsChange",
|
||||
props: {
|
||||
partId: {
|
||||
type: Number,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 备品备件变动记录表格数据
|
||||
sparePartsChangeList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
partId: this.partId,
|
||||
changeType: undefined,
|
||||
changeQuantity: undefined,
|
||||
reason: undefined,
|
||||
changeTime: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
},
|
||||
partList: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
if (this.partId) {
|
||||
return;
|
||||
}
|
||||
this.getPartList();
|
||||
},
|
||||
watch: {
|
||||
partId: {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal !== oldVal && newVal !== undefined) {
|
||||
this.queryParams.partId = newVal;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getPartList() {
|
||||
listSparePart({ pageNum: 1, pageSize: 1000 }).then(response => {
|
||||
this.partList = response.rows;
|
||||
});
|
||||
},
|
||||
/** 查询备品备件变动记录列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listSparePartsChange(this.queryParams).then(response => {
|
||||
this.sparePartsChangeList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
changeId: undefined,
|
||||
partId: this.partId,
|
||||
changeType: undefined,
|
||||
changeQuantity: undefined,
|
||||
reason: undefined,
|
||||
changeTime: undefined,
|
||||
createBy: undefined,
|
||||
updateBy: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
delFlag: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.changeId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加备品备件变动记录";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const changeId = row.changeId || this.ids
|
||||
getSparePartsChange(changeId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改备品备件变动记录";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.changeId != null) {
|
||||
updateSparePartsChange(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addSparePartsChange(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const changeIds = row.changeId || this.ids;
|
||||
this.$modal.confirm('是否确认删除备品备件变动记录编号为"' + changeIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delSparePartsChange(changeIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('eqp/sparePartsChange/export', {
|
||||
...this.queryParams
|
||||
}, `sparePartsChange_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user