feat: 修复

演示数据2.0
chenhc 6 months ago
parent fdc5fd4567
commit bde96791b4

@ -0,0 +1,68 @@
import axios from "@/utils/request";
export function filterDeviceContract(query) {
return axios(
{
url: "/inv/device/contract/filter",
method: "get",
params: query
}
)
}
export function insertCompanyContract(query) {
return axios(
{
url: "/inv/info/insertDeviceContract",
method: "post",
data: query
}
);
}
export function updateDeviceContract(query) {
return axios(
{
url: "/inv/info/updateDeviceContract",
method: "post",
data: query
}
);
}
export function auditSupContract(query) {
return axios(
{
url: "/sale/sup/contract/audit",
method: "post",
data: query
}
);
}
export function deleteDeviceContract(query) {
return axios(
{
url: "/inv/info/deleteDeviceContract",
method: "post",
data: query
}
);
}
export function revokeSupContract(query) {
return axios(
{
url: "/sale/sup/contract/revoke",
method: "post",
data: query
}
);
}

@ -65,7 +65,12 @@
</invDeviceUpkeepEditDialog>
</el-tab-pane>
<!-- <el-tab-pane label="采购合同" v-if="this.visibleFull">-->
<el-tab-pane label="采购合同" v-if="this.visibleFull ">
<contract :idQuery="filterQuery"
:rowData="this.rowData"
></contract>
</el-tab-pane>
<!-- <el-tab-pane label="采购合同" v-if="this.visibleFull">-->
<!-- <invDevicePurContractDialog v-if="viewCheckVisible "-->
<!-- :idQuery="filterQuery"-->
<!-- :rowData="this.rowData"-->
@ -146,6 +151,7 @@ import DeviceModelDetail from "@/views/dev/DeviceModelDetail.vue";
import inspectSetModifyDialog from "@/views/dev/InspectSetModifyDialog.vue";
import checkResultPanel from "@/views/dev/invDeviceEditDialog.vue";
import technical from "@/views/dev/invTechniclDialog.vue";
import contract from "@/views/dev/invContractDialog.vue";
import invDeviceUserEditDialog from "@/views/dev/invDeviceUserEditDialog.vue";
import invDeviceUsageEditDialog from "@/views/dev/invDeviceUsageEditDialog.vue";
import invDevicePurContractDialog from "@/views/dev/invDevicePurContractDialog.vue";
@ -494,6 +500,7 @@ export default {
invDevicePurOrderDialog,
invDevicePurApplyDialog,
invDeviceRepairEditDialog,
contract,
invDeviceUpkeepEditDialog
},
created() {

@ -0,0 +1,466 @@
<template>
<div>
<el-form :model="inputQuery" :rules="rules" ref="inputQuery" label-width="100px">
<div style=" float: right;
text-align: right;
margin-bottom: 8px;">
<el-button type="primary" size="mini" icon="search" @click="addCert"
style="text-align:right"
>添加合同信息
</el-button>
</div>
<el-table v-loading="certLoading" :data="certList" style=" width: 100%;margin-top: 20px" border
highlight-current-row>
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column label="合同名称" prop="name"></el-table-column>
<el-table-column label="合同编号" prop="code"></el-table-column>
<el-table-column label="更新日期" prop="updateTime"></el-table-column>
<el-table-column label="合同状态">
<template slot-scope="scope">
<span>{{ expire[scope.row.status] }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="审核状态" prop="auditStatus" width="120">-->
<!-- <template slot-scope="scope">-->
<!-- <el-tag :type="(scope.row.auditStatus) | statusFilterType">-->
<!-- {{ checkFlag[scope.row.auditStatus] }}-->
<!-- </el-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="备注" prop="remark"></el-table-column>
<el-table-column label="操作" width="140">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native="addCert(scope.row)"
>编辑
</el-button
>
<el-button type="text" size="mini" @click.native="showImgViewer(scope.row)">
预览
</el-button>
<el-button
type="text"
size="small"
@click.native="deleteDeviceCert(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-image-viewer v-if="imgViewerVisible" style="z-index:9999" :on-close="closeImgViewer"
:url-list="imgList"/>
<pagination
v-show="certTotal>0"
:total="certTotal"
:page.sync="certQuery.page"
:limit.sync="certQuery.limit"
@pagination="certHandleCurrentChange"
></pagination>
<el-dialog
:title="formMap[formName]"
:visible.sync="addCertVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="70%"
v-if="addCertVisible"
append-to-body
@close='closeLocalDialog'
>
<deviceAddContract
:closeDialog="closeLocalDialog"
:inputQuery="inputQuery"
:addType="addType"
:editTye="editTye"
></deviceAddContract>
</el-dialog>
</el-form>
</div>
</template>
<script>
import {modifyCompany, addCompany, bindCorp, previewImage} from "@/api/purchase/supCompany";
import store from "@/store";
import {regionDataPlus, CodeToText} from "element-china-area-data";
import {deleteDeviceContract, updateDeviceContract,filterDeviceContract} from "@/api/dev/deviceContract";
import corpMaintainSelect from "@/views/basic/corpMaintain/corpMaintainSelect"
import deviceAddContract from "@/views/inventory/contract/depContractAddDialog.vue";
import draggable from "vuedraggable";
import {getUUID, isBlank} from "@/utils/strUtil";
import supCertSetSelectDialog from "@/views/purchase/cert/supCertSetSelectDialog";
import {getBasicUnitMaintains, getCorpList} from "@/api/basic/basicUnitMaintain";
import ElImageViewer from "element-ui/packages/image/src/image-viewer"
export default {
name: "invTechnicalEdit",
props: {
// closeDialog: {
// type: Function,
// required: true,
// },
// inputEdit: {
// type: Object,
// required: true,
// },
// editType: {
// type: Number,
// required: true,
// }
idQuery: {
type: Object,
required: true,
},
rowData: {
type: Object,
required: true,
},
},
watch: {
rowData: function (newVal, oldVal) {
this.searchData(newVal);
}
}
,
data() {
return {
formName: null,
formMap: {
"add": "添加合同信息",
"edit": "编辑合同信息"
},
BASE_URL: process.env.VUE_APP_BASE_API,
headers: {},
classesDisplay: false,
selectedOptions: [],
imgViewerVisible: false,
imgList: [],
options: regionDataPlus,
inputQuery: {
// customerId: null,
devCodeFk: null,
companyName: null,
contacts: null,
mobile: null,
detailAddr: null,
},
rules: {
companyName: [
{
required: true,
message: "请输入企业名称",
trigger: "blur"
}
],
creditNum: [
{
required: true,
message: "请输入统一社会信用代码",
trigger: "blur"
}
],
classes: [
{
required: true,
message: "请选择企业类别",
trigger: "change"
}
],
area: [
{
required: true,
message: "请选择所属地区",
trigger: "change"
}
],
detailAddr: [
{
required: true,
message: "请输入详细地址",
trigger: "change"
}
],
contacts: [
{
required: true,
message: "请输入联系人",
trigger: "change"
}
],
mobile: [
{
required: true,
message: "请输入联系电话",
trigger: "change"
}
],
email: [
{
required: true,
message: "请输入邮箱",
trigger: "change"
}
],
updateCause: [
{
required: true,
message: "请输入变更原因",
trigger: "change"
}
],
},
uploadUrl: "",
fileUrl: "",
certFileUrl: "",
url: 'http://127.0.0.1:9996/udiwms/image/register/file/getImage?type=image1&name=t11111.jpg',
certQuery: {
devCodeFk: "",
page: 1,
limit: 20,
type: 1
},
expire: {
0: "有效",
1: "失效"
},
certList: [],
certTotal: 0,
certLoading: false,
addCertVisible: false,
salesmanQuery: {
name: "",
page: 1,
limit: 20
},
salesmanList: [],
salesmanTotal: 0,
salesmanLoading: false,
addSalesmanVisible: false,
certTypeMap: {
1: '身份证'
},
selectLocalVisible: false,
productQuery: {
ylqxzcrbarmc: "",
cpmctymc: "",
ggxh: "",
page: 1,
limit: 20
},
maintainsList: [],
productList: [],
productTotal: 0,
productLoading: false,
uuid: null,
companyApplyUpdateVisible: false,
companyEditDisabled: true,
companyEditButtonStr: "编辑",
addType: "2", //12
checkFlag: {
0: "草稿",
1: "已通过",
2: "已拒绝",
3: "变更未审核",
6: "未审核",
},
editTye: 1,
selectCorpVisible: false,
selectCertVisible: false,
certType: 1,
customerId: null,
};
}
,
methods: {
searchData(query) {
console.log("完成!")
console.log(query)
this.idQuery = {...query}
this.getDeviceContractList();
},
//
showImgViewer(row) {
// URL
this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name=";
this.imgList = [];
// PDF
const isPdf = row.filePath.toLowerCase().includes('.pdf');
if (isPdf) {
// PDF
previewImage({ imageUrl: row.filePath, certFileUrl: this.certFileUrl }).then(response => {
if (response.code === 20000) {
// PDF
this.imgList = response.data;
window.open(this.imgList, '_blank');
//
// UI
this.imgViewerVisible = false;
}
});
} else {
// PDF
previewImage({ imageUrl: row.filePath, certFileUrl: this.certFileUrl }).then(response => {
if (response.code === 20000) {
this.imgList = response.data;
this.imgViewerVisible = true;
//
const m = (e) => {
e.preventDefault();
};
document.body.style.overflow = 'hidden';
document.addEventListener("touchmove", m, false);
}
});
}
},
closeImgViewer() {
this.imgViewerVisible = false;
const m = (e) => {
e.preventDefault()
};
document.body.style.overflow = 'auto';
document.removeEventListener("touchmove", m, true);
},
selectBasicCorp() {
this.selectCorpVisible = true;
},
cancelDialog() {
this.closeDialog();
},
//
closeLocalDialog() {
this.addCertVisible = false;
this.selectCertVisible = false;
// this.getCompanyCertList();
this.getDeviceContractList();
}
,
//
addCert(row) {
if (isBlank(this.inputQuery.devCodeFk)) {
return this.$message.error("请先选择设备");
}
console.log(this.inputQuery.devCodeFk)
if (this.$isNotBlank(row) && this.$isNotBlank(row.id)) {
this.formName = "edit"
this.inputQuery.formData = row;
this.editTye = 2;
} else {
this.formName = "add"
this.inputQuery.formData = {};
this.inputQuery.formData.addType = 2;
this.editTye = 1;
}
this.addCertVisible = true;
}
,
//
certHandleCurrentChange(val) {
this.certQuery.page = val.page;
// this.getCompanyCertList();
this.getDeviceContractList();
},
getBasicUnitMaintainsList() {
getCorpList()
.then((response) => {
this.maintainsList = response.data || [];
})
.catch(() => {
this.maintainsList = [];
});
},
getDeviceContractList() {
this.certLoading = true;
// let certRuery = {}
// this.certQuery.customerId = this.inputEdit.customerId;
// console.log("idQuery")
// console.log(this.idQuery)
this.certQuery.devCodeFk = this.idQuery.devCodeFk;
this.certQuery.type = 2;
this.inputQuery={...this.idQuery};
this.inputQuery.devCodeFk=this.idQuery.devCodeFk;
// console.log(this.inputQuery);
// console.log("this.certQuery:")
// console.log(this.certQuery)
filterDeviceContract(this.certQuery)
.then((response) => {
this.certLoading = false;
this.certList = response.data.list || [];
this.certTotal = response.data.total;
})
.catch(() => {
this.certLoading = false;
this.certList = [];
});
},
deleteDeviceCert(row) {
this.$confirm("是否删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.certLoading = true;
let tquery = {
id: row.id,
filePath: row.filePath,
};
deleteDeviceContract(tquery)
.then((response) => {
this.certLoading = false;
if (response.code === 20000) {
this.getDeviceCertList();
this.$message({
type: "success",
message: "删除成功!",
});
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.certLoading = false;
});
}).catch(() => {
});
},
},
created() {
// console.log("this.rowData:")
// console.log(this.rowData)
// // if (this.rowData.editType == 1) {
this.getDeviceContractList();
// // }
// this.getBasicUnitMaintainsList();
this.headers = {
ADMINID: store.getters.adminId,
ADMINTOKEN: store.getters.token,
};
},
components: {
draggable, deviceAddContract, corpMaintainSelect, supCertSetSelectDialog, ElImageViewer
}
}
;
</script>
<style scoped>
</style>

@ -298,19 +298,39 @@ export default {
},
//
showImgViewer(row) {
this.certFileUrl = this.BASE_URL + '/udiwms/image/register/file/getImage?type=image2&name='
this.imgList = []
previewImage({ imageUrl: row.filePath, certFileUrl: this.certFileUrl }).then(response => {
if (response.code === 20000) {
this.imgList = response.data
}
})
this.imgViewerVisible = true
const m = (e) => {
e.preventDefault()
// URL
this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name=";
this.imgList = [];
// PDF
const isPdf = row.filePath.toLowerCase().includes('.pdf');
if (isPdf) {
// PDF
previewImage({ imageUrl: row.filePath, certFileUrl: this.certFileUrl }).then(response => {
if (response.code === 20000) {
// PDF
this.imgList = response.data;
window.open(this.imgList, '_blank');
//
// UI
this.imgViewerVisible = false;
}
});
} else {
// PDF
previewImage({ imageUrl: row.filePath, certFileUrl: this.certFileUrl }).then(response => {
if (response.code === 20000) {
this.imgList = response.data;
this.imgViewerVisible = true;
//
const m = (e) => {
e.preventDefault();
};
document.body.style.overflow = 'hidden';
document.addEventListener("touchmove", m, false);
}
});
}
document.body.style.overflow = 'hidden'
document.addEventListener('touchmove', m, false) //
},
closeImgViewer() {
this.imgViewerVisible = false

@ -294,19 +294,39 @@ export default {
},
//
showImgViewer(row) {
// URL
this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name=";
this.imgList = [];
previewImage({imageUrl: row.filePath, certFileUrl: this.certFileUrl}).then(response => {
if (response.code === 20000) {
this.imgList = response.data;
}
});
this.imgViewerVisible = true;
const m = (e) => {
e.preventDefault()
};
document.body.style.overflow = 'hidden';
document.addEventListener("touchmove", m, false); //
// PDF
const isPdf = row.filePath.toLowerCase().includes('.pdf');
if (isPdf) {
// PDF
previewImage({ imageUrl: row.filePath, certFileUrl: this.certFileUrl }).then(response => {
if (response.code === 20000) {
// PDF
this.imgList = response.data;
window.open(this.imgList, '_blank');
//
// UI
this.imgViewerVisible = false;
}
});
} else {
// PDF
previewImage({ imageUrl: row.filePath, certFileUrl: this.certFileUrl }).then(response => {
if (response.code === 20000) {
this.imgList = response.data;
this.imgViewerVisible = true;
//
const m = (e) => {
e.preventDefault();
};
document.body.style.overflow = 'hidden';
document.addEventListener("touchmove", m, false);
}
});
}
},
closeImgViewer() {
this.imgViewerVisible = false;

@ -114,7 +114,7 @@
:on-remove="uploadHandleRemove"
:headers="headers"
:on-exceed="uploadHandleExceed"
accept=".jpg,.png"
accept=".jpg,.png,.pdf"
:on-change="uploadOnchange"
:on-success="uploadHandleSuccess"
:on-error="uploadHandleError"
@ -124,7 +124,7 @@
<el-button slot="trigger" size="small" type="primary" :disabled="formData.auditStatus == 1">
{{ choiceFile }}
</el-button>
<div>只能上传 jpg,png 文件且不超过 3 MB</div>
<div>只能上传 jpg,png,pdf 文件且不超过 6 MB</div>
</el-upload>
<!-- <el-button type="primary" size="mini" icon="search" @click="toViewCompanyCert"-->
<!-- style="text-align:right"-->
@ -313,8 +313,8 @@ export default {
let uid = file.uid
let pos = fileName.lastIndexOf(".");
let lastName = fileName.substring(pos, fileName.length);
if (lastName.toLowerCase() !== ".jpg" && lastName.toLowerCase() !== ".png" && lastName.toLowerCase() !== ".doc") {
this.$message.error("上传文件只能是 jpg,png格式");
if (lastName.toLowerCase() !== ".jpg" && lastName.toLowerCase() !== ".png" && lastName.toLowerCase() !== ".pdf") {
this.$message.error("上传文件只能是 jpg,png,pdf格式");
for (let i = 0; i < fileList.length; i++) {//list
if (fileList[i].uid === uid) {
fileList.splice(i, 1)
@ -323,9 +323,9 @@ export default {
return;
}
//
const isLt = file.size / 1024 / 1024 / 3 <= 1;
const isLt = file.size / 1024 / 1024 / 6 <= 1;
if (!isLt) {
this.$message.error("上传文件大小不能超过 3MB");
this.$message.error("上传文件大小不能超过 6MB");
for (let i = 0; i < fileList.length; i++) {
if (fileList[i].uid === uid) {
fileList.splice(i, 1)

@ -0,0 +1,406 @@
<template>
<div>
<el-form :model="formData" :rules="formRules" ref="dataForm">
<el-card style="margin-top: -30px">
<el-button-group style="display: flex">
<el-button type="primary" @click.native="submitUpload()" style="margin: 0 60px 10px auto; height: 35px"
:loading="loading">提交
</el-button>
</el-button-group>
<el-row>
<el-col :span="3">
<div class="ao-text">
<span>合同名称</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item prop="name">
<el-input v-model="formData.name" auto-complete="off" :disabled="formData.auditStatus == 1"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<div class="ao-text">
<span>合同编号</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item prop="code">
<el-input v-model="formData.code" auto-complete="off" :disabled="formData.auditStatus == 1"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="3">
<div class="ao-text">
<span>生效期</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item prop="vailDate">
<el-date-picker
v-model="formData.vailDate"
type="date"
:disabled="formData.auditStatus == 1"
value-format="yyyy-MM-dd"
style="width: 100%"
placeholder="请选择生效期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="3">
<div class="ao-text">
<span>失效期</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item prop="expireDate">
<el-date-picker
v-model="formData.expireDate"
type="date"
:disabled="formData.auditStatus == 1"
value-format="yyyy-MM-dd"
style="width: 100%"
placeholder="请选择失效期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="3">
<div class="ao-text">
<span>备注</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item prop="remark">
<el-input v-model="formData.remark" auto-complete="off" type="textarea" autosize></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row :gutter="20">-->
<!-- <el-col :span="4">-->
<!-- </el-col>-->
<!-- <el-col :span="16">-->
<!-- <div style="color: red">-->
<!-- 需要上传档案为营业执照电子档案经营许可证电子档案经营备案证电子档案开户行电子档案-->
<!-- </div>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row>
<el-col :span="3">
<div class="ao-text">
<span>文件</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item>
<el-upload
:disabled="formData.auditStatus == 1"
class="upload-demo"
ref="upload"
:action="this.uploadUrl"
:on-preview="uploadHandlePreview"
:on-remove="uploadHandleRemove"
:headers="headers"
:on-exceed="uploadHandleExceed"
accept=".jpg,.png,.pdf"
:on-change="uploadOnchange"
:on-success="uploadHandleSuccess"
:on-error="uploadHandleError"
:file-list="fileList"
:data="{type:'image2'}"
:auto-upload="true">
<el-button slot="trigger" size="small" type="primary" :disabled="formData.auditStatus == 1">
{{ choiceFile }}
</el-button>
<div>只能上传 jpg,png,pdf 文件且不超过 6 MB</div>
</el-upload>
<!-- <el-button type="primary" size="mini" icon="search" @click="toViewCompanyCert"-->
<!-- style="text-align:right"-->
<!-- >文件预览-->
<!-- </el-button-->
<!-- >-->
</el-form-item>
</el-col>
</el-row>
</el-card>
</el-form>
</div>
</template>
<script>
import draggable from "vuedraggable";
import store from "../../../store";
import {insertCompanyContract, updateCompanyContract, updateDeviceContract} from "@/api/dev/deviceContract";
import ElImageViewer from "element-ui/packages/image/src/image-viewer"
export default {
name: "devCompanyCertAdd",
props: {
closeDialog: {
type: Function,
required: true,
},
inputQuery: {
type: Object,
required: true,
},
editTye: {
type: Object,//1:2
required: true,
},
addType: {
type: Object,
required: true,
},
},
data() {
return {
BASE_URL: process.env.VUE_APP_BASE_API,
code: "",
isCleck:false,
formData: {
devCodeFk: null,
type: 0,
vailDate: null,
expireDate: null,
remark: null,
code: null,
name: null,
manufacturerIdFk: null,
auditStatus: 6
},
formRules: {
name: [
{required: true, message: "请输入证书名称", trigger: "blur"}
],
code: [
{required: true, message: "请输入证书编号", trigger: "blur"}
],
},
loading: false,
uploadUrl: "",
fileList: [],
headers: {},
choiceFile: "选取文件",
};
},
components: {
draggable,
ElImageViewer
},
methods: {
submitUpload() {
this.$refs["dataForm"].validate(valid => {
if (valid) {
if (this.formData.auditStatus == 1) {
this.$confirm("该证书已审核通过,是否重新提交审核?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.onConfirmSubmit(1);
})
.catch(() => {
});
} else {
this.onConfirmSubmit();
}
}
});
},
onConfirmSubmit(val) {
this.formData.repeatUpload = val;
console.log(this.formData)
if (this.$isNotBlank(this.formData.filePath)) {
if (this.$refs.upload.uploadFiles.length > 0) {
this.$refs.upload.submit();
this.onSubmit();
} else {
this.onSubmit();
}
} else {
console.log(this.$refs.upload.uploadFiles.length);
if (this.$refs.upload.uploadFiles.length > 0) {
this.$refs.upload.submit();
} else {
this.$message.warning(`请选择文件`);
}
}
},
onSubmit() {
this.formData.devCodeFk = this.inputQuery.devCodeFk;
// if (this.formData.devCodeFk == null) {
// this.formData.devCodeFk = store.getters.devCodeFk;
// }
// this.formData.type = this.addType;
console.log("this.addType的值判断是技术还是资质");
console.log(this.addType);
//12
if (this.addType == 1) {
this.formData.devCodeFk = this.inputQuery.devCodeFk;
this.formData.type = 1;
} else if (this.addType == 2) {
this.formData.devCodeFk = this.inputQuery.devCodeFk;
this.formData.type = 2;
}
// if (this.formData.auditStatus != 1)
// this.formData.auditStatus = "6";
console.log("添加修改前:")
console.log(this.formData)
console.log(this.editTye)
if (this.editTye == 1) {
insertCompanyContract(this.formData).then(response => {
this.loading = false;
if (response.code === 20000) {
this.$message.success("添加成功");
this.closeDialog(true);
} else {
this.$message.error(response.message);
}
});
} else {
updateDeviceContract(this.formData).then(response => {
this.loading = false;
if (response.code === 20000) {
this.$message.success("添加成功");
this.closeDialog(true);
} else {
this.$message.error(response.message);
}
});
}
},
uploadHandleRemove(file, fileList) {
this.formData.filePath="";
for (var i=0;i<fileList.length;i++){
this.formData.filePath+=fileList[i].response.data.name+",";
}
},
uploadHandlePreview(file) {
console.log(file);
console.log(this.fileList);
},
uploadHandleExceed(files, fileList) {
},
uploadOnchange(file, fileList) {
let fileName = file.name;
let uid = file.uid
let pos = fileName.lastIndexOf(".");
let lastName = fileName.substring(pos, fileName.length);
if (lastName.toLowerCase() !== ".jpg" && lastName.toLowerCase() !== ".png" && lastName.toLowerCase() !== ".pdf") {
this.$message.error("上传文件只能是 jpg,png,pdf格式");
for (let i = 0; i < fileList.length; i++) {//list
if (fileList[i].uid === uid) {
fileList.splice(i, 1)
}
}
return;
}
//
const isLt = file.size / 1024 / 1024 / 6 <= 1;
if (!isLt) {
this.$message.error("上传文件大小不能超过 6MB");
for (let i = 0; i < fileList.length; i++) {
if (fileList[i].uid === uid) {
fileList.splice(i, 1)
}
}
}
return isLt;
},
uploadHandleSuccess(response, file, fileList) {
if (response.code === 20000) {
if(this.formData.filePath==null || this.isCleck==true){
this.formData.filePath=response.data.name+",";
this.isCleck=false;
}else{
this.formData.filePath+=response.data.name+",";
}
} else {
this.$message.error("文件上传失败:" + response.message);
}
},
uploadHandleError() {
},
toViewCompanyCert() {
this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name=";
window.open(this.certFileUrl + this.formData.filePath);
},
},
filters: {},
mounted() {
document.body.ondrop = function (event) {
event.preventDefault();
event.stopPropagation();
};
},
created() {
this.uploadUrl = this.BASE_URL + "/udiwms/upload/register/file";
this.headers = {
ADMINID: store.getters.adminId,
ADMINTOKEN: store.getters.token,
};
if (this.inputQuery.formData == null) {
this.formData = {}
} else if (this.inputQuery.formData != null && this.inputQuery.formData.addType == 1) {
this.formData = {}
} else {
this.formData = this.inputQuery.formData;
// console.log(this.inputQuery.formData);
}
// console.log("")
// console.log(this.inputQuery)
// console.log("1")
// console.log(this.formData)
if (this.formData.filePath != null) {
this.choiceFile = "更换文件";
this.isCleck=true;
} else {
this.choiceFile = "选取文件";
}
},
};
</script>
<style scoped>
.ao-text {
width: 100%;
font-size: 13px;
font-family: "Microsoft YaHei";
float: right;
text-align: right;
margin-top: 10px;
}
</style>
Loading…
Cancel
Save