dengrui il y a 8 mois
Parent
commit
669d98df47
2 fichiers modifiés avec 247 ajouts et 5 suppressions
  1. 22 0
      src/api/rework/index.ts
  2. 225 5
      src/views/pro-operation/rework/index.vue

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

@@ -19,6 +19,21 @@ export function addRework(data: any) {
     data,
   });
 }
+export function addRework1(data: any) {
+  return request({
+    url: "/api/v1/error/add",
+    method: "post",
+    data,
+  });
+}
+export function delError(data: any) {
+  return request({
+    url: "/api/v1/error/del",
+    method: "post",
+    data,
+  });
+}
+
 export function getList(data: any) {
   return request({
     url: "/api/v1/rework/record/list",
@@ -26,3 +41,10 @@ export function getList(data: any) {
     data,
   });
 }
+export function getList1(data: any) {
+  return request({
+    url: "/api/v1/error/page",
+    method: "post",
+    data,
+  });
+}

+ 225 - 5
src/views/pro-operation/rework/index.vue

@@ -90,7 +90,127 @@
         </div>
       </template>
     </el-scrollbar>
-    <el-scrollbar class="containerBox" v-else> 2 </el-scrollbar>
+    <el-scrollbar class="containerBox" v-else>
+      <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">
+            <template #default="scope">
+              <span v-if="scope.row.state === 0">待处理</span>
+              <span v-else-if="scope.row.state === 1">审核中</span>
+              <span v-else-if="scope.row.state === 2">审核驳回</span>
+              <span v-else-if="scope.row.state === 3">审核完成</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="操作">
+            <template #default="{ row }">
+              <el-button
+                v-if="row.state === 0"
+                link
+                type="danger"
+                @click="del(row.id)"
+                style="font-size: 20px"
+                >删除</el-button
+              >
+            </template>
+          </el-table-column>
+        </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="ruleFormRef1" :model="ruleForm1" :rules="rules1">
+            <el-form-item label="流转卡号" prop="seqs">
+              <el-select
+                v-model="ruleForm1.seqs"
+                multiple
+                placeholder="请选择"
+                value-key="value"
+              >
+                <el-option
+                  v-for="item in infoData?.processWorkSeq"
+                  :key="item"
+                  :label="item"
+                  :value="item"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item
+              label="不合格现象(质量问题)描述"
+              prop="remark1[content]"
+            >
+              <el-input v-model="ruleForm1.remark1.content" />
+            </el-form-item>
+            <el-form-item label="检验人员" prop="reason">
+              <el-select
+                v-model="ruleForm1.remark1.user2"
+                filterable
+                placeholder="请选择人员"
+                value-key="id"
+              >
+                <el-option
+                  v-for="item in dictStroe.allUsers"
+                  :key="item.id"
+                  :label="item.userName"
+                  :value="item.userName"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="日期" prop="reason">
+              <el-date-picker
+                v-model="ruleForm1.remark1.time"
+                type="date"
+                placeholder="Pick a day"
+              />
+            </el-form-item>
+            <el-form-item label="原因分析" prop="remark2[content]">
+              <el-input v-model="ruleForm1.remark2.content" />
+            </el-form-item>
+            <el-form-item label="分析人" prop="reason">
+              <el-select
+                v-model="ruleForm1.remark2.user3"
+                filterable
+                placeholder="请选择人员"
+                value-key="id"
+              >
+                <el-option
+                  v-for="item in dictStroe.allUsers"
+                  :key="item.id"
+                  :label="item.userName"
+                  :value="item.userName"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="日期" prop="reason">
+              <el-date-picker
+                v-model="ruleForm1.remark2.time"
+                type="date"
+                placeholder="Pick a day"
+              />
+            </el-form-item>
+            <el-form-item label="详细地址" prop="address">
+              <el-input v-model="ruleForm1.address" />
+            </el-form-item>
+          </el-form>
+        </el-scrollbar>
+        <div class="btns">
+          <el-button type="primary" @click="submit1">提交</el-button>
+        </div>
+      </template>
+    </el-scrollbar>
   </div>
 </template>
 
@@ -99,12 +219,31 @@ import {
   breakReportInfoById,
   operationListByIds,
 } from "@/api/process/reportBreak";
-import { addRework, getList } from "@/api/rework";
+import {
+  addRework,
+  addRework1,
+  getList,
+  getList1,
+  delError,
+} from "@/api/rework";
 import { useProcessStore } from "@/store/modules/processView";
+import { useDictionaryStore } from "@/store/modules/dictionary";
+const dictStroe = useDictionaryStore();
 const processStore = useProcessStore();
 const ruleForm = ref({
   seqList: [],
 });
+const ruleForm1 = ref({
+  seqs: [],
+  remark1: {
+    content: "",
+    user2: "",
+  },
+  remark2: {
+    content: "",
+    user3: "",
+  },
+});
 const tableData = ref([]);
 const toAdd = () => {
   formStatus.value = false;
@@ -117,7 +256,20 @@ const toList = () => {
   formStatus.value = true;
 };
 const resetForm = () => {
+  page.value = 1;
+  limit.value = 10;
   ruleForm.value = { seqList: [] };
+  ruleForm1.value = {
+    seqs: [],
+    remark1: {
+      content: "",
+      user2: "",
+    },
+    remark2: {
+      content: "",
+      user3: "",
+    },
+  };
 };
 const getPagination = async () => {
   const { data } = await getList({
@@ -127,6 +279,22 @@ const getPagination = async () => {
   });
   tableData.value = data;
 };
+const del = async (id) => {
+  const { code } = await delError({
+    id,
+  });
+  if (code == "200") {
+    ElMessage.success("删除成功");
+    getPagination1();
+  }
+};
+const getPagination1 = async () => {
+  const { data } = await getList1({
+    pageNo: page.value,
+    pageSize: limit.value,
+  });
+  tableData.value = data.records;
+};
 const formStatus = ref(true);
 const submit = async () => {
   ruleFormRef.value.validate((valid) => {
@@ -137,6 +305,15 @@ const submit = async () => {
     }
   });
 };
+const submit1 = async () => {
+  ruleFormRef1.value.validate((valid) => {
+    if (valid) {
+      addTask1();
+    } else {
+      ElMessage.error("请检查是否有未填项");
+    }
+  });
+};
 const addTask = async () => {
   const { code } = await addRework({
     ...ruleForm.value,
@@ -148,12 +325,36 @@ const addTask = async () => {
     workOrderCode: processStore.odersData.workOrderCode,
   });
   if (code == "200") {
+    resetForm();
+    formStatus.value = true;
+    getPagination();
+    ElMessage.success("操作成功!");
+  }
+};
+const addTask1 = async () => {
+  const { code } = await addRework1({
+    ...ruleForm1.value,
+    materialModel: processStore.odersData.materialModel,
+    materialCode: processStore.scanInfo.materialCode,
+    materialName: processStore.scanInfo.materialName,
+    operationId: processStore.scanInfo.operationId,
+    operationName: processStore.scanInfo.operationName,
+    pid: processStore.scanInfo.id,
+    workOrderCode: processStore.odersData.workOrderCode,
+    orderNo: processStore.scanInfo.orderCode,
+    type: "eliminate",
+  });
+  if (code == "200") {
+    resetForm();
+    formStatus.value = true;
+    getPagination1();
     ElMessage.success("操作成功!");
   }
 };
 const value = ref(false);
 const valueStatus = ref(false);
 const ruleFormRef = ref(null);
+const ruleFormRef1 = ref(null);
 const total = ref(0);
 const page = ref(1);
 const limit = ref(10);
@@ -168,14 +369,33 @@ const rules = reactive({
     },
   ],
 });
+const rules1 = 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();
-});
+
+watch(
+  () => value.value,
+  (val) => {
+    resetForm();
+    if (val == false) {
+      getPagination();
+    } else {
+      getPagination1();
+    }
+  },
+  { immediate: true }
+);
 </script>
 
 <style lang="scss" scoped>