Browse Source

新增 通用文件上传

王智慧 3 năm trước cách đây
mục cha
commit
44e0d65c69
3 tập tin đã thay đổi với 211 bổ sung1 xóa
  1. 5 1
      src/components/Aside.vue
  2. 9 0
      src/router/index.js
  3. 197 0
      src/views/toolManage/uploadFileManage.vue

+ 5 - 1
src/components/Aside.vue

@@ -114,12 +114,16 @@ export default {
       },
       {
         icon: "Document",
-        title: "版本/入口",
+        title: "项目管理",
         items: [
           {
             path: "/toolManage/versions",
             name: "版本日志",
           },
+          {
+            path: "/toolManage/uploadFileManage",
+            name: "通用文件上传",
+          },
           {
             path: "/urls",
             name: "项目集成",

+ 9 - 0
src/router/index.js

@@ -172,6 +172,15 @@ const router = createRouter({
       },
       component: () => import("../views/toolManage/versions.vue"),
     },
+    {
+      path: "/toolManage/uploadFileManage",
+      name: "uploadFileManage",
+      meta: {
+        title: "通用文件上传",
+      },
+      component: () => import("../views/toolManage/uploadFileManage.vue"),
+    },
+
     {
       path: "/urls",
       name: "urls",

+ 197 - 0
src/views/toolManage/uploadFileManage.vue

@@ -0,0 +1,197 @@
+<template>
+  <div class="full-container-p24">
+    <div style="display: flex; justify-content: space-between">
+      <div style="display: flex">
+        <el-input
+          placeholder="货主名称/船名/MMSI"
+          prefix-icon="el-icon-search"
+          v-model="term"
+          clearable
+          style="height: 32px; width: 330px; line-height: 32px"
+        ></el-input>
+        <div class="seach-btn" @click="getBlockChainList(1)">查询</div>
+      </div>
+    </div>
+    <div style="margin-top: 24px">
+      <el-table :data="tableData" stripe style="width: 100%">
+        <el-table-column
+          type="index"
+          label="序号"
+          min-width="80"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="voyageName"
+          label="航次名称"
+          min-width="160"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="shipName"
+          label="船名"
+          min-width="160"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="shipMmsi"
+          label="MMSI"
+          min-width="120"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="loadPort"
+          label="装货港"
+          min-width="160"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="dischargeProt"
+          label="卸货港"
+          min-width="120"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="loadTons"
+          label="载货吨位(吨)"
+          min-width="160"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="onChainTime"
+          label="上链时间"
+          min-width="200"
+          align="center"
+        ></el-table-column>
+        <el-table-column label="操作" min-width="80" align="center">
+          <template v-slot="scope">
+            <span v-if="scope.row.hash">已上链</span>
+            <el-button
+              v-else
+              @click="upBlockChain(scope.row.voyageId, scope.$index)"
+              type="primary"
+              size="small"
+              :loading="upLoading && currentIndex == scope.$index"
+            >
+              上链
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div style="width: 100%; text-align: right; margin-top: 43px">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          :current-page="currentPage"
+          :total="total"
+          @current-change="pageChange"
+        ></el-pagination>
+      </div>
+    </div>
+  </div>
+</template>
+<script setup>
+import { ref, h, reactive, toRefs, onMounted } from "vue";
+import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
+import store from "../../store";
+import router from "../../router";
+import md5 from "md5";
+import api from "../../apis/fetch";
+
+let currentPage = ref(1);
+let term = ref("");
+let tableData = ref([]);
+let total = ref(0);
+async function getBlockChainList(page) {
+  currentPage.value = page || currentPage.value;
+  let res = await api.getBlockChainList({
+    currentPage: currentPage.value,
+    size: 10,
+    term: term.value,
+  });
+  if (res.data.status == 0) {
+    tableData.value = res.data.result;
+    total.value = res.data.total;
+  } else {
+    tableData.value = [];
+    total.value = 0;
+  }
+}
+
+let upLoading = ref(false);
+let currentIndex = ref(-1);
+
+async function upBlockChain(voyageId, index) {
+  upLoading.value = true;
+  currentIndex.value = index;
+  let res = await api.upBlockChain({
+    voyageId,
+  });
+  if (res.data.status == 0) {
+    ElNotification.success({
+      title: "成功",
+      duration: 2000,
+      message: res.data.msg,
+    });
+    getBlockChainList();
+  } else {
+    ElNotification.error({
+      title: "失败",
+      duration: 2000,
+      message: res.data.msg,
+    });
+  }
+  upLoading.value = false;
+  currentIndex.value = -1;
+}
+function pageChange(e) {
+  currentPage.value = e;
+  getBlockChainList();
+}
+onMounted(() => {
+  getBlockChainList();
+});
+</script>
+<style scoped>
+.seach-btn {
+  display: inline-block;
+  width: 60px;
+  height: 38px;
+  background: #0094fe;
+  border-radius: 2px;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #ffffff;
+  text-align: center;
+  line-height: 38px;
+  margin-left: 10px;
+  cursor: pointer;
+}
+
+.cargo-owner-add {
+  width: 80px;
+  height: 32px;
+  border-radius: 2px;
+  border: 1px solid #0094fe;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+  line-height: 32px;
+  text-align: center;
+  cursor: pointer;
+}
+
+:deep().el-dialog {
+  width: 560px;
+  padding: 20px 50px;
+  border-radius: 6px;
+}
+
+:deep() .el-dialog__title {
+  font-size: 18px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+}
+</style>