|
@@ -334,6 +334,45 @@
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="8" class="clear">
|
|
|
+ <el-form-item
|
|
|
+ label="附件"
|
|
|
+ prop="enclosure_file"
|
|
|
+ class="activity-upload"
|
|
|
+ >
|
|
|
+ <div v-if="ruleForm&&ruleForm.enclosure_file" class="clearfix">
|
|
|
+ <a :href="ruleForm.enclosure_file" download="附件">点击下载</a>
|
|
|
+
|
|
|
+ <el-link
|
|
|
+ :underline="false"
|
|
|
+ @click="deleteUrl()"
|
|
|
+ type="warning"
|
|
|
+ style="margin: 0 0 0 16px"
|
|
|
+ >删除</el-link
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="activity-upload" v-else>
|
|
|
+ <div class="btnupload" style="position: relative">
|
|
|
+ <i class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ <file-upload-pdf
|
|
|
+ class="Upload"
|
|
|
+ :accept="'.zip,.rar,.7z'"
|
|
|
+ :multiple="false"
|
|
|
+ :uploadcondition="beforeOtherUpload"
|
|
|
+ @UploadErrorEvent="UploadErrorOtherenclosure_file"
|
|
|
+ @UploadSuccessEvent="
|
|
|
+ UploadSuccessOtherenclosure_file
|
|
|
+ "
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="txt-tips fl">
|
|
|
+ <p>建议大小:小于5MB</p>
|
|
|
+ <p>文件格式:.zip,.rar,.7z</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
<el-col :span="8" v-if="is_noble">
|
|
|
<el-form-item label="金属种类" prop="metal_id">
|
|
|
<search-metal-kind
|
|
@@ -465,6 +504,7 @@ export default {
|
|
|
remark: "",
|
|
|
metal_id: "",
|
|
|
gold_price: "0",
|
|
|
+ enclosure_file: "",
|
|
|
},
|
|
|
rulesThis: this.rules,
|
|
|
rules: rules,
|
|
@@ -572,6 +612,7 @@ export default {
|
|
|
specinfo,
|
|
|
cat_id_name,
|
|
|
cat_arr_id,
|
|
|
+ enclosure_file,
|
|
|
} = this.sitem;
|
|
|
console.log(this.sitem);
|
|
|
// console.log(p_cat_info);
|
|
@@ -625,6 +666,7 @@ export default {
|
|
|
gold_price: gold_price || "0",
|
|
|
unit: unit ? unit : [],
|
|
|
unit_name: unit_name ? unit_name : "",
|
|
|
+ enclosure_file: enclosure_file || "",
|
|
|
};
|
|
|
this.is_noble = false;
|
|
|
if (cat_arr_id && cat_arr_id.length > 0) {
|
|
@@ -767,6 +809,50 @@ export default {
|
|
|
this.$refs.ruleForm.validateField("good_img");
|
|
|
}
|
|
|
},
|
|
|
+ //其他文件上传失败
|
|
|
+ UploadErrorOtherenclosure_file(res) {
|
|
|
+ if (res !== "break") {
|
|
|
+ this.$refs.ruleForm.validateField("enclosure_file");
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //判断其他文件规格
|
|
|
+ beforeOtherUpload(file) {
|
|
|
+ let isJPG = false;
|
|
|
+ if (file.type === "application/x-zip-compressed") {
|
|
|
+ isJPG = true;
|
|
|
+ }
|
|
|
+ let name = file.name;
|
|
|
+ let list = name.split(".");
|
|
|
+ if (list[list.length - 1] === "rar" || list[list.length - 1] === "7z") {
|
|
|
+ isJPG = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 5;
|
|
|
+ if (!isJPG) {
|
|
|
+ this.$message.error("文件格式不正确!");
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error("文件大小不能超过 5MB!");
|
|
|
+ }
|
|
|
+ return isJPG && isLt2M;
|
|
|
+ },
|
|
|
+
|
|
|
+ deleteUrl() {
|
|
|
+ this.ruleForm.enclosure_file = "";
|
|
|
+ this.$refs.ruleForm.validateField("enclosure_file");
|
|
|
+ },
|
|
|
+ // 其他文件上传成功
|
|
|
+ async UploadSuccessOtherenclosure_file(data) {
|
|
|
+ const { url } = data;
|
|
|
+ console.log(url);
|
|
|
+ if (url === "noToken") {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.ruleForm.enclosure_file = url;
|
|
|
+ this.$message.success("附件上传成功!");
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|