Reiskuchen 5 rokov pred
rodič
commit
037fcd53f1

+ 13 - 1
ys_vue/src/common/js/util.js

@@ -52,8 +52,20 @@ export default {
                 return _date;
             }
             return null;
+        },
+        dateDiff: function(sDate1, sDate2) {
+            var aDate, oDate1, oDate2, iDays
+            aDate = sDate1.split("-")
+            oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]);
+            aDate = sDate2.split("-")
+            oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]);
+            if((oDate1 - oDate2) < 0){
+                iDays = "已失效"
+            } else {
+                iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) + "天" //把相差的毫秒数转换为天数 
+            }
+            return iDays
         }
-
     }
 
 };

+ 14 - 2
ys_vue/src/main.js

@@ -59,8 +59,13 @@ router.beforeEach((to, from, next) => {
                         if(children[j].name == "人员管理" && user.isManager == 0){
                             children[j].hidden = true
                         }
-                        if(children[j].name == "权限管理" && user.isManager == 0){
-                            children[j].hidden = true
+
+                        if(children[j].name == "权限管理"){
+                            if(user.isManager == 0){
+                                children[j].hidden = true
+                            } else {
+                                children[j].hidden = false
+                            }
                         }
                     }
                 } else if(routes[i].name == "项目管理") {
@@ -69,6 +74,13 @@ router.beforeEach((to, from, next) => {
                         if(children[j].name != "项目详情"){
                             children[j].hidden = false
                         }
+                        
+                        if(children[j].name == "权限管理"){
+                            console.log((user.parentId == 0 || user.parentId == 1) && user.isManager == 0)
+                            if((user.parentId == 0 || user.parentId == 1) && user.isManager == 0){
+                                children[j].hidden = true
+                            }
+                        }
                     }
                 }
             }

+ 59 - 43
ys_vue/src/views/base/allocation.vue

@@ -5,17 +5,17 @@
             <el-form :inline="true" :model="filters">
                 <el-col :span="3">
                     <el-form-item>
-                        <el-select v-model="filters.value" placeholder="按公司筛选">
-                        <el-option label="编号" value="0"></el-option>
-                        <el-option label="名称" value="1"></el-option>
+                        <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.name" placeholder="请输入关键字进行搜索"></el-input>
+                    <el-input v-model="filters.keyName" placeholder="请输入关键字进行搜索"></el-input>
                 </el-form-item>
                 <el-form-item>
-                    <el-button type="primary">查询</el-button>
+                    <el-button type="primary" @click="getMoulds">查询</el-button>
                 </el-form-item>
                 <el-form-item style="float: right;">
                     <el-button type="primary" @click="showAllocation">新建</el-button>
@@ -27,20 +27,23 @@
         <el-table :data="allocations" :height="tableHeight" highlight-current-row v-loading="listLoading" style="width: 100%;">
             <el-table-column type="index" width="60"></el-table-column>
             <el-table-column prop="equipmentNo" label="云模盒编号" width="130" sortable></el-table-column>
-            <el-table-column prop="hillNumber" label="电量" width="100" sortable></el-table-column>
-            <el-table-column prop="useLife" label="倒计时" width="100" sortable>
-                <template slot-scope="scope">{{scope.row.useLife}}</template>
+            <el-table-column prop="hillNumber" label="电量" width="80" align="center" sortable></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="equipmentName" label="模具名称" sortable></el-table-column>
-            <el-table-column label="模具编号" sortable></el-table-column>
+            <el-table-column prop="useLife" label="倒计时" width="100" align="center" sortable>
+                <template slot-scope="scope">{{scope.row.diffTime}}</template>
+            </el-table-column>
+            <el-table-column prop="modelName" label="模具名称" sortable></el-table-column>
+            <el-table-column prop="modelNo" label="模具编号" width="120" align="center" sortable></el-table-column>
             <el-table-column prop="companyName" label="公司名称" sortable></el-table-column>
-            <el-table-column label="模具状态" width="100" sortable>
+            <el-table-column label="云模盒状态" align="center" width="100" sortable>
                 <template slot-scope="scope">
-                <span v-if="scope.row.isUse == 0">未启用</span>
-                <span v-else>已启用</span>
+                    <span v-if="scope.row.isUse == 0">未启用</span>
+                    <span v-else>已启用</span>
                 </template>
             </el-table-column>
-            <el-table-column label="操作" width="220" sortable>
+            <el-table-column label="操作" align="center" width="220" sortable>
                 <template slot-scope="scope">
                     <el-button size="small" type="primary" @click="enable(scope.$index)" :disabled="scope.row.isUse == 1">启用</el-button>
                     <el-button size="small" @click="showEdit(scope.$index, scope.row)">修改</el-button>
@@ -173,8 +176,8 @@
                     belongCompanyId: "" //所属公司ID
                 },
                 filters: {
-                    name: "",
-                    value: ""
+                    keyName: "",
+                    companyId: ""
                 },
                 formRules: {
                     equipmentNo: [
@@ -237,12 +240,25 @@
                 this.listLoading = true;
                 this.http.post(this.port.base.mouldeList,{
                     pageNum: this.page,
-                    pageSize: this.size
+                    pageSize: this.size,
+                    keyName: this.filters.keyName,
+                    companyId: this.filters.companyId
                 },
                 res => {
                     this.listLoading = false;
                     if (res.code == "ok") {
-                        this.allocations = res.data.list;
+                        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'), 
+                                    util.formatDate.format(new Date(new Date()), 'yyyy-MM-dd')
+                                );
+                            }
+                        }
+                        this.allocations = list;
                         this.total = res.data.total;
                     } else {
                         this.$message({
@@ -283,28 +299,28 @@
                         useLife: this.newAllocation.useLife
                         },
                         res => {
-                        this.addLoading = false;
-                        this.addFormVisible = false;
-                        if (res.code == "ok") {
-                            this.$message({
-                            message: "添加成功",
-                            type: "success"
-                            });
-                            this.getMoulds();
-                        } else {
-                            this.$message({
-                            message: res.msg,
-                            type: "error"
-                            });
-                        }
+                            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"
-                        });
+                            this.addLoading = false;
+                            this.addFormVisible = false;
+                            this.$message({
+                                message: error,
+                                type: "error"
+                            });
                         }
                     );
                     }
