浏览代码

Merge remote-tracking branch 'origin/master'

Reiskuchen 5 年之前
父节点
当前提交
c031ddd909

+ 2 - 0
fhKeeper/formulahousekeeper/inva_4_tivo/css/styles.css

@@ -2179,6 +2179,8 @@ a:hover.back-to-top {
 .cards-1 .scenes {
 	text-align: left;
 	padding: 1rem 1.2rem;
+	background: #f3f7fd;
+	border-radius: 10px;
 }
 
 .cards-1 .scenes .scenes-head {

+ 3 - 2
fhKeeper/formulahousekeeper/inva_4_tivo/download.html

@@ -3,8 +3,9 @@
 <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <meta name="description" content="Tivo is a free HTML landing page template built with Bootstrap to help you crate engaging presentations for SaaS apps and convert visitors into users.">
-    <title>工时管家</title>
+    <meta name="keywords" content="工时管家,远程办公,员工管理,项目管理,绩效考核,项目成本统计,远程监控,兼职软件开发,软件外包,外包人员管理" />
+    <meta name="description" content="工时管家利用智能图像识别技术,统计员工每日实际的工作时长,并能自动分析员工每天时间分配情况,如研发,设计,上网,影视娱乐等,能有效提高领导对团队工作时间的把控,进而制定降低成本、提高效率的措施。同时领导可以查看员工在每个项目上投入的时间,核算项目的人力成本。"/>
+    <title>工时管家|反馈真实工作情况,提供员工考核数据</title>
     <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700&display=swap&subset=latin-ext" rel="stylesheet">
     <link href="css/bootstrap.css" rel="stylesheet">
     <!-- <link href="css/fontawesome-all.css" rel="stylesheet"> -->

二进制
fhKeeper/formulahousekeeper/inva_4_tivo/images/banner_6.png


+ 13 - 4
fhKeeper/formulahousekeeper/inva_4_tivo/index.html

@@ -3,8 +3,9 @@
 <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <meta name="description" content="Tivo is a free HTML landing page template built with Bootstrap to help you crate engaging presentations for SaaS apps and convert visitors into users.">
-    <title>工时管家</title>
+    <meta name="keywords" content="工时管理,项目成本统计,远程办公,员工管理,项目管理,绩效考核,远程监控,兼职软件开发,软件外包,外包人员管理" />
+    <meta name="description" content="工时管家利用智能图像识别技术,统计员工每日实际的工作时长,并能自动分析员工每天时间分配情况,如研发,设计,上网,影视娱乐等,能有效提高领导对团队工作时间的把控,进而制定降低成本、提高效率的措施。同时领导可以查看员工在每个项目上投入的时间,核算项目的人力成本。"/>
+    <title>工时管家|反馈真实工作情况,提供员工考核数据</title>
     <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700&display=swap&subset=latin-ext" rel="stylesheet">
     <link href="css/bootstrap.css" rel="stylesheet">
     <!-- <link href="css/fontawesome-all.css" rel="stylesheet"> -->
@@ -13,6 +14,15 @@
 	<link href="css/magnific-popup.css" rel="stylesheet">
 	<link href="css/styles.css" rel="stylesheet">
     <link rel="icon" href="images/favicon.png">
+    <script>
+        var _hmt = _hmt || [];
+        (function() {
+          var hm = document.createElement("script");
+          hm.src = "https://hm.baidu.com/hm.js?db6f9072933f13477e2679fb672a8761";
+          var s = document.getElementsByTagName("script")[0];
+          s.parentNode.insertBefore(hm, s);
+        })();
+    </script>
 </head>
 <body data-spy="scroll" data-target=".fixed-top">
 	<div class="spinner-wrapper">
@@ -82,7 +92,6 @@
                         <div class="image-container">
                             <div class="img-wrapper">
                                 <img class="img-fluid" src="images/banner_2.jpg" alt="alternative">
-<!--                                desk1.png-->
                             </div>
                         </div>
                     </div>
@@ -236,7 +245,7 @@
                             <img class="img-fluid" src="images/4.png" alt="alternative">
                         </div>
                         <div class="card-body">
-                            <h4 class="card-title">成本核算</h4>
+                            <h4 class="card-title">项目管理</h4>
                             <p>以项目作为纬度进行工时统计<br>掌握员工对每个项目所花工时<br>有利于领导对项目整体进度进行调整</p>
                         </div>
                     </div>

+ 3 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/desktop/detail.vue

@@ -56,9 +56,9 @@ export default {
       detailId: this.$route.params.id,
       date: this.$route.params.date,
       user: JSON.parse(sessionStorage.getItem("user")),
-      uName: "周瑞霆",
-      uTime: "2020-01-03",
-      uHours: 20,
+      uName: "",
+      uTime: "",
+      uHours: 0,
       timeList: [],
       srcList: [],
       infoList: [],

+ 2 - 2
fhKeeper/formulahousekeeper/timesheet/src/views/desktop/unusual.vue

@@ -20,9 +20,9 @@
         </el-table-column>
         <el-table-column label="图片" width="200">
             <template slot-scope="scope">
-                <el-image :src="scope.row.picUrl" :preview-src-list="getSrcList(index)" lazy>
+                <el-image :src="scope.row.picUrl" :preview-src-list="getSrcList(index)">
                     <div slot="error" class="image-slot">
-                        <el-image :src="require('../../assets/image/noPic.png')" class="image" lazy></el-image>
+                        <el-image :src="require('../../assets/image/noPic.png')" class="image"></el-image>
                     </div>
                 </el-image>
             </template>

+ 9 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/project/cost.vue

@@ -22,8 +22,9 @@
                         for(var i in list) {
                             xList.push(list[i].project);
                             yList.push({
-                                value: list[i].cost,
+                                "value": list[i].cost,
                                 "id": list[i].id,
+                                "cost": list[i].costMoney
                             });
                         }
 
@@ -56,12 +57,17 @@
                                 }
                             },
                             tooltip:{
-                                trigger:'axis'
+                                trigger:'axis',
+                                formatter: function (params,ticket,callback) {
+                                    var res = params[0].name + "<br/>工作时长(h)"+" : " + params[0].data.value 
+                                    + "h <br/>工作成本(元)"+" : " + params[0].data.cost + "元";
+                                    return res;
+                                }
                             },
                             xAxis: {
                                 data: xList,
                                 axisLabel: {
-                                    interval:0,rotate:40
+                                    interval:0,rotate:20
                                 }
                             },
                             yAxis: [{

+ 18 - 24
fhKeeper/formulahousekeeper/timesheet/src/views/project/detail.vue

@@ -10,29 +10,12 @@
                 <el-form-item>
                     <span class="workName">{{detailName}}</span>
                 </el-form-item>
+                <el-form-item style="float:right;">
+                    <span style="font-size:18px;">项目成本:<span style="color:#20a0ff;">{{cost}}元</span></span>
+                </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="人员名称" sortable></el-table-column>
-            <el-table-column prop="cost" label="分配时长(h)" sortable></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> -->
-
         <div id="container" :style="'height:' + tableHeight + 'px'"></div> 
     </section>
 </template>
@@ -48,6 +31,8 @@
 
                 user: JSON.parse(sessionStorage.getItem("user")),
 
+                cost: 0,
+
                 tableHeight: 0,
                 
                 echart: null,
@@ -69,10 +54,14 @@
                     this.listLoading = false;
                     var _this = this;
                     if (res.code == "ok") {
-                        var xList = [],yList = [] , list = res.data;
+                        var xList = [],yList = [] , list = res.data.costList;
+                        this.cost = res.data.totalMoneyCost;
                         for(var i in list) {
                             xList.push(list[i].name);
-                            yList.push(list[i].cost);
+                            yList.push({
+                                "value": list[i].cost,
+                                "cost": list[i].costMoney
+                            });
                         }
 
                         var myChart = echarts.init(document.getElementById("container"));
@@ -100,12 +89,17 @@
                                 }
                             },
                             tooltip:{
-                                trigger:'axis'
+                                trigger:'axis',
+                                formatter: function (params,ticket,callback) {
+                                    var res = params[0].name + "<br/>工作时长(h)"+" : " + params[0].data.value 
+                                    + "h <br/>工作成本(元)"+" : " + params[0].data.cost + "元";
+                                    return res;
+                                }
                             },
                             xAxis: {
                                 data: xList,
                                 axisLabel: {
-                                    interval:0,rotate:40
+                                    interval:0,rotate:20
                                 }
                             },
                             yAxis: [{

+ 442 - 381
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -1,408 +1,469 @@
 <template>
-  <section>
-    <!--工具条-->
-    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
-      <el-form :inline="true">
-        <el-form-item>
-          <div class="nowTime">
-            <i class="el-icon-s-home"></i>
-            {{user.companyName}}
-          </div>
-        </el-form-item>
-        <el-form-item style="float:right;">
-          <el-link type="primary" :underline="false" @click="openInsertDialog(null)">添加人员</el-link>
-        </el-form-item>
-        <el-form-item style="float:right;">
-          <el-upload
-            ref="upload"
-            action="#"
-            :limit="1"
-            :http-request="importUser"
-            :show-file-list="false"
-          >
-            <el-link type="primary" :underline="false">批量导入</el-link>
-          </el-upload>
-        </el-form-item>
-        <el-form-item style="float:right;">
-          <el-link
-            type="primary"
-            :underline="false"
-            href="./upload/人员导入模板.xlsx"
-            download="人员导入模板.xlsx"
-          >模板下载</el-link>
-        </el-form-item>
-      </el-form>
-    </el-col>
+    <section>
+        <!--工具条-->
+        <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
+            <el-form :inline="true">
+                <el-form-item>
+                    <div class="nowTime">
+                        <i class="el-icon-s-home"></i>
+                        {{user.companyName}}
+                    </div>
+                </el-form-item>
+                <el-form-item style="float:right;">
+                    <el-link type="primary" :underline="false" @click="openInsertDialog(null)">添加人员</el-link>
+                </el-form-item>
+                <el-form-item style="float:right;">
+                    <el-upload
+                        ref="upload"
+                        action="#"
+                        :limit="1"
+                        :http-request="importUser"
+                        :show-file-list="false"
+                    >
+                        <el-link type="primary" :underline="false">批量导入</el-link>
+                    </el-upload>
+                </el-form-item>
+                <el-form-item style="float:right;">
+                    <el-link
+                        type="primary"
+                        :underline="false"
+                        href="./upload/人员导入模板.xlsx"
+                        download="人员导入模板.xlsx"
+                    >模板下载</el-link>
+                </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="姓名" sortable></el-table-column>
-      <el-table-column prop="phone" label="手机"></el-table-column>
-      <el-table-column label="角色">
-        <template slot-scope="scope">
-          {{scope.row.role == 0 ? "普通员工" :
-          scope.row.role == 1 ? "负责人" : "管理员"}}
-        </template>
-      </el-table-column>
-      <el-table-column prop="cost" label="成本"></el-table-column>
-      <el-table-column label="操作" width="280">
-        <template slot-scope="scope">
-          <el-button
-            size="small"
-            v-if="scope.row.role == 0 && user.role == 1"
-            @click="switchRole(scope.$index)"
-          >切换为管理员</el-button>
-          <el-button
-            size="small"
-            v-if="scope.row.role == 2 && user.role == 1"
-            @click="switchRole(scope.$index)"
-          >切换为员工</el-button>
-          <el-button
-            size="small"
-            type="primary"
-            v-if="scope.row.role != 1"
-            @click="openInsertDialog(scope.$index)"
-          >编辑</el-button>
-          <el-button
-            size="small"
-            type="danger"
-            v-if="scope.row.role == 0"
-            @click="deleteUser(scope.$index)"
-          >删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
+        <!--列表-->
+        <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="姓名" sortable></el-table-column>
+            <el-table-column prop="phone" label="手机"></el-table-column>
+            <el-table-column label="角色">
+                <template slot-scope="scope">
+                {{scope.row.role == 0 ? "普通员工" :
+                scope.row.role == 1 ? "负责人" : "管理员"}}
+                </template>
+            </el-table-column>
+            <el-table-column prop="cost" label="成本"></el-table-column>
+            <el-table-column label="操作" width="280">
+                <template slot-scope="scope">
+                <el-button
+                    size="small"
+                    v-if="scope.row.role == 0 && user.role == 1"
+                    @click="switchRole(scope.$index)"
+                >切换为管理员</el-button>
+                <el-button
+                    size="small"
+                    v-if="scope.row.role == 2 && user.role == 1"
+                    @click="switchRole(scope.$index)"
+                >切换为员工</el-button>
+                <el-button
+                    size="small"
+                    type="primary"
+                    v-if="scope.row.role != 1"
+                    @click="openInsertDialog(scope.$index)"
+                >编辑</el-button>
+                <el-button
+                    size="small"
+                    type="primary"
+                    v-if="scope.row.role == 1"
+                    @click="openInsertDialog1(scope.$index)"
+                >编辑</el-button>
+                <el-button
+                    size="small"
+                    type="danger"
+                    v-if="scope.row.role == 0"
+                    @click="deleteUser(scope.$index)"
+                >删除</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-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>
 
-    <!-- 新增单个人员的Dialog -->
-    <el-dialog title="新增人员" :visible.sync="dialogVisible" width="400px">
-      <el-form ref="form1" :model="insertForm" :rules="rules" label-width="60px">
-        <el-form-item label="名字" prop="name">
-          <el-input v-model="insertForm.name" placeholder="请输入姓名" clearable></el-input>
-        </el-form-item>
-        <el-form-item label="电话" prop="phone">
-          <el-input v-model="insertForm.phone" placeholder="请输入电话号码" clearable></el-input>
-        </el-form-item>
-        <el-form-item label="成本" prop="cost">
-          <!-- 这里目前只能输入整数 但实际上数据库里是可以存的 需要调整校验方式 -->
-          <el-input v-model.number="insertForm.cost" placeholder="请输入成本 单位:元/小时" clearable></el-input>
-        </el-form-item>
-        <el-form-item label="角色" prop="role">
-          <el-select v-model="insertForm.role" placeholder="请选择角色" style="width: 100%">
-            <el-option label="普通员工" :value="0"></el-option>
-            <el-option label="管理员" :value="2"></el-option>
-          </el-select>
-        </el-form-item>
-      </el-form>
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="dialogVisible=false">取消</el-button>
-        <el-button type="primary" @click="submitInsert">提交</el-button>
-      </span>
-    </el-dialog>
-  </section>
+        <!-- 新增单个人员的Dialog -->
+        <el-dialog :title="title" :visible.sync="dialogVisible" width="400px">
+            <el-form ref="form1" :model="insertForm" :rules="rules" label-width="60px">
+                <el-form-item label="名字" prop="name">
+                    <el-input v-model="insertForm.name" placeholder="请输入姓名" clearable></el-input>
+                </el-form-item>
+                <el-form-item label="电话" prop="phone">
+                    <el-input v-model="insertForm.phone" placeholder="请输入电话号码" clearable></el-input>
+                </el-form-item>
+                <el-form-item label="成本" prop="costNum">
+                    <!-- 这里目前只能输入整数 但实际上数据库里是可以存的 需要调整校验方式 -->
+                    <el-input v-model.number="insertForm.cost" placeholder="请输入成本 单位:元/小时" clearable></el-input>
+                </el-form-item>
+                <el-form-item label="角色" prop="role">
+                    <el-select v-model="insertForm.role" placeholder="请选择角色" style="width: 100%">
+                        <el-option label="普通员工" :value="0"></el-option>
+                        <el-option label="管理员" :value="2"></el-option>
+                    </el-select>
+                </el-form-item>
+            </el-form>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="dialogVisible=false">取消</el-button>
+                <el-button type="primary" @click="submitInsert">提交</el-button>
+            </span>
+        </el-dialog>
+
+        <el-dialog title="修改成本" :visible.sync="dialogVisible1" width="400px">
+            <el-form ref="form1" :model="insertForm" :rules="rules" label-width="60px">
+                <el-form-item label="成本" prop="cost">
+                    <el-input v-model.number="insertForm.cost" placeholder="请输入成本 单位:元/小时" clearable></el-input>
+                </el-form-item>
+            </el-form>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="dialogVisible1=false">取消</el-button>
+                <el-button type="primary" @click="submitInsert1">提交</el-button>
+            </span>
+        </el-dialog>
+    </section>
 </template>
 
 <script>
-export default {
-  data() {
-    return {
-      user: JSON.parse(sessionStorage.getItem("user")),
+    export default {
+        data() {
+            return {
+                user: JSON.parse(sessionStorage.getItem("user")),
 
-      tableHeight: 0,
-      listLoading: false,
-      total: 0,
-      page: 1,
-      size: 20,
-      list: [],
-      dialogVisible: false,
-      insertForm: {
-        id: null,
-        name: null,
-        phone: null,
-        role: null,
-        cost: null
-      },
-      rules: {
-        name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
-        phone: [{ required: true, message: "请输入电话", trigger: "blur" }],
-        role: [{ required: true, message: "请选择角色", trigger: "blur" }],
-        cost: [{ required: false, message: "请输入成本", trigger: "blur" }]
-      }
-    };
-  },
-  methods: {
-    //分页
-    handleCurrentChange(val) {
-      this.page = val;
-      this.getUser();
-    },
+                tableHeight: 0,
+                listLoading: false,
+                total: 0,
+                page: 1,
+                size: 20,
+                list: [],
+                
+                dialogVisible: false,
+                title: "",
+                insertForm: {
+                    id: null,
+                    name: null,
+                    phone: null,
+                    role: null,
+                    cost: null
+                },
+                rules: {
+                    name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
+                    phone: [{ required: true, message: "请输入电话", trigger: "blur" }],
+                    role: [{ required: true, message: "请选择角色", trigger: "blur" }],
+                    cost: [{ required: true, message: "请输入成本", trigger: "blur" }]
+                },
 
-    handleSizeChange(val) {
-      this.size = val;
-      this.getUser();
-    },
+                dialogVisible1: false,
 
-    //获取所有员工的列表
-    getUser() {
-      this.listLoading = true;
-      this.http.post(
-        this.port.manage.list,
-        {},
-        res => {
-          this.listLoading = false;
-          if (res.code == "ok") {
-            this.list = res.data;
-          } else {
-            this.$message({
-              message: res.msg,
-              type: "error"
-            });
-          }
+            };
         },
-        error => {
-          this.listLoading = false;
-          this.$message({
-            message: error,
-            type: "error"
-          });
-        }
-      );
-    },
+        methods: {
+            //分页
+            handleCurrentChange(val) {
+                this.page = val;
+                this.getUser();
+            },
 
-    //新增员工
-    submitInsert() {
-      this.$refs.form1.validate(valid => {
-        if (valid) {
-          this.listLoading = true;
-          var form = {
-            name: this.insertForm.name,
-            phone: this.insertForm.phone,
-            role: this.insertForm.role,
-            cost: this.insertForm.cost
-          };
-          if (this.insertForm.id != null) {
-            form.id = this.insertForm.id;
-          }
-          this.http.post(
-            this.port.manage.insert,
-            form,
-            res => {
-              this.listLoading = false;
-              if (res.code == "ok") {
-                this.$message({
-                  message:
-                    this.insertForm.id != null ? "修改" : "创建" + "成功",
-                  type: "success"
-                });
-                this.dialogVisible = false;
-                //重新读取列表
+            handleSizeChange(val) {
+                this.size = val;
                 this.getUser();
-              } else {
-                this.$message({
-                  message: res.msg,
-                  type: "error"
+            },
+
+            //获取所有员工的列表
+            getUser() {
+                this.listLoading = true;
+                this.http.post( this.port.manage.list, {
+                    pageIndex: this.page,
+                    pageSize: this.size
+                },
+                res => {
+                    this.listLoading = false;
+                    if (res.code == "ok") {
+                        this.list = res.data.records;
+                        this.total = res.data.total;
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.listLoading = false;
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
                 });
-              }
             },
-            error => {
-              this.listLoading = false;
-              this.$message({
-                message: error,
-                type: "error"
-              });
-            }
-          );
-        }
-      });
-    },
 
-    //获取所有员工的列表
-    importUser(item) {
-      //首先判断文件类型
-      let str = item.file.name.split(".");
-      let format = str[str.length - 1];
-      if (format != "xls" && format != "xlsx") {
-        this.$message({
-          message: "请选择.xls或.xlsx文件",
-          type: "error"
-        });
-      } else {
-        this.listLoading = true;
-        let formData = new FormData();
-        formData.append("file", item.file);
-        this.http.uploadFile(
-          this.port.manage.import,
-          formData,
-          res => {
-            this.$refs.upload.clearFiles();
-            this.listLoading = false;
-            if (res.code == "ok") {
-              this.$message({
-                message: "导入成功",
-                type: "success"
-              });
-              //重新读取列表
-              this.getUser();
-            } else {
-              this.$message({
-                message: res.msg,
-                type: "error"
-              });
-            }
-          },
-          error => {
-            this.$refs.upload.clearFiles();
-            this.listLoading = false;
-            this.$message({
-              message: error,
-              type: "error"
-            });
-          }
-        );
-      }
-    },
+            //新增员工
+            submitInsert() {
+                this.$refs.form1.validate(valid => {
+                    if (valid) {
+                        this.listLoading = true;
+                        var form = {
+                            name: this.insertForm.name,
+                            phone: this.insertForm.phone,
+                            role: this.insertForm.role,
+                            cost: this.insertForm.cost
+                        };
+                        if (this.insertForm.id != null) {
+                            form.id = this.insertForm.id;
+                        }
+                        this.http.post( this.port.manage.insert, form,
+                        res => {
+                            this.listLoading = false;
+                            if (res.code == "ok") {
+                                this.$message({
+                                message:
+                                    this.insertForm.id != null ? "修改" : "创建" + "成功",
+                                type: "success"
+                                });
+                                this.dialogVisible = false;
+                                //重新读取列表
+                                this.getUser();
+                            } else {
+                                this.$message({
+                                message: res.msg,
+                                type: "error"
+                                });
+                            }
+                        },
+                        error => {
+                            this.listLoading = false;
+                            this.$message({
+                                message: error,
+                                type: "error"
+                            });
+                        });
+                    }
+                });
+            },
 
-    //切换角色 0/2
-    switchRole(index) {
-      this.listLoading = true;
-      this.http.post(
-        this.port.manage.permission,
-        { id: this.list[index].id },
-        res => {
-          this.listLoading = false;
-          if (res.code == "ok") {
-            this.$message({
-              message: "切换角色成功",
-              type: "success"
-            });
-            //重新读取列表
-            this.getUser();
-          } else {
-            this.$message({
-              message: res.msg,
-              type: "error"
-            });
-          }
-        },
-        error => {
-          this.listLoading = false;
-          this.$message({
-            message: error,
-            type: "error"
-          });
-        }
-      );
-    },
+            //获取所有员工的列表
+            importUser(item) {
+                //首先判断文件类型
+                let str = item.file.name.split(".");
+                let format = str[str.length - 1];
+                if (format != "xls" && format != "xlsx") {
+                    this.$message({
+                    message: "请选择.xls或.xlsx文件",
+                    type: "error"
+                    });
+                } else {
+                    this.listLoading = true;
+                    let formData = new FormData();
+                    formData.append("file", item.file);
+                    this.http.uploadFile( this.port.manage.import, formData,
+                    res => {
+                        this.$refs.upload.clearFiles();
+                        this.listLoading = false;
+                        if (res.code == "ok") {
+                            this.$message({
+                                message: "导入成功",
+                                type: "success"
+                            });
+                            //重新读取列表
+                            this.getUser();
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                        this.$refs.upload.clearFiles();
+                        this.listLoading = false;
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                    });
+                }
+            },
 
-    //三天之内删了你 数据库都给你清了
-    deleteUser(index) {
-      this.$confirm(
-        "确定要删除用户" + this.list[index].name + "吗?",
-        "删除用户",
-        {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }
-      )
-        .then(() => {
-          this.listLoading = true;
-          this.http.post(
-            this.port.manage.delete,
-            { userId: this.list[index].id },
-            res => {
-              this.listLoading = false;
-              if (res.code == "ok") {
-                this.$message({
-                  message: "删除成功",
-                  type: "success"
+            //切换角色 0/2
+            switchRole(index) {
+                this.listLoading = true;
+                this.http.post( this.port.manage.permission, { id: this.list[index].id },
+                res => {
+                    this.listLoading = false;
+                    if (res.code == "ok") {
+                        this.$message({
+                        message: "切换角色成功",
+                        type: "success"
+                        });
+                        //重新读取列表
+                        this.getUser();
+                    } else {
+                        this.$message({
+                        message: res.msg,
+                        type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.listLoading = false;
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
                 });
-                //重新读取列表
-                this.getUser();
-              } else {
-                this.$message({
-                  message: res.msg,
-                  type: "error"
-                });
-              }
             },
-            error => {
-              this.listLoading = false;
-              this.$message({
-                message: error,
-                type: "error"
-              });
-            }
-          );
-        })
-        .catch(() => {});
-    },
 
-    //打开单独新增的Dialog
-    openInsertDialog(i) {
-      if (i != null) {
-        this.insertForm = {
-          id: this.list[i].id,
-          name: this.list[i].name,
-          phone: this.list[i].phone,
-          role: this.list[i].role,
-          cost: this.list[i].cost
-        };
-      } else {
-        this.insertForm = {
-          id: null,
-          name: null,
-          phone: null,
-          role: null,
-          cost: null
-        };
-      }
-      this.dialogVisible = true;
-    }
-  },
+            //三天之内删了你 数据库都给你清了
+            deleteUser(index) {
+                this.$confirm( "确定要删除用户" + this.list[index].name + "吗?", "删除用户", {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning"
+                })
+                .then(() => {
+                    this.listLoading = true;
+                    this.http.post( this.port.manage.delete, { userId: this.list[index].id },
+                    res => {
+                        this.listLoading = false;
+                        if (res.code == "ok") {
+                            this.$message({
+                                message: "删除成功",
+                                type: "success"
+                            });
+                            //重新读取列表
+                            this.getUser();
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                        this.listLoading = false;
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                    });
+                })
+                .catch(() => {});
+            },
+
+            //打开单独新增的Dialog
+            openInsertDialog(i) {
+                if (i != null) {
+                    this.insertForm = {
+                        id: this.list[i].id,
+                        name: this.list[i].name,
+                        phone: this.list[i].phone,
+                        role: this.list[i].role,
+                        cost: this.list[i].cost
+                    };
+                    this.title = "编辑人员"
+                } else {
+                    this.insertForm = {
+                        id: null,
+                        name: null,
+                        phone: null,
+                        role: null,
+                        cost: null
+                    };
+                    this.title = "新增人员"
+                }
+                this.dialogVisible = true;
+            },
+
+            openInsertDialog1(i) {
+                this.insertForm = {
+                    id: this.list[i].id,
+                    name: this.list[i].name,
+                    phone: this.list[i].phone,
+                    role: this.list[i].role,
+                    cost: this.list[i].cost
+                };
+                this.dialogVisible1 = true;
+            },
+
+            submitInsert1() {
+                this.$refs.form1.validate(valid => {
+                    if (valid) {
+                        this.listLoading = true;
+                        var form = {
+                            id: this.insertForm.id,
+                            name: this.insertForm.name,
+                            phone: this.insertForm.phone,
+                            role: this.insertForm.role,
+                            cost: this.insertForm.cost
+                        };
+                        this.http.post( this.port.manage.insert, form,
+                        res => {
+                            this.listLoading = false;
+                            if (res.code == "ok") {
+                                this.$message({
+                                    message: "修改成功",
+                                    type: "success"
+                                });
+                                this.dialogVisible1 = false;
+                                //重新读取列表
+                                this.getUser();
+                            } else {
+                                this.$message({
+                                    message: res.msg,
+                                    type: "error"
+                                });
+                            }
+                        },
+                        error => {
+                            this.listLoading = false;
+                            this.$message({
+                                message: error,
+                                type: "error"
+                            });
+                        });
+                    }
+                });
+            },
+        },
 
-  created() {
-    let height = window.innerHeight;
-    this.tableHeight = height - 195;
-    const that = this;
-    window.onresize = function temp() {
-      that.tableHeight = window.innerHeight - 195;
+        created() {
+            let height = window.innerHeight;
+            this.tableHeight = height - 195;
+            const that = this;
+            window.onresize = function temp() {
+                that.tableHeight = window.innerHeight - 195;
+            };
+        },
+        mounted() {
+            this.getUser();
+        }
     };
-  },
-  mounted() {
-    this.getUser();
-  }
-};
 </script>
 
 <style lang="scss" scoped>
-.nowTime {
-  height: 40px;
-  line-height: 40px;
-  font-size: 16px;
-  color: #20a0ff;
-  margin-left: 10px;
-  i {
-    margin-right: 10px;
-  }
-}
+    .nowTime {
+        height: 40px;
+        line-height: 40px;
+        font-size: 16px;
+        color: #20a0ff;
+        margin-left: 10px;
+        i {
+            margin-right: 10px;
+        }
+    }
 </style>