|
@@ -132,7 +132,10 @@
|
|
|
size="small"
|
|
|
>编辑</el-button
|
|
|
>
|
|
|
- <el-button @click="handleClick(scope.row)" type="text" size="small"
|
|
|
+ <el-button
|
|
|
+ @click="handleClick(scope.row.downloadUrl)"
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
>下载</el-button
|
|
|
>
|
|
|
<el-button
|
|
@@ -171,10 +174,11 @@
|
|
|
<!-- 弹出层 -->
|
|
|
<!-- 新增 -->
|
|
|
<el-dialog
|
|
|
- title="新增"
|
|
|
+ title="新增(批次列表为空时,请前往性能分析下批次管理中添加批次!)"
|
|
|
:visible.sync="nuedialog"
|
|
|
class="dialogBox"
|
|
|
width="900px"
|
|
|
+ :before-close="handleCloses"
|
|
|
>
|
|
|
<div v-loading="loadingView" class="views">
|
|
|
<el-form ref="form" :model="newform" label-width="150px">
|
|
@@ -252,6 +256,7 @@
|
|
|
:visible.sync="editNuedialog"
|
|
|
class="dialogBox"
|
|
|
width="900px"
|
|
|
+ :before-close="handleCloses"
|
|
|
>
|
|
|
<div v-loading="loadingViewEdit" class="views">
|
|
|
<el-form
|
|
@@ -352,7 +357,12 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<!-- 异常信息详情 -->
|
|
|
- <el-dialog title="异常详情" :visible.sync="unusualdialog" width="800px">
|
|
|
+ <el-dialog
|
|
|
+ title="异常详情"
|
|
|
+ :visible.sync="unusualdialog"
|
|
|
+ width="800px"
|
|
|
+ :before-close="handleCloses"
|
|
|
+ >
|
|
|
{{ errInfo }}
|
|
|
</el-dialog>
|
|
|
<!-- 转换\重新转换 -->
|
|
@@ -360,6 +370,7 @@
|
|
|
:title="editTransferStateTitle"
|
|
|
:visible.sync="editTransferStateLoading"
|
|
|
width="400px"
|
|
|
+ :before-close="handleCloses"
|
|
|
>
|
|
|
<div v-loading="loadingViewEdit" class="views">
|
|
|
<el-form
|
|
@@ -486,6 +497,14 @@ export default {
|
|
|
this.getBatchCodeList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleCloses(done) {
|
|
|
+ this.$confirm("确认关闭?")
|
|
|
+ .then((_) => {
|
|
|
+ this.getBatchCodeList();
|
|
|
+ done();
|
|
|
+ })
|
|
|
+ .catch((_) => {});
|
|
|
+ },
|
|
|
ensureMinValue(item, field) {
|
|
|
if (item[field] < 1) {
|
|
|
item[field] = 1;
|
|
@@ -497,6 +516,7 @@ export default {
|
|
|
this.editTransferStateForm.dataTransferTypePath = "";
|
|
|
this.editTransferStateLoading = false;
|
|
|
this.loadingViewEdit = false;
|
|
|
+ this.getBatchCodeList();
|
|
|
},
|
|
|
editStately(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
@@ -542,6 +562,7 @@ export default {
|
|
|
this.editNuedialog = false;
|
|
|
this.loadingViewEdit = false;
|
|
|
this.getTableList();
|
|
|
+ this.getBatchCodeList();
|
|
|
},
|
|
|
editly(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
@@ -655,38 +676,48 @@ export default {
|
|
|
this.errInfo = row.errInfo;
|
|
|
},
|
|
|
//下载
|
|
|
- async handleClick() {
|
|
|
- try {
|
|
|
- // 获取 HTML 内容
|
|
|
- const response = await axios.get("/downLoadApi", {
|
|
|
- responseType: "blob",
|
|
|
- }); // 确保响应类型为 Blob
|
|
|
- const reader = new FileReader();
|
|
|
- reader.onload = function (event) {
|
|
|
- const htmlContent = event.target.result; // 读取的 HTML 内容
|
|
|
- const newWindow = window.open("", "_blank");
|
|
|
- newWindow.document.open();
|
|
|
- newWindow.document.write(htmlContent);
|
|
|
- newWindow.document.close();
|
|
|
- // 获取当前页面的 URL
|
|
|
- const currentUrl = window.location.href;
|
|
|
- const proxyUrl = currentUrl.substring(0, currentUrl.indexOf("/", 8)); // 从第8个字符开始搜索,找到第一个 "/" 为止
|
|
|
- // 拼接代理地址和接口路径
|
|
|
- const apiEndpoint = proxyUrl + "/downLoadApi";
|
|
|
-
|
|
|
- // 拼接新的路径
|
|
|
- const newUrl = apiEndpoint + "/downLoadApi";
|
|
|
- // 设置 base 元素
|
|
|
- const baseElement = newWindow.document.createElement("base");
|
|
|
- baseElement.href = newUrl; // 使用代理地址和接口路径
|
|
|
- newWindow.document.head.appendChild(baseElement);
|
|
|
- };
|
|
|
- reader.readAsText(response.data, "utf-8"); // 以 UTF-8 编码读取 Blob
|
|
|
- } catch (error) {
|
|
|
- console.error("Failed to fetch data:", error);
|
|
|
- this.$message.error("无法打开新链接");
|
|
|
+ async handleClick(downloadUrl) {
|
|
|
+ let newWindow = window.open(downloadUrl, "_blank");
|
|
|
+ if (
|
|
|
+ !newWindow ||
|
|
|
+ newWindow.closed ||
|
|
|
+ typeof newWindow.closed == "undefined"
|
|
|
+ ) {
|
|
|
+ alert("弹出窗口已被阻止!请允许弹出式窗口访问本网站。");
|
|
|
}
|
|
|
},
|
|
|
+ // async handleClick() {
|
|
|
+ // try {
|
|
|
+ // // 获取 HTML 内容
|
|
|
+ // const response = await axios.get("/downLoadApi", {
|
|
|
+ // responseType: "blob",
|
|
|
+ // }); // 确保响应类型为 Blob
|
|
|
+ // const reader = new FileReader();
|
|
|
+ // reader.onload = function (event) {
|
|
|
+ // const htmlContent = event.target.result; // 读取的 HTML 内容
|
|
|
+ // const newWindow = window.open("", "_blank");
|
|
|
+ // newWindow.document.open();
|
|
|
+ // newWindow.document.write(htmlContent);
|
|
|
+ // newWindow.document.close();
|
|
|
+ // // 获取当前页面的 URL
|
|
|
+ // const currentUrl = window.location.href;
|
|
|
+ // const proxyUrl = currentUrl.substring(0, currentUrl.indexOf("/", 8)); // 从第8个字符开始搜索,找到第一个 "/" 为止
|
|
|
+ // // 拼接代理地址和接口路径
|
|
|
+ // const apiEndpoint = proxyUrl + "/downLoadApi";
|
|
|
+
|
|
|
+ // // 拼接新的路径
|
|
|
+ // const newUrl = apiEndpoint + "/downLoadApi";
|
|
|
+ // // 设置 base 元素
|
|
|
+ // const baseElement = newWindow.document.createElement("base");
|
|
|
+ // baseElement.href = newUrl; // 使用代理地址和接口路径
|
|
|
+ // newWindow.document.head.appendChild(baseElement);
|
|
|
+ // };
|
|
|
+ // reader.readAsText(response.data, "utf-8"); // 以 UTF-8 编码读取 Blob
|
|
|
+ // } catch (error) {
|
|
|
+ // console.error("Failed to fetch data:", error);
|
|
|
+ // this.$message.error("无法打开新链接");
|
|
|
+ // }
|
|
|
+ // },
|
|
|
async getTableList() {
|
|
|
try {
|
|
|
this.loading = true;
|
|
@@ -711,7 +742,32 @@ export default {
|
|
|
},
|
|
|
//新增按钮
|
|
|
addData() {
|
|
|
- this.nuedialog = true;
|
|
|
+ if (this.batchList === null || this.batchList.length === 0) {
|
|
|
+ this.$confirm(
|
|
|
+ "批次列表为空,请前往性能分析菜单下的批次管理中添加批次!确认跳转到批次管理菜单吗?",
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ this.$router.push("/home/performance/batchMag?id=22");
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "成功!",
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: "info",
|
|
|
+ message: "已取消",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.nuedialog = true;
|
|
|
+ }
|
|
|
},
|
|
|
//获取批次编号列表接口
|
|
|
async getBatchCodeList() {
|