4/28 上传pdf修改

20240109-yw
wangwei 11 months ago
parent 8851588265
commit 1bd0caf0f7

@ -10,6 +10,17 @@ export function filterCompanyCert(query) {
}
)
}
export function filterByid(query) {
return axios(
{
// url: "/sup/company/cert/filterList",
url: "/sup/company/cert/filterByid",
method: "get",
params: query
}
)
}
//产品
export function filterCompanyCPCert(query) {
return axios(

@ -3,23 +3,35 @@
<div class="user-info-head">
<el-row>
<el-col :span="6">
<el-button type="primary" icon="el-icon-view" size="small" @click="showImgViewer">
<el-button type="primary" icon="el-icon-view" size="small" @click="viewFile">(pdf)
</el-button>
</el-col>
<el-col :span="6">
<el-upload action="#" :http-request="requestUpload" :show-file-list="false" :before-upload="beforeUpload">
<el-button type="primary" icon="el-icon-plus" size="small" @click="uploadPdf"></el-button>
</el-upload>
</el-col>
<el-upload
class="upload-demo"
action
:data="{type:'.pdf'}"
:on-change="handleChange"
:on-success="handleSuccess"
:file-list="fileList"
:auto-upload="false"
:http-request="requestUpload"
>
<el-button size="small" type="primary" icon="el-icon-plus"
style="margin-left: 50px;padding-right: 15px"
>上传资质文件</el-button>
</el-upload>
</el-row>
</div>
</div>
</template>
<script>
import {uploadFile} from "@/api/basic/uploadZz";
import {filterByid} from "@/api/purchase/companyCert";
export default {
props: {
@ -31,10 +43,18 @@ export default {
type: Object,
required: true,
},
},
data() {
return {
filePdf:{}
addForm:{
file:null,
fileName:'',
fileData:null
},
filePdfa:null,
newFile:{},
filePdf: null,
};
},
methods: {
@ -42,49 +62,97 @@ export default {
requestUpload() {
},
//
beforeUpload(file) {
console.log("zhegewenjian hdhdhd",file)
this.filePdf.fileName = file.name
if (file.type === "application/pdf") {
uploadFile(file).then(response => {
console.log("上传成功")
this.inputQuery.filePath = this.inputQuery.filePath + ";" + this.options.img + ";"
this.splitImages()
this.$modal.msgSuccess("提交成功");
this.visible = false;
});
} else {
this.$modal.msgError("文件格式错误请上传Pdf类型的文件。");
//
beforeUpload(file){
this.addForm.file = file;
this.addForm.fileName = file.name;
// this.fileSize = file.size;
const extension = file.name.split('.').slice(-1) == 'pdf'
if (!extension) {
this.$message.warning('上传模板只能是pdf格式!')
return
}
let reader = new FileReader();
reader.readAsDataURL(file);
let that = this;
reader.onload = function() {
that.addForm.fileData = reader.result;
};
return false; // false
},
//pdf PDF
viewFile(){
if (this.formName == 1){
if(this.filePdf == null){
this.$message.warning('请先上传PDF文件');
return false;
}
var win = window.open();
win.document.write(
'<body style="margin:0px;"><object data="' +
this.filePdf +
'" type="application/pdf" width="100%" height="100%"><iframe src="' +
this.filePdf +
'" scrolling="no" width="100%" height="100%" frameborder="0" ></iframe></object></body>'
);
}else {
if ( this.filePdf == null){
this.$message.error("请上传资质文件");
}else {
window.open(this.filePdf,'_blank')
console.log("hhhhhhhhhhhhhhhhhhhhhhhh",this.filePdf)
}
// getCropFile(data) {
// debugger
// console.log(data);
// uploadFile(data).then(response => {
// this.open = false;
// this.options.img = response.data.name;
// this.inputQuery.filePath = this.inputQuery.filePath + ";" + this.options.img + ";"
// this.splitImages()
// this.$modal.msgSuccess("");
// this.visible = false;
// });
// },
// Pdf
uploadPdf() {
let formData = new FormData();
console.log("xixiixixixiixixixi",this.filePdf.fileName)
formData.append("file", data, this.options.filename);
formData.append("type", "pdf2");
uploadFile(formData).then(response => {
this.open = false;
console.log(response.data.name);
this.options.img = response.data.name;
this.inputQuery.filePath = this.options.img
}
},
//
getOneCert(){
let cQuery = {
id : this.inputQuery.id
};
filterByid(cQuery).then(res => {
if (res.code == 20000){
this.filePdf = res.data.filePdfPath
console.log("dayinchu zhege ba ",this.filePdf)
}
})
},
submitAddForm(){
let formData = new FormData();
formData.append("file", this.addForm.file);
formData.append("type", ".pdf");
console.log("heihei", this.addForm.file)
this.newFile = this.addForm.file
uploadFile(formData).then(response => {
if (response == 20000){
this.filePdf = response.data.name
this.$modal.msgSuccess("提交成功");
this.visible = false;
});
}
});
},
handleChange(file,fileList){
console.log("zaici dayin ",file.raw)
let newFile = file.raw
let formData = new FormData();
formData.append("file",newFile);
formData.append("type", ".pdf");
uploadFile(formData).then(res => {
if (res.code == 20000){
console.log("aaaaaaaachenggong",res)
this.inputQuery.filePdfPath = res.data.name
this.filePdf = res.data.name
this.$modal.msgSuccess("提交成功");
this.visible = false;
}
});
console.log('文件列表发生变化',file);
},
handleSuccess(response, file) {
// this.filePdf = file.response.data.name
//
console.log('上传成功', response, file);
},
//
closeDialog() {
@ -93,13 +161,13 @@ export default {
splitImages() {
// filePath
if (typeof this.inputQuery.filePath !== "string") {
if (typeof this.inputQuery.filePdfPath !== "string") {
console.warn("inputQuery.filePath is not a string");
return;
}
try {
//
let imagePaths = this.inputQuery.filePath.split(";");
// //
// let imagePaths = this.inputQuery.filePath.split(";");
//
this.imgList = imagePaths.filter(path => path.trim() !== "" && path.trim() !== null && path.trim() !== "null");
console.log(this.imgList);
@ -113,6 +181,8 @@ export default {
created() {
this.splitImages();
this.getOneCert();
console.log("dayin dayin ",this.inputQuery)
}
};
</script>

@ -47,7 +47,8 @@
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
>
</el-option>
</el-select>
</el-form-item>
<el-form-item v-if="item.columnType =='selectServer'" :prop="item.columnName">
@ -122,8 +123,8 @@
</el-row>
</template>
<div style='text-align: center; margin-bottom: 10px;margin-top: 18px ;'>
<el-button @click="closeDialog"></el-button>
<el-button v-if="formName != 3" type="primary" @click="submitInv('inputQuery')"></el-button>
<el-button @click="closeDialog"></el-button>
</div>
</el-form>
</el-card>
@ -195,7 +196,6 @@ export default {
},
methods: {
submitInv(inputQuery){
console.log("踩踩我是哪一个")
this.$refs[inputQuery].validate((valid) => {
if (valid) {

@ -622,19 +622,19 @@
<el-radio :label="scope.row.id" v-model="radioCheck"><span></span></el-radio>
</template>
</el-table-column>
<el-table-column
v-if="item.columnType == 'laber' && executeEval(row,item.expression,true)"
:prop="item.columnName"
:label="item.columnDesc"
:sortable="item.sort"
:width="item.width"
:show-overflow-tooltip="item.tooltip"
:key="item.columnName"
>
<template slot-scope="scope">
<span :style="{color: executeFuc(scope.row,'4',item.lableRuleObj[scope.row[item.columnName]])}">{{ item.lableRuleObj[scope.row[item.columnName]] }}</span>
</template>
</el-table-column>
<!--<el-table-column-->
<!-- v-if="item.columnType == 'laber' && executeEval(row,item.expression,true)"-->
<!-- :prop="item.columnName"-->
<!-- :label="item.columnDesc"-->
<!-- :sortable="item.sort"-->
<!-- :width="item.width"-->
<!-- :show-overflow-tooltip="item.tooltip"-->
<!-- :key="item.columnName"-->
<!--&gt;-->
<!-- <template slot-scope="scope">-->
<!-- <span :style="{color: executeFuc(scope.row,'4',item.lableRuleObj[scope.row[item.columnName]])}">{{ item.lableRuleObj[scope.row[item.columnName]] }}</span>-->
<!-- </template>-->
<!--</el-table-column>-->
<el-table-column
v-if="item.columnType == 'eltag' && executeEval(row,item.expression,true)"
:prop="item.columnName"

@ -529,10 +529,10 @@ export default {
});
},
selectProduct() {
if (this.$isBlank(this.filterQuery.companyIdFk)) {
this.$message.error("请先选择注册企业!");
return;
}
// if (this.$isBlank(this.filterQuery.companyIdFk)) {
// this.$message.error("");
// return;
// }
this.selectProductVisible = true;
},

@ -1,7 +1,7 @@
<template>
<div class="upfile">
<div>
<el-button type="primary" icon="el-icon-plus" size="small" @click="getCropImg"></el-button>
<el-button type="primary" icon="el-icon-plus" size="small" @click="getCropImg" style="margin-left: 50px">新增资质图片</el-button>
</div>
<!-- <div v-else class="addFileImg">-->
<!-- <img :src="imgBase64">-->

Loading…
Cancel
Save