4 changed files with 818 additions and 2 deletions
@ -0,0 +1,53 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
// 查询资产状况信息列表
|
|||
export function listAsset(query) { |
|||
return request({ |
|||
url: '/enterprise/asset/list', |
|||
method: 'post', |
|||
data: query |
|||
}) |
|||
} |
|||
|
|||
// 查询资产状况信息详细
|
|||
export function getAsset(id) { |
|||
return request({ |
|||
url: '/enterprise/asset/' + id, |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
// 新增资产状况信息
|
|||
export function addAsset(data) { |
|||
return request({ |
|||
url: '/enterprise/asset', |
|||
method: 'post', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 修改资产状况信息
|
|||
export function updateAsset(data) { |
|||
return request({ |
|||
url: '/enterprise/asset', |
|||
method: 'put', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 删除资产状况信息
|
|||
export function delAsset(id) { |
|||
return request({ |
|||
url: '/enterprise/asset/' + id, |
|||
method: 'delete' |
|||
}) |
|||
} |
|||
|
|||
// 导出资产状况信息
|
|||
export function exportAsset(query) { |
|||
return request({ |
|||
url: '/enterprise/asset/export', |
|||
method: 'get', |
|||
params: query |
|||
}) |
|||
} |
@ -0,0 +1,750 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<!-- <el-form |
|||
:model="queryParams" |
|||
ref="queryForm" |
|||
:inline="true" |
|||
v-show="showSearch" |
|||
> |
|||
<el-form-item label="项目名称" prop="projectName"> |
|||
<el-input |
|||
v-model="queryParams.data.projectName" |
|||
placeholder="请输入项目名称" |
|||
clearable |
|||
size="small" |
|||
@keyup.enter.native="handleQuery" |
|||
> |
|||
<el-button |
|||
type="primary" |
|||
slot="append" |
|||
icon="el-icon-search" |
|||
size="small" |
|||
@click="handleQuery" |
|||
></el-button> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item> |
|||
<el-button |
|||
type="cyan" |
|||
icon="el-icon-search" |
|||
size="mini" |
|||
@click="handleQuery" |
|||
>搜索</el-button |
|||
> |
|||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery" |
|||
>重置</el-button |
|||
> |
|||
</el-form-item> |
|||
</el-form> --> |
|||
|
|||
<el-row :gutter="10" class="mb8"> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="primary" |
|||
icon="el-icon-plus" |
|||
size="mini" |
|||
@click="handleAdd" |
|||
>新增</el-button |
|||
> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="success" |
|||
icon="el-icon-edit" |
|||
size="mini" |
|||
:disabled="single" |
|||
@click="handleUpdate" |
|||
>修改</el-button |
|||
> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="danger" |
|||
icon="el-icon-delete" |
|||
size="mini" |
|||
:disabled="multiple" |
|||
@click="handleDelete" |
|||
>删除</el-button |
|||
> |
|||
</el-col> |
|||
<right-toolbar |
|||
:showSearch.sync="showSearch" |
|||
@queryTable="getList" |
|||
></right-toolbar> |
|||
</el-row> |
|||
|
|||
<el-table |
|||
v-loading="loading" |
|||
:data="performanceRecordList" |
|||
@selection-change="handleSelectionChange" |
|||
> |
|||
<el-table-column type="selection" width="55" align="center" fixed /> |
|||
<el-table-column |
|||
label="序号" |
|||
type="index" |
|||
width="50" |
|||
align="center" |
|||
fixed |
|||
/> |
|||
<el-table-column |
|||
label="财务信息" |
|||
align="center" |
|||
prop="financialInformation" |
|||
min-width="180" |
|||
> |
|||
<template slot-scope="scope"> |
|||
<div |
|||
v-for="(item, index) in JSON.parse(scope.row.financialInformation)" |
|||
:key="item + index" |
|||
> |
|||
<i class="el-icon-document"></i> |
|||
{{ item.name }} |
|||
<i |
|||
class="el-icon-download" |
|||
@click="downloadFile(scope, index)" |
|||
style="cursor: pointer" |
|||
></i> |
|||
</div> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
label="设备资产信息" |
|||
align="center" |
|||
prop="equipmentAssetInformation" |
|||
min-width="180" |
|||
> |
|||
<template slot-scope="scope"> |
|||
<div |
|||
v-for="(item, index) in JSON.parse( |
|||
scope.row.equipmentAssetInformation |
|||
)" |
|||
:key="item + index" |
|||
> |
|||
<i class="el-icon-document"></i> |
|||
{{ item.name }} |
|||
<i |
|||
class="el-icon-download" |
|||
@click="downloadFile(scope, index)" |
|||
style="cursor: pointer" |
|||
></i> |
|||
</div> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
label="年份" |
|||
align="center" |
|||
prop="year" |
|||
min-width="120" |
|||
/> |
|||
|
|||
<el-table-column |
|||
label="操作" |
|||
align="center" |
|||
class-name="small-padding fixed-width" |
|||
width="180" |
|||
fixed="right" |
|||
> |
|||
<template slot-scope="scope"> |
|||
<!-- <el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-view" |
|||
@click="viewInfo(scope.row)" |
|||
>查看</el-button |
|||
> --> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-edit" |
|||
@click="handleUpdate(scope.row)" |
|||
>修改</el-button |
|||
> |
|||
<el-button |
|||
size="mini" |
|||
type="text" |
|||
icon="el-icon-delete" |
|||
@click="handleDelete(scope.row)" |
|||
>删除</el-button |
|||
> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<pagination |
|||
v-show="total > 0" |
|||
:total="total" |
|||
:page.sync="queryParams.pageNum" |
|||
:limit.sync="queryParams.pageSize" |
|||
@pagination="getList" |
|||
/> |
|||
|
|||
<!-- 添加或修改工程业绩记录对话框 --> |
|||
<el-dialog |
|||
:title="title" |
|||
:visible.sync="open" |
|||
width="1200px" |
|||
append-to-body |
|||
:close-on-click-modal="false" |
|||
> |
|||
<el-row :gutter="15"> |
|||
<el-form ref="form" :model="form" :rules="rules" label-width="110px"> |
|||
<el-col :span="12"> |
|||
<el-form-item label="财务信息" prop="financialInformation"> |
|||
<!-- <el-input v-model="form.attachment" placeholder="请输入附件" /> --> |
|||
<el-upload |
|||
class="upload-demo" |
|||
action="thinking/common/upload" |
|||
:headers="headers" |
|||
:before-upload="(file) => $fileBeforeUpload(file, 'fileList')" |
|||
:on-preview="handlePreview" |
|||
:on-remove="(file) => handleRemove(file, 'fileList')" |
|||
:before-remove="beforeRemove" |
|||
multiple |
|||
:on-exceed="handleExceed" |
|||
:on-success=" |
|||
(_, fileList) => submitUpload(fileList, 'fileList') |
|||
" |
|||
:file-list="fileList" |
|||
> |
|||
<el-button size="small" type="primary" plain> |
|||
<i class="el-icon-upload el-icon--right"></i> |
|||
点击上传 |
|||
</el-button> |
|||
<div slot="tip" class="el-upload__tip"> |
|||
支持jpg/png/pdf/word/excel文件等,不超过200M |
|||
</div> |
|||
</el-upload> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="设备资产信息" prop="equipmentAssetInformation"> |
|||
<!-- <el-input v-model="form.attachment" placeholder="请输入附件" /> --> |
|||
<el-upload |
|||
class="upload-demo" |
|||
action="thinking/common/upload" |
|||
:headers="headers" |
|||
:before-upload="(file) => $fileBeforeUpload(file, 'fileList1')" |
|||
:on-preview="handlePreview" |
|||
:on-remove="(file) => handleRemove(file, 'fileList1')" |
|||
:before-remove="beforeRemove" |
|||
multiple |
|||
:on-exceed="handleExceed" |
|||
:on-success=" |
|||
(_, fileList) => submitUpload(fileList, 'fileList1') |
|||
" |
|||
:file-list="fileList1" |
|||
> |
|||
<el-button size="small" type="primary" plain> |
|||
<i class="el-icon-upload el-icon--right"></i> |
|||
点击上传 |
|||
</el-button> |
|||
<div slot="tip" class="el-upload__tip"> |
|||
支持jpg/png/pdf/word/excel文件等,不超过200M |
|||
</div> |
|||
</el-upload> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="年份" prop="year"> |
|||
<el-date-picker |
|||
clearable |
|||
size="small" |
|||
style="width: 100%" |
|||
v-model="form.year" |
|||
type="year" |
|||
value-format="yyyy" |
|||
placeholder="选择年份" |
|||
> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-form> |
|||
</el-row> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button type="primary" @click="submitForm">确 定</el-button> |
|||
<el-button @click="cancel">取 消</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
<!--查看 --> |
|||
<el-dialog |
|||
:title="viewTitle" |
|||
:visible.sync="viewOpen" |
|||
width="1200px" |
|||
append-to-body |
|||
@close="closeView" |
|||
:close-on-click-modal="false" |
|||
> |
|||
<!-- 工程业绩记录 --> |
|||
<div class="infoTitle">工程业绩记录</div> |
|||
<div class="draLine"></div> |
|||
<div class="content"> |
|||
<el-descriptions |
|||
class="margin-top" |
|||
:column="2" |
|||
border |
|||
:labelStyle="{ |
|||
'text-align': 'left', |
|||
width: '180px', |
|||
height: '50px', |
|||
}" |
|||
:contentStyle="{ minWidth: '350px' }" |
|||
> |
|||
<el-descriptions-item> |
|||
<template slot="label"> 项目名称 </template> |
|||
{{ this.performanceRecordMsg.projectName }} |
|||
</el-descriptions-item> |
|||
<el-descriptions-item> |
|||
<template slot="label"> 建设单位 </template> |
|||
{{ this.performanceRecordMsg.constructingUnits }} |
|||
</el-descriptions-item> |
|||
<el-descriptions-item> |
|||
<template slot="label"> 项目负责人 </template> |
|||
{{ this.performanceRecordMsg.projectLeader }} |
|||
</el-descriptions-item> |
|||
<el-descriptions-item> |
|||
<template slot="label"> 项目所在地 </template> |
|||
{{ formatProjectLocation(this.performanceRecordMsg) }} |
|||
</el-descriptions-item> |
|||
<el-descriptions-item> |
|||
<template slot="label"> 项目状态 </template> |
|||
{{ projectStatusFormat(this.performanceRecordMsg) }} |
|||
</el-descriptions-item> |
|||
<el-descriptions-item> |
|||
<template slot="label"> 开工日期 </template> |
|||
{{ this.performanceRecordMsg.commencementDate }} |
|||
</el-descriptions-item> |
|||
<el-descriptions-item> |
|||
<template slot="label"> 竣工日期 </template> |
|||
{{ this.performanceRecordMsg.completionDate }} |
|||
</el-descriptions-item> |
|||
<el-descriptions-item> |
|||
<template slot="label"> 合同价(万元) </template> |
|||
{{ this.performanceRecordMsg.contractPrice }} |
|||
</el-descriptions-item> |
|||
<el-descriptions-item> |
|||
<template slot="label"> 项目获奖情况 </template> |
|||
{{ this.performanceRecordMsg.projectAwardSituation }} |
|||
</el-descriptions-item> |
|||
<el-descriptions-item> |
|||
<template slot="label"> 质量评定结果 </template> |
|||
{{ this.performanceRecordMsg.qualityAssessmentResults }} |
|||
</el-descriptions-item> |
|||
<el-descriptions-item> |
|||
<template slot="label"> 备注 </template> |
|||
{{ this.performanceRecordMsg.remark }} |
|||
</el-descriptions-item> |
|||
<el-descriptions-item> |
|||
<template slot="label"> 附件 </template> |
|||
<template v-if="this.performanceRecordMsg.attachment"> |
|||
<div |
|||
v-for="(item, index) in JSON.parse( |
|||
this.performanceRecordMsg.attachment |
|||
)" |
|||
:key="item + index" |
|||
> |
|||
{{ item.name }} |
|||
|
|||
<i |
|||
class="el-icon-download" |
|||
@click="downloadFile2(item, index)" |
|||
style="cursor: pointer" |
|||
></i> |
|||
</div> |
|||
</template> |
|||
</el-descriptions-item> |
|||
</el-descriptions> |
|||
</div> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
listAsset, |
|||
getAsset, |
|||
addAsset, |
|||
updateAsset, |
|||
delAsset, |
|||
exportAsset, |
|||
} from "@/api/enterprise/asset"; |
|||
import { |
|||
listPerformanceRecord, |
|||
getPerformanceRecord, |
|||
delPerformanceRecord, |
|||
addPerformanceRecord, |
|||
updatePerformanceRecord, |
|||
exportPerformanceRecord, |
|||
} from "@/api/enterprise/performanceRecord"; |
|||
import { getParentQualifications } from "@/api/enterprise/qualifications"; |
|||
import { getAreasData } from "@/api/areas/index"; |
|||
import { regionData, codeToText, TextToCode } from "element-china-area-data"; |
|||
import { getToken } from "@/utils/auth"; |
|||
import { getFileStream } from "@/api/system/upload"; |
|||
|
|||
export default { |
|||
name: "assetCondition", |
|||
props: ["enterpriseId"], |
|||
data() { |
|||
return { |
|||
areasOptionProps: { |
|||
emitPath: false, //value返回最后一级的 |
|||
checkStrictly: true, //选择任意一级 |
|||
}, |
|||
areasOptions: [], |
|||
// 遮罩层 |
|||
loading: true, |
|||
// 选中数组 |
|||
ids: [], |
|||
// 非单个禁用 |
|||
single: true, |
|||
// 非多个禁用 |
|||
multiple: true, |
|||
// 显示搜索条件 |
|||
showSearch: true, |
|||
// 总条数 |
|||
total: 0, |
|||
// 工程业绩记录表格数据 |
|||
performanceRecordList: [], |
|||
// 弹出层标题 |
|||
title: "", |
|||
viewTitle: "", |
|||
// 是否显示弹出层 |
|||
open: false, |
|||
viewOpen: false, |
|||
// 项目状态字典 |
|||
projectStatusOptions: [], |
|||
// 查询参数 |
|||
queryParams: { |
|||
pageNum: 1, |
|||
pageSize: 10, |
|||
ids: null, |
|||
data: { |
|||
enterpriseId: null, |
|||
projectName: null, |
|||
constructingUnits: null, |
|||
proCode: null, |
|||
projectLeader: null, |
|||
projectLocation: null, |
|||
projectStatus: null, |
|||
commencementDate: null, |
|||
completionDate: null, |
|||
contractPrice: null, |
|||
projectAwardSituation: null, |
|||
qualityAssessmentResults: null, |
|||
attachment: null, |
|||
createUid: null, |
|||
updateUid: null, |
|||
owerDept: null, |
|||
}, |
|||
// 排序方式 |
|||
params: { |
|||
// 按哪个字段排序 |
|||
orderBy: "create_time", |
|||
// desc降序,升序asc |
|||
sort: "desc", |
|||
}, |
|||
}, |
|||
// 表单参数 |
|||
form: { |
|||
id: null, |
|||
enterpriseId: null, |
|||
financialInformation: null, |
|||
equipmentAssetInformation: null, |
|||
year: null, |
|||
}, |
|||
// 表单校验 |
|||
rules: { |
|||
projectName: [ |
|||
{ |
|||
required: true, |
|||
message: "请输入项目名称", |
|||
trigger: "blur", |
|||
}, |
|||
{ max: 250, message: "字符长度最大为250", trigger: "blur" }, |
|||
], |
|||
constructingUnits: [ |
|||
{ max: 250, message: "字符长度最大为250", trigger: "blur" }, |
|||
], |
|||
projectLeader: [ |
|||
{ max: 250, message: "字符长度最大为250", trigger: "blur" }, |
|||
], |
|||
contractPrice: [ |
|||
{ |
|||
pattern: |
|||
/(^[1-9]([0-9]{0,6})?(\.[0-9]{1,2})?$|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$))/, |
|||
message: "请输入数字,整数7位,可保留两位小数", |
|||
trigger: "blur", |
|||
}, |
|||
], |
|||
projectAwardSituation: [ |
|||
{ max: 250, message: "字符长度最大为250", trigger: "blur" }, |
|||
], |
|||
qualityAssessmentResults: [ |
|||
{ max: 250, message: "字符长度最大为250", trigger: "blur" }, |
|||
], |
|||
remark: [{ max: 250, message: "字符长度最大为250", trigger: "blur" }], |
|||
}, |
|||
// 请求头 |
|||
headers: { |
|||
jianwei: "jwtech " + getToken(), |
|||
}, |
|||
fileList: [], |
|||
fileList1: [], |
|||
performanceRecordMsg: {}, |
|||
}; |
|||
}, |
|||
created() { |
|||
this.getList(); |
|||
}, |
|||
methods: { |
|||
formatProjectLocation(row) { |
|||
if (row.projectLocation) { |
|||
let provinceCode = row.projectLocation.slice(0, 2); |
|||
let cityCode = row.projectLocation.slice(2, 4); |
|||
let areaCode = row.projectLocation.slice(4, 6); |
|||
if (areaCode != "00") { |
|||
return ( |
|||
codeToText[provinceCode] + |
|||
"-" + |
|||
codeToText[provinceCode + cityCode] + |
|||
"-" + |
|||
codeToText[provinceCode + cityCode + areaCode] |
|||
); |
|||
} else if (cityCode != "00") { |
|||
return ( |
|||
codeToText[provinceCode] + "-" + codeToText[provinceCode + cityCode] |
|||
); |
|||
} else { |
|||
return codeToText[provinceCode]; |
|||
} |
|||
} |
|||
}, |
|||
/** 查询工程业绩记录列表 */ |
|||
getList() { |
|||
this.loading = true; |
|||
this.queryParams.data.enterpriseId = this.enterpriseId; |
|||
listAsset(this.queryParams).then((response) => { |
|||
this.performanceRecordList = response.records; |
|||
this.total = response.total; |
|||
this.loading = false; |
|||
}); |
|||
}, |
|||
// 项目状态字典翻译 |
|||
projectStatusFormat(row, column) { |
|||
return this.selectDictLabel(this.projectStatusOptions, row.projectStatus); |
|||
}, |
|||
// 取消按钮 |
|||
cancel() { |
|||
this.open = false; |
|||
this.reset(); |
|||
}, |
|||
// 表单重置 |
|||
reset() { |
|||
this.fileList = []; |
|||
this.form = { |
|||
id: null, |
|||
enterpriseId: null, |
|||
financialInformation: null, |
|||
equipmentAssetInformation: null, |
|||
year: null, |
|||
}; |
|||
this.resetForm("form"); |
|||
}, |
|||
// 查询表单重置 |
|||
resetQueryForm() { |
|||
this.queryParams = { |
|||
pageNum: 1, |
|||
pageSize: 10, |
|||
data: { |
|||
id: null, |
|||
enterpriseId: null, |
|||
projectName: null, |
|||
constructingUnits: null, |
|||
proCode: null, |
|||
projectLeader: null, |
|||
projectLocation: null, |
|||
projectStatus: null, |
|||
commencementDate: null, |
|||
completionDate: null, |
|||
contractPrice: null, |
|||
projectAwardSituation: null, |
|||
qualityAssessmentResults: null, |
|||
remark: null, |
|||
attachment: null, |
|||
createUid: null, |
|||
updateUid: null, |
|||
createTime: null, |
|||
updateTime: null, |
|||
owerDept: null, |
|||
}, |
|||
// 排序方式 |
|||
params: { |
|||
// 按哪个字段排序 |
|||
orderBy: "create_time", |
|||
// desc降序,升序asc |
|||
sort: "desc", |
|||
}, |
|||
}; |
|||
this.resetForm("form"); |
|||
}, |
|||
// 查看信息 |
|||
viewInfo(row) { |
|||
// this.viewTitle = row.projectName.slice(0, row.projectName.indexOf("[")); |
|||
this.viewTitle = row.projectName; |
|||
this.performanceRecordMsg = row; |
|||
console.log("performanceRecordMsg", row); |
|||
this.viewOpen = true; |
|||
}, |
|||
// 关闭弹窗 |
|||
closeView() { |
|||
this.performanceRecordMsg = {}; |
|||
}, |
|||
/** 搜索按钮操作 */ |
|||
handleQuery() { |
|||
this.queryParams.pageNum = 1; |
|||
this.getList(); |
|||
}, |
|||
/** 重置按钮操作 */ |
|||
resetQuery() { |
|||
this.resetQueryForm(); |
|||
this.handleQuery(); |
|||
}, |
|||
// 多选框选中数据 |
|||
handleSelectionChange(selection) { |
|||
this.ids = selection.map((item) => item.id); |
|||
this.single = selection.length !== 1; |
|||
this.multiple = !selection.length; |
|||
}, |
|||
/** 新增按钮操作 */ |
|||
handleAdd() { |
|||
this.reset(); |
|||
this.open = true; |
|||
this.title = "添加工程业绩记录"; |
|||
}, |
|||
/** 修改按钮操作 */ |
|||
handleUpdate(row) { |
|||
this.reset(); |
|||
const id = row.id || this.ids; |
|||
getAsset(id).then((response) => { |
|||
this.form = response.data; |
|||
if (this.form.financialInformation) { |
|||
this.fileList = JSON.parse(this.form.financialInformation); |
|||
} |
|||
if (this.form.equipmentAssetInformation) { |
|||
this.fileList1 = JSON.parse(this.form.equipmentAssetInformation); |
|||
} |
|||
this.open = true; |
|||
this.title = "修改工程业绩记录"; |
|||
}); |
|||
}, |
|||
/** 提交按钮 */ |
|||
submitForm() { |
|||
this.$refs["form"].validate((valid) => { |
|||
if (valid) { |
|||
this.form.enterpriseId = this.enterpriseId; |
|||
this.form.financialInformation = JSON.stringify(this.fileList); |
|||
this.form.equipmentAssetInformation = JSON.stringify(this.fileList1); |
|||
if (this.form.id != null) { |
|||
updateAsset(this.form).then((response) => { |
|||
if (response.code === 200) { |
|||
this.msgSuccess("修改成功"); |
|||
this.open = false; |
|||
this.getList(); |
|||
} |
|||
}); |
|||
} else { |
|||
addAsset(this.form).then((response) => { |
|||
if (response.code === 200) { |
|||
this.msgSuccess("新增成功"); |
|||
this.open = false; |
|||
this.getList(); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
/** 删除按钮操作 */ |
|||
handleDelete(row) { |
|||
const ids = row.id || this.ids; |
|||
if (ids) { |
|||
this.$confirm("是否删除选中的数据?", "警告", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning", |
|||
}) |
|||
.then(function () { |
|||
return delAsset(ids); |
|||
}) |
|||
.then(() => { |
|||
this.getList(); |
|||
this.msgSuccess("删除成功"); |
|||
}) |
|||
.catch(function () {}); |
|||
} else { |
|||
this.$message.warning("请选择要删除的数据!!"); |
|||
} |
|||
}, |
|||
submitUpload(fileList, name) { |
|||
console.log(name, fileList); |
|||
this[name].push({ |
|||
name: fileList.name, |
|||
fileName: fileList.response.fileName, |
|||
url: fileList.response.url, |
|||
uid: fileList.uid, |
|||
}); |
|||
console.log(name, this[name]); |
|||
}, |
|||
handleRemove(file, name) { |
|||
// console.log(file, fileList1); |
|||
let index = this[name].findIndex((item) => item.uid === file.uid); |
|||
// 删除文件 |
|||
this[name].splice(index, 1); |
|||
}, |
|||
downloadFile(scope, index) { |
|||
// console.log(scope); |
|||
let file = JSON.parse(scope.row.attachment)[index]; |
|||
this.handlePreview(file); |
|||
}, |
|||
downloadFile2(info, index) { |
|||
console.log(info); |
|||
this.handlePreview(info); |
|||
}, |
|||
|
|||
// 点击预览的文件进行下载 |
|||
handlePreview(file) { |
|||
// console.log(file); |
|||
getFileStream({ fileName: file.fileName }).then((res) => { |
|||
const blob = new Blob([res], { |
|||
// type类型后端返回来的数据中会有,根据自己实际进行修改 |
|||
// 表格下载为 application/xlsx,压缩包为 application/zip等, |
|||
type: "application/xlsx", |
|||
}); //excel,pdf等 |
|||
const href = URL.createObjectURL(blob); //创建新的URL表示指定的blob对象 |
|||
const a = document.createElement("a"); //创建a标签 |
|||
a.style.display = "none"; |
|||
a.href = href; // 指定下载链接 |
|||
a.download = file.name; //指定下载文件名 |
|||
a.click(); //触发下载 |
|||
URL.revokeObjectURL(a.href); //释放URL对象 |
|||
}); |
|||
}, |
|||
handleExceed(files, fileList) { |
|||
this.$message.warning( |
|||
`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${ |
|||
files.length + fileList.length |
|||
} 个文件` |
|||
); |
|||
}, |
|||
beforeRemove(file, fileList) { |
|||
return this.$confirm(`确定移除 ${file.name}?`); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "@/assets/css/dialog.scss"; |
|||
</style> |
Loading…
Reference in new issue