Prechádzať zdrojové kódy

feature/流程叫料 首页工单分页实现

dy 1 rok pred
rodič
commit
49a4551211

+ 1 - 1
.env.development

@@ -13,7 +13,7 @@ VITE_APP_UPLOAD_URL = 'http://192.168.101.4:9000'
 # 线上接口地址
 # VITE_APP_API_URL = http://vapi.youlai.tech
 # 开发接口地址
-VITE_APP_API_URL = 'http://192.168.101.188:8079'
+VITE_APP_API_URL = 'http://192.168.101.4:8079'
 # Websocket地址
 VITE_WEBSOCKET_URL = 'ws://192.168.101.4:8079'
 ``

+ 2 - 22
src/components/ScanCodeInput/index.vue

@@ -9,26 +9,7 @@
   </el-input>
 </template>
 
-<script lang="ts" setup>
-// const props = defineProps({
-//   modelValue: {
-//     type: String,
-//     default: "",
-//   },
-// });
-// const emits = defineEmits(["update:modelValue", "enterfnc"]);
-// const enter = () => {
-//   emits("enterfnc");
-// };
-// const value = computed({
-//   get() {
-//     return props.modelValue;
-//   },
-//   set(val) {
-//     emits("update:modelValue", val);
-//   },
-// });
-</script>
+<script lang="ts" setup></script>
 
 <style lang="scss" scoped>
 .scanInput {
@@ -40,8 +21,7 @@
   color: #00000080;
 
   :deep(.el-input__wrapper) {
-    box-shadow: 0 0 0 0px var(--el-input-border-color, var(--el-border-color))
-      inset;
+    box-shadow: 0 0 0 0px var(--el-input-border-color, var(--el-border-color)) inset;
     cursor: default;
 
     .el-input__inner {

+ 9 - 5
src/views/pro-steps/components/ESOP.vue

@@ -1,11 +1,16 @@
 <template>
   <div class="espoViewStyle">
     <div class="header">
-      <div class="imgView">
+      <!-- <div class="imgView">
         <el-image class="img" :src="getImgurl(srcList[selectImgIndex]?.imgUrl)" :initial-index="selectImgIndex"
           :preview-src-list="showSrcList" fit="cover" />
+      </div> -->
+      <div class="imgView">
+        <el-scrollbar>
+          <PDFView :need-to-show-pdf="true" :show-pdf-number="3" :is-link="true"
+            pdf-source="http://192.168.101.4:9000/jgfile/2024/04/20/%E7%AC%AC08%E7%AB%A0_%E8%81%9A%E5%90%88%E5%87%BD%E6%95%B0.pdf" />
+        </el-scrollbar>
       </div>
-      <PDFView :need-to-show-pdf="true" :pdf-source="baseUrl + box.drawingPath" />
       <div class="textBox">
         <el-scrollbar :max-height="scrollbarHeight">
           <div class="title">{{ srcList[selectImgIndex]?.title }}</div>
@@ -64,8 +69,7 @@ const setShowSrcList = () => {
 };
 const getImgListData = async () => {
   const { data } = await getImgList({
-    // operationId: store.odersData.operationId,
-    operationId: "241",
+    operationId: store.odersData.operationId,
     pageNo: 1,
     pageSize: 999,
   });
@@ -93,7 +97,7 @@ onMounted(async () => {
 
   .imgView {
     flex: 1;
-    height: calc(100vh - 294px);
+    height: calc(100vh - 318px);
     @include flex;
     justify-content: center;
 

+ 2 - 4
src/views/process/components/steps.vue

@@ -67,6 +67,7 @@ const props = defineProps<{
   opsArray?: object;
 }>();
 //步骤显示index
+const router = useRouter();
 const selectStepIndex = ref(null);
 const scanStatus = inject("scanStatus");
 const centerDialogVisible = ref(false);
@@ -76,10 +77,7 @@ const emitFnc = () => {
     lastStatus:
       selectStepIndex.value == null || selectStepIndex.value == 0
         ? false
-        : props.opsArray[selectStepIndex.value - 1].opComplete == false &&
-          props.opsArray[selectStepIndex.value - 1].exists == true
-          ? true
-          : false,
+        : true,
   });
 };
 emitter.on(EventsNames.PROCESS_STEPINDEX, (val: any) => {

+ 1 - 24
src/views/process/main.vue

@@ -2,7 +2,7 @@
   <div class="mainContentBox">
     <el-row :gutter="20">
       <el-col :span="6" class="elColClasss">
-        <Orders :ordersSum="ordersSum" @getindex="setSelectOrderIndex" />
+        <Orders @getindex="setSelectOrderIndex" />
       </el-col>
       <el-col :span="6" class="elColClasss">
         <div class="grid-content ep-bg-purple">
@@ -15,11 +15,9 @@
 </template>
 
 <script lang="ts" setup>
-import { onMounted, provide, ref } from "vue";
 import Orders from "@/views/process/orders.vue";
 import Processes from "@/views/process/processes.vue";
 import CurrentProduction from "@/views/process/currentProduction.vue";
-import { getOrders } from "@/api/process";
 
 defineOptions({ name: "ProcessMain" });
 //未完成订单数组
@@ -47,27 +45,6 @@ provide("selectOrderIndex", selectOrderIndex);
 provide("selectSeqArray", selectSeqArray);
 provide("scanStatus", scanStatus);
 provide("opsArray", opsArray);
-//获取未完成订单的参数
-const ordersQuery = ref({
-  orders: [],
-  pageNo: 1,
-  pageSize: 9999,
-});
-
-//获取未完成订单Data
-const getOrdersData = async () => {
-  const { code, data } = await getOrders(ordersQuery.value);
-  if (code == "200") {
-    ordersDataArray.value = data.records;
-    ordersDataArray.value.forEach((element, index) => {
-      element.index = index;
-    });
-    ordersSum.value = data.totalCount;
-  }
-};
-onMounted(() => {
-  getOrdersData();
-});
 </script>
 
 <style lang="scss" scoped>

+ 66 - 22
src/views/process/orders.vue

@@ -1,14 +1,19 @@
 <template>
   <div>
-    <div class="commonTitle">待完成工单[{{ ordersSum }}]</div>
+    <div class="commonTitle">
+      {{ activeName == "ok" ? "已完成工单" : "待完成工单" }}[{{ ordersSum }}]
+    </div>
     <el-tabs v-model="activeName" class="demo-tabs" type="card" @tab-click="handleClick">
       <el-tab-pane label="未完成" name="false" />
       <el-tab-pane label="已完成" name="ok" />
     </el-tabs>
-    <el-scrollbar class="barHeight">
-      <Order v-for="(item, index) in selectOrder" :key="index" @click="setSlectIndex(item)"
-        :hoverStatus="item.index == selectIndex ? true : false" :item="item" />
-      <Empty v-if="selectOrder.length < 1" />
+    <el-scrollbar class="barHeight" ref="wrapRef" @scroll="handleScroll">
+      <Order v-for="(item, index) in ordersDataArray" :key="index" @click="setSlectIndex(index)"
+        :hoverStatus="index == selectIndex ? true : false" :item="item" />
+      <Empty v-if="ordersDataArray.length < 1" />
+      <div class="describeText notice" v-if="ordersQuery.pageNo == ordersQuery.totalPages">
+        已经到底啦~
+      </div>
     </el-scrollbar>
     <Empty v-if="ordersDataArray.length < 1" />
   </div>
@@ -17,32 +22,40 @@
 import Order from "@/views/process/components/order.vue";
 import { useProcessStore } from "@/store";
 import { useDictionaryStore } from "@/store";
+import { getOrders } from "@/api/process";
 const dictS = useDictionaryStore();
 const store = useProcessStore();
 const selectSeqIndex = inject("selectSeqIndex");
-const props = defineProps<{
-  ordersSum?: number;
-}>();
+const ordersSum = ref(0);
 const emit = defineEmits(["getindex"]);
 const ordersDataArray = inject("ordersDataArray");
-const selectOrder = computed(() => {
-  let array = [];
-  if (activeName.value == "ok") {
-    array = ordersDataArray.value.filter((item) => item.workOrderState == "6");
-  } else {
-    array = ordersDataArray.value.filter((item) => item.workOrderState != "6");
-  }
-  return array;
+//获取未完成订单的参数
+const ordersQuery = ref({
+  orders: [],
+  pageNo: 1,
+  pageSize: 5,
+  queryComplete: 0,
+  totalPages: 1,
 });
+const wrapRef = ref(null);
+//获取未完成订单Data
+const getOrdersData = async () => {
+  const { code, data } = await getOrders(ordersQuery.value);
+  if (code == "200") {
+    ordersDataArray.value.push(...data.records);
+    ordersSum.value = data.totalCount;
+    ordersQuery.value.totalPages = data.totalPages;
+  }
+};
 const activeName = ref("false");
 //这里是存放控制当前选择工序的index
 const selectIndex = ref(null);
-const setSlectIndex = (item: object) => {
-  if (item == null) {
+const setSlectIndex = (index: number) => {
+  if (index == null) {
     selectIndex.value = null;
     return;
   }
-  selectIndex.value = item.index;
+  selectIndex.value = index;
   store.odersData.productLineId =
     ordersDataArray.value[selectIndex.value].productLineId;
   store.odersData.workOrderCode =
@@ -65,14 +78,45 @@ const handleClick = (tab: TabsPaneContext, event: Event) => {
   store.processInfo.materialName = "";
   store.processInfo.materialModel = "";
 };
-// watch(ordersDataArray, () => {
-//   if (ordersDataArray.value.length > 0) setSlectIndex(0);
-// });
+//滚动事件
+const handleScroll = (obj: obj) => {
+  //当发生滚动触底时
+  if (
+    wrapRef.value.wrapRef.scrollHeight ==
+    Math.ceil(obj.scrollTop) + wrapRef.value.wrapRef.clientHeight
+  ) {
+    if (ordersQuery.value.pageNo < ordersQuery.value.totalPages) {
+      ordersQuery.value.pageNo = ordersQuery.value.pageNo + 1;
+      getOrdersData();
+    }
+  }
+};
+watch(
+  () => activeName.value,
+  (val) => {
+    if (val == "ok") {
+      ordersQuery.value.queryComplete = 1;
+      ordersQuery.value.pageNo = 1;
+    } else {
+      ordersQuery.value.queryComplete = 0;
+      ordersQuery.value.pageNo = 1;
+    }
+    ordersDataArray.value = [];
+    getOrdersData();
+  }
+);
+onMounted(() => {
+  getOrdersData();
+});
 </script>
 
 <style lang="scss" scoped>
 .barHeight {
   height: calc(100vh - 265px);
+
+  .notice {
+    text-align: center;
+  }
 }
 
 :deep(.el-tabs--card > .el-tabs__header .el-tabs__nav) {

+ 1 - 21
src/views/process/popUpView/operatePop.vue

@@ -37,13 +37,8 @@ const store = useProcessStore();
 const router = useRouter();
 const lcRes = ref(false);
 const time = ref(10);
-const props = defineProps({
-  modelValue: {
-    type: Boolean,
-    default: false,
-  },
-});
 const emits = defineEmits(["update:modelValue"]);
+const modelValue = defineModel<boolean>();
 const gxDisabled = ref(true);
 const lcDisabled = ref(true);
 const callBoxStatus = ref(false);
@@ -80,7 +75,6 @@ const lastOpCall = () => {
 };
 //监听工序index等
 emitter.on(EventsNames.PROCESS_STEPOBJ, (data: any) => {
-  console.log(data);
   if (data.index == null || scanStatus.value == false) {
     lcDisabled.value = true;
     gxDisabled.value = true;
@@ -93,20 +87,6 @@ emitter.on(EventsNames.PROCESS_STEPOBJ, (data: any) => {
     gxDisabled.value = false;
   }
 });
-watch(
-  () => props.modelValue,
-  (val) => {
-    if (val == true) {
-      // if (lcDisabled.value == false) {
-      //   if (store.useSeqNo == "") {
-      //     lcDisabled.value = true;
-      //   } else {
-      //     lcDisabled.value = false;
-      //   }
-      // }
-    }
-  }
-);
 </script>
 
 <style lang="scss" scoped>