|
@@ -14,7 +14,7 @@
|
|
|
v-model="formSearch.orgId"
|
|
|
placeholder="请选择"
|
|
|
clearable
|
|
|
- @change="loadExamList(formSearch.orgId);"
|
|
|
+ @change="loadExamList(formSearch.orgId)"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in orgList"
|
|
@@ -67,8 +67,9 @@
|
|
|
<el-upload
|
|
|
:action="uploadAction"
|
|
|
:headers="uploadHeaders"
|
|
|
- :file-list="fileList"
|
|
|
+ :file-list="uploadFileList"
|
|
|
:disabled="!hasPermit"
|
|
|
+ :before-upload="file => beforeUpload(file, scope.row)"
|
|
|
:on-success="
|
|
|
(response, file, fileList) =>
|
|
|
uploadSuccess(response, file, fileList, scope.row)
|
|
@@ -93,7 +94,7 @@
|
|
|
size="mini"
|
|
|
icon="el-icon-download"
|
|
|
:disabled="checkEmptyStr(scope.row.fileName)"
|
|
|
- @click="download(scope.row);"
|
|
|
+ @click="download(scope.row)"
|
|
|
>下载
|
|
|
</el-button>
|
|
|
</template>
|
|
@@ -104,7 +105,7 @@
|
|
|
size="mini"
|
|
|
icon="el-icon-view"
|
|
|
:disabled="checkEmptyStr(scope.row.fileUrl)"
|
|
|
- @click="preview(scope.row);"
|
|
|
+ @click="preview(scope.row)"
|
|
|
>预览
|
|
|
</el-button>
|
|
|
</template>
|
|
@@ -140,7 +141,7 @@ export default {
|
|
|
templateType: "",
|
|
|
fileUrl: ""
|
|
|
},
|
|
|
- fileList: [],
|
|
|
+ uploadFileList: [],
|
|
|
uploadAction: PRINT_API + "/common/upload",
|
|
|
uploadHeaders: {
|
|
|
key: "",
|
|
@@ -221,6 +222,50 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ beforeUpload(file, row) {
|
|
|
+ const isLimit = file.size / 1024 / 1024 < 50;
|
|
|
+ if (!isLimit) {
|
|
|
+ this.$notify({
|
|
|
+ message: "上传文件大小不能超过50MB!",
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ let index = file.name.lastIndexOf(".");
|
|
|
+ let ext = file.name.substring(index).toLowerCase();
|
|
|
+ console.log("templateType:" + row.templateType + " ext:" + ext);
|
|
|
+
|
|
|
+ if (row.templateType == 1 || row.templateType == 2) {
|
|
|
+ /* 考生数据表(1)、考场数据表(2) */
|
|
|
+ if (!new RegExp("(.xls|.xlsx)$").test(ext)) {
|
|
|
+ this.$notify({
|
|
|
+ message: "请选择后缀为.xls或.xlsx的文件!",
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else if (row.templateType == 8) {
|
|
|
+ /* 试卷袋样式(8) */
|
|
|
+ if (!new RegExp("(.jpg|.png)$").test(ext)) {
|
|
|
+ this.$notify({
|
|
|
+ message: "请选择后缀为.jpg或.png的文件!",
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ /* 卷袋贴模板(3)、签到表模板(4)、常规题卡模板(5)、特殊题卡模板(6)、备份卷贴模板(7) */
|
|
|
+ if (!new RegExp("(.pdf)$").test(ext)) {
|
|
|
+ this.$notify({
|
|
|
+ message: "请选择后缀为.pdf的文件!",
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
uploadSuccess(response, file, fileList, row) {
|
|
|
/* 上传模板 */
|
|
|
if (response.code == "PRT-000200") {
|