基础功能:勘查日志和项目管理前端开发
This commit is contained in:
parent
210dd0fcdb
commit
1958d538fb
|
|
@ -42,6 +42,7 @@
|
|||
"sortablejs": "1.10.2",
|
||||
"splitpanes": "2.4.1",
|
||||
"vue": "2.6.12",
|
||||
"vue-baidu-map": "^0.21.22",
|
||||
"vue-count-to": "1.0.13",
|
||||
"vue-cropper": "0.5.5",
|
||||
"vue-router": "3.4.9",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* 动态加载百度地图api函数
|
||||
* @param {String} ak 百度地图AK,必传
|
||||
*/
|
||||
export default function loadBMap(ak) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (typeof window.BMap !== "undefined") {
|
||||
resolve(window.BMap);
|
||||
return true;
|
||||
}
|
||||
window.onBMapCallback = function() {
|
||||
resolve(window.BMap);
|
||||
return true;
|
||||
};
|
||||
const script = document.createElement("script");
|
||||
script.type = "text/javascript";
|
||||
script.src =
|
||||
`"http://api.map.baidu.com/api?v=3.0&ak=PM43nB8eDNTBrXkQwGrTQFcmOni3Z9nO"`;
|
||||
script.onerror = reject;
|
||||
document.head.appendChild(script);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询项目列表
|
||||
export function listProject(query) {
|
||||
return request({
|
||||
url: '/basic/project/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 新增项目
|
||||
export function addProject(data) {
|
||||
return request({
|
||||
url: '/basic/project',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询项目详细
|
||||
export function getProject(proId) {
|
||||
return request({
|
||||
url: '/basic/project/' + proId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 修改项目
|
||||
export function updateProject(data) {
|
||||
return request({
|
||||
url: '/basic/project',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除项目
|
||||
export function delProject(proId) {
|
||||
return request({
|
||||
url: '/basic/project/' + proId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询项目列表
|
||||
export function listSurvey(query) {
|
||||
return request({
|
||||
url: '/basic/survey/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 新增项目
|
||||
export function addSurvey(data) {
|
||||
return request({
|
||||
url: '/basic/survey',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询项目详细
|
||||
export function getSurvey(proId) {
|
||||
return request({
|
||||
url: '/basic/survey/' + proId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 修改项目
|
||||
export function updateSurvey(data) {
|
||||
return request({
|
||||
url: '/basic/survey',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除项目
|
||||
export function delSurvey(proId) {
|
||||
return request({
|
||||
url: '/basic/survey/' + proId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询项目下拉框
|
||||
export function projectSelect() {
|
||||
return request({
|
||||
url: '/basic/project/list',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
|
@ -69,6 +69,11 @@ DictData.install()
|
|||
* please remove it before going online! ! !
|
||||
*/
|
||||
|
||||
import BaiduMap from 'vue-baidu-map'
|
||||
Vue.use(BaiduMap, {
|
||||
ak: "PM43nB8eDNTBrXkQwGrTQFcmOni3Z9nO"
|
||||
})
|
||||
|
||||
Vue.use(Element, {
|
||||
size: Cookies.get('size') || 'medium' // set element-ui default size
|
||||
})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,358 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="项目名称" prop="proName">
|
||||
<el-input
|
||||
v-model="queryParams.proName"
|
||||
placeholder="请输入项目名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属单位" prop="unit">
|
||||
<el-input
|
||||
v-model="queryParams.unit"
|
||||
placeholder="请输入所属单位"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人" prop="chargePerson">
|
||||
<el-input
|
||||
v-model="queryParams.chargePerson"
|
||||
placeholder="请输入负责人"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" 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"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['basic:project:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['basic:project:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="proList" @selection-change="handleSelectionChange">
|
||||
<el-table-column label="序号" align="center" type="index" />
|
||||
<el-table-column label="项目名称" align="center" prop="proName" />
|
||||
<el-table-column label="项目类型" align="center" prop="proType" />
|
||||
<el-table-column label="所属单位" align="center" prop="unit" />
|
||||
<el-table-column label="负责人" align="center" prop="chargePerson" />
|
||||
<el-table-column label="项目所在地" align="center" prop="location" width="180" />
|
||||
<el-table-column label="备注" align="center" prop="remark" width="180" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['basic:project:edit']"
|
||||
>编辑</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['basic:project:remove']"
|
||||
>删除</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="550px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="项目名称" prop="proName">
|
||||
<el-input v-model="form.proName" placeholder="请输入项目名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目类型" prop="proType">
|
||||
<el-input v-model="form.proType" placeholder="请输入项目类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="建设单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入建设单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人" prop="chargePerson">
|
||||
<el-input v-model="form.chargePerson" placeholder="请输入负责人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目所在地" prop="location">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="mapAdd"
|
||||
>地图选点</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<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="地图选点" :visible.sync="mapVisible" :fullscreen=false id="mapDialog" :close-on-click-modal="false" style="margin-top: 8.5vh;">
|
||||
<div style="margin-bottom: 10px">
|
||||
<label>关键词:<input v-model="keyword" class="lineinput" style="width:200px" size="mini"></label>
|
||||
<label>地区:<input v-model="location2" class="lineinput" style="width:200px" size="mini"></label>
|
||||
</div>
|
||||
<baidu-map class="map" :center="center" :zoom="zoom" @ready="handler"
|
||||
:scroll-wheel-zoom="true"
|
||||
@click="clickEvent"
|
||||
ak="你的ak">
|
||||
<bm-navigation anchor="BMAP_ANCHOR_TOP_RIGHT"></bm-navigation>
|
||||
<bm-city-list anchor="BMAP_ANCHOR_TOP_LEFT"></bm-city-list>
|
||||
<bm-geolocation anchor="BMAP_ANCHOR_BOTTOM_RIGHT" :showAddressBar="true" :autoLocation="true" @locationSuccess="getLoctionSuccess" ></bm-geolocation>
|
||||
<bm-view :style="{width:'100%',height: '300px',flex: 1,marginTop:'0px'}"></bm-view>
|
||||
<bm-local-search :keyword="keyword" :auto-viewport="false" :location="location2" style="height: 150px;overflow-y: scroll;margin: 2px 0"></bm-local-search>
|
||||
</baidu-map>
|
||||
<div class="demo-input-suffix" style="margin-top: 2vh">
|
||||
<el-link type="info">经度:</el-link><el-input class="lineinput" style="width:200px" size="mini" v-model.number="form.longitude" :disabled="true"></el-input>
|
||||
<el-link type="info"> 纬度:</el-link><el-input class="lineinput" style="width:200px" size="mini" v-model.number="form.latitude" :disabled="true"></el-input>
|
||||
<el-link type="info"> 位置:</el-link><el-input class="lineinput" style="width:200px" size="mini" v-model="form.location" :disabled="true"></el-input>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer" style="margin-top: -30px">
|
||||
<el-button type="warning" size="small" icon="el-icon-close" @click.native="mapVisible = false">取消</el-button>
|
||||
<el-button type="primary" size="small" icon="el-icon-check" @click="findLocation">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listProject, getProject, delProject, addProject, updateProject } from "@/api/basic/project"
|
||||
import {BaiduMap,BmNavigation,BmView,BmGeolocation,BmCityList,BmLocalSearch} from 'vue-baidu-map'
|
||||
|
||||
export default {
|
||||
name: "Post",
|
||||
dicts: ['sys_normal_disable'],
|
||||
data() {
|
||||
return {
|
||||
location2: '',
|
||||
keyword: '',
|
||||
center: {lng: 111.752912, lat: 40.832246},
|
||||
zoom: 12,
|
||||
mapVisible: false,
|
||||
iconUrl:'http://api0.map.bdimg.com/images/marker_red_sprite.png',
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 岗位表格数据
|
||||
proList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
proName: undefined,
|
||||
unit: undefined,
|
||||
chargePerson: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
longitude:'',
|
||||
latitude:'',
|
||||
location:'',
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
proName: [
|
||||
{ required: true, message: "项目名称不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询岗位列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
listProject(this.queryParams).then(response => {
|
||||
this.proList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
proId: undefined,
|
||||
proName: undefined,
|
||||
proType: undefined,
|
||||
unit: undefined,
|
||||
chargePerson: undefined,
|
||||
location: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
this.resetForm("form")
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm")
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = "新增项目"
|
||||
},
|
||||
/** 地图选点操作 */
|
||||
mapAdd() {
|
||||
this.mapVisible = true
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const proId = row.proId || this.ids
|
||||
getProject(proId).then(response => {
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = "修改项目"
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.proId != undefined) {
|
||||
updateProject(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addProject(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** 地图选点 */
|
||||
handler ({BMap, map}) {
|
||||
let _this = this; // 设置一个临时变量指向vue实例,因为在百度地图回调里使用this,指向的不是vue实例;
|
||||
let geolocation = new BMap.Geolocation();
|
||||
geolocation.getCurrentPosition(function(r){
|
||||
console.log(r);
|
||||
_this.center = {lng: r.longitude, lat: r.latitude}; // 设置center属性值
|
||||
_this.autoLocationPoint = {lng: r.longitude, lat: r.latitude}; // 自定义覆盖物
|
||||
_this.initLocation = true;
|
||||
},{enableHighAccuracy: true})
|
||||
window.map = map;
|
||||
},
|
||||
//点击地图监听
|
||||
clickEvent(e){
|
||||
map.clearOverlays();
|
||||
let Icon_0 = new BMap.Icon("http://api0.map.bdimg.com/images/marker_red_sprite.png", new BMap.Size(64, 64), {anchor: new BMap.Size(18, 32),imageSize: new BMap.Size(36, 25)});
|
||||
let myMarker = new BMap.Marker(new BMap.Point(e.point.lng, e.point.lat),{icon: Icon_0});
|
||||
map.addOverlay(myMarker);
|
||||
//用所定位的经纬度查找所在地省市街道等信息
|
||||
let point = new BMap.Point(e.point.lng, e.point.lat);
|
||||
let gc = new BMap.Geocoder();
|
||||
let _this = this;
|
||||
gc.getLocation(point, function (rs) {
|
||||
let addComp = rs.addressComponents;
|
||||
_this.form.location = rs.address;
|
||||
|
||||
});
|
||||
this.form.longitude = e.point.lng;
|
||||
this.form.latitude = e.point.lat;
|
||||
},
|
||||
//定位成功回调
|
||||
getLoctionSuccess(point, AddressComponent, marker){
|
||||
map.clearOverlays();
|
||||
let Icon_0 = new BMap.Icon("http://api0.map.bdimg.com/images/marker_red_sprite.png", new BMap.Size(64, 64), {anchor: new BMap.Size(18, 32),imageSize: new BMap.Size(36, 36)});
|
||||
let myMarker = new BMap.Marker(new BMap.Point(point.point.lng, point.point.lat),{icon: Icon_0});
|
||||
map.addOverlay(myMarker);
|
||||
this.form.longitude = point.point.lng;
|
||||
this.form.latitude = point.point.lat;
|
||||
},
|
||||
//返回选中点的位置
|
||||
findLocation(){
|
||||
this.mapVisible = false
|
||||
this.$emit("findlocdata",this.form)
|
||||
this.temp.location=this.keyword
|
||||
this.temp.lng=this.form.longitude
|
||||
this.temp.lat=this.form.latitude
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const proIds = row.proId || this.ids
|
||||
this.$modal.confirm('是否确认删除项目编号为"' + proIds + '"的数据项?').then(function() {
|
||||
return delProject(proIds)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('basic/project/export', {
|
||||
...this.queryParams
|
||||
}, `项目信息表.xlsx`)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,284 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="项目名称" prop="proName">
|
||||
<el-input
|
||||
v-model="queryParams.proName"
|
||||
placeholder="请输入项目名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="堪查人" prop="surveyUser">
|
||||
<el-input
|
||||
v-model="queryParams.surveyUser"
|
||||
placeholder="请输入堪查人"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="勘查时间" prop="surveyTime">
|
||||
<el-date-picker v-model="queryParams.surveyTime"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择日期选择" clearable>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" 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"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['basic:survey:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="proList" @selection-change="handleSelectionChange">
|
||||
<el-table-column label="序号" align="center" type="index" />
|
||||
<el-table-column label="所属项目" align="center" prop="proName" />
|
||||
<el-table-column label="堪查人" align="center" prop="surveyUser" />
|
||||
<el-table-column label="勘查附件" align="center" prop="surveyAttach" />
|
||||
<el-table-column label="勘查内容" align="center" prop="surveyContent" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['basic:survey:edit']"
|
||||
>编辑</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['basic:survey:remove']"
|
||||
>删除</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="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="项目名称" prop="proId">
|
||||
<el-select v-model="form.proId" placeholder="请选择项目">
|
||||
<el-option
|
||||
v-for="item in projectOptions"
|
||||
:key="item.proId"
|
||||
:label="item.proName"
|
||||
:value="item.proId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="勘查时间" prop="surveyTime">
|
||||
<el-date-picker v-model="form.surveyTime"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择日期选择" clearable>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="勘查人" prop="surveyUser">
|
||||
<el-input v-model="form.surveyUser" placeholder="请输入勘查人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="勘查内容" prop="surveyContent">
|
||||
<el-input v-model="form.surveyContent" placeholder="请输入勘查内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="勘查附件" prop="surveyAttach">
|
||||
<el-upload
|
||||
action=""
|
||||
:auto-upload="false"
|
||||
:multiple="true"
|
||||
:limit="3"
|
||||
:on-change="handleFileChange"
|
||||
:http-request="customUpload"
|
||||
:file-list="fileList">
|
||||
<el-button size="small">上传附件</el-button>
|
||||
<div slot="tip">支持扩展名:.doc/.pdf/.xlsx</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listSurvey, getSurvey, delSurvey, addSurvey, updateSurvey, projectSelect } from "@/api/basic/survey"
|
||||
|
||||
export default {
|
||||
name: "Post",
|
||||
dicts: ['sys_normal_disable'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 项目选择
|
||||
projectOptions: [],
|
||||
// 岗位表格数据
|
||||
proList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 日期范围
|
||||
dateRange: [],
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
proName: undefined,
|
||||
unit: undefined,
|
||||
chargePerson: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
proId: [
|
||||
{ required: true, message: "项目名称不能为空", trigger: "blur" }
|
||||
],
|
||||
surveyTime: [
|
||||
{ required: true, message: "勘查时间不能为空", trigger: "blur" }
|
||||
],
|
||||
surveyUser: [
|
||||
{ required: true, message: "勘查人不能为空", trigger: "blur" }
|
||||
],
|
||||
surveyContent: [
|
||||
{ required: true, message: "勘查内同不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询岗位列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
listSurvey(this.queryParams).then(response => {
|
||||
this.proList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
proId: undefined,
|
||||
proName: undefined,
|
||||
proType: undefined,
|
||||
unit: undefined,
|
||||
chargePerson: undefined,
|
||||
location: undefined,
|
||||
remark: undefined,
|
||||
dataRange: undefined
|
||||
}
|
||||
this.resetForm("form")
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm")
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
projectSelect().then(response => {
|
||||
this.open = true
|
||||
this.projectOptions = response.rows
|
||||
this.title = "添加勘查日志"
|
||||
})
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const id = row.id || this.ids
|
||||
projectSelect().then(response => {
|
||||
this.projectOptions = response.rows
|
||||
})
|
||||
getSurvey(id).then(response => {
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = "修改勘查日志"
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != undefined) {
|
||||
updateSurvey(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addSurvey(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
this.$modal.confirm('是否确认删除项目编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delSurvey(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue