sunyadv 5 年之前
父節點
當前提交
fc1a377f74

二進制
ys_vue/cloud.ico


+ 3 - 0
ys_vue/index.html

@@ -3,8 +3,11 @@
     <head>
         <meta charset="utf-8">
         <title>云塑网后台管理系统</title>
+        <link rel="shortcut icon" type="image/x-icon" href="./cloud.ico" /> 
         <!-- 高德地图 -->
         <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=362cff852a3a37d328f9697352eebacd"></script>
+        <!-- 高德地图UI组件库 1.0 -->
+        <script src="//webapi.amap.com/ui/1.0/main.js"></script>
         <style>
             /* 地图弹窗样式 */
             .window {

+ 0 - 98
ys_vue/invite.html

@@ -1,98 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
-    <meta charset="UTF-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <title>邀请</title>
-    <style>
-        * {
-            font-family: 'Microsoft YaHei', '微软雅黑', '黑体';
-            margin: 0;
-            padding: 0;
-        }
-        .main {
-            margin: 80px auto;
-            width: 300px;
-            color: #555;
-        }
-        .title{
-            text-align: center;
-            font-size: 20px;
-            color: #999;
-            line-height: 50px;
-            border-bottom:#DDD 1px solid;
-            margin-bottom:5px;
-            padding: 0 10px;
-        }
-        .impoortant{
-            color: #1E72FF;
-        }
-        .hello{
-            line-height: 40px;
-            padding: 0 10px;
-        }
-        .invite{
-            line-height: 22px;
-            padding: 0 10px;
-        }
-        .info{
-            background-color: #EEE;
-            margin: 20px 0;
-            padding: 10px;
-            border-radius: 3px;
-        }
-        .info1{
-            padding-left: 10px;
-            border-left:#1E72FF 1px solid;
-            line-height: 18px;
-        }
-        .info2{
-            line-height: 20px;
-            padding: 10px 0;
-        }
-        .info3{
-            line-height: 20px;
-        }
-        .info2 span{
-            position:relative;
-            left: 40px;
-            color:#999;
-        }
-        .info3 span{
-            position:relative;
-            left: 25px;
-            color:#999;
-        }
-        button{
-            background-color: #1E72FF;
-            border: 0;
-            color: white;
-            border-radius: 5px;
-            width: 100%;
-            height: 40px;
-        }
-    </style>
-    <script>
-        function join(){
-            console.log("点击了立即加入,但什么都没有发生");
-        }
-    </script>
-</head>
-
-<body>
-    <div class="main">
-        <div class="title">云模管理平台</div>
-        <p class="hello">王二小您好!</p>
-        <p class="invite">陈晨 邀您参与 <span class="impoortant">南京火石闪信网络公司</span>的<span class="impoortant">face水杯</span>项目</p>
-        <div class="info">
-            <p class="info1">您的账户信息</p>
-            <p class="info2">手机号<span>16651112436</span></p>
-            <p class="info3">初始密码<span>000000</span></p>
-        </div>
-        <button onclick="join()">立即加入</button>
-    </div>
-</body>
-
-</html>

+ 2 - 1
ys_vue/src/port.js

@@ -11,7 +11,8 @@ export default {
         resetPwd: '/user/updatePassword'
     },
     map: {
-        mapList: '/company/getCoutomCompanyAndMouldsByUser' //生产方公司和公司下所属的模具
+        mapList: '/company/getCoutomCompanyAndMouldsByUser', //生产方公司和公司下所属的模具
+        newMap: '/mould/listMap'
     },
     project: {
         userList: '/user/list',  //用户列表

+ 1 - 0
ys_vue/src/views/base/comp.vue

@@ -417,6 +417,7 @@
                             }
                         }
                         this.http.post(this.port.base.addCompany, {
+                            id: this.editForm.id,
                             companyName: this.editForm.companyName,
                             companyType: 0,
                             companyAddress: this.editForm.companyAddress,

+ 44 - 10
ys_vue/src/views/base/factory.vue

@@ -92,6 +92,12 @@
 				<el-form-item label="生产方名称" prop="factoryName">
 					<el-input v-model="editForm.companyName" autocomplete="off" placeholder="请输入生产方名称"></el-input>
 				</el-form-item>
+                <el-form-item label="关联资产方">
+                    <el-select v-model="editForm.companyIds" clearable multiple filterable placeholder="请选择生产方" style="width:533px">
+                        <el-option v-for="item in companys" :key="item.id" :label="item.companyName" :value="item.id">
+                        </el-option>
+                    </el-select>
+				</el-form-item>
                 <el-form-item label="生产方地址" prop="factoryArea">
 					<el-input v-model="editForm.companyAddress" autocomplete="off" :change="changeFactoryArea('editContainer')" placeholder="请输入生产方地址"></el-input>
 				</el-form-item>
@@ -185,6 +191,7 @@
                     companyAddress: '',
                     yLng: 0,
                     xLat: 0,
+                    companyIds: [],
                     flag: 1
 				}
 			}
