待检任务检测历史的前后端代码
This commit is contained in:
@@ -41,4 +41,15 @@ export function delCheckTask(taskId) {
|
||||
url: '/qc/checkTask/' + taskId,
|
||||
method: 'delete'
|
||||
})
|
||||
|
||||
//查看历史任务
|
||||
}
|
||||
|
||||
// 查询历史检查任务列表
|
||||
export function listHistoryCheckTask(query) {
|
||||
return request({
|
||||
url: '/qc/checkTask/listHistory',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
@@ -42,3 +42,11 @@ export function delCheckTaskItem(itemId) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function updateCheckTaskItemStatus(data) {
|
||||
return request({
|
||||
url: '/qc/checkTaskItem/updateStatus',
|
||||
method: 'put',
|
||||
data // 需要包含checkTaskId、checkItemId、status
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="任务名称" prop="taskName">
|
||||
<el-input
|
||||
v-model="queryParams.taskName"
|
||||
@@ -39,196 +39,116 @@
|
||||
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>
|
||||
@click="handleDetail(scope.row)"
|
||||
>详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
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="taskName">
|
||||
<el-input v-model="form.taskName" placeholder="请输入任务名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" 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>
|
||||
<!-- 检查任务详情弹窗(可复用task页面的实现) -->
|
||||
<!-- ...如需详情弹窗可参考task/index.vue... -->
|
||||
<el-dialog :title="'检查任务详情'" :visible.sync="detailOpen" width="600px" append-to-body>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="任务名称">{{ detailData.taskName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{ detailData.remark }}</el-descriptions-item>
|
||||
<el-descriptions-item label="检查项">
|
||||
<div v-for="item in detailData.itemList" :key="item.itemId" style="margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between;">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<el-tag type="info" style="margin-right: 12px;">{{ item.itemName }}</el-tag>
|
||||
<el-tag
|
||||
:type="item.status == 1 ? 'success' : (item.status == 2 ? 'danger' : 'info')"
|
||||
style="margin-right: 16px; min-width: 60px; text-align: center;"
|
||||
>
|
||||
<span v-if="item.status == 0">未检测</span>
|
||||
<span v-else-if="item.status == 1">通过</span>
|
||||
<span v-else-if="item.status == 2">不通过</span>
|
||||
<span v-else>未知</span>
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleDetailClose">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCheckTask, getCheckTask, delCheckTask, addCheckTask, updateCheckTask } from "@/api/mes/qc/checkTask";
|
||||
import { listHistoryCheckTask, getCheckTask } from '@/api/mes/qc/checkTask'
|
||||
|
||||
export default {
|
||||
name: "CheckTask",
|
||||
name: 'CheckTaskHistory',
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 检查任务表格数据
|
||||
checkTaskList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
taskName: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
detailOpen: false,
|
||||
detailData: {},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询检查任务列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCheckTask(this.queryParams).then(response => {
|
||||
this.checkTaskList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
this.loading = true
|
||||
listHistoryCheckTask(this.queryParams).then(response => {
|
||||
this.checkTaskList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
taskId: undefined,
|
||||
taskName: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined,
|
||||
delFlag: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.taskId)
|
||||
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 taskId = row.taskId || this.ids
|
||||
getCheckTask(taskId).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.taskId != null) {
|
||||
updateCheckTask(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addCheckTask(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const taskIds = row.taskId || this.ids;
|
||||
this.$modal.confirm('是否确认删除检查任务编号为"' + taskIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delCheckTask(taskIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('qc/checkTask/export', {
|
||||
...this.queryParams
|
||||
}, `checkTask_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
handleDetail(row) {
|
||||
this.loading = true
|
||||
getCheckTask(row.taskId).then(response => {
|
||||
this.detailData = response.data
|
||||
this.detailOpen = true
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
handleDetailClose() {
|
||||
this.detailOpen = false
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -106,16 +106,48 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 检查任务详情弹窗 -->
|
||||
<el-dialog :title="'检查任务详情'" :visible.sync="detailOpen" width="600px" append-to-body>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="任务名称">{{ detailData.taskName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{ detailData.remark }}</el-descriptions-item>
|
||||
<el-descriptions-item label="检查项">
|
||||
<div v-for="item in detailData.itemList" :key="item.itemId" style="margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between;">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<el-tag type="info" style="margin-right: 12px;">{{ item.itemName }}</el-tag>
|
||||
<el-tag
|
||||
:type="item.status == 1 ? 'success' : (item.status == 2 ? 'danger' : 'info')"
|
||||
style="margin-right: 16px; min-width: 60px; text-align: center;"
|
||||
>
|
||||
<span v-if="item.status == 0">未检测</span>
|
||||
<span v-else-if="item.status == 1">通过</span>
|
||||
<span v-else-if="item.status == 2">不通过</span>
|
||||
<span v-else>未知</span>
|
||||
</el-tag>
|
||||
</div>
|
||||
<div>
|
||||
<el-button v-if="item.status == 0" size="mini" type="success" style="margin-right: 8px;" @click="changeItemStatus(detailData.taskId, item.itemId, 1)">通过</el-button>
|
||||
<el-button v-if="item.status == 0" size="mini" type="danger" @click="changeItemStatus(detailData.taskId, item.itemId, 2)">不通过</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleDetailClose">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { listCheckTask, getCheckTask, delCheckTask, addCheckTask, updateCheckTask } from "@/api/mes/qc/checkTask";
|
||||
import { listCheckTask, getCheckTask, delCheckTask, addCheckTask, updateCheckTask } from '@/api/mes/qc/checkTask'
|
||||
import { updateCheckTaskItemStatus } from '@/api/mes/qc/checkTaskItem'
|
||||
import CheckItemSelect from '@/components/KLPService/CheckItemSelect/index'
|
||||
|
||||
export default {
|
||||
name: "CheckTask",
|
||||
name: 'CheckTask',
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
@@ -148,7 +180,9 @@ export default {
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
},
|
||||
detailOpen: false,
|
||||
detailData: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -221,6 +255,16 @@ export default {
|
||||
this.title = "修改检查任务";
|
||||
});
|
||||
},
|
||||
/** 详情按钮操作 */
|
||||
handleDetail(row) {
|
||||
this.loading = true
|
||||
getCheckTask(row.taskId).then(response => {
|
||||
this.detailData = response.data
|
||||
this.detailOpen = true
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
@@ -266,6 +310,23 @@ export default {
|
||||
this.download('qc/checkTask/export', {
|
||||
...this.queryParams
|
||||
}, `checkTask_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 修改检查项状态 */
|
||||
changeItemStatus(checkTaskId, checkItemId, status) {
|
||||
this.$modal.confirm('确定要将该检查项状态修改为' + (status === 1 ? '通过' : '不通过') + '吗?').then(() => {
|
||||
// 调用新接口
|
||||
return updateCheckTaskItemStatus({ checkTaskId, checkItemId, status })
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess('状态修改成功')
|
||||
// 重新拉取详情
|
||||
getCheckTask(this.detailData.taskId).then(response => {
|
||||
this.detailData = response.data
|
||||
})
|
||||
})
|
||||
},
|
||||
handleDetailClose() {
|
||||
this.detailOpen = false
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user