|
|
|
|
@ -3,17 +3,18 @@
|
|
|
|
|
<!-- 生成记录列表 -->
|
|
|
|
|
<view class="record-list">
|
|
|
|
|
<uv-swipe-action>
|
|
|
|
|
<uv-swipe-action-item @click="delItem(record)" :options="options" v-for="record in list"
|
|
|
|
|
:key="record.ID">
|
|
|
|
|
<uv-swipe-action-item @click="index => controlItem(index,record)" :options="options"
|
|
|
|
|
v-for="record in list" :key="record.ID">
|
|
|
|
|
<view class="record-item">
|
|
|
|
|
<!-- 记录信息 -->
|
|
|
|
|
<view class="record-info">
|
|
|
|
|
<view class="record-title">{{ record.file_name || record.order_no || record.plannedNo }}</view>
|
|
|
|
|
<view class="record-title">{{ record.file_name || record.order_no || record.plannedNo }}
|
|
|
|
|
</view>
|
|
|
|
|
<view class="record-time">
|
|
|
|
|
生成时间:
|
|
|
|
|
{{
|
|
|
|
|
record.CreatedAt
|
|
|
|
|
? dayjs(record.CreatedAt).format("YYYY-MM-DD")
|
|
|
|
|
? dayjs(record.CreatedAt).format("YYYY-MM-DD HH:mm:ss")
|
|
|
|
|
: ""
|
|
|
|
|
}}
|
|
|
|
|
</view>
|
|
|
|
|
@ -23,9 +24,11 @@
|
|
|
|
|
<view class="status-tag" :class="{
|
|
|
|
|
completed: record.status == 4,
|
|
|
|
|
failed: record.status == 5,
|
|
|
|
|
waitting:record.status == 1
|
|
|
|
|
}">
|
|
|
|
|
<span v-if="record.status == 4">已完成</span>
|
|
|
|
|
<span v-else-if="record.status == 5">生成失败</span>
|
|
|
|
|
<span v-else-if="record.status == 1">等待生成</span>
|
|
|
|
|
<span v-else>生成中</span>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
@ -54,6 +57,21 @@
|
|
|
|
|
|
|
|
|
|
<!-- 加载更多 -->
|
|
|
|
|
<uv-load-more v-else :status="loadingStatus" @loadmore="loadmore" />
|
|
|
|
|
|
|
|
|
|
<!-- 参数展示弹窗 -->
|
|
|
|
|
<uv-modal ref="paramsModalRef" title="生成参数" :showCancelButton="false" confirmText="确定">
|
|
|
|
|
<view class="params-modal-content">
|
|
|
|
|
<view v-if="currentParams.length === 0" class="no-params">
|
|
|
|
|
暂无参数信息
|
|
|
|
|
</view>
|
|
|
|
|
<view v-else class="params-list">
|
|
|
|
|
<view v-for="param in currentParams" :key="param.name" class="param-item">
|
|
|
|
|
<view class="param-name">{{ param.name }}:</view>
|
|
|
|
|
<view class="param-value">{{ param.value || '未设置' }}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</uv-modal>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@ -71,14 +89,41 @@
|
|
|
|
|
} from "@dcloudio/uni-app";
|
|
|
|
|
|
|
|
|
|
const options = ref([{
|
|
|
|
|
text: "参数",
|
|
|
|
|
style: {
|
|
|
|
|
backgroundColor: "#6eb0ea",
|
|
|
|
|
},
|
|
|
|
|
}, {
|
|
|
|
|
text: "删除",
|
|
|
|
|
style: {
|
|
|
|
|
backgroundColor: "#f56c6c",
|
|
|
|
|
},
|
|
|
|
|
}, ]);
|
|
|
|
|
const delItem = (item) => {
|
|
|
|
|
console.log(item);
|
|
|
|
|
deleteRecord(item);
|
|
|
|
|
}]);
|
|
|
|
|
const currentParams = ref([])
|
|
|
|
|
const showParamsModal = ref(false)
|
|
|
|
|
const paramsModalRef = ref(null)
|
|
|
|
|
|
|
|
|
|
const controlItem = (index, item) => {
|
|
|
|
|
console.log(index, item);
|
|
|
|
|
if (index.index === 0) {
|
|
|
|
|
// 显示参数弹窗
|
|
|
|
|
showParams(item);
|
|
|
|
|
} else {
|
|
|
|
|
deleteRecord(item);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 显示参数弹窗
|
|
|
|
|
const showParams = (item) => {
|
|
|
|
|
if (item.template_data) {
|
|
|
|
|
currentParams.value = Object.entries(item.template_data).map(([key, value]) => ({
|
|
|
|
|
name: key,
|
|
|
|
|
value: value
|
|
|
|
|
}));
|
|
|
|
|
} else {
|
|
|
|
|
currentParams.value = [];
|
|
|
|
|
}
|
|
|
|
|
paramsModalRef.value.open();
|
|
|
|
|
};
|
|
|
|
|
// 响应式数据
|
|
|
|
|
const loading = ref(false);
|
|
|
|
|
@ -86,7 +131,6 @@
|
|
|
|
|
const page = ref(1);
|
|
|
|
|
const list = ref([]);
|
|
|
|
|
const count = ref(0);
|
|
|
|
|
|
|
|
|
|
// 下载记录
|
|
|
|
|
const downloadRecord = (record) => {
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
@ -102,12 +146,38 @@
|
|
|
|
|
document.body.appendChild(link);
|
|
|
|
|
link.click();
|
|
|
|
|
document.body.removeChild(link);
|
|
|
|
|
|
|
|
|
|
// downloadA(record.result_url, (record.file_name || record.plannedNo))
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "开始下载",
|
|
|
|
|
icon: "success",
|
|
|
|
|
});
|
|
|
|
|
// uni.request({
|
|
|
|
|
// url:'/api/proxyDownload',
|
|
|
|
|
// data:{"name":record.file_name || record.plannedNo,url:record.result_url},
|
|
|
|
|
// method:'POST',
|
|
|
|
|
// responseType: 'arraybuffer',
|
|
|
|
|
// success:res => {
|
|
|
|
|
// const blob = new Blob([res.data], {
|
|
|
|
|
// type: 'application/pdf'
|
|
|
|
|
// })
|
|
|
|
|
// const base64 = res.data
|
|
|
|
|
// const iframe = document.createElement('iframe')
|
|
|
|
|
// iframe.style.display = 'none'
|
|
|
|
|
// iframe.src = `data:application/pdf;base64,${base64}`
|
|
|
|
|
// document.body.appendChild(iframe)
|
|
|
|
|
|
|
|
|
|
// // const url = URL.createObjectURL(blob)
|
|
|
|
|
// // const a = document.createElement('a')
|
|
|
|
|
// // a.href = url
|
|
|
|
|
// // a.download = record.file_name
|
|
|
|
|
// // a.click()
|
|
|
|
|
// // URL.revokeObjectURL(url)
|
|
|
|
|
// },
|
|
|
|
|
// complete:() => {
|
|
|
|
|
// uni.hideLoading();
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
// 小程序和App端使用uni.downloadFile
|
|
|
|
|
@ -275,7 +345,7 @@
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
margin-bottom: 6px;
|
|
|
|
|
word-wrap: break-word;
|
|
|
|
|
white-space: normal;
|
|
|
|
|
white-space: normal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.record-time {
|
|
|
|
|
@ -307,6 +377,10 @@
|
|
|
|
|
background: #fff7e6;
|
|
|
|
|
color: #fa8c16;
|
|
|
|
|
}
|
|
|
|
|
&.waitting {
|
|
|
|
|
background: #fff7e6;
|
|
|
|
|
color: #4ad6f1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.record-actions {
|
|
|
|
|
@ -335,4 +409,47 @@
|
|
|
|
|
padding: 20px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.params-modal-content {
|
|
|
|
|
padding: 20px 0;
|
|
|
|
|
max-height: 400px;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
|
|
|
|
.no-params {
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: #999;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
padding: 20px 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.params-list {
|
|
|
|
|
.param-item {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
padding: 12px 0;
|
|
|
|
|
border-bottom: 1px solid #f0f0f0;
|
|
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.param-name {
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: #333;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
min-width: 80px;
|
|
|
|
|
margin-right: 12px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.param-value {
|
|
|
|
|
flex: 1;
|
|
|
|
|
color: #666;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
word-wrap: break-word;
|
|
|
|
|
white-space: normal;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|