|
@@ -1,16 +1,59 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="full-container-p24">
|
|
<div class="full-container-p24">
|
|
|
<div style="display: flex; justify-content: space-between">
|
|
<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>
|
|
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="type"
|
|
|
|
|
+ class="m-2"
|
|
|
|
|
+ placeholder="全部文件"
|
|
|
|
|
+ @change="getUFileList"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in options"
|
|
|
|
|
+ :key="item.key"
|
|
|
|
|
+ :label="item.value"
|
|
|
|
|
+ :value="item.key"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ <el-button @click="showUploadModal" type="primary">上传文件</el-button>
|
|
|
|
|
+ <el-dialog v-model="visable" title="上传文件" style="width: 420px">
|
|
|
|
|
+ <div class="df aic">
|
|
|
|
|
+ <div style="width: 80px">文件类型:</div>
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="currentFileType"
|
|
|
|
|
+ class="m-2"
|
|
|
|
|
+ placeholder="请选择文件类型"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in options"
|
|
|
|
|
+ :key="item.key"
|
|
|
|
|
+ :label="item.value"
|
|
|
|
|
+ :value="item.key"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="mt20" v-if="currentFileType">
|
|
|
|
|
+ <el-upload
|
|
|
|
|
+ ref="uploadRef"
|
|
|
|
|
+ v-model:file-list="fileList"
|
|
|
|
|
+ :action="store.state.baseurl + '/ufile/upload'"
|
|
|
|
|
+ :on-remove="handleRemove"
|
|
|
|
|
+ :data="{
|
|
|
|
|
+ type: currentFileType,
|
|
|
|
|
+ }"
|
|
|
|
|
+ :limit="1"
|
|
|
|
|
+ :on-success="uploadSuccess"
|
|
|
|
|
+ :auto-upload="false"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-button :disabled="fileList.length" type="primary">
|
|
|
|
|
+ 选择文件
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </el-upload>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="df jcfe mt40">
|
|
|
|
|
+ <el-button @click="uploadUFile" type="primary">上传</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
</div>
|
|
|
<div style="margin-top: 24px">
|
|
<div style="margin-top: 24px">
|
|
|
<el-table :data="tableData" stripe style="width: 100%">
|
|
<el-table :data="tableData" stripe style="width: 100%">
|
|
@@ -20,59 +63,40 @@
|
|
|
min-width="80"
|
|
min-width="80"
|
|
|
align="center"
|
|
align="center"
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
|
|
|
+
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="voyageName"
|
|
|
|
|
- label="航次名称"
|
|
|
|
|
- min-width="160"
|
|
|
|
|
- align="center"
|
|
|
|
|
- ></el-table-column>
|
|
|
|
|
- <el-table-column
|
|
|
|
|
- prop="shipName"
|
|
|
|
|
- label="船名"
|
|
|
|
|
|
|
+ prop="typeName"
|
|
|
|
|
+ label="文件类型"
|
|
|
min-width="160"
|
|
min-width="160"
|
|
|
align="center"
|
|
align="center"
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="shipMmsi"
|
|
|
|
|
- label="MMSI"
|
|
|
|
|
- min-width="120"
|
|
|
|
|
- align="center"
|
|
|
|
|
- ></el-table-column>
|
|
|
|
|
- <el-table-column
|
|
|
|
|
- prop="loadPort"
|
|
|
|
|
- label="装货港"
|
|
|
|
|
|
|
+ prop="fileName"
|
|
|
|
|
+ label="文件名称"
|
|
|
min-width="160"
|
|
min-width="160"
|
|
|
align="center"
|
|
align="center"
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="dischargeProt"
|
|
|
|
|
- label="卸货港"
|
|
|
|
|
|
|
+ prop="createTime"
|
|
|
|
|
+ label="上传时间"
|
|
|
min-width="120"
|
|
min-width="120"
|
|
|
align="center"
|
|
align="center"
|
|
|
></el-table-column>
|
|
></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">
|
|
|
|
|
|
|
+ <el-table-column label="操作" min-width="180" align="center">
|
|
|
<template v-slot="scope">
|
|
<template v-slot="scope">
|
|
|
- <span v-if="scope.row.hash">已上链</span>
|
|
|
|
|
<el-button
|
|
<el-button
|
|
|
- v-else
|
|
|
|
|
- @click="upBlockChain(scope.row.voyageId, scope.$index)"
|
|
|
|
|
|
|
+ @click="downloadUFIle(scope.row)"
|
|
|
type="primary"
|
|
type="primary"
|
|
|
size="small"
|
|
size="small"
|
|
|
- :loading="upLoading && currentIndex == scope.$index"
|
|
|
|
|
>
|
|
>
|
|
|
- 上链
|
|
|
|
|
|
|
+ 下载
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ @click="deleteUFIle(scope.row)"
|
|
|
|
|
+ type="danger"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ >
|
|
|
|
|
+ 删除
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -98,15 +122,15 @@ import md5 from "md5";
|
|
|
import api from "../../apis/fetch";
|
|
import api from "../../apis/fetch";
|
|
|
|
|
|
|
|
let currentPage = ref(1);
|
|
let currentPage = ref(1);
|
|
|
-let term = ref("");
|
|
|
|
|
|
|
+let type = ref("");
|
|
|
let tableData = ref([]);
|
|
let tableData = ref([]);
|
|
|
let total = ref(0);
|
|
let total = ref(0);
|
|
|
-async function getBlockChainList(page) {
|
|
|
|
|
|
|
+async function getUFileList(page) {
|
|
|
currentPage.value = page || currentPage.value;
|
|
currentPage.value = page || currentPage.value;
|
|
|
- let res = await api.getBlockChainList({
|
|
|
|
|
|
|
+ let res = await api.getUFileList({
|
|
|
currentPage: currentPage.value,
|
|
currentPage: currentPage.value,
|
|
|
size: 10,
|
|
size: 10,
|
|
|
- term: term.value,
|
|
|
|
|
|
|
+ type: type.value || 0,
|
|
|
});
|
|
});
|
|
|
if (res.data.status == 0) {
|
|
if (res.data.status == 0) {
|
|
|
tableData.value = res.data.result;
|
|
tableData.value = res.data.result;
|
|
@@ -120,35 +144,90 @@ async function getBlockChainList(page) {
|
|
|
let upLoading = ref(false);
|
|
let upLoading = ref(false);
|
|
|
let currentIndex = ref(-1);
|
|
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,
|
|
|
|
|
|
|
+function pageChange(e) {
|
|
|
|
|
+ currentPage.value = e;
|
|
|
|
|
+ getUFileList();
|
|
|
|
|
+}
|
|
|
|
|
+let options = ref([]);
|
|
|
|
|
+
|
|
|
|
|
+async function getUFileTypeSelect() {
|
|
|
|
|
+ let res = await api.getUFileTypeSelect();
|
|
|
|
|
+ options.value = res.data.result;
|
|
|
|
|
+}
|
|
|
|
|
+let currentFileType = ref("");
|
|
|
|
|
+
|
|
|
|
|
+function downloadUFIle(item) {
|
|
|
|
|
+ let a = document.createElement("a");
|
|
|
|
|
+ a.setAttribute("href", item.downloadUrl);
|
|
|
|
|
+ a.click();
|
|
|
|
|
+}
|
|
|
|
|
+function deleteUFIle(item) {
|
|
|
|
|
+ ElMessageBox.confirm(`确认删除: ${item.fileName}?`, "提示", {
|
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
|
+ type: "warning",
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(async () => {
|
|
|
|
|
+ let res = await api.deleteUFile({
|
|
|
|
|
+ id: item.id,
|
|
|
|
|
+ });
|
|
|
|
|
+ if (res.data.status == 0) {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ type: "success",
|
|
|
|
|
+ message: "删除成功",
|
|
|
|
|
+ });
|
|
|
|
|
+ getUFileList();
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((e) => {
|
|
|
|
|
+ console.log(e);
|
|
|
});
|
|
});
|
|
|
- getBlockChainList();
|
|
|
|
|
- } else {
|
|
|
|
|
- ElNotification.error({
|
|
|
|
|
- title: "失败",
|
|
|
|
|
- duration: 2000,
|
|
|
|
|
- message: res.data.msg,
|
|
|
|
|
|
|
+}
|
|
|
|
|
+let uploadRef = ref(null);
|
|
|
|
|
+function uploadUFile(e) {
|
|
|
|
|
+ if (!currentFileType.value) {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: "请选择文件类型并上传文件",
|
|
|
|
|
+ type: "warning",
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (fileList.value.length == 0) {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: "请上传文件",
|
|
|
|
|
+ type: "warning",
|
|
|
});
|
|
});
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
- upLoading.value = false;
|
|
|
|
|
- currentIndex.value = -1;
|
|
|
|
|
|
|
+ uploadRef.value.submit();
|
|
|
}
|
|
}
|
|
|
-function pageChange(e) {
|
|
|
|
|
- currentPage.value = e;
|
|
|
|
|
- getBlockChainList();
|
|
|
|
|
|
|
+let visable = ref(false);
|
|
|
|
|
+function showUploadModal() {
|
|
|
|
|
+ visable.value = true;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+let fileList = ref([]);
|
|
|
|
|
+function uploadSuccess(e) {
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ if (e.status == 0) {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: "上传成功!",
|
|
|
|
|
+ type: "success",
|
|
|
|
|
+ });
|
|
|
|
|
+ visable.value = false;
|
|
|
|
|
+ currentFileType.value = "";
|
|
|
|
|
+ fileList.value = [];
|
|
|
|
|
+ getUFileList();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: e.msg,
|
|
|
|
|
+ type: "error",
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
- getBlockChainList();
|
|
|
|
|
|
|
+ getUFileList();
|
|
|
|
|
+ getUFileTypeSelect();
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
<style scoped>
|
|
<style scoped>
|