Quellcode durchsuchen

联系人列表

xiaohaizhao vor 2 Jahren
Ursprung
Commit
1713454413

+ 3 - 5
app.json

@@ -35,10 +35,6 @@
         {
             "root": "packageA",
             "pages": [
-                "contacts/index",
-                "contacts/list",
-                "contacts/details",
-                "contacts/edit",
                 "forecast/index",
                 "forecast/detail",
                 "forecast/record",
@@ -158,7 +154,9 @@
                 "invoiceforecast/modules/orderForm/select",
                 "setclient/contacts",
                 "work/synchronization",
-                "select/clue/select"
+                "select/clue/select",
+                "contacts/index",
+                "contacts/group"
             ]
         }
     ],

+ 5 - 1
components/Yl_Filtrate1/index.js

@@ -50,6 +50,10 @@ Component({
         isReset: {
             type: Boolean,
             value: true
+        },
+        minus: {
+            type: [Number, String],
+            value: 80
         }
     },
     data: {
@@ -61,7 +65,7 @@ Component({
     lifetimes: {
         ready() {
             getHeight('.head', this).then(res => this.setData({
-                listHeight: res - 80
+                listHeight: res - this.data.minus
             }));
         }
     },

+ 0 - 152
packageA/contacts/details.js

@@ -1,152 +0,0 @@
-const _Http = getApp().globalData.http;
-Page({
-    data: {
-        contacts: [],
-        form1: [],
-        form2: [],
-        show: false,
-        actions: [{
-            name: "呼叫"
-        }, {
-            name: "复制"
-        }]
-    },
-    onLoad(options) {
-        this.handleData(JSON.parse(options.item))
-    },
-    //更新标签
-    getTags() {
-        this.selectComponent("#Tags").getTags();
-    },
-    handleData(item) {
-        this.setData({
-            contacts: item,
-            form1: [{
-                label: "性别",
-                content: item.sex
-            }, {
-                label: "生日",
-                content: item.birthday
-            }, {
-                label: "家庭住址",
-                content: item.homeaddress
-            }, {
-                label: "微信",
-                content: item.wechatnum
-            }, {
-                label: "邮箱",
-                content: item.email
-            }, {
-                label: "传真",
-                content: item.fax
-            }, {
-                label: "单位",
-                content: item.company
-            }, {
-                label: "部门",
-                content: item.depname
-            }, {
-                label: "职位",
-                content: item.position
-            }, {
-                label: "群组",
-                content: item.groupname
-            }, {
-                label: "关联项目",
-                content: item.projectname
-            }, {
-                label: "备注",
-                content: item.remarks
-            }],
-            form2: [{
-                label: "创建人",
-                content: item.createby
-            }, {
-                label: "创建时间",
-                content: item.createdate
-            }]
-        })
-        this.getTags()
-    },
-    changeShow() {
-        this.setData({
-            show: !this.data.show
-        })
-    },
-    /* 处理选择 */
-    handleSelect(e) {
-        let phone = this.data.contacts.phonenumber;
-        if (e.detail.name == '复制') {
-            wx.setClipboardData({
-                data: phone
-            });
-        } else {
-            wx.makePhoneCall({
-                phoneNumber: phone,
-            })
-        };
-        this.changeShow()
-    },
-    /* 拷贝内容 */
-    copyContents(e) {
-        const {
-            data
-        } = e.currentTarget.dataset;
-        if (data) wx.setClipboardData({
-            data,
-        });
-    },
-    /* 去编辑 */
-    toEdit() {
-        let data = JSON.stringify(this.data.contacts);
-        wx.navigateTo({
-            url: '../contacts/edit?data=' + data,
-        })
-    },
-    /* 删除 */
-    deleteData() {
-        const that = this,
-            contacts = this.data.contacts;
-        console.log(contacts.groupname == '项目联系人' ? '20221111130904' : contacts.groupname == '客户联系人' ? "20221018145502" : "20220831164703")
-        wx.showModal({
-            title: "提示",
-            content: `是否确认删除${contacts.name}`,
-            success({
-                confirm
-            }) {
-                if (confirm) _Http.basic({
-                    "id": contacts.groupname == '项目联系人' ? '20221111130904' : contacts.groupname == '客户联系人' ? "20221018145502" : "20220831164703",
-                    "version": 1,
-                    "content": {
-                        "sys_phonebookid": contacts.sys_phonebookid,
-                        "sa_project_contactsids": [contacts.sa_project_contactsid],
-                        "contactsid": contacts.contactsid,
-                        "sys_enterpriseid": contacts.sys_enterpriseid
-                    }
-                }).then(res => {
-                    console.log("删除", res)
-                    if (res.msg != '成功') return wx.showToast({
-                        title: res.data,
-                        icon: "none"
-                    })
-                    getCurrentPages().forEach(v => {
-                        if (v.route === 'packageA/contacts/index') {
-                            v.getGroup();
-                        } else if (v.route === 'packageA/contacts/list') {
-                            v.getGroup();
-                        }
-                    });
-                    wx.showToast({
-                        title: '删除成功',
-                        icon: 'none'
-                    })
-                    setTimeout(() => {
-                        wx.navigateBack({
-                            delta: 0,
-                        })
-                    }, 500);
-                })
-            }
-        })
-    }
-})

+ 0 - 4
packageA/contacts/details.json

@@ -1,4 +0,0 @@
-{
-    "usingComponents": {},
-    "navigationBarTitleText": "联系人详情"
-}

+ 0 - 114
packageA/contacts/details.scss

@@ -1,114 +0,0 @@
-.contacts {
-    width: 100vw;
-    background-color: #ffffff;
-    box-sizing: border-box;
-    margin-bottom: 20rpx;
-    padding: 20rpx 30rpx;
-    display: flex;
-
-    .portrait {
-        display: flex;
-        align-items: center;
-        justify-content: center;
-        width: 96rpx;
-        height: 96rpx;
-        background: #3874F6;
-        border-radius: 50%;
-        font-size: 28rpx;
-        font-family: PingFang SC-Regular, PingFang SC;
-        color: #FFFFFF;
-        margin-right: 20rpx;
-        flex-shrink: 0;
-    }
-
-    .content {
-        .title {
-            font-size: 30rpx;
-            font-family: PingFang SC-Regular, PingFang SC;
-            color: #333333;
-        }
-
-        .tag {
-            margin-top: 16rpx;
-        }
-    }
-}
-
-
-.box {
-    margin-bottom: 20rpx;
-    background-color: #ffffff;
-
-    .row {
-        width: 100vw;
-        box-sizing: border-box;
-        padding-left: 30rpx;
-
-        .cell {
-            display: flex;
-            justify-content: space-between;
-            width: 100%;
-            padding: 30rpx 30rpx 28rpx 0;
-            border-bottom: 2rpx solid #DDDDDD;
-            box-sizing: border-box;
-
-            .label {
-                width: 200rpx;
-                font-size: 28rpx;
-                font-family: PingFang SC-Regular, PingFang SC;
-                color: #000000;
-                flex-shrink: 0;
-            }
-
-            .content {
-                font-size: 28rpx;
-                font-family: PingFang SC-Regular, PingFang SC;
-                color: #333333;
-            }
-        }
-    }
-
-    .row:last-child {
-        .cell {
-            padding-bottom: 30rpx;
-            border-bottom: none;
-        }
-    }
-}
-
-/* 底部 */
-.footer {
-    position: fixed;
-    display: flex;
-    justify-content: space-between;
-    width: 100vw;
-    padding: 20rpx 30rpx;
-    bottom: 0;
-    box-sizing: border-box;
-    background-color: #ffffff;
-    z-index: 999;
-
-    .delete {
-        width: 200rpx;
-        height: 90rpx;
-        background: #FFFFFF;
-        border-radius: 100rpx;
-        border: 1px solid #CCCCCC;
-
-        font-size: 28rpx;
-        font-family: PingFang SC-Bold, PingFang SC;
-        font-weight: bold;
-        color: #999999;
-    }
-
-    .edit {
-        width: 460rpx;
-        height: 90rpx;
-        background: #3874F6;
-        border-radius: 100rpx;
-        font-size: 28rpx;
-        font-family: PingFang SC-Bold, PingFang SC;
-        font-weight: bold;
-        color: #FFFFFF;
-    }
-}

+ 0 - 58
packageA/contacts/details.wxml

@@ -1,58 +0,0 @@
-<!-- <view class="contacts">
-    <view class="circle">{{contacts.name[0]}}</view>
-    <view class="text">
-        <text style="margin-right: 10rpx;">{{contacts.name}}</text>
-    </view>
-</view> -->
-
-<view class="contacts">
-    <view class="portrait">
-        {{contacts.name[0]}}
-    </view>
-    <view class="content">
-        <view class="title">
-            {{contacts.name}}
-        </view>
-        <view class="tag">
-            <Yl-tags wx:if="{{contacts.groupname=='客户联系人'}}" id="Tags" add ownertable='plm_unit' ownerid='{{contacts.contactsid}}' />
-            <Yl-tags wx:elif="{{contacts.groupname=='项目联系人'}}" id="Tags" add ownertable='sa_project_contacts' ownerid='{{contacts.contactsid}}' />
-            <Yl-tags wx:else id="Tags" add ownertable='sys_phonebook' ownerid='{{contacts.sys_phonebookid}}' />
-        </view>
-    </view>
-</view>
-
-<!-- 点击手机号操作 -->
-<van-action-sheet show="{{ show }}" actions="{{ actions }}" z-index='9999' cancel-text="取消" bind:click-overlay='changeShow' bind:select='handleSelect' bind:cancel='changeShow' />
-<view class="box">
-    <navigator url="#" class="row" bindtap="changeShow">
-        <view class="cell">
-            <view class="label">联系方式</view>
-            <view class="content">{{contacts.phonenumber}}
-                <text class="iconfont icon-shujubodadianhua1" style="color: #FA8C16;margin-left: 20rpx;"></text>
-            </view>
-        </view>
-    </navigator>
-    <navigator url="#" class="row" wx:for="{{form1}}" wx:key="label" bindtap="copyContents" data-data="{{item.content}}">
-        <view class="cell">
-            <view class="label">{{item.label}}</view>
-            <view class="content">{{item.content||'--'}}</view>
-        </view>
-    </navigator>
-</view>
-<view style="background-color: #F4F5F7; padding: 0rpx 30rpx 20rpx; font-weight: 600;font-size: 28rpx;">
-    系统信息
-</view>
-<view class="box">
-    <navigator url="#" class="row" wx:for="{{form2}}" wx:key="label" bindtap="copyContents" data-data="{{item.content}}">
-        <view class="cell">
-            <view class="label">{{item.label}}</view>
-            <view class="content">{{item.content||'--'}}</view>
-        </view>
-    </navigator>
-</view>
-<view class="footer">
-    <van-button custom-class='delete' bindtap="deleteData">删除</van-button>
-    <van-button custom-class='edit' bindtap="toEdit">编辑</van-button>
-</view>
-<view style="height: 140rpx;" />
-<wxs src='../../utils/wxmlQueryPer.wxs' module="per" />

+ 0 - 365
packageA/contacts/edit.js

@@ -1,365 +0,0 @@
-const _Http = getApp().globalData.http;
-Page({
-    data: {
-        isEdit: false,
-        form: [{
-            label: "姓名",
-            error: false,
-            errMsg: "",
-            type: "text",
-            value: "",
-            placeholder: "请填写",
-            valueName: "name", //绑定的字段名称
-            required: true, //必填
-        }, {
-            label: "联系方式",
-            error: false,
-            errMsg: "",
-            hint: "",
-            type: "radio",
-            value: "0",
-            radioList: [{
-                id: '0',
-                name: '手机号'
-            }, {
-                id: '1',
-                name: '座机电话'
-            }],
-            valueName: "isTelephone", //绑定的字段名称
-            required: true, //必填
-            interrupt: true,
-            checking: `true`,
-            phonenumber: "",
-            telephone: ["", ""]
-        }, {
-            label: "手机号",
-            error: false,
-            errMsg: "",
-            type: "number",
-            value: "",
-            placeholder: "联系人手机号码",
-            valueName: "phonenumber",
-            required: true,
-            checking: "phone"
-        }, {
-            label: "微信",
-            error: false,
-            errMsg: "",
-            type: "text",
-            value: "",
-            placeholder: "请填写",
-            valueName: "wechatnum", //绑定的字段名称
-            required: false, //必填
-        }, {
-            label: "邮箱",
-            error: false,
-            errMsg: "",
-            type: "textarea",
-            value: "",
-            placeholder: "请填写",
-            valueName: "email",
-            required: false,
-            checking: "mail"
-        }, {
-            label: "传真",
-            error: false,
-            errMsg: "",
-            type: "text",
-            value: "",
-            placeholder: "请填写",
-            valueName: "fax",
-            required: false, //必填
-        }, {
-            label: "单位",
-            error: false,
-            errMsg: "",
-            type: "text",
-            value: "",
-            placeholder: "请填写",
-            valueName: "company",
-            required: false, //必填
-        }, {
-            label: "部门",
-            error: false,
-            errMsg: "",
-            type: "text",
-            value: "",
-            placeholder: "请填写",
-            valueName: "depname",
-            required: false, //必填
-        }, {
-            label: "职位",
-            error: false,
-            errMsg: "",
-            type: "text",
-            value: "",
-            placeholder: "请填写",
-            valueName: "position",
-            required: false, //必填
-        }, {
-            label: "性别",
-            error: false,
-            errMsg: "",
-            type: "sex",
-            value: "男",
-            placeholder: "联系人性别",
-            valueName: "sex",
-            required: false,
-            checking: "base"
-        }, {
-            label: "生日",
-            error: false,
-            errMsg: "",
-            type: "date",
-            value: "",
-            placeholder: "联系人生日",
-            valueName: "birthday",
-            required: false
-        }, {
-            label: "家庭住址",
-            error: false,
-            errMsg: "",
-            type: "text",
-            value: "",
-            placeholder: "请填写",
-            valueName: "homeaddress",
-            required: false, //必填
-        }, {
-            label: "备注",
-            error: false,
-            errMsg: "",
-            type: "text",
-            value: "",
-            placeholder: "请填写",
-            valueName: "remarks",
-            required: false,
-        }],
-        content: {
-            sys_phonebookid: 0
-        },
-        disabled: true, //按钮禁用
-        groupname: null,
-        loading: false
-    },
-    onLoad(options) {
-        wx.setNavigationBarTitle({
-            title: '添加联系人'
-        })
-        if (options.group) {
-            const group = JSON.parse(options.group);
-            this.setData({
-                groupname: group.groupname
-            })
-            this.getGroup();
-        } else if (options.data) {
-            wx.setNavigationBarTitle({
-                title: '修改联系人'
-            })
-            let item = JSON.parse(options.data),
-                disabled = false,
-                arr = item.phonenumber.split("-");
-            item.isTelephone = arr.length == 2 ? "1" : "0";
-            this.setData({
-                form: this.data.form.map(v => {
-                    if (v.valueName == 'phonenumber') {
-                        v = arr.length == 2 ? {
-                            label: "电话",
-                            error: false,
-                            errMsg: "",
-                            type: "telephone",
-                            value: arr,
-                            placeholder: "联系人手机号码",
-                            valueName: "telephone",
-                            required: true,
-                            checking: "telephone"
-                        } : {
-                            label: "手机号",
-                            error: false,
-                            errMsg: "",
-                            type: "number",
-                            value: arr[0],
-                            placeholder: "联系人手机号码",
-                            valueName: "phonenumber",
-                            required: true,
-                            checking: "phone"
-                        }
-                    } else {
-                        v.value = Object.hasOwn(item, v.valueName) ? item[v.valueName] : v.value;
-                    }
-                    return v
-                }),
-                disabled
-            });
-            this.data.content = item;
-            this.setData({
-                groupname: item.groupname,
-                disabled: false,
-                isEdit: true
-            });
-            if (item.groupname != '客户联系人' && item.groupname != '项目联系人') this.getGroup();
-        } else {
-            this.getGroup();
-        }
-    },
-    /* 提交表单 */
-    submit() {
-        let content = Object.assign(this.data.content, this.selectComponent("#Form").submit());
-        if (content.telephone) {
-            content.phonenumber = content.telephone.join("-");
-            delete(content.telephone)
-        }
-        try {
-            if (content.groupname != '客户联系人' && content.groupname != '项目联系人') content.sys_phonebookgroupid = this.data.form.find(v => v.label == '群组').range.find(v => v.groupname == content.groupname).sys_phonebookgroupid
-        } catch (error) {
-            wx.showToast({
-                title: '群组保存失败',
-                icon: "none"
-            })
-            content.sys_phonebookgroupid = 0;
-        }
-        this.setData({
-            loading: true
-        })
-        _Http.basic({
-            "id": content.groupname == '客户联系人' || content.groupname == '项目联系人' ? '20221018141802' : "20220831164503",
-            "version": 1,
-            content
-        }).then(res => {
-            console.log("新建联系人", res)
-            this.setData({
-                loading: false
-            })
-            if (res.msg != '成功') return wx.showToast({
-                title: res.data,
-                icon: "none"
-            })
-            getCurrentPages().forEach(v => {
-                if (v.route === 'packageA/contacts/index') {
-                    v.getGroup();
-                } else if (v.route === 'packageA/contacts/list') {
-                    v.getGroup();
-                } else if (v.route === 'packageA/contacts/details') {
-                    v.handleData(res.data);
-                }
-            });
-            let isEdit = this.data.isEdit;
-            wx.showToast({
-                title: isEdit ? '保存成功' : '添加成功',
-                mask: true
-            });
-            this.setData({
-                disabled: true,
-            })
-            setTimeout(() => {
-                if (isEdit) {
-                    wx.navigateBack({
-                        delta: 0
-                    })
-                } else {
-                    wx.redirectTo({
-                        url: '/packageA/contacts/details?item=' + JSON.stringify(res.data),
-                    })
-                }
-            }, 700);
-        })
-    },
-    /* 打断 */
-    interrupt({
-        detail
-    }) {
-        let {
-            data,
-            form
-        } = detail;
-        if (data.label == '联系方式') {
-            if (data.value == 0) {
-                data.telephone = form[2].value;
-                form[2] = {
-                    label: "手机号",
-                    error: false,
-                    errMsg: "",
-                    type: "number",
-                    value: data.phonenumber,
-                    placeholder: "联系人手机号码",
-                    valueName: "phonenumber",
-                    required: true,
-                    checking: "phone"
-                }
-            } else {
-                data.phonenumber = form[2].value;
-                form[2] = {
-                    label: "电话",
-                    error: false,
-                    errMsg: "",
-                    type: "telephone",
-                    value: data.telephone,
-                    placeholder: "联系人手机号码",
-                    valueName: "telephone",
-                    required: true,
-                    checking: "telephone"
-                }
-            };
-            this.setData({
-                form
-            })
-        } else if (data.label == '群组') {
-            this.data.content.sys_phonebookgroupid = data.range.find(v => v.groupname == data.value).sys_phonebookgroupid;
-        }
-    },
-    /* 监听表单必填项 */
-    onConfirm({
-        detail
-    }) {
-        this.setData({
-            disabled: detail
-        })
-    },
-    /* 获取分组 */
-    getGroup() {
-        _Http.basic({
-            "id": "20220831164603",
-            "version": 1,
-            "content": {
-                "nocache": true,
-                "where": {
-                    "condition": ""
-                }
-            }
-        }).then(res => {
-            console.log('获取群组', res)
-            if (res.msg != '成功') return wx.showToast({
-                title: res.msg,
-                icon: "none"
-            })
-
-            const range = res.data.filter(v => v.groupname != '客户联系人' && v.groupname != '项目联系人').map(v => {
-                    delete(v.count)
-                    delete(v.phonebook)
-                    delete(v.rowindex)
-                    return v
-                }),
-                groupname = this.data.groupname || '默认群组';
-
-            let form = this.data.form;
-
-            form.splice(form.length - 1, 0, {
-                label: "群组",
-                error: false,
-                errMsg: "",
-                type: "selector",
-                range,
-                rangeKey: "groupname",
-                rangeIndex: range.findIndex(v => v.groupname == groupname),
-                value: groupname,
-                placeholder: "选择群组",
-                valueName: "groupname",
-                required: false, //必填
-                interrupt: true
-            })
-
-            this.setData({
-                form
-            })
-        });
-    }
-})

+ 0 - 8
packageA/contacts/edit.json

@@ -1,8 +0,0 @@
-{
-    "usingComponents": {
-        "My_form": "/components/My_form/index",
-      
-        "van-radio": "@vant/weapp/radio/index",
-        "van-radio-group": "@vant/weapp/radio-group/index"
-    }
-}

+ 0 - 54
packageA/contacts/edit.scss

@@ -1,54 +0,0 @@
-.checkboxes {
-    justify-content: flex-end;
-    font-size: 0 !important;
-}
-
-.popup-title {
-    height: 80rpx;
-    line-height: 80rpx;
-    text-align: center;
-    font-weight: 700;
-    font-size: 30rpx;
-}
-
-.popup-button {
-    width: 100%;
-    display: flex;
-    justify-content: space-around;
-    box-sizing: border-box;
-    padding: 0 80rpx;
-    margin-top: 30rpx;
-
-    .but {
-        width: 180rpx;
-        height: 80rpx;
-        border-radius: 8rpx;
-    }
-}
-
-.tag {
-    height: 40rpx;
-    padding: 0 15rpx;
-    margin-right: 10rpx;
-    border-radius: 8rpx;
-}
-
-.footer {
-    text-align: center;
-    position: fixed;
-    bottom: 0;
-    width: 100vw;
-    padding: 20rpx 0;
-    background-color: #ffffff;
-    z-index: 99;
-
-    .button {
-        width: 500rpx;
-        height: 90rpx;
-        border-radius: 100rpx;
-        font-size: 28rpx;
-        font-family: PingFang SC-Bold, PingFang SC;
-        font-weight: bold;
-        color: #FFFFFF;
-    }
-}

+ 0 - 8
packageA/contacts/edit.wxml

@@ -1,8 +0,0 @@
-<Yl_field id='Form' form='{{form}}' bind:onConfirm='onConfirm' bind:interrupt='interrupt' />
-<view style="height: 130rpx;" />
-<view class="footer">
-    <van-button wx:if="{{isEdit}}" custom-class='button' disabled='{{disabled}}' loading='{{loading}}' loading-text="保存中..." color="#FA8C16" bindclick="submit">保存</van-button>
-    <van-button wx:else custom-class='button' loading='{{loading}}' loading-text="添加中..." disabled='{{disabled}}' color="#3874F6" bindclick="submit">确定添加</van-button>
-</view>
-
-<wxs src='../../utils/wxmlQueryPer.wxs' module="per" />

+ 18 - 0
packageA/contacts/group.js

@@ -0,0 +1,18 @@
+Page({
+    data: {
+        groupname: "",
+        sys_phonebookgroupid: 0
+    },
+    onLoad(options) {
+        this.setData({
+            groupname: options.name || "",
+            sys_phonebookgroupid: options.id || 0
+        })
+        wx.setNavigationBarTitle({
+          title: options.name
+        })
+    },
+    onReady() {
+        this.selectComponent("#list").getList(true);
+    },
+})

+ 6 - 0
packageA/contacts/group.json

@@ -0,0 +1,6 @@
+{
+    "usingComponents": {
+        "list": "./modules/list/index"
+    },
+    "navigationBarTitleText": "群组"
+}

+ 1 - 0
packageA/contacts/group.scss

@@ -0,0 +1 @@
+/* packageA/contacts/group.wxss */

+ 1 - 0
packageA/contacts/group.wxml

@@ -0,0 +1 @@
+<list id='list' groupname="{{groupname}}" sys_phonebookgroupid="{{sys_phonebookgroupid}}" />

+ 137 - 159
packageA/contacts/index.js

@@ -1,83 +1,34 @@
-// packageA/contacts/index.js
-let dowmCount = null,
-    _Http = getApp().globalData.http,
-    dMark = require('../../utils/deleteMark')
+const _Http = getApp().globalData.http;
+import Dialog from '@vant/weapp/dialog/dialog';
 Page({
-
-    /**
-     * 页面的初始数据
-     */
     data: {
-        systemGroup: [], //系统分组
-        myGroup: [], //自定义分组
-        groupName: '',
-        sys_phonebookgroupid: 0,
-        dialogShow: false
+        active: "联系人",
+        allGroup: [],
+        defaultGroup: [],
+        myGroup: [],
+        updateGroup: {
+            "sys_phonebookgroupid": 0,
+            "groupname": ""
+        }
     },
     onLoad(options) {
-        this.getGroup();
-    },
-    toAddContacts() {
-        wx.navigateTo({
-            url: './edit',
-        })
-    },
-    /* 获取分组 */
-    getGroup(condition = '') {
-        return _Http.basic({
-            "id": "20220831164603",
-            "version": 1,
-            "content": {
-                "nocache": true,
-                "where": {
-                    condition
-                }
-            }
-        }).then(res => {
-            if (res.msg != '成功') return wx.showToast({
-                title: res.msg,
-                icon: "none"
-            })
-            console.log("123123", res.data)
-            if (condition != '') return res.data;
-
-            res.data = res.data.map(v => {
-                delete(v.phonebook)
-                return v
-            })
-            let systemGroup = [],
-                myGroup = [];
-            res.data.forEach(v => ['默认群组', '客户联系人', '项目联系人'].includes(v.groupname) ? systemGroup.push(v) : myGroup.push(v));
-            this.setData({
-                systemGroup,
-                myGroup
-            })
-        })
+        this.getList(true);
+        this.getGroup(true);
     },
-    toCheckList(e) {
-        const {
-            groupname
-        } = e.currentTarget.dataset;
-        wx.navigateTo({
-            url: './list?groupname=' + groupname,
-        })
+    onInput(e) {
+        this.data.updateGroup.groupname = e.detail.value;
     },
-    /* 删除自定义分组 */
     deleteGroup(e) {
-        const {
+        let {
             item
         } = e.currentTarget.dataset,
             that = this;
-        if (item.count) return wx.showToast({
-            title: '当前状态不可删除',
-            icon: "none"
-        });
         wx.showModal({
-            title: "提示",
-            content: `是否确认删除 "${item.groupname}"`,
-            success({
+            title: '提示',
+            content: `是否确定删除“${item.groupname}”`,
+            complete: ({
                 confirm
-            }) {
+            }) => {
                 if (confirm) _Http.basic({
                     "id": "20220831164403",
                     "version": 1,
@@ -85,114 +36,141 @@ Page({
                         "sys_phonebookgroupid": item.sys_phonebookgroupid
                     }
                 }).then(res => {
-                    if (res.msg != '成功') return wx.showToast({
-                        title: res.msg,
+                    console.log("删除群组", res)
+                    wx.showToast({
+                        title: res.msg != '成功' ? res.msg : '删除成功',
                         icon: "none"
                     })
-                    const myGroup = that.data.myGroup.filter(v => v.sys_phonebookgroupid != item.sys_phonebookgroupid);
-                    that.setData({
-                        myGroup
-                    })
-                    wx.showToast({
-                        title: '删除成功',
+                    if (res.msg == '成功') that.setData({
+                        myGroup: that.data.myGroup.filter(v => v.sys_phonebookgroupid != item.sys_phonebookgroupid)
                     })
                 })
             }
         })
 
     },
-    /* 开始搜索 */
-    startSearch({
-        detail
-    }) {
-        this.getGroup(detail.trim()).then(res => {
-            let item = {
-                groupname: "搜索",
-                phonebook: [],
-                sys_phonebookgroupid: 0
-            };
-            res.forEach(v => {
-                if (v.phonebook.length != 0) {
-                    item.phonebook = item.phonebook.concat(v.phonebook)
-                }
-            });
-            if (item.phonebook.length == 0) {
-                wx.showToast({
-                    title: `未找到与'${detail.trim()}'有关内容`,
-                    icon: "none"
-                })
-            } else {
-                wx.navigateTo({
-                    url: './list?item=' + JSON.stringify(item),
-                })
-            }
+    editGroup(e) {
+        this.setData({
+            updateGroup: e.currentTarget.dataset.item
         })
+        this.showDialog();
     },
-    onClose(event) {
-        const {
-            instance
-        } = event.detail;
-        instance.close();
+    insertGroup() {
+        this.setData({
+            updateGroup: {
+                "sys_phonebookgroupid": 0,
+                "groupname": ""
+            }
+        });
+        this.showDialog();
     },
-    openDialog(e) {
-        console.log(e)
-        if (e.currentTarget.dataset.item) {
-            this.setData({
-                dialogShow: true,
-                groupName: e.currentTarget.dataset.item.groupname,
-                sys_phonebookgroupid: e.currentTarget.dataset.item.sys_phonebookgroupid
-            })
-        } else {
-            this.setData({
-                dialogShow: true,
-                groupName: "",
-                sys_phonebookgroupid: 0
-            })
-        }
+    showDialog() {
+        Dialog.confirm({
+            beforeClose: (action) =>
+                new Promise((resolve) => {
+                    if (action === 'confirm') {
+                        let content = this.data.updateGroup;
+                        if (content.groupname == "") {
+                            wx.showToast({
+                                title: '群组名称不可为空',
+                                icon: "none"
+                            })
+                            resolve(false);
+                        } else {
+                            _Http.basic({
+                                "id": "20220831164203",
+                                "version": 1,
+                                content
+                            }).then(res => {
+                                let operate = content.sys_phonebookgroupid == 0 ? "新建" : '编辑';
+                                console.log(operate + '群组', res)
+                                if (res.msg != '成功') {
+                                    wx.showToast({
+                                        title: res.msg,
+                                        icon: "none"
+                                    })
+                                    resolve(false);
+                                } else {
+                                    this.getGroup(true).then(() => {
+                                        resolve(true)
+                                        wx.showToast({
+                                            title: operate + '成功',
+                                            icon: "none"
+                                        })
+                                    })
+                                }
+                            })
+                        }
+                    } else {
+                        resolve(true);
+                    }
+                })
+        });
     },
-    inputName({
-        detail
-    }) {
+    onChange(e) {
+        const active = e.detail.name;
         this.setData({
-            groupName: dMark.queryStr(detail.value)
-        })
+            active
+        });
+        this.updatedb(active == '群组' && this.data.defaultGroup.length == 0)
     },
-    handleAddGroup() {
-        let name = this.data.groupName.trim()
-        if (name.length == 0) return wx.showToast({
-            title: '群组名称不可为空',
-            icon: "none"
-        })
-        _Http.basic({
-            "id": "20220831164203",
-            "version": 1,
-            "content": {
-                "sys_phonebookgroupid": this.data.sys_phonebookgroupid,
-                "groupname": name
-            }
-        }).then(res => {
-            if (res.msg != '成功') {
-                wx.showToast({
-                    title: res.data,
+    async updatedb(init = false) {
+        if (init.detail != undefined) init = init.detail;
+        await this[this.data.active == '联系人' ? 'getList' : 'getGroup'](init)
+        this.selectComponent('#ListBox').RefreshToComplete();
+    },
+    getList(init) {
+        return this.selectComponent("#list").getList(init);
+    },
+    getGroup(init) {
+        return new Promise((resolve) => {
+            if (!init) return resolve();
+            _Http.basic({
+                "id": "20220831164303",
+                "content": {
+                    nocache: true,
+                    type: 1,
+                    pageSize: 9999,
+                    where: {
+                        condition: ""
+                    }
+                }
+            }).then(res => {
+                resolve();
+                console.log("群组", res)
+                if (res.msg != '成功') return wx.showToast({
+                    title: res.msg,
                     icon: "none"
+                });
+                let myGroup = [],
+                    defaultGroup = [];
+                myGroup = res.data.filter(v => {
+                    if (v.sys_phonebookgroupid == 0) defaultGroup.push(v)
+                    return v.sys_phonebookgroupid
                 })
-            };
-            this.getGroup();
-            wx.showToast({
-                title: this.data.sys_phonebookgroupid == 0 ? '添加成功' : '修改成功',
-            })
-            this.setData({
-                groupName: "",
-                sys_phonebookgroupid: 0
+                this.setData({
+                    defaultGroup,
+                    myGroup
+                })
+                let page = this.selectComponent("#list");
+                if (page) {
+                    page.data.filtratelist.unshift({
+                        label: "群组",
+                        index: null,
+                        showName: "groupname", //显示字段
+                        valueKey: "group", //传参 代表选着字段 不传参返回整个选择对象
+                        value: "", //选中值
+                        list: res.data
+                    });
+                    page.setData({
+                        filtratelist: page.data.filtratelist
+                    })
+                }
             })
         })
     },
-    onCancel() {
-        this.setData({
-            dialogShow: false
-        })
+    onReady() {
+        this.selectComponent("#ListBox").setHeight(".linear", this);
     },
-    onShareAppMessage() {
-
-    }
-})
+})
+//                    ,

+ 3 - 3
packageA/contacts/index.json

@@ -1,8 +1,8 @@
 {
     "usingComponents": {
-        "add": "./modules/add/index",
         "van-swipe-cell": "@vant/weapp/swipe-cell/index",
-        "van-dialog": "@vant/weapp/dialog/index"
+        "van-dialog": "@vant/weapp/dialog/index",
+        "list": "./modules/list/index"
     },
-    "navigationBarTitleText": "联系人"
+    "navigationBarTitleText": "通讯录"
 }

+ 112 - 67
packageA/contacts/index.scss

@@ -1,92 +1,137 @@
-/* 组 */
-.group-box {
+page {
+    height: 100vh !important;
+    overflow: hidden !important;
+}
+
+.linear {
+    width: 750rpx;
+    height: 2rpx;
+    background: #DDDDDD;
+}
+
+.insert-group {
     width: 100vw;
-    background-color: #fff;
-    margin-top: 20rpx;
-    padding-bottom: 15rpx;
+    height: 100rpx;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 0 30rpx;
+    background: #FFFFFF;
+    overflow: hidden;
+    box-sizing: border-box;
 
-    .icon {
+    .title {
         display: flex;
         align-items: center;
-        justify-content: center;
 
-        text {
-            color: #fff;
-            font-size: 48rpx;
+        .iconfont {
+            color: #52C41A;
+            font-size: 44rpx;
         }
-    }
 
-    .title {
-        height: 42rpx;
-        font-size: 30rpx;
-        font-family: PingFang SC-Bold, PingFang SC;
-        font-weight: bold;
-        color: #000000;
-        padding: 30rpx;
-        padding-bottom: 15rpx;
+        .text {
+            font-size: 28rpx;
+            font-family: PingFang SC, PingFang SC;
+            color: #333333;
+            margin-left: 30rpx;
+        }
     }
+}
 
-    .group {
-        display: flex;
-        width: 100vw;
-        padding: 15rpx 30rpx;
-        box-sizing: border-box;
+.label {
+    font-size: 30rpx;
+    font-weight: bold;
+    color: #333333;
+    padding: 24rpx 30rpx;
+}
+
+.group {
+    display: flex;
+    align-items: center;
+    width: 750rpx;
+    height: 120rpx;
+    padding: 20rpx 30rpx;
+    background: #FFFFFF;
+    box-sizing: border-box;
 
-        >view {
-            height: 84rpx;
+    .icon-box {
+        width: 80rpx;
+        height: 80rpx;
+        border-radius: 16rpx;
+        text-align: center;
+        line-height: 80rpx;
+        flex-shrink: 0;
+        margin-right: 20rpx;
+
+        .iconfont {
+            font-size: 38rpx;
+            color: #fff;
         }
+    }
 
-        .icon {
-            width: 84rpx;
-            border-radius: 16rpx;
-            margin-right: 20rpx;
+    .text-box {
+        width: 0;
+        flex: 1;
+        height: 80rpx;
+
+        .title {
+            line-height: 40rpx;
+            font-size: 28rpx;
+            color: #333333;
         }
 
-        .text {
-            flex: 1;
-
-            .name {
-                height: 40rpx;
-                font-size: 28rpx;
-                font-family: PingFang SC-Regular, PingFang SC;
-                color: #333333;
-            }
-
-            .count {
-                height: 34rpx;
-                font-size: 24rpx;
-                font-family: PingFang SC-Regular, PingFang SC;
-                color: #999999;
-                margin-top: 6rpx;
-            }
+        .count {
+            line-height: 34rpx;
+            font-size: 24rpx;
+            color: #999999;
+            margin-top: 6rpx;
         }
     }
+}
 
-    /* 滑动 */
-    .slide {
-        display: flex;
-        height: 84rpx;
-        width: 240rpx;
-        margin-top: 15rpx;
+.van-swipe-cell__right {
+    display: flex;
+    height: 120rpx;
 
-        .but {
-            border-radius: 0 !important;
-        }
+    navigator {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        width: 120rpx;
+        height: 120rpx;
+        font-size: 28rpx;
+        font-family: PingFang SC, PingFang SC;
+        color: #FFFFFF;
     }
 }
 
+.dialog {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
 
-.group {
-    padding: 40rpx 0 50rpx;
+    .dialog-title {
+        margin-top: 30rpx;
+        font-size: 32rpx;
+        color: #333333;
+    }
 
-    .group-name {
-        width: 70%;
-        height: 50rpx !important;
-        margin: auto;
-        border: 1px solid rgb(116, 114, 114);
-        text-align: center;
-        font-family: PingFang SC-Regular, PingFang SC;
-        font-size: 26rpx;
-        border-radius: 12rpx;
+    .dialog-input {
+        width: 520rpx;
+        height: 90rpx;
+        background: #FAFAFA;
+        border-radius: 8rpx;
+        border: 1rpx solid #CCCCCC;
+        margin-top: 30rpx;
+        margin-bottom: 30rpx;
+        box-sizing: border-box;
+        padding: 0 30rpx;
     }
+}
+
+.tab-active {
+    font-size: 28rpx !important;
+    font-family: PingFang SC, PingFang SC !important;
+    font-weight: bold !important;
+    color: #3874F6 !important;
 }

+ 60 - 39
packageA/contacts/index.wxml

@@ -1,44 +1,65 @@
-<van-search value="{{ condition }}" shape="round" background="var(--primary)" bind:search='startSearch' placeholder="搜索联系人" />
-<add isGroup bind:callBack='toAddContacts' bind:openDialog='openDialog' />
-<!-- 系统分组 -->
-<view class="group-box">
-    <view class="title">系统群组</view>
-    <navigator url="#" class="group" wx:for="{{systemGroup}}" wx:key="groupname" bindtap="toCheckList" data-groupname="{{item.groupname}}">
-        <view class="icon" style="background: #FA8C16;">
-            <text class="iconfont icon-xiaochengxu_qunzu" />
-        </view>
-        <view class="text">
-            <view class="name">{{item.groupname}}</view>
-            <view class="count">已有 {{item.count}} 人</view>
-        </view>
-        <van-icon size='14' color='#D2D2D2' name="arrow" />
-    </navigator>
-</view>
-<!-- 自定义分组 -->
-<view class="group-box">
-    <view class="title">自定义群组</view>
-    <van-swipe-cell id="swipe-cell" async-close right-width="{{ 120 }}" wx:for="{{myGroup}}" wx:key="groupname" bind:close="onClose">
-        <van-cell-group>
-            <navigator url="#" class="group" bindtap="toCheckList" data-groupname="{{item.groupname}}">
-                <view class="icon" style="background: #52C41A;">
-                    <text class="iconfont icon-xiaochengxu_qunzu" />
-                </view>
-                <view class="text">
-                    <view class="name">{{item.groupname}}</view>
-                    <view class="count">已有 {{item.count}} 人</view>
+<van-tabs active="{{ active }}" tab-active-class='tab-active' color='#3874F6' bind:change="onChange">
+    <view class="linear" />
+    <Yl_ListBox id='ListBox' pullDown='{{active == "群组"}}' safety='{{active == "群组"}}' bind:getlist='updatedb'>
+        <van-tab title="联系人" name="联系人">
+            <list id='list' allGroup='{{allGroup}}' />
+        </van-tab>
+        <van-tab title="群组" name="群组">
+            <navigator class="insert-group" url="#" bindtap="insertGroup">
+                <view class="title">
+                    <text class="iconfont icon-tianjiaqunzu" />
+                    <text class="text">添加新群组</text>
                 </view>
-                <van-icon size='14' color='#D2D2D2' name="arrow" />
+                <text class="iconfont icon-a-wodetiaozhuan" />
             </navigator>
-        </van-cell-group>
-        <view slot="right" class="slide">
-            <van-button custom-class='but' color="#FA8C16" bindtap="openDialog" data-item="{{item}}">编辑</van-button>
-            <van-button custom-class='but' color="#FF3B30" bindtap="deleteGroup" data-item="{{item}}">删除</van-button>
+            <block wx:if="{{defaultGroup.length}}">
+                <view class="label">
+                    系统群组
+                </view>
+                <navigator class="group" url="/packageA/contacts/group?id={{item.sys_phonebookgroupid}}&name={{item.groupname}}" wx:for="{{defaultGroup}}" wx:key="rowindex">
+                    <view class="icon-box" style="background-color: #FA8C16;">
+                        <text class="iconfont icon-xiaochengxu_qunzu" />
+                    </view>
+                    <view class="text-box">
+                        <view class="title">{{item.groupname}}</view>
+                        <view class="count">已有{{item.count}}人</view>
+                    </view>
+                    <text class="iconfont icon-a-wodetiaozhuan" />
+                </navigator>
+            </block>
+
+            <block wx:if="{{myGroup.length}}">
+                <view class="label">
+                    自定义群组
+                </view>
+                <van-swipe-cell wx:for="{{myGroup}}" wx:key="rowindex" right-width="{{ 120 }}">
+                    <van-cell-group>
+                        <navigator class="group" url="/packageA/contacts/group?id={{item.sys_phonebookgroupid}}&name={{item.groupname}}">
+                            <view class="icon-box" style="background-color: #52C41A;">
+                                <text class="iconfont icon-xiaochengxu_qunzu" />
+                            </view>
+                            <view class="text-box">
+                                <view class="title line-1">{{item.groupname}}</view>
+                                <view class="count">已有{{item.count}}人</view>
+                            </view>
+                            <text class="iconfont icon-a-wodetiaozhuan" />
+                        </navigator>
+                    </van-cell-group>
+                    <view slot="right" class="van-swipe-cell__right">
+                        <navigator style="background-color: #FA8C16;" data-item="{{item}}" bindtap="editGroup" url="#">编辑</navigator>
+                        <navigator style="background-color: #FF3B30;" data-item="{{item}}" bindtap="deleteGroup" url="#">删除</navigator>
+                    </view>
+                </van-swipe-cell>
+            </block>
+        </van-tab>
+    </Yl_ListBox>
+</van-tabs>
+
+<van-dialog use-slot id="van-dialog" confirm-button-color='#3874F6' cancel-button-color='#999999'>
+    <view class="dialog">
+        <view class="dialog-title">
+            {{updateGroup.sys_phonebookgroupid==0?'新建':'编辑'}}群组
         </view>
-    </van-swipe-cell>
-</view>
-<!-- 添加群组 -->
-<van-dialog use-slot title="添加群组" show="{{ dialogShow }}" showCancelButton confirmButtonText='确定' confirm-button-color='var(--assist)' bind:confirm='handleAddGroup' bind:cancel='onCancel'>
-    <view class="group">
-        <input type="text" placeholder="请输入群组名称" bindinput="inputName" value="{{groupName}}" class="group-name" />
+        <input class="dialog-input" value="{{updateGroup.groupname}}" placeholder="请输入群组名称" type="text" bindinput="onInput" />
     </view>
 </van-dialog>

+ 0 - 117
packageA/contacts/list.js

@@ -1,117 +0,0 @@
-const _Http = getApp().globalData.http;
-
-Page({
-    data: {
-        showFiltrate: false,
-        phonebook: [],
-        group: {},
-        "where": {
-            "condition": "",
-            "groupname": "",
-            "tag": []
-        }
-    },
-    onLoad(options) {
-        if (options.item) {
-            this.randerList(JSON.parse(options.item))
-        } else if (options.groupname) {
-            this.setData({
-                "where.groupname": options.groupname,
-                "group.groupname": options.groupname,
-            })
-            this.getGroup();
-            if (options.groupname != '搜索') {
-                let param = {
-                    "id": 20220929085401,
-                    "content": {
-                        "ownertable": "sys_phonebook",
-                        "ownerid": "0"
-                    }
-                };
-                switch (options.groupname) {
-                    case '客户联系人':
-                        param.content.ownertable = 'plm_unit';
-                        break;
-                    case '项目联系人':
-                        param.content.ownertable = 'sa_project_contacts';
-                        break;
-                    default:
-                        param.content.ownertable = 'sys_phonebook';
-                        break;
-                }
-                _Http.basic(param).then(res => {
-                    console.log("获取标签", res)
-                    this.setData({
-                        filtratelist: [{
-                            label: "标签",
-                            index: null,
-                            type: "checkbox",
-                            showName: "tag", //显示字段
-                            valueKey: "tag", //返回Key
-                            selectKey: "tag", //传参 代表选着字段 不传参返回整个选择对象
-                            value: "", //选中值
-                            list: res.data.systemtag.concat(res.data.option)
-                        }]
-                    })
-                })
-            }
-        }
-    },
-    /* 获取分组 */
-    getGroup() {
-        const where = this.data.where;
-        _Http.basic({
-            "id": "20220831164603",
-            "version": 1,
-            "content": {
-                "nocache": true,
-                where
-            }
-        }).then(res => {
-            console.log("123123", res)
-            if (res.msg != '成功') return wx.showToast({
-                title: "获取失败",
-                icon: "none"
-            })
-            this.randerList(res.data.find(v => v.groupname == where.groupname))
-        })
-    },
-    randerList(item) {
-        console.log(item)
-        wx.setNavigationBarTitle({
-            title: item.groupname,
-        })
-        this.setData({
-            phonebook: item.phonebook,
-            group: {
-                groupname: item.groupname,
-                sys_phonebookgroupid: item.sys_phonebookgroupid
-            },
-            "where.groupname": item.groupname
-        })
-    },
-    toAddContacts() {
-        wx.navigateTo({
-            url: '../contacts/edit?group=' + JSON.stringify(this.data.group),
-        })
-    },
-    onSearch({
-        detail
-    }) {
-        this.data.where.condition = detail;
-        this.getGroup()
-    },
-    onClick() {
-        this.setData({
-            showFiltrate: true
-        })
-    },
-    handleFilter({
-        detail
-    }) {
-        this.setData({
-            "where.tag": detail.tag || ""
-        })
-        this.getGroup()
-    }
-})

+ 0 - 8
packageA/contacts/list.json

@@ -1,8 +0,0 @@
-{
-    "usingComponents": {
-        "add": "./modules/add/index",
-        "list": "./modules/list/index",
-        "van-sticky": "@vant/weapp/sticky/index"
-    },
-    "navigationBarTitleText": "群组"
-}

+ 0 - 11
packageA/contacts/list.scss

@@ -1,11 +0,0 @@
-.search {
-    position: sticky;
-    top: 0;
-    box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
-    background-color: #fff;
-
-    .action {
-        color: #666;
-        padding: 0 10rpx;
-    }
-}

+ 0 - 17
packageA/contacts/list.wxml

@@ -1,17 +0,0 @@
-<block wx:if="{{group.groupname!='搜索'}}">
-    <view class="search">
-        <van-search value="{{ value }}" shape="round" placeholder="请输入搜索关键词" use-action-slot bind:search="onSearch" bind:clear='onSearch'>
-            <navigator class="action" url="#" slot="action" bind:tap="onClick">
-                <text class="iconfont icon-shaixuan" />
-                筛选
-            </navigator>
-        </van-search>
-    </view>
-    <view style="height: 20rpx;" />
-</block>
-<block wx:if="{{group.groupname!='客户联系人' && group.groupname!='项目联系人' && group.groupname!='搜索'}}">
-    <add bind:callBack='toAddContacts' />
-    <view style="height: 20rpx;" />
-</block>
-<list phonebook='{{phonebook}}' />
-<Yl_Filtrate1 show='{{showFiltrate}}' list="{{filtratelist}}" bindhandle="handleFilter" />

+ 0 - 27
packageA/contacts/modules/add/index.js

@@ -1,27 +0,0 @@
-Component({
-    properties: {
-        isGroup: {
-            type:Boolean,
-            value:true
-        },
-        callBack: {
-            type:Function
-        },
-        openDialog: {type:Function}
-    },
-    options: {
-        addGlobalClass: true
-    },
-    data: {
-        show: false,
-        groupName: ''
-    },
-    methods: {
-        addGroup() {
-            this.triggerEvent("openDialog")
-        },
-        handleCallBack() {
-            this.triggerEvent('callBack')
-        }
-    }
-})

+ 0 - 5
packageA/contacts/modules/add/index.json

@@ -1,5 +0,0 @@
-{
-    "component": true,
-    "usingComponents": {
-    }
-}

+ 0 - 31
packageA/contacts/modules/add/index.scss

@@ -1,31 +0,0 @@
-.add {
-    .box {
-        width: 100vw;
-        background-color: #fff;
-        padding-left: 30rpx;
-        box-sizing: border-box;
-
-        .content {
-            display: flex;
-            align-items: center;
-            justify-content: space-between;
-            width: 100%;
-            height: 100rpx;
-            border-bottom: 1px solid #ddd;
-            box-sizing: border-box;
-
-            .text {
-                flex: 1;
-                font-size: 28rpx;
-                font-family: PingFang SC-Regular, PingFang SC;
-                color: #333333;
-            }
-        }
-    }
-
-    .box:last-child {
-        .content {
-            border: none;
-        }
-    }
-}

+ 0 - 20
packageA/contacts/modules/add/index.wxml

@@ -1,20 +0,0 @@
-<view class="add">
-    <navigator class="box" url="#" bindtap="handleCallBack">
-        <view class="content">
-            <view style="height: 48rpx; width: 48rpx; margin-right: 20rpx;">
-                <text class="iconfont icon-tianjialianxiren" style="color:#FA8C16; font-size: 48rpx;"></text>
-            </view>
-            <view class="text">添加联系人{{types}}</view>
-            <van-icon size='14' color='#D2D2D2' style="margin-right: 30rpx;" name="arrow" />
-        </view>
-    </navigator>
-    <navigator wx:if="{{isGroup}}" class="box" url="#" bindtap="addGroup">
-        <view class="content">
-            <view style="height: 48rpx; width: 48rpx; margin-right: 20rpx;">
-                <text class="iconfont icon-tianjiaqunzu" style="color:#52C41A; font-size: 48rpx;"></text>
-            </view>
-            <view class="text">添加群组</view>
-            <van-icon size='14' color='#D2D2D2' style="margin-right: 30rpx;" name="arrow" />
-        </view>
-    </navigator>
-</view>

+ 174 - 9
packageA/contacts/modules/list/index.js

@@ -1,17 +1,182 @@
+const _Http = getApp().globalData.http;
 Component({
     properties: {
-        phonebook: {
-            type: Array
+        groupname: {
+            type: String,
+            value: ""
+        },
+        sys_phonebookgroupid: {
+            type: [String, Number],
+            value: 0
         }
     },
+    data: {
+        list: [],
+        "content": {
+            "type": 1,
+            "pageNumber": 1,
+            "pageTotal": 1,
+            "pageSize": 20,
+            "where": {
+                "condition": ""
+            }
+        },
+        navList: [{
+            label: "我负责的",
+            icon: "icon-webxialaxuanxiangjiantou",
+            color: "",
+            width: "",
+            id: "1"
+        }, {
+            label: "筛选",
+            icon: "icon-shaixuan",
+            color: "",
+            width: "",
+            id: "2"
+        }],
+        classShow: false,
+        classActions: [],
+        filtratelist: [{
+            label: "标签",
+            index: null,
+            type: "checkbox",
+            showName: "tag", //显示字段
+            valueKey: "tag", //返回Key
+            selectKey: "tag", //传参 代表选着字段 不传参返回整个选择对象
+            value: "", //选中值
+            list: [{
+                tag: "关键决策人"
+            }, {
+                tag: "反对者"
+            }, {
+                tag: "支持者"
+            }]
+        }]
+    },
     methods: {
-        toDetails(e) {
-            const {
-                item
-            } = e.currentTarget.dataset;
-            wx.navigateTo({
-                url: './details?item=' + JSON.stringify(item),
-            });
+        getList(init = false) {
+            if (init.detail != undefined) init = init.detail;
+            let content = this.data.content;
+            if (init) {
+                content.pageNumber = 1;
+                content.pageTotal = 1;
+            }
+            if (content.pageNumber > content.pageTotal) return;
+            content.groupname = this.data.groupname;
+            content.sys_phonebookgroupid = this.data.sys_phonebookgroupid;
+            if (this.data.classActions.length == 0) {
+                this.setData({
+                    classActions: wx.getStorageSync('templetList').map(v => {
+                        return {
+                            name: v.templetname,
+                            index: v.templetid
+                        }
+                    }),
+                    'navList[0].label': wx.getStorageSync('templetList')[0].templetname
+                });
+                content.type = wx.getStorageSync('templetList')[0].templetid;
+                this.selectComponent("#ListBox").setHeight(".head", this);
+            }
+            return new Promise((resolve) => {
+                _Http.basic({
+                    "id": 20231220085804,
+                    content
+                }).then(res => {
+                    console.log("通讯录", res)
+                    this.selectComponent('#ListBox').RefreshToComplete();
+                    resolve()
+                    if (res.msg != '成功') return wx.showToast({
+                        title: res.msg,
+                        icon: "none"
+                    })
+                    content.pageTotal = res.pageTotal;
+                    content.pageNumber = res.pageNumber + 1;
+                    this.setData({
+                        content,
+                        list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
+                    })
+                    // this.getTags()
+                })
+            })
+        },
+        /* 获取列表标签 */
+        getTags() {
+            let list = this.data.list,
+                ownerids = list.map(v => v.sys_phonebookid);
+            _Http.basic({
+                "id": 20221018102001,
+                "content": {
+                    nocache: true,
+                    "ownertable": "sys_phonebook",
+                    ownerids
+                }
+            }).then(res => {
+                console.log("获取联系人标签",res)
+                for (let key in res.data) {
+                    let index = list.findIndex(v => v.sys_phonebookid == key);
+                    list[index].tags = res.data[key]
+                };
+                this.setData({
+                    list
+                })
+            })
+        },
+        classSelect({
+            detail
+        }) {
+            if (this.data.content.type == detail.index) return this.classClose();
+            this.setData({
+                "content.type": detail.index,
+                'navList[0].label': detail.name
+            })
+            this.classClose();
+            this.getList(true)
         },
+        classClose() {
+            this.setData({
+                classShow: false
+            })
+        },
+        /* 顶部条件导航回调 */
+        navClick({
+            detail
+        }) {
+            switch (detail.id) {
+                case '1':
+                    this.setData({
+                        classShow: true
+                    })
+                    break;
+                case '2':
+                    this.setData({
+                        'filterShow': true
+                    })
+                    break;
+            }
+        },
+        onSearch({
+            detail
+        }) {
+            this.data.content.where.condition = detail;
+            this.getList(true)
+        },
+        handleFilter({
+            detail
+        }) {
+            console.log("筛选项", detail)
+            detail.condition = this.data.content.where.condition;
+            if (getCurrentPages()[getCurrentPages().length - 1].__route__ == 'packageA/contacts/index') {
+                if (detail.group) {
+                    this.data.groupname = detail.group.groupname;
+                    this.data.sys_phonebookgroupid = detail.group.sys_phonebookgroupid;
+                } else {
+                    this.data.groupname = "";
+                    this.data.sys_phonebookgroupid = 0;
+                }
+                delete(detail.group)
+            }
+            this.data.content.where = detail;
+            this.getList(true);
+        }
     }
 })

+ 65 - 31
packageA/contacts/modules/list/index.scss

@@ -1,37 +1,71 @@
-/* 联系人 */
-.contacts {
-    display: flex;
-    align-items: center;
-    width: 100vw;
-    height: 112rpx;
-    background-color: #ffffff;
-    padding: 0 30rpx;
+.item-box {
+    width: 750rpx;
+    height: 130rpx;
+    background: #FFFFFF;
+    padding: 20rpx 30rpx 0 30rpx;
     box-sizing: border-box;
 
-    .circle {
-        width: 64rpx;
-        height: 64rpx;
-        line-height: 64rpx;
-        text-align: center;
-        border-radius: 50%;
-        background-color: #3874F6;
-        font-size: 26rpx;
-        font-family: PingFang SC-Regular, PingFang SC;
-        color: #FFFFFF;
-        margin-right: 20rpx;
-    }
+    .item {
+        display: flex;
+        align-items: center;
+        width: 100%;
+        height: 100%;
+        box-sizing: border-box;
+        border-bottom: 2rpx solid #ddd;
+        padding-bottom: 20rpx;
+
+        .head-portrait {
+            width: 64rpx;
+            height: 64rpx;
+            line-height: 64rpx;
+            background: #3874F6;
+            border-radius: 50%;
+            text-align: center;
+            font-size: 24rpx;
+            color: #FFFFFF;
+            margin-right: 30rpx;
+        }
+
+        .content {
+            .name {
+                height: 42rpx;
+                line-height: 42rpx;
+                font-size: 30rpx;
+                font-family: PingFang SC, PingFang SC;
+                color: #333333;
+
+                text {
+                    font-size: 24rpx;
+                    font-family: PingFang SC, PingFang SC;
+                    color: #666666;
+                    margin-left: 20rpx;
+                }
+            }
+
+            .tag-box {
+                display: flex;
+                height: 40rpx;
+                margin-top: 8rpx;
+                overflow: hidden;
+
+                .tag {
+                    height: 40rpx;
+                    background: #FAAB16;
+                    border-radius: 20rpx;
+                    padding: 6rpx 10rpx;
+                    box-sizing: border-box;
+                    font-size: 20rpx;
+                    color: #FFFFFF;
+                    margin-right: 10rpx;
+                }
+
+                .tag:last-child {
+                    margin-right: 0;
+                }
+            }
 
-    .text {
-        flex: 1;
-        font-size: 30rpx;
-        font-family: PingFang SC-Regular, PingFang SC;
-        color: #333333;
-
-        .tag {
-            height: 48rpx;
-            padding: 0 15rpx;
-            margin-right: 10rpx;
-            border-radius: 24rpx;
         }
     }
+
+
 }

+ 28 - 8
packageA/contacts/modules/list/index.wxml

@@ -1,8 +1,28 @@
-<navigator class="contacts" url="#" wx:for="{{phonebook}}" wx:key="sys_phonebookid" bindtap="toDetails" data-item="{{item}}">
-    <view class="circle">{{item.name[0]}}</view>
-    <view class="text">
-        <text style="margin-right: 10rpx;">{{item.name}}</text>
-    </view>
-    <van-icon size='14' color='#D2D2D2' name="arrow" />
-</navigator>
-<My_empty wx:if="{{!phonebook.length}}" />
+<Yl_nav search list='{{navList}}' bind:onClick='navClick' bind:onSearch='onSearch' />
+<view class="head" />
+<Yl_ListBox id='ListBox' bind:getlist='getList'>
+    <view style="height: 20rpx;" />
+    <navigator class="item-box" url="#" wx:for="{{list}}" wx:key="sys_phonebookid">
+        <view class="item">
+            <view class="head-portrait">
+                {{item.name[0]||'-'}}
+            </view>
+            <view class="content">
+                <view class="name">
+                    {{item.name}}<text>{{item.phonenumber}}</text>
+                </view>
+
+                <view class="tag-box">
+                    <view class="tag" wx:for="{{item.tag1}}" wx:for-item="it" wx:for-index="i" wx:key="it">{{it}}</view>
+                </view>
+            </view>
+        </view>
+    </navigator>
+    <My_empty wx:if="{{list.length==0}}" />
+</Yl_ListBox>
+
+<van-action-sheet show="{{ classShow }}" actions="{{ classActions }}" cancel-text="取消" bind:click-overlay='classClose' bind:cancel="classClose" bind:select="classSelect" />
+<!-- 筛选条件 -->
+<Yl_Filtrate1 show='{{filterShow}}' list="{{filtratelist}}" dateRange bindhandle="handleFilter" />
+<!-- 浮动按钮 -->
+<Yl_FloatingButton bindtap="toAdd" />

+ 7 - 0
project.private.config.json

@@ -41,6 +41,13 @@
                     "query": "id=202",
                     "launchMode": "default",
                     "scene": null
+                },
+                {
+                    "name": "通讯录",
+                    "pathName": "packageA/contacts/index",
+                    "query": "",
+                    "launchMode": "default",
+                    "scene": null
                 }
             ]
         }