Commit 8d0dbd1a authored by wangqinghua's avatar wangqinghua

联系人列表更新

parent 5cefb65c
......@@ -51,7 +51,7 @@ export class MyApp {
this.statusBar.styleLightContent();
timer(4500).subscribe((res) => {
timer(500).subscribe((res) => {
this.showSplash = false;
this.device();
this.loadLogin();
......
......@@ -55,6 +55,7 @@ import {VistorRegisterPageModule} from "../pages/serve-pages/vistor-register/vis
import {BusinessUnitPageModule} from "../pages/serve-pages/business-unit/business-unit.module";
import {DiscoverService} from "../pages/discover-pages/discover.service";
import {FoodPageModule} from "../pages/serve-pages/food/food.module";
import {ContactService} from "../pages/contact/contact.service";
@NgModule({
......@@ -134,6 +135,7 @@ import {FoodPageModule} from "../pages/serve-pages/food/food.module";
ServeService,
TabsService,
MineService,
ContactService,
EmitService,
AppMainService,
DiscoverService,
......
......@@ -18,30 +18,39 @@
<ion-content>
<ion-searchbar (ionInput)="getList()" [(ngModel)]="name" placeholder="姓名、手机号码"></ion-searchbar>
<div class="ion-item" *ngFor="let item of perList">
<div class="contact-box">
<div class="contact-img">
<ng-container *ngIf="item?.picUrl && item?.picUrl != ''">
<img src="{{picture+item.picUrl}}">
</ng-container>
<ng-container *ngIf="!item?.picUrl || item?.picUrl == ''">
<img src="./assets/imgs/man.png" *ngIf="item.gender =='1'||item.gender==null">
<img src="./assets/imgs/woman.png" *ngIf="item.gender =='0'">
</ng-container>
</div>
<div class="contact-box-right">
<div>
<span class="contact-name">{{item.name}}</span>
<span class="contact-handphone">{{item.mobile}}</span>
<!-- <ion-searchbar (ionInput)="getList()" [(ngModel)]="name" placeholder="姓名、手机号码"></ion-searchbar>-->
<div *ngFor="let org of orgList;let i = index;" >
<div class="item item-border" (click)="getPersonList(org,i)">
<img src="./assets/imgs/orgn.png" class="contact-img">
<span class="contact-title">{{org?.name}}</span>
<ion-icon *ngIf="!org.drop" name="ios-arrow-forward"></ion-icon>
<ion-icon *ngIf="org.drop" name="arrow-down"></ion-icon>
</div>
<div *ngIf="org.drop" class="person-list" >
<div class="ion-item" *ngFor="let item of org?.perList">
<div class="contact-box">
<div class="contact-img">
<ng-container *ngIf="item?.picUrl && item?.picUrl != ''">
<img src="{{picture+item.picUrl}}">
</ng-container>
<ng-container *ngIf="!item?.picUrl || item?.picUrl == ''">
<img src="./assets/imgs/man.png" *ngIf="item.gender =='1'||item.gender==null">
<img src="./assets/imgs/woman.png" *ngIf="item.gender =='0'">
</ng-container>
</div>
<div class="contact-box-right">
<div>
<span class="contact-name">{{item.name}}</span>
<span class="contact-handphone">{{item.mobile}}</span>
</div>
<div class="contact-organization">{{item?.orgname}}</div>
</div>
<div class="contact-checkbox">
<ion-checkbox [(ngModel)]="item.checkbox" color="danger"
(ngModelChange)="changeCheck($event,item)"></ion-checkbox>
</div>
</div>
<div class="contact-organization">{{item?.orgname}}</div>
</div>
<div class="contact-checkbox">
<ion-checkbox [(ngModel)]="item.checkbox" color="danger"
(ngModelChange)="changeCheck($event,item)"></ion-checkbox>
</div>
</div>
</div>
</ion-content>
person-mul {
.searchToolBar{
.searchToolBar {
display: flex;
flex-direction: row;
align-items: center;
justify-content: left;
box-sizing: border-box;
}
.ion-item{
.ion-item {
border-bottom: 1px solid #c8c7cc;
padding: 10px;
}
.search{
.search {
float: right;
color: #72a4fe;
font-size: 24px;
margin-right: 10px;
}
.contact-box{
.contact-box {
display: flex;
flex-direction: row;
align-items: center;
}
.contact-box-right{
.contact-box-right {
padding-left: 10px;
width: 70%;
}
.contact-checkbox{
.contact-checkbox {
width: 10%;
}
.contact-img{
.contact-img {
width: 20%;
img{
img {
width: 4rem;
height: 4rem;
border-radius: 2px;
}
}
.contact-name{
.contact-name {
font-size: 16px;
}
.contact-sex{
.contact-sex {
font-size: 16px;
font-weight: bold;
}
.male{
.male {
color: #72a4fe;
}
.female{
.female {
color: #f09ae5;
}
.contact-organization{
.contact-organization {
color: #808080;
font-size: 12px;
}
.contact-telphone{
.contact-telphone {
color: #808080;
font-size: 12px;
}
.contact-handphone{
.contact-handphone {
color: #808080;
font-size: 12px;
margin-right: 10px;
}
.back-btn{
.back-btn {
width: 30px;
height: 30px;
}
.person-list{
padding: 0 20px;
height: 100%;
transition: all 300ms;
}
.item {
display: flex;
flex-direction: row;
align-items: center;
justify-content: left;
box-sizing: border-box;
}
.item-border {
border-bottom: 1px solid #eeeeee;
padding-bottom: 10px;
margin: 15px 0px 0px;
padding-left: 15px;
padding-right: 10px;
.contact-img {
width: 3.5rem;
margin-right: 1rem;
}
ion-icon{
margin-left: auto;
margin-right: 10px;
color: #999;
line-height: 2;
font-size: 1.8rem;
}
}
}
import {Component} from '@angular/core';
import {AppGlobal, AppService} from "../../service/http.service";
import {NavController, NavParams, ViewController} from "ionic-angular";
import {ServeService} from "../../pages/serve-pages/serve.service";
import {ContactService} from "../../pages/contact/contact.service";
@Component({
selector: 'person-mul',
......@@ -13,16 +15,26 @@ export class PersonMulComponent {
name = '';
chooseList = [];
orgList = [];
constructor(public navCtrl: NavController, public navParams: NavParams,
public appService: AppService, public viewCtrl: ViewController) {
constructor(public navCtrl: NavController, public navParams: NavParams, private serveSer: ServeService,
public appService: AppService, public viewCtrl: ViewController, private contactSer: ContactService) {
}
ionViewDidLoad() {
this.getList();
this.getOrg();
}
getList() {
getOrg() {
const data = {order: 0};
this.serveSer.getAllOrganization(data).subscribe(
(res) => {
this.orgList = res;
}
)
}
getOrgPerson(org) {
const data = {
name: this.name,
pageNumber: 1,
......@@ -38,17 +50,34 @@ export class PersonMulComponent {
})
}
changeCheck(event,item) {
if(event == true){
getPersonList(item, index) {
if (item.drop) {
item.drop = false;
return
}
this.contactSer.getAllUserByOrgid(item.id).subscribe(
(res) => {
res.forEach(e => {
e.userName = e.name;
e.checkbox = false;
});
this.orgList[index].perList = res;
this.orgList[index].drop = true;
}
)
}
changeCheck(event, item) {
if (event == true) {
this.chooseList.push(item);
}else{
} else {
let n;
this.chooseList.forEach((e,index)=>{
if(e.id == item.id){
this.chooseList.forEach((e, index) => {
if (e.id == item.id) {
n = index;
}
});
this.chooseList.splice(n,1);
this.chooseList.splice(n, 1);
}
console.log(this.chooseList);
......@@ -58,7 +87,7 @@ export class PersonMulComponent {
this.viewCtrl.dismiss(this.chooseList);
}
cancel(){
cancel() {
this.viewCtrl.dismiss();
}
......
import {Injectable} from "@angular/core";import {HttpClient} from "@angular/common/http";import {Http} from "@angular/http";import {Observable} from "rxjs/Observable";import {AppGlobal} from "../../service/http.service";import {CommonService} from "../../provide/common.service"; @Injectable()export class ContactService { constructor( private http: HttpClient, //该请求 将结果转为json private commonSer: CommonService, private https: Http, //该请求不转json ) { } //获取部门下人员 getAllUserByOrgid(params): Observable<any> { return this.http.get(AppGlobal.domain + '/wisdomgroup/sysmanagement/user/getAllUserByOrgid/' + params); } }
\ No newline at end of file
......@@ -120,13 +120,6 @@ export class ContactListPage {
this.navCtrl.push("ContractPersoninfoPage", {"id": contactPerson.id});
}
// search(){
// if(this.orgid != null && this.orgid != ''){
// this.navCtrl.push("SearchPage",{"orgid":this.orgid,"orgName":this.orgName}); //组织部门下搜索
// }else{ //全局搜索
// this.navCtrl.push("SearchPage");
// }
// }
//获取常用联系人ids,数组:此方法主要是在部门人员列表中判断:
//当前人员是否在常用联系人中来判别:添加/移出联系人按钮
......
......@@ -71,10 +71,13 @@ page-room-apply {
margin-right: 10px;
white-space: initial;
border: 1px solid #eee;
padding: 2px 5px;
font-size: 1rem;
margin-bottom: 5px;
border-radius: 4px;
width: 60px;
height: 25px;
text-align: center;
line-height: 25px;
ion-icon {
margin-left: 3px;
......
......@@ -86,7 +86,7 @@ export class RoomApplyPage {
if (this.applyId) {
this.meetDetail();
this.roomMax = `该会议室可容纳${this.navParams.get('accommodation')}人`;
}else{
} else {
this.initParams();
}
}
......@@ -281,7 +281,8 @@ export class RoomApplyPage {
});
modal.onDidDismiss(data => {
if (data) {
this.personList = data;
const arr = this.personList.concat(data);
this.personList = this.commonSer.uniArr(arr,'id');
}
});
modal.present();
......@@ -305,7 +306,7 @@ export class RoomApplyPage {
this.check.participantAmount = true;
return false;
}
if(~~this.obj.participantAmount > ~~max){
if (~~this.obj.participantAmount > ~~max) {
console.log("人数太多");
this.check.participantAmount = true;
return false;
......
......@@ -11,9 +11,6 @@ page-contact {
width: 4rem;
margin-right: 1rem;
}
.item{
//margin: 0px 0 1px 15px;
}
.label-ios{
margin: 0;
padding: 15px;
......@@ -39,18 +36,6 @@ page-contact {
padding-top: 5px;
padding-bottom: 5px;
}
.item{
// height: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: left;
box-sizing: border-box;
//margin: 10px 0 10px 15px;
}
.contact-icon{
font-size: 30px;
color: #81afe8;
......@@ -81,11 +66,19 @@ page-contact {
border-bottom: 1px solid #ddd;
}
.item{
display: flex;
flex-direction: row;
align-items: center;
justify-content: left;
box-sizing: border-box;
}
.item-border{
border-bottom: 1px solid #eeeeee;
padding-bottom: 10px;
margin: 15px 0px 0px;
padding-left: 15px;
padding-right: 10px;
.contact-img{
width: 3.5rem;
margin-right: 1rem;
......
......@@ -5,14 +5,13 @@ import {File} from "@ionic-native/file";
import {FileOpener} from "@ionic-native/file-opener";
@Injectable()
export class CommonService{
constructor(public toastCtrl:ToastController,public alertCtrl:AlertController,
public loadCtrl:LoadingController,
private file: File, private fileOpener: FileOpener){}
export class CommonService {
constructor(public toastCtrl: ToastController, public alertCtrl: AlertController,
public loadCtrl: LoadingController,
private file: File, private fileOpener: FileOpener) {
}
/**
......@@ -20,7 +19,7 @@ export class CommonService{
* @param data json格式的数据
* @returns {string}
*/
toQuery(data){
toQuery(data) {
let str = '';
for (let key in data) {
if (data.hasOwnProperty(key)) {
......@@ -37,10 +36,10 @@ export class CommonService{
* @param json 需要转化的json
* @returns {FormData} formData数据
*/
toFormData(json){
toFormData(json) {
let formData = new FormData();
for(let k in json){
formData.append(k,json[k])
for (let k in json) {
formData.append(k, json[k])
}
return formData;
}
......@@ -55,7 +54,7 @@ export class CommonService{
let toast = this.toastCtrl.create({
message: message,
duration: 2000,
position:'middle',
position: 'middle',
dismissOnPageChange: true,
});
toast.present();
......@@ -65,15 +64,16 @@ export class CommonService{
}
//短暂提示提示
toastTime(message,duration) {
toastTime(message, duration) {
let toast = this.toastCtrl.create({
message: message,
duration: duration,
position:'middle',
position: 'middle',
dismissOnPageChange: true,
});
toast.present();
}
/**
* alert弹窗
* @param message 弹窗内的文字
......@@ -102,18 +102,18 @@ export class CommonService{
}
}
alert2(message,title,callback?){
alert2(message, title, callback?) {
if (callback) {
let alert = this.alertCtrl.create({
title: title,
message: message,
buttons: [
{
text: "确定",
handler: data => {
callback();
}
}]
text: "确定",
handler: data => {
callback();
}
}]
});
alert.present();
} else {
......@@ -130,32 +130,32 @@ export class CommonService{
* 下载文件
* @param url 文件URL
*/
downloadFile(fileID,fileName) {
downloadFile(fileID, fileName) {
const xhr = new XMLHttpRequest();
const fileType = this.getFileMimeType(fileName);
const url = encodeURI(AppGlobal.domain + '/wisdomgroup/modules/common/file/download/' + fileID);
xhr.open('GET',url);
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xhr.open('GET', url);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.responseType = "blob";
xhr.addEventListener("loadstart",(ev)=>{
xhr.addEventListener("loadstart", (ev) => {
})
xhr.addEventListener("progress",(ev)=>{
xhr.addEventListener("progress", (ev) => {
let progress = Math.round(100.0 * ev.loaded / ev.total);
// alert(progress);
})
xhr.addEventListener("load",(ev)=>{
xhr.addEventListener("load", (ev) => {
const blob = xhr.response;
if(blob){
if (blob) {
let path = this.file.externalDataDirectory;
this.file.writeFile(path,fileName,blob,{ //写入文件
replace:true
this.file.writeFile(path, fileName, blob, { //写入文件
replace: true
}).then(
()=>{
() => {
this.fileOpener.open(path + fileName, fileType).catch((err) => {
this.alert('打开文件失败!'+err);
this.alert('打开文件失败!' + err);
})
}).catch((err)=>{
this.toast("下载文件失败!")
}).catch((err) => {
this.toast("下载文件失败!")
})
}
});
......@@ -220,16 +220,30 @@ export class CommonService{
return mimeType;
}
/**
* 对象数组去重
*/
uniArr(arr,key) {
let temp = [], result = [];
arr.map((item) => {
if (!temp[item[key]]) {
result.push(item);
temp[item[key]] = true;
}
});
return result;
}
/**
* vConsole 移动端调试工具
* 定义全局的log日志 开发模式 打印log 生产环境 关闭
* @param message 信息
*/
log(message){
log(message) {
// if(AppGlobal.domain === ""){ //开发环境时
console.log(message);
console.log(message);
// }
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment