From 555d43cd77473c1f5e1a2d0a29d0b61381b23015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Sun, 10 Apr 2022 06:40:32 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/js/util.js | 66 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/src/common/js/util.js b/src/common/js/util.js index f4374a1b..cf5c00e9 100644 --- a/src/common/js/util.js +++ b/src/common/js/util.js @@ -13,6 +13,60 @@ function padding(s, len) { export default { + /** + * 通过字典值获取其名称 + * 界面上可以 + * {{formatDicts(dicts,'xxx',scope.row.xxx)}} + * @param {*} dicts + * @param {*} itemCode + * @param {*} cellValue + * @returns + */ + formatDicts: function(dicts,itemCode,cellValue){ + let key=itemCode; + if( dicts[key]==undefined || dicts[key]==null || dicts[key].length==0 ){ + return cellValue; + } + let dict=dicts[key].find(i=>i.id===cellValue) + if(dict){ + return dict.name + }else{ + return cellValue + } + }, + + /** + * 通过字典值获取其名称,返回根值相同的字典,并自动计算其对应显示样式 + * 界面上可以类似使用 + * {{item.name}} + * + * @param {*} dicts + * @param {*} itemCode + * @param {*} cellValue + * @returns [{id:'',name:'',className:''}] + */ + formatDictsWithClass: function(dicts,itemCode,cellValue){ + debugger; + var classNames=['info','primary','success','warning','danger']; + let key=itemCode; + if(!cellValue){ + return []; + } + if(dicts[key]==undefined || dicts[key]==null || dicts[key].length==0 ){ + var className=cellValue%5; + return [{id:cellValue,name:cellValue,className:classNames[cellValue%5]}]; + } + let data=dicts[key].find(i=>i.id===cellValue) + let index=dicts[key].findIndex(i=>i.id===cellValue) + if(data){ + data['className']=classNames[index%5] + return [data]; + }else{ + return [{id:cellValue,name:cellValue,className:classNames[cellValue%5]}] + } + + }, + calcTableMaxHeight(cssSelector) { var table=cssSelector; if(typeof cssSelector == 'string'){ @@ -157,10 +211,8 @@ export default { */ toLine(name) { return name.replace(/([A-Z])/g, "_$1").toLowerCase(); - }, - formatDate: { - - format: function(date, pattern) { + }, + formatDate: function(date, pattern) { pattern = pattern || DEFAULT_PATTERN return pattern.replace(SIGN_REGEXP, function($0) { switch ($0.charAt(0)) { @@ -183,7 +235,7 @@ export default { } }) }, - parse: function(dateString, pattern) { + parseDate: function(dateString, pattern) { var matchs1 = pattern.match(SIGN_REGEXP) var matchs2 = dateString.match(/(\d)+/g) if (matchs1.length == matchs2.length) { @@ -215,9 +267,7 @@ export default { return _date } return null - }, - - }, + }, //type date/daterange pickerOptions: function(type) { From b9ae858bbd7bd1040541906c571d83c198bb840f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Sun, 10 Apr 2022 06:42:37 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mdp/form/formData/FormDataMng.vue | 4 ++-- src/views/mdp/workflow/hi/procinst/ProcinstMng.vue | 4 ++-- src/views/mdp/workflow/ru/execution/ExecutionMng.vue | 6 +++--- .../ru/procinstParames/ProcinstParamesStartSet.vue | 4 ++-- src/views/mdp/workflow/ru/task/TaskMng.vue | 8 ++++---- src/views/xm/core/xmPhase/XmPhaseAdd.vue | 4 ++-- src/views/xm/core/xmPhase/XmPhaseBatch.vue | 12 ++++++------ src/views/xm/core/xmPhase/XmPhaseForProduct.vue | 12 ++++++------ src/views/xm/core/xmPhase/XmPhaseMng.vue | 12 ++++++------ src/views/xm/core/xmTask/XmTaskAdd.vue | 4 ++-- src/views/xm/core/xmTask/XmTaskEdit.vue | 4 ++-- src/views/xm/core/xmTask/XmTaskMng.vue | 6 +++--- 12 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/views/mdp/form/formData/FormDataMng.vue b/src/views/mdp/form/formData/FormDataMng.vue index 83f13325..ef52970b 100644 --- a/src/views/mdp/form/formData/FormDataMng.vue +++ b/src/views/mdp/form/formData/FormDataMng.vue @@ -274,7 +274,7 @@ tags:[], users:null,//更新人 cusers:null,//创建人 - createTimeRanger:[util.formatDate.format(fromStartTime,'yyyy-MM-dd'),util.formatDate.format(toStartTime,'yyyy-MM-dd')], + createTimeRanger:[util.formatDate(fromStartTime,'yyyy-MM-dd'),util.formatDate(toStartTime,'yyyy-MM-dd')], flowState:'',//审核状态 0 未审核 1审核中 2 审核结束 }, pickerOptions: { @@ -942,7 +942,7 @@ var nullTimeDatas=[]; var tags=[]; var now=new Date(); - var dateStr=util.formatDate.format(now,'yyyy-MM-dd'); + var dateStr=util.formatDate(now,'yyyy-MM-dd'); datas.forEach(i=>{ var rowData=Object.assign({},i); diff --git a/src/views/mdp/workflow/hi/procinst/ProcinstMng.vue b/src/views/mdp/workflow/hi/procinst/ProcinstMng.vue index 13f2b911..e9357268 100644 --- a/src/views/mdp/workflow/hi/procinst/ProcinstMng.vue +++ b/src/views/mdp/workflow/hi/procinst/ProcinstMng.vue @@ -217,8 +217,8 @@ categoryTreeNodes: [], tags: [], startTimeRanger: [ - util.formatDate.format(fromStartTime, "yyyy-MM-dd"), - util.formatDate.format(toStartTime, "yyyy-MM-dd") + util.formatDate(fromStartTime, "yyyy-MM-dd"), + util.formatDate(toStartTime, "yyyy-MM-dd") ], planFinishTimeRanger: [], endTimeRanger: [], diff --git a/src/views/mdp/workflow/ru/execution/ExecutionMng.vue b/src/views/mdp/workflow/ru/execution/ExecutionMng.vue index 2c7be3d3..5c011037 100644 --- a/src/views/mdp/workflow/ru/execution/ExecutionMng.vue +++ b/src/views/mdp/workflow/ru/execution/ExecutionMng.vue @@ -328,11 +328,11 @@ procCategory: '', categoryTreeNodes: [], tags: [], - startTimeRanger: [util.formatDate.format(fromStartTime, 'yyyy-MM-dd'), util.formatDate.format(toStartTime, + startTimeRanger: [util.formatDate(fromStartTime, 'yyyy-MM-dd'), util.formatDate(toStartTime, 'yyyy-MM-dd')], planFinishTimeRanger: [], assignee: null, //已选中人员 - calendarDate: util.formatDate.format(toStartTime, 'yyyy-MM-dd'), + calendarDate: util.formatDate(toStartTime, 'yyyy-MM-dd'), filterType: '', suspensionState: '', //1/2 激活、挂起 }, @@ -988,7 +988,7 @@ var delayTasks = []; var tags = []; var now = new Date(); - var dateStr = util.formatDate.format(now, 'yyyy-MM-dd'); + var dateStr = util.formatDate(now, 'yyyy-MM-dd'); if (dateStr == data.day) { data.isSelected = true; diff --git a/src/views/mdp/workflow/ru/procinstParames/ProcinstParamesStartSet.vue b/src/views/mdp/workflow/ru/procinstParames/ProcinstParamesStartSet.vue index 0ed9bf46..5b912462 100644 --- a/src/views/mdp/workflow/ru/procinstParames/ProcinstParamesStartSet.vue +++ b/src/views/mdp/workflow/ru/procinstParames/ProcinstParamesStartSet.vue @@ -333,7 +333,7 @@ }, //新增界面数据 流程实例参数设置表 addForm: { - id:seq.sn(),isRefForm:'',monitors:'',sponsors:'',procInstId:'',formId:'',formDataId:'',procDefId:'',userid:'',startDate:util.formatDate.format(new Date(),'yyyy-MM-dd hh:mm:ss'),planFinishTime:'',mainQx:'',isTemplate:'',mainContext:'',mainTitle:'',deptid:'',categoryId:'' + id:seq.sn(),isRefForm:'',monitors:'',sponsors:'',procInstId:'',formId:'',formDataId:'',procDefId:'',userid:'',startDate:util.formatDate(new Date(),'yyyy-MM-dd hh:mm:ss'),planFinishTime:'',mainQx:'',isTemplate:'',mainContext:'',mainTitle:'',deptid:'',categoryId:'' }, /**begin 在下面加自定义属性,记得补上面的一个逗号**/ procdefParamesForm: { @@ -603,7 +603,7 @@ this.addForm.sponsors=(this.procdef.sponsors!=null && this.procdef.sponsors!='')?this.procdef.sponsors:this.userInfo.userid; var planFinishTime = new Date(); planFinishTime.setTime(planFinishTime.getTime() + 3600 * 1000 * 24 * 7); - this.addForm.planFinishTime=util.formatDate.format(planFinishTime,'yyyy-MM-dd hh:mm:ss') + this.addForm.planFinishTime=util.formatDate(planFinishTime,'yyyy-MM-dd hh:mm:ss') this.addForm.tagIds=this.procdef.tagIds; this.addForm.tagNames=this.procdef.tagNames; this.addForm.mainQx=this.procdef.mainQx; diff --git a/src/views/mdp/workflow/ru/task/TaskMng.vue b/src/views/mdp/workflow/ru/task/TaskMng.vue index b346ee26..13d1781f 100644 --- a/src/views/mdp/workflow/ru/task/TaskMng.vue +++ b/src/views/mdp/workflow/ru/task/TaskMng.vue @@ -292,11 +292,11 @@ categoryTreeNodes: [], tags: [], startTimeRanger: [ - util.formatDate.format(fromStartTime, "yyyy-MM-dd"), - util.formatDate.format(toStartTime, "yyyy-MM-dd") + util.formatDate(fromStartTime, "yyyy-MM-dd"), + util.formatDate(toStartTime, "yyyy-MM-dd") ], planFinishTimeRanger: [], - calendarDate: util.formatDate.format(toStartTime, 'yyyy-MM-dd'), + calendarDate: util.formatDate(toStartTime, 'yyyy-MM-dd'), }, pickerOptions: { shortcuts: [{ @@ -1153,7 +1153,7 @@ var tags = []; var now = new Date(); - var dateStr = util.formatDate.format(now, "yyyy-MM-dd"); + var dateStr = util.formatDate(now, "yyyy-MM-dd"); if (dateStr == data.day) { data.isSelected = true; } diff --git a/src/views/xm/core/xmPhase/XmPhaseAdd.vue b/src/views/xm/core/xmPhase/XmPhaseAdd.vue index f481f1fb..b59446e7 100644 --- a/src/views/xm/core/xmPhase/XmPhaseAdd.vue +++ b/src/views/xm/core/xmPhase/XmPhaseAdd.vue @@ -218,8 +218,8 @@ id:'',name:'',remark:'',parentPhaseId:'',branchId:'',taskType:'kf',planType:'m1',projectId:'',beginDate:'',endDate:'',budgetHours:'',budgetStaffNu:'',ctime:'',budgetNouserAt:'',budgetIuserAt:'',budgetOuserAt:'',baselineId:'',bizProcInstId:'',bizFlowState:'',budgetWorkload:'',totalActWorkload:'',totalActNouserAt:'',totalActInerUserAt:'',totalActOuserAt:'',planType:'',taskType:'',seqNo:'1',budgetIuserCnt:'',budgetOuserCnt:'',budgetIuserPrice:80,budgetOuserPrice:100,budgetIuserWorkload:0,budgetOuserWorkload:0,ntype:'0' }, dateRanger: [ - util.formatDate.format(beginDate, "yyyy-MM-dd HH:mm:ss"), - util.formatDate.format(endDate, "yyyy-MM-dd HH:mm:ss") + util.formatDate(beginDate, "yyyy-MM-dd HH:mm:ss"), + util.formatDate(endDate, "yyyy-MM-dd HH:mm:ss") ], /**begin 在下面加自定义属性,记得补上面的一个逗号**/ pickerOptions: util.pickerOptions('datarange'), diff --git a/src/views/xm/core/xmPhase/XmPhaseBatch.vue b/src/views/xm/core/xmPhase/XmPhaseBatch.vue index f541b982..0969f28a 100644 --- a/src/views/xm/core/xmPhase/XmPhaseBatch.vue +++ b/src/views/xm/core/xmPhase/XmPhaseBatch.vue @@ -781,9 +781,9 @@ export default { var beginDate = new Date(); const endDate = new Date(); endDate.setTime(ctime.getTime() + 3600 * 1000 * 24 * 7 * 4); //两周后 - i.ctime = util.formatDate.format(ctime, "yyyy-MM-dd HH:mm:ss"); - i.beginDate = util.formatDate.format(beginDate, "yyyy-MM-dd HH:mm:ss"); - i.endDate = util.formatDate.format(endDate, "yyyy-MM-dd HH:mm:ss"); + i.ctime = util.formatDate(ctime, "yyyy-MM-dd HH:mm:ss"); + i.beginDate = util.formatDate(beginDate, "yyyy-MM-dd HH:mm:ss"); + i.endDate = util.formatDate(endDate, "yyyy-MM-dd HH:mm:ss"); }); batchImportFromTemplate(phaseTemplates2) .then((res) => { @@ -1669,12 +1669,12 @@ export default { var beginDate = new Date(); const endDate = new Date(); endDate.setTime(ctime.getTime() + 3600 * 1000 * 24 * 7 * 4); //两周后 - subRow.ctime = util.formatDate.format(ctime, "yyyy-MM-dd HH:mm:ss"); - subRow.beginDate = util.formatDate.format( + subRow.ctime = util.formatDate(ctime, "yyyy-MM-dd HH:mm:ss"); + subRow.beginDate = util.formatDate( beginDate, "yyyy-MM-dd HH:mm:ss" ); - subRow.endDate = util.formatDate.format(endDate, "yyyy-MM-dd HH:mm:ss"); + subRow.endDate = util.formatDate(endDate, "yyyy-MM-dd HH:mm:ss"); this.fieldChange(subRow, "seqNo"); this.xmPhases.unshift(subRow); diff --git a/src/views/xm/core/xmPhase/XmPhaseForProduct.vue b/src/views/xm/core/xmPhase/XmPhaseForProduct.vue index 519120ee..9f684778 100644 --- a/src/views/xm/core/xmPhase/XmPhaseForProduct.vue +++ b/src/views/xm/core/xmPhase/XmPhaseForProduct.vue @@ -538,9 +538,9 @@ import XmTaskList from '../xmTask/XmTaskList.vue'; var beginDate=new Date(); const endDate=new Date(); endDate.setTime(ctime.getTime() + 3600 * 1000 * 24 * 7 *4);//两周后 - i.ctime=util.formatDate.format(ctime,'yyyy-MM-dd HH:mm:ss') - i.beginDate=util.formatDate.format(beginDate,'yyyy-MM-dd HH:mm:ss') - i.endDate=util.formatDate.format(endDate,'yyyy-MM-dd HH:mm:ss') + i.ctime=util.formatDate(ctime,'yyyy-MM-dd HH:mm:ss') + i.beginDate=util.formatDate(beginDate,'yyyy-MM-dd HH:mm:ss') + i.endDate=util.formatDate(endDate,'yyyy-MM-dd HH:mm:ss') }); batchImportFromTemplate(phaseTemplates2).then(res=>{ this.phaseTemplateVisible=false; @@ -1182,9 +1182,9 @@ import XmTaskList from '../xmTask/XmTaskList.vue'; var beginDate=new Date(); const endDate=new Date(); endDate.setTime(ctime.getTime() + 3600 * 1000 * 24 * 7 *4);//两周后 - subRow.ctime=util.formatDate.format(ctime,'yyyy-MM-dd HH:mm:ss') - subRow.beginDate=util.formatDate.format(beginDate,'yyyy-MM-dd HH:mm:ss') - subRow.endDate=util.formatDate.format(endDate,'yyyy-MM-dd HH:mm:ss') + subRow.ctime=util.formatDate(ctime,'yyyy-MM-dd HH:mm:ss') + subRow.beginDate=util.formatDate(beginDate,'yyyy-MM-dd HH:mm:ss') + subRow.endDate=util.formatDate(endDate,'yyyy-MM-dd HH:mm:ss') this.fieldChange(subRow,'seqNo'); this.xmPhases.unshift(subRow); diff --git a/src/views/xm/core/xmPhase/XmPhaseMng.vue b/src/views/xm/core/xmPhase/XmPhaseMng.vue index 258f9f44..5a78fbd4 100644 --- a/src/views/xm/core/xmPhase/XmPhaseMng.vue +++ b/src/views/xm/core/xmPhase/XmPhaseMng.vue @@ -573,9 +573,9 @@ import XmTaskList from '../xmTask/XmTaskList.vue'; var beginDate=new Date(); const endDate=new Date(); endDate.setTime(ctime.getTime() + 3600 * 1000 * 24 * 7 *4);//两周后 - i.ctime=util.formatDate.format(ctime,'yyyy-MM-dd HH:mm:ss') - i.beginDate=util.formatDate.format(beginDate,'yyyy-MM-dd HH:mm:ss') - i.endDate=util.formatDate.format(endDate,'yyyy-MM-dd HH:mm:ss') + i.ctime=util.formatDate(ctime,'yyyy-MM-dd HH:mm:ss') + i.beginDate=util.formatDate(beginDate,'yyyy-MM-dd HH:mm:ss') + i.endDate=util.formatDate(endDate,'yyyy-MM-dd HH:mm:ss') }); batchImportFromTemplate(phaseTemplates2).then(res=>{ this.phaseTemplateVisible=false; @@ -1217,9 +1217,9 @@ import XmTaskList from '../xmTask/XmTaskList.vue'; var beginDate=new Date(); const endDate=new Date(); endDate.setTime(ctime.getTime() + 3600 * 1000 * 24 * 7 *4);//两周后 - subRow.ctime=util.formatDate.format(ctime,'yyyy-MM-dd HH:mm:ss') - subRow.beginDate=util.formatDate.format(beginDate,'yyyy-MM-dd HH:mm:ss') - subRow.endDate=util.formatDate.format(endDate,'yyyy-MM-dd HH:mm:ss') + subRow.ctime=util.formatDate(ctime,'yyyy-MM-dd HH:mm:ss') + subRow.beginDate=util.formatDate(beginDate,'yyyy-MM-dd HH:mm:ss') + subRow.endDate=util.formatDate(endDate,'yyyy-MM-dd HH:mm:ss') this.fieldChange(subRow,'seqNo'); this.xmPhases.unshift(subRow); diff --git a/src/views/xm/core/xmTask/XmTaskAdd.vue b/src/views/xm/core/xmTask/XmTaskAdd.vue index 67ab499a..bf17bdd4 100644 --- a/src/views/xm/core/xmTask/XmTaskAdd.vue +++ b/src/views/xm/core/xmTask/XmTaskAdd.vue @@ -377,8 +377,8 @@ groupUserSelectVisible:false, execGroupUserSelectVisible:false, budgetDateRanger: [ - util.formatDate.format(beginDate, "yyyy-MM-dd HH:mm:ss"), - util.formatDate.format(endDate, "yyyy-MM-dd HH:mm:ss") + util.formatDate(beginDate, "yyyy-MM-dd HH:mm:ss"), + util.formatDate(endDate, "yyyy-MM-dd HH:mm:ss") ], actDateRanger: [ ], diff --git a/src/views/xm/core/xmTask/XmTaskEdit.vue b/src/views/xm/core/xmTask/XmTaskEdit.vue index bbb04686..3d410c18 100644 --- a/src/views/xm/core/xmTask/XmTaskEdit.vue +++ b/src/views/xm/core/xmTask/XmTaskEdit.vue @@ -357,8 +357,8 @@ import XmMenuEdit from '../xmMenu/XmMenuEdit.vue'; groupUserSelectVisible:false, execGroupUserSelectVisible:false, budgetDateRanger: [ - util.formatDate.format(beginDate, "yyyy-MM-dd HH:mm:ss"), - util.formatDate.format(endDate, "yyyy-MM-dd HH:mm:ss") + util.formatDate(beginDate, "yyyy-MM-dd HH:mm:ss"), + util.formatDate(endDate, "yyyy-MM-dd HH:mm:ss") ], actDateRanger: [ ], diff --git a/src/views/xm/core/xmTask/XmTaskMng.vue b/src/views/xm/core/xmTask/XmTaskMng.vue index 4aa68477..5b4ba2ae 100644 --- a/src/views/xm/core/xmTask/XmTaskMng.vue +++ b/src/views/xm/core/xmTask/XmTaskMng.vue @@ -1754,12 +1754,12 @@ export default { var startTime = new Date(); const endTime = new Date(); endTime.setTime(startTime.getTime() + 3600 * 1000 * 24 * 7 * 2); //两周后 - i.createTime = util.formatDate.format( + i.createTime = util.formatDate( createTime, "yyyy-MM-dd HH:mm:ss" ); - i.startTime = util.formatDate.format(startTime, "yyyy-MM-dd HH:mm:ss"); - i.endTime = util.formatDate.format(endTime, "yyyy-MM-dd HH:mm:ss"); + i.startTime = util.formatDate(startTime, "yyyy-MM-dd HH:mm:ss"); + i.endTime = util.formatDate(endTime, "yyyy-MM-dd HH:mm:ss"); }); var params={ xmTasks:taskTemplates2, From 1393d1b526974067615b46018200ca8c75dc0efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Thu, 21 Apr 2022 12:13:42 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/branch.js | 8 +- src/api/login.js | 38 +++++++- src/views/login/BranchAdd.vue | 146 +++++++++++++++--------------- src/views/login/index.vue | 121 ++++++++++++++++++------- src/views/login/register.vue | 56 +++++++++++- src/views/login/resetPassword.vue | 81 +++++++++++++---- 6 files changed, 316 insertions(+), 134 deletions(-) diff --git a/src/api/branch.js b/src/api/branch.js index f9da89cb..811f65cc 100644 --- a/src/api/branch.js +++ b/src/api/branch.js @@ -9,11 +9,11 @@ let base=config.getSysBasePath(); *1 默认只开放普通查询,所有查询,只要上传 分页参数 {currentPage:当前页码从1开始,pageSize:每页记录数,total:总记录【数如果是0后台会自动计算总记录数非0不会自动计算】},后台都会自动按分页查询 其它 api用到再打开,没用到的api请注释掉, *2 查询、新增、修改的参数格式 params={id:'机构编号 主键',branchName:'机构名称',enabled:'是否可用',industryCategory:'行业分类',cuserid:'创建人编号',cdate:'创建日期',cusername:'创建人姓名',phoneNo:'联系电话',emaill:'邮件'} **/ - -//普通查询 条件之间and关系 + +//普通查询 条件之间and关系 export const listBranchNoAuth = params => { return axios.get(`${base}/mdp/sys/branch/listBranchNoAuth`, { params: params }); }; -//模糊查询管理端机构表(机构下面若干部门) 条件之间or关系 +//模糊查询管理端机构表(机构下面若干部门) 条件之间or关系 //export const listBranchKey = params => { return axios.get(`${base}/mdp/sys/branch/listKey`, { params: params }); }; //删除一条管理端机构表(机构下面若干部门) params={id:'机构编号 主键'} @@ -30,4 +30,4 @@ export const addBranchNoAuth = params => { return axios.post(`${base}/mdp/sys/br //新增一条企业入驻审核流程 -export const addUserJoinBranchRequire = params => { return axios.post(`${base}/mdp/sys/userJoinBranchRequire/add`, params); }; \ No newline at end of file +export const addUserJoinBranchRequire = params => { return axios.post(`${base}/mdp/sys/userJoinBranchRequire/add`, params); }; diff --git a/src/api/login.js b/src/api/login.js index 695083cc..f01c13ec 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -7,13 +7,14 @@ import config from '@/common/config' let base=config.getOauth2LoginBasePath(); //let base=''; -export function doLoginByUserloginid(userloginid, password,grantType,authType,deptid) { +export function doLoginByUserloginid(userloginid, password,grantType,authType,deptid,userid) { removeToken(); const data = { userloginid: userloginid, password: password, authType:authType, - deptid:deptid + deptid:deptid, + userid:userid, } return axios({ url: base+'/login/token?grantType='+grantType, @@ -55,6 +56,14 @@ export function checkPhoneno(phoneno ) { data }) } +export function queryByUserloginid( params ) { + return axios({ + url: base+'/user/queryByUserloginid', + method: 'get', + params:params + }) +} + export function doRegister( userInfo ) { removeToken(); const data = { @@ -79,6 +88,7 @@ export function resetPasswordByPhoneno( userInfo ) { newPassword:userInfo.newPassword, phoneno:userInfo.phoneno, smsCode:userInfo.smsCode, + userid:userInfo.userid } return axios({ url: base+'/user/password/reset?type=sms', @@ -109,3 +119,27 @@ export function getUserInfo(params) { data }) } + +/** + * 发送邮件 + */ + +export function sendEmail(params) { + const data=params; + return axios({ + url: base+'/user/sendEmail', + method: 'post', + data + }) +} +/** + * 验证邮箱 + */ + +export function validEmailCode(params) { + return axios({ + url: base+'/user/validEmailCode', + method: 'get', + params:params + }) +} diff --git a/src/views/login/BranchAdd.vue b/src/views/login/BranchAdd.vue index a2854514..bf470096 100644 --- a/src/views/login/BranchAdd.vue +++ b/src/views/login/BranchAdd.vue @@ -7,16 +7,16 @@ 创建新公司申请加入已有公司 - + - 查询机构是否存在 + 查询机构是否存在 - - + + - + - + - + - - - 取消 - 创建新公司 - + + + 取消 + 创建新公司 + - + - - + + 选择已有公司-申请加入 - + - + - + - - - 取消 - 加入公司 - + + + 取消 + 加入公司 + @@ -88,49 +88,49 @@ import { listOption } from '@/api/itemOption';//下拉框数据查询 import { addBranchNoAuth,listBranchNoAuth,addUserJoinBranchRequire } from '@/api/branch'; import { mapGetters } from 'vuex' - + export default { props:['branch','visible'], watch: { 'branch':function( branch ) { this.addForm = branch; }, - 'visible':function(visible) { + 'visible':function(visible) { if(visible==true){ //从新打开页面时某些数据需要重新加载,可以在这里添加 } - } - }, + } + }, data() { - const validateBranchName = (rule, value, callback) => { + const validateBranchName = (rule, value, callback) => { if( !value || value.length<=6){ callback(new Error('请输入6位以上公司名称')) }else{ callback() - } + } } - const validatePhoneNo = (rule, value, callback) => { + const validatePhoneNo = (rule, value, callback) => { if( !value || value.length !=11 ){ callback(new Error('手机号码必须为11位号码')) }else{ callback() - } - } - const validateCusername = (rule, value, callback) => { + } + } + const validateCusername = (rule, value, callback) => { if( !value || value.length <2 ){ callback(new Error('请输入联系人名称')) }else{ callback() - } - } + } + } return { - options:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]} + options:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]} load:{ list: false, edit: false, del: false, add: false },//查询中... addFormRules: { branchName: [{ required: true, trigger: 'blur', validator: validateBranchName }], cusername: [{ required: true, trigger: 'blur', validator: validateCusername }], - phoneNo: [{ required: true, trigger: 'blur', validator: validatePhoneNo }], + phoneNo: [{ required: true, trigger: 'blur', validator: validatePhoneNo }], }, //新增界面数据 管理端机构表(机构下面若干部门) addForm: { @@ -139,18 +139,18 @@ joinFormRules: { //branchName: [{ required: true, trigger: 'blur', validator: validateBranchName }], joinUsername: [{ required: true, trigger: 'blur', validator: validateCusername }], - joinUserPhoneno: [{ required: true, trigger: 'blur', validator: validatePhoneNo }], + joinUserPhoneno: [{ required: true, trigger: 'blur', validator: validatePhoneNo }], joinBranchId:[{ required: true, message: '要加入的公司不能为空', trigger: 'blur' }], joinReason:[{ required: true, message: '加入理由不能为空', trigger: 'blur' }], }, //新增界面数据 管理端机构表(机构下面若干部门) joinForm: { id:'',joinBranchId:'',joinUserPhoneno:'',joinUserid:'',joinUsername:'',joinDeptid:'',joinReason:'' - }, + }, branchs:[], addOrJoinBranch:'join' /**begin 在下面加自定义属性,记得补上面的一个逗号**/ - + /**end 在上面加自定义属性**/ }//end return },//end data @@ -161,10 +161,10 @@ }, //新增提交Branch 管理端机构表(机构下面若干部门) 父组件监听@submit="afterAddSubmit" addSubmit: function () { - + this.$refs.addForm.validate((valid) => { - if (valid) { - this.$confirm('确认提交吗?', '提示', {}).then(() => { + if (valid) { + this.$confirm('确认提交吗?', '提示', {}).then(() => { if(this.addForm.branchName.length>=6){ var params={ key:"%"+this.addForm.branchName+"%" @@ -173,32 +173,32 @@ if(res.data.tips.isOk){ if(res.data.data.length<=0){ this.load.add=true - let params = Object.assign({}, this.addForm); + let params = Object.assign({}, this.addForm); params.cuserid=this.userInfo.userid addBranchNoAuth(params).then((res) => { this.load.add=false var tips=res.data.tips; - if(tips.isOk){ + if(tips.isOk){ this.$emit('submit',res.data.data );// @submit="afterAddSubmit" } - this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' }); + this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' }); }).catch(() => this.load.add=false); }else{ - this.$notify({position:'bottom-left',showClose:true,message: "该公司名已注册,不可以使用", type: 'error' }); + this.$notify({position:'bottom-left',showClose:true,message: "该公司名已注册,不可以使用", type: 'error' }); return; } } }) }else{ - this.$notify({position:'bottom-left',showClose:true,message: "公司名必须6个字以上", type: 'error' }); + this.$notify({position:'bottom-left',showClose:true,message: "公司名必须6个字以上", type: 'error' }); return; } - + }); } }); }, - + searchBranchs:function(query){ this.load.list=true; if(query.length>=2){ @@ -219,29 +219,29 @@ }) }else{ this.load.list=false; - this.$notify({position:'bottom-left',showClose:true,message: "最少输入两个字", type: 'info' }); + this.$notify({position:'bottom-left',showClose:true,message: "最少输入两个字", type: 'info' }); return; } }, - joinBranch:function(){ + joinBranch:function(){ this.$refs.joinForm.validate((valid) => { - if (valid) { - this.$confirm('确认提交吗?', '提示', {}).then(() => { + if (valid) { + this.$confirm('确认提交吗?', '提示', {}).then(() => { var params= this.joinForm - addUserJoinBranchRequire(params).then(res=>{ + addUserJoinBranchRequire(params).then(res=>{ var tips = res.data.tips; - if(tips.isOk){ - this.$notify({position:'bottom-left',showClose:true,message:tips.msg, type: 'success' }); - //this.$emit('submit',res.data.data );// @submit="afterAddSubmit" - return; - }else{ - this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: 'error' }); + if(tips.isOk){ + this.$notify({position:'bottom-left',showClose:true,message:tips.msg, type: 'success' }); + //this.$emit('submit',res.data.data );// @submit="afterAddSubmit" + return; + }else{ + this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: 'error' }); return; } }) }); } - }); + }); }, checkBranchExists:function(){ if(this.addForm.branchName.length>=2){ @@ -251,25 +251,25 @@ listBranchNoAuth(params).then(res=>{ if(res.data.tips.isOk){ if(res.data.data.length<=0){ - this.$notify({position:'bottom-left',showClose:true,message: "该公司名未注册,可以使用", type: 'success' }); + this.$notify({position:'bottom-left',showClose:true,message: "该公司名未注册,可以使用", type: 'success' }); return; }else{ - this.$notify({position:'bottom-left',showClose:true,message: "该公司名已注册,不可以使用", type: 'error' }); + this.$notify({position:'bottom-left',showClose:true,message: "该公司名已注册,不可以使用", type: 'error' }); return; } } }) }else{ - this.$notify({position:'bottom-left',showClose:true,message: "最少输入两个字", type: 'error' }); + this.$notify({position:'bottom-left',showClose:true,message: "最少输入两个字", type: 'error' }); return; } } /**begin 在下面加自定义方法,记得补上面的一个逗号**/ - + /**end 在上面加自定义方法**/ - + },//end method - components: { + components: { //在下面添加其它组件 'branch-edit':BranchEdit }, computed: { @@ -278,7 +278,7 @@ ]) }, mounted() { - this.addForm=Object.assign(this.addForm, this.branch); + this.addForm=Object.assign(this.addForm, this.branch); this.addForm.cusername=this.userInfo.username this.addForm.phoneNo=this.userInfo.phoneno; this.addForm.cuserid=this.userInfo.userid; @@ -299,4 +299,4 @@ \ No newline at end of file + diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 865258bb..a63b7267 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -13,14 +13,14 @@ - 账户密码登录 + 账户密码 短信验证码快速登录 - - + + - + @@ -34,8 +34,13 @@ - 发送验证码 + 发送验证码 + + 该手机号有{{users.length}}个账户,请选择需要登录的账户 +
+ 已选择:{{selectUser.username}} 选择账户 +
@@ -87,6 +92,27 @@ + + + + + + + + + + + + + + + + @@ -96,6 +122,7 @@ import LangSelect from '@/components/LangSelect'; import SocialSign from './socialsignin'; import Register from './register'; import ResetPassword from './resetPassword'; +import { queryByUserloginid } from '@/api/login'; import BranchAdd from './BranchAdd'; import { mapGetters } from 'vuex'; @@ -151,14 +178,14 @@ export default { } return { loginForm: { - displayUserid: '', + userloginid: '', password: '', authType:'password_display_userid',//password/sms/password_display_userid 分别为账户密码、短信验证码快捷登录 phoneno:'',//手机号码 smsCode:'',//短信验证码 }, loginRules: { - displayUserid: [{ required: true, trigger: 'blur', validator: validateDisplayUserid }], + userloginid: [{ required: true, trigger: 'blur', validator: validateDisplayUserid }], password: [{ required: true, trigger: 'blur', validator: validatePassword }], phoneno: [{ required: true, trigger: 'blur', validator: validatePhoneno }], smsCode: [{ required: true, trigger: 'blur', validator: validateSmsCode }], @@ -166,13 +193,16 @@ export default { passwordType: 'password', loading: false, + load:{sendSmsCode:false,}, showResetPasswordDialog:false,//显示忘记密码重置密码窗口 showTpLoginDialog: false, //显示第三方登陆对话框 showRegisterDialog: false,//显示注册窗口 deptSelectVisible:false,//显示选择部门对话框 userDeptid:'',//选中的部门编号 - userBranchId:'',//选中的部门对应的机构号 addBranchFormVisible:false, //显示添加机构对话框 + users:[], + phonenoUsersVisible:false, + selectUser:null, } }, methods: { @@ -184,17 +214,30 @@ export default { } }, sendPhonenoSmsCode(){ - var params={ - phoneno:this.loginForm.phoneno, - scene:"login" - } - sendSmsCode(params).then(res=>{ - if(res.data.tips.isOk){ - this.$message.info(res.data.tips.msg); + this.load.sendSmsCode=true; + this.$refs.loginForm.validateField("phoneno",(err)=>{ + if(err){ + this.$message.error(err); + this.load.sendSmsCode=false; + return; }else{ - this.$message.error(res.data.tips.msg); + var params={ + phoneno:this.loginForm.phoneno, + scene:"login" + } + + sendSmsCode(params).then(res=>{ + this.load.sendSmsCode=false; + if(res.data.tips.isOk){ + this.$message.success(res.data.tips.msg); + this.queryByUserloginid(); + }else{ + this.$message.error(res.data.tips.msg); + } + }).catch(()=>this.load.sendSmsCode=false) } - }) + }); + }, handleLogin() { @@ -202,29 +245,29 @@ export default { if (valid) { this.loading = true let params={ - displayUserid:this.loginForm.displayUserid, + userloginid:this.loginForm.userloginid, password:md5(this.loginForm.password), deptid:this.userDeptid, authType:this.loginForm.authType, phoneno:this.loginForm.phoneno, - smsCode:this.loginForm.smsCode, - branchId:this.userBranchId, + smsCode:this.loginForm.smsCode } var loginParams={ } if(params.authType=='password_display_userid'){ - loginParams.userloginid=params.displayUserid + loginParams.userloginid=params.userloginid loginParams.password=params.password loginParams.grantType="password" loginParams.authType='password_display_userid' - //loginParams.deptid=params.deptid - loginParams.branchId=params.branchId + loginParams.deptid=params.deptid }else if(params.authType=='sms'){ loginParams.userloginid=params.phoneno loginParams.password=params.smsCode loginParams.grantType="password" loginParams.authType="sms" - //loginParams.deptid=params.deptid - loginParams.branchId=params.branchId + loginParams.deptid=params.deptid + } + if(this.selectUser){ + loginParams.userid=this.selectUser.userid } this.$store.dispatch("LoginByUserloginid",loginParams).then(res => { this.loading = false @@ -235,11 +278,7 @@ export default { //this.userDeptid=res2.data.userInfo.deptid this.loading = false if(res2.data.tips.isOk==true){ - if(this.$store.state.user.myBranchs==null ||this.$store.state.user.myBranchs.length==0||this.$store.state.user.myDepts==null || this.$store.state.user.myDepts.length<=0){ - //if(1==1){ - //this.$message.error("亲,您不在任何一个公司或者部门中,需要【先创建公司】\n 或者请【管理员加您进入公司】哦"); - this.addBranchFormVisible=true; - }else if(this.$store.state.user.myDepts.length>1 ){ + if(this.$store.state.user.myDepts.length>1 ){ //this.$message.info("亲,您在多个部门中任职,我分不清您要登陆哪个部门,请选择一个部门登陆吧"); if( !this.userDeptid ){ this.userDeptid=res2.data.userInfo.deptid @@ -283,10 +322,8 @@ export default { return } - + let depts=this.myDepts.filter(d=>d.deptid==this.userDeptid) if(this.$store.state.user.userInfo.deptid!=this.userDeptid){ - let depts=this.myDepts.filter(d=>d.deptid==this.userDeptid) - this.userBranchId=depts[0].branchId this.handleLogin(); return; }else{ @@ -329,6 +366,24 @@ export default { // this.$router.push({ path: '/' }) // }) // } + }, + queryByUserloginid(){ + var params={userloginid:this.loginForm.userloginid} + if(this.loginForm.authType=='sms'){ + params.idType="phoneno" + }else{ + params.idType='all' + } + queryByUserloginid(params).then(res=>{ + var tips = res.data.tips; + if(tips.isOk){ + this.users=res.data.data + } + }) + }, + onUserSelect(user){ + this.selectUser=user + this.phonenoUsersVisible=false; } }, created() { diff --git a/src/views/login/register.vue b/src/views/login/register.vue index cb74fa47..fb879e04 100644 --- a/src/views/login/register.vue +++ b/src/views/login/register.vue @@ -11,8 +11,11 @@ - 发送验证码 + 发送验证码 + 该手机号已注册有{{phonenoUsers.length}}个账户 + 查看明细 + @@ -54,7 +57,22 @@ - + + + + + + + + + + + + + {{$t('login.thirdpartyTips')}} @@ -73,7 +91,7 @@