立项计划导入
This commit is contained in:
@@ -332,12 +332,32 @@
|
||||
@checkedRole="checkedRole"
|
||||
:nodeList="nodeList"
|
||||
></Role-tree>
|
||||
<!-- 选择起草责任单位-->
|
||||
<Mechanism-tree
|
||||
is-title="选择起草责任单位"
|
||||
:is-visible.sync="modalshowflagZRBM"
|
||||
:nodeList="nodeListZRBM"
|
||||
@checkedRole="drawerCheckZRBM"
|
||||
/>
|
||||
<!--导入模态窗-->
|
||||
<el-dialog width="400px" :visible.sync="importModalshowflag" title="导入文件" :footer-hide="true">
|
||||
<el-upload
|
||||
drag
|
||||
:show-file-list="showUploadlist"
|
||||
:on-success="importFileSuccess"
|
||||
:on-remove="removeOneFile"
|
||||
:before-upload="beforeUpload"
|
||||
:action="importExcelUrl"
|
||||
:file-list="defaultFileList"
|
||||
accept=".xlsx"
|
||||
name="file"
|
||||
ref="importFileAboutStand">
|
||||
<div style="padding: 20px 0">
|
||||
<i class="el-icon-upload" style="color: #3399ff"></i>
|
||||
<p>点击或拖拽上传文件</p>
|
||||
</div>
|
||||
</el-upload>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -358,6 +378,10 @@ export default {
|
||||
name: "qbzxdlxStep1",
|
||||
data() {
|
||||
return {
|
||||
importModalshowflag: false, //导入弹窗
|
||||
showUploadlist: true, // 导入过程中新增数据时,如果数据错误,不出现导入列表
|
||||
importExcelUrl: 'api/att/attFile/upload', // 导入EXCEL文档
|
||||
defaultFileList: [], // 默认显示
|
||||
uploadFileListPath: "api/att/attFile/upload", // 上传的地址
|
||||
fileInfoList: [], // 上传的附件
|
||||
fileIds: [], // 上传的附件
|
||||
@@ -483,6 +507,51 @@ export default {
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
onFileExceed() {
|
||||
this.$message.error('最多上传一个文件')
|
||||
},
|
||||
// 导入标准数据成功后执行
|
||||
importFileSuccess (res, file, fileList) {
|
||||
let files = {}
|
||||
if (res.ok) {
|
||||
files.attId = res.data.attId
|
||||
files.fileName = res.data.name
|
||||
if (res.data.standNum != null && res.data.standNum !== '') {
|
||||
files.standNumSplit = res.data.standNum
|
||||
}
|
||||
if (res.data.standName != null && res.data.standName !== '') {
|
||||
files.standNameSplit = res.data.standName
|
||||
}
|
||||
this.defaultFileList.push(file)
|
||||
const _formData = new FormData()
|
||||
_formData.append('standNumSplit', files.standNumSplit)
|
||||
_formData.append('standNameSplit', files.standNameSplit)
|
||||
_formData.append('fileType', files.fileType)
|
||||
_formData.append('file', file.raw)
|
||||
this.$http.postData('importWkExcel/importData', _formData,{
|
||||
_this: this
|
||||
}, res => {
|
||||
if(res.ok){
|
||||
this.qblx_pageData.qblxData = res.data
|
||||
}else{
|
||||
alert(res.message)
|
||||
}
|
||||
})
|
||||
this.$message.success('文件上传成功')
|
||||
this.importModalshowflag = false
|
||||
this.$nextTick(() => {
|
||||
this.$refs.importFileAboutStand.clearFiles()
|
||||
})
|
||||
} else {
|
||||
this.defaultFileList = []
|
||||
this.uploadFilesplitEo.attId = ''
|
||||
this.$message.error(res.message)
|
||||
}
|
||||
},
|
||||
//删除文件时执行
|
||||
removeOneFile(){
|
||||
|
||||
},
|
||||
getWorkBtn(){
|
||||
this.page = 1
|
||||
this.getWorkData()
|
||||
@@ -787,7 +856,7 @@ export default {
|
||||
|
||||
/** 数据导入到列表 */
|
||||
uploadQblx() {
|
||||
|
||||
this.importModalshowflag = true
|
||||
},
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user