Browse Source

刷新实现

dengrui 1 tuần trước cách đây
mục cha
commit
1f7b1db24e

+ 1 - 1
.env.development

@@ -11,7 +11,7 @@ VITE_APP_BASE_API = '/dev-api'
 VITE_APP_UPLOAD_URL = 'http://192.168.1.4:9000'
 
 # 开发接口地址
-VITE_APP_API_URL = 'http://113.44.0.55:9999'
+VITE_APP_API_URL = 'http://113.44.0.55:8021'
 # Websocket地址
 VITE_WEBSOCKET_URL = 'ws://192.168.101.178:8079'
 ``

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 0
src/assets/icons/toRefresh.svg


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

@@ -9,10 +9,19 @@
       >
         <div
           :class="
-            item.exists == true ? selectStepIndex == index ? 'stepBox stepBoxHover' :
-            (item.opComplete == true ? 'stepBox stepCompleteHover' : item.bugExists == true ? 'stepBox stepBugHover' : 'stepBox') : (item.opComplete == true ?
-            'stepBox stepExistsCompleteHover' :
-            item.bugExists == true ? 'stepBox stepExistsBugHover' : 'stepBox stepExistsHover')
+            item.exists == true
+              ? selectStepIndex == index
+                ? 'stepBox stepBoxHover'
+                : item.opComplete == true
+                  ? 'stepBox stepCompleteHover'
+                  : item.bugExists == true
+                    ? 'stepBox stepBugHover'
+                    : 'stepBox'
+              : item.opComplete == true
+                ? 'stepBox stepExistsCompleteHover'
+                : item.bugExists == true
+                  ? 'stepBox stepExistsBugHover'
+                  : 'stepBox stepExistsHover'
           "
         >
           <div style="display: flex; align-items: center">
