Browse Source

feature/检验页面

dengrui 10 months ago
parent
commit
73bb09380a

+ 6 - 10
src/api/file/index.ts

@@ -1,19 +1,15 @@
 import request from "@/utils/request";
 import { AxiosPromise } from "axios";
 import { FileInfo } from "./types";
-import { v4 as uuidv4 } from "uuid";
 
-/**
- * 上传文件
- *
- * @param file
- */
-export function uploadFileApi(file: File): AxiosPromise<FileInfo> {
+export function uploadFileApi(
+  file: File,
+  generatePdf: boolean = false
+): AxiosPromise<FileInfo> {
   const formData = new FormData();
   formData.append("file", file);
-
-  formData.append("fileName", `${uuidv4()}.` + file.name.split(".").pop());
-
+  formData.append("fileName", file.name);
+  formData.append("generatePdf", generatePdf);
   return request({
     url: "/api/v1/base/upload",
     method: "post",

+ 59 - 0
src/api/inspect/index.ts

@@ -0,0 +1,59 @@
+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 checkUser(data: any) {
+  return request({
+    url: "/api/v1/sys/user/user/detail",
+    method: "post",
+    data,
+  });
+}
+export function getCheckList(data: any) {
+  return request({
+    url: "/api/v1/process/check/items/page",
+    method: "post",
+    data,
+  });
+}
+export function addCheckList(data: any) {
+  return request({
+    url: "/api/v1/process/check/items/add",
+    method: "post",
+    data,
+  });
+}
+export function editCheckList(data: any) {
+  return request({
+    url: "/api/v1/process/check/items/update",
+    method: "post",
+    data,
+  });
+}
+export function deleteCheckList(data: any) {
+  return request({
+    url: "/api/v1/process/check/items/del",
+    method: "post",
+    data,
+  });
+}
+
+export function getSeqData(id: any) {
+  return request({
+    url: "/api/v1/process/escalationFault/getWorkDetail/" + `${id}`,
+    method: "get",
+  });
+}

+ 165 - 0
src/components/Upload/FilesUpload.vue

@@ -0,0 +1,165 @@
+<template>
+  <el-upload
+    v-model:file-list="fileList"
+    class="upload-demo"
+    :on-change="handleChange"
+    :limit="limit"
+    :auto-upload="false"
+    :show-file-list="false"
+  >
+    <el-button
+      type="primary"
+      :loading="loading"
+      :disabled="fileList.length >= limit"
+      >点击上传文件</el-button
+    >
+    <template #tip>
+      <div class="tip" v-if="showTip">
+        文件类型限制为.jpg,.jpeg,.png,word文档,pdf,大小不超过{{ size }}M
+      </div>
+    </template>
+    <div>
+      <el-tag
+        class="file-item"
+        v-for="(file, index) in fileList"
+        :key="file.name"
+        closable
+        type="success"
+        @close="deleteFile(index)"
+        @click.stop.prevent="handlePreview(index)"
+      >
+        {{ file.name }}
+      </el-tag>
+    </div>
+  </el-upload>
+  <el-drawer
+    v-model="PDFVisible"
+    :footer="false"
+    :header="false"
+    :show-close="false"
+    destroy-on-close
+    direction="rtl"
+    :append-to-body="true"
+    size="972px"
+  >
+    <VuePdfEmbed :source="pdfSource" annotation-layer text-layer />
+  </el-drawer>
+</template>
+<script lang="ts" setup>
+import { ref } from "vue";
+import { UploadFile, UploadFiles, UploadUserFile } from "element-plus";
+import { uploadFileApi } from "@/api/file";
+import PDFView from "@/components/PDFView/index.vue";
+import VuePdfEmbed from "vue-pdf-embed";
+
+const props = defineProps({
+  size: {
+    type: Number,
+    default: 4,
+  },
+  limit: {
+    type: Number,
+    default: 1,
+  },
+  src: {
+    type: String,
+    default: "",
+  },
+  srcList: {
+    type: Array<string>,
+    default: () => [],
+  },
+  pdfList: {
+    type: Array<string>,
+    default: () => [],
+  },
+  fileNameList: {
+    type: Array<string>,
+    default: () => [],
+  },
+  generatePdf: {
+    type: Boolean,
+    default: false,
+  },
+  showTip: {
+    type: Boolean,
+    default: true,
+  },
+});
+
+const loading = ref(false);
+
+const emit = defineEmits([
+  "update:src",
+  "update:srcList",
+  "update:pdfList",
+  "update:fileNameList",
+  "finished",
+]);
+
+// 上传文件成功返回的值
+const src = useVModel(props, "src", emit); //单文件用这个
+const srcList = useVModel(props, "srcList", emit); //多文件用这个
+const pdfList = useVModel(props, "pdfList", emit); //转换成pdf后的多文件用这个
+const fileNameList = useVModel(props, "fileNameList", emit); //多文件上传要显示文件名
+
+// el-upload 绑定的值
+const fileList = ref<UploadUserFile[]>([]);
+const resetFileList = (value: Array) => {
+  fileList.value = value;
+};
+
+const handleChange = async (uploadFile: UploadFile) => {
+  if (uploadFile.size! > props.size * 1048 * 1048) {
+    ElMessage.warning(`上传文件不能大于${props.size}M`);
+    return;
+  }
+  loading.value = true;
+  uploadFileApi(uploadFile.raw as File, props.generatePdf)
+    .then((res: any) => {
+      loading.value = false;
+      src.value = res.data.fileUrl;
+      pdfList.value.push(res.data.pdfUrl);
+      srcList.value.push(res.data.fileUrl);
+      fileNameList.value.push(res.data.fileName);
+      emit("finished");
+    })
+    .catch((err) => {
+      ElMessage.error(err.message);
+      loading.value = false;
+    });
+};
+
+const deleteFile = (index: number) => {
+  src.value = ""; //删除直接清空src即可,不用考虑是哪个,因为单文件不会有多个
+  fileList.value.splice(index, 1);
+  srcList.value.splice(index, 1);
+  pdfList.value.splice(index, 1);
+  fileNameList.value.splice(index, 1);
+};
+
+const PDFVisible = ref(false);
+const pdfSource = ref("");
+const handlePreview = (index: number) => {
+  if (srcList.value.length > index && props.generatePdf) {
+    pdfSource.value =
+      import.meta.env.VITE_APP_UPLOAD_URL + pdfList.value[index];
+    PDFVisible.value = true;
+  }
+};
+defineExpose({
+  resetFileList,
+  fileList,
+});
+</script>
+
+<style scoped lang="scss">
+.tip {
+  font-size: 12px;
+  color: #e6a23c;
+  margin-top: 5px;
+}
+.file-item {
+  margin-left: 10px;
+}
+</style>

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

@@ -125,6 +125,15 @@ export default {
       },
     },
     {
+      path: "inspect",
+      component: () => import("@/views/pro-operation/inspect/index.vue"),
+      name: "inspect",
+      meta: {
+        title: "检验",
+        back: true,
+      },
+    },
+    {
       path: "appoint",
       component: () => import("@/views/pro-operation/appoint-out/index.vue"),
       name: "appoint-out",

+ 1 - 0
src/store/index.ts

@@ -20,4 +20,5 @@ export * from "./modules/common";
 export * from "./modules/processView";
 export * from "./modules/dictionary";
 export * from "./modules/repair";
+export * from "./modules/inspect";
 export { store };

+ 15 - 0
src/store/modules/inspect.ts

@@ -0,0 +1,15 @@
+import { store } from "@/store";
+export const useInspectStore = defineStore(
+  "Inspect",
+  () => {
+    const checkName = ref<any>("");
+    return { checkName };
+  },
+  {
+    //开启持久化存储
+    persist: true,
+  }
+);
+export function useInspectStoreHook() {
+  return useInspectStore(store);
+}

+ 25 - 0
src/utils/downLoad.ts

@@ -0,0 +1,25 @@
+// 在你的 Vue 组件中引入 axios 或者其他网络请求库
+import axios from "axios";
+const downService = axios.create({
+  baseURL: import.meta.env.VITE_APP_UPLOAD_URL,
+});
+async function downloadFile(url: string, fileName: string) {
+  try {
+    const response = await downService.get(url, {
+      responseType: "blob",
+    });
+    const blob = new Blob([response.data]);
+    const link = document.createElement("a");
+    const resurl = url;
+    link.href = window.URL.createObjectURL(blob);
+    const lastDotIndex = resurl.lastIndexOf(".");
+    link.download = fileName + "." + resurl.substring(lastDotIndex + 1);
+    document.body.appendChild(link);
+    link.click();
+    window.URL.revokeObjectURL(link.href);
+    document.body.removeChild(link);
+  } catch (error) {
+    console.error("文件下载失败:", error);
+  }
+}
+export { downloadFile };

+ 117 - 42
src/views/prepare-complete-suit/firstPopUpView/showInfo.vue

@@ -6,26 +6,74 @@
           <div class="btns">
             <!-- <el-button :class="selectedType == 'default' ? 'activeBtn' : ''" @click="setSelectedType('default')"
               type="primary" plain>全 部</el-button> -->
-            <el-button :class="selectedType == 'yes' ? 'activeBtn' : ''" @click="setSelectedType('yes')"
-              :disabled="disabled" type="primary" plain>符 合</el-button>
-            <el-button :class="selectedType == 'no' ? 'activeBtn' : ''" @click="setSelectedType('no')"
-              :disabled="disabled" type="primary" plain>不符合</el-button>
+            <el-button
+              :class="selectedType == 'yes' ? 'activeBtn' : ''"
+              @click="setSelectedType('yes')"
+              :disabled="disabled"
+              type="primary"
+              plain
+              >符 合</el-button
+            >
+            <el-button
+              :class="selectedType == 'no' ? 'activeBtn' : ''"
+              @click="setSelectedType('no')"
+              :disabled="disabled"
+              type="primary"
+              plain
+              >不符合</el-button
+            >
             <div class="submitBox">
-              <el-button type="primary" @click="close" v-if="!bingdingStatus && !outboundStatus" plain>关 闭</el-button>
-              <el-button type="primary" style="background-color: #f9bf5c90"
-                v-if="!bingdingStatus && selectedType == 'yes'" @click="binding" plain>绑 定</el-button>
+              <el-button
+                type="primary"
+                @click="close"
+                v-if="!bingdingStatus && !outboundStatus"
+                plain
+                >关 闭</el-button
+              >
+              <el-button
+                type="primary"
+                style="background-color: #f9bf5c90"
+                v-if="!bingdingStatus && selectedType == 'yes'"
+                @click="binding"
+                plain
+                >绑 定</el-button
+              >
 
-              <el-button @click="cancelBingding" type="primary" v-if="bingdingStatus || outboundStatus" plain>取
-                消</el-button>
-              <el-button type="primary" style="background-color: #f9bf5c90" v-if="
-                !bingdingStatus &&
-                selectedType == 'no' &&
-                outboundStatus == false
-              " @click="outboundFnc" plain>出 库</el-button>
-              <el-button type="primary" @click="submit" style="background-color: #f9bf5c90; color: white; border: 0px"
-                v-if="bingdingStatus" plain>确 认</el-button>
-              <el-button type="primary" @click="submit" style="background-color: #f9bf5c90; color: white; border: 0px"
-                v-if="outboundStatus" plain>确 认</el-button>
+              <el-button
+                @click="cancelBingding"
+                type="primary"
+                v-if="bingdingStatus || outboundStatus"
+                plain
+                >取 消</el-button
+              >
+              <el-button
+                type="primary"
+                style="background-color: #f9bf5c90"
+                v-if="
+                  !bingdingStatus &&
+                  selectedType == 'no' &&
+                  outboundStatus == false
+                "
+                @click="outboundFnc"
+                plain
+                >出 库</el-button
+              >
+              <el-button
+                type="primary"
+                @click="submit"
+                style="background-color: #f9bf5c90; color: white; border: 0px"
+                v-if="bingdingStatus"
+                plain
+                >确 认</el-button
+              >
+              <el-button
+                type="primary"
+                @click="submit"
+                style="background-color: #f9bf5c90; color: white; border: 0px"
+                v-if="outboundStatus"
+                plain
+                >确 认</el-button
+              >
             </div>
           </div>
           <div class="selectInfoBox">
@@ -46,31 +94,49 @@
                     还需数量:{{
                       selectRowData.totalMaterial -
                         selectRowData.completeNum -
-                        topSum < 1 ? 0 : selectRowData.totalMaterial - selectRowData.completeNum - topSum }} </div>
-                  </div>
-                  <div class="selectInfoItem" v-if="selectedType == 'yes'" @click="closeTopItem(item.selectedIndex)"
-                    v-for="item in setTopItem">
-                    <div>料箱名称:</div>
-                    <div>{{ item.name }}</div>
-                    <div>料箱编号:</div>
-                    <div>{{ item.code }}</div>
+                        topSum <
+                      1
+                        ? 0
+                        : selectRowData.totalMaterial -
+                          selectRowData.completeNum -
+                          topSum
+                    }}
                   </div>
                 </div>
+                <div
+                  class="selectInfoItem"
+                  v-if="selectedType == 'yes'"
+                  @click="closeTopItem(item.selectedIndex)"
+                  v-for="item in setTopItem"
+                >
+                  <div>料箱名称:</div>
+                  <div>{{ item.name }}</div>
+                  <div>料箱编号:</div>
+                  <div>{{ item.code }}</div>
+                </div>
+              </div>
             </el-scrollbar>
           </div>
           <el-scrollbar class="scrollbar">
             <template v-for="(item, index) in materialData">
-              <div :class="index == outboundIndex
-                  ? 'item bound'
-                  : item.selected == true
-                    ? 'item active'
-                    : item.isEnable == 2
-                      ? 'item noBound'
-                      : 'item'
-                " :style="index == selectIndex
+              <div
+                :class="
+                  index == outboundIndex
+                    ? 'item bound'
+                    : item.selected == true
+                      ? 'item active'
+                      : item.isEnable == 2
+                        ? 'item noBound'
+                        : 'item'
+                "
+                :style="
+                  index == selectIndex
                     ? 'border: 3px solid #6cc2ff;box-shadow: 5px #6cc2ff;'
                     : ''
-                  " v-if="itemShowStatus(item)" @click="setSelectIndex(index)">
+                "
+                v-if="itemShowStatus(item)"
+                @click="setSelectIndex(index)"
+              >
                 <div>料箱名称:</div>
                 <div>{{ item.name }}</div>
                 <div>料箱编号:</div>
@@ -83,7 +149,11 @@
         <el-col :span="10">
           <el-scrollbar class="infoBox">
             <el-table class="infoTable" :data="selectIndexInfoData" border>
-              <el-table-column prop="materialName" label="物料名称" width="120" />
+              <el-table-column
+                prop="materialName"
+                label="物料名称"
+                width="120"
+              />
               <el-table-column prop="materialNo" label="物料编号" />
               <el-table-column prop="num" label="出入库数量" />
               <el-table-column prop="coordinate" label="储位坐标" />
@@ -95,8 +165,13 @@
         </el-col>
       </el-row>
     </div>
-    <Bangding v-model="showStatus" :title="bindingTitle" @submit="submitData" :submitType="submitType"
-      :outboundIndex="outboundIndex" />
+    <Bangding
+      v-model="showStatus"
+      :title="bindingTitle"
+      @submit="submitData"
+      :submitType="submitType"
+      :outboundIndex="outboundIndex"
+    />
   </div>
 </template>
 
@@ -152,7 +227,7 @@ const outboundFnc = () => {
   disabled.value = true;
 };
 const selectIndexInfoData = computed(() => {
-  if (materialData.value.length > 0 && selectIndex.value!=null) {
+  if (materialData.value.length > 0 && selectIndex.value != null) {
     return materialData.value[selectIndex.value].list;
   } else {
     return [];
@@ -165,9 +240,9 @@ const setSelectIndex = (index: number) => {
     //先判定是否现在数量已经够了
     if (
       selectRowData.value.totalMaterial -
-      selectRowData.value.completeNum -
-      topSum.value <
-      1 &&
+        selectRowData.value.completeNum -
+        topSum.value <
+        1 &&
       bingdingStatus.value
     )
       return ElMessage.warning("现数目已达需要值,请不要过量绑定!");

+ 86 - 0
src/views/pro-operation/inspect/components/checkForm.vue

@@ -0,0 +1,86 @@
+<template>
+  <el-form :model="modelValue" :rules="rules" label-width="100px" ref="formRef">
+    <el-form-item label="检验项名称" prop="checkName">
+      <el-input v-model="modelValue.checkName" />
+    </el-form-item>
+    <el-form-item label="检验内容" prop="checkContent">
+      <el-input type="textarea" v-model="modelValue.checkContent" />
+    </el-form-item>
+    <el-form-item label="结果" prop="result">
+      <el-select v-model="modelValue.result">
+        <el-option label="合格" value="1" />
+        <el-option label="不合格" value="2" />
+      </el-select>
+    </el-form-item>
+    <el-form-item label="流转卡号" prop="seqNoList">
+      <el-select v-model="modelValue.seqNoList" multiple>
+        <el-option
+          v-for="(item, index) in SeqArray"
+          :key="index"
+          :label="item"
+          :value="item"
+        />
+      </el-select>
+    </el-form-item>
+    <el-form-item label="上传附件">
+      <FilesUpload v-model:src="modelValue.filePath" ref="uploadRef" />
+    </el-form-item>
+  </el-form>
+</template>
+
+<script setup>
+import { getSeqData } from "@/api/inspect";
+import { useProcessStore } from "@/store/modules/processView";
+const rules = reactive({
+  checkContent: [{ required: true, trigger: "blur" }],
+  checkName: [{ required: true, trigger: "blur" }],
+  result: [{ required: true, trigger: "change" }],
+  seqNoList: [{ required: true, trigger: "change" }],
+});
+const processStore = useProcessStore();
+const uploadRef = ref(null);
+const setFileList = (value) => {
+  uploadRef.value.resetFileList(value);
+};
+
+const formRef = ref(null);
+const props = defineProps({
+  modelValue: {
+    type: [Object],
+  },
+});
+const SeqArray = ref([]);
+const emits = defineEmits(["update:modelValue", "submit"]);
+const getSeq = async () => {
+  const { data } = await getSeqData(processStore.scanInfo.id);
+  SeqArray.value = data.processWorkSeq;
+};
+onMounted(() => {
+  getSeq();
+});
+const fileName = inject("fileName");
+watch(
+  () => props.modelValue.filePath,
+  (value) => {
+    if (value) {
+      fileName.value = uploadRef.value.fileList[0].name;
+    } else {
+      fileName.value = "";
+    }
+  },
+  { deep: true }
+);
+defineExpose({
+  setFileList,
+  formRef,
+  fileName,
+});
+</script>
+
+<style lang="scss" scoped>
+.body {
+  display: flex;
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 418 - 0
src/views/pro-operation/inspect/index.vue

@@ -0,0 +1,418 @@
+<template>
+  <div class="body">
+    <!-- <div v-for="(box, index) in drawingData" :key="index" class="suit-box">
+        <div class="pdf-box">
+          <PDFView
+            :need-to-show-pdf="true"
+            :pdf-source="baseUrl + box.pdfPath"
+          />
+        </div>
+        <div class="suit-title">{{ box?.drawingTitle }}</div>
+        <div class="suit-desc">{{ box?.created }}</div>
+      </div> -->
+    <div v-if="!checkName" class="checkBody">
+      <div class="titleText" style="text-align: center; margin-bottom: 20px">
+        请先扫描铭牌或输入工牌号:
+      </div>
+      <ScanCodeInput v-model="inputValue" @keyup.enter="handleSubmit" />
+    </div>
+    <div v-else class="checkForm">
+      <div v-if="!editStatus" class="headerName">
+        <div class="titleText">当前检验人:{{ checkName }}</div>
+        <div
+          class="titleText"
+          style="margin-right: 15%; display: flex; align-items: center"
+        >
+          检验类型:
+          <el-select
+            v-model="checkType"
+            placeholder="Select"
+            style="width: 100px; font-size: 16px"
+            @change="
+              search.page = 1;
+              getPagination();
+            "
+          >
+            <el-option
+              v-for="item in options"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+              style="color: black; font-size: 16px"
+            />
+          </el-select>
+        </div>
+
+        <div
+          class="titleText"
+          style="color: red; cursor: pointer"
+          @click="logOff"
+        >
+          注销
+        </div>
+      </div>
+      <div v-if="!editStatus" class="content">
+        <div>
+          <el-button
+            class="sureBtn"
+            style="margin-bottom: 10px"
+            type="success"
+            @click="addCheck"
+            >新 增
+          </el-button>
+        </div>
+        <el-table
+          :data="dataList"
+          style="height: calc(100vh - 250px); border-radius: 16px"
+        >
+          <el-table-column label="序号" type="index" width="80" />
+          <el-table-column label="检验项名称" prop="checkName" />
+          <el-table-column label="检验项内容" prop="checkContent" />
+          <el-table-column label="流转卡号" prop="seqNo" />
+          <el-table-column label="附件" prop="filePath">
+            <template #default="scope">
+              <span
+                v-if="scope.row.filePath"
+                class="opera"
+                @click="downLoad(scope.row.filePath)"
+                >下载</span
+              >
+              <span v-else>无附件</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="结果" prop="result">
+            <template #default="scope">
+              <span
+                :style="{ color: scope.row.result == '1' ? 'green' : 'red' }"
+                >{{ scope.row.result == "1" ? "合格" : "不合格" }}</span
+              >
+            </template>
+          </el-table-column>
+          <el-table-column label="操作" width="180">
+            <template #default="scope">
+              <span class="opera" @click="editCheck(scope.row)">编辑</span>
+              <span
+                class="opera"
+                style="color: red"
+                @click="deleteCheck(scope.row.id)"
+                >删除</span
+              >
+            </template>
+          </el-table-column>
+          <template #empty>
+            <div class="empty">
+              <Empty />
+            </div>
+          </template>
+        </el-table>
+        <Pagination
+          :limit="search.limit"
+          :page="search.page"
+          :position="'right'"
+          :total="search.total"
+          @pagination="getPagination"
+        />
+      </div>
+      <div v-if="editStatus" class="headerName">
+        <div class="titleText">当前检验人:{{ checkName }}</div>
+        <div
+          class="titleText"
+          style="margin-right: 15%; display: flex; align-items: center"
+        >
+          操作类型:{{ editType == "add" ? "新增" : "修改" }}
+        </div>
+        <div></div>
+      </div>
+      <div v-if="editStatus" class="content">
+        <div class="form">
+          <div class="formContent">
+            <el-scrollbar style="height: calc(100vh - 260px); padding: 20px">
+              <CheckForm ref="formRef" v-model="formData"
+            /></el-scrollbar>
+          </div>
+          <div class="btns">
+            <el-button class="sureBtn" type="primary" @click="submit"
+              >提 交
+            </el-button>
+            <el-button class="sureBtn" type="info" @click="toBack"
+              >返 回
+            </el-button>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import {
+  checkUser,
+  getCheckList,
+  addCheckList,
+  editCheckList,
+  deleteCheckList,
+} from "@/api/inspect";
+import { useProcessStore } from "@/store/modules/processView";
+import { useInspectStore } from "@/store/modules/inspect";
+import { downloadFile } from "@/utils/downLoad";
+import PDFView from "@/components/PDFView/index.vue";
+import CheckForm from "./components/checkForm.vue";
+const formRef = ref(null);
+const formData = ref({});
+const checkName = ref(null);
+const checkType = ref("first_check");
+const editStatus = ref(false);
+const editCheck = async (row) => {
+  editStatus.value = true;
+  editType.value = "edit";
+  formData.value = row;
+  if (row.filePath) {
+    setTimeout(() => {
+      formRef.value.setFileList([{ name: row.fileName }]);
+    }, 0);
+  }
+};
+const search = ref({
+  limit: 10,
+  page: 1,
+  total: 0,
+});
+const downLoad = async (url) => {
+  let resUrl = url;
+  console.log(import.meta.env.VITE_APP_API_URL, "res");
+  await downloadFile(resUrl, "附件");
+};
+const addCheck = () => {
+  formData.value = { ...checkObj };
+  editStatus.value = true;
+  editType.value = "add";
+};
+const check = () => {
+  return new Promise(async (resolve, reject) => {
+    await formRef.value.formRef.validate((valid) => {
+      if (valid) {
+        resolve();
+      } else {
+        ElMessage.error("请检查表单");
+        reject();
+      }
+    });
+  });
+};
+const reset = () => {
+  formData.value = {};
+  editStatus.value = false;
+  editType.value = "add";
+  getPagination();
+};
+const addCheckAsync = async () => {
+  const { data, code } = await addCheckList({
+    ...formData.value,
+    checkType: checkType.value,
+    operationId: processStore.odersData.operationId,
+    workOrderCode: processStore.odersData.workOrderCode,
+    operator: checkName.value,
+    processId: processStore.scanInfo.id,
+    fileName: fileName.value,
+  });
+  if (code == "200") {
+    ElMessage.success("操作成功!");
+  }
+};
+const deleteCheck = (id) => {
+  deleteCheckAsync(id);
+};
+const deleteCheckAsync = async (id) => {
+  const { data, code } = await deleteCheckList({
+    id,
+  });
+  if (code == "200") {
+    ElMessage.success("操作成功!");
+    getPagination();
+  }
+};
+const editCheckAsync = async () => {
+  const { data, code } = await editCheckList({
+    ...formData.value,
+    checkType: checkType.value,
+    operationId: processStore.odersData.operationId,
+    workOrderCode: processStore.odersData.workOrderCode,
+    operator: checkName.value,
+    processId: processStore.scanInfo.id,
+    fileName: fileName.value,
+  });
+  if (code == "200") {
+    ElMessage.success("操作成功!");
+  }
+};
+const fileName = ref("");
+provide("fileName", fileName);
+const submit = async () => {
+  check().then(() => {
+    if (editType.value == "add") {
+      addCheckAsync();
+      reset();
+    } else {
+      editCheckAsync();
+      reset();
+    }
+  });
+};
+const checkObj = {
+  checkContent: "",
+  checkName: "",
+  checkType: "",
+  filePath: "",
+  result: "",
+  seqNoList: [],
+};
+const dataList = ref([]);
+const getPagination = async () => {
+  const { data } = await getCheckList({
+    checkType: checkType.value,
+    pageNo: search.value.page,
+    pageSize: search.value.limit,
+    operationId: processStore.odersData.operationId,
+    workOrderCode: processStore.odersData.workOrderCode,
+    seqNo: processStore.useSeqNo,
+  });
+  search.value.total = data.totalCount;
+  dataList.value = data.records;
+};
+const inspectStore = useInspectStore();
+const processStore = useProcessStore();
+const editType = ref("add");
+const toBack = () => {
+  editStatus.value = false;
+};
+//add 或者edit
+const options = [
+  {
+    value: "first_check",
+    label: "首检",
+  },
+  {
+    value: "inspection",
+    label: "巡检",
+  },
+  {
+    value: "self_check",
+    label: "自检",
+  },
+  {
+    value: "special_inspection",
+    label: "专检",
+  },
+  {
+    value: "mutual_inspection",
+    label: "互检",
+  },
+];
+const inputValue = ref("");
+const handleSubmit = () => {
+  checkUserVal();
+};
+const logOff = () => {
+  checkName.value = "";
+  inspectStore.checkName = "";
+};
+
+// const drawingData = ref<any>([]);
+const checkUserVal = async () => {
+  setTimeout(() => {
+    inputValue.value = "";
+  }, 0);
+  const { data, code, msg } = await checkUser({
+    employeeCode: inputValue.value,
+  });
+  if (code == "200") {
+    ElMessage.success("记录成功!请开展检验操作");
+    inspectStore.checkName = data.userName;
+    checkName.value = data.userName;
+  } else {
+    ElMessage.error(msg);
+  }
+};
+// const baseUrl = import.meta.env.VITE_APP_UPLOAD_URL;
+
+onMounted(() => {
+  if (inspectStore.checkName) {
+    checkName.value = inspectStore.checkName;
+  }
+});
+watch(checkName, (val) => {
+  if (val !== "") {
+    getPagination();
+  }
+});
+onUnmounted(() => {
+  inspectStore.checkName = "";
+});
+</script>
+
+<style lang="scss" scoped>
+.opera {
+  font-size: 20px;
+  margin-right: 10px;
+  cursor: pointer;
+  color: rgb(64, 158, 255);
+}
+.sureBtn {
+  border-radius: 16px;
+  font-size: 16px;
+  font-size: 500;
+}
+.body {
+  width: 100vw;
+  height: calc(100vh - 120px);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  .checkBody {
+    width: 30vw;
+    align-items: center;
+    justify-content: center;
+  }
+  .checkForm {
+    width: 100%;
+    height: 100%;
+    display: flex;
+    flex-direction: column;
+    .headerName {
+      width: 100%;
+      height: 40px;
+      background-color: white;
+      border-radius: 20px;
+      lighting-color: 40px;
+      padding: 0 20px;
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+    }
+    .content {
+      flex: 1;
+      padding: 20px;
+      .form {
+        width: 800px;
+        height: 100%;
+        margin: 0 auto;
+        background-color: white;
+        border-radius: 16px;
+        display: flex;
+        flex-direction: column;
+        .formContent {
+          flex: 1;
+        }
+        .btns {
+          width: 100%;
+          height: 60px;
+          display: flex;
+          align-items: center;
+          padding: 0 20%;
+          justify-content: space-evenly;
+        }
+      }
+    }
+  }
+}
+</style>

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

@@ -53,6 +53,9 @@ const setIndex = (index: number) => {
     case "baogong":
       reportWorkRef.value?.openReportWorkDrawer();
       break;
+    case "jianyan":
+      router.push({ name: "inspect" });
+      break;
     default:
       break;
   }
@@ -83,6 +86,10 @@ const stepComponents = ref([
     compentName: "报工",
     compentType: "baogong",
   },
+  {
+    compentName: "检验",
+    compentType: "jianyan",
+  },
 ]);
 </script>
 

+ 8 - 1
src/views/traceability/components/traceability.vue

@@ -14,7 +14,13 @@
       </div>
     </template>
   </el-table>
-  <Pagination position="right" :page="page" :limit="limit" :total="total" @pagination="getPagination" />
+  <Pagination
+    position="right"
+    :page="page"
+    :limit="limit"
+    :total="total"
+    @pagination="getPagination"
+  />
 </template>
 
 <script lang="ts" setup>
@@ -36,6 +42,7 @@ const getPagination = async () => {
     pageNo: page.value,
     pageSize: limit.value,
     seqNo: store.useSeqNo,
+    workOrderCode: store.odersData.workOrderCode,
   });
   total.value = data.totalCount;
   tableData.value = data.records;

+ 44 - 11
src/views/traceability/index.vue

@@ -3,7 +3,12 @@
     <!-- 基础信息展示 -->
     <div class="contentBody">
       <div class="headerInfo">
-        <el-descriptions :column="3" border class="descriptions" label-class-name="labelStyle">
+        <el-descriptions
+          :column="3"
+          border
+          class="descriptions"
+          label-class-name="labelStyle"
+        >
           <el-descriptions-item>
             <template #label>
               <div class="cell-item">
@@ -97,17 +102,27 @@
         </el-descriptions>
       </div>
       <div id="tabBox" class="tabBox">
-        <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
+        <el-tabs
+          v-model="activeName"
+          class="demo-tabs"
+          @tab-click="handleClick"
+        >
           <el-tab-pane name="f1">
             <template #label>
-              <el-badge :type="activeName == 'f1' ? 'warning' : 'primary'" :value="tabCountData.traceability">生产履历
+              <el-badge
+                :type="activeName == 'f1' ? 'warning' : 'primary'"
+                :value="tabCountData.traceability"
+                >生产履历
               </el-badge>
             </template>
             <Traceability />
           </el-tab-pane>
           <el-tab-pane name="f2">
             <template #label>
-              <el-badge :type="activeName == 'f2' ? 'warning' : 'primary'" :value="tabCountData.materials">已采物料
+              <el-badge
+                :type="activeName == 'f2' ? 'warning' : 'primary'"
+                :value="tabCountData.materials"
+                >已采物料
               </el-badge>
             </template>
             <keep-alive>
@@ -116,7 +131,10 @@
           </el-tab-pane>
           <el-tab-pane name="f3">
             <template #label>
-              <el-badge :type="activeName == 'f3' ? 'warning' : 'primary'" :value="tabCountData.record">记录项
+              <el-badge
+                :type="activeName == 'f3' ? 'warning' : 'primary'"
+                :value="tabCountData.record"
+                >记录项
               </el-badge>
             </template>
             <keep-alive>
@@ -127,7 +145,10 @@
           </el-tab-pane>
           <el-tab-pane name="f4">
             <template #label>
-              <el-badge :type="activeName == 'f4' ? 'warning' : 'primary'" :value="tabCountData.checks">点检判定
+              <el-badge
+                :type="activeName == 'f4' ? 'warning' : 'primary'"
+                :value="tabCountData.checks"
+                >点检判定
               </el-badge>
             </template>
             <keep-alive>
@@ -138,7 +159,10 @@
           </el-tab-pane>
           <el-tab-pane name="f5">
             <template #label>
-              <el-badge :type="activeName == 'f5' ? 'warning' : 'danger'" :value="tabCountData.equit">设备使用
+              <el-badge
+                :type="activeName == 'f5' ? 'warning' : 'danger'"
+                :value="tabCountData.equit"
+                >设备使用
               </el-badge>
             </template>
             <keep-alive>
@@ -149,7 +173,10 @@
           </el-tab-pane>
           <el-tab-pane name="f6">
             <template #label>
-              <el-badge :type="activeName == 'f6' ? 'warning' : 'danger'" :value="tabCountData.fault">报故记录
+              <el-badge
+                :type="activeName == 'f6' ? 'warning' : 'danger'"
+                :value="tabCountData.fault"
+                >报故记录
               </el-badge>
             </template>
             <keep-alive>
@@ -160,7 +187,10 @@
           </el-tab-pane>
           <el-tab-pane name="f7">
             <template #label>
-              <el-badge :type="activeName == 'f7' ? 'warning' : 'danger'" :value="tabCountData.medias">图片采集
+              <el-badge
+                :type="activeName == 'f7' ? 'warning' : 'danger'"
+                :value="tabCountData.medias"
+                >图片采集
               </el-badge>
             </template>
             <keep-alive>
@@ -191,17 +221,20 @@ const Media = defineAsyncComponent(() => import("./components/media.vue"));
 const store = useProcessStore();
 const router = useRouter();
 const activeName = ref("f1");
-const handleClick = () => { };
+const handleClick = () => {};
 const infoData = ref({});
 const tabCountData = ref({});
 //获取卡号基础信息
 const getInfo = async (seq) => {
-  const { data } = await getTraceabilityInfo(seq);
+  const { data } = await getTraceabilityInfo(
+    store.odersData.workOrderCode + "/" + seq
+  );
   infoData.value = data;
 };
 const getTabCountData = async (seq) => {
   const { data } = await getTabCount({
     seqNo: seq,
+    workOrderCode: store.odersData.workOrderCode,
   });
   tabCountData.value = data;
 };