feat(设备管理): 新增设备管理相关功能模块
新增设备类型管理、备品备件管理、设备检修记录等功能模块 新增设备参数管理、备件变动记录、库存变动等功能 新增设备状态管理、检修计划管理等功能 优化图片预览组件,支持从OSS获取图片
This commit is contained in:
@@ -42,3 +42,11 @@ export function delSparePartsChange(changeId) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function changeStock(data) {
|
||||
return request({
|
||||
url: '/eqp/sparePartsChange/changeStock',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listByIds } from "@/api/system/oss";
|
||||
|
||||
export default {
|
||||
name: "ImagePreview",
|
||||
@@ -22,11 +23,28 @@ export default {
|
||||
},
|
||||
width: {
|
||||
type: [Number, String],
|
||||
default: ""
|
||||
default: "50px"
|
||||
},
|
||||
height: {
|
||||
type: [Number, String],
|
||||
default: ""
|
||||
default: "50px"
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
urls: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
src: {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal !== oldVal && newVal !== '') {
|
||||
listByIds(newVal).then(response => {
|
||||
this.urls = response.data.map(item => item.url).join(',');
|
||||
})
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -34,14 +52,14 @@ export default {
|
||||
if (!this.src) {
|
||||
return;
|
||||
}
|
||||
let real_src = this.src.split(",")[0];
|
||||
let real_src = this.urls.split(",")[0];
|
||||
return real_src;
|
||||
},
|
||||
realSrcList() {
|
||||
if (!this.src) {
|
||||
return;
|
||||
}
|
||||
let real_src_list = this.src.split(",");
|
||||
let real_src_list = this.urls.split(",");
|
||||
let srcList = [];
|
||||
real_src_list.forEach(item => {
|
||||
return srcList.push(item);
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
<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="equipmentId">
|
||||
<el-input
|
||||
v-model="queryParams.equipmentId"
|
||||
placeholder="请输入关联设备ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="检修厂商" prop="inspectVendor">
|
||||
<el-input
|
||||
v-model="queryParams.inspectVendor"
|
||||
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-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" :data="inspectionRecordList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="记录ID" align="center" prop="recordId" v-if="false"/>
|
||||
<el-table-column label="关联设备" align="center" prop="equipmentName" />
|
||||
<el-table-column label="实际检修时间" align="center" prop="inspectTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.inspectTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检修厂商" align="center" prop="inspectVendor" />
|
||||
<el-table-column label="检修内容" align="center" prop="inspectContent" />
|
||||
<el-table-column label="检修结果" align="center" prop="result" />
|
||||
<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>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改检修记录对话框 -->
|
||||
<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="equipmentId">
|
||||
<el-input v-model="form.equipmentId" placeholder="请输入关联设备" />
|
||||
</el-form-item>
|
||||
<el-form-item label="实际检修时间" prop="inspectTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.inspectTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择实际检修时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="检修厂商" prop="inspectVendor">
|
||||
<el-input v-model="form.inspectVendor" placeholder="请输入检修厂商" />
|
||||
</el-form-item>
|
||||
<el-form-item label="检修内容">
|
||||
<editor v-model="form.inspectContent" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="检修结果" prop="result">
|
||||
<el-input v-model="form.result" placeholder="请输入检修结果" />
|
||||
</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 { listInspectionRecord, getInspectionRecord, delInspectionRecord, addInspectionRecord, updateInspectionRecord } from "@/api/mes/eqp/inspectionRecord";
|
||||
|
||||
export default {
|
||||
name: "InspectionRecord",
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 检修记录表格数据
|
||||
inspectionRecordList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
equipmentId: undefined,
|
||||
inspectVendor: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询检修记录列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listInspectionRecord(this.queryParams).then(response => {
|
||||
this.inspectionRecordList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
recordId: undefined,
|
||||
equipmentId: undefined,
|
||||
inspectTime: undefined,
|
||||
inspectVendor: undefined,
|
||||
inspectContent: undefined,
|
||||
result: 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.recordId)
|
||||
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 recordId = row.recordId || this.ids
|
||||
getInspectionRecord(recordId).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.recordId != null) {
|
||||
updateInspectionRecord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addInspectionRecord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const recordIds = row.recordId || this.ids;
|
||||
this.$modal.confirm('是否确认删除检修记录编号为"' + recordIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delInspectionRecord(recordIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('eqp/inspectionRecord/export', {
|
||||
...this.queryParams
|
||||
}, `inspectionRecord_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,377 @@
|
||||
<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="equipmentId">
|
||||
<el-select v-model="queryParams.equipmentId" placeholder="请选择关联设备" clearable filterable
|
||||
@keyup.enter.native="handleQuery">
|
||||
<el-option v-for="item in equipmentList" :key="item.equipmentId" :label="item.equipmentName"
|
||||
:value="item.equipmentId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划时间" prop="inspectTime">
|
||||
<el-date-picker clearable v-model="queryParams.inspectTime" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="请选择计划检修时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="检修厂商" prop="inspectVendor">
|
||||
<el-input v-model="queryParams.inspectVendor" 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-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" :data="inspectedEquipmentList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="待检ID" align="center" prop="inspectId" v-if="false" />
|
||||
<el-table-column label="关联设备" align="center" prop="equipmentName" />
|
||||
<el-table-column label="计划检修时间" align="center" prop="inspectTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.inspectTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="剩余时间" align="center" prop="inspectTime" width="200">
|
||||
<template slot-scope="scope">
|
||||
<!-- 绑定函数返回的文本和颜色样式 -->
|
||||
<span v-if="scope.row.status == 0 || scope.row.status == null" :style="{ color: getRemainStatus(scope.row.inspectTime).color }">
|
||||
{{ getRemainStatus(scope.row.inspectTime).text }}
|
||||
</span>
|
||||
<span v-else style="color: grey">
|
||||
已检修
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检修厂商" align="center" prop="inspectVendor" />
|
||||
<!-- 0表示未检修,1表示已检修 -->
|
||||
<el-table-column label="状态" align="center" prop="status">《
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.status == 0 || scope.row.status == null ? '未检修' : '已检修' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row.status == 0 || scope.row.status == null" size="mini" type="text"
|
||||
icon="el-icon-check" @click="handleCheck(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" />
|
||||
|
||||
<!-- 添加或修改待检设备对话框 -->
|
||||
<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="equipmentId">
|
||||
<el-select v-model="form.equipmentId" placeholder="请选择关联设备" filterable clearable>
|
||||
<el-option v-for="item in equipmentList" :key="item.equipmentId" :label="item.equipmentName"
|
||||
:value="item.equipmentId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划检修时间" prop="inspectTime">
|
||||
<el-date-picker clearable v-model="form.inspectTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择计划检修时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="检修厂商" prop="inspectVendor">
|
||||
<el-input v-model="form.inspectVendor" placeholder="请输入检修厂商" />
|
||||
</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>
|
||||
|
||||
<el-dialog title="检修详情" :visible.sync="checkOpen" width="500px" append-to-body>
|
||||
<el-form ref="checkForm" :model="checkForm" label-width="80px">
|
||||
<el-form-item label="检修厂商" prop="inspectVendor">
|
||||
<el-input v-model="checkForm.inspectVendor" placeholder="请输入检修厂商" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="检修内容" prop="inspectContent">
|
||||
<editor v-model="checkForm.inspectContent" placeholder="请输入检修内容" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="检修结果" prop="result">
|
||||
<el-input v-model="checkForm.result" placeholder="请输入检修结果" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="checkForm.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitCheck">确 定</el-button>
|
||||
<el-button @click="cancelCheck">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listInspectedEquipment, getInspectedEquipment, delInspectedEquipment, addInspectedEquipment, updateInspectedEquipment } from "@/api/mes/eqp/inspectedEquipment";
|
||||
import { listEquipmentManagement } from "@/api/mes/eqp/equipmentManagement";
|
||||
import { addInspectionRecord } from "@/api/mes/eqp/inspectionRecord";
|
||||
|
||||
export default {
|
||||
name: "InspectedEquipment",
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 待检设备表格数据
|
||||
inspectedEquipmentList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
equipmentId: undefined,
|
||||
inspectTime: undefined,
|
||||
inspectVendor: undefined,
|
||||
status: undefined,
|
||||
},
|
||||
currentInspecedId: undefined,
|
||||
checkOpen: false,
|
||||
checkForm: {},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
},
|
||||
equipmentList: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getEquipmentList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询待检设备列表 */
|
||||
getEquipmentList() {
|
||||
this.loading = true;
|
||||
listEquipmentManagement({ pageSize: 1000 }).then(response => {
|
||||
this.equipmentList = response.rows;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 计算剩余时间状态(包含文本和颜色)
|
||||
* @param {string} inspectTimeStr - 日期字符串(如 '2025-12-31' 或 '2025-12-31 23:59:59')
|
||||
* @returns {Object} { text: 显示文本, color: 文本颜色 }
|
||||
*/
|
||||
getRemainStatus(inspectTimeStr) {
|
||||
// 1. 解析日期字符串为时间戳
|
||||
const deadline = new Date(inspectTimeStr).getTime();
|
||||
if (isNaN(deadline)) {
|
||||
return { text: '日期格式错误', color: '#999' }; // 无效日期:灰色
|
||||
}
|
||||
|
||||
// 2. 计算剩余时间(毫秒)和天数
|
||||
const now = new Date().getTime();
|
||||
const remainMs = deadline - now; // 剩余毫秒数(可能为负)
|
||||
const oneDayMs = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
||||
|
||||
// 计算剩余天数(不足1天按1天算,过期则取绝对值)
|
||||
let days;
|
||||
if (remainMs > 0) {
|
||||
days = Math.ceil(remainMs / oneDayMs); // 剩余天数(向上取整)
|
||||
} else {
|
||||
days = Math.ceil(Math.abs(remainMs) / oneDayMs); // 过期天数(向上取整)
|
||||
}
|
||||
|
||||
// 3. 定义状态配置(时间充足/临近/过期)
|
||||
const threeDays = 3 * oneDayMs; // 3天的毫秒数
|
||||
if (remainMs > threeDays) {
|
||||
return {
|
||||
text: `时间充足(剩余${days}天)`,
|
||||
color: '#27ae60' // 绿色:充足
|
||||
};
|
||||
} else if (remainMs > 0) {
|
||||
return {
|
||||
text: `临近(剩余${days}天)`,
|
||||
color: '#e67e22' // 橙色:临近
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
text: `过期(已超${days}天)`,
|
||||
color: '#e74c3c' // 红色:过期
|
||||
};
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listInspectedEquipment(this.queryParams).then(response => {
|
||||
this.inspectedEquipmentList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleCheck(row) {
|
||||
|
||||
this.checkForm = {
|
||||
equipmentId: row.equipmentId,
|
||||
inspectTime: new Date().toISOString().substring(0, 10) + ' 00:00:00',
|
||||
inspectVendor: row.inspectVendor,
|
||||
}
|
||||
this.currentInspecedId = row.inspectId;
|
||||
this.checkOpen = true;
|
||||
},
|
||||
async submitCheck() {
|
||||
this.buttonLoading = true;
|
||||
await addInspectionRecord(this.checkForm)
|
||||
await updateInspectedEquipment({
|
||||
inspectId: this.currentInspecedId,
|
||||
status: 1,
|
||||
})
|
||||
this.$modal.msgSuccess("已检修");
|
||||
this.checkOpen = false;
|
||||
this.buttonLoading = false;
|
||||
},
|
||||
cancelCheck() {
|
||||
this.checkOpen = false;
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
inspectId: undefined,
|
||||
equipmentId: undefined,
|
||||
inspectTime: undefined,
|
||||
inspectVendor: undefined,
|
||||
remainTime: undefined,
|
||||
status: 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.inspectId)
|
||||
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 inspectId = row.inspectId || this.ids
|
||||
getInspectedEquipment(inspectId).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.inspectId != null) {
|
||||
updateInspectedEquipment(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addInspectedEquipment(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const inspectIds = row.inspectId || this.ids;
|
||||
this.$modal.confirm('是否确认删除待检设备编号为"' + inspectIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delInspectedEquipment(inspectIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('eqp/inspectedEquipment/export', {
|
||||
...this.queryParams
|
||||
}, `inspectedEquipment_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
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>
|
||||
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<device-page page-param="in_service" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DevicePage from "@/views/mes/eqp/components/pages/device.vue";
|
||||
|
||||
export default {
|
||||
name: "DeviceIndex",
|
||||
components: {
|
||||
DevicePage,
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<device-page page-param="retired" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DevicePage from "@/views/mes/eqp/components/pages/device.vue";
|
||||
|
||||
export default {
|
||||
name: "DeviceStopIndex",
|
||||
components: {
|
||||
DevicePage,
|
||||
},
|
||||
}
|
||||
</script>
|
||||
16
klp-ui/src/views/mes/eqp/ready/change.vue
Normal file
16
klp-ui/src/views/mes/eqp/ready/change.vue
Normal file
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<partChange />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import partChange from '../components/pages/partChange.vue';
|
||||
|
||||
export default {
|
||||
name: "ReadyChange",
|
||||
components: {
|
||||
partChange
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,418 @@
|
||||
<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="partName">
|
||||
<el-input
|
||||
v-model="queryParams.partName"
|
||||
placeholder="请输入备件名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料品类" prop="materialCategory">
|
||||
<el-input
|
||||
v-model="queryParams.materialCategory"
|
||||
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="unit">
|
||||
<el-input
|
||||
v-model="queryParams.unit"
|
||||
placeholder="请输入计量单位"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联设备" prop="equipmentId">
|
||||
<el-select v-model="queryParams.equipmentId" placeholder="请选择关联设备" filterable>
|
||||
<el-option v-for="item in equipmentList" :key="item.equipmentId" :label="item.equipmentName" :value="item.equipmentId" />
|
||||
</el-select>
|
||||
</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-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" :data="sparePartList" @row-click="handleRowClick" highlight-current-row @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="materialCategory" />
|
||||
<el-table-column label="备件型号" align="center" prop="model" />
|
||||
<el-table-column label="计量单位" align="center" prop="unit" />
|
||||
<el-table-column label="关联设备" align="center" prop="equipmentName" />
|
||||
<el-table-column label="当前库存" align="center" prop="quantity" />
|
||||
<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.native.stop="handleAddChange(scope.row)"
|
||||
>增加</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click.native.stop="handleReduce(scope.row)"
|
||||
>减少</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click.native.stop="handleUpdate(scope.row)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click.native.stop="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"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改备品备件对话框 -->
|
||||
<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="partName">
|
||||
<el-input v-model="form.partName" placeholder="请输入备件名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料品类" prop="materialCategory">
|
||||
<el-input v-model="form.materialCategory" 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="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入计量单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="关联设备ID" prop="equipmentId">
|
||||
<el-select v-model="form.equipmentId" placeholder="请选择关联设备ID" filterable>
|
||||
<el-option v-for="item in equipmentList" :key="item.equipmentId" :label="item.equipmentName" :value="item.equipmentId" />
|
||||
</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>
|
||||
|
||||
<el-dialog title="库存变动" :visible.sync="changeOpen" width="500px" append-to-body>
|
||||
<el-form ref="changeForm" :model="changeForm" label-width="80px">
|
||||
<el-form-item label="变动类型">
|
||||
<el-select v-model="changeForm.changeType" placeholder="请选择变动类型">
|
||||
<el-option label="增加" value="增加" />
|
||||
<el-option label="减少" value="减少" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="变动数量">
|
||||
<el-input-number v-model="changeForm.changeQuantity" :min="0" :step="1" placeholder="请输入变动数量" size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="变动原因">
|
||||
<el-input type="textarea" v-model="changeForm.reason" placeholder="请输入变动原因" size="mini"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="changeSubmitForm">确 定</el-button>
|
||||
<el-button @click="changeCancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 备品备件变动记录对话框 -->
|
||||
<partChange ref="partChange" v-if="currentRow.partId" :partId="currentRow.partId" />
|
||||
<el-empty v-else description="请选择备品查看变动记录" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listSparePart, getSparePart, delSparePart, addSparePart, updateSparePart } from "@/api/mes/eqp/sparePart";
|
||||
import { listEquipmentManagement } from "@/api/mes/eqp/equipmentManagement";
|
||||
import { listSparePartsChange, changeStock } from "@/api/mes/eqp/sparePartsChange";
|
||||
import partChange from '../components/pages/partChange.vue';
|
||||
|
||||
export default {
|
||||
name: "SparePart",
|
||||
components: {
|
||||
partChange
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentRow: {},
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 备品备件表格数据
|
||||
sparePartList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
partName: undefined,
|
||||
materialCategory: undefined,
|
||||
model: undefined,
|
||||
unit: undefined,
|
||||
equipmentId: undefined,
|
||||
quantity: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
},
|
||||
equipmentList: [],
|
||||
changeOpen: false,
|
||||
changeTitle: '',
|
||||
changeForm: {},
|
||||
changes: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getEquipmentList();
|
||||
},
|
||||
watch: {
|
||||
currentRow: {
|
||||
handler(newVal) {
|
||||
if (newVal.partId) {
|
||||
listSparePartsChange({ partId: newVal.partId, pageNum: 1, pageSize: 1000 }).then(response => {
|
||||
this.changes = response.rows;
|
||||
})
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 查询备品备件列表 */
|
||||
getEquipmentList() {
|
||||
listEquipmentManagement({ pageNum: 1, pageSize: 1000 }).then(response => {
|
||||
this.equipmentList = response.rows;
|
||||
});
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listSparePart(this.queryParams).then(response => {
|
||||
this.sparePartList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleRowClick(row) {
|
||||
this.currentRow = row;
|
||||
},
|
||||
handleAddChange(row) {
|
||||
this.changeOpen = true;
|
||||
this.changeForm = {
|
||||
changeType: '增加',
|
||||
partId: row.partId,
|
||||
}
|
||||
},
|
||||
handleReduce(row) {
|
||||
this.changeOpen = true;
|
||||
this.changeForm = {
|
||||
changeType: '减少',
|
||||
partId: row.partId,
|
||||
}
|
||||
},
|
||||
changeCancel() {
|
||||
this.changeOpen = false;
|
||||
},
|
||||
changeSubmitForm() {
|
||||
this.buttonLoading = true;
|
||||
changeStock(this.changeForm).then(response => {
|
||||
this.buttonLoading = false;
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
this.getList();
|
||||
this.$refs["partChange"].getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
this.changeCancel();
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
partId: undefined,
|
||||
partName: undefined,
|
||||
materialCategory: undefined,
|
||||
model: undefined,
|
||||
unit: undefined,
|
||||
equipmentId: undefined,
|
||||
quantity: 0,
|
||||
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.partId)
|
||||
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 partId = row.partId || this.ids
|
||||
getSparePart(partId).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.partId != null) {
|
||||
updateSparePart(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addSparePart(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const partIds = row.partId || this.ids;
|
||||
this.$modal.confirm('是否确认删除备品备件编号为"' + partIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delSparePart(partIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('eqp/sparePart/export', {
|
||||
...this.queryParams
|
||||
}, `sparePart_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-form-item label="分类名称" prop="typeName">
|
||||
<el-input v-model="queryParams.typeName" placeholder="请输入分类名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类描述" prop="typeDesc">
|
||||
<el-input v-model="queryParams.typeDesc" 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-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 :data="equipmentTypeList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="分类名称" align="center" prop="typeName" />
|
||||
<el-table-column label="分类描述" align="center" prop="typeDesc" />
|
||||
<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>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" v-if="currentType.typeId">
|
||||
<type-params :type-id="currentType.typeId" />
|
||||
</el-col>
|
||||
<el-col :span="12" v-else>
|
||||
<el-empty description="请选择设备类型" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
<!-- 添加或修改设备类型对话框 -->
|
||||
<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="typeName">
|
||||
<el-input v-model="form.typeName" placeholder="请输入分类名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类描述" prop="typeDesc">
|
||||
<el-input v-model="form.typeDesc" placeholder="请输入分类描述" />
|
||||
</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 { listEquipmentType, getEquipmentType, delEquipmentType, addEquipmentType, updateEquipmentType } from "@/api/mes/eqp/equipmentType";
|
||||
import TypeParams from './panels/params.vue'
|
||||
|
||||
export default {
|
||||
name: "EquipmentType",
|
||||
components: {
|
||||
TypeParams
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentType: {},
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备类型表格数据
|
||||
equipmentTypeList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
typeName: undefined,
|
||||
typeDesc: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备类型列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listEquipmentType(this.queryParams).then(response => {
|
||||
this.equipmentTypeList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
handleRowClick(row) {
|
||||
this.currentType = row;
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
typeId: undefined,
|
||||
typeName: undefined,
|
||||
typeDesc: 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.typeId)
|
||||
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 typeId = row.typeId || this.ids
|
||||
getEquipmentType(typeId).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.typeId != null) {
|
||||
updateEquipmentType(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addEquipmentType(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const typeIds = row.typeId || this.ids;
|
||||
this.$modal.confirm('是否确认删除设备类型编号为"' + typeIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delEquipmentType(typeIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('eqp/equipmentType/export', {
|
||||
...this.queryParams
|
||||
}, `equipmentType_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
295
klp-ui/src/views/mes/eqp/type/panels/params.vue
Normal file
295
klp-ui/src/views/mes/eqp/type/panels/params.vue
Normal file
@@ -0,0 +1,295 @@
|
||||
<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-row>
|
||||
|
||||
<el-table :data="typeParamList" @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>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改设备类型参数(某类设备的通用参数标准)对话框 -->
|
||||
<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 { listTypeParam, getTypeParam, delTypeParam, addTypeParam, updateTypeParam } from "@/api/mes/eqp/typeParam";
|
||||
|
||||
export default {
|
||||
name: "TypeParam",
|
||||
dicts: ['eqp_params_type', 'eqp_params_from'],
|
||||
props: {
|
||||
typeId: {
|
||||
type: Number,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备类型参数(某类设备的通用参数标准)表格数据
|
||||
typeParamList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
typeId: this.typeId,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
typeId: {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
this.queryParams.typeId = newVal
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备类型参数(某类设备的通用参数标准)列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listTypeParam(this.queryParams).then(response => {
|
||||
this.typeParamList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
typeParamId: undefined,
|
||||
typeId: this.typeId,
|
||||
paramName: undefined,
|
||||
paramType: undefined,
|
||||
paramStandard: undefined,
|
||||
paramUnit: undefined,
|
||||
paramSource: undefined,
|
||||
isMandatory: 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.typeParamId)
|
||||
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 typeParamId = row.typeParamId || this.ids
|
||||
getTypeParam(typeParamId).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.typeParamId != null) {
|
||||
updateTypeParam(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addTypeParam(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const typeParamIds = row.typeParamId || this.ids;
|
||||
this.$modal.confirm('是否确认删除设备类型参数(某类设备的通用参数标准)编号为"' + typeParamIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delTypeParam(typeParamIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('eqp/typeParam/export', {
|
||||
...this.queryParams
|
||||
}, `typeParam_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -169,7 +169,6 @@ export default {
|
||||
targetUpper: undefined,
|
||||
targetLower: undefined,
|
||||
unit: undefined,
|
||||
qualitativeQuantitative: 0,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
|
||||
Reference in New Issue
Block a user