sunyadv 5 سال پیش
والد
کامیت
c38ba918c4

+ 30 - 8
cloud-socket/WebContent/bind_weixin.jsp

@@ -9,14 +9,30 @@
 <script>
 	$(function(){
 		var openid = '${requestScope.openid}';
+		//var openid = "o1L3L5jybPQ0zJWujikHpVJPBiM8";
 		if (openid == '') {
 			login();
-		}
+		}else{
+            $.post('checkAccountStatus.do',{"openid": openid}, function(resp) {
+                if (resp.code == 'ok') {
+                    $(".main").css("height", frameHeight);
+                    $(".account_detail").html(resp.data);
+                    $(".binding_procedure").hide();
+                    $(".binding_finish").show();
+                }
+            })
+        }
+		
+		var frameHeight = $(".main").css("height");
 		
 		$(".confirm").click(function(){
 			$.post('bindAccount.do',{'openid':openid, 'account':$(".account").val(), 'pwd':$(".password").val()}, function(resp) {
 				if (resp.code == 'ok') {
 					alert("绑定成功!");
+					$(".main").css("height", frameHeight);
+					$(".account_detail").html($(".account").val());
+					$(".binding_procedure").hide();
+					$(".binding_finish").show();
 				} else {
 					alert(resp.msg);
 				}
@@ -38,13 +54,19 @@
 		<div class="logo">
 			<img src="images/logo_bind.png">
 		</div>
-		<p class="text1">绑定您的云模后台账号</p>
-		<p class="text2">即可通过公众号接收消息</p>
-		<p class="text3">账号</p>
-		<input class="textbox account" type="text" placeholder="请输入账号">
-		<p class="text3">密码</p>
-		<input class="textbox password" type="password" placeholder="请输入密码">
-		<div class="confirm">确认绑定</div>
+		<div class="binding_procedure">
+			<p class="text1">绑定您的云模后台账号</p>
+			<p class="text2">即可通过公众号接收消息</p>
+			<p class="text3">账号</p>
+			<input class="textbox account" type="text" placeholder="请输入账号">
+			<p class="text3">密码</p>
+			<input class="textbox password" type="password" placeholder="请输入密码">
+			<div class="confirm">确认绑定</div>
+		</div>
+		<div class="binding_finish" style="display: none;">
+			<p>您的云模后台账号已与公众号绑定</p>
+			<p>绑定账号为:<span class="account_detail"></span></p>
+		</div>
 	</div>
 </body>
 </html>

+ 19 - 1
cloud-socket/src/com/js/kbt/controller/WeiXinUserInfoController.java

@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 
@@ -42,7 +43,24 @@ public class WeiXinUserInfoController {
 //	@Autowired
 //	private WeiXinPlatformService weiXinPlatformService;
 	Logger log = Logger.getLogger(WeiXinUserInfoController.class);	
-	
+
+	@ResponseBody
+	@RequestMapping("/checkAccountStatus")
+	public void checkAccountStatus(@RequestParam String openid, HttpServletResponse response) throws IOException{
+		HttpRespMsg msg = new HttpRespMsg();
+		TbUserExample example = new TbUserExample();
+		example.createCriteria().andOpenidEqualTo(openid);
+		if (tbUserMapper.countByExample(example) > 0) {
+			TbUser user = tbUserMapper.selectByExample(example).get(0);
+			msg.data = user.getAccount();
+		} else {
+			msg.setError("没有找到相应账号");
+		}
+		response.setContentType("application/json");
+		response.setCharacterEncoding("UTF-8");
+		response.getWriter().println(msg.toJSONStr());
+	}
+
 	@RequestMapping("/getWeiXinOpenid")
 	public ModelAndView getWeiXinOpenid(@RequestParam(required = false) String code) {
 		log.info("============!!!!!进入getWeiXinOpenid==========");

+ 2 - 1
ys_int/src/i18n/lang/en.js

@@ -155,7 +155,8 @@ const lang = {
 		editPro: "Edit Project",
 		addUser: "Add Person",
 		uploadAndAdd: "Submit and Add",
-		delFile: "Are you sure to delete this document??",
+		delFile: "Are you sure to delete this document?",
+		num:"Num",
         // 人员管理
         initial: "Initial Password",
         name: "Name",

+ 1 - 0
ys_int/src/i18n/lang/zh.js

@@ -156,6 +156,7 @@ const lang = {
 		addUser: "添加人员",
 		uploadAndAdd: "提交并新增",
 		delFile: "确认删除该文档吗?",
+		num:"序号",
         // 人员管理
         initial: "初始密码",
         name: "姓名",

+ 117 - 20
ys_int/src/views/project/projectDetail.vue

@@ -78,7 +78,7 @@
                                 <el-table-column type="index" width="40"></el-table-column>
                                 <el-table-column prop="modelNo" :label="$t('mold.moldNo')" width="200" sortable>
                                     <template slot-scope="scope">
-                                        <span class="model" @click="toMold(scope.row.id)">{{scope.row.modelNo}}</span>
+                                        <span class="model" @click="toMold(scope.row.id)">{{scope.row.belongProjectGrade}}-{{scope.row.modelNo}}</span>
                                     </template>
                                 </el-table-column>
                                 <el-table-column prop="modelName" :label="$t('mold.modelName')" width="500" sortable></el-table-column>
@@ -663,7 +663,9 @@
                 this.http.post(this.port.project.getUserById, param , res => {
                     if (res.code == "ok") {
                         var list = res.data , assets = [] , produce = [];
+                        var allUserId = [];
                         for(var i in list) {
+                            allUserId.push(list[i].id); 
                             if(list[i].companyId == this.proDetail.ownerCompany){
                                 if(list[i].id != this.user.id){
                                     if(list[i].id != this.proDetail.managerId){
@@ -674,14 +676,67 @@
                                 produce.push(list[i])
                             }
                         }
-                        this.editForm.managerId = "";
-                        this.editForm.customerApproverId = "";
-                        this.editForm.users = [];
+
+                        var manager = allUserId.indexOf(this.editForm.managerId.id),
+                            customerApprover = allUserId.indexOf(this.editForm.customerApproverId),
+                            array = res.data , newAssets = [] , newProduce = [],newCharger = [];
+
                         this.allUser = res.data;
-                        this.charger = res.data;
-                        this.assets = assets;
-                        this.produce = produce;
-                        this.general = res.data;
+
+                        if(manager == -1) {
+                            this.editForm.managerId = "";
+                            this.charger = res.data;
+                        } else {
+                            for(var i in list) {
+                                newCharger.push(list[i]);
+                            }
+                            this.charger = newCharger;
+                        }
+
+                        if(customerApprover == -1) {
+                            this.editForm.customerApproverId = "";
+                        } else {
+                            for(var i in list) {
+                                if(str.indexOf(list[i].id) == -1) {
+                                    if(list[i].subordinateType == 0){
+                                        newAssets.push(list[i])
+                                    } else {
+                                        newProduce.push(list[i])
+                                    }
+                                }
+                            }
+                            this.assets = newAssets;
+                            this.produce = newAssets;
+                        }
+
+                        var oldUsers = [] , backUsers = this.proDetail.participateUsers;
+                        for(var i in backUsers) {
+                            oldUsers.push(backUsers[i]);
+                        }
+                        for(var i in oldUsers) {
+                            var num = allUserId.indexOf(oldUsers[i].id);
+                            if(num == -1) {
+                                oldUsers.splice(num - 1, 1);
+                            } else {
+                                for(var j in list){
+                                    if(oldUsers[i].id == list[j].id) {
+                                        if(list[j].id == this.editForm.customerApproverId || list[j].id == this.editForm.managerId.id || list[j].id == this.editForm.ownerApproverId){
+                                            array.splice(j,1)
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                        var editUser = [];
+                        for(var i in oldUsers) {
+                            for(var j in this.editForm.users) {
+                                if(this.editForm.users[j] == oldUsers[i].id) {
+                                    editUser.push(oldUsers[i].id)
+                                }
+                            }
+                        }
+                        this.editForm.users = editUser;
+                        this.general = array;
                         this.setMember();
                     } else {
                         this.$message({
@@ -741,19 +796,61 @@
                     users.push(this.proDetail.participateUsers[i].id)
                 }
 
-                this.editForm = {
-                    id: this.proDetail.id,
-                    projectName: this.proDetail.projectName,
-                    customerCompany: compArr,
-                    managerId: manager,
-                    ownerApproverId: ownerApproverId,
-                    customerApproverId: customerApproverId,
-                    modelIds: moldArr,
-                    users: users
+                var param = {} ,
+                str = this.proDetail.ownerCompany + ',';
+                for(var i in this.proDetail.models){
+                    if(str.indexOf(this.proDetail.models[i].produceCompanyId) == -1) {
+                        str += this.proDetail.models[i].produceCompanyId + ",";
+                    }
                 }
-                this.setMember();
-
-                this.editFormVisible = true;
+                str = str.substring(0,str.length-1);
+                param.companyIds = str;
+                param.id = this.user.id;
+                param.projectId = this.detailId;
+                this.http.post(this.port.project.getUserById, param , res => {
+                    if (res.code == "ok") {
+                        var list = res.data , assets = [] , produce = [];
+                        for(var i in list) {
+                            if(list[i].companyId == this.proDetail.ownerCompany){
+                                if(list[i].id != this.user.id){
+                                    if(list[i].id != this.proDetail.managerId){
+                                        assets.push(list[i])
+                                    }
+                                }
+                            } else {
+                                produce.push(list[i])
+                            }
+                        }
+                        this.allUser = res.data;
+                        this.charger = res.data;
+                        this.assets = assets;
+                        this.produce = produce;
+                        this.general = res.data;
+                        this.editForm = {
+                            id: this.proDetail.id,
+                            projectName: this.proDetail.projectName,
+                            customerCompany: compArr,
+                            managerId: manager,
+                            ownerApproverId: ownerApproverId,
+                            customerApproverId: customerApproverId,
+                            modelIds: moldArr,
+                            users: users
+                        }
+                        this.setMember();
+                        this.editFormVisible = true;
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        });
+                    }
+                }, error => {
+                    this.$message({
+                        message: error,
+                        type: 'error'
+                    });
+                })
+                //this.setMember();
             },
 
             setMember() {

+ 1 - 1
ys_int/src/views/project/staff.vue

@@ -25,7 +25,7 @@
 				<el-form-item>
 					<el-button type="primary" @click="getUsers">{{$t('base.query')}}</el-button>
 				</el-form-item>
-				<el-form-item style="float:right;" v-if="user.subordinateType == 0">
+				<el-form-item style="float:right;" v-if="user.subordinateType == 0 || user.isManager == 1">
 					<el-button type="primary" @click="handleAdd">{{$t('base.add')}}</el-button>
 				</el-form-item>
 			</el-form>

+ 117 - 20
ys_vue/src/views/project/projectDetail.vue

@@ -77,7 +77,7 @@
                                 <el-table-column type="index" width="40"></el-table-column>
                                 <el-table-column prop="modelNo" label="模具编号" width="200" sortable>
                                     <template slot-scope="scope">
-                                        <span class="model" @click="toMold(scope.row.id)">{{scope.row.modelNo}}</span>
+                                        <span class="model" @click="toMold(scope.row.id)">{{scope.row.belongProjectGrade}}-{{scope.row.modelNo}}</span>
                                     </template>
                                 </el-table-column>
                                 <el-table-column prop="modelName" label="模具名称" width="500" sortable></el-table-column>
@@ -642,7 +642,9 @@
                 this.http.post(this.port.project.getUserById, param , res => {
                     if (res.code == "ok") {
                         var list = res.data , assets = [] , produce = [];
+                        var allUserId = [];
                         for(var i in list) {
+                            allUserId.push(list[i].id); 
                             if(list[i].companyId == this.proDetail.ownerCompany){
                                 if(list[i].id != this.user.id){
                                     if(list[i].id != this.proDetail.managerId){
@@ -653,14 +655,67 @@
                                 produce.push(list[i])
                             }
                         }
-                        this.editForm.managerId = "";
-                        this.editForm.customerApproverId = "";
-                        this.editForm.users = [];
+
+                        var manager = allUserId.indexOf(this.editForm.managerId.id),
+                            customerApprover = allUserId.indexOf(this.editForm.customerApproverId),
+                            array = res.data , newAssets = [] , newProduce = [],newCharger = [];
+
                         this.allUser = res.data;
-                        this.charger = res.data;
-                        this.assets = assets;
-                        this.produce = produce;
-                        this.general = res.data;
+
+                        if(manager == -1) {
+                            this.editForm.managerId = "";
+                            this.charger = res.data;
+                        } else {
+                            for(var i in list) {
+                                newCharger.push(list[i]);
+                            }
+                            this.charger = newCharger;
+                        }
+
+                        if(customerApprover == -1) {
+                            this.editForm.customerApproverId = "";
+                        } else {
+                            for(var i in list) {
+                                if(str.indexOf(list[i].id) == -1) {
+                                    if(list[i].subordinateType == 0){
+                                        newAssets.push(list[i])
+                                    } else {
+                                        newProduce.push(list[i])
+                                    }
+                                }
+                            }
+                            this.assets = newAssets;
+                            this.produce = newAssets;
+                        }
+
+                        var oldUsers = [] , backUsers = this.proDetail.participateUsers;
+                        for(var i in backUsers) {
+                            oldUsers.push(backUsers[i]);
+                        }
+                        for(var i in oldUsers) {
+                            var num = allUserId.indexOf(oldUsers[i].id);
+                            if(num == -1) {
+                                oldUsers.splice(num - 1, 1);
+                            } else {
+                                for(var j in list){
+                                    if(oldUsers[i].id == list[j].id) {
+                                        if(list[j].id == this.editForm.customerApproverId || list[j].id == this.editForm.managerId.id || list[j].id == this.editForm.ownerApproverId){
+                                            array.splice(j,1)
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                        var editUser = [];
+                        for(var i in oldUsers) {
+                            for(var j in this.editForm.users) {
+                                if(this.editForm.users[j] == oldUsers[i].id) {
+                                    editUser.push(oldUsers[i].id)
+                                }
+                            }
+                        }
+                        this.editForm.users = editUser;
+                        this.general = array;
                         this.setMember();
                     } else {
                         this.$message({
@@ -720,19 +775,61 @@
                     users.push(this.proDetail.participateUsers[i].id)
                 }
 
-                this.editForm = {
-                    id: this.proDetail.id,
-                    projectName: this.proDetail.projectName,
-                    customerCompany: compArr,
-                    managerId: manager,
-                    ownerApproverId: ownerApproverId,
-                    customerApproverId: customerApproverId,
-                    modelIds: moldArr,
-                    users: users
+                var param = {} ,
+                    str = this.proDetail.ownerCompany + ',';
+                for(var i in this.proDetail.models){
+                    if(str.indexOf(this.proDetail.models[i].produceCompanyId) == -1) {
+                        str += this.proDetail.models[i].produceCompanyId + ",";
+                    }
                 }
-                this.setMember();
-
-                this.editFormVisible = true;
+                str = str.substring(0,str.length-1);
+                param.companyIds = str;
+                param.id = this.user.id;
+                param.projectId = this.detailId;
+                this.http.post(this.port.project.getUserById, param , res => {
+                    if (res.code == "ok") {
+                        var list = res.data , assets = [] , produce = [];
+                        for(var i in list) {
+                            if(list[i].companyId == this.proDetail.ownerCompany){
+                                if(list[i].id != this.user.id){
+                                    if(list[i].id != this.proDetail.managerId){
+                                        assets.push(list[i])
+                                    }
+                                }
+                            } else {
+                                produce.push(list[i])
+                            }
+                        }
+                        this.allUser = res.data;
+                        this.charger = res.data;
+                        this.assets = assets;
+                        this.produce = produce;
+                        this.general = res.data;
+                        this.editForm = {
+                            id: this.proDetail.id,
+                            projectName: this.proDetail.projectName,
+                            customerCompany: compArr,
+                            managerId: manager,
+                            ownerApproverId: ownerApproverId,
+                            customerApproverId: customerApproverId,
+                            modelIds: moldArr,
+                            users: users
+                        }
+                        this.setMember();
+                        this.editFormVisible = true;
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        });
+                    }
+                }, error => {
+                    this.$message({
+                        message: error,
+                        type: 'error'
+                    });
+                })
+                //this.setMember();
             },
 
             setMember() {

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

@@ -25,7 +25,7 @@
 				<el-form-item>
 					<el-button type="primary" @click="getUsers">查询</el-button>
 				</el-form-item>
-				<el-form-item style="float:right;" v-if="user.subordinateType == 0">
+				<el-form-item style="float:right;" v-if="user.subordinateType == 0 || user.isManager == 1">
 					<el-button type="primary" @click="handleAdd">新增</el-button>
 				</el-form-item>
 			</el-form>