Pārlūkot izejas kodu

地图、模具详情

sunyadv 5 gadi atpakaļ
vecāks
revīzija
416ac4e7a5

+ 27 - 1
ys_vue/index.html

@@ -49,6 +49,31 @@
                 line-height: 20px;
                 background-color: #fff;
             }
+
+            div.info-item {
+                width: 300px;
+                height: 30px;
+                line-height: 30px;
+                padding:0 8px;
+            }
+
+            div.info-item a {
+                color: #20a0ff;
+                cursor: pointer;
+            }
+
+            span.info-state {
+                float:right;
+            }
+
+            span.info-ball {
+                display: inline-block;
+                width:10px;
+                height:10px;
+                border-radius: 50%;
+                margin-right: 10px;
+                line-height: 30px;
+            }
             
             .customWidth {
                 width: 675px!important;
@@ -82,7 +107,8 @@
             /*取消消息列表弹出框的内边距*/
             .popover-self {
                 padding: 0 !important;
-            }    </style>
+            }    
+        </style>
     </head>
     <body>
         <div id="app"></div>

+ 3 - 0
ys_vue/src/port.js

@@ -11,6 +11,9 @@ export default {
     pwd: {
         resetPwd: '/user/updatePassword'
     },
+    map: {
+        mapList: '/company/getCoutomCompanyAndMouldsByUser' //生产方公司和公司下所属的模具
+    },
     project: {
         userList: '/user/list',  //用户列表
         addUser: '/user/add',  //添加或修改用户

+ 86 - 57
ys_vue/src/views/map/map.vue

@@ -12,70 +12,99 @@
 			}
 		},
 		methods: {
-            
-        },
-        mounted() {
-            let height = window.innerHeight;
-            height = height - 100;
-            this.$el.style.height = height + "px";
+            getMap() {
+                var _this = this
+                this.http.post( this.port.map.mapList, {},
+                res => {
+                    if (res.code == "ok") {
+                        var list = res.data;
 
-            var map = new AMap.Map('container', {
-                resizeEnable: true,   
-                zoom: 5
-            });
-            map.clearMap();  
-            var markers = [] , 
-                infoWindow , 
-                data=[{"fLong":'112.00003','fLati':'30.2345'},{"fLong":'115.00003','fLati':'18.2345'},{"fLong":'114.00003','fLati':'38.2345'},{"fLong":'116.00003','fLati':'38.2345'}];
+                        var map = new AMap.Map('container', {
+                            resizeEnable: true,   
+                            zoom: 5
+                        });
+                        map.clearMap();  
+                        var markers = [] , 
+                            infoWindow , 
+                            data = list;
 
-            var marker;
-            for(var i in data){
-                var jfong=[ data[i].fLong , data[i].fLati ];
-				marker = new AMap.Marker({
-                    position: jfong,
-                    zIndex: 101,
-                    map:map
-				});	
-                marker.setMap(map);	
-                marker.orderON=data[i].orderON;
-                marker.tranOFID=data[i].tranOFID;
-                marker.fhadd=data[i].fhadd;
-                marker.sAdd=data[i].sAdd;
-                marker.status=data[i].status;			
-			    marker.on('click', function(data){
-                    var MyComponent = Vue.extend({
-                        template: "<div class='window'>" +
-                            "<div class='info-top'><div>方恒假日酒店<span>价格:318</span></div><i class='el-icon-close' @click='closeInfoWindow()'></i></div>" +
-                            "<div class='info-middle'>" + 
-                                "地址:北京市朝阳区阜通东大街6号院3号楼东北8.3公里<br>" +
-                                "电话:010-64733333<br>" +
-                                "经度:" + data.lnglat.lng + "<br>" +
-                                "纬度:" + data.lnglat.lat + "<br>" +
-                                "<a href='https://ditu.amap.com/detail/B000A8URXB?citycode=110105'>详细信息</a>" +
-                            "</div>" +
-                        "</div>",
-                        methods:{
-                            closeInfoWindow:function() {
-                                map.clearInfoWindow();
-                            }
+                        var marker;
+                        for(var i in data){
+                            var jfong=[ data[i].ylng , data[i].xlat];
+                            marker = new AMap.Marker({
+                                position: jfong,
+                                zIndex: 101,
+                                map:map
+                            });	
+                            marker.setMap(map);	
+                            marker.msg = data[i];
+                            marker.on('click', function(data){
+                                console.log(data)
+                                var str = "<div class='window'>" +
+                                    "<div class='info-top'><div>"+ data.target.msg.companyName +"</div><i class='el-icon-close' @click='closeInfoWindow()'></i></div>" +
+                                    "<div class='info-middle'>";
+                                    for(var i in data.target.msg.list){
+                                        str += "<div class='info-item'><a @click='jumpToMold("+ data.target.msg.list[i].id +")'>" + data.target.msg.list[i].modelName + "(" + data.target.msg.list[i].modelNo + ")</a>"
+                                            if(data.target.msg.list[i].state=='0'){
+                                                str += "<span class='info-state'><span class='info-ball' style='background:#CD2626;'></span>静止</span>"
+                                            } else {
+                                                str += "<span class='info-state'><span class='info-ball' style='background:#00CD66;'></span>运行</span>"
+                                            }
+                                        str += "</div>"
+                                    }
+                                    str += "</div>" +
+                                "</div>"
+
+                                var MyComponent = Vue.extend({
+                                    template: str ,
+                                    methods:{
+                                        closeInfoWindow:function() {
+                                            map.clearInfoWindow();
+                                        },
+                                        jumpToMold:function(id) {
+                                            _this.$router.push("/moldList/" + id);
+                                        }
+                                    }
+                                });
+                                var component= new MyComponent().$mount();
+                                infoWindow.setContent(component.$el);
+                                infoWindow.open(map, data.lnglat);
+                            });
                         }
+
+                        infoWindow = new AMap.InfoWindow({
+                            isCustom:	true,
+                            draggable: true,  //是否可拖动
+                            showShadow: true,
+                            autoMove: true,
+                            offset: new AMap.Pixel(0, -31),
+                            content:""
+                        });
+
+                        marker.setMap(map);
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
                     });
-                    var component= new MyComponent().$mount();
-                    infoWindow.setContent(component.$el);
-                    infoWindow.open(map, data.lnglat);
                 });
             }
+        },
+        mounted() {
+            this.getMap();
 
-            infoWindow = new AMap.InfoWindow({
-                isCustom:	true,
-                draggable: true,  //是否可拖动
-                showShadow: true,
-                autoMove: true,
-                offset: new AMap.Pixel(0, -31),
-                content:""
-            });
-
-            marker.setMap(map);
+            this.$el.style.height = (window.innerHeight - 100) + "px";
+            const that = this;
+            window.onresize = function temp() {
+                this.$el.style.height = (window.innerHeight - 100) + "px";
+            };
         }
 	}
 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 824 - 856
ys_vue/src/views/mold/moldDetail.vue


+ 2 - 3
ys_vue/src/views/mold/moldList.vue

@@ -180,8 +180,7 @@
                         message: error,
                         type: "error"
                     });
-                }
-            );
+                });
             },
             //分页
             handleCurrentChange(val) {
@@ -238,7 +237,7 @@
 
             //详情
             toDetail(row) {
-            this.$router.push("/moldList/" + row.id);
+                this.$router.push("/moldList/" + row.id);
             },
 
             //添加界面

+ 2 - 2
ys_vue/src/views/project/projectDetail.vue

@@ -96,8 +96,8 @@
                 <el-table-column type="index" width="40"></el-table-column>
                 <el-table-column prop="content" label="操作" width="120" sortable></el-table-column>
                 <el-table-column prop="fileName" label="操作文档名称" sortable></el-table-column>
-                <el-table-column prop="operator" label="操作人" width="120" sortable></el-table-column>
-                <el-table-column prop="indate" label="操作时间" width="200" sortable></el-table-column>
+                <el-table-column prop="operator" label="操作人" width="120" align="center" sortable></el-table-column>
+                <el-table-column prop="indate" label="操作时间" width="200" align="center" sortable></el-table-column>
             </el-table>
         </el-col>