Ver Fonte

后台管理系统修改

sunyadv há 5 anos atrás
pai
commit
bfc0ff93ae

+ 3 - 1
bms/src/main/java/com/hssx/bms/entity/Book.java

@@ -1,5 +1,7 @@
 package com.hssx.bms.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
@@ -16,7 +18,7 @@ public class Book extends Model<Book> {
 
     private static final long serialVersionUID=1L;
 
-    @TableField("id")
+    @TableId(value = "id",type = IdType.ID_WORKER_STR)
     private String id;
 
     @TableField("name")

+ 14 - 14
lib_vue/src/http.js

@@ -37,10 +37,10 @@ export default {
      */
     post (url, data, response, exception) {
         var user = sessionStorage.getItem('user') , token = "";
-        if(user != null){
-            token = JSON.parse(user).headImgurl
-            data.token = token
-        }
+        // if(user != null){
+        //     token = JSON.parse(user).headImgurl
+        //     data.token = token
+        // }
         axios({
             method: 'post',
             url: handleUrl(url),
@@ -72,9 +72,9 @@ export default {
      */
     get (url , response, exception) {
         var user = sessionStorage.getItem('user') , token = "";
-        if(user != null){
-            token = JSON.parse(user).headImgurl
-        }
+        // if(user != null){
+        //     token = JSON.parse(user).headImgurl
+        // }
         axios({
             method: 'get',
             url: handleUrl(url),
@@ -104,10 +104,10 @@ export default {
      */
     uploadFile (url, data, response, exception) {
         var user = sessionStorage.getItem('user') , token = "";
-        if(user != null){
-            token = JSON.parse(user).headImgurl
-            data.append("token", token);
-        }
+        // if(user != null){
+        //     token = JSON.parse(user).headImgurl
+        //     data.append("token", token);
+        // }
         axios({
             method: 'post',
             url: handleUrl(url),
@@ -138,9 +138,9 @@ export default {
      */
     downloadFile (url, data, fileName, exception) {
         var user = sessionStorage.getItem('user') , token = "";
-        if(user != null){
-            token = JSON.parse(user).headImgurl
-        }
+        // if(user != null){
+        //     token = JSON.parse(user).headImgurl
+        // }
         axios({
             method: 'post',
             url: handleUrl(url),

+ 9 - 0
lib_vue/src/port.js

@@ -10,9 +10,18 @@ export default {
         detail: '/institutional/detail',
         add: '/institutional/add',
         edit: '/institutional/update',
+        delete: '/institutional/deleteInformation',
         updatePic: '/institutional/updatePics',
         deletePic: '/institutional/delete'
     },
+    book: {
+        list: '/book/list',
+        detail: '/book/detail',
+        add: '/book/addOrUpdateBook',
+        uploadFile: '/book/addBookPage',
+        delete: '/book/deleteBookPage',
+        fileList: '/book/bookPageList',
+    },
     map: { 
         mapList: '/company/getCoutomCompanyAndMouldsByUser', // 生产方公司和公司下所属的模具
         newMap: '/mould/listMap' // 获取地图

+ 5 - 90
lib_vue/src/routes.js

@@ -1,30 +1,13 @@
 import Login from './views/Login.vue'
 import NotFound from './views/404.vue'
 import Home from './views/Home.vue'
-import message from './views/message.vue'
-import invite from './views/invite.vue'
-
-import map from './views/map/map.vue'
-
-import detection from './views/detection/detection.vue'
-import maintenance from './views/detection/maintenance.vue'
-
-import project from './views/project/project.vue'
-import projectDetail from './views/project/projectDetail.vue'
-import staff from './views/project/staff.vue'
-import competence from './views/project/competence.vue'
-
-import moldList from './views/mold/moldList.vue'
-import moldDetail from './views/mold/moldDetail.vue'
-import moldDownload from './views/mold/moldDownload.vue'
-
-import comp from './views/base/comp.vue'
-import factory from './views/base/factory.vue'
-import allocation from './views/base/allocation.vue'
 
 import agency from './views/agency/agencyList.vue'
 import agencyDetail from './views/agency/agencyDetail.vue'
 
+import course from './views/course/courseList.vue'
+import courseDetail from './views/course/courseDetail.vue'
+
 import book from './views/book/bookList.vue'
 import bookDetail from './views/book/bookDetail.vue'
 
@@ -61,8 +44,8 @@ let routes = [
         iconCls: 'iconfont iconkecheng',
         leaf: true,//只有一个节点
         children: [
-            { path: '/book', component: book, name: '课程管理' },
-            { path: '/book/:id', component: bookDetail, name: '课程详情', hidden: true }
+            { path: '/course', component: course, name: '课程管理' },
+            { path: '/course/:id', component: courseDetail, name: '课程详情', hidden: true }
         ]
     },
     //图书管理
@@ -99,74 +82,6 @@ let routes = [
             { path: '/vip', component: vip, name: '会员设置' }
         ]
     },
-    //地图概览
-    {
-        path: '/',
-        component: Home,
-        name: '',
-        iconCls: 'iconfont icon-ditu',
-        leaf: true,//只有一个节点
-        children: [
-            { path: '/map', component: map, name: '地图概览' },
-            { path: '/message', component: message, name: '消息中心', hidden: true }
-        ]
-    },
-    //运行监测
-    {
-        path: '/',
-        component: Home,
-        name: '',
-        iconCls: 'iconfont icon-jiance',
-        leaf: true,//只有一个节点
-        children: [
-            { path: '/detection', component: detection, name: '运行检测' },
-            { path: '/detection/:id', component: maintenance, name: '运行检测详情', hidden: true }
-        ]
-    },
-    //项目管理
-    {
-        path: '/',
-        component: Home,
-        name: '项目管理',
-        iconCls: 'iconfont icon-ic_dashboard',
-        children: [
-            { path: '/project', component: project, name: '项目列表' },
-            { path: '/project/:id', component: projectDetail, name: '项目详情', hidden: true },
-            { path: '/staff', component: staff, name: '人员管理' },
-            { path: '/competence', component: competence, name: '权限管理' }
-        ]
-    },
-    //模具管理
-    {
-        path: '/',
-        component: Home,
-        name: '模具管理',
-        iconCls: 'iconfont icon-moxing',
-        children: [
-            { path: '/moldList', component: moldList, name: '模具列表' },
-            { path: '/moldList/:id/:type', component: moldDetail, name: '模具详情', hidden: true },
-            { path: '/moldDownload', component: moldDownload, name: '文档下载' }
-        ]
-    },
-    //基础管理
-    {
-        path: '/',
-        component: Home,
-        name: '基础管理',
-        iconCls: 'iconfont icon-setting-fill',
-        children: [
-            { path: '/comp', component: comp, name: '资产方管理' },
-            { path: '/factory', component: factory, name: '生产方管理' },
-            { path: '/allocation', component: allocation, name: '云模盒管理' }
-        ]
-    },
-    //邀请
-    {
-        path: '/invite/:inviteeId/:projectId/:operatorId',
-        component: invite,
-        name: '邀请',
-        hidden: true
-    },
     {
         path: '/404',
         component: NotFound,

+ 2 - 0
lib_vue/src/views/Home.vue

@@ -408,6 +408,8 @@
                 width: 80%;
                 padding: 20px;
                 background-color: #efefef;
+                overflow: auto;
+                height: 100%;
                 .breadcrumb-container {
                     .title {
                         width: 200px;

Diff do ficheiro suprimidas por serem muito extensas
+ 345 - 496
lib_vue/src/views/agency/agencyDetail.vue


+ 32 - 39
lib_vue/src/views/agency/agencyList.vue

@@ -9,8 +9,7 @@
 				<el-form-item>
 					<el-button type="primary" size="small" v-on:click="getList">查询</el-button>
 				</el-form-item>
-				<el-form-item style="float:right;">
-                    <!--  v-if="user.parentId == 1 && user.subordinateType == 0" -->
+				<el-form-item style="float:right;" v-if='user.roleType == 0'>
 					<el-button type="primary" size="small" @click="handleAdd">新增</el-button>
 				</el-form-item>
 			</el-form>
@@ -66,9 +65,6 @@
 </template>
 
 <script>
-    import Vue from 'vue';
-    import util from '../../common/js/util'
-    
 	export default {
 		data() {
 			return {
@@ -76,8 +72,6 @@
 					keyName: ''
                 },
                 user: JSON.parse(sessionStorage.getItem('user')),
-                charger: [],
-                molds: [],
 
 				list: [],
 				total: 0,
@@ -153,38 +147,10 @@
                 this.$router.push('/agency/' + id);
             },
 
-            //删除
-            toDelete(id) {
-                this.$confirm('确认删除该培训机构吗?', '提示', {
-					type: 'warning'
-				}).then(() => {
-                    this.http.post(this.port.agency.delete, {
-                        id: row.id
-                    }, res => {
-                        if (res.code == "ok") {
-                            this.$message({
-                                message: '删除成功',
-                                type: 'success'
-                            });
-                            this.getList();
-                        } else {
-                            this.$message({
-                                message: res.msg,
-                                type: 'error'
-                            });
-                        }
-                    }, error => {
-                        this.$message({
-                            message: error,
-                            type: 'error'
-                        });
-                    })
-				});
-            },
-
             //显示新增界面
 			handleAdd() {
-				this.addFormVisible = true;
+                this.addLoading = false;
+                this.addFormVisible = true;
 				this.addForm = {
 					name: '',
                     address: '',
@@ -205,7 +171,6 @@
                             lng: this.addForm.address==''?null:this.addForm.yLng,
                             lat: this.addForm.address==''?null:this.addForm.xLat,
                         } , res => {
-                            this.addLoading = false;
                             if (res.code == "ok") {
                                 this.addFormVisible = false;
                                 this.$message({
@@ -220,7 +185,6 @@
                                 });
                             }
                         }, error => {
-                            this.addLoading = false;
                             this.addFormVisible = false;
                             this.$message({
                                 message: error,
@@ -231,6 +195,35 @@
 				});
             },
 
+            //删除
+            toDelete(id) {
+                this.$confirm('确认删除该培训机构吗?', '提示', {
+					type: 'warning'
+				}).then(() => {
+                    this.http.post(this.port.agency.delete, {
+                        id: id
+                    }, res => {
+                        if (res.code == "ok") {
+                            this.$message({
+                                message: '删除成功',
+                                type: 'success'
+                            });
+                            this.getList();
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: 'error'
+                            });
+                        }
+                    }, error => {
+                        this.$message({
+                            message: error,
+                            type: 'error'
+                        });
+                    })
+				});
+            },
+
             //地址输入切换
             changeFactoryArea(mapId) {
                 if(mapId == "addContainer"){

+ 0 - 639
lib_vue/src/views/base/allocation.vue

@@ -1,639 +0,0 @@
-<template>
-    <section>
-        <!--工具条-->
-        <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
-            <el-form :inline="true" :model="filters">
-                <el-col :span="3">
-                    <el-form-item>
-                        <el-select v-model="filters.companyId" clearable filterable placeholder="请选择公司">
-                            <el-option v-for="item in companies" :key="item.id" :label="item.companyName" :value="item.id">
-                            </el-option>
-                        </el-select>
-                    </el-form-item>
-                </el-col>
-                <el-form-item>
-                    <el-input v-model="filters.keyName" placeholder="请输入关键字进行搜索"></el-input>
-                </el-form-item>
-                <el-form-item>
-                    <el-button type="primary" @click="getMoulds">查询</el-button>
-                </el-form-item>
-                <el-form-item style="float: right;">
-                    <a class="download" href="/upload/云模盒批量导入模板.xlsx" download="云模盒批量导入模板.xlsx">
-                        <el-button type="primary">
-                            下载模板
-                        </el-button>
-                    </a>
-                </el-form-item>
-                <el-form-item style="float: right;">
-                    <el-upload ref="upload" action="customize" :show-file-list="false" :http-request="uploadFile" :limit="1">
-                        <el-button type="primary" :loading="uploading">批量导入</el-button>
-                    </el-upload>
-                </el-form-item>
-                <el-form-item style="float: right;">
-                    <el-button type="primary" @click="showAllocation">新建</el-button>
-                </el-form-item>
-                <!-- <el-form-item style="float: right;">
-                    <el-button type="primary" @click="issued">下发</el-button>
-                </el-form-item> -->
-            </el-form>
-        </el-col>
-
-        <!--列表-->
-        <el-table :data="allocations" :height="tableHeight" highlight-current-row v-loading="listLoading" style="width: 100%;">
-            <!-- <el-table-column type="selection" width="50"></el-table-column> -->
-            <el-table-column type="index" width="60"></el-table-column>
-            <el-table-column prop="equipmentNo" label="云模盒编号" width="180" sortable></el-table-column>
-            <el-table-column prop="sim" label="SIM卡号" width="120" sortable></el-table-column>
-            <el-table-column prop="hillNumber" label="电量" width="80" align="center" sortable>
-                <template slot-scope="scope">{{scope.row.hillNumber}}<span v-if="scope.row.hillNumber">%</span></template>
-            </el-table-column>
-            <el-table-column prop="alarmBattery" label="报警电池电量" width="130" align="center" sortable>
-                <template slot-scope="scope">{{scope.row.alarmBattery}}<span v-if="scope.row.alarmBattery">%</span></template>
-            </el-table-column>
-            <el-table-column prop="alarmDegree" label="热报警度数" width="120" align="center" sortable>
-                <template slot-scope="scope">{{scope.row.alarmDegree}}<span v-if="scope.row.alarmDegree">℃</span></template>
-            </el-table-column>
-            <el-table-column prop="useLife" label="使用年限" width="100" align="center" sortable>
-                <template slot-scope="scope">{{scope.row.useLife}}年</template>
-            </el-table-column>
-            <el-table-column prop="diffTime" label="倒计时" width="100" align="center" sortable>
-                <template slot-scope="scope">{{scope.row.diffTime}}</template>
-            </el-table-column>
-            <el-table-column prop="modelName" label="模具名称" width="130" sortable></el-table-column>
-            <el-table-column prop="modelNo" label="模具编号" width="120" align="center" sortable></el-table-column>
-            <el-table-column prop="companyName" label="公司名称" width="180" sortable></el-table-column>
-            <el-table-column prop="agent" label="代理商" width="120" sortable></el-table-column>
-            <el-table-column label="云模盒状态" align="center" width="120" sortable>
-                <template slot-scope="scope">
-                    <span v-if="scope.row.isUse == 0">未启用</span>
-                    <span v-else>已启用</span>
-                </template>
-            </el-table-column>
-            <el-table-column label="操作" align="center" width="160">
-                <template slot-scope="scope">
-                    <el-button size="small" v-if="scope.row.modelNo != null && scope.row.isUse == 0" type="primary" @click="openEnable(scope.$index)">启用</el-button>
-                    <el-button size="small" v-if="scope.row.modelNo != null && scope.row.isUse == 1" type="danger" @click="disableEquipment(scope.$index)">停用</el-button>
-                    <!--  :disabled="scope.row.isUse == 1" -->
-                    <el-button size="small" :style="scope.row.modelNo != null?'':'float:right;margin-right:6px'" @click="showEdit(scope.$index, scope.row, scope.row.isUse == 1)">修改</el-button>
-                </template>
-            </el-table-column>
-        </el-table>
-
-        <!--工具条-->
-        <el-col :span="24" class="toolbar">
-        <el-pagination
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :page-sizes="[20 , 50 , 80 , 100]"
-            :page-size="20"
-            layout="total, sizes, prev, pager, next"
-            :total="total"
-            style="float:right;"
-        ></el-pagination>
-        </el-col>
-
-        <!--新增界面-->
-        <el-dialog title="新建云模盒" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth">
-            <el-form :model="newAllocation" label-width="100px" :rules="formRules" ref="newAllocation" :inline="true" class="demo-form-inline">
-                <el-form-item label="云模盒编号" prop="equipmentNo">
-                    <el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请输入云模盒编号"></el-input>
-                </el-form-item>
-                <el-form-item label="所属公司" prop="belongCompanyId">
-                    <el-select v-model="newAllocation.belongCompanyId" filterable clearable placeholder="请选择所属公司" style="width: 202px">
-                        <el-option v-for="item in companies" :key="item.id" :label="item.companyName" :value="item.id"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item label="使用年限" prop="useLife">
-                    <el-input v-model.number="newAllocation.useLife" type="age" autocomplete="off" placeholder="请输入使用年限"></el-input>
-                </el-form-item>
-                <el-form-item label="代理商" prop="agent">
-                    <el-input v-model="newAllocation.agent" autocomplete="off" placeholder="请输入代理商" style="width: 202px"></el-input>
-                </el-form-item>
-            </el-form>
-            <div slot="footer" class="dialog-footer">
-                <el-button @click.native="addFormVisible = false">取消</el-button>
-                <el-button type="primary" @click="addMould()">提交</el-button>
-            </div>
-        </el-dialog>
-
-        <!--修改界面-->
-        <el-dialog title="修改云模盒" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass="customWidth">
-            <el-form :model="newAllocation" label-width="100px" :rules="formRules" ref="newAllocation" :inline="true" class="demo-form-inline">
-                <el-form-item label="云模盒编号" prop="equipmentNo">
-                    <el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请输入云模盒编号"></el-input>
-                </el-form-item>
-                <el-form-item label="所属公司" prop="belongCompanyId">
-                    <el-select v-model="newAllocation.belongCompanyId" filterable clearable placeholder="请选择所属公司" style="width: 202px" :disabled="newAllocation.usage">
-                        <el-option v-for="item in companies" :key="item.id" :label="item.companyName" :value="item.id"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item label="使用年限" prop="useLife">
-                    <el-input v-model.number="newAllocation.useLife" type="age" autocomplete="off" placeholder="请输入使用年限"></el-input>
-                </el-form-item>
-                <el-form-item label="代理商" prop="agent">
-                    <el-input v-model="newAllocation.agent" autocomplete="off" placeholder="请输入代理商" style="width: 202px"></el-input>
-                </el-form-item>
-            </el-form>
-            <div slot="footer" class="dialog-footer">
-                <el-button @click.native="editFormVisible = false">取消</el-button>
-                <el-button type="primary" @click="editMould(newAllocation.id)">提交</el-button>
-            </div>
-        </el-dialog>
-
-        <!-- 启用弹窗 -->
-        <el-dialog title="启用" :visible.sync="operateDialogVisible" width="450px">
-            <!-- <el-form label-width="100px" :rules="formRules" :inline="true" class="demo-form-inline">
-                <el-form-item label="某个参数">
-                    <el-input autocomplete="off" placeholder="填了也不会发生什么"></el-input>
-                </el-form-item>
-            </el-form>
-            <span slot="footer" class="dialog-footer">
-                <el-button @click="operateDialogVisible = false">取消</el-button>
-                <el-button type="primary" @click="enable">启用</el-button>
-            </span> -->
-            <el-form :model="issuedVal" label-width="130px" :rules="formRules" ref="issuedVal" :inline="true" class="demo-form-inline">
-                <el-form-item label="报警电池电量" prop="alarmBattery">
-                    <el-input v-model.number="issuedVal.alarmBattery" type="age" autocomplete="off" placeholder="请输入报警电池电量" style="width:250px;"></el-input>
-                    %
-                </el-form-item>
-                <el-form-item label="热报警度数" prop="alarmDegree">
-                    <el-input v-model.number="issuedVal.alarmDegree" type="age" autocomplete="off" placeholder="请输入热报警度数" style="width:250px;"></el-input>
-                    ℃
-                </el-form-item>
-            </el-form>
-            <span slot="footer" class="dialog-footer">
-                <el-button @click="operateDialogVisible = false">取消</el-button>
-                <el-button type="primary" @click="enable">启用</el-button>
-            </span>
-        </el-dialog>
-
-        <!-- 下发弹窗 -->
-        <el-dialog title="下发" :visible.sync="issuedVisible" width="450px">
-            <el-form :model="issuedVal" label-width="130px" :rules="formRules" ref="issuedVal" :inline="true" class="demo-form-inline">
-                <el-form-item label="报警电池电量" prop="alarmBattery">
-                    <el-input v-model.number="issuedVal.alarmBattery" type="age" autocomplete="off" placeholder="请输入报警电池电量" style="width:250px;"></el-input>
-                    %
-                </el-form-item>
-                <el-form-item label="热报警度数" prop="alarmDegree">
-                    <el-input v-model.number="issuedVal.alarmDegree" type="age" autocomplete="off" placeholder="请输入热报警度数" style="width:250px;"></el-input>
-                    ℃
-                </el-form-item>
-            </el-form>
-            <span slot="footer" class="dialog-footer">
-                <el-button @click="issuedVisible = false">取消</el-button>
-                <el-button type="primary" @click="saveIssued">下发</el-button>
-            </span>
-        </el-dialog>
-    </section>
-</template>
-
-<script>
-    import util from "../../common/js/util";
-    export default {
-        data() {
-            return {
-                allocations: [],
-                companies: {},
-                newAllocation: {
-                    equipmentNo: "", //设备编号
-                    useLife: "", //使用年限
-                    equipmentName: "", //设备名称
-                    id: "", //设备id
-                    belongCompanyId: "", //所属公司ID
-                    agent: "", //代理商
-                    usage: true //是否可以修改公司
-                },
-                filters: {
-                    keyName: "",
-                    companyId: ""
-                },
-                formRules: {
-                    equipmentNo: [
-                        { required: true, message: "请输入云模盒编号", trigger: "blur" }
-                    ],
-                    useLife: [
-                        { required: true, message: '请输入使用年限'},
-                        { type: 'number', message: '使用年限必须为数字值'}
-                    ],
-                    belongCompanyId: [
-                        { required: true, message: "请选择所属公司", trigger: ["blur", "change"] }
-                    ],
-                    agent: [
-                        { required: true, message: "请输入代理商", trigger: "blur" }
-                    ],
-                    alarmBattery: [
-                        { required: true, message: '请输入报警电池电量'},
-                        { type: 'number', message: '报警电池电量必须为数字值'}
-                    ],
-                    alarmDegree: [
-                        { required: true, message: '请输入热报警度数'},
-                        { type: 'number', message: '热报警度数必须为数字值'}
-                    ],
-                },
-
-                listLoading: false,
-                addLoading: false,
-                editLoading: false,
-                uploading: false,
-
-                total: 0,
-                page: 1,
-                size: 20,
-                tableHeight: 0,
-
-                addFormVisible: false,
-                editFormVisible: false,
-                operateDialogVisible: false,
-                activeIndex: 0,
-
-                issuedVal: {
-                    alarmBattery: 30,
-                    alarmDegree: 80,
-                },
-                issuedVisible: false,
-                multipleSelection: [],
-            };
-        },
-        methods: {
-            getMsg() {
-                //获取公司下拉列表
-                this.http.post( this.port.base.getCompanys, {},
-                res => {
-                    if (res.code == "ok") {
-                        this.companies = res.data;
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            },
-
-            //分页
-            handleCurrentChange(val) {
-                this.page = val;
-                this.getMoulds();
-            },
-
-            handleSizeChange(val) {
-                this.size = val;
-                this.getMoulds();
-            },
-
-            //读取云模盒信息
-            getMoulds() {
-                this.listLoading = true;
-                this.http.post(this.port.base.mouldeList,{
-                    pageNum: this.page,
-                    pageSize: this.size,
-                    keyName: this.filters.keyName,
-                    companyId: this.filters.companyId
-                },
-                res => {
-                    this.listLoading = false;
-                    if (res.code == "ok") {
-                        var list = res.data.list
-                        for(var i in list){
-                            if(list[i].endTime == null){
-                                list[i].diffTime = "";
-                            } else {
-                                list[i].diffTime = util.formatDate.dateDiff(
-                                    //util.formatDate.format(new Date(list[i].endTime), 'yyyy-MM-dd'), 
-                                    list[i].endTime,
-                                    util.formatDate.format(new Date(new Date()), 'yyyy-MM-dd')
-                                );
-                            }
-                        }
-                        this.allocations = list;
-                        this.total = res.data.total;
-                    } else {
-                        this.$message({
-                        message: res.msg,
-                        type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.listLoading = false;
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            },
-
-            //添加界面
-            showAllocation() {
-                this.addFormVisible = true;
-                this.newAllocation = {
-                    id: "",
-                    useLife: "",
-                    equipmentNo: "",
-                    belongCompanyId: "",
-                    agent: ""
-                };
-            },
-           
-            //添加模具
-            addMould() {
-                this.$refs.newAllocation.validate(valid => {
-                    if (valid) {
-                    this.addLoading = true;
-                    this.http.post(
-                        this.port.base.editMould,
-                        {
-                            equipmentNo: this.newAllocation.equipmentNo,
-                            belongCompanyId: this.newAllocation.belongCompanyId,
-                            useLife: this.newAllocation.useLife,
-                            agent: this.newAllocation.agent
-                        },
-                        res => {
-                            this.addLoading = false;
-                            if (res.code == "ok") {
-                                this.addFormVisible = false;
-                                this.$message({
-                                    message: "添加成功",
-                                    type: "success"
-                                });
-                                this.getMoulds();
-                            } else {
-                                this.$message({
-                                    message: res.msg,
-                                    type: "error"
-                                });
-                            }
-                        },
-                        error => {
-                            this.addLoading = false;
-                            this.addFormVisible = false;
-                            this.$message({
-                                message: error,
-                                type: "error"
-                            });
-                        }
-                    );
-                    }
-                });
-            },
-
-             //修改界面
-            showEdit(index, row, usageBoolean) {
-                this.editFormVisible = true;
-                this.newAllocation = {
-                    id: row.id,
-                    useLife: row.useLife,
-                    equipmentNo: row.equipmentNo,
-                    belongCompanyId: row.belongCompanyId,
-                    agent: row.agent,
-                    usage: usageBoolean
-                };
-            },
-
-            //编辑模具
-            editMould() {
-                this.$refs.newAllocation.validate(valid => {
-                    if (valid) {
-                        this.editLoading = true;
-                        this.http.post( this.port.base.editMould, {
-                            id: this.newAllocation.id,
-                            equipmentNo: this.newAllocation.equipmentNo,
-                            equipmentName: this.newAllocation.equipmentName,
-                            belongCompanyId: this.newAllocation.belongCompanyId,
-                            useLife: this.newAllocation.useLife,
-                            agent: this.newAllocation.agent
-                        },
-                        res => {
-                            this.editLoading = false;
-                            if (res.code == "ok") {
-                                this.editFormVisible = false;
-                                this.$message({
-                                    message: "修改成功",
-                                    type: "success"
-                                });
-                                this.getMoulds();
-                            } else {
-                                this.$message({
-                                    message: res.msg,
-                                    type: "error"
-                                });
-                            }
-                        },
-                        error => {
-                            this.editLoading = false;
-                            this.editFormVisible = false;
-                            this.$message({
-                                message: error,
-                                type: "error"
-                            });
-                        });
-                    }
-                });
-            },
-
-            //打开启用窗口
-            openEnable(index) {
-                this.operateDialogVisible = true;
-                this.issuedVal.alarmBattery = this.allocations[this.activeIndex].alarmBattery;
-                this.issuedVal.alarmDegree = parseInt(this.allocations[this.activeIndex].alarmDegree);
-                this.activeIndex = index;
-            },
-
-            //启用设备
-            enable() {
-                // if(this.allocations[this.activeIndex].belongCompanyId == null){
-                //     this.$message({
-                //         message: "输入所属公司后才能启用模具",
-                //         type: "error"
-                //     });
-                // }else{
-                this.allocations[this.activeIndex].isUse = 1;
-                this.operateDialogVisible = false;
-                // this.http.post( this.port.base.enableMould, {
-                //     id: this.allocations[this.activeIndex].id,
-                //     isUse: 1
-                // },
-                var str = this.allocations[this.activeIndex].equipmentNo;
-                this.http.post( this.port.base.setPacket, {
-                    lowPowerLimit: this.issuedVal.alarmBattery,//.toString(16),
-                    hotAlarmLimit: this.issuedVal.alarmDegree,//.toString(16),
-                    isUse: 1,
-                    equipmentNo: str
-                },
-                res => {
-                    if (res.code == "ok") {
-                        this.$message({
-                            message: "设备已启用",
-                            type: "success"
-                        });
-                        this.getMoulds();
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            },
-
-            //停用云模盒
-            disableEquipment(index) {
-                // if(this.allocations[index].belongCompanyId == null){
-                //     this.$message({
-                //         message: "输入所属公司后才能启用模具",
-                //         type: "error"
-                //     });
-                // }else{
-                this.allocations[index].isUse = 0;
-                // this.http.post( this.port.base.enableMould, {
-                //     id: this.allocations[index].id,
-                //     isUse: 0
-                // },
-                var str = this.allocations[this.activeIndex].equipmentNo;
-                this.http.post( this.port.base.setPacket, {
-                    lowPowerLimit: this.issuedVal.alarmBattery,//.toString(16),
-                    hotAlarmLimit: this.issuedVal.alarmDegree,//.toString(16),
-                    isUse: 0,
-                    equipmentNo: str
-                },
-                res => {
-                    if (res.code == "ok") {
-                        this.$message({
-                            message: "设备已停用",
-                            type: "success"
-                        });
-                        this.getMoulds();
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            },
-
-            //导入云模盒
-            uploadFile(params) {
-                var fileObj = params.file;
-                var form = new FormData();
-                form.append("file", fileObj);
-                this.uploading = true;
-                this.http.uploadFile( this.port.base.importMouldEquipmentExcel,  form,
-                res => {
-                    this.uploading = false;
-                    this.$refs.upload.clearFiles();
-                    if (res.code == "ok") {
-                        this.$message({
-                            message: "上传成功",
-                            type: "success"
-                        });
-                        this.getMoulds();
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.uploading = false;
-                    this.$refs.upload.clearFiles();
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            },
-
-            //列表选择
-            handleSelectionChange(val) {
-                this.multipleSelection = val;
-            },
-
-            //下发云模盒
-            issued() {
-                this.issuedVisible = true;
-            },
-
-            saveIssued() {
-                if(this.multipleSelection.length == 0) {
-                    this.$message({
-                        message: "请选择要下发的云模盒",
-                        type: "error"
-                    });
-                } else {
-                    var str = '';
-                    for(var i in this.multipleSelection) {
-                        str += this.multipleSelection[i].equipmentNo + ',';
-                    }
-                    str = str.substring(0,str.length-1)
-                    this.http.post( this.port.base.setPacket, {
-                        lowPowerLimit: this.issuedVal.alarmBattery,//.toString(16),
-                        hotAlarmLimit: this.issuedVal.alarmDegree,//.toString(16),
-                        equipmentNo: str
-                    },
-                    res => {
-                        if (res.code == "ok") {
-                            this.$message({
-                                message: "下发成功",
-                                type: "success"
-                            });
-                            this.issuedVisible = false;
-                            this.getMoulds();
-                        } else {
-                            this.$message({
-                                message: res.msg,
-                                type: "error"
-                            });
-                        }
-                    },
-                    error => {
-                        this.$message({
-                            message: error,
-                            type: "error"
-                        });
-                    });
-                }
-            }
-
-        },
-        created() {
-            let height = window.innerHeight;
-            this.tableHeight = height - 210;
-            const that = this;
-            window.onresize = function temp() {
-                that.tableHeight = window.innerHeight - 210;    
-            };
-        },
-        mounted() {
-            this.getMsg();
-            //获取模具列表
-            this.getMoulds();
-        }
-    };
-</script>
-
-<style scoped>
-    .download {
-        color: #fff;
-        text-decoration: none;
-    }
-</style>

+ 0 - 476
lib_vue/src/views/base/comp.vue

@@ -1,476 +0,0 @@
-<template>
-	<section>
-		<!--工具条-->
-		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
-			<el-form :inline="true" :model="filters">
-                <el-form-item>
-                    <el-input v-model="filters.keyName" placeholder="请输入资产方名称进行搜索" clearable></el-input>
-                </el-form-item>
-				<el-form-item>
-					<el-button type="primary" @click.native="getComp">查询</el-button>
-				</el-form-item>
-				<el-form-item style="float:right;">
-					<el-button type="primary" @click.native="handleAdd">新增</el-button>
-				</el-form-item>
-			</el-form>
-		</el-col>
-
-		<!--列表-->
-		<el-table :data="list" highlight-current-row :height="tableHeight" v-loading="listLoading" style="width: 100%;">
-            <el-table-column type="index" width="60"></el-table-column>
-			<el-table-column prop="companyName" label="资产方名称" width="250" sortable>
-            </el-table-column>
-            <el-table-column prop="administrator" label="资产方管理员" width="150" sortable>
-                <template slot-scope="scope">
-                    <router-link to="/staff" tag="span" style="cursor: pointer; color: #409eff;">{{scope.row.administrator}}</router-link>
-                </template>
-            </el-table-column>
-            <el-table-column prop="relateCompanyList" label="关联生产方" width="400" sortable>
-                <template slot-scope="scope">
-                    <span class="info" v-for="(item, index) in scope.row.relateCompanyList">
-                        {{item.companyName}}
-                        <span v-if="index != scope.row.relateCompanyList.length-1">、</span>
-                    </span>
-                </template>
-            </el-table-column>
-            <el-table-column prop="companyAddress" label="资产方地址" sortable></el-table-column>
-			<el-table-column label="操作" width="150">
-				<template slot-scope="scope">
-					<el-button size="small" @click.native="handleEdit(scope.$index, scope.row)">编辑</el-button>
-					<el-button type="danger" size="small" @click.native.native="handleDel(scope.$index, scope.row)">删除</el-button>
-				</template>
-			</el-table-column>
-		</el-table>
-
-		<!--工具条-->
-		<el-col :span="24" class="toolbar">
-            <el-pagination
-                @size-change="handleSizeChange"
-                @current-change="handleCurrentChange"
-                :page-sizes="[20 , 50 , 80 , 100]"
-                :page-size="20"
-                layout="total, sizes, prev, pager, next"
-                :total="total"
-                style="float:right;">
-            </el-pagination>
-		</el-col>
-
-        <!--新增界面-->
-		<el-dialog :title="addTitle" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
-			<el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm">
-				<el-form-item label="资产方名称" prop="companyName" v-show="addState">
-					<el-input v-model="addForm.companyName" autocomplete="off" placeholder="请输入资产方地址"></el-input>
-				</el-form-item>
-                <el-form-item label="关联生产方" v-show="addState">
-                    <el-select v-model="addForm.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="companyAddress" v-show="addState">
-					<el-input v-model="addForm.companyAddress" autocomplete="off" placeholder="请输入资产方地址"></el-input>
-				</el-form-item>
-                <el-form-item label="姓名" prop="username" v-show="!addState">
-					<el-input v-model="addForm.username" autocomplete="off" placeholder="请输入姓名"></el-input>
-				</el-form-item>
-				<el-form-item label="手机号" prop="account" v-show="!addState">
-					<el-input v-model="addForm.account" autocomplete="off" placeholder="请输入手机号"></el-input>
-				</el-form-item>
-                <el-form-item label="角色" v-show="!addState">
-                    <el-input v-model="addForm.roleName" autocomplete="off" placeholder="请输入角色名称"></el-input>
-				</el-form-item>
-			</el-form>
-			<div slot="footer" class="dialog-footer">
-                <span v-if="!addState" style="color:#f00;float:left;margin-left:60px;">初始密码:000000</span>
-				<el-button @click.native="addFormVisible = false">取消</el-button>
-                <el-button v-if="addState" type="primary" @click.native="toNext(0)">下一步</el-button>
-                <el-button v-if="!addState" type="primary" @click.native="toPart(0)">上一步</el-button>
-				<el-button v-if="!addState" type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button>
-			</div>
-		</el-dialog>
-
-		<!--编辑界面-->
-		<el-dialog title="编辑资产方" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass='customWidth'>
-			<el-form :model="editForm" label-width="100px" :rules="formRules" ref="editForm">
-				<el-form-item label="资产方名称" prop="companyName">
-					<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="companyAddress">
-					<el-input v-model="editForm.companyAddress" autocomplete="off" placeholder="请输入资产方地址"></el-input>
-				</el-form-item>
-			</el-form>
-			<div slot="footer" class="dialog-footer">
-				<el-button @click.native="editFormVisible = false">取消</el-button>
-				<el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>
-			</div>
-		</el-dialog>
-	</section>
-</template>
-
-<script>
-	import util from '../../common/js/util'
-
-	export default {
-		data() {
-            var checkPhone = (rule, value, callback) => {
-                if (!value) {
-                    return callback(new Error('请输入联系方式'));
-                } else {
-                    const reg = /^1[0-9]\d{9}$/
-                    if (reg.test(value)) {
-                        callback();
-                    } else {
-                        return callback(new Error('请输入正确的联系方式'));
-                    }
-                }
-            };
-			return {
-				filters: {
-                    keyName: ''
-                },
-
-                user: JSON.parse(sessionStorage.getItem('user')),
-                companys:[],
-				list: [],
-				total: 0,
-                page: 1,
-                size: 20,
-                listLoading: false,
-                tableHeight: 0,
-                
-                formRules: {
-					companyName: [
-						{ required: true, message: '请输入资产方名称', trigger: 'blur' }
-                    ],
-                    companyAddress: [
-                        { required: true, message: '请输入资产方地址', trigger: 'blur' }
-                    ],
-                    username: [
-						{ required: true, message: '请输入姓名', trigger: 'blur' }
-                    ],
-                    account: [
-                        { required: true, validator: checkPhone, trigger: 'blur'}
-                    ]
-                },
-
-                team: [{label:'资产方',value:0},{label:'生产方',value:1}],
-
-                // 新增界面
-				addFormVisible: false,
-                addLoading: false,
-                addState: true,
-                addTitle: '新增资产方',
-				addForm: {
-                    companyName: '',
-                    companyAddress: '',
-                    companyIds: [],
-                    username: '',
-                    account: '',
-                    companyId: '',
-                    roleName: "系统管理员",
-                    flag: 0
-				},
-                
-                // 编辑界面
-				editFormVisible: false,
-                editLoading: false,
-				editForm: {
-					id: 0,
-                    companyName: '',
-                    companyType: 0,
-                    companyAddress: '',
-                    companyIds: [],
-                    flag: 1
-				}
-			}
-		},
-		methods: {
-            //  分页
-			handleCurrentChange(val) {
-				this.page = val;
-				this.getComp();
-            },
-
-            handleSizeChange(val) {
-                this.size = val;
-				this.getComp();
-            },
-
-            //获取基础数据
-            getMsg() {
-                this.http.post(this.port.base.relationList, {
-                    companyType: 1
-                }, res => {
-                    if (res.code == "ok") {
-                        this.companys = res.data;
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: 'error'
-                        });
-                    }
-                }, error => {
-                    this.$message({
-                        message: error,
-                        type: 'error'
-                    });
-                })
-            },
-
-			//获取资产方列表
-			getComp() {
-				this.listLoading = true;
-                this.http.post(this.port.base.companyList, {
-                    keyName: this.filters.keyName,
-                    pageNum: this.page,
-                    pageSize: this.size,
-                    companyType: 0
-                }, res => {
-                    this.listLoading = false;
-                    if (res.code == "ok") {
-                        this.list = res.data.list;
-                        this.total = res.data.total;
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: 'error'
-                        });
-                    }
-                }, error => {
-                    this.listLoading = false;
-                    this.$message({
-                        message: error,
-                        type: 'error'
-                    });
-                })
-            }, 
-
-            toNext(i) {
-                if(i == 0) {
-                    this.addState = false;
-                     this.addTitle = '新增资产方管理员';
-                }
-            },
-
-            toPart(i) {
-                if(i == 0) {
-                    this.addState = true;
-                    this.addTitle = '新增资产方';
-                }
-            },
-
-            //显示新增界面
-			handleAdd() {
-                this.addFormVisible = true;
-                this.addState = true;
-                this.addTitle = '新增资产方';
-				this.addForm = {
-                    companyName: '',
-                    companyAddress: '',
-                    companyIds: [],
-                    username: '',
-                    account: '',
-                    companyId: '',
-                    roleName: "系统管理员",
-                    flag: 0
-				};
-            },
-            
-            //新增
-			addSubmit() {
-				this.$refs.addForm.validate((valid) => {
-					if (valid) {
-                        this.addLoading = true;
-                        var str = "";
-                        for(var i in this.addForm.companyIds){
-                            if(i == this.addForm.companyIds.length-1){
-                                str += this.addForm.companyIds
-                            } else {
-                                str += this.addForm.companyIds + ","
-                            }
-                        }
-                        this.http.post(this.port.base.addCompany, {
-                            companyName: this.addForm.companyName,
-                            companyType: 0,
-                            companyAddress: this.addForm.companyAddress,
-                            companyIds: str,
-                            flag: 0
-                        } , res => {
-                            if (res.code == "ok") {
-                                this.addPeo(res.data.id);
-                            } else {
-                                this.$message({
-                                    message: res.msg,
-                                    type: 'error'
-                                });
-                            }
-                        }, error => {
-                            this.addLoading = false;
-                            this.addFormVisible = false;
-                            this.$message({
-                                message: error,
-                                type: 'error'
-                            });
-                        })
-					}
-				});
-            },
-
-            //添加人员
-            addPeo(companyId) {
-                this.$refs.addForm.validate((valid) => {
-					if (valid) {
-                        this.http.post(this.port.project.addUser, {
-                            username: this.addForm.username,
-                            account: this.addForm.account,
-                            companyId: companyId,
-                            roleName: this.addForm.roleName,
-                            parentId: this.user.id,
-                            addType: 0,
-                            flag: 0
-                        } , res => {
-                            this.addLoading = false;
-                            if (res.code == "ok") {
-                                this.addFormVisible = false;
-                                this.$message({
-                                    message: '创建成功',
-                                    type: 'success'
-                                });
-                                this.getComp();
-                            } else {
-                                this.$message({
-                                    message: res.msg,
-                                    type: 'error'
-                                });
-                            }
-                        }, error => {
-                            this.addLoading = false;
-                            this.addFormVisible = false;
-                            this.$message({
-                                message: error,
-                                type: 'error'
-                            });
-                        })
-					}
-				});
-            },
-            
-			//删除
-			handleDel(index, row) {
-				this.$confirm('确认删除该资产方吗?', '提示', {
-					type: 'warning'
-				}).then(() => {
-                    this.http.post(this.port.base.delCompany, {
-                        id: row.id
-                    }, res => {
-                        if (res.code == "ok") {
-                            this.$message({
-                                message: '删除成功',
-                                type: 'success'
-                            });
-                            this.getComp();
-                        } else {
-                            this.$message({
-                                message: res.msg,
-                                type: 'error'
-                            });
-                        }
-                    }, error => {
-                        this.$message({
-                            message: error,
-                            type: 'error'
-                        });
-                    })
-				});
-            },
-            
-			//显示编辑界面
-			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,
-                    companyType: 0,
-                    companyAddress: row.companyAddress,
-                    companyIds: array,
-                    flag: 1
-				};
-            },
-            
-			//编辑
-			editSubmit() {
-				this.$refs.editForm.validate((valid) => {
-					if (valid) {
-                        this.editLoading = true;
-                        var str = "";
-                        for(var i in this.editForm.companyIds){
-                            if(i == this.editForm.companyIds.length-1){
-                                str += this.editForm.companyIds
-                            } else {
-                                str += this.editForm.companyIds + ","
-                            }
-                        }
-                        this.http.post(this.port.base.addCompany, {
-                            id: this.editForm.id,
-                            companyName: this.editForm.companyName,
-                            companyType: 0,
-                            companyAddress: this.editForm.companyAddress,
-                            companyIds: str,
-                            flag: 1
-                        } , res => {
-                            this.editLoading = false;
-                            if (res.code == "ok") {
-                                this.editFormVisible = false;
-                                this.$message({
-                                    message: '修改成功',
-                                    type: 'success'
-                                });
-                                this.getComp();
-                            } else {
-                                this.$message({
-                                    message: res.msg,
-                                    type: 'error'
-                                });
-                            }
-                        }, error => {
-                            this.editLoading = false;
-                            this.editFormVisible = false;
-                            this.$message({
-                                message: error,
-                                type: 'error'
-                            });
-                        })
-					}
-				});
-            }
-        },
-
-        created() {
-            let height = window.innerHeight;
-            this.tableHeight = height - 210;
-            const that = this;
-            window.onresize = function temp() {
-                that.tableHeight = window.innerHeight - 210;    
-            };
-        },
-
-		mounted() {
-            this.getMsg();
-			this.getComp();
-        }
-	}
-</script>
-
-<style scoped>
-    
-</style>

+ 0 - 601
lib_vue/src/views/base/factory.vue

@@ -1,601 +0,0 @@
-<template>
-	<section>
-		<!--工具条-->
-		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
-			<el-form :inline="true" :model="filters">
-                <el-form-item>
-                    <el-input v-model="filters.keyName" placeholder="请输入生产方名称进行搜索" clearable></el-input>
-                </el-form-item>
-				<el-form-item>
-					<el-button type="primary" @click.native="getFactory">查询</el-button>
-				</el-form-item>
-				<el-form-item style="float:right;">
-					<el-button type="primary" @click.native="handleAdd">新增</el-button>
-				</el-form-item>
-			</el-form>
-		</el-col>
-
-		<!--列表-->
-		<el-table :data="list" highlight-current-row :height="tableHeight" v-loading="listLoading" style="width: 100%;">
-            <el-table-column type="index" width="60"></el-table-column>
-			<el-table-column prop="companyName" label="生产方名称" width="250" sortable></el-table-column>
-            <el-table-column prop="administrator" label="生产方管理员" width="150" sortable>
-            </el-table-column>
-            <el-table-column prop="relateCompanyList" label="关联资产方" width="400" sortable>
-                <template slot-scope="scope">
-                    <span class="info" v-for="(item, index) in scope.row.relateCompanyList">
-                        {{item.companyName}}
-                        <span v-if="index != scope.row.relateCompanyList.length-1">、</span>
-                    </span>
-                </template>
-            </el-table-column>
-            <el-table-column prop="companyAddress" label="生产方地址" sortable></el-table-column>
-			<el-table-column label="操作" width="150">
-				<template slot-scope="scope">
-					<el-button size="small" @click.native="handleEdit(scope.$index, scope.row)">编辑</el-button>
-					<el-button type="danger" size="small" @click.native.native="handleDel(scope.$index, scope.row)">删除</el-button>
-				</template>
-			</el-table-column>
-		</el-table>
-
-		<!--工具条-->
-		<el-col :span="24" class="toolbar">
-            <el-pagination
-                @size-change="handleSizeChange"
-                @current-change="handleCurrentChange"
-                :page-sizes="[20 , 50 , 80 , 100]"
-                :page-size="20"
-                layout="total, sizes, prev, pager, next"
-                :total="total"
-                style="float:right;">
-            </el-pagination>
-		</el-col>
-
-        <!--新增界面-->
-		<el-dialog :title="addTitle" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
-			<el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm">
-				<el-form-item label="生产方名称" prop="companyName" v-show="addState">
-					<el-input v-model="addForm.companyName" autocomplete="off" placeholder="请输入生产方名称"></el-input>
-				</el-form-item>
-                <el-form-item label="关联资产方" v-show="addState">
-                    <el-select v-model="addForm.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="companyAddress" v-show="addState">
-					<el-input v-model.lazy="addForm.companyAddress" autocomplete="off" @change="changeFactoryArea('addContainer')" placeholder="请输入生产方地址"></el-input>
-				</el-form-item>
-                <div id="addContainer" class="formMap" v-show="addState"></div>
-                <el-form-item label="姓名" prop="username" v-show="!addState">
-					<el-input v-model="addForm.username" autocomplete="off" placeholder="请输入姓名"></el-input>
-				</el-form-item>
-				<el-form-item label="手机号" prop="account" v-show="!addState">
-					<el-input v-model="addForm.account" autocomplete="off" placeholder="请输入手机号"></el-input>
-				</el-form-item>
-                <el-form-item label="角色" v-show="!addState">
-                    <el-input v-model="addForm.roleName" autocomplete="off" placeholder="请输入角色名称"></el-input>
-				</el-form-item>
-			</el-form>
-			<div slot="footer" class="dialog-footer">
-                 <span v-if="!addState" style="color:#f00;float:left;margin-left:60px;">初始密码:000000</span>
-				<el-button @click.native="addFormVisible = false">取消</el-button>
-                <el-button v-if="addState" type="primary" @click.native="toNext(0)">下一步</el-button>
-                <el-button v-if="!addState" type="primary" @click.native="toPart(0)">上一步</el-button>
-				<el-button v-if="!addState" type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button>
-			</div>
-		</el-dialog>
-
-		<!--编辑界面-->
-		<el-dialog title="编辑生产方" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass='customWidth'>
-			<el-form :model="editForm" label-width="100px" :rules="formRules" ref="editForm">
-				<el-form-item label="生产方名称" prop="companyName">
-					<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="companyAddress">
-					<el-input v-model="editForm.companyAddress" autocomplete="off" :change="changeFactoryArea('editContainer')" placeholder="请输入生产方地址"></el-input>
-				</el-form-item>
-                <div id="editContainer" class="formMap"></div>
-			</el-form>
-			<div slot="footer" class="dialog-footer">
-				<el-button @click.native="editFormVisible = false">取消</el-button>
-				<el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>
-			</div>
-		</el-dialog>
-	</section>
-</template>
-
-<script>
-    import Vue from 'vue';
-	import util from '../../common/js/util'
-
-	export default {
-		data() {
-            var checkPhone = (rule, value, callback) => {
-                if (!value) {
-                    return callback(new Error('请输入联系方式'));
-                } else {
-                    const reg = /^1[0-9]\d{9}$/
-                    if (reg.test(value)) {
-                        callback();
-                    } else {
-                        return callback(new Error('请输入正确的联系方式'));
-                    }
-                }
-            };
-			return {
-				filters: {
-                    keyName: ''
-                },
-
-                user: JSON.parse(sessionStorage.getItem('user')),
-                companys:[],
-				list: [],
-				total: 0,
-                page: 1,
-                size: 20,
-                listLoading: false,
-                tableHeight: 0,
-                
-                formRules: {
-					companyName: [
-						{ required: true, message: '请输入生产方名称', trigger: 'blur' }
-                    ],
-                    companyAddress: [
-                        { required: true, message: '请输入生产方地址', trigger: 'blur' }
-                    ],
-                    username: [
-						{ required: true, message: '请输入姓名', trigger: 'blur' }
-                    ],
-                    account: [
-                        { required: true, validator: checkPhone, trigger: 'blur'}
-                    ]
-                },
-
-                // 地图
-                map: '',
-                marker: '',
-
-                // 新增界面
-				addFormVisible: false,
-                addLoading: false,
-                addState: true,
-                addTitle: '新增生产方',
-				addForm: {
-                    companyName: '',
-                    companyType: 1,
-                    companyAddress: '',
-                    yLng: 116.397511,
-                    xLat: 39.907545,
-                    companyIds: [],
-                    username: '',
-                    account: '',
-                    companyId: '',
-                    roleName: "系统管理员",
-                    flag: 0
-				},
-                
-                // 编辑界面
-				editFormVisible: false,
-				editLoading: false,
-				editForm: {
-					id: 0,
-					companyName: '',
-                    companyType: 1,
-                    companyAddress: '',
-                    yLng: 0,
-                    xLat: 0,
-                    companyIds: [],
-                    flag: 1
-				}
-			}
-		},
-		methods: {
-            //  分页
-			handleCurrentChange(val) {
-				this.page = val;
-				this.getFactory();
-            },
-
-            handleSizeChange(val) {
-                this.size = val;
-				this.getFactory();
-            },
-
-            //获取基础数据
-            getMsg() {
-                this.http.post(this.port.base.relationList, {
-                    companyType: 0
-                }, res => {
-                    if (res.code == "ok") {
-                        this.companys = res.data;
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: 'error'
-                        });
-                    }
-                }, error => {
-                    this.$message({
-                        message: error,
-                        type: 'error'
-                    });
-                })
-            },
-
-			//获取列表
-			getFactory() {
-				this.listLoading = true;
-                this.http.post(this.port.base.companyList, {
-                    keyName: this.filters.keyName,
-                    pageNum: this.page,
-                    pageSize: this.size,
-                    companyType: 1
-                }, res => {
-                    this.listLoading = false;
-                    if (res.code == "ok") {
-                        this.list = res.data.list;
-                        this.total = res.data.total;
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: 'error'
-                        });
-                    }
-                }, error => {
-                    this.listLoading = false;
-                    this.$message({
-                        message: error,
-                        type: 'error'
-                    });
-                })
-            },
-            
-            //地址输入切换
-            changeFactoryArea(mapId) {
-                if(mapId == "addContainer"){
-                    this.markLocation(this.addForm.companyAddress, mapId);
-                } else {
-                    this.markLocation(this.editForm.companyAddress, mapId);
-                }
-                
-            },
-
-            toNext(i) {
-                if(i == 0) {
-                    this.addState = false;
-                     this.addTitle = '新增生产方管理员';
-                }
-            },
-
-            toPart(i) {
-                if(i == 0) {
-                    this.addState = true;
-                    this.addTitle = '新增生产方';
-                }
-                var _this = this
-                setTimeout(function(){ _this.setMap('addContainer'); }, 100);
-            },
-
-            //显示新增界面
-			handleAdd() {
-                this.addFormVisible = true;
-                this.addState = true;
-                this.addTitle = '新增生产方';
-				this.addForm = {
-                    companyName: '',
-                    companyAddress: '',
-                    yLng: 116.397511,
-                    xLat: 39.907545,
-                    companyIds: [],
-                    username: '',
-                    account: '',
-                    companyId: '',
-                    roleName: "系统管理员",
-                    flag: 0
-                };
-            },
-
-            //新增
-			addSubmit() {
-				this.$refs.addForm.validate((valid) => {
-					if (valid) {
-                        this.addLoading = true;
-                        var str = "";
-                        for(var i in this.addForm.companyIds){
-                            if(i == this.addForm.companyIds.length-1){
-                                str += this.addForm.companyIds
-                            } else {
-                                str += this.addForm.companyIds + ","
-                            }
-                        }
-                        this.http.post(this.port.base.addCompany, {
-                            companyName: this.addForm.companyName,
-                            companyType: 1,
-                            companyAddress: this.addForm.companyAddress,
-                            yLng: this.addForm.yLng,
-                            xLat: this.addForm.xLat,
-                            companyIds: str,
-                            flag: 0
-                        } , res => {
-                            this.addLoading = false;
-                            if (res.code == "ok") {
-                                this.addPeo(res.data.id);
-                            } else {
-                                this.$message({
-                                    message: res.msg,
-                                    type: 'error'
-                                });
-                            }
-                        }, error => {
-                            this.addLoading = false;
-                            this.addFormVisible = false;
-                            this.$message({
-                                message: error,
-                                type: 'error'
-                            });
-                        })
-					}
-				});
-            },
-
-            //添加人员
-            addPeo(companyId) {
-                this.$refs.addForm.validate((valid) => {
-					if (valid) {
-                        this.http.post(this.port.project.addUser, {
-                            username: this.addForm.username,
-                            account: this.addForm.account,
-                            companyId: companyId,
-                            roleName: this.addForm.roleName,
-                            parentId: this.user.id,
-                            addType: 0,
-                            flag: 0
-                        } , res => {
-                            this.addLoading = false;
-                            if (res.code == "ok") {
-                                this.addFormVisible = false;
-                                this.$message({
-                                    message: '创建成功',
-                                    type: 'success'
-                                });
-                                this.getFactory();
-                            } else {
-                                this.$message({
-                                    message: res.msg,
-                                    type: 'error'
-                                });
-                            }
-                        }, error => {
-                            this.addLoading = false;
-                            this.addFormVisible = false;
-                            this.$message({
-                                message: error,
-                                type: 'error'
-                            });
-                        })
-					}
-				});
-            },
-            
-			//删除
-			handleDel(index, row) {
-				this.$confirm('确认删除该生产方吗?', '提示', {
-					type: 'warning'
-				}).then(() => {
-                    this.http.post(this.port.base.delCompany, {
-                        id: row.id
-                    }, res => {
-                        if (res.code == "ok") {
-                            this.$message({
-                                message: '删除成功',
-                                type: 'success'
-                            });
-                            this.getFactory();
-                        } else {
-                            this.$message({
-                                message: res.msg,
-                                type: 'error'
-                            });
-                        }
-                    }, error => {
-                        this.$message({
-                            message: error,
-                            type: 'error'
-                        });
-                    })
-				});
-            },
-            
-			//显示编辑界面
-			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,
-                    companyType: 1,
-                    companyAddress: row.companyAddress,
-                    yLng: row.ylng,
-                    xLat: row.xlat,
-                    companyIds: array,
-                    flag: 1
-                };
-            },
-            
-			//编辑
-			editSubmit() {
-				this.$refs.editForm.validate((valid) => {
-					if (valid) {
-                        this.editLoading = true;
-                        var str = "";
-                        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;
-                                this.$message({
-                                    message: '修改成功',
-                                    type: 'success'
-                                });
-                                this.getFactory();
-                            } else {
-                                this.$message({
-                                    message: res.msg,
-                                    type: 'error'
-                                });
-                            }
-                        }, error => {
-                            this.editLoading = false;
-                            this.editFormVisible = false;
-                            this.$message({
-                                message: error,
-                                type: 'error'
-                            });
-                        })
-					}
-				});
-            },
-
-            //获取地图
-            setMap(mapId) {
-                if(mapId == 'addContainer') {
-                    this.map = new AMap.Map('addContainer', {
-                        resizeEnable: true, // 允许缩放
-                        center:[ this.addForm.yLng , this.addForm.xLat ],
-                        zoom:10
-                    })
-
-                    this.marker = new AMap.Marker({
-                        map: this.map,
-                        position: new AMap.LngLat(this.addForm.yLng , this.addForm.xLat),   // 经纬度
-                    });
-                } else {
-                    this.map = new AMap.Map('editContainer', {
-                        resizeEnable: true, // 允许缩放
-                        center:[this.editForm.yLng , this.editForm.xLat],
-                        zoom:10
-                    })
-
-                    this.marker = new AMap.Marker({
-                        map: this.map,
-                        position: new AMap.LngLat(this.editForm.yLng , this.editForm.xLat),   // 经纬度
-                    });
-                }
-                
-                var _this = this;
-                this.map.on('click', function(e) {
-                    if(_this.map){
-                        _this.map.remove(_this.marker);
-                    }
-                    var Lng = e.lnglat.getLng(),
-                    Lat = e.lnglat.getLat();
-                    if(mapId == 'addContainer') {
-                        _this.addForm.yLng = Lng;
-                        _this.addForm.xLat = Lat;
-                    } else {
-                        _this.editForm.yLng = Lng;
-                        _this.editForm.xLat = Lat;
-                    }
-                    _this.marker = new AMap.Marker({
-                        map: _this.map,
-                        position: new AMap.LngLat(Lng , Lat),   // 经纬度
-                    });
-                });
-            },
-
-            // 获取经纬度
-            markLocation(address,mapId) {
-                var _this = this;
-                AMap.plugin('AMap.Geocoder', function() {
-                    var geocoder = new AMap.Geocoder();            
-                    geocoder.getLocation(address, function(status, result) {
-                        if (status === 'complete' && result.info === 'OK') {
-                            // 经纬度                      
-                            var lng = result.geocodes[0].location.lng;
-                            var lat = result.geocodes[0].location.lat;
-                            
-                            _this.noSub = false;
-                            if(mapId == "addContainer") {
-                                _this.addForm.yLng = lng;
-                                _this.addForm.xLat = lat;
-                            } else {
-                                _this.editForm.yLng = lng;
-                                _this.editForm.xLat = 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('定位失败!');
-                        }
-                    });
-                });
-            }
-        },
-        created() {
-            let height = window.innerHeight;
-            this.tableHeight = height - 210;
-            const that = this;
-            window.onresize = function temp() {
-                that.tableHeight = window.innerHeight - 210;    
-            };
-        },
-        watch: {
-            addFormVisible(val) {
-                if(val){
-                    var _this = this
-                    setTimeout(function(){ _this.setMap('addContainer'); }, 300);
-                }
-            },
-            editFormVisible(val) {
-                if(val){
-                    var _this = this
-                    setTimeout(function(){ _this.setMap('editContainer'); }, 300);
-                }
-            }
-        },
-		mounted() {
-            this.getMsg();
-			this.getFactory();
-        }
-	}
-</script>
-
-<style scoped>
-    .formMap {
-        height: 400px;
-    }
-</style>

+ 152 - 199
lib_vue/src/views/book/bookList.vue

@@ -4,13 +4,12 @@
 		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
 			<el-form :inline="true" :model="filters">
 				<el-form-item>
-					<el-input v-model="filters.keyName" size="small" placeholder="请输入机构名称"></el-input>
+					<el-input v-model="filters.keyName" size="small" clearable placeholder="请输入机构名称"></el-input>
 				</el-form-item>
 				<el-form-item>
-					<el-button type="primary" size="small" v-on:click="getProject">查询</el-button>
+					<el-button type="primary" size="small" v-on:click="getList">查询</el-button>
 				</el-form-item>
-				<el-form-item style="float:right;">
-                    <!--  v-if="user.parentId == 1 && user.subordinateType == 0" -->
+				<el-form-item style="float:right;" v-if='user.roleType == 0'>
 					<el-button type="primary" size="small" @click="handleAdd">新增</el-button>
 				</el-form-item>
 			</el-form>
@@ -19,12 +18,18 @@
 		<!--列表-->
 		<el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
 			<el-table-column type="index" width="60"></el-table-column>
-			<el-table-column prop="projectName" label="机构名称" width="350" sortable></el-table-column>
-            <el-table-column prop="ownerCompanyName" label="机构位置" sortable></el-table-column>
+			<el-table-column prop="cover" label="图书封面" width="180">
+                <template slot-scope="scope">
+                    <img :src="scope.row.cover">
+				</template>
+            </el-table-column>
+            <el-table-column prop="name" label="图书名称" width="200" sortable></el-table-column>
+            <el-table-column prop="author" label="图书作者" sortable></el-table-column>
+            <el-table-column prop="descrip" label="图书简介" width="300" :show-overflow-tooltip="true"></el-table-column>
 			<el-table-column label="操作" width="160" align="center">
 				<template slot-scope="scope">
-                    <el-button type="primary" size="small" @click="toDetail(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="toDetail(scope.row.id)">详情</el-button>
+					<el-button type="danger" size="small" @click="toDelete(scope.row.id)">删除</el-button>
 				</template>
 			</el-table-column>
 		</el-table>
@@ -43,35 +48,23 @@
 		</el-col>
 
         <!--新增界面-->
-		<el-dialog title="新增项目" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
-			<el-form :model="addForm" label-width="120px" :rules="formRules" ref="addForm">
-                <el-col :span="24">
-                    <el-form-item label="项目名称" prop="projectName">
-                        <el-input v-model="addForm.projectName" autocomplete="off" placeholder="请输入项目名称" style="width:510px"></el-input>
-                    </el-form-item>
-                </el-col>
-                <el-col :span="24">
-                    <el-form-item label="项目模具" prop="mold">
-                        <el-select v-model="addForm.mold" @change="companyChange" clearable filterable multiple placeholder="请选择项目模具" value-key='id' style="width:510px">
-                            <el-option v-for="item in molds" :key="item.id" :label="item.modelName" :value="item">
-                                <span style="float: left">{{ item.modelName }}</span>
-                                <span style="float: right; color: #8492a6; font-size: 6px;margin-right:17px;">{{ item.produceCompany }}</span>
-                            </el-option>
-                        </el-select>
-                    </el-form-item>
-                </el-col>
-                <el-col :span="24">
-                    <el-form-item label="项目经理" prop="managerId">
-                        <el-select v-model="addForm.managerId" clearable filterable placeholder="请选择项目经理" value-key='id' style="width:510px">
-                            <!-- <el-option v-for="item in charger" :key="item.id" :label="item.username" :value="item">
-                            </el-option> -->
-                            <el-option v-for="item in charger" :key="item.id" :label="item.username" :value="item">
-                                <span style="float: left">{{ item.username }}</span>
-                                <span style="float: right; color: #8492a6; font-size: 13px;">{{ item.companyName }}</span>
-                            </el-option>
-                        </el-select>
-                    </el-form-item>
-                </el-col>
+		<el-dialog title="新增图书" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
+            <el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm">
+				<el-form-item label="图书名称" prop="name">
+					<el-input v-model="addForm.name" autocomplete="off" placeholder="请输入图书名称"></el-input>
+				</el-form-item>
+                <el-form-item label="图书作者" prop="author">
+					<el-input v-model="addForm.author" autocomplete="off" placeholder="请输入图书作者"></el-input>
+				</el-form-item>
+                <el-form-item label="图书简介" prop="descrip">
+					<el-input v-model="addForm.descrip" type="textarea" :rows="5" placeholder="请输入图书简介"></el-input>
+				</el-form-item>
+                <el-form-item label="机构图片">
+                    <el-upload class="avatar-uploader" ref="upload" accept="image/*" list-type="picture-card"
+                        :limit="1" action="action" :auto-upload="false" :http-request="uploadFile" :file-list='addForm.file'>
+                        <i slot="default" class="el-icon-plus"></i>
+                    </el-upload>
+                </el-form-item>
 			</el-form>
 			<div slot="footer" class="dialog-footer">
 				<el-button @click.native="addFormVisible = false">取消</el-button>
@@ -82,7 +75,6 @@
 </template>
 
 <script>
-	import util from '../../common/js/util'
 	export default {
 		data() {
 			return {
@@ -90,8 +82,6 @@
 					keyName: ''
                 },
                 user: JSON.parse(sessionStorage.getItem('user')),
-                charger: [],
-                molds: [],
 
 				list: [],
 				total: 0,
@@ -101,110 +91,56 @@
                 tableHeight: 0,
 
                 formRules: {
-					projectName: [
-						{ required: true, message: '请输入项目名称', trigger: 'blur' }
+					name: [
+						{ required: true, message: '请输入图书名称', trigger: 'blur' }
                     ],
-                    mold: [
-                        { required: true, message: '请选择项目模具', trigger: ['blur','change'] }
+                    author: [
+						{ required: true, message: '请输入图书作者', trigger: 'blur' }
                     ],
-                    managerId: [
-                        { required: true, message: '请选择项目经理', trigger: ['blur','change'] }
+                    descrip: [
+						{ required: true, message: '请输入图书简介', trigger: 'blur' }
                     ]
                 },
+
+                // 地图
+                map: '',
+                marker: '',
                 
-                addFormVisible: false, //新增界面是否显示
+                // 新增界面
+                addFormVisible: false,
 				addLoading: false,
-				//新增界面数据
 				addForm: {
-					projectName: '',
-                    mold: [],
-                    managerId: ''
+					name: '',
+                    author: '',
+                    descrip: '',
+                    file: '',
 				}
 
 			}
 		},
 		methods: {
-            //获取基础数据
-            getMsg(){
-                this.http.post(this.port.project.getUserById, {
-                    companyIds: this.user.companyId,
-                    id: this.user.id
-                } , res => {
-                    if (res.code == "ok") {
-                        this.charger = res.data;
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: 'error'
-                        });
-                    }
-                }, error => {
-                    this.$message({
-                        message: error,
-                        type: 'error'
-                    });
-                })
-
-                //获取模具
-                this.getMoulds();
-            },
-
-            //获取模具
-            getMoulds(){
-                this.http.post(this.port.mold.modelList, {
-                    parentId: this.user.parentId,
-                    id: this.user.id
-                }, res => {
-                    if (res.code == "ok") {
-                        this.molds = res.data;
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: 'error'
-                        });
-                    }
-                }, error => {
-                    this.$message({
-                        message: error,
-                        type: 'error'
-                    });
-                })
-            },
-
 			//分页
 			handleCurrentChange(val) {
 				this.page = val;
-				this.getProject();
+				this.getList();
             },
 
             handleSizeChange(val) {
                 this.size = val;
-				this.getProject();
+				this.getList();
             },
             
 			//获取项目列表
-			getProject() {
+			getList() {
 				this.listLoading = true;
-				this.http.post(this.port.project.projectList, {
-                    keyName: this.filters.keyName,
+				this.http.post(this.port.book.list, {
+                    // keyName: this.filters.keyName,
                     pageNum: this.page,
                     pageSize: this.size,
                 }, res => {
                     this.listLoading = false;
                     if (res.code == "ok") {
-                        var list = res.data.list;
-                        for(var i in list){
-                            var customCompaniesStr = "";
-                            for(var j in list[i].customCompanies){
-                                if(j == list[i].customCompanies.length -1){
-                                    customCompaniesStr += list[i].customCompanies[j].companyName;
-                                } else {
-                                    customCompaniesStr += list[i].customCompanies[j].companyName + "、";
-                                }
-                            }
-                            list[i].customCompaniesStr = customCompaniesStr;
-                        }
-                        this.list = list;
+                        this.list = res.data.list;
                         this.total = res.data.total;
                     } else {
                         this.$message({
@@ -222,103 +158,122 @@
             },
 
             //详情
-            toDetail(row) {
-                this.$router.push('/agency/' + row.id);
-            },
-
-            //选择公司切换人员
-            companyChange() {
-                var param = {} ,
-                    str = this.user.companyId;
-                for(var i in this.addForm.mold){
-                    str += "," + this.addForm.mold[i].produceCompanyId;
-                }
-                param.companyIds = str;
-                param.id = this.user.id
-                this.http.post(this.port.project.getUserById, param , res => {
-                    if (res.code == "ok") {
-                        this.charger = res.data;
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: 'error'
-                        });
-                    }
-                }, error => {
-                    this.$message({
-                        message: error,
-                        type: 'error'
-                    });
-                })
+            toDetail(id) {
+                this.$router.push('/book/' + id);
             },
 
             //显示新增界面
 			handleAdd() {
-                //重新获取一下模具
-                this.getMoulds();
-				this.addFormVisible = true;
+                this.addLoading = false;
+                this.addFormVisible = true;
 				this.addForm = {
-					projectName: '',
-                    mold: [],
-                    managerId: ''
+					name: '',
+                    author: '',
+                    descrip: '',
+                    file: '',
 				};
             },
 
             //新增
 			addSubmit() {
-				this.$refs.addForm.validate((valid) => {
-					if (valid) {
-                        var cId = "",
-                            cName = "",
-                            mId = "";
-
-                        for(var i in this.addForm.mold){
-                            if(cId.indexOf(this.addForm.mold[i].produceCompanyId) == -1){
-                                cId += this.addForm.mold[i].produceCompanyId + ",";
-                                cName += this.addForm.mold[i].produceCompanyName + ",";
-                            }
-                            mId += this.addForm.mold[i].id + ","
-                        }
-
-                        cId = cId.substring(0,cId.length-1);
-                        cName = cName.substring(0,cName.length-1);
-                        mId = mId.substring(0,mId.length-1);
-
-                        this.addLoading = true;
-                        this.http.post(this.port.project.addProject, {
-                            projectName: this.addForm.projectName,
-                            customerCompanyIds: cId,
-                            customerCompanyNames: cName,
-                            manager: this.addForm.managerId.username,
-                            managerId: this.addForm.managerId.id,
-                            modelIds: mId,
-                            flag: 0
-                        } , res => {
-                            this.addLoading = false;
-                            if (res.code == "ok") {
+				this.$refs.addForm.validate(valid => {
+                    if (valid) {
+                        if(this.$refs.upload.uploadFiles.length == 1) {
+                            this.$refs.upload.submit();
+                        } else {
+                            this.http.post( this.port.book.add, {
+                                name: this.addForm.name,
+                                author: this.addForm.author,
+                                descrip: this.addForm.descrip
+                            },
+                            res => {
+                                if (res.code == "ok") {
+                                    this.addFormVisible = false;
+                                    this.$message({
+                                        message: "添加成功",
+                                        type: "success"
+                                    });
+                                    this.getList();
+                                } else {
+                                    this.$message({
+                                        message: res.msg,
+                                        type: "error"
+                                    });
+                                }
+                            },
+                            error => {
                                 this.addFormVisible = false;
                                 this.$message({
-                                    message: '创建成功',
-                                    type: 'success'
+                                    message: error,
+                                    type: "error"
                                 });
-                                this.getProject();
-                            } else {
-                                this.$message({
-                                    message: res.msg,
-                                    type: 'error'
-                                });
-                            }
-                        }, error => {
-                            this.addLoading = false;
-                            this.addFormVisible = false;
+                            });
+                        }
+                    }
+                })
+            },
+            
+            uploadFile(params){
+                var fileObj = params.file;
+                var form = new FormData();
+                form.append("file", fileObj);
+                form.append("name", this.addForm.name);
+                form.append("author", this.addForm.author);
+                form.append("descrip", this.addForm.descrip);
+                this.http.uploadFile( this.port.book.add, form,
+                res => {
+                    if (res.code == "ok") {
+                        this.$message({
+                            message: "添加成功",
+                            type: "success"
+                        });
+                        this.addFormVisible = false;
+                        this.$refs.upload.clearFiles();
+                        this.getList();
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.addFormVisible = false;
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
+            //删除
+            toDelete(id) {
+                this.$confirm('确认删除该图书吗?', '提示', {
+					type: 'warning'
+				}).then(() => {
+                    this.http.post(this.port.book.delete, {
+                        id: id
+                    }, res => {
+                        if (res.code == "ok") {
                             this.$message({
-                                message: error,
+                                message: '删除成功',
+                                type: 'success'
+                            });
+                            this.getList();
+                        } else {
+                            this.$message({
+                                message: res.msg,
                                 type: 'error'
                             });
-                        })
-					}
+                        }
+                    }, error => {
+                        this.$message({
+                            message: error,
+                            type: 'error'
+                        });
+                    })
 				});
-			},
+            },
         },
         created() {
             let height = window.innerHeight;
@@ -329,13 +284,11 @@
             };
         },
 		mounted() {
-            this.getMsg();
-			this.getProject();
+			this.getList();
 		}
 	}
 
 </script>
 
 <style scoped>
-
 </style>

+ 690 - 0
lib_vue/src/views/course/courseDetail.vue

@@ -0,0 +1,690 @@
+<template>
+    <section>
+        <!-- 机构信息 -->
+        <el-col :span="24" class="agencyHead">
+            <el-container>
+                <el-container>
+                    <el-aside width="335px;">
+                        <div class="agencyHead_img">
+                            <!-- <el-image class="agencyHead_imgbox" :src="detail.briefIntroductionPic"> -->
+                                <img class="agencyHead_imgbox" :src="detail.briefIntroductionPic">
+                            <!-- </el-image> -->
+                        </div>
+                    </el-aside>
+                    <el-container>
+                        <el-header height="90px;">
+                            {{detail.name}}
+                            <el-button type="text" @click="editDetail(0)" icon="el-icon-edit" class="agencyHead_edit"></el-button>
+                            <el-button type="text" @click="backToList" class="agencyHead_back"><i class="iconfont iconfanhui1"></i></el-button>
+                        </el-header>
+                        <el-footer>
+                            <span class="info">{{detail.headIntroduction==null?"暂无简介":detail.headIntroduction}}</span>
+                        </el-footer>
+                    </el-container>
+                </el-container>
+            </el-container>
+        </el-col>
+        
+        <el-col :span="24" class="agencyDeail">
+            <!-- 轮播图 -->
+            <el-col :span="24" class="agencyBody_title">轮播图</el-col>
+            <el-col :span="24" class="agencyBody_main">
+                <el-upload action="/api/institutional/updatePics/" accept="image/*" multiple :limit="5" :data="uploadMsg" list-type="picture-card" 
+                    :file-list="detail.pics"
+                    :on-preview="handlePictureCardPreview" 
+                    :on-remove="handleRemove"
+                    :on-success="handleUploadSuccess"
+                    :on-error="handleUploadError">
+                    <i slot="default" class="el-icon-plus"></i>
+                    <div slot="file" slot-scope="{file}">
+                        <img class="el-upload-list__item-thumbnail" :src="file.url" alt="">
+                        <span class="el-upload-list__item-actions">
+                            <span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
+                                <i class="el-icon-zoom-in"></i>
+                            </span>
+                            <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">
+                                <i class="el-icon-delete"></i>
+                            </span>
+                        </span>
+                    </div>
+                </el-upload>
+                <el-dialog :visible.sync="dialogVisible">
+                    <img width="100%" :src="dialogImageUrl" alt="">
+                </el-dialog>
+            </el-col>
+
+            <!-- 基本信息 -->
+            <el-col :span="24" class="agencyBody_title">
+                基本信息
+                <el-button type="text" @click="editDetail(1)" icon="el-icon-edit" class="agencyHead_edit"></el-button>
+            </el-col>
+            <el-col :span="24" class="agencyBody_main">
+                <el-col :span="24" class="agencyBody_detail">
+                    上课时间:
+                    <span class="info" v-if="detail.amTime != null || detail.pmTime != null">{{detail.amTime}} - {{detail.pmTime}}</span>
+                    <span class="info" v-else>暂无</span>
+                </el-col>
+                <el-col :span="24" class="agencyBody_detail">
+                    收费标准:
+                    <span class="info">{{detail.chargingStandard==null?'暂无':detail.chargingStandard}}</span>
+                </el-col>
+                <el-col :span="24" class="agencyBody_detail">
+                    机构位置:
+                    <span class="info">{{detail.address==null?'暂无':detail.address}}</span>
+                </el-col>
+                <el-col :span="24" class="agencyBody_detail">
+                    联系方式:
+                    <span class="info">{{detail.phone==null?'暂无':detail.phone}}</span>
+                </el-col>
+            </el-col>
+
+            <!-- 机构简介 -->
+            <el-col :span="24" class="agencyBody_title">
+                机构介绍
+                <el-button type="text" @click="editDetail(2)" icon="el-icon-edit" class="agencyHead_edit"></el-button>
+            </el-col>
+            <el-col :span="24" class="agencyBody_main">
+                <el-col :span="24" class="agencyBody_detail">
+                    <span class="info">{{detail.briefIntroduction==null?'暂无':detail.briefIntroduction}}</span>
+                </el-col>
+            </el-col>
+
+            <!-- 课程特色 -->
+            <el-col :span="24" class="agencyBody_title">
+                课程特色
+                <el-button type="text" @click="editDetail(3)" icon="el-icon-edit" class="agencyHead_edit"></el-button>
+            </el-col>
+            <el-col :span="24" class="agencyBody_main">
+                <el-col :span="24" class="agencyBody_detail">
+                    <span class="info">{{detail.classAdvantages==null?'暂无':detail.classAdvantages}}</span>
+                </el-col>
+            </el-col>
+        </el-col>
+
+        <!--编辑基础信息-->
+		<el-dialog title="编辑机构信息" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass='customWidth'>
+			<el-form :model="editForm" label-width="100px" :rules="formRules" ref="editForm">
+                <el-col :span="24">
+                    <el-form-item label="机构名称" prop="name">
+                        <el-input v-model="editForm.name" autocomplete="off" placeholder="请输入项目名称"></el-input>
+                    </el-form-item>
+                </el-col>
+                <el-col :span="24">
+                    <el-form-item label="机构简介">
+                        <el-input v-model="editForm.headIntroduction" type="textarea" :rows="5" placeholder="请输入机构简介"></el-input>
+                    </el-form-item>
+                </el-col>
+                <el-col :span="24">
+                    <el-form-item label="机构图片">
+                        <el-upload class="avatar-uploader" ref="upload" accept="image/*" list-type="picture-card"
+                          :limit="1" action="action" :auto-upload="false" :http-request="uploadDiscardFile" :file-list='editForm.headPic'>
+                            <i slot="default" class="el-icon-plus"></i>
+                        </el-upload>
+                    </el-form-item>
+                </el-col>
+			</el-form>
+			<div slot="footer" class="dialog-footer">
+				<el-button @click.native="editFormVisible = false">取消</el-button>
+				<el-button type="primary" @click.native="addSubmit" :loading="editLoading">提交</el-button>
+			</div>
+		</el-dialog>
+
+        <el-dialog title="编辑机构信息" v-if="editFormVisibleOther" :visible.sync="editFormVisibleOther" :close-on-click-modal="false" customClass='customWidth'>
+			<el-form :model="editFormOther" label-width="70px" :rules="formRules" ref="editFormOther">
+                <el-form-item label="上课时间" v-if="editType == 1">
+                    <el-time-picker is-range v-model="editFormOther.time" format="HH:mm:ss" value-format="HH:mm:ss"
+                    range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围" style=width:565px;></el-time-picker>
+                </el-form-item>
+                <el-form-item label="收费标准" v-if="editType == 1">
+                    <el-input v-model="editFormOther.chargingStandard" autocomplete="off" placeholder="请输入收费标准"></el-input>
+                </el-form-item>
+                <el-form-item label="联系方式" v-if="editType == 1">
+                    <el-input v-model="editFormOther.phone" autocomplete="off" placeholder="请输入联系方式"></el-input>
+                </el-form-item>
+                <el-form-item label="机构位置" v-if="editType == 1">
+                    <el-input v-model="editFormOther.address" :change="changeFactoryArea('editContainer')" autocomplete="off" placeholder="请输入机构位置"></el-input>
+                </el-form-item>
+                <div id="editContainer" v-if="editType == 1" class="formMap"></div>
+                <el-form-item label="机构介绍" v-if="editType == 2">
+                    <el-input v-model="editFormOther.briefIntroduction" type="textarea" :rows="5" placeholder="请输入机构介绍"></el-input>
+                </el-form-item>
+                <el-form-item label="课程特色" v-if="editType == 3">
+                    <el-input v-model="editFormOther.classAdvantages" type="textarea" :rows="5" placeholder="请输入课程特色"></el-input>
+                </el-form-item>
+			</el-form>
+			<div slot="footer" class="dialog-footer">
+				<el-button @click.native="editFormVisibleOther = false">取消</el-button>
+				<el-button type="primary" @click.native="addSubmitOther" :loading="editOtherLoading">提交</el-button>
+			</div>
+		</el-dialog>
+    </section>
+</template>
+
+<script>
+    export default {
+        data() {
+            return {
+                //基础信息
+                detailId: this.$route.params.id,
+                user: JSON.parse(sessionStorage.getItem('user')),
+                detail: {},
+
+                dialogImageUrl: '',
+                dialogVisible: false,
+                disabled: false,
+
+                uploadMsg: {
+                    "id": this.$route.params.id
+                },
+
+                formRules: {
+                    name: [
+						{ required: true, message: '请输入机构名称', trigger: 'blur' }
+                    ],
+                },
+
+                // 地图
+                map: '',
+                marker: '',
+                
+                //编辑
+                editType: 0,
+                editFormVisible: false,
+                editLoading: false,
+				editForm: {
+					name: '',
+                    headIntroduction: '',
+                    headPic: [{url:""}],
+                },
+
+                editFormVisibleOther: false,
+                editOtherLoading: false,
+                editFormOther: {
+					time: ['09:00:00','18:00:00'],
+                    chargingStandard: '',
+                    phone: '',
+                    address: '',
+                    yLng: '',
+                    xLat: '',
+                    briefIntroduction: '',
+                    classAdvantages: '',
+                },
+            };
+        },
+        methods: {
+            //返回
+            backToList() {
+                this.$router.go(-1);
+            },
+
+            //获取详情
+            getDetail() {
+                this.http.post(this.port.agency.detail, {
+                    id: this.detailId
+                }, res => {
+                    if (res.code == "ok") {
+                        this.detail = res.data;
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        });
+                    }
+                }, error => {
+                    this.$message({
+                        message: error,
+                        type: 'error'
+                    });
+                })
+            },
+
+            //图片上传
+            handleUploadSuccess(response, file, fileList) {
+                if(response.code == "ok") {
+                    this.$message({
+                        message: "上传成功",
+                        type: "success"
+                    });
+                } else {
+                    this.$message({
+                        message: err,
+                        type: "error"
+                    });
+                }
+            },
+
+            handleUploadError(err, file, fileList) {
+                this.$message({
+                    message: err,
+                    type: "error"
+                });
+            },
+
+            //预览图片
+            handlePictureCardPreview(file) {
+                this.dialogImageUrl = file.picUrl;
+                this.dialogVisible = true;
+            },
+
+            //删除图片
+            handleRemove(file) {
+                this.$confirm('确认删除该图片吗?', '提示', {
+					type: 'warning'
+				}).then(() => {
+                    this.http.post(this.port.agency.deletePic, {
+                        id: file.id
+                    }, res => {
+                        if (res.code == "ok") {
+                            this.$message({
+                                message: '删除成功',
+                                type: 'success'
+                            });
+                            this.getDetail();
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: 'error'
+                            });
+                        }
+                    }, error => {
+                        this.$message({
+                            message: error,
+                            type: 'error'
+                        });
+                    })
+				});
+            },
+
+            //打开编辑页面
+            editDetail(type) {
+                this.editType = type;
+                this.editLoading = false;
+                this.editOtherLoading = false;
+                if(type == 0) {
+                    this.editFormVisible = true;
+                    this.editForm = {
+                        "name": this.detail.name,
+                        "headIntroduction": this.detail.headIntroduction,
+                        "headPic": [{url:this.detail.briefIntroductionPic}]
+                    }
+                } else {
+                    this.editFormVisibleOther = true;
+                    const time = this.editFormOther.time;
+                    if(this.detail.amTime != null) {
+                        time[0] = this.detail.amTime;
+                    }
+                    if(this.detail.pmTime != null) {
+                        time[1] = this.detail.pmTime;
+                    }
+                    this.editFormOther = {
+                        "time": time,
+                        "chargingStandard": this.detail.chargingStandard,
+                        "phone": this.detail.phone,
+                        "address": this.detail.address,
+                        "yLng": this.detail.lng,
+                        "xLat": this.detail.lat,
+                        "briefIntroduction": this.detail.briefIntroduction,
+                        "classAdvantages": this.detail.classAdvantages,
+                    }
+                }
+            },
+
+            //提交
+            addSubmit() {
+                this.$refs.editForm.validate(valid => {
+                    if (valid) {
+                        if(this.$refs.upload.uploadFiles.length == 1 && this.$refs.upload.uploadFiles[0].url != this.detail.briefIntroductionPic) {
+                            this.$refs.upload.submit();
+                        } else {
+                            this.http.post( this.port.agency.edit, {
+                                id: this.detail.id,
+                                name: this.editForm.name,
+                                headIntroduction: this.editForm.headIntroduction,
+                            },
+                            res => {
+                                if (res.code == "ok") {
+                                    this.editFormVisible = false;
+                                    this.$message({
+                                        message: "修改成功",
+                                        type: "success"
+                                    });
+                                    this.getDetail();
+                                } else {
+                                    this.$message({
+                                        message: res.msg,
+                                        type: "error"
+                                    });
+                                }
+                            },
+                            error => {
+                                this.editFormVisible = false;
+                                this.$message({
+                                    message: error,
+                                    type: "error"
+                                });
+                            });
+                        }
+                    }
+                })
+            },
+
+            addSubmitOther() {
+                var form = {};
+                if(this.editType == 1) {
+                    form = {
+                        id: this.detail.id,
+                        amTime: this.editFormOther.time[0],
+                        pmTime: this.editFormOther.time[1],
+                        chargingStandard: this.editFormOther.chargingStandard,
+                        phone: this.editFormOther.phone,
+                        address: this.editFormOther.address,
+                    };
+                } else if(this.editType == 2) {
+                    form = {
+                        id: this.detail.id,
+                        briefIntroduction: this.editFormOther.briefIntroduction,
+                    };
+                } else if(this.editType == 3) {
+                    form = {
+                        id: this.detail.id,
+                        classAdvantages: this.editFormOther.classAdvantages,
+                    };
+                }
+                this.http.post( this.port.agency.edit, form ,
+                res => {
+                    if (res.code == "ok") {
+                        this.editFormVisibleOther = false;
+                        this.$message({
+                            message: "修改成功",
+                            type: "success"
+                        });
+                        this.getDetail();
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.editFormVisibleOther = false;
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
+            uploadDiscardFile(params){
+                var fileObj = params.file;
+                var form = new FormData();
+                form.append("file", fileObj);
+                form.append("id", this.detail.id);
+                form.append("name", this.editForm.name);
+                form.append("headIntroduction", this.editForm.headIntroduction);
+                this.http.uploadFile( this.port.agency.edit, form,
+                res => {
+                    if (res.code == "ok") {
+                        this.$message({
+                            message: "修改成功",
+                            type: "success"
+                        });
+                        this.editFormVisible = false;
+                        this.$refs.upload.clearFiles();
+                        this.getDetail();
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.editFormVisible = false;
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
+            //地址输入切换
+            changeFactoryArea(mapId) {
+                if(mapId == "addContainer"){
+                    this.markLocation(this.addForm.address, mapId);
+                } else {
+                    this.markLocation(this.editFormOther.address, mapId);
+                }
+            },
+            
+            //获取地图
+            setMap(mapId) {
+                if(mapId == 'addContainer') {
+                    this.map = new AMap.Map('addContainer', {
+                        resizeEnable: true, // 允许缩放
+                        center:[ this.addForm.yLng , this.addForm.xLat ],
+                        zoom:10
+                    })
+
+                    this.marker = new AMap.Marker({
+                        map: this.map,
+                        position: new AMap.LngLat(this.addForm.yLng , this.addForm.xLat),   // 经纬度
+                    });
+                } else {
+                    this.map = new AMap.Map('editContainer', {
+                        resizeEnable: true, // 允许缩放
+                        center:[this.editFormOther.yLng , this.editFormOther.xLat],
+                        zoom:10
+                    })
+
+                    this.marker = new AMap.Marker({
+                        map: this.map,
+                        position: new AMap.LngLat(this.editFormOther.yLng , this.editFormOther.xLat),   // 经纬度
+                    });
+                }
+                
+                var _this = this;
+                this.map.on('click', function(e) {
+                    if(_this.map){
+                        _this.map.remove(_this.marker);
+                    }
+                    var Lng = e.lnglat.getLng(),
+                    Lat = e.lnglat.getLat();
+                    if(mapId == 'addContainer') {
+                        _this.addForm.yLng = Lng;
+                        _this.addForm.xLat = Lat;
+                    } else {
+                        _this.editFormOther.yLng = Lng;
+                        _this.editFormOther.xLat = Lat;
+                    }
+                    _this.marker = new AMap.Marker({
+                        map: _this.map,
+                        position: new AMap.LngLat(Lng , Lat),   // 经纬度
+                    });
+                });
+            },
+
+            // 获取经纬度
+            markLocation(address,mapId) {
+                var _this = this;
+                AMap.plugin('AMap.Geocoder', function() {
+                    var geocoder = new AMap.Geocoder();            
+                    geocoder.getLocation(address, function(status, result) {
+                        if (status === 'complete' && result.info === 'OK') {
+                            // 经纬度                      
+                            var lng = result.geocodes[0].location.lng;
+                            var lat = result.geocodes[0].location.lat;
+                            
+                            _this.noSub = false;
+                            if(mapId == "addContainer") {
+                                _this.addForm.yLng = lng;
+                                _this.addForm.xLat = lat;
+                            } else {
+                                _this.editFormOther.yLng = lng;
+                                _this.editFormOther.xLat = 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('定位失败!');
+                        }
+                    });
+                });
+            }
+        },
+        watch: {
+            addFormVisible(val) {
+                if(val){
+                    var _this = this
+                    setTimeout(function(){ _this.setMap('addContainer'); }, 300);
+                }
+            },
+            editFormVisibleOther(val) {
+                if(val){
+                    var _this = this
+                    setTimeout(function(){ _this.setMap('editContainer'); }, 300);
+                }
+            }
+        },
+        mounted() {
+            this.getDetail();
+        }
+    };
+</script>
+
+<style scoped lang="scss">
+    a {
+        text-decoration:none;
+        color: #333;
+    }
+
+    .agencyDeail {
+        margin-bottom: 45px;
+    }
+
+    .el-header {
+        font-size: 18px;
+        font-weight: 600;
+        color: #333;
+        line-height: 40px;
+    }
+
+    .el-footer {
+        font-size: 16px;
+        color: #333;
+        line-height: 30px;
+    }
+
+    .el-container.is-vertical {
+        overflow: hidden;
+    }
+
+    .agencyHead {
+        margin: 20px 0 0 0;
+        padding: 0 20px;
+    }
+
+    .agencyHead_img {
+        width:335px;
+        height:160px;
+        overflow:hidden;
+        .agencyHead_imgbox {
+            width:335px;
+            height:160px;
+        }
+    }
+
+    .agencyHead_edit {
+        font-size:16px;
+        margin: 0 0 0 15px;
+        padding: 0;
+    }
+    
+    .agencyHead_back {
+        float: right;
+        margin: 0;
+        position: relative;
+        .iconfont {
+            font-size: 25px;
+            position: absolute;
+            right: -10px;
+            top: 0px;
+        }
+    }
+
+    .allDetail {
+        overflow-y: auto;
+    }
+
+    .agencyBody_title {
+        padding-left: 10px;
+        padding-bottom: 0px;
+        margin: 20px 0;
+        font-size: 16px;
+        line-height: 20px;
+        border-left: 1px #20a0ff solid;
+        position: relative;
+    }
+    
+    .agencyBody_main {
+        padding-left: 40px;
+    }
+
+    .agencyBody_detail {
+        margin-bottom: 20px;
+    }
+
+    .toolbar .el-form-item {
+        font-size: 14px;
+        vertical-align: middle;
+    }
+
+    .divLine {
+        width: 2px;
+        background: #c3c3c3;
+        height: 100%;
+    }
+
+    .projectTitle {
+        font-size: 18px;
+        color: #333;
+    }
+
+    .upload-demo {
+        position: absolute;
+        right: 0;
+        top: -5px;
+    }
+
+    .editDetail {
+        margin-left: 10px;
+        color:#20a0ff;
+        cursor: pointer;
+    }
+
+    .info {
+        color: grey;
+    }
+
+    .model {
+        cursor: pointer;
+        color:#20a0ff;
+    }
+
+    .el-collapse {
+        border: none;
+    }
+
+    .formMap {
+        height: 400px;
+    }
+</style>

+ 355 - 0
lib_vue/src/views/course/courseList.vue

@@ -0,0 +1,355 @@
+<template>
+	<section>
+		<!--工具条-->
+		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
+			<el-form :inline="true" :model="filters">
+				<el-form-item>
+					<el-input v-model="filters.keyName" size="small" clearable placeholder="请输入机构名称"></el-input>
+				</el-form-item>
+				<el-form-item>
+					<el-button type="primary" size="small" v-on:click="getList">查询</el-button>
+				</el-form-item>
+				<el-form-item style="float:right;" v-if='user.roleType == 0'>
+					<el-button type="primary" size="small" @click="handleAdd">新增</el-button>
+				</el-form-item>
+			</el-form>
+		</el-col>
+
+		<!--列表-->
+		<el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
+			<el-table-column type="index" width="60"></el-table-column>
+			<el-table-column prop="name" label="机构名称" width="300" sortable></el-table-column>
+            <el-table-column prop="phone" label="联系方式" width="200" sortable></el-table-column>
+            <el-table-column prop="address" label="机构位置" sortable></el-table-column>
+			<el-table-column label="操作" width="160" align="center">
+				<template slot-scope="scope">
+                    <el-button type="primary" size="small" @click="toDetail(scope.row.id)">详情</el-button>
+					<el-button type="danger" size="small" @click="toDelete(scope.row.id)">删除</el-button>
+				</template>
+			</el-table-column>
+		</el-table>
+
+		<!--工具条-->
+		<el-col :span="24" class="toolbar">
+			<el-pagination
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :page-sizes="[20 , 50 , 80 , 100]"
+                :page-size="20"
+                layout="total, sizes, prev, pager, next"
+                :total="total"
+                style="float:right;">
+            </el-pagination>
+		</el-col>
+
+        <!--新增界面-->
+		<el-dialog title="新增培训机构" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
+            <el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm">
+				<el-form-item label="机构名称" prop="name">
+					<el-input v-model="addForm.name" autocomplete="off" placeholder="请输入机构名称"></el-input>
+				</el-form-item>
+                <el-form-item label="联系方式" prop="phone">
+					<el-input v-model="addForm.phone" autocomplete="off" placeholder="请输入联系方式"></el-input>
+				</el-form-item>
+                <el-form-item label="机构地址" prop="address">
+					<el-input v-model="addForm.address" autocomplete="off" :change="changeFactoryArea('addContainer')" placeholder="请输入机构地址"></el-input>
+				</el-form-item>
+                <div id="addContainer" class="formMap"></div>
+			</el-form>
+			<div slot="footer" class="dialog-footer">
+				<el-button @click.native="addFormVisible = false">取消</el-button>
+				<el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button>
+			</div>
+		</el-dialog>
+	</section>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				filters: {
+					keyName: ''
+                },
+                user: JSON.parse(sessionStorage.getItem('user')),
+                charger: [],
+                molds: [],
+
+				list: [],
+				total: 0,
+                page: 1,
+                size: 20,
+                listLoading: false,
+                tableHeight: 0,
+
+                formRules: {
+					name: [
+						{ required: true, message: '请输入机构名称', trigger: 'blur' }
+                    ]
+                },
+
+                // 地图
+                map: '',
+                marker: '',
+                
+                // 新增界面
+                addFormVisible: false,
+				addLoading: false,
+				addForm: {
+					name: '',
+                    address: '',
+                    phone: '',
+                    yLng: 116.397511,
+                    xLat: 39.907545,
+				}
+
+			}
+		},
+		methods: {
+			//分页
+			handleCurrentChange(val) {
+				this.page = val;
+				this.getList();
+            },
+
+            handleSizeChange(val) {
+                this.size = val;
+				this.getList();
+            },
+            
+			//获取项目列表
+			getList() {
+				this.listLoading = true;
+				this.http.post(this.port.agency.list, {
+                    // keyName: this.filters.keyName,
+                    pageNum: this.page,
+                    pageSize: this.size,
+                }, res => {
+                    this.listLoading = false;
+                    if (res.code == "ok") {
+                        this.list = res.data.list;
+                        this.total = res.data.total;
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        });
+                    }
+                }, error => {
+                    this.listLoading = false;
+                    this.$message({
+                        message: error,
+                        type: 'error'
+                    });
+                })
+            },
+
+            //详情
+            toDetail(id) {
+                this.$router.push('/agency/' + id);
+            },
+
+            //显示新增界面
+			handleAdd() {
+                this.addLoading = false;
+                this.addFormVisible = true;
+				this.addForm = {
+					name: '',
+                    address: '',
+                    phone: '',
+                    yLng: 116.397511,
+                    xLat: 39.907545,
+				};
+            },
+
+            //新增
+			addSubmit() {
+				this.$refs.addForm.validate((valid) => {
+					if (valid) {
+                        this.addLoading = true;
+                        this.http.post(this.port.agency.add, {
+                            name: this.addForm.name,
+                            address: this.addForm.address,
+                            lng: this.addForm.address==''?null:this.addForm.yLng,
+                            lat: this.addForm.address==''?null:this.addForm.xLat,
+                        } , res => {
+                            if (res.code == "ok") {
+                                this.addFormVisible = false;
+                                this.$message({
+                                    message: '创建成功',
+                                    type: 'success'
+                                });
+                                this.getList();
+                            } else {
+                                this.$message({
+                                    message: res.msg,
+                                    type: 'error'
+                                });
+                            }
+                        }, error => {
+                            this.addFormVisible = false;
+                            this.$message({
+                                message: error,
+                                type: 'error'
+                            });
+                        })
+					}
+				});
+            },
+
+            //删除
+            toDelete(id) {
+                this.$confirm('确认删除该培训机构吗?', '提示', {
+					type: 'warning'
+				}).then(() => {
+                    this.http.post(this.port.agency.delete, {
+                        id: id
+                    }, res => {
+                        if (res.code == "ok") {
+                            this.$message({
+                                message: '删除成功',
+                                type: 'success'
+                            });
+                            this.getList();
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: 'error'
+                            });
+                        }
+                    }, error => {
+                        this.$message({
+                            message: error,
+                            type: 'error'
+                        });
+                    })
+				});
+            },
+
+            //地址输入切换
+            changeFactoryArea(mapId) {
+                if(mapId == "addContainer"){
+                    this.markLocation(this.addForm.address, mapId);
+                } else {
+                    this.markLocation(this.editForm.address, mapId);
+                }
+            },
+            
+            //获取地图
+            setMap(mapId) {
+                if(mapId == 'addContainer') {
+                    this.map = new AMap.Map('addContainer', {
+                        resizeEnable: true, // 允许缩放
+                        center:[ this.addForm.yLng , this.addForm.xLat ],
+                        zoom:10
+                    })
+
+                    this.marker = new AMap.Marker({
+                        map: this.map,
+                        position: new AMap.LngLat(this.addForm.yLng , this.addForm.xLat),   // 经纬度
+                    });
+                } else {
+                    this.map = new AMap.Map('editContainer', {
+                        resizeEnable: true, // 允许缩放
+                        center:[this.editForm.yLng , this.editForm.xLat],
+                        zoom:10
+                    })
+
+                    this.marker = new AMap.Marker({
+                        map: this.map,
+                        position: new AMap.LngLat(this.editForm.yLng , this.editForm.xLat),   // 经纬度
+                    });
+                }
+                
+                var _this = this;
+                this.map.on('click', function(e) {
+                    if(_this.map){
+                        _this.map.remove(_this.marker);
+                    }
+                    var Lng = e.lnglat.getLng(),
+                    Lat = e.lnglat.getLat();
+                    if(mapId == 'addContainer') {
+                        _this.addForm.yLng = Lng;
+                        _this.addForm.xLat = Lat;
+                    } else {
+                        _this.editForm.yLng = Lng;
+                        _this.editForm.xLat = Lat;
+                    }
+                    _this.marker = new AMap.Marker({
+                        map: _this.map,
+                        position: new AMap.LngLat(Lng , Lat),   // 经纬度
+                    });
+                });
+            },
+
+            // 获取经纬度
+            markLocation(address,mapId) {
+                var _this = this;
+                AMap.plugin('AMap.Geocoder', function() {
+                    var geocoder = new AMap.Geocoder();            
+                    geocoder.getLocation(address, function(status, result) {
+                        if (status === 'complete' && result.info === 'OK') {
+                            // 经纬度                      
+                            var lng = result.geocodes[0].location.lng;
+                            var lat = result.geocodes[0].location.lat;
+                            
+                            _this.noSub = false;
+                            if(mapId == "addContainer") {
+                                _this.addForm.yLng = lng;
+                                _this.addForm.xLat = lat;
+                            } else {
+                                _this.editForm.yLng = lng;
+                                _this.editForm.xLat = 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('定位失败!');
+                        }
+                    });
+                });
+            }
+        },
+        created() {
+            let height = window.innerHeight;
+            this.tableHeight = height - 210;
+            const that = this;
+            window.onresize = function temp() {
+                that.tableHeight = window.innerHeight - 210;    
+            };
+        },
+        watch: {
+            addFormVisible(val) {
+                if(val){
+                    var _this = this
+                    setTimeout(function(){ _this.setMap('addContainer'); }, 300);
+                }
+            },
+            editFormVisible(val) {
+                if(val){
+                    var _this = this
+                    setTimeout(function(){ _this.setMap('editContainer'); }, 300);
+                }
+            }
+        },
+		mounted() {
+			this.getList();
+		}
+	}
+
+</script>
+
+<style scoped>
+    .formMap {
+        height: 400px;
+    }
+</style>

+ 0 - 151
lib_vue/src/views/invite.vue

@@ -1,151 +0,0 @@
-<template>
-    <div class="main">
-        <div class="title">云模管理平台</div>
-        <p class="hello">{{detail.invitee}}您好!</p>
-        <p class="invite">
-            {{detail.operator}} 邀您参与
-            <span class="impoortant">{{detail.companyName}}</span>的
-            <span class="impoortant">{{detail.projectName}}</span>项目
-        </p>
-        <div class="info">
-            <p class="info1">您的账户信息</p>
-            <p class="info2">
-                手机号
-                <span>{{detail.account}}</span>
-            </p>
-            <p class="info3">
-                初始密码
-                <span>000000</span>
-            </p>
-        </div>
-        <button @click="join">立即加入</button>
-    </div>
-</template>
-
-<script>
-    import util from "../common/js/util";
-    export default {
-        data() {
-            return {
-                inviteeId: "",
-                projectId: "",
-                operatorId: "",
-                detail: ""
-            };
-        },
-        methods: {
-            join() {
-                this.$router.push("/login");
-            }
-        },
-        created() {},
-        mounted() {
-            //获取传入的值
-            this.inviteeId = this.$route.params.inviteeId;
-            this.projectId = this.$route.params.projectId;
-            this.operatorId = this.$route.params.operatorId;
-
-            this.http.post(this.port.project.inviteUser, {
-                inviteeId: this.inviteeId,
-                projectId: this.projectId,
-                operatorId: this.operatorId
-            } , res => {
-                if (res.code == "ok") {
-                    this.detail = res.data;
-                } else {
-                    this.$message({
-                        message: res.msg,
-                        type: 'error'
-                    });
-                }
-            }, error => {
-                this.$message({
-                    message: error,
-                    type: 'error'
-                });
-            })
-        }
-    };
-</script>
-
-<style scoped>
-    * {
-        margin: 0;
-        padding: 0;
-    }
-
-    .main {
-        margin: 80px auto;
-        width: 360px;
-        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;
-        cursor: pointer;
-    }
-</style>

+ 0 - 344
lib_vue/src/views/map/map.vue

@@ -1,344 +0,0 @@
-<template>
-	<div id="container"></div> 
-</template>
-
-<script>
-    import Vue from 'vue';
-
-	export default {
-		data() {
-			return {
-				
-			}
-		},
-		methods: {
-            getMap() {
-                var _this = this
-                this.http.post( this.port.map.mapList, {},
-                res => {
-                    if (res.code == "ok") {
-                        var list = res.data;
-
-                        if(list != null && list.length > 0){
-                            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].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){
-                                    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:#999999;'></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 + "/0");
-                                            }
-                                        }
-                                    });
-                                    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"
-                    });
-                });
-            },
-        },
-        mounted() {
-            //this.getMap();
-
-            this.$el.style.height = (window.innerHeight - 100) + "px";
-            const that = this;
-            window.onresize = function temp() {
-                that.$el.style.height = (window.innerHeight - 100) + "px";
-            };
-
-            //新地图
-            var map = new AMap.Map('container', {
-                zoom: 4,
-                //mapStyle: "amap://styles/grey",
-                mapStyle: "amap://styles/8016abec658e1132508723183f848f14",
-                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.9)'
-                        },
-                        //鼠标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 name = feature.properties.name;
-                            if(feature.properties.level == "province") {
-                                if(name == "黑龙江省" || name == "内蒙古自治区"){
-                                    name = name.substring(0,3)
-                                } else {
-                                    name = name.substring(0,2)
-                                }
-                            }
-                            var text = name;//feature.properties.name ;//+ '\n' + dataItems.length;
-                            var textMetrics = labelCtx.measureText(text);
-                            var halfTxtWidth = textMetrics.width / 2;
-
-                            var num = dataItems.length;
-                            var numMetrics = labelCtx.measureText(num);
-                            var halfNumWidth = numMetrics.width / 2;
-
-                            // labelCtx.fillStyle = 'rgba(3 , 94 , 255 , 0.5)';//'#3366cc';
-                            
-                            labelCtx.beginPath();
-                            labelCtx.fillStyle = 'rgba(12 , 239 , 231 , 0.8)';//'#3366cc';
-
-                            //绘制一个蓝色背景
-                            labelCtx.strokeStyle= "rgba(12 , 239 , 231 , 0.65)"
-                            labelCtx.fillStyle = 'rgba(12 , 239 , 231 , 0.65)';
-                            
-                            var radius = 0;
-                            if(textMetrics.width > numMetrics.width) {
-                                radius = (textMetrics.width + 6 * pixelRatio) / 2;
-                            } else {
-                                radius = (numMetrics.width + 6 * pixelRatio) / 2;
-                            }
-
-                            labelCtx.arc(centerX , centerY, radius + 6,
-                                0*Math.PI, 2*Math.PI, false);
-
-                            labelCtx.closePath();
-                            labelCtx.fill();
-                            // 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 - 5);
-                            labelCtx.fillText(num , centerX - halfNumWidth, centerY + 12);
-
-                            labelCtx.stroke();
-                            labelCtx.restore();
-                        //}
-                    }
-                });
-
-                var distCluster = new DistrictCluster({
-                    zIndex: 100,
-                    map: map, //所属的地图实例
-                    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)];
-                    },
-                    renderConstructor: MyRender,
-                    //特定区划级别的默认样式
-                    renderOptions: {
-                        getClusterMarker: null,
-                        featureClickToShowSub: true,
-                        featureStyle: {
-                            lineWidth: 2, //描边线宽
-                            // strokeStyle: 'rgba(0, 119, 180, 0.5)', //描边色
-                            strokeStyle: 'rgba(75, 143, 239, 0.5)', //描边色
-                            //鼠标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"
-                    });
-                })
-            });
-        }
-	}
-
-</script>
-
-<style scoped lang="scss">
-    #container {
-        width: 100%; 
-        margin-top: 10px;
-    }  
-</style>

+ 0 - 264
lib_vue/src/views/message.vue

@@ -1,264 +0,0 @@
-<template>
-  <section>
-    <!--工具条-->
-    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
-      <el-form :inline="true">
-        <el-col :span="2">
-          <el-form-item>消息中心</el-form-item>
-        </el-col>
-      </el-form>
-    </el-col>
-
-    <!--选项卡-->
-    <el-col :span="24">
-      <el-tabs v-model="activePage" @tab-click="handleClick" type="card">
-        <el-tab-pane name="0" label="审批">
-          <div :style="heightString">
-            <span v-if="messages[0].length == 0">目前暂无消息</span>
-            <div
-              class="message-div"
-              v-for="item in messages[0]"
-              @click="locationHerf(item.id, item.refId, item.noticeType, item.belongType)"
-            >
-              <p>
-                <span class="message-title isRead" v-if="item.isRead == 1">{{item.projectName}}</span>
-                <span class="message-title" v-else>{{item.projectName}}</span>
-                <span class="message-time">{{item.indate}}</span>
-              </p>
-              <p class="message-article">{{item.content}}</p>
-            </div>
-          </div>
-          <!--分页1-->
-          <el-col :span="24" class="toolbar">
-            <el-pagination
-              @size-change="handleSizeChange0"
-              @current-change="handleCurrentChange0"
-              :page-sizes="[20 , 50 , 80 , 100 , 200]"
-              :page-size="20"
-              layout="total, sizes, prev, pager, next"
-              :total="total[0]"
-              style="float:right;"
-            ></el-pagination>
-          </el-col>
-        </el-tab-pane>
-        <el-tab-pane name="1" label="警告">
-          <div :style="heightString">
-            <span v-if="messages[1].length == 0">目前暂无消息</span>
-            <div
-              class="message-div"
-              v-for="item in messages[1]"
-              @click="locationHerf(item.id, item.refId, item.noticeType, null)"
-            >
-              <p>
-                <span class="message-title isRead" v-if="item.isRead == 1">{{item.projectName}}</span>
-                <span class="message-title" v-else>{{item.projectName}}</span>
-                <span class="message-time">{{item.indate}}</span>
-              </p>
-              <p class="message-article">{{item.content}}</p>
-            </div>
-          </div>
-          <!--分页2-->
-          <el-col :span="24" class="toolbar">
-            <el-pagination
-              @size-change="handleSizeChange1"
-              @current-change="handleCurrentChange1"
-              :page-sizes="[20 , 50 , 80 , 100 , 200]"
-              :page-size="20"
-              layout="total, sizes, prev, pager, next"
-              :total="total[1]"
-              style="float:right;"
-            ></el-pagination>
-          </el-col>
-        </el-tab-pane>
-        <el-tab-pane name="2" label="保养">
-          <div :style="heightString">
-            <span v-if="messages[2].length == 0">目前暂无消息</span>
-            <div
-              class="message-div"
-              v-for="item in messages[2]"
-              @click="locationHerf(item.id, item.refId, item.noticeType, null)"
-            >
-              <p>
-                <span class="message-title isRead" v-if="item.isRead == 1">{{item.projectName}}</span>
-                <span class="message-title" v-else>{{item.projectName}}</span>
-                <span class="message-time">{{item.indate}}</span>
-              </p>
-              <p class="message-article">{{item.content}}</p>
-            </div>
-          </div>
-          <!--分页3-->
-          <el-col :span="24" class="toolbar">
-            <el-pagination
-              @size-change="handleSizeChange2"
-              @current-change="handleCurrentChange2"
-              :page-sizes="[20 , 50 , 80 , 100 , 200]"
-              :page-size="20"
-              layout="total, sizes, prev, pager, next"
-              :total="total[2]"
-              style="float:right;"
-            ></el-pagination>
-          </el-col>
-        </el-tab-pane>
-      </el-tabs>
-    </el-col>
-  </section>
-</template>
-
-<script>
-import util from "../common/js/util";
-export default {
-  data() {
-    return {
-      messages: [[], [], []],
-      page0: 1,
-      page1: 1,
-      page2: 1,
-      size: 20,
-      total: [0, 0, 0],
-      tableHeight: 0,
-      activePage: 0,
-      heightString: ""
-    };
-  },
-  methods: {
-    //分页1
-    handleCurrentChange0(val) {
-      this.page0 = val;
-      this.loadNotice();
-    },
-    handleSizeChange0(val) {
-      this.size1 = val;
-      this.loadNotice();
-    },
-    //分页2
-    handleCurrentChange1(val) {
-      this.page2 = val;
-      this.loadNotice();
-    },
-    handleSizeChange1(val) {
-      this.size = val;
-      this.loadNotice();
-    },
-    //分页3
-    handleCurrentChange2(val) {
-      this.page = val;
-      this.loadNotice();
-    },
-    handleSizeChange2(val) {
-      this.size = val;
-      this.loadNotice();
-    },
-    //标签页面切换时
-    handleClick(tab, event) {
-      this.activeTab = tab.name;
-    },
-    //读取消息提示
-    loadNotice() {
-      this.http.post(
-        this.port.notice.list,
-        {
-          pageNum: this.page,
-          pageSize: this.size
-        },
-        res => {
-          if (res.code == "ok") {
-            this.messages = [];
-            this.messages.push(res.data[0].approvelList.list);
-            this.messages.push(res.data[1].matainList.list);
-            this.messages.push(res.data[2].emergencyList.list);
-            this.total[0] = res.data[0].approvelList.total;
-            this.total[1] = res.data[1].matainList.total;
-            this.total[2] = res.data[2].emergencyList.total;
-          } else {
-            this.$message({
-              message: res.msg,
-              type: "error"
-            });
-          }
-        },
-        error => {
-          this.$message({
-            message: error,
-            type: "error"
-          });
-        }
-      );
-    },
-    //点击消息的跳转
-    locationHerf(id, refid, type, approval) {
-      this.http.post(
-        this.port.notice.read,
-        {
-          id: id
-        },
-        res => {
-          if (res.code == "ok") {
-          } else {
-            this.$message({
-              message: res.msg,
-              type: "error"
-            });
-          }
-        },
-        error => {
-          this.$message({
-            message: error,
-            type: "error"
-          });
-        }
-      );
-      if (type == 0) {
-        //审批 跳转到模具详情
-        this.$router.push("/moldList/" + refid + "/" + approval);
-      } else if (type == 1) {
-        //警告 跳转到运行监测
-        this.$router.push("/detection");
-      } else if (type == 2) {
-        //保养 跳转到运行监测详情
-        this.$router.push("/detection/" + refid);
-      }
-    }
-  },
-  created() {
-    let height = window.innerHeight;
-    this.tableHeight = height - 260;
-    this.heightString = "height: " + this.tableHeight + "px";
-  },
-  mounted() {
-    this.loadNotice();
-  }
-};
-</script>
-
-<style scoped>
-.message-div {
-  cursor: pointer;
-  padding: 5px 0;
-}
-
-.message-div > p {
-  line-height: 25px;
-  margin: 0;
-}
-
-.message-type {
-  font-weight: 700;
-}
-
-.message-time {
-  padding-left: 30px;
-  color: #777;
-}
-
-.message-title {
-  color: #409eff;
-}
-
-.message-article {
-  color: #555;
-}
-
-.isRead {
-  color: #999 !important;
-}
-</style>