@@ -336,17 +352,17 @@
                         },
                         res => {
                             this.editLoading = false;
-                            this.editFormVisible = false;
                             if (res.code == "ok") {
+                                this.editFormVisible = false;
                                 this.$message({
-                                message: "添加成功",
-                                type: "success"
+                                    message: "添加成功",
+                                    type: "success"
                                 });
                                 this.getMoulds();
                             } else {
                                 this.$message({
-                                message: res.msg,
-                                type: "error"
+                                    message: res.msg,
+                                    type: "error"
                                 });
                             }
                         },

+ 2 - 2
ys_vue/src/views/base/comp.vue

@@ -201,8 +201,8 @@
                         this.addLoading = true;
                         this.http.post(this.port.base.addCompany, this.addForm , res => {
                             this.addLoading = false;
-                            this.addFormVisible = false;
                             if (res.code == "ok") {
+                                this.addFormVisible = false;
                                 this.$message({
                                     message: '创建成功',
                                     type: 'success'
@@ -274,8 +274,8 @@
 						this.editLoading = true;
                         this.http.post(this.port.base.addCompany, this.editForm , res => {
                             this.editLoading = false;
-                            this.editFormVisible = false;
                             if (res.code == "ok") {
+                                this.editFormVisible = false;
                                 this.$message({
                                     message: '修改成功',
                                     type: 'success'

+ 2 - 2
ys_vue/src/views/base/factory.vue

@@ -203,8 +203,8 @@
                         this.addLoading = true;
                         this.http.post(this.port.base.addCompany, this.addForm , res => {
                             this.addLoading = false;
-                            this.addFormVisible = false;
                             if (res.code == "ok") {
+                                this.addFormVisible = false;
                                 this.$message({
                                     message: '创建成功',
                                     type: 'success'
@@ -278,8 +278,8 @@
                         this.editLoading = true;
                         this.http.post(this.port.base.addCompany, this.editForm , res => {
                             this.editLoading = false;
-                            this.editFormVisible = false;
                             if (res.code == "ok") {
+                                this.editFormVisible = false;
                                 this.$message({
                                     message: '修改成功',
                                     type: 'success'

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

@@ -17,7 +17,7 @@
         </el-col>
         <el-col :span="3">
           <el-form-item>
-            <el-select v-model="filters.serchType" placeholder="请选择查询条件">
+            <el-select v-model="filters.searchType" placeholder="请选择查询条件">
               <el-option label="编号" value="0"></el-option>
               <el-option label="名称" value="1"></el-option>
             </el-select>
@@ -161,9 +161,10 @@ export default {
       molds: [],
       filters: {
         keyName: "",
-        serchType: "编号",
+        searchType: "编号",
         projectId: ""
       },
+      team: [{label:'资产方',value:0},{label:'生产方',value:1}],
 
       formRules: {
         modelNo: [
@@ -263,7 +264,7 @@ export default {
           pageNum: this.page,
           pageSize: this.size,
           projectId: this.filters.projectId == "" ? -1 : this.filters.projectId,
-          serchType: this.filters.serchType
+          searchType: this.filters.searchType == "编号"? 0:1
         },
         res => {
           this.listLoading = false;

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

@@ -15,7 +15,7 @@
 					<el-input v-model="filters.keyName" placeholder="请输入姓名进行搜索"></el-input>
 				</el-form-item>
 				<el-form-item>
-					<el-button type="primary" v-on:click="getUsers">查询</el-button>
+					<el-button type="primary" @click="getUsers">查询</el-button>
 				</el-form-item>
 			</el-form>
 		</el-col>
@@ -77,7 +77,7 @@
                     <el-form-item label="权限配置">
                         <el-row>
                             <el-col :span="6" v-for="(item,index) in roleList" :key="item.val" style="text-align:center;">
-                                <el-checkbox v-model="editForm[item.label]" :checked="editForm[item.label]">{{item.name}}</el-checkbox>
+                                <el-checkbox v-model="editForm[item.label]" :disabled="index==3?true:false" :checked="editForm[item.label]">{{item.name}}</el-checkbox>
                             </el-col>
                         </el-row>
                     </el-form-item>

+ 10 - 4
ys_vue/src/views/project/projectDetail.vue

@@ -15,7 +15,7 @@
         </el-col>
         <el-col :span="24" :style="allDetail">
             <el-col :span="24" class="title">项目基本信息
-                <i class="el-icon-edit editDetail" v-if="user.parentId == 1 || user.id == proDetail.managerId" @click="edit"></i>
+                <i class="el-icon-edit editDetail" v-if="user.id == proDetail.managerId || user.id == proDetail.creatorId" @click="edit"></i>
             </el-col>
             <el-col :span="24" class="main">
                 <el-col :span="6" class="detail">
@@ -65,7 +65,8 @@
             </el-col>
 
             <el-col :span="24" class="title">项目文档
-                <el-upload v-if="update == 1" class="upload-demo" action="customize" :http-request="uploadFile" :show-file-list="false" multiple :limit="5" style="float:right;">
+                <!-- update == 1 -->
+                <el-upload v-if="user.id == proDetail.managerId" class="upload-demo" action="customize" :http-request="uploadFile" :show-file-list="false" multiple :limit="5" style="float:right;">
                     <el-button size="small" type="primary">点击上传</el-button>
                 </el-upload>
             </el-col>
@@ -83,7 +84,7 @@
                             </el-button>
                             <el-button size="small" type="danger" @click="fileDel(scope.row.id)" v-if="scope.row.uploaderId == user.id">删除</el-button>
                         </template>
-                        <template slot-scope="scope" v-if="download == 0">
+                        <template slot-scope="scope" v-else>
                             -
                         </template>
                     </el-table-column>
@@ -346,7 +347,9 @@
                         var list = res.data , assets = [] , produce = [];
                         for(var i in list) {
                             if(list[i].companyId == this.user.companyId){
-                                assets.push(list[i])
+                                if(list[i].id != this.user.id){
+                                    assets.push(list[i])
+                                }
                             } else {
                                 produce.push(list[i])
                             }
@@ -600,6 +603,7 @@
                             type: 'success'
                         });
                         this.getFileList();
+                        this.getOperList();
                     } else {
                         this.$message({
                             message: res.msg,
@@ -618,6 +622,7 @@
                 this.http.post(this.port.project.dowloadFile, {
                     id: id
                 }, res => {
+                    this.getOperList();
                 }, error => {
                 })
             },
@@ -635,6 +640,7 @@
                                 type: 'success'
                             });
                             this.getFileList();
+                            this.getOperList();
                         } else {
                             this.$message({
                                 message: res.msg,

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

@@ -305,8 +305,8 @@
 						this.addLoading = true;
                         this.http.post(this.port.project.addUser, this.addForm , res => {
                             this.addLoading = false;
-                            this.addFormVisible = false;
                             if (res.code == "ok") {
+                                this.addFormVisible = false;
                                 this.$message({
                                     message: '创建成功',
                                     type: 'success'
@@ -382,8 +382,8 @@
                         this.editLoading = true;
                         this.http.post(this.port.project.addUser, this.editForm , res => {
                             this.editLoading = false;
-                            this.editFormVisible = false;
                             if (res.code == "ok") {
+                                this.editFormVisible = false;
                                 this.$message({
                                     message: '修改成功',
                                     type: 'success'