dengrui пре 8 месеци
родитељ
комит
b2bae93ab2

+ 28 - 0
src/api/rework/index.ts

@@ -0,0 +1,28 @@
+import request from "@/utils/request";
+
+/**
+ * 通过id获取报故详情
+ *
+ * @param queryParams
+ */
+export function getEscalationFaultById(id: any) {
+  return request({
+    url: "/api/v1/process/escalationFault/get/" + `${id}`,
+    method: "get",
+  });
+}
+
+export function addRework(data: any) {
+  return request({
+    url: "/api/v1/rework/record/add",
+    method: "post",
+    data,
+  });
+}
+export function getList(data: any) {
+  return request({
+    url: "/api/v1/rework/record/list",
+    method: "post",
+    data,
+  });
+}

+ 11 - 3
src/components/Pagination/index.vue

@@ -1,8 +1,16 @@
 <template>
   <div :class="{ hidden: hidden }" class="pagination">
-    <el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :background="background"
-      :layout="layout" :page-sizes="pageSizes" :total="total" @size-change="handleSizeChange"
-      @current-change="handleCurrentChange" :style="`float:${position} `" />
+    <el-pagination
+      v-model:current-page="currentPage"
+      v-model:page-size="pageSize"
+      :background="background"
+      :layout="layout"
+      :page-sizes="pageSizes"
+      :total="total"
+      @size-change="handleSizeChange"
+      @current-change="handleCurrentChange"
+      :style="`float:${position} `"
+    />
   </div>
 </template>
 

+ 10 - 0
src/router/modules/process.ts

@@ -42,6 +42,7 @@ export default {
             back: true,
           },
         },
+
         {
           path: "esop",
           component: () => import("@/views/pro-steps/components/ESOP.vue"),
@@ -178,6 +179,15 @@ export default {
         back: true,
       },
     },
+    {
+      path: "rework",
+      component: () => import("@/views/pro-operation/rework/index.vue"),
+      name: "rework",
+      meta: {
+        title: "返工/剔除",
+        back: true,
+      },
+    },
   ],
   beforeEnter: (to, from, next) => {
     const store = useUserStore();

+ 228 - 0
src/views/pro-operation/rework/index.vue

@@ -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>

+ 7 - 0
src/views/pro-steps/components/operates.vue

@@ -53,6 +53,9 @@ const setIndex = (index: number) => {
     case "weiwai":
       router.push({ name: "appoint-out" });
       break;
+    case "fangong":
+      router.push({ name: "rework" });
+      break;
     case "baogong":
       reportWorkRef.value?.openReportWorkDrawer();
       break;
@@ -89,6 +92,10 @@ const stepComponents = ref([
     compentName: "报工",
     compentType: "baogong",
   },
+  {
+    compentName: "返工/剔除",
+    compentType: "fangong",
+  },
 ]);
 
 onMounted(() => {