@@ -409,6 +416,10 @@
 			//显示编辑界面
 			handleEdit(index, row) {
                 this.editFormVisible = true;
+                var array = [];
+                for(var i in row.relateCompanyList){
+                    array.push(row.relateCompanyList[i].id)
+                }
                 this.editForm = {
                     id: row.id,
                     companyName: row.companyName,
@@ -416,8 +427,10 @@
                     companyAddress: row.companyAddress,
                     yLng: row.ylng,
                     xLat: row.xlat,
+                    companyIds: array,
                     flag: 1
-				};
+                };
+                console.log(this.editForm.companyIds)
             },
             
 			//编辑
@@ -425,7 +438,25 @@
 				this.$refs.editForm.validate((valid) => {
 					if (valid) {
                         this.editLoading = true;
-                        this.http.post(this.port.base.addCompany, this.editForm , res => {
+                        var str = "";
+                        console.log(this.editForm.companyIds.length)
+                        for(var i in this.editForm.companyIds){
+                            if(i == this.editForm.companyIds.length-1){
+                                str += this.editForm.companyIds[i]
+                            } else {
+                                str += this.editForm.companyIds[i] + ","
+                            }
+                        }
+                        this.http.post(this.port.base.addCompany, {
+                            id: this.editForm.id,
+                            companyName: this.editForm.companyName,
+                            companyType: 1,
+                            companyAddress: this.editForm.companyAddress,
+                            yLng: this.editForm.yLng,
+                            xLat: this.editForm.xLat,
+                            companyIds: str,
+                            flag: 1
+                        } , res => {
                             this.editLoading = false;
                             if (res.code == "ok") {
                                 this.editFormVisible = false;
@@ -480,7 +511,9 @@
                 
                 var _this = this;
                 this.map.on('click', function(e) {
-                    _this.map.remove(_this.marker);
+                    if(_this.map){
+                        _this.map.remove(_this.marker);
+                    }
                     var Lng = e.lnglat.getLng(),
                     Lat = e.lnglat.getLat();
                     if(mapId == 'addContainer') {
@@ -518,13 +551,14 @@
                             }
                             
                             // 添加标记
-                            _this.map.remove(_this.marker);
-                            _this.map.setZoomAndCenter(10, [lng, lat]);
-                            _this.marker = new AMap.Marker({
-                                map: _this.map,
-                                position: new AMap.LngLat(lng, lat),   // 经纬度
-                            });
-                            
+                            if(_this.map){
+                                _this.map.remove(_this.marker);
+                                _this.map.setZoomAndCenter(10, [lng, lat]);
+                                _this.marker = new AMap.Marker({
+                                    map: _this.map,
+                                    position: new AMap.LngLat(lng, lat),   // 经纬度
+                                });
+                            }
 
                         } else {
                             //console.log('定位失败!');

+ 54 - 52
ys_vue/src/views/detection/maintenance.vue

@@ -33,12 +33,13 @@
         size="small"
         type="primary"
         @click="showMaintenance"
+        v-if="!(user.parentId == 1 && user.subordinateType == 1)"
         style="margin-left: 16px;"
       >立即处理</el-button>
     </el-col>
     <el-col :span="4" :offset="2" style="line-height: 32px;">
       云模盒告警:{{warning}}
-      <el-button size="small" type="primary" style="margin-left: 16px;">立即处理</el-button>
+      <el-button size="small" v-if="!(user.parentId == 1 && user.subordinateType == 1)" type="primary" style="margin-left: 16px;">立即处理</el-button>
     </el-col>
 
     <!-- 操作记录 -->
@@ -177,57 +178,58 @@ import util from "../../common/js/util";
 export default {
   data() {
     return {
-      //本页模具ID
-      mouldId: null,
-      //模具名字
-      mouldName: null,
-      //模具状态
-      mouldState: 0,
-      options: [{ value: "aaa", label: "123" }, { value: "bbb", label: "456" }],
-      //记录
-      records: [],
-      //警告信息
-      warning: "低电量、过热",
-      //标题栏过滤器
-      filters: {
-        name: "",
-        value: ""
-      },
-      listLoading: false,
-      page: 1,
-      size: 20,
-      total: 0,
-      tableHeight: 0,
-      //活跃页面
-      activePage: 0,
-      formRules: {},
-      //保养界面 种类
-      type: [{ label: "动作", value: 0 }, { label: "易损件", value: 1 }],
-      //保养界面 动作
-      action: [{ label: "喷漆", value: 0 }, { label: "检查", value: 1 }],
-      //易损件
-      vulnerable: [
-        { label: "易损件1", value: 0 },
-        { label: "易损件12450", value: 1 },
-        { label: "易损件114514", value: 2 }
-      ],
-      //是否需要保养 提示
-      requirement: true,
-      prompt: true,
-      //保养详情界面显示
-      maintenanceFormVisible: false,
-      maintenanceLoading: false,
-      //保养详情界面数据
-      maintenanceForm: {
-        username: "",
-        account: "",
-        mobile: "",
-        teamName: "",
-        companyId: "",
-        roleType: "",
-        flag: 0
-      },
-      imageUrl: ""
+        user: JSON.parse(sessionStorage.getItem('user')),
+        //本页模具ID
+        mouldId: null,
+        //模具名字
+        mouldName: null,
+        //模具状态
+        mouldState: 0,
+        options: [{ value: "aaa", label: "123" }, { value: "bbb", label: "456" }],
+        //记录
+        records: [],
+        //警告信息
+        warning: "低电量、过热",
+        //标题栏过滤器
+        filters: {
+            name: "",
+            value: ""
+        },
+        listLoading: false,
+        page: 1,
+        size: 20,
+        total: 0,
+        tableHeight: 0,
+        //活跃页面
+        activePage: 0,
+        formRules: {},
+        //保养界面 种类
+        type: [{ label: "动作", value: 0 }, { label: "易损件", value: 1 }],
+        //保养界面 动作
+        action: [{ label: "喷漆", value: 0 }, { label: "检查", value: 1 }],
+        //易损件
+        vulnerable: [
+            { label: "易损件1", value: 0 },
+            { label: "易损件12450", value: 1 },
+            { label: "易损件114514", value: 2 }
+        ],
+        //是否需要保养 提示
+        requirement: true,
+        prompt: true,
+        //保养详情界面显示
+        maintenanceFormVisible: false,
+        maintenanceLoading: false,
+        //保养详情界面数据
+        maintenanceForm: {
+            username: "",
+            account: "",
+            mobile: "",
+            teamName: "",
+            companyId: "",
+            roleType: "",
+            flag: 0
+        },
+        imageUrl: ""
     };
   },
   methods: {

+ 195 - 2
ys_vue/src/views/map/map.vue

@@ -96,16 +96,209 @@
                         type: "error"
                     });
                 });
-            }
+            },
         },
         mounted() {
-            this.getMap();
+            //this.getMap();
 
             this.$el.style.height = (window.innerHeight - 100) + "px";
             const that = this;
             window.onresize = function temp() {
                 this.$el.style.height = (window.innerHeight - 100) + "px";
             };
+
+            //新地图
+            var map = new AMap.Map('container', {
+                zoom: 4,
+                mapStyle: "amap://styles/grey",
+                features: ['bg']
+            });
+
+            var _this = this;
+            //加载相关组件
+            AMapUI.load(['ui/geo/DistrictCluster', 'ui/misc/PointSimplifier', 'lib/$' ,  'lib/utils'], function(DistrictCluster, PointSimplifier , $ , utils) {
+
+                window.DistrictCluster = DistrictCluster;
+
+                //启动页面
+                var pointSimplifierIns = new PointSimplifier({
+                    map: map, //所属的地图实例
+                    autoSetFitView: false, //禁止自动更新地图视野
+                    zIndex: 110,
+                    getPosition: function(item) {
+                        if (!item) {
+                            return null;
+                        }
+                        //var parts = item.split(',');
+                        //返回经纬度
+                        //return [parseFloat(parts[0]), parseFloat(parts[1])];
+                        return [parseFloat(item.lng), parseFloat(item.lat)];
+                    },
+                    getHoverTitle: function(dataItem, idx) {
+                        var state = "";
+                        if(dataItem.state == '0'){
+                            state = "静止"
+                        } else if(dataItem.state == '1'){
+                            state = "运动"
+                        } else if(dataItem.state == '2'){
+                            state = "告警"
+                        } else if(dataItem.state == '3'){
+                            state = "报废"
+                        }
+                        return dataItem.modelName + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + state;
+                    },
+                    renderOptions: {
+                        //点的样式
+                        pointStyle: {
+                            width: 6,
+                            height: 6,
+                            fillStyle:'rgba(0, 236, 252, 0.38)'
+                        },
+                        //鼠标hover时的title信息
+                        hoverTitleStyle: {
+                            position: 'top'
+                        }
+                    }
+                });
+
+                function MyRender(distClusterIns, opts) {
+                    //直接调用父类的构造函数
+                    MyRender.__super__.constructor.apply(this, arguments);
+                }
+
+                //继承默认引擎
+                utils.inherit(MyRender, DistrictCluster.Render.Default);
+
+                utils.extend(MyRender.prototype, {
+                    drawFeaturePolygons: function(ctx, polygons, styleOptions, feature, dataItems) {
+                        //调用父类方法
+                        MyRender.__super__.drawFeaturePolygons.apply(this, arguments);
+
+                        //直接绘制聚合信息
+                        this.drawMyLabel(feature, dataItems);
+                    },
+                    _initContainter: function() {
+                        //调用父类方法
+                        MyRender.__super__._initContainter.apply(this, arguments);
+
+                        //创建一个新的canvas
+                        this._createCanvas('mylabel', this._container);
+                    },
+                    /**
+                     * 绘制一个蓝底白字的label替代聚合标注
+                     */
+                    drawMyLabel: function(feature, dataItems) {
+                        if(dataItems.length != 0){
+                            var pixelRatio = this.getPixelRatio(); //高清下存在比例放大
+
+                            var containerPos = map.lngLatToContainer(feature.properties.centroid || feature.properties.center);
+
+                            var labelCtx = this._getCanvasCxt('mylabel');
+
+                            //文字的中心点
+                            var centerX = containerPos.getX() * pixelRatio,
+                                centerY = containerPos.getY() * pixelRatio;
+
+                            labelCtx.save();
+
+                            labelCtx.font = 12 * pixelRatio + 'px 微软雅黑';
+
+                            var text = feature.properties.name + '\n' + dataItems.length + '';
+
+                            var textMetrics = labelCtx.measureText(text);
+
+                            var halfTxtWidth = textMetrics.width / 2;
+
+                            labelCtx.fillStyle = 'rgba(3 , 94 , 255 , 0.5)';//'#3366cc';
+                            //绘制一个蓝色背景
+                            labelCtx.fillRect(centerX - halfTxtWidth - 3 * pixelRatio,
+                                centerY - 11 * pixelRatio,
+                                textMetrics.width + 6 * pixelRatio,
+                                22 * pixelRatio);
+
+
+                            labelCtx.fillStyle = '#ffffff';
+                            labelCtx.textBaseline = 'middle';
+                            labelCtx.stroke();
+                            labelCtx.fillText(text, centerX - halfTxtWidth, centerY);
+
+                            labelCtx.restore();
+                        }
+                    }
+                });
+
+                var distCluster = new DistrictCluster({
+                    zIndex: 100,
+                    map: map, //所属的地图实例
+                    getPosition: function(item) {
+                        if (!item) {
+                            return null;
+                        }
+                        // var parts = item.split(',');
+                        // console.log(item)
+                        //返回经纬度
+                        //return [parseFloat(parts[0]), parseFloat(parts[1])];
+                        return [parseFloat(item.lng), parseFloat(item.lat)];
+                    },
+                    renderConstructor: MyRender,
+                    //特定区划级别的默认样式
+                    renderOptions: {
+                        getClusterMarker: null,
+                        featureClickToShowSub: true,
+                        featureStyle: {
+                            lineWidth: 2, //描边线宽
+                            strokeStyle: 'rgba(31, 119, 180, 0.8)', //描边色
+                            //鼠标Hover后的样式
+                            hoverOptions: {
+                                fillStyle: 'rgba(255,255,255,0.2)'
+                            }
+                        },
+                        getFeatureStyle: function(feature, dataItems) {
+                            return {
+                                fillStyle: ''
+                            };
+                        }
+                    },
+                });
+
+                window.distCluster = distCluster;
+
+                map.on('zoomend', function() {
+                    var zoom = map.getZoom();
+                    //获取 pointStyle
+                    var pointStyle = pointSimplifierIns.getRenderOptions().pointStyle;
+                    //根据当前zoom调整点的尺寸
+                    pointStyle.width = pointStyle.height = 2 * Math.pow(1.2, map.getZoom() - 3);
+                });
+
+                var zoom = map.getZoom();
+                //获取 pointStyle
+                var pointStyle = pointSimplifierIns.getRenderOptions().pointStyle;
+                //根据当前zoom调整点的尺寸
+                pointStyle.width = pointStyle.height = 2 * Math.pow(1.2, map.getZoom() - 3);
+
+                $('<div id="loadingTip">加载数据,请稍候...</div>').appendTo(document.body);
+                // $.get('https://a.amap.com/amap-ui/static/data/10w.txt', function(csv) {
+                
+                //     $('#loadingTip').remove();
+                //     var data = csv.split('\n');
+                //     distCluster.setData(data);
+                //     pointSimplifierIns.setData(data);
+                // });
+                _this.http.post( _this.port.map.newMap, {},
+                res => {
+                    $('#loadingTip').remove();
+                    var data = res.data;
+                    distCluster.setData(data);
+                    pointSimplifierIns.setData(data);
+                },
+                error => {
+                    _this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                })
+            });
         }
 	}
 

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

@@ -25,7 +25,7 @@
 				<el-form-item>
 					<el-button type="primary" @click="getUsers">查询</el-button>
 				</el-form-item>
-				<el-form-item style="float:right;">
+				<el-form-item style="float:right;" v-if="user.subordinateType == 0">
 					<el-button type="primary" @click="handleAdd">新增</el-button>
 				</el-form-item>
 			</el-form>
@@ -49,7 +49,7 @@
 			<el-table-column prop="companyName" label="所属公司" sortable></el-table-column>
             <el-table-column prop="roleName" label="角色" width="180" sortable></el-table-column>
 			<el-table-column label="操作" align="left" width="230">
-				<template slot-scope="scope" v-if="user.id == scope.row.parentId || user.isManager == 1 || user.parentId == 1">
+				<template slot-scope="scope" v-if="user.id == scope.row.parentId || user.isManager == 1 || (user.parentId == 1 && user.subordinateType == 0)">
 					<el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
 					<el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button>
                     <el-button type="primary" size="small" @click="invite(scope.$index, scope.row)" v-if="user.id != 1 && scope.row.projects.length == 1">邀请</el-button>