feat(工单管理): 添加工单调试状态操作按钮及功能
新增完成调试和重新调试按钮,根据工单状态显示不同操作按钮 实现调试状态更新功能,包括状态变更和数值类型转换
This commit is contained in:
@@ -54,6 +54,10 @@
|
||||
<vxe-button size="mini" mode="text" status="primary" content="开始上线" @click="updateitem(row)"></vxe-button>
|
||||
<vxe-button size="mini" mode="text" status="danger" content="取消上线" @click="cancelitem(row)"></vxe-button>
|
||||
</div>
|
||||
<div v-if="row.remark2 && row.remark2.includes('调试')">
|
||||
<vxe-button v-if="row.status != 2" size="mini" mode="text" status="primary" content="完成调试" @click="doCompletion(row)"></vxe-button>
|
||||
<vxe-button v-if="row.status === 2" size="mini" mode="text" status="danger" content="重新调试" @click="resetCompletion(row)"></vxe-button>
|
||||
</div>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
@@ -69,6 +73,7 @@
|
||||
|
||||
<script>
|
||||
import { getWorkoderList, startOnline, cancelOnline } from '@/api/productManagement/workorder_online.js'
|
||||
import { updateworkorder } from '@/api/productManagement/workoder_v2.js'
|
||||
|
||||
export default {
|
||||
name: 'workorder_online',
|
||||
@@ -146,6 +151,77 @@ export default {
|
||||
this.$message.info('动作取消')
|
||||
})
|
||||
},
|
||||
|
||||
// 完成调试,设置status为2
|
||||
doCompletion(row) {
|
||||
this.$modal
|
||||
.confirm('是否确认完成调试工单名称为"' + row.productDescription + '"的数据项?')
|
||||
.then(() => {
|
||||
// 深拷贝行数据并设置状态为2
|
||||
const updateData = { ...row, status: 2 };
|
||||
|
||||
// 转换数值类型
|
||||
updateData.vehicleNumber = Number(updateData.vehicleNumber) || 0;
|
||||
updateData.hangNumber = Number(updateData.hangNumber) || 0;
|
||||
updateData.previousNumber = Number(updateData.previousNumber) || 0;
|
||||
updateData.year = Number(updateData.year) || 0;
|
||||
updateData.week = Number(updateData.week) || 0;
|
||||
updateData.date = Number(updateData.date) || 0;
|
||||
updateData.sort = Number(updateData.sort) || 0;
|
||||
|
||||
// 调用updateworkorder方法更新工单状态
|
||||
updateworkorder(updateData).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success('调试完成');
|
||||
this.getList(); // 重新获取列表数据
|
||||
} else {
|
||||
this.$message.error(res.msg || '操作失败,请重试');
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('更新工单状态失败:', error);
|
||||
this.$message.error('网络异常,请重试');
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.info('动作取消')
|
||||
})
|
||||
},
|
||||
|
||||
// 重新调试,设置status为0
|
||||
resetCompletion(row) {
|
||||
this.$modal
|
||||
.confirm('是否确认重新调试工单名称为"' + row.productDescription + '"的数据项?')
|
||||
.then(() => {
|
||||
// 深拷贝行数据并设置状态为1
|
||||
const updateData = { ...row, status: 0 };
|
||||
|
||||
// 转换数值类型
|
||||
updateData.vehicleNumber = Number(updateData.vehicleNumber) || 0;
|
||||
updateData.hangNumber = Number(updateData.hangNumber) || 0;
|
||||
updateData.previousNumber = Number(updateData.previousNumber) || 0;
|
||||
updateData.year = Number(updateData.year) || 0;
|
||||
updateData.week = Number(updateData.week) || 0;
|
||||
updateData.date = Number(updateData.date) || 0;
|
||||
updateData.sort = Number(updateData.sort) || 0;
|
||||
|
||||
// 调用updateworkorder方法更新工单状态
|
||||
updateworkorder(updateData).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success('重新调试设置成功');
|
||||
this.getList(); // 重新获取列表数据
|
||||
} else {
|
||||
this.$message.error(res.msg || '操作失败,请重试');
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('更新工单状态失败:', error);
|
||||
this.$message.error('网络异常,请重试');
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.info('动作取消')
|
||||
})
|
||||
},
|
||||
|
||||
//todo 更改单元格格式
|
||||
rowClassName(item) {
|
||||
if (item.row.status === 1) {
|
||||
|
||||
Reference in New Issue
Block a user