init project
This commit is contained in:
136
pages/tpm/checkTaskItem.vue
Normal file
136
pages/tpm/checkTaskItem.vue
Normal file
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-collapse>
|
||||
<uni-forms ref="form" :modelValue="formData">
|
||||
<uni-collapse-item title="点检任务明细单" :open="true">
|
||||
<uni-forms-item label="任务名" :labelWidth='90' name="taskName">
|
||||
<uni-easyinput disabled v-model="formData.taskName" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="明细号" :labelWidth='90' name="taskItemCode">
|
||||
<uni-easyinput disabled v-model="formData.taskItemCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="明细名" :labelWidth='90' name="taskItemName">
|
||||
<uni-easyinput disabled v-model="formData.taskItemName" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备编码" :labelWidth='90' name="equipmentCode">
|
||||
<uni-easyinput disabled v-model="formData.equipmentCode" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="检查人ID" :labelWidth='90' name="verifierId">
|
||||
<uni-easyinput disabled v-model="formData.verifierId" />
|
||||
</uni-forms-item>
|
||||
</uni-collapse-item>
|
||||
<uni-collapse-item title="点检任务明细项信息" :open="true">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
|
||||
v-for="(item, index) in formData.tpmEquipmentCheckTaskItemDetailList">
|
||||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||||
<uni-forms-item label="项目编码" :labelWidth='90'
|
||||
:name="'tpmEquipmentCheckTaskItemDetailList.'+ index +'.detailCode'">
|
||||
<uni-easyinput disabled type="text" disabled v-model="item.detailCode"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="项目名称" :labelWidth='90'
|
||||
:name="'tpmEquipmentCheckTaskItemDetailList.'+ index +'.detailName'">
|
||||
<uni-easyinput disabled type="text" disabled v-model="item.detailName"></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="点检标准" :labelWidth='90'
|
||||
name="'tpmEquipmentCheckTaskItemDetailList.'+ index +'.standard'">
|
||||
<uni-easyinput disabled type="text" v-model="item.standard" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="点检结果" :labelWidth='90'
|
||||
name="'tpmEquipmentCheckTaskItemDetailList.'+ index +'.result'">
|
||||
<uni-easyinput disabled type="text" v-model="item.result" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="状态" :labelWidth='90'
|
||||
name="'tpmEquipmentCheckTaskItemDetailList.'+ index +'.status'">
|
||||
<uni-tag :text="tagText(item.status)" type="primary" v-if="item.status"></uni-tag>
|
||||
<button type="success" size="mini"
|
||||
style="float: right;margin-right: 10px;background-color: #5AC725;color: #fff;"
|
||||
@click="handleFinish(item)">点检完成</button>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="备注" :labelWidth='90'
|
||||
name="'tpmEquipmentCheckTaskItemDetailList.'+ index +'remark'">
|
||||
<uni-easyinput disabled type="text" v-model="item.remark" />
|
||||
</uni-forms-item>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
</uni-collapse-item>
|
||||
</uni-forms>
|
||||
</uni-collapse>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listTaskItem,
|
||||
getTaskItem,
|
||||
delTaskItem,
|
||||
addTaskItem,
|
||||
updateTaskItem,
|
||||
finishCheckTaskItem,
|
||||
finishCheckTaskItemDetail,
|
||||
repairCheckTaskItemDetail,
|
||||
listEmployee,
|
||||
tpmCheckTaskEditemOnly
|
||||
} from "@/api/tpm/checkTaskItem";
|
||||
export default {
|
||||
onLoad(option) {
|
||||
this.formData = JSON.parse(option.formData);
|
||||
},
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
formData: {},
|
||||
rightOptions: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#ff2a17'
|
||||
}
|
||||
}, ],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
tagText(status) {
|
||||
if (status == "0") {
|
||||
return "待点检";
|
||||
} else if (status == "1") {
|
||||
return "已点检";
|
||||
} else if (status == "2") {
|
||||
return "已报修";
|
||||
}
|
||||
},
|
||||
async handleFinish(item) {
|
||||
try {
|
||||
// 获取用户ID
|
||||
let useId = null;
|
||||
const res = await listEmployee({
|
||||
"name": this.$store.state.user.name
|
||||
});
|
||||
if (res && res.rows && res.rows.length > 0) {
|
||||
useId = res.rows[0]["id"];
|
||||
}
|
||||
|
||||
if (useId) {
|
||||
// 更改数据状态
|
||||
const verifierRes = await tpmCheckTaskEditemOnly({
|
||||
id: useId
|
||||
});
|
||||
console.log(verifierRes, "verifierRes");
|
||||
|
||||
// 完成检查任务项详情
|
||||
const finishRes = await finishCheckTaskItemDetail([item.id]);
|
||||
this.$modal.msgSuccess("完成成功!");
|
||||
item.status = "1"; // 更新item的状态
|
||||
} else {
|
||||
// this.$modal.msgError("没有找到该员工!");
|
||||
}
|
||||
} catch (error) {
|
||||
// console.error("Error in handleFinish:", error);
|
||||
// this.$modal.msgError("操作失败,请稍后重试!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user