fix:触发首检接口修改

This commit is contained in:
17630416519 2025-11-25 09:36:23 +08:00
parent 898aa873f0
commit f373b17aaf
2 changed files with 210 additions and 34 deletions

View File

@ -0,0 +1,75 @@
import request from '@/utils/request'
// 查询缓存详细
export function getCache(data) {
return request({
url: 'mes/MaterialTypeDict/list',
method: 'get',
params: data
})
}
//新增
export function addCache(data) {
return request({
url: 'mes/MaterialTypeDict',
method: 'post',
data: data
})
}
//修改
export function updateCache(data) {
return request({
url: 'mes/MaterialTypeDict',
method: 'put',
data: data
})
}
//删除
export function delCache(id) {
return request({
url: 'mes/MaterialTypeDict/delete/' + id,
method: 'post',
})
}
export function getLineName() {
return request({
url: 'MasterDataManagement/Plant/PlantProductlinebody/getAllLine',
method: 'get'
})
}
//工艺路线下拉数据
export function getProcessInfoTree(data) {
return request({
url: 'mes/ProcessInfo/GetProcessInfoByLineCode/' + data,
method: 'post',
})
}
//重置密码
export function resetPassword() {
return request({
url: 'mes/PasswordInfo/resetFirstInspectionPwd',
method: 'get',
})
}
//更改密码
export function changePassword(data) {
return request({
url: 'mes/PasswordInfo/changeFirstInspectionPwd',
method: 'post',
data: data
})
}
//效验密码
export function checkPassword(data) {
return request({
url: `mes/PasswordInfo/checkFirstInspectionPwd?password=${data}`,
method: 'post',
})
}

View File

@ -23,13 +23,13 @@
</el-form-item>
<el-row :gutter="15" class="mb10">
<el-col :span="1.5">
<el-button type="primary" v-hasPermi="['business:processmodeloperation:add']" plain icon="plus"
<!-- <el-button type="primary" v-hasPermi="['business:processmodeloperation:add']" plain icon="plus"
@click="handleAdd">
{{ $t('btn.add') }}
</el-button>
</el-button> -->
<el-button class="tool-box" color="#00aa00" icon="Upload" @click="handleDownload"> 导出
</el-button>
<el-button class="tool-box" color="#00aa00" icon="Setting" @click="handlerootCause"> 批量新增/修改不良原因
<el-button class="tool-box" color="#00aa00" icon="Setting" @click="handlerootCause"> 批量新增/修改
</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"
@ -52,8 +52,32 @@
<el-table-column prop="materialName" label="零件信息" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="materialCode" label="零件编码" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="totalQty" label="工单总数" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="okQty" label="合格数" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="ngQty" label="不合格数" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="okQty" label="合格数" align="center" :show-overflow-tooltip="true">
<template #default="scope">
<div v-if="!scope.row.editingOkQty">
{{ scope.row.okQty }}
<el-icon @click="handleEditOkQty(scope.row)" style="cursor: pointer; margin-left: 5px;">
<Edit />
</el-icon>
</div>
<el-input v-else v-model="scope.row.okQty" @blur="handleSaveOkQty(scope.row)"
@keyup.enter="handleSaveOkQty(scope.row)" style="width: 100px;" ref="okQtyInput"
:data-row-id="scope.row.id || scope.row.planCode" data-field="okQty" />
</template>
</el-table-column>
<el-table-column prop="ngQty" label="不合格数" align="center" :show-overflow-tooltip="true">
<template #default="scope">
<div v-if="!scope.row.editingNgQty">
{{ scope.row.ngQty }}
<el-icon @click="handleEditNgQty(scope.row)" style="cursor: pointer; margin-left: 5px;">
<Edit />
</el-icon>
</div>
<el-input v-else v-model="scope.row.ngQty" @blur="handleSaveNgQty(scope.row)"
@keyup.enter="handleSaveNgQty(scope.row)" style="width: 100px;" ref="ngQtyInput"
:data-row-id="scope.row.id || scope.row.planCode" data-field="ngQty" />
</template>
</el-table-column>
<el-table-column prop="defectReason" label="不良原因描述" align="center" :show-overflow-tooltip="true">
<template #default="scope">
<div v-if="!scope.row.editing">
@ -80,13 +104,13 @@
<el-table-column prop="createTime" label="创建时间" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="updateName" label="更新人" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="updateTime" label="更新时间" align="center" :show-overflow-tooltip="true" />
<el-table-column label="操作" width="100" align="center">
<!-- <el-table-column label="操作" width="100" align="center">
<template #default="scope">
<el-button type="danger" size="small" icon="delete" title="删除"
v-hasPermi="['business:processmodeloperation:delete']"
@click="handleDelete(scope.row)"></el-button>
</template>
</el-table-column>
</el-table-column> -->
</el-table>
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
@pagination="getList" />
@ -192,10 +216,16 @@
<el-dialog v-model="rootCauseCloseWork" title="不良原因" @close="handleCloseRootCause" width="500" draggable
:close-on-click-modal="false">
<el-form>
<el-form-item label="合格数" prop="okQty">
<el-input v-model="batchUpdateForm.okQty" placeholder="请输入合格数" />
</el-form-item>
<el-form-item label="不合格数" prop="ngQty">
<el-input v-model="batchUpdateForm.ngQty" placeholder="请输入不合格数" />
</el-form-item>
<el-form-item label="不良原因选择" prop="defectReason">
<el-select filterable clearable v-model="rootCause" placeholder="请选择">
<el-option v-for="item in defectReasonData" :key="item.value" :label="item.label"
:value="item.value" />
:value="item.label" />
</el-select>
</el-form-item>
</el-form>
@ -223,6 +253,10 @@ import { ref, reactive, getCurrentInstance, watch, toRefs, onMounted, nextTick }
const { proxy } = getCurrentInstance()
const loading = ref(false)
const showSearch = ref(true)
const batchUpdateForm = reactive({
okQty: '',
ngQty: ''
});
const show = ref(false)
const editingRows = ref(new Set())
const dataList = ref([])
@ -246,6 +280,27 @@ function handleEdit(row) {
}
})
}
function handleEditOkQty(row) {
row.editingOkQty = true
nextTick(() => {
const input = document.querySelector(`[data-row-id="${row.id || row.planCode}"][data-field="okQty"]`)
if (input) {
input.focus()
}
})
}
function handleEditNgQty(row) {
row.editingNgQty = true
nextTick(() => {
const input = document.querySelector(`[data-row-id="${row.id || row.planCode}"][data-field="ngQty"]`)
if (input) {
input.focus()
}
})
}
function handleSave(row) {
//
editingRows.value.delete(row.id || row.planCode)
@ -266,6 +321,35 @@ function handleSave(row) {
}
})
}
function handleSaveOkQty(row) {
row.editingOkQty = false
updateProcessInfo({
...row,
userId: userId,
userName: userName
}).then(res => {
if (res.code == 200) {
ElMessage.success('合格数更新成功')
getList()
}
})
}
function handleSaveNgQty(row) {
row.editingNgQty = false
updateProcessInfo({
...row,
userId: userId,
userName: userName
}).then(res => {
if (res.code == 200) {
ElMessage.success('不合格数更新成功')
getList()
}
})
}
//
function handleSelectionChange(val) {
selectedRows.value = val;
@ -291,10 +375,17 @@ function handlerootCause() {
}
if (selectedRows.value.length > 0) {
rootCause.value = '';
batchUpdateForm.okQty = '';
batchUpdateForm.ngQty = '';
}
getReason().then(res => {
if (res.code == 200) {
defectReasonData.value = res.data.result
defectReasonData.value = res.data.map(item => {
return {
value: item.value,
label: item.label
}
})
}
})
rootCauseCloseWork.value = true
@ -455,11 +546,7 @@ function reset() {
//
function handleAdd() {
getLineName().then(res => {
if (res.code == 200) {
productionLine.value = res.data
}
})
reset()
open.value = true
title.value = '添加工艺'
@ -515,38 +602,51 @@ function submitForm() {
})
}
//
function handleDelete(row) {
proxy.$confirm(
'确认删除该条数据吗?',
'提示',
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }
).then(() => {
delProcessInfo([row.materialCode]).then(res => {
if (res.code === 200) {
ElMessage({ message: '删除成功', type: 'success' });
getList();
}
});
});
}
//
// function handleDelete(row) {
// proxy.$confirm(
// '',
// '',
// { confirmButtonText: '', cancelButtonText: '', type: 'warning' }
// ).then(() => {
// delProcessInfo([row.materialCode]).then(res => {
// if (res.code === 200) {
// ElMessage({ message: '', type: 'success' });
// getList();
// }
// });
// });
// }
//
function submitRootCause() {
if (!rootCause.value) {
ElMessage.warning('请输入不良原因描述');
if (!rootCause.value && !batchUpdateForm.okQty && !batchUpdateForm.ngQty) {
ElMessage.warning('请至少填写一个要更新的字段');
return;
}
const updatePromises = selectedRows.value.map(row => {
const updatedRow = {
...row,
defectReason: rootCause.value,
userId: userId,
userName: userName
};
row.defectReason = rootCause.value;
if (rootCause.value) {
updatedRow.defectReason = rootCause.value;
row.defectReason = rootCause.value;
}
if (batchUpdateForm.okQty !== '') {
updatedRow.okQty = batchUpdateForm.okQty;
row.okQty = batchUpdateForm.okQty;
}
if (batchUpdateForm.ngQty !== '') {
updatedRow.ngQty = batchUpdateForm.ngQty;
row.ngQty = batchUpdateForm.ngQty;
}
return updateProcessInfo(updatedRow);
});
Promise.all(updatePromises).then(results => {
const allSuccessful = results.every(res => res.code === 200);
if (allSuccessful) {
@ -566,7 +666,8 @@ function submitRootCause() {
function handleCloseRootCause() {
rootCauseCloseWork.value = false;
rootCause.value = '';
selectedRows.value = [];
batchUpdateForm.okQty = '';
batchUpdateForm.ngQty = '';
}
//