diff --git a/src/views/keyprojects/outsourced/components/edit.vue b/src/views/keyprojects/outsourced/components/edit.vue index 352ab0a..3079a02 100644 --- a/src/views/keyprojects/outsourced/components/edit.vue +++ b/src/views/keyprojects/outsourced/components/edit.vue @@ -406,9 +406,11 @@ export default { // { ID: '0', NAME: '未申请' }, // { ID: '1', NAME: '申请中' }, // { ID: '2', NAME: '已完成' } - + { ID: '0', NAME: '未开工' }, { ID: '1', NAME: '进行中' }, - { ID: '2', NAME: '已结束' } + { ID: '2', NAME: '已结束' }, + { ID: '-1', NAME: '开工申请中' }, + { ID: '-2', NAME: '结束申请中' } ], smsList: [ { ID: '0', NAME: '是' }, @@ -481,6 +483,8 @@ export default { this.dialogType = 'edit' this.form.OUTSOURCED_ID = this.$parent.OUTSOURCED_ID this.getData() + } else { + this.form.STATE = '0' } this.getCorpInfo() // this.getTreeList() diff --git a/src/views/keyprojects/outsourced/components/info.vue b/src/views/keyprojects/outsourced/components/info.vue index c5a05a9..91a715c 100644 --- a/src/views/keyprojects/outsourced/components/info.vue +++ b/src/views/keyprojects/outsourced/components/info.vue @@ -93,8 +93,11 @@ + 未开工 进行中 已结束 + 开工申请中 + 结束申请中 + + 重点工程定位 + {{ pd.WORK_LATITUDE }}*{{ pd.WORK_LONGITUDE }} + 未定位 + 查看定位 + 安全管理协议{{ index +1 }} {{ item.FILE_NAME }} @@ -315,6 +324,78 @@ export default { goBack() { this.$parent.activeName = 'List' this.$parent.OUTSOURCED_ID = '' + }, + /** + * 初始化天地图对象 + */ + initTDT() { + return new Promise((resolve, reject) => { + if (window.T) { + console.log('天地图初始化成功...') + resolve(window.T) + reject('error') + } + }).then(T => { + window.T = T + }) + }, + /** + * 初始化地图 + * @param {*} lng 经度 + * @param {*} lat 纬度 + * @param {*} zoom 缩放比例(1~18) + */ + initMap(lng, lat, zoom) { + this.initTDT().then((T) => { + const imageURL = 'http://t0.tianditu.gov.cn/img_w/wmts?' + 'SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles' + '&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=e8a16137fd226a62a23cc7ba5c9c78ce' + // 创建自定义图层对象 + this.lay = new window.T.TileLayer(imageURL, { minZoom: 1, maxZoom: 18 }) + // 初始化地图对象 + this.map = new window.T.Map('map') + this.initCenter(lng, lat, zoom) + }) + }, + initCenter(lng, lat, zoom) { + // 设置显示地图的中心点和级别 + if (!this.form.LONGITUDE && !this.form.LATITUDE) { + this.map.centerAndZoom(new window.T.LngLat(119.58, 39.94), zoom) + this.marker && this.map.removeOverLay(this.marker) + } else { + this.map.centerAndZoom(new window.T.LngLat(lng, lat), zoom) + this.marker && this.map.removeOverLay(this.marker) + this.form.LONGITUDE = lng + this.form.LATITUDE = lat + this.marker = new window.T.Marker(new window.T.LngLat(lng, lat)) + // 向地图上添加标注 + this.map.addOverLay(this.marker) + } + // 创建卫星和路网的混合视图 + this.map.setMapType(window.TMAP_HYBRID_MAP) + // 允许鼠标滚轮缩放地图 + this.map.enableScrollWheelZoom() + // 允许鼠标移动地图 + this.map.enableInertia() + // 向地图上添加标注 + this.map.addEventListener('click', this.MapClick) + }, + MapClick(event) { + this.marker && this.map.removeOverLay(this.marker) + this.form.LONGITUDE = event.lnglat.getLng() + this.form.LATITUDE = event.lnglat.getLat() + this.marker = new window.T.Marker(new window.T.LngLat(event.lnglat.getLng(), event.lnglat.getLat())) + // 向地图上添加标注 + this.map.addOverLay(this.marker) + }, + handleMap(row) { + this.form.LATITUDE = '' + this.form.LONGITUDE = '' + this.dialogFormMap = true + this.form.LATITUDE = this.pd.WORK_LATITUDE + this.form.LONGITUDE = this.pd.WORK_LONGITUDE + this.$nextTick(() => { + if (!this.map) this.initMap(this.form.LONGITUDE, this.form.LATITUDE, 16) + else this.initCenter(this.form.LONGITUDE, this.form.LATITUDE, 16) + }) } } } diff --git a/src/views/keyprojects/outsourced/components/list.vue b/src/views/keyprojects/outsourced/components/list.vue index 2947c14..17cfc55 100644 --- a/src/views/keyprojects/outsourced/components/list.vue +++ b/src/views/keyprojects/outsourced/components/list.vue @@ -137,15 +137,19 @@ @@ -183,6 +187,7 @@ export default { directives: { waves }, data() { return { + userInfoUserId: JSON.parse(sessionStorage.getItem('user')).USER_ID, qrcodeStr: '', listLoading: true, add: false, @@ -233,8 +238,11 @@ export default { dialogType: 'add', loginUserId: JSON.parse(sessionStorage.getItem('user')).USER_ID, stateList: [ + { ID: '0', NAME: '未开工' }, { ID: '1', NAME: '进行中' }, - { ID: '2', NAME: '已结束' } + { ID: '2', NAME: '已结束' }, + { ID: '-1', NAME: '开工申请中' }, + { ID: '-2', NAME: '结束申请中' } ] } }, @@ -326,27 +334,50 @@ export default { this.$parent.OUTSOURCED_ID = ID }, + handleState(id) { + this.$confirm('确定要开工吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/outsourced/updateState', + { + OUTSOURCED_ID: id, + OPERATOR: this.userInfoUserId, // 修改人 + STATE: '1' + } + ).then((data) => { + this.$message({ + message: '已开工', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + }) + }, handleJie(id) { this.$confirm('确定要结束吗?', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' - }).then((data) => { + }).then(() => { this.listLoading = true requestFN( - '/outsourced/jie', + '/outsourced/updateState', { - OUTSOURCED_ID: id + OUTSOURCED_ID: id, + OPERATOR: this.userInfoUserId, // 修改人 + STATE: '2' } ).then((data) => { - if (data.code == '500') { - this.listLoading = false - this.$message({ - message: data.msg, - type: 'error' - }) - return - } this.$message({ message: '已结束', type: 'success'