|
@@ -59,16 +59,32 @@
|
|
style="width:100%;"
|
|
style="width:100%;"
|
|
border
|
|
border
|
|
>
|
|
>
|
|
- <el-table-column type="selection" width="55"></el-table-column>
|
|
|
|
|
|
+ <el-table-column label="序号" type="index" width="50">
|
|
|
|
+ </el-table-column>
|
|
<el-table-column label="类别" prop="typeName" />
|
|
<el-table-column label="类别" prop="typeName" />
|
|
<el-table-column label="上传">
|
|
<el-table-column label="上传">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-button
|
|
|
|
- size="mini"
|
|
|
|
- icon="el-icon-upload"
|
|
|
|
- @click="upload(scope.row);"
|
|
|
|
- >上传
|
|
|
|
- </el-button>
|
|
|
|
|
|
+ <el-upload
|
|
|
|
+ :action="uploadAction"
|
|
|
|
+ :headers="uploadHeaders"
|
|
|
|
+ :file-list="fileList"
|
|
|
|
+ :disabled="!hasPermit"
|
|
|
|
+ :on-success="
|
|
|
|
+ (response, file, fileList) =>
|
|
|
|
+ uploadSuccess(response, file, fileList, scope.row)
|
|
|
|
+ "
|
|
|
|
+ :on-error="uploadError"
|
|
|
|
+ :show-file-list="false"
|
|
|
|
+ :auto-upload="true"
|
|
|
|
+ :multiple="false"
|
|
|
|
+ >
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ icon="el-icon-upload"
|
|
|
|
+ :disabled="!hasPermit"
|
|
|
|
+ >上传</el-button
|
|
|
|
+ >
|
|
|
|
+ </el-upload>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="下载">
|
|
<el-table-column label="下载">
|
|
@@ -76,6 +92,7 @@
|
|
<el-button
|
|
<el-button
|
|
size="mini"
|
|
size="mini"
|
|
icon="el-icon-download"
|
|
icon="el-icon-download"
|
|
|
|
+ :disabled="isEmptyStr(scope.row.fileName)"
|
|
@click="download(scope.row);"
|
|
@click="download(scope.row);"
|
|
>下载
|
|
>下载
|
|
</el-button>
|
|
</el-button>
|
|
@@ -86,6 +103,7 @@
|
|
<el-button
|
|
<el-button
|
|
size="mini"
|
|
size="mini"
|
|
icon="el-icon-view"
|
|
icon="el-icon-view"
|
|
|
|
+ :disabled="isEmptyStr(scope.row.fileUrl)"
|
|
@click="preview(scope.row);"
|
|
@click="preview(scope.row);"
|
|
>预览
|
|
>预览
|
|
</el-button>
|
|
</el-button>
|
|
@@ -115,6 +133,18 @@ export default {
|
|
tableData: [],
|
|
tableData: [],
|
|
orgList: [],
|
|
orgList: [],
|
|
examList: [],
|
|
examList: [],
|
|
|
|
+ templateForm: {
|
|
|
|
+ orgId: "",
|
|
|
|
+ examId: "",
|
|
|
|
+ templateType: "",
|
|
|
|
+ fileUrl: ""
|
|
|
|
+ },
|
|
|
|
+ fileList: [],
|
|
|
|
+ uploadAction: PRINT_API + "/common/upload",
|
|
|
|
+ uploadHeaders: {
|
|
|
|
+ key: "",
|
|
|
|
+ token: ""
|
|
|
|
+ },
|
|
rules: {}
|
|
rules: {}
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -165,29 +195,63 @@ export default {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- upload(row) {
|
|
|
|
|
|
+ uploadSuccess(response, file, fileList, row) {
|
|
/* 上传模板 */
|
|
/* 上传模板 */
|
|
- console.log(row);
|
|
|
|
|
|
+ if (response.code == "PRT-000200") {
|
|
|
|
+ this.templateForm.orgId = this.formSearch.orgId;
|
|
|
|
+ this.templateForm.examId = this.formSearch.examId;
|
|
|
|
+ this.templateForm.templateType = row.templateType;
|
|
|
|
+ this.templateForm.fileUrl = response.data;
|
|
|
|
+ this.$http
|
|
|
|
+ .post(PRINT_API + "/project/template/save", this.templateForm)
|
|
|
|
+ .then(
|
|
|
|
+ () => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "上传模板成功!",
|
|
|
|
+ type: "success"
|
|
|
|
+ });
|
|
|
|
+ this.searchRecords();
|
|
|
|
+ },
|
|
|
|
+ () => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "上传模板失败!",
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ uploadError(response, file, fileList) {
|
|
|
|
+ console.log(response);
|
|
this.$notify({
|
|
this.$notify({
|
|
- message: "Todo...",
|
|
|
|
- type: "warning"
|
|
|
|
|
|
+ message: "上传文件失败!",
|
|
|
|
+ type: "error"
|
|
});
|
|
});
|
|
},
|
|
},
|
|
preview(row) {
|
|
preview(row) {
|
|
/* 预览模板 */
|
|
/* 预览模板 */
|
|
- console.log(row);
|
|
|
|
- this.$notify({
|
|
|
|
- message: "Todo...",
|
|
|
|
- type: "warning"
|
|
|
|
- });
|
|
|
|
|
|
+ let url = row.fileUrl;
|
|
|
|
+ if (!url) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "当前模板不存在!",
|
|
|
|
+ type: "warning"
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ window.open(url);
|
|
},
|
|
},
|
|
download(row) {
|
|
download(row) {
|
|
/* 下载模板 */
|
|
/* 下载模板 */
|
|
- console.log(row);
|
|
|
|
- this.$notify({
|
|
|
|
- message: "Todo...",
|
|
|
|
- type: "warning"
|
|
|
|
- });
|
|
|
|
|
|
+ let filePath = row.fileName;
|
|
|
|
+ if (!filePath) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "当前模板不存在!",
|
|
|
|
+ type: "warning"
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let url = PRINT_API + "/common/download?filePath=" + filePath;
|
|
|
|
+ window.location.href = url;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -203,6 +267,11 @@ export default {
|
|
} else {
|
|
} else {
|
|
this.hasPermit = false;
|
|
this.hasPermit = false;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ this.uploadHeaders = {
|
|
|
|
+ key: this.user.key,
|
|
|
|
+ token: this.user.token
|
|
|
|
+ };
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|