diff --git a/src/api/maintainmanagement/index.js b/src/api/maintainmanagement/index.js index 509d44d..2a6dcba 100644 --- a/src/api/maintainmanagement/index.js +++ b/src/api/maintainmanagement/index.js @@ -39,3 +39,19 @@ export function del(id) { params:{ id } }) } + +export function importShow(data) { + return request({ + url: '/api/admin/maintain-plan/import-show', + method: 'post', + data + }) +} + +export function importPlan(data) { + return request({ + url: '/api/admin/maintain-plan/import', + method: 'post', + data + }) +} diff --git a/src/views/rain/maintain/plan copy.vue b/src/views/rain/maintain/plan copy.vue new file mode 100644 index 0000000..dd86bb4 --- /dev/null +++ b/src/views/rain/maintain/plan copy.vue @@ -0,0 +1,440 @@ + + + + + diff --git a/src/views/rain/maintain/plan.vue b/src/views/rain/maintain/plan.vue index 19877df..6872574 100644 --- a/src/views/rain/maintain/plan.vue +++ b/src/views/rain/maintain/plan.vue @@ -8,7 +8,38 @@
- + +
+ + + + + + 点击上传 + + + + +
+ +
@@ -44,14 +75,24 @@ - + + + + + + + + - - + + - + @@ -100,7 +141,27 @@ - + + + + + + + + + + + + + + + + + + + + + + @@ -128,8 +189,44 @@ 保存 - - + + + +
+ + + + + + + + +
+ + +
@@ -139,12 +236,19 @@ get, store, save, - del + del, + importShow, + importPlan } from '../../../api/maintainmanagement/index.js' import { listCommonuser } from '../../../api/common.js' - + import { + listroad + } from '../../../api/basic/road.js' + import { + getToken + } from '@/utils/auth' import { listarea } from '../../../api/basic/area.js' @@ -164,10 +268,25 @@ areaList:[], plantypes:[{ id:1, - value:"日常雨水设施养护" + value:"雨水管道疏挖" },{ id:2, - value:"在建工地养护" + value:"雨水管道疏通" + },{ + id:3, + value:"汛期助排" + },{ + id:4, + value:"污泥外运" + },{ + id:5, + value:"出水口排查" + },{ + id:6, + value:"专项处理" + },{ + id:7, + value:"维修" }], dayList:[], dateRange:[], @@ -180,41 +299,79 @@ page: 1, page_size: 15, total: 0 + }, + roadsList: [], + roadName: "", + roaddisabled: false, + roadloading: false, + fileList:[], + uploadOther: { + token: "" }, - form: { - name:"", + form: { + name:"养护计划", item_type:"", area_id:"", - day:"", + road_id:"", + inspection_well:0, + side_well:0, + master_pipe:0, + branch_pipe:0, start_date:"", - end_date:"", - responsible_id:"", - remark:"" + end_date:"" }, - rules: { - name:[{ - required: true, - message: '请填写养护名称', - trigger: 'blur', - }], + rules: { area_id:[{ required: true, message: '请选择所属片区', trigger: 'blur', }] - }, + }, + fileData:[], + dialogFileVisible:false, + filecolumns:[{ + field: "序号", + title: "序号", + type: "string", + align: "left", + },{ + field: "路名", + title: "路名", + type: "string", + align: "left", + },{ + field: "start_date", + title: "开始时间", + type: "date", + align: "left", + },{ + field: "end_date", + title: "结束时间", + type: "date", + align: "left", + },{ + field: "master_pipe", + title: "主管", + type: "string", + align: "left", + },{ + field: "branch_pipe", + title: "支管", + type: "string", + align: "left", + }], columns: [{ - field: "name", - title: "养护名称", + field: "roadName", + title: "所属道路", type: "string", align: "left", width:240 }, { field: "item_type_name", - title: "养护项目", + title: "养护类型", type: "string", align: "center", width:180 @@ -226,14 +383,6 @@ width:180, align: "center" }, - { - field: "day", - title: "循环机制", - type: "string", - width:120, - align: "center" - - }, { field: "daterange", title: "养护周期", @@ -243,12 +392,34 @@ }, { - field: "responsibleName", - title: "责任人", + field: "inspection_well", + title: "窨井", type: "string", align: "center", width:180, }, + { + field: "side_well", + title: "边井", + type: "string", + align: "center", + width:180, + }, + { + field: "master_pipe", + title: "主管数", + type: "string", + align: "center", + width:180, + }, + { + field: "branch_pipe", + title: "支管数", + type: "string", + align: "center", + width:180, + }, + { field: "created_at", title: "提交日期", @@ -281,6 +452,7 @@ var topHeight = 50; //页面 头部 let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight - 20; that.tableHeight = tableHeight; + this.uploadOther.token = getToken(); listarea({ page: 1, page_size: 999, @@ -322,8 +494,9 @@ m.item_type_name = k.value } } - m.area_name = m.area_info.name - m.responsibleName = m.responsible?m.responsible.name :"" + m.area_name = m.area_info?m.area_info.name:"" + m.roadName = m.road?m.road.name:"" + // m.responsibleName = m.responsible?m.responsible.name :"" } this.tableData = response.data; this.paginations.total = response.total; @@ -336,9 +509,12 @@ info(obj) { var that = this; get(obj.id).then(res => { - let result = Object.assign(that.form, res); + let result = Object.assign(that.form, res); + that.roadName = "" + that.roaddisabled = true // this.$set(that.form,res); that.form = result; + that.roadName = result.road?result.road.name:"" that.dateRange = [result.start_date,result.end_date] }).catch(error => { @@ -407,9 +583,114 @@ resetForm(formName) { var that = this; that.dateRange = []; + that.roadName = "" + that.roaddisabled = false this.$refs[formName].resetFields(); that.dialogFormVisible = false; + }, + chooseRoad(val) { + this.form.road_id = val + }, + remoteRoad() { + this.roadsList = [] + }, + remoteMethod(query) { + if (query != '') { + this.roadloading = true + listroad({ + name: query + }).then(res => { + this.roadloading = false + this.roadsList = res.data + }) + } else { + this.roadsList = [] + } + }, + handleRemove(file, fileList) { + console.log(file, fileList); + }, + handlePreview(file) { + console.log(file); + }, + handleExceed(files, fileList) { + this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); + }, + beforeRemove(file, fileList) { + return this.$confirm(`确定移除 ${ file.name }?`); + }, + handleSuccess(response, file, fileList){ + // this.fileList = response + var nowyear = "" + var k = 0 + for(var i=0;i5){ + nowyear = result.start_date.substring(0,4) + }else{ + m.start_date = nowyear+"-"+result.start_date.replace(".","-") + m.end_date = nowyear+"-"+result.end_date.replace(".","-") + let startAll = m.start_date.split("-") + let endAll = m.end_date.split("-") + startAll[1] = startAll[1]<10? "0"+startAll[1]:startAll[1] + startAll[2] = startAll[2]<10? "0"+startAll[2]:startAll[2] + endAll[1] = endAll[1]<10? "0"+endAll[1]:endAll[1] + endAll[2] = endAll[2]<10? "0"+endAll[2]:endAll[2] + m.start_date = startAll[0]+"-"+startAll[1]+"-"+startAll[2] + m.end_date = endAll[0]+"-"+endAll[1]+"-"+endAll[2] + } + }else{ + let dateStr = result['日期']+"" + dateStr = dateStr.replace(";",";") + dateStr = dateStr.replace("-",";") + if(dateStr.indexOf(';')!=-1){ + let dateall = dateStr.split(";") + m.start_date = nowyear+"-"+dateall[0].replace(".","-") + m.end_date = nowyear+"-"+dateall[1].replace(".","-") + let startAll = m.start_date.split("-") + let endAll = m.end_date.split("-") + startAll[1] = startAll[1]<10? "0"+startAll[1]:startAll[1] + startAll[2] = startAll[2]<10? "0"+startAll[2]:startAll[2] + endAll[1] = endAll[1]<10? "0"+endAll[1]:endAll[1] + endAll[2] = endAll[2]<10? "0"+endAll[2]:endAll[2] + m.start_date = startAll[0]+"-"+startAll[1]+"-"+startAll[2] + m.end_date = endAll[0]+"-"+endAll[1]+"-"+endAll[2] + + } + } + if(result['序号']!=""&&result['序号']!="合计"){ + this.fileData.push(m) + } + + } + } + this.dialogFileVisible = true + + }, + submitFile(){ + console.log(this.fileData) + // return + importPlan({ + data:this.fileData + }).then(res=>{ + this.$Message.success('操作成功'); + this.fileList = [] + this.fileData = [] + this.load(); + this.dialogFileVisible = false + }).catch(error=>{ + this.$Message.error('检查信息是否正确,修改后再次提交'); + console.log(error) + reject(error) + }) + }, + resetFile(){ + this.fileList = [] + this.fileData = [] + this.dialogFileVisible = false } } } @@ -421,5 +702,16 @@ } .width100{ width:100%; + } + .upfile{ + display: inline-block; + vertical-align: bottom; + margin-left: 10px; + } + .el-upload-list.el-upload-list--text{ + display: inline-block; + height: 32px; + line-height: 32px; + vertical-align: top; }