|
@@ -0,0 +1,228 @@
|
|
|
+<template>
|
|
|
+ <div class="body">
|
|
|
+ <div class="opera">
|
|
|
+ <el-switch
|
|
|
+ v-model="value"
|
|
|
+ size="large"
|
|
|
+ style="--el-switch-on-color: red; --el-switch-off-color: #13ce66"
|
|
|
+ active-text="剔除"
|
|
|
+ inactive-text="返工"
|
|
|
+ >
|
|
|
+ <template #active-action>
|
|
|
+ <span class="custom-active-action" style="font-weight: 600">T</span>
|
|
|
+ </template>
|
|
|
+ <template #inactive-action>
|
|
|
+ <span class="custom-inactive-action" style="font-weight: 600">F</span>
|
|
|
+ </template></el-switch
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-scrollbar class="containerBox" v-if="!value">
|
|
|
+ <div style="margin-bottom: 10px; display: flex; justify-content: center">
|
|
|
+ <el-button type="primary" v-if="formStatus" @click="toAdd"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ <el-button type="primary" v-else @click="toList">返回</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <template v-if="formStatus">
|
|
|
+ <el-table class="table" :data="tableData">
|
|
|
+ <el-table-column label="物料名称" prop="materialName" />
|
|
|
+ <el-table-column label="数量" prop="num" />
|
|
|
+ <el-table-column label="返工原因" prop="reason" />
|
|
|
+ <el-table-column label="返工内容" prop="remark" />
|
|
|
+ </el-table>
|
|
|
+ <Pagination
|
|
|
+ v-model:limit="limit"
|
|
|
+ v-model:page="page"
|
|
|
+ :position="'right'"
|
|
|
+ :total="total"
|
|
|
+ @pagination="getPagination"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-scrollbar class="form">
|
|
|
+ <el-form ref="ruleFormRef" :model="ruleForm" :rules="rules">
|
|
|
+ <el-form-item
|
|
|
+ :label="`流转卡号数量[${ruleForm.seqList.length}]`"
|
|
|
+ prop="seqNoList"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="ruleForm.seqList"
|
|
|
+ multiple
|
|
|
+ placeholder="请选择"
|
|
|
+ value-key="value"
|
|
|
+ @change="selectProcessWorkSeqChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in infoData?.processWorkSeq"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="返工工序" prop="itemList">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleForm.itemList"
|
|
|
+ multiple
|
|
|
+ placeholder="请选择"
|
|
|
+ value-key="operationId"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in operationList"
|
|
|
+ :key="item.operationId"
|
|
|
+ :label="item.operationName"
|
|
|
+ :value="item"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="返工原因" prop="reason">
|
|
|
+ <el-input v-model="ruleForm.reason" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="返工内容" prop="remark">
|
|
|
+ <el-input v-model="ruleForm.remark" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-scrollbar>
|
|
|
+ <div class="btns">
|
|
|
+ <el-button type="primary" @click="submit">提交</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-scrollbar>
|
|
|
+ <el-scrollbar class="containerBox" v-else> 2 </el-scrollbar>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import {
|
|
|
+ breakReportInfoById,
|
|
|
+ operationListByIds,
|
|
|
+} from "@/api/process/reportBreak";
|
|
|
+import { addRework, getList } from "@/api/rework";
|
|
|
+import { useProcessStore } from "@/store/modules/processView";
|
|
|
+const processStore = useProcessStore();
|
|
|
+const ruleForm = ref({
|
|
|
+ seqList: [],
|
|
|
+});
|
|
|
+const tableData = ref([]);
|
|
|
+const toAdd = () => {
|
|
|
+ formStatus.value = false;
|
|
|
+ breakReportInfoById(processStore.scanInfo.id).then((res) => {
|
|
|
+ infoData.value = res.data;
|
|
|
+ });
|
|
|
+};
|
|
|
+const toList = () => {
|
|
|
+ resetForm();
|
|
|
+ formStatus.value = true;
|
|
|
+};
|
|
|
+const resetForm = () => {
|
|
|
+ ruleForm.value = { seqList: [] };
|
|
|
+};
|
|
|
+const getPagination = async () => {
|
|
|
+ const { data } = await getList({
|
|
|
+ pageNo: page.value,
|
|
|
+ pageSize: limit.value,
|
|
|
+ seqNo: processStore.useSeqNo,
|
|
|
+ });
|
|
|
+ tableData.value = data;
|
|
|
+};
|
|
|
+const formStatus = ref(true);
|
|
|
+const submit = async () => {
|
|
|
+ ruleFormRef.value.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ addTask();
|
|
|
+ } else {
|
|
|
+ ElMessage.error("请检查是否有未填项");
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+const addTask = async () => {
|
|
|
+ const { code } = await addRework({
|
|
|
+ ...ruleForm.value,
|
|
|
+ materialCode: processStore.scanInfo.materialCode,
|
|
|
+ materialName: processStore.scanInfo.materialName,
|
|
|
+ operationId: processStore.scanInfo.operationId,
|
|
|
+ operationName: processStore.scanInfo.operationName,
|
|
|
+ processId: processStore.scanInfo.id,
|
|
|
+ workOrderCode: processStore.odersData.workOrderCode,
|
|
|
+ });
|
|
|
+ if (code == "200") {
|
|
|
+ ElMessage.success("操作成功!");
|
|
|
+ }
|
|
|
+};
|
|
|
+const value = ref(false);
|
|
|
+const valueStatus = ref(false);
|
|
|
+const ruleFormRef = ref(null);
|
|
|
+const total = ref(0);
|
|
|
+const page = ref(1);
|
|
|
+const limit = ref(10);
|
|
|
+const operationList = ref([]);
|
|
|
+const infoData = ref({});
|
|
|
+const rules = reactive({
|
|
|
+ location: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "Please select a location",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+});
|
|
|
+const selectProcessWorkSeqChange = () => {
|
|
|
+ operationListByIds(ruleForm.value.seqList).then((res) => {
|
|
|
+ operationList.value = res.data;
|
|
|
+ });
|
|
|
+};
|
|
|
+onMounted(() => {
|
|
|
+ getPagination();
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.table {
|
|
|
+ height: calc(100vh - 240px);
|
|
|
+ border-radius: 16px;
|
|
|
+}
|
|
|
+.body {
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100vh - 60px);
|
|
|
+ .opera {
|
|
|
+ height: 40px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ background-color: white;
|
|
|
+ padding-right: 8%;
|
|
|
+ }
|
|
|
+}
|
|
|
+.containerBox {
|
|
|
+ height: calc(100vh - 100px);
|
|
|
+ padding: 20px;
|
|
|
+}
|
|
|
+:deep(.el-switch__label) {
|
|
|
+ span {
|
|
|
+ font-size: 20px !important;
|
|
|
+ line-height: 25px !important;
|
|
|
+ }
|
|
|
+}
|
|
|
+.form {
|
|
|
+ width: 50%;
|
|
|
+ max-width: 600px;
|
|
|
+ height: calc(100vh - 240px);
|
|
|
+ background-color: white;
|
|
|
+ margin: 0 auto;
|
|
|
+ padding: 0 20px;
|
|
|
+ padding-top: 20px;
|
|
|
+ border-radius: 16px;
|
|
|
+}
|
|
|
+.btns {
|
|
|
+ height: 40px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ width: 50%;
|
|
|
+ max-width: 600px;
|
|
|
+
|
|
|
+ margin: 0 auto;
|
|
|
+}
|
|
|
+</style>
|