|
@ -55,6 +55,16 @@ |
|
|
>新增</el-button |
|
|
>新增</el-button |
|
|
> |
|
|
> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
<el-col :span="1.5"> |
|
|
|
|
|
<el-button |
|
|
|
|
|
type="primary" |
|
|
|
|
|
icon="el-icon-folder-add" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
@click="openAddAll" |
|
|
|
|
|
v-hasPermi="['build:sectionInfo:addAll']" |
|
|
|
|
|
>批量导入</el-button |
|
|
|
|
|
> |
|
|
|
|
|
</el-col> |
|
|
<el-col :span="1.5"> |
|
|
<el-col :span="1.5"> |
|
|
<el-button |
|
|
<el-button |
|
|
type="success" |
|
|
type="success" |
|
@ -66,6 +76,7 @@ |
|
|
>修改</el-button |
|
|
>修改</el-button |
|
|
> |
|
|
> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
|
|
|
<el-col :span="1.5"> |
|
|
<el-col :span="1.5"> |
|
|
<el-button |
|
|
<el-button |
|
|
type="danger" |
|
|
type="danger" |
|
@ -1048,12 +1059,82 @@ |
|
|
@getMapData="getMapData" |
|
|
@getMapData="getMapData" |
|
|
/> |
|
|
/> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 添加或修改农民工考勤表对话框 --> |
|
|
|
|
|
<el-dialog |
|
|
|
|
|
title="批量导入" |
|
|
|
|
|
:visible.sync="uploadParams.addAllOpen" |
|
|
|
|
|
width="1200px" |
|
|
|
|
|
append-to-body |
|
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
|
@closed="closeTemplate" |
|
|
|
|
|
class="templateDialog" |
|
|
|
|
|
> |
|
|
|
|
|
<!-- 限制文件格式 --> |
|
|
|
|
|
<!-- accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" --> |
|
|
|
|
|
<el-upload |
|
|
|
|
|
ref="uploadTemplate" |
|
|
|
|
|
class="upload-template" |
|
|
|
|
|
:action="uploadParams.url" |
|
|
|
|
|
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" |
|
|
|
|
|
:headers="uploadParams.headers" |
|
|
|
|
|
:on-change="handleChangetem" |
|
|
|
|
|
:on-remove="handleRemove" |
|
|
|
|
|
:on-progress="handleFileUploadProgress" |
|
|
|
|
|
:on-success="handleFileSuccess" |
|
|
|
|
|
:data="{ proNo: proNo, proCode: proCode }" |
|
|
|
|
|
:disabled="uploadParams.isUploading" |
|
|
|
|
|
:auto-upload="false" |
|
|
|
|
|
:file-list="uploadParams.templateList" |
|
|
|
|
|
drag |
|
|
|
|
|
multiple |
|
|
|
|
|
> |
|
|
|
|
|
<!-- :show-file-list="false" --> |
|
|
|
|
|
<!-- <el-button size="small" type="primary" plain> |
|
|
|
|
|
<i class="el-icon-upload el-icon--right"></i> |
|
|
|
|
|
点击上传 |
|
|
|
|
|
</el-button> --> |
|
|
|
|
|
<i class="el-icon-upload"></i> |
|
|
|
|
|
<div class="el-upload__text"> |
|
|
|
|
|
<!-- 将文件拖到此处,或 --> |
|
|
|
|
|
<em>点击上传</em> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div slot="tip" class="el-upload__tip"> |
|
|
|
|
|
<el-button |
|
|
|
|
|
type="text" |
|
|
|
|
|
icon="el-icon-download" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
@click="importTemplate" |
|
|
|
|
|
style="font-size: 14px" |
|
|
|
|
|
>模版下载</el-button |
|
|
|
|
|
> |
|
|
|
|
|
<span style="font-size: 16px; color: red; margin-left: 20px" |
|
|
|
|
|
>提示:仅允许导入“xls”或“xlsx”格式文件!</span |
|
|
|
|
|
> |
|
|
|
|
|
</div> |
|
|
|
|
|
</el-upload> |
|
|
|
|
|
|
|
|
|
|
|
<el-table |
|
|
|
|
|
:data="uploadParams.tableData" |
|
|
|
|
|
style="width: 100%" |
|
|
|
|
|
max-height="250" |
|
|
|
|
|
> |
|
|
|
|
|
<el-table-column prop="sectionName" label="标段名称" /> |
|
|
|
|
|
<el-table-column prop="projectName" label="项目名称" /> |
|
|
|
|
|
</el-table> |
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
|
|
<el-button type="primary" @click="submitTemplate">确 定</el-button> |
|
|
|
|
|
<el-button @click="cancelTemplate">取 消</el-button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</el-dialog> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import mapEle from "@/components/map/index.vue"; |
|
|
import mapEle from "@/components/map/index.vue"; |
|
|
import { |
|
|
import { |
|
|
|
|
|
tagTemplate, |
|
|
listSectionInfo, |
|
|
listSectionInfo, |
|
|
getSectionInfo, |
|
|
getSectionInfo, |
|
|
delSectionInfo, |
|
|
delSectionInfo, |
|
@ -1064,6 +1145,7 @@ import { |
|
|
import { getInfo } from "@/api/build/projectInfo"; |
|
|
import { getInfo } from "@/api/build/projectInfo"; |
|
|
import { getAreasData } from "@/api/areas/index"; |
|
|
import { getAreasData } from "@/api/areas/index"; |
|
|
import { regionData, codeToText, TextToCode } from "element-china-area-data"; |
|
|
import { regionData, codeToText, TextToCode } from "element-china-area-data"; |
|
|
|
|
|
import { getToken } from "@/utils/auth"; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: "SectionInfo", |
|
|
name: "SectionInfo", |
|
@ -1071,6 +1153,24 @@ export default { |
|
|
props: ["proNo", "proCode", "projectName"], |
|
|
props: ["proNo", "proCode", "projectName"], |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
|
|
|
// 导入参数 |
|
|
|
|
|
uploadParams: { |
|
|
|
|
|
// templateList: [], |
|
|
|
|
|
// 是否显示 |
|
|
|
|
|
addAllOpen: false, |
|
|
|
|
|
// 是否禁用上传 |
|
|
|
|
|
isUploading: false, |
|
|
|
|
|
// 是否更新已经存在的数据 |
|
|
|
|
|
updateSupport: 0, |
|
|
|
|
|
// 设置上传的请求头部 |
|
|
|
|
|
headers: { |
|
|
|
|
|
jianwei: "jwtech " + getToken(), |
|
|
|
|
|
}, |
|
|
|
|
|
// 上传的地址 |
|
|
|
|
|
url: "thinking/build/sectionInfo/importData", |
|
|
|
|
|
tableData: [], |
|
|
|
|
|
fileTemp: null, |
|
|
|
|
|
}, |
|
|
areasOptionProps: { |
|
|
areasOptionProps: { |
|
|
emitPath: false, |
|
|
emitPath: false, |
|
|
checkStrictly: true, //选择任意一级 |
|
|
checkStrictly: true, //选择任意一级 |
|
@ -1548,6 +1648,170 @@ export default { |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
// 移除excel表 |
|
|
|
|
|
handleRemove(file, fileList) { |
|
|
|
|
|
// console.log(11111111); |
|
|
|
|
|
this.uploadParams.fileTemp = null; |
|
|
|
|
|
}, |
|
|
|
|
|
// excel表上传 |
|
|
|
|
|
handleChangetem(file, fileList) { |
|
|
|
|
|
// console.log(22222222, file); |
|
|
|
|
|
if (file.status !== "ready") return; |
|
|
|
|
|
this.uploadParams.fileTemp = file.raw; |
|
|
|
|
|
// console.log(this.uploadParams.fileTemp); |
|
|
|
|
|
// 判断上传文件格式 |
|
|
|
|
|
if (this.uploadParams.fileTemp) { |
|
|
|
|
|
if ( |
|
|
|
|
|
this.uploadParams.fileTemp.type == |
|
|
|
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || |
|
|
|
|
|
this.uploadParams.fileTemp.type == "application/vnd.ms-excel" |
|
|
|
|
|
) { |
|
|
|
|
|
this.importfxx(this.uploadParams.fileTemp); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message({ |
|
|
|
|
|
type: "warning", |
|
|
|
|
|
message: "附件格式错误,请删除后重新上传!", |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message({ |
|
|
|
|
|
type: "warning", |
|
|
|
|
|
message: "请上传附件!", |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
importfxx(obj) { |
|
|
|
|
|
let _this = this; |
|
|
|
|
|
// 通过DOM取文件数据 |
|
|
|
|
|
this.file = obj; |
|
|
|
|
|
var rABS = false; //是否将文件读取为二进制字符串 |
|
|
|
|
|
var f = this.file; |
|
|
|
|
|
var reader = new FileReader(); |
|
|
|
|
|
FileReader.prototype.readAsBinaryString = function (f) { |
|
|
|
|
|
var binary = ""; |
|
|
|
|
|
var rABS = false; //是否将文件读取为二进制字符串 |
|
|
|
|
|
var pt = this; |
|
|
|
|
|
var wb; //读取完成的数据 |
|
|
|
|
|
var outdata; |
|
|
|
|
|
var reader = new FileReader(); |
|
|
|
|
|
reader.onload = function (e) { |
|
|
|
|
|
var bytes = new Uint8Array(reader.result); |
|
|
|
|
|
// console.log(reader.result); |
|
|
|
|
|
var length = bytes.byteLength; |
|
|
|
|
|
for (var i = 0; i < length; i++) { |
|
|
|
|
|
binary += String.fromCharCode(bytes[i]); |
|
|
|
|
|
} |
|
|
|
|
|
var XLSX = require("xlsx"); |
|
|
|
|
|
if (rABS) { |
|
|
|
|
|
wb = XLSX.read(btoa(fixdata(binary)), { |
|
|
|
|
|
//手动转化 |
|
|
|
|
|
type: "base64", |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
wb = XLSX.read(binary, { |
|
|
|
|
|
type: "binary", |
|
|
|
|
|
// 日期格式 |
|
|
|
|
|
cellDates: true, |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]); //outdata就是读取excel内容之后输出的东西 |
|
|
|
|
|
this.da = [...outdata]; |
|
|
|
|
|
let arr = []; |
|
|
|
|
|
let successNo = 0; |
|
|
|
|
|
this.da.map((v) => { |
|
|
|
|
|
console.log(7777, v); |
|
|
|
|
|
let obj = {}; |
|
|
|
|
|
obj.sectionName = v["标段名称(必填)"]; //ip是表的标题 |
|
|
|
|
|
obj.projectName = v["相关项目名称(必填)"]; //ip是表的标题 |
|
|
|
|
|
obj.projectLegalPerson = v["项目法人单位"]; //ip是表的标题 |
|
|
|
|
|
// obj.nativePlace = v["法定代表人电话"]; //ip是表的标题 |
|
|
|
|
|
obj.engineeringGrade = v["工程等别"]; //ip是表的标题 |
|
|
|
|
|
obj.engineeringPurposes = v["工程用途"]; //ip是表的标题 |
|
|
|
|
|
obj.constructionAddress = v["建设地址"]; //ip是表的标题 |
|
|
|
|
|
obj.adcd = v["行政区划"]; //ip是表的标题 |
|
|
|
|
|
obj.commencementDate = _this.parseTime( |
|
|
|
|
|
v["开工日期"], |
|
|
|
|
|
"{y}-{m}-{d}" |
|
|
|
|
|
); //ip是表的标题 |
|
|
|
|
|
obj.plannedCompletionDate = _this.parseTime( |
|
|
|
|
|
v["计划竣工日期"], |
|
|
|
|
|
"{y}-{m}-{d}" |
|
|
|
|
|
); //ip是表的标题 |
|
|
|
|
|
obj.isKeyProject = v["是否为安全度汛重点工程"]; //ip是表的标题 |
|
|
|
|
|
obj.isPierceProject = v["是否穿破堤坝施工"]; //ip是表的标题 |
|
|
|
|
|
if (obj.sectionName && obj.projectName) { |
|
|
|
|
|
successNo += 1; |
|
|
|
|
|
arr.push(obj); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
if (this.da.length > 0) { |
|
|
|
|
|
_this.$message({ |
|
|
|
|
|
type: "success", |
|
|
|
|
|
message: |
|
|
|
|
|
"一共" + |
|
|
|
|
|
this.da.length + |
|
|
|
|
|
"条数据,成功导入" + |
|
|
|
|
|
successNo + |
|
|
|
|
|
"条数据", |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//return arr |
|
|
|
|
|
// 把读取的excel表格中的内容放进tableData中(这里要改成自己的表的名字) |
|
|
|
|
|
_this.uploadParams.tableData = |
|
|
|
|
|
_this.uploadParams.tableData.concat(arr); |
|
|
|
|
|
|
|
|
|
|
|
console.log( |
|
|
|
|
|
"_this.uploadParams.tableData", |
|
|
|
|
|
_this.uploadParams.tableData |
|
|
|
|
|
); |
|
|
|
|
|
}; |
|
|
|
|
|
reader.readAsArrayBuffer(f); |
|
|
|
|
|
}; |
|
|
|
|
|
if (rABS) { |
|
|
|
|
|
reader.readAsArrayBuffer(f); |
|
|
|
|
|
} else { |
|
|
|
|
|
reader.readAsBinaryString(f); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// 文件上传中处理 |
|
|
|
|
|
handleFileUploadProgress(event, file, fileList) { |
|
|
|
|
|
this.uploadParams.isUploading = true; |
|
|
|
|
|
}, |
|
|
|
|
|
// 文件上传成功处理 |
|
|
|
|
|
handleFileSuccess(response, file, fileList) { |
|
|
|
|
|
this.uploadParams.isUploading = false; |
|
|
|
|
|
if (this.uploadParams.tableData.length) { |
|
|
|
|
|
this.uploadParams.addAllOpen = false; |
|
|
|
|
|
// this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true }); |
|
|
|
|
|
this.getList(); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message({ |
|
|
|
|
|
type: "warning", |
|
|
|
|
|
message: "暂无有效数据", |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
submitTemplate() { |
|
|
|
|
|
this.$refs.uploadTemplate.submit(); |
|
|
|
|
|
}, |
|
|
|
|
|
cancelTemplate() { |
|
|
|
|
|
this.uploadParams.addAllOpen = false; |
|
|
|
|
|
}, |
|
|
|
|
|
closeTemplate() { |
|
|
|
|
|
this.uploadParams.tableData = []; |
|
|
|
|
|
this.$refs.uploadTemplate.clearFiles(); |
|
|
|
|
|
}, |
|
|
|
|
|
openAddAll() { |
|
|
|
|
|
this.uploadParams.addAllOpen = true; |
|
|
|
|
|
}, |
|
|
|
|
|
importTemplate() { |
|
|
|
|
|
tagTemplate().then((res) => { |
|
|
|
|
|
console.log("下载模版", res); |
|
|
|
|
|
this.downloadFile(res, true, res.msg); |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
getMapData(potMsg, lineMsg, allDrawMsg) { |
|
|
getMapData(potMsg, lineMsg, allDrawMsg) { |
|
|
this.potMsg = potMsg; |
|
|
this.potMsg = potMsg; |
|
|
this.lineMsg = lineMsg; |
|
|
this.lineMsg = lineMsg; |
|
@ -1996,6 +2260,11 @@ export default { |
|
|
transform: scale(1); |
|
|
transform: scale(1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
.templateDialog { |
|
|
|
|
|
/deep/ .el-dialog { |
|
|
|
|
|
margin-top: 15vh !important; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
.listTitle { |
|
|
.listTitle { |
|
|
font-size: 14px; |
|
|
font-size: 14px; |
|
|
padding-left: 10px; |
|
|
padding-left: 10px; |
|
|