Bladeren bron

Merge branch '蓝色' into 测试

xiaohaizhao 1 jaar geleden
bovenliggende
commit
b1dbb8bfdf

+ 7 - 0
packageA/publicClue/modules/follow/insert.js

@@ -22,6 +22,13 @@ Page({
             address: "", //逆解析位置
         }
     },
+    changeState({
+        detail
+    }) {
+        this.setData({
+            loading: detail
+        })
+    },
     async onLoad(options) {
         let date = formatTime(new Date(), '-').split(' '),
             time = date[1].split(":"),

+ 2 - 2
packageA/publicClue/modules/follow/insert.wxml

@@ -4,12 +4,12 @@
   <view class="content">
     <view class="upload">
       <view class="title">跟进附件</view>
-      <My_upload accept='media' binduploadCallback="insertImgEdit">
+      <My_upload accept='media' binduploadCallback="insertImgEdit" bindchangeState='changeState'>
         <navigator url="#">
           <text class="iconfont icon-a-tonggaofujian" />
         </navigator>
       </My_upload>
-      <My_upload accept='file' binduploadCallback="insertImgEdit">
+      <My_upload accept='file' binduploadCallback="insertImgEdit" bindchangeState='changeState'>
         <navigator url="#">
           <text class="iconfont icon-a-biaoqianlanzhiku" />
         </navigator>

+ 91 - 116
packageA/setclient/modules/trace/add/index.js

@@ -1,60 +1,66 @@
 const _Http = getApp().globalData.http;
 Page({
     data: {
-        ownerid: null,
-        ownertable: null,
-        sys_datafollowupid: 0, //数据ID
-        type: "",
-        content: "",
-        user: {}, //联系人
-        actions: [{
-            name: "上门拜访"
-        }, {
-            name: "电话拜访"
-        }, {
-            name: "微信联系"
-        }, {
-            name: "QQ联系"
+        loading: false,
+        list: [{
+            label: "跟进内容",
+            key: "content",
+            value: "",
         }],
-        show: false
+        content: {
+
+        }
     },
     onLoad(options) {
-        if (options.ownertable) {
-            this.setData({
-                ...options
-            })
-        };
-        //编辑获取原信息,新建初始化模板
+        console.log(options)
         if (options.sys_datafollowupid) {
             _Http.basic({
                 "id": 20221026085601,
                 "content": {
                     "sys_datafollowupid": options.sys_datafollowupid
-                }
+                },
             }).then(res => {
-                console.log("跟进详情", res)
-                if (res.msg != '成功') {
-                    wx.showToast({
-                        title: res.msg,
-                        icon: "none"
-                    })
-                    setTimeout(() => {
-                        wx.navigateBack()
-                    }, 300)
-                };
-                this.selectComponent("#Yl_files").handleFiles(res.data.attinfos)
+                console.log("获取详情", res)
+                if (res.code != 1) return wx.showToast({
+                    title: res.msg,
+                    icon: "none"
+                })
                 this.setData({
-                    type: res.data.type,
-                    content: res.data.content
+                    [`list[0].value`]: res.data.content
                 })
+                if (res.data.attinfos.length) this.selectComponent("#Yl_files").handleFiles(res.data.attinfos);
+                this.data.content = Object.assign(res.data, options);
+
             })
         } else {
-            // this.initTemplate()
+            options.sys_datafollowupid = 0;
+            this.data.content = options;
         }
-
-        //getFiles
     },
-
+    changeState({
+        detail
+    }) {
+        this.setData({
+            loading: detail
+        })
+    },
+    onInput(e) {
+        const {
+            index
+        } = e.target.dataset;
+        this.data.list[index].value = e.detail.value;
+        this.setData({
+            list: this.data.list
+        })
+    },
+    onVoiceInput(e) {
+        let {
+            index
+        } = e.target.dataset;
+        this.setData({
+            [`list[${index}].value`]: e.detail
+        })
+    },
     /* 绑定媒体 */
     insertImgEdit({
         detail
@@ -81,101 +87,70 @@ Page({
                 this.selectComponent("#Yl_files").handleFiles(res.data)
             } else {
                 if (res.data.length) data.attinfos = res.data;
-                // this.changeItem(data)
-                /*   setTimeout(() => {
-                      wx.navigateBack()
-                  }, 500) */
+                this.changeItem(data)
+                setTimeout(() => {
+                    wx.navigateBack()
+                }, 500)
             }
         })
     },
-    //开始选择跟进方式
-    openSelect() {
-        this.setData({
-            show: true
-        })
-    },
-    //取消选择
-    onCancel() {
-        this.setData({
-            show: false
-        })
-    },
-    //确定选择
-    onSelect({
-        detail
-    }) {
+    changeItem(data) {
         this.setData({
-            type: detail.name
+            loading: false
         })
-        this.onCancel();
+        let page = getCurrentPages()[getCurrentPages().length - 2],
+            isDetail = page.__route__ == 'packageA/setclient/modules/trace/detail/index';
+        if (isDetail) {
+            page.getDetail();
+            page = getCurrentPages()[getCurrentPages().length - 3];
+        }
+        let model = page.selectComponent("#Trace");
+        if (this.data.content.sys_datafollowupid == 0) {
+            if (page) {
+                if (model) model.getList(0, true)
+            }
+        } else {
+            let list = model.data.list,
+                index = list.findIndex(v => v.sys_datafollowupid == data.sys_datafollowupid);
+            if (index != -1) list[index] = data;
+            model.setData({
+                list
+            })
+
+        }
     },
-    //文本域输入
-    onInput(e) {
+    submit() {
         this.setData({
-            content: e.detail.value
+            loading: true
         })
-    },
-    submit() {
-        const content = {
-            // type: this.data.type,
-            content: this.data.content,
-            ownerid: this.data.ownerid,
-            ownertable: this.data.ownertable,
-            sys_datafollowupid: this.data.sys_datafollowupid
-        };
-        if (!content.content) return;
-        console.log(this.selectComponent("#Yl_files").getFiles())
+        let content = Object.assign(this.data.content, this.selectComponent("#Form").submit())
+        content.content = this.data.list[0].value;
+
         _Http.basic({
             "id": 20220930121601,
             content
         }).then(res => {
             console.log("保存跟进内容", res)
-            if (res.msg != '成功') return wx.showToast({
-                title: res.msg,
-                icon: "none"
-            });
             wx.showToast({
-                title: '保存成功',
+                title: res.msg != '成功' ? res.msg : content.sys_datafollowupid == 0 ? '保存成功' : '修改成功',
                 icon: "none",
-                mask: true
+                mask: res.msg == '成功'
             });
+            if (res.msg != '成功') return;
+
+
             let attachmentids = this.selectComponent("#Yl_files").getFiles().attachmentids;
-            if (attachmentids.length) this.handleFileLink(attachmentids, 'sys_datafollowup', res.data.sys_datafollowupid, res.data);
+
+            if (attachmentids.length) return this.handleFileLink(attachmentids, 'sys_datafollowup', res.data.sys_datafollowupid, res.data);
+
+            this.changeItem(res.data)
+
             setTimeout(() => {
-                getCurrentPages().forEach(v => {
-                    //详情界面更新数据
-                    v.getDetail && v.getDetail();
-                    //列表页更新数据
-                    if (v.selectComponent("#Trace")) {
-                        let page = v.selectComponent("#Trace"),
-                            list = page.data.list,
-                            index = list.findIndex(value => value.sys_datafollowupid == res.data.sys_datafollowupid);
-                        if (index != -1) {
-                            //列表中存在说明是编辑,返回上一级页面并更新数据
-                            list[index] = res.data;
-                            page.setData({
-                                list
-                            });
-                            wx.navigateBack();
-                        } else {
-                            //列表中不存在说明是新增,返回上一级页面更新数据 并进入详情
-                            list.push(res.data);
-                            page.setData({
-                                list,
-                                "content.total": page.data.content.total + 1
-                            });
-                            wx.navigateBack();
-                            /*  wx.navigateTo({
-                                 url: `/packageA/setclient/modules/trace/detail/index?data=` + JSON.stringify({
-                                     "sys_datafollowupid": res.data.sys_datafollowupid,
-                                     "ownertable": this.data.ownertable,
-                                     "ownerid": this.data.ownerid
-                                 }),
-                             }) */
-                        }
-                    };
-                });
-            }, 300)
+                wx.navigateBack()
+            }, 500)
         })
+    },
+    onUnload() {
+        if (this.data.content.sys_datafollowupid == 0) this.selectComponent("#Yl_files").deleteAll()
     }
 })

+ 2 - 1
packageA/setclient/modules/trace/add/index.json

@@ -1,6 +1,7 @@
 {
     "usingComponents": {
-        "My_upload": "/components/My_upload/index"
+        "My_upload": "/components/My_upload/index",
+        "Yl_VoiceInput": "/components/Yl_VoiceInput/index"
     },
     "navigationBarTitleText": "跟进"
 }

+ 42 - 63
packageA/setclient/modules/trace/add/index.scss

@@ -1,67 +1,13 @@
-.navigator {
-    width: 750rpx;
-    background: #FFFFFF;
-    box-sizing: border-box;
-    padding-left: 30rpx;
-    margin-bottom: 20rpx;
-
-    >view {
-        display: flex;
-        align-items: center;
-        border-bottom: 2rpx solid #ccc;
-        height: 90rpx;
-        width: 100%;
-        box-sizing: border-box;
-
-        .label {
-            flex-shrink: 0;
-            font-size: 28rpx;
-            font-family: PingFang SC-Regular, PingFang SC;
-            color: #666666;
-            padding-left: 20rpx;
-            width: 290rpx;
-            box-sizing: border-box;
-        }
-
-        .text {
-            flex: 1;
-            font-size: 28rpx;
-            font-family: PingFang SC-Regular, PingFang SC;
-            color: #333333;
-        }
-
-        .iconfont {
-            flex-shrink: 0;
-            margin-right: 36rpx;
-        }
-    }
-}
 .box {
     width: 100vw;
     box-sizing: border-box;
+    margin-top: 20rpx;
     background-color: #fff;
-    padding-top: 20rpx;
-    .title {
-        font-size: 28rpx;
-        font-family: PingFang SC-Regular, PingFang SC;
-        color: #333333;
-        padding-left: 30rpx;
-    }
+
     .content {
-        width: 690rpx;
         border-radius: 8rpx;
-        border: 2rpx solid #CCCCCC;
-        margin-top: 20rpx;
+        padding: 0 30rpx;
         box-sizing: border-box;
-        padding-bottom: 20rpx;
-        margin-left: 30rpx;
-        margin-bottom: 20rpx;
-
-        .textarea {
-            width: 625rpx;
-            height: 400rpx;
-            margin: 20rpx 0 20rpx 30rpx;
-        }
 
         .upload {
             display: flex;
@@ -69,9 +15,14 @@
             width: 100%;
             height: 88rpx;
             box-sizing: border-box;
-            border-bottom: 2rpx solid #CCCCCC;
-            border-top: 2rpx solid #CCCCCC;
-            background-color: #F4F5F7;
+
+            .title {
+                flex: 1;
+                font-size: 28rpx;
+                font-family: PingFang SC-Regular, PingFang SC;
+                color: #333333;
+                font-weight: bold;
+            }
 
             navigator {
                 width: 100rpx;
@@ -79,15 +30,43 @@
                 line-height: 80rpx;
                 text-align: center;
                 padding: 0;
-                background-color: #F4F5F7;
             }
         }
 
-        .title {
-            margin: 20rpx 0 0 0;
+    }
+}
+
+.inputs {
+    width: 100vw;
+    padding: 30rpx;
+    background-color: #fff;
+    box-sizing: border-box;
+    font-size: 30rpx;
+    font-family: PingFang SC-Medium, PingFang SC;
+    font-weight: 600;
+    color: #333333;
+    border-bottom: 1px solid #ddd;
+
+    .label {
+        position: relative;
+        margin-bottom: 20rpx;
+
+        .Yl_VoiceInput {
+            position: absolute;
+            margin-left: 20rpx;
         }
     }
+
+    textarea {
+        font-size: 28rpx !important;
+        font-weight: 400;
+        width: 100%;
+        white-space: pre-wrap;
+        word-break: break-all;
+    }
 }
+
+
 .footer {
     display: flex;
     align-items: center;

+ 11 - 13
packageA/setclient/modules/trace/add/index.wxml

@@ -1,32 +1,30 @@
-<!-- <navigator class="navigator" url="#" bindtap="openSelect" style='margin-bottom:20rpx;'>
-    <view>
-        <view class="label">跟进方式</view>
-        <view class="text">{{type||"请选择"}}</view>
-        <text class="iconfont icon-a-wodetiaozhuan" />
+<Yl_field id='Form' form='{{form}}' bind:onConfirm='onConfirm' />
+<view class="inputs" wx:for="{{list}}" wx:key="key">
+    <view class="label">
+        {{item.label}}
+        <Yl_VoiceInput class="Yl_VoiceInput" data-index="{{index}}" bindcallback="onVoiceInput" />
     </view>
-</navigator> -->
-
+    <textarea value="{{item.value}}" placeholder="请输入..." auto-height maxlength='-1' data-index="{{index}}" bindinput='onInput' />
+</view>
 <view class="box">
-    <view class="title">跟进内容</view>
     <view class="content">
         <view class="upload">
-            <My_upload accept='media' binduploadCallback="insertImgEdit">
+            <view class="title">跟进附件</view>
+            <My_upload accept='media' binduploadCallback="insertImgEdit" bindchangeState='changeState'>
                 <navigator url="#">
                     <text class="iconfont icon-a-tonggaofujian" />
                 </navigator>
             </My_upload>
-            <My_upload accept='file' binduploadCallback="insertImgEdit">
+            <My_upload accept='file' binduploadCallback="insertImgEdit" bindchangeState='changeState'>
                 <navigator url="#">
                     <text class="iconfont icon-a-biaoqianlanzhiku" />
                 </navigator>
             </My_upload>
         </view>
-        <textarea class="textarea" maxlength='-1' placeholder='请填写' value="{{content}}" bindinput='onInput' />
     </view>
     <Yl_Files delete id="Yl_files" />
 </view>
-<van-action-sheet show="{{ show }}" actions="{{ actions }}" bind:cancel='onCancel' bind:select='onSelect' cancel-text="取消" />
 <view style="height: 130rpx;" />
 <view class="footer">
-    <van-button custom-class='but' disabled='{{!content}}' bindclick="submit">确定</van-button>
+    <van-button custom-class='but' disabled='{{list[0].value.length==0}}' loading='{{loading}}' bindclick="submit">确定</van-button>
 </view>

+ 2 - 3
pages/trace/insert.wxml

@@ -10,13 +10,12 @@
   <view class="content">
     <view class="upload">
       <view class="title">跟进附件</view>
-      <My_upload accept='media' binduploadCallback="insertImgEdit">
+      <My_upload accept='media' binduploadCallback="insertImgEdit" bindchangeState='changeState'>
         <navigator url="#">
           <text class="iconfont icon-a-tonggaofujian" />
         </navigator>
       </My_upload>
-
-      <My_upload accept='file' binduploadCallback="insertImgEdit">
+      <My_upload accept='file' binduploadCallback="insertImgEdit" bindchangeState='changeState'>
         <navigator url="#">
           <text class="iconfont icon-a-biaoqianlanzhiku" />
         </navigator>