This commit is contained in:
hayu 2025-08-29 17:23:18 +08:00
parent 5d9c290a4b
commit b1d13bf1b5
2 changed files with 144 additions and 51 deletions

View File

@ -122,3 +122,29 @@ export function addWsMaInfoData(data) {
data: data, data: data,
}) })
} }
// 小工具编码信息列表--删除
export function delGadget(data) {
return request({
url: '/material/wsMaInfo/delGadget',
method: 'post',
data: data,
})
}
//查看机具类型管理列表详细信息
export function getGadgetInfo(id) {
return request({
url: '/material/wsMaInfo/getGadgetInfo/'+ id,
method: 'get',
})
}
// 小工具编码信息列表--修改
export function updateGadgetInfo(data) {
return request({
url: '/material/wsMaInfo/updateGadgetInfo',
method: 'post',
data: data,
})
}

View File

@ -43,6 +43,22 @@
<el-table-column label="下次检验时间" align="center" prop="nextCheckTime" show-overflow-tooltip /> <el-table-column label="下次检验时间" align="center" prop="nextCheckTime" show-overflow-tooltip />
<el-table-column label="检修员" align="center" prop="repairMan" show-overflow-tooltip/> <el-table-column label="检修员" align="center" prop="repairMan" show-overflow-tooltip/>
<el-table-column label="检验员" align="center" prop="checkMan" show-overflow-tooltip/> <el-table-column label="检验员" align="center" prop="checkMan" show-overflow-tooltip/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleEdit(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-table>
<pagination <pagination
@ -83,13 +99,14 @@
filterable filterable
style="width: 100%" style="width: 100%"
:disabled="!form.deviceTypeId" :disabled="!form.deviceTypeId"
:loading="modelLoading"
> >
<el-option <el-option
v-for="item in deviceModelOptions" v-for="item in deviceModelOptions"
:key="item.typeId" :key="item.typeId"
:label="item.typeName" :label="item.typeName"
:value="item.typeId" :value="item.typeId"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -103,9 +120,9 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="本次检验" prop="thisCheckDate"> <el-form-item label="本次检验" prop="thisCheckTime">
<el-date-picker <el-date-picker
v-model="form.thisCheckDate" v-model="form.thisCheckTime"
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
@ -118,7 +135,7 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="下次检验"> <el-form-item label="下次检验">
<el-input <el-input
v-model="form.nextCheckDate" v-model="form.nextCheckTime"
readonly readonly
class="next-check-date" class="next-check-date"
/> />
@ -146,11 +163,11 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="检验结论" prop="conclusion"> <el-form-item label="检验结论" prop="result">
<el-input <el-input
type="textarea" type="textarea"
:rows="3" :rows="3"
v-model="form.conclusion" v-model="form.result"
placeholder="请输入检验结论" placeholder="请输入检验结论"
/> />
</el-form-item> </el-form-item>
@ -167,8 +184,8 @@
<script> <script>
import { import {
addWsMaInfoData, addWsMaInfoData, delGadget,
getDeviceType, getGadgetList getDeviceType, getGadgetInfo, getGadgetList
} from '@/api/ma/device' } from '@/api/ma/device'
export default { export default {
@ -213,13 +230,14 @@ export default {
deviceTypeId: null, deviceTypeId: null,
deviceModelId: null, deviceModelId: null,
deviceCode: '', deviceCode: '',
thisCheckDate: '', thisCheckTime: '',
nextCheckDate: '', nextCheckTime: '',
checkMan: '', checkMan: '',
repairMan: '', repairMan: '',
phone: '', phone: '',
conclusion: '' result: ''
}, },
modelLoading: false,
// //
rules: { rules: {
deviceTypeId: [ deviceTypeId: [
@ -231,7 +249,7 @@ export default {
deviceCode: [ deviceCode: [
{ required: true, message: "设备编码不能为空", trigger: "blur" } { required: true, message: "设备编码不能为空", trigger: "blur" }
], ],
thisCheckDate: [ thisCheckTime: [
{ required: true, message: "本次检验日期不能为空", trigger: "change" } { required: true, message: "本次检验日期不能为空", trigger: "change" }
], ],
checkMan: [ checkMan: [
@ -243,7 +261,7 @@ export default {
phone: [ phone: [
{ required: true, message: "联系电话不能为空", trigger: "blur" } { required: true, message: "联系电话不能为空", trigger: "blur" }
], ],
conclusion: [ result: [
{ required: true, message: "检验结论不能为空", trigger: "blur" } { required: true, message: "检验结论不能为空", trigger: "blur" }
] ]
}, },
@ -277,20 +295,29 @@ export default {
}) })
}, },
/** 获取设备类型选项 */ /** 获取设备类型选项 */
getDeviceTypeOptions() { async getDeviceTypeOptions() {
// API try {
getDeviceType({ level: 3, skipPermission: 1 }).then(response => { const response = await getDeviceType({ level: 3, skipPermission: 1 });
this.deviceTypeOptions = response.data; this.deviceTypeOptions = response.data || [];
}); } catch (error) {
console.error('获取设备类型失败:', error);
this.deviceTypeOptions = [];
}
}, },
/** 设备类型变化时获取设备型号 */ /** 设备类型变化时获取设备型号 */
handleDeviceTypeChange(value) { async handleDeviceTypeChange(value) {
this.form.deviceModelId = null; this.form.deviceModelId = null;
if (value) { if (value) {
// API this.modelLoading = true;
getDeviceType({typeId:value}).then(response => { try {
this.deviceModelOptions = response.data; const response = await getDeviceType({ typeId: value });
}); this.deviceModelOptions = response.data || [];
} catch (error) {
console.error('获取设备型号失败:', error);
this.deviceModelOptions = [];
} finally {
this.modelLoading = false;
}
} else { } else {
this.deviceModelOptions = []; this.deviceModelOptions = [];
} }
@ -308,9 +335,9 @@ export default {
const month = (nextDate.getMonth() + 1).toString().padStart(2, '0'); const month = (nextDate.getMonth() + 1).toString().padStart(2, '0');
const day = nextDate.getDate().toString().padStart(2, '0'); const day = nextDate.getDate().toString().padStart(2, '0');
this.form.nextCheckDate = `${year}-${month}-${day}`; this.form.nextCheckTime = `${year}-${month}-${day}`;
} else { } else {
this.form.nextCheckDate = ''; this.form.nextCheckTime = '';
} }
}, },
@ -349,39 +376,79 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加设备检验信息"; this.title = "添加小工具信息";
}, },
/** 编辑按钮操作 */ /** 编辑按钮操作 */
handleEdit(row) { async handleEdit(row) {
this.reset(); this.reset();
// API try {
getDeviceInfo(row.maId).then(response => { const response = await getGadgetInfo(row.id);
this.form = response.data; this.form = { ...response.data };
this.form.deviceCode = response.data.maCode;
// ID
this.form.deviceTypeId =response.data.deviceTypeId;
//
if (this.deviceTypeOptions.length === 0) {
await this.getDeviceTypeOptions();
}
//
await this.handleDeviceTypeChange(this.form.deviceTypeId);
// ID -
this.form.deviceModelId =response.data.deviceModelId;
this.open = true; this.open = true;
this.title = "修改设备检验信息"; this.title = "修改小工具信息";
}); } catch (error) {
console.error('获取设备信息失败:', error);
this.$message.error('获取设备信息失败');
}
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$confirm('是否确认删除设备检验信息编号为"' + row.maId + '"的数据项?', "警告", { this.$confirm('是否确认删除设备编号为"' + row.maCode + '"的数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(async () => {
// API const loading = this.$loading({ text: '删除中...' })
return deleteDeviceInfo(row.maId); try {
}).then(() => { const res = await delGadget({ id: row.id})
this.getList(); this.$message({
this.$message.success("删除成功"); type: 'success',
message: '删除成功!'
})
this.getList()
} catch (error) {
console.log('删除失败', error)
} finally {
loading.close()
}
}) })
}, },
/** 提交表单 */ /** 提交表单 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.maId) { if (this.form.id) {
const params = {
id: this.form.id,
maName: data.maName,
maModel:data.maModel,
modelId:this.form.deviceModelId,
maCode:this.form.deviceCode,
thisCheckTime:this.form.thisCheckTime,
nextCheckTime:this.form.nextCheckTime,
repairMan: this.form.repairMan,
checkMan: this.form.checkMan,
phone: this.form.phone,
result:this.form.result,
}
// API // API
updateDeviceInfo(this.form).then(response => { updateGadgetInfo(params).then(response => {
this.$message.success("修改成功"); this.$message.success("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -404,12 +471,12 @@ export default {
maModel:data.maModel, maModel:data.maModel,
modelId:this.form.deviceModelId, modelId:this.form.deviceModelId,
maCode:this.form.deviceCode, maCode:this.form.deviceCode,
thisCheckTime:this.form.thisCheckDate, thisCheckTime:this.form.thisCheckTime,
nextCheckTime:this.form.nextCheckDate, nextCheckTime:this.form.nextCheckTime,
repairMan: this.form.repairMan, repairMan: this.form.repairMan,
checkMan: this.form.checkMan, checkMan: this.form.checkMan,
phone: this.form.phone, phone: this.form.phone,
result:this.form.conclusion, result:this.form.result,
} }
// API // API
addWsMaInfoData(params).then(response => { addWsMaInfoData(params).then(response => {
@ -433,8 +500,8 @@ export default {
deviceTypeId: null, deviceTypeId: null,
deviceModelId: null, deviceModelId: null,
deviceCode: '', deviceCode: '',
thisCheckDate: '', thisCheckTime: '',
nextCheckDate: '', nextCheckTime: '',
checkMan: '', checkMan: '',
repairMan: '', repairMan: '',
phone: '', phone: '',