@@ -129,6 +138,7 @@ emitter.on(EventsNames.PROCESS_REDER, () => {
 //     }
 //   }
 // };
+const OpKey = inject("OpKey");
 const boxClick = (item, index) => {
   if (item.exists != true) return;
   selectSeqArray.value =
@@ -140,6 +150,21 @@ const boxClick = (item, index) => {
   emitFnc();
   // centerDialogVisible.value = true;
 };
+const refresh = () => {
+  const opIndex = JSON.parse(JSON.stringify(selectStepIndex.value));
+
+  setTimeout(() => {
+    if (opIndex == null) {
+      return;
+    } else {
+      boxClick(props.opsArray[opIndex], opIndex);
+      setTimeout(() => {
+        selectStepIndex.value = opIndex;
+      }, 2);
+    }
+  }, 0);
+};
+defineExpose({ refresh });
 const getScanData = async () => {
   try {
     const { code, data, msg } = await getScan({
@@ -172,6 +197,9 @@ watch(
     } else {
       selectStepIndex.value = null;
     }
+  },
+  {
+    deep: true,
   }
 );
 watch(

+ 22 - 2
src/views/process/components/transferNum.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="commonTitle">流转卡号</div>
-  <div class="body">
+  <div class="body" :key="SeqKey">
     <el-scrollbar class="scrollbar">
       <div
         v-if="selectSeqArray.length < 1"
@@ -42,7 +42,13 @@
             <div
               style="display: flex; flex-direction: column; align-items: end"
             >
-              <div :class="item.state == '0' || item.state == '2' ? 'status success' : 'status'">
+              <div
+                :class="
+                  item.state == '0' || item.state == '2'
+                    ? 'status success'
+                    : 'status'
+                "
+              >
                 {{
                   dictS.getLableByValue(
                     "station_task_state",
@@ -71,11 +77,13 @@
 import { useDictionaryStore, useProcessStore } from "@/store";
 import { Transition } from "vue";
 import { getPull } from "@/api/process";
+import { set } from "nprogress";
 const refArray = ref([]);
 const store = useProcessStore();
 const dictS = useDictionaryStore();
 const selectSeqIndex = inject("selectSeqIndex");
 const selectSeqArray = inject("selectSeqArray");
+const SeqKey = inject("SeqKey");
 const pull = async (seq: string) => {
   const { data, code } = await getPull({ seqNo: seq });
   if (code == "200") {
@@ -128,6 +136,18 @@ const clickCardNum = (index: number) => {
   selectSeqIndex.value = index;
   store.useSeqNo = selectSeqArray.value[selectSeqIndex.value].seqNo;
 };
+const refresh = () => {
+  const seqIndex = JSON.parse(JSON.stringify(selectSeqIndex.value));
+  setTimeout(() => {
+    if (seqIndex != null) {
+      SeqKey.value = !SeqKey.value;
+      clickCardNum(seqIndex);
+    }
+  }, 1);
+};
+defineExpose({
+  refresh,
+});
 watch(
   () => selectSeqArray.value,
   () => {

+ 8 - 1
src/views/process/currentProduction.vue

@@ -1,6 +1,6 @@
 <template>
   <el-col :span="6" class="elColClasss">
-    <TransferNum />
+    <TransferNum ref="transferNumRef" />
   </el-col>
   <el-col :span="6" class="elColClasss">
     <Operate />
@@ -9,6 +9,13 @@
 <script lang="ts" setup>
 import TransferNum from "@/views/process/components/transferNum.vue";
 import Operate from "@/views/process/components/operate.vue";
+const transferNumRef = ref(null);
+const refresh = () => {
+  if (transferNumRef.value) {
+    transferNumRef.value.refresh();
+  }
+};
+defineExpose({ refresh });
 </script>
 
 <style lang="scss" scoped>

+ 15 - 3
src/views/process/main.vue

@@ -2,14 +2,14 @@
   <div class="mainContentBox">
     <el-row :gutter="20">
       <el-col :span="6" class="elColClasss">
-        <Orders @getindex="setSelectOrderIndex" />
+        <Orders @getindex="setSelectOrderIndex" @refresh="refresh" />
       </el-col>
       <el-col :span="6" class="elColClasss">
         <div class="grid-content ep-bg-purple">
-          <Processes />
+          <Processes ref="processesRef" />
         </div>
       </el-col>
-      <CurrentProduction />
+      <CurrentProduction ref="currentProductionRef" />
     </el-row>
     <Transition>
       <CheckPop v-model="checkPop" />
@@ -25,6 +25,18 @@ import CheckPop from "./popUpView/checkPop.vue";
 import { ElLoading } from "element-plus";
 defineOptions({ name: "ProcessMain" });
 const checkPop = ref(false);
+const processesRef = ref(null);
+const currentProductionRef = ref(null);
+const refresh = () => {
+  processesRef.value.refresh();
+  currentProductionRef.value.refresh();
+};
+
+//刷新重置组件
+const OpKey = ref(false);
+provide("OpKey", OpKey);
+const SeqKey = ref(false);
+provide("SeqKey", SeqKey);
 //未完成订单数组
 const ordersDataArray = ref([]);
 //未完成任务总数

+ 51 - 3
src/views/process/orders.vue

@@ -1,7 +1,17 @@
 <template>
   <div>
-    <div class="commonTitle">
-      {{ activeName == "ok" ? "已完成工单" : "待完成工单" }}[{{ ordersSum }}]
+    <div
+      style="display: flex; justify-content: space-between; align-items: center"
+    >
+      <div class="commonTitle">
+        {{ activeName == "ok" ? "已完成工单" : "待完成工单" }}[{{ ordersSum }}]
+      </div>
+      <svg-icon
+        icon-class="toRefresh"
+        size="47"
+        style="margin-bottom: 10px"
+        @click="toRefresh"
+      />
     </div>
 
     <el-tabs
@@ -53,7 +63,7 @@ const selectedOderStatus = inject("selectedOderStatus");
 const ordersSum = ref(0);
 const commonS = useCommonStoreHook();
 const map = commonS.loadingMap;
-const emit = defineEmits(["getindex"]);
+const emit = defineEmits(["getindex", "refresh"]);
 const ordersDataArray = inject("ordersDataArray");
 const selectSeqArray = inject("selectSeqArray");
 //获取未完成订单的参数
@@ -64,6 +74,44 @@ const ordersQuery = ref({
   totalPages: 1,
 });
 const wrapRef = ref(null);
+const OpKey = inject("OpKey");
+const SeqKey = inject("SeqKey");
+
+const toRefresh = async () => {
+  const { code, data } = await getOrders({
+    pageNo: 1,
+    pageSize: ordersQuery.value.pageSize * 5,
+    queryComplete: ordersQuery.value.queryComplete,
+  });
+  if (code == "200") {
+    ordersDataArray.value = [];
+    ordersDataArray.value.push(...data.records);
+    ordersSum.value = data.totalCount;
+    ordersQuery.value.totalPages = data.totalPages;
+
+    // 记录工序、流转卡号数据
+    emit("refresh");
+
+    //点击工单数据重置
+    if (selectIndex.value != null) {
+      store.odersData.productLineId =
+        ordersDataArray.value[selectIndex.value].productLineId;
+      store.odersData.workOrderCode =
+        ordersDataArray.value[selectIndex.value].workOrderCode;
+      store.processInfo.materialName =
+        ordersDataArray.value[selectIndex.value].materialName;
+      store.processInfo.materialModel =
+        ordersDataArray.value[selectIndex.value].materialModel;
+      store.odersData.operationId = "";
+      store.processInfo.operationCode = "";
+      store.processInfo.operationName = "";
+      store.useSeqNo = "";
+      selectSeqArray.value = [];
+      selectSeqIndex.value = null;
+      emit("getindex", selectIndex.value);
+    }
+  }
+};
 //获取未完成订单Data
 const getOrdersData = async () => {
   const { code, data } = await getOrders(ordersQuery.value);

+ 17 - 1
src/views/process/processes.vue

@@ -4,7 +4,12 @@
     <div class="titleText notice" v-if="!selectedOderStatus">请选择订单</div>
 
     <Transition>
-      <Steps v-if="selectedOderStatus" :opsArray="opsArray" />
+      <Steps
+        :key="OpKey"
+        v-if="selectedOderStatus"
+        :opsArray="opsArray"
+        ref="stepsRef"
+      />
     </Transition>
 
     <Empty v-if="selectedOderStatus && opsArray.length < 1" />
@@ -12,7 +17,15 @@
 </template>
 <script lang="ts" setup>
 import Steps from "@/views/process/components/steps.vue";
+import { de } from "element-plus/es/locale";
+const OpKey = inject("OpKey");
 const selectedOderStatus = inject("selectedOderStatus");
+const stepsRef = ref(null);
+const refresh = () => {
+  if (stepsRef.value) {
+    stepsRef.value.refresh();
+  }
+};
 //总的订单data
 const ordersDataArray = inject("ordersDataArray");
 //当前选择的订单index
@@ -27,6 +40,9 @@ const opsArray = inject("opsArray");
 //   }
 // };
 const OptArrayLength = computed(() => opsArray.value.length);
+defineExpose({
+  refresh,
+});
 </script>
 
 <style lang="scss" scoped>