Parcourir la source

任务接收页面改造

cz il y a 1 an
Parent
commit
b8da7528d4
2 fichiers modifiés avec 188 ajouts et 25 suppressions
  1. 66 25
      src/views/JXSK/mes/receive/index.vue
  2. 122 0
      src/views/JXSK/mes/receive/indexaa.vue

+ 66 - 25
src/views/JXSK/mes/receive/index.vue

@@ -1,39 +1,49 @@
 <template>
-  <van-nav-bar
-    :title="$t('receive.name')"
-    left-text=""
-    left-arrow
-    @click-left="onClickLeft"
-  >
+  <van-nav-bar :title="$t('receive.name')" left-text="" left-arrow @click-left="onClickLeft">
     <!-- <template #right> 添加 </template> -->
   </van-nav-bar>
-  <van-search
-    v-model="req.keyword"
-    :placeholder="$t('common.pleaseEnterKeywords')"
-    @search="onRefresh"
-  />
+  <van-search v-model="req.keyword" :placeholder="$t('common.pleaseEnterKeywords')" @search="onRefresh" />
 
   <van-pull-refresh v-model="loading" @refresh="onRefresh">
     <div class="list">
-      <van-list
-        v-model:loading="loading"
-        :finished="finished"
-        :finished-text="$t('common.noMore')"
-        @load="onLoad"
-        style="margin-bottom: 60px"
-      >
-        <commonList
-          :data="listData"
-          :config="listConfig"
-          :showMore="true"
-          @onClick="toDtl"
-        ></commonList>
+      <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" @load="onLoad" style="margin-bottom: 60px">
+        <!-- <commonList :data="listData" :config="listConfig" :showMore="true" @onClick="toDtl"></commonList> -->
+        <div style="padding:0 25px;padding-top:25px">
+          <div v-for="item in listData" @click="toDtl(item)" :key="item.in " class="item">
+            <div class="left">
+              <div class="row">
+                <span class="label">产品名称:</span> <span>{{item.productName}}</span>
+              </div>
+              <div class="row">
+                <span class="label"> 规格型号:</span> <span>{{item.productSpec}}</span>
+              </div>
+              <div class="row">
+                <span class="label">产品Sn:</span> <span>{{item.productSn}}</span>
+              </div>
+              <div class="row">
+                <span class="label">当前工序:</span> <span>{{item.productionProcessesName}}</span>
+              </div>
+              <div class="row">
+                <span class="label">前道工序:</span> <span>{{item.previousProcessesName}}</span>
+              </div>
+            </div>
+            <div class="more-box" @click="toDtl(item)">
+              <van-icon name="arrow" />
+            </div>
+          </div>
+        </div>
       </van-list>
     </div>
   </van-pull-refresh>
 </template>
 <script setup>
-import { ref, getCurrentInstance, onMounted } from "vue";
+import {
+  ref,
+  getCurrentInstance,
+  onMounted,
+  onBeforeUnmount,
+  onUnmounted,
+} from "vue";
 import commonList from "@/components/common-list.vue";
 import { useRoute } from "vue-router";
 const loading = ref(false);
@@ -113,10 +123,41 @@ const getList = (type) => {
 };
 
 getList();
+const timer = ref(null);
+timer.value = setInterval(() => {
+  getList();
+}, 1000 * 30);
+
+onBeforeUnmount(() => {
+  clearInterval(timer.value);
+  timer.value = null;
+});
 </script>
 
 <style lang="scss" scoped>
 .list {
   min-height: 70vh;
 }
+.item {
+  border-radius: 5px;
+  background-color: rgba(21, 73, 121, 1);
+  display: flex;
+  margin-bottom: 25px;
+  color: #fff;
+  padding: 15px 10px;
+  align-items: center;
+  .more-box {
+    width: 10px;
+  }
+  .left {
+    flex: 1;
+  }
+  .row {
+    display: flex;
+    .label {
+      min-width: 100px;
+      text-align: left;
+    }
+  }
+}
 </style>

+ 122 - 0
src/views/JXSK/mes/receive/indexaa.vue

@@ -0,0 +1,122 @@
+<template>
+  <van-nav-bar
+    :title="$t('receive.name')"
+    left-text=""
+    left-arrow
+    @click-left="onClickLeft"
+  >
+    <!-- <template #right> 添加 </template> -->
+  </van-nav-bar>
+  <van-search
+    v-model="req.keyword"
+    :placeholder="$t('common.pleaseEnterKeywords')"
+    @search="onRefresh"
+  />
+
+  <van-pull-refresh v-model="loading" @refresh="onRefresh">
+    <div class="list">
+      <van-list
+        v-model:loading="loading"
+        :finished="finished"
+        :finished-text="$t('common.noMore')"
+        @load="onLoad"
+        style="margin-bottom: 60px"
+      >
+        <commonList
+          :data="listData"
+          :config="listConfig"
+          :showMore="true"
+          @onClick="toDtl"
+        ></commonList>
+      </van-list>
+    </div>
+  </van-pull-refresh>
+</template>
+<script setup>
+import { ref, getCurrentInstance, onMounted } from "vue";
+import commonList from "@/components/common-list.vue";
+import { useRoute } from "vue-router";
+const loading = ref(false);
+const router = useRoute();
+const req = ref({
+  pageNum: 1,
+  keyword: null,
+});
+const finished = ref(false);
+const proxy = getCurrentInstance().proxy;
+const listData = ref([]);
+
+const listConfig = ref([
+  {
+    label: proxy.t("receive.productName"),
+    prop: "productName",
+  },
+  {
+    label: "规格型号",
+    prop: "productSpec",
+  },
+  {
+    label: proxy.t("receive.productSN"),
+    prop: "productSn",
+  },
+  {
+    label: "当前工序",
+    prop: "productionProcessesName",
+  },
+  {
+    label: proxy.t("receive.previousProcess"),
+    prop: "previousProcessesName",
+  },
+]);
+const onRefresh = () => {
+  req.value.pageNum = 1;
+  finished.value = false;
+  getList("refresh");
+};
+const onLoad = () => {
+  getList();
+};
+
+const onClickLeft = () => proxy.$router.push("/main/working");
+
+// const onClickRight = () => {
+//   proxy.$router.push("/main/jxskTaskAdd");
+// };
+
+const toDtl = (row) => {
+  proxy.$router.push({
+    path: "jxskReceiveAdd",
+    query: {
+      ...row,
+    },
+  });
+};
+
+const getList = (type) => {
+  loading.value = true;
+  proxy
+    .post("/productionTaskDetail/receivePage", req.value)
+    .then((res) => {
+      listData.value =
+        type === "refresh"
+          ? res.data.rows
+          : listData.value.concat(res.data.rows);
+      if (req.value.pageNum * 10 >= res.data.total) {
+        finished.value = true;
+      }
+      req.value.pageNum++;
+      loading.value = false;
+    })
+    .catch((err) => {
+      loading.value = false;
+    });
+};
+
+getList();
+</script>
+
+<style lang="scss" scoped>
+.list {
+  min-height: 70vh;
+}
+</style>