Преглед изворни кода

Merge branch '客户项目跟进修改' into dev

xiaohaizhao пре 2 година
родитељ
комит
99dd1d1217
7 измењених фајлова са 407 додато и 344 уклоњено
  1. 140 137
      pages/trace/index.js
  2. 1 1
      pages/trace/index.scss
  3. 10 1
      pages/trace/index.wxml
  4. 200 168
      pages/trace/insert.js
  5. 2 1
      pages/trace/insert.json
  6. 31 19
      pages/trace/insert.scss
  7. 23 17
      pages/trace/insert.wxml

+ 140 - 137
pages/trace/index.js

@@ -1,148 +1,151 @@
 const _Http = getApp().globalData.http
 Component({
-    properties: {
-        ownertable: {
-            type: String
-        },
-        ownerid: {
-            type: String
-        },
-        ownerid1: {
-            type: String
-        },
-        disabled: {
-            type: Boolean,
-            value: true
-        }
+  properties: {
+    ownertable: {
+      type: String
     },
-    options: {
-        addGlobalClass: true
+    ownerid: {
+      type: String
     },
-    data: {
-        content: {
-            nocache: true,
-            pageNumber: 1,
-            pageSize: 10,
-            pageTotal: 1,
-            total: null
-        },
-        list: []
+    ownerid1: {
+      type: String
     },
-    methods: {
-        getList(id, init = false) {
-            let content = {
-                ...this.data.content,
-                "ownertable": this.data.ownertable,
-                "ownerid": this.data.ownerid,
-            };
-            if (init) {
-                content.pageNumber = 1
-                content.pageTotal = 1
-            }
-            _Http.basic({
-                "id": 20220930121501,
-                content
-            }).then(res => {
-                console.log("跟进动态", res)
-                if (res.msg != '成功') return wx.showToast({
-                    title: res.data,
-                    icon: "none"
-                });
-                let list = res.data.map(v => {
-                    try {
-                        v.names = v.contacts.map(n => n.name)
-                    } catch (error) {
-                        v.names = null
-                    }
-                    return v
-                })
-                this.setData({
-                    "content.pageNumber": res.pageNumber + 1,
-                    "content.pageTotal": res.pageTotal,
-                    "content.total": res.total,
-                    list: res.pageNumber == 1 ? list : this.data.list.concat(list)
-                })
-            })
-        },
-        editItem(e) {
-            let item = null;
-            try {
-                item = e.currentTarget.dataset.item;
-            } catch (error) {
-                item = e
-            }
-            let parems = {
-                ownertable: this.data.ownertable,
-                ownerid: this.data.ownerid,
-                ownerid1: this.data.ownerid1,
-                sys_datafollowupid: item.sys_datafollowupid,
-                content: item.content,
-                contactsid: item.names ? [item.names, item.dataextend.contactsid] : "",
-                type: item.type,
-                attinfos: item.attinfos
-            }
-            wx.navigateTo({
-                url: '/pages/trace/insert?parems=' + JSON.stringify(parems),
-            })
-            _Http.changeItem = this.changeItem.bind(this)
-        },
-        changeItem(item) {
-            let list = this.data.list,
-                index = list.findIndex(v => v.sys_datafollowupid == item.sys_datafollowupid);
-            if (index != -1) {
-                list[index] = item;
-            } else {
-                list.unshift(item)
-                this.setData({
-                    "content.total": this.data.content.total += 1
-                })
-            }
-            this.setData({
-                list
-            })
-        },
-        deleteItem(e) {
-            const {
-                item
-            } = e.currentTarget.dataset;
-            wx.navigateTo({
-                url: `/packageA/setclient/modules/trace/list/delete?item=${JSON.stringify({
+    disabled: {
+      type: Boolean,
+      value: true
+    }
+  },
+  options: {
+    addGlobalClass: true
+  },
+  data: {
+    content: {
+      nocache: true,
+      pageNumber: 1,
+      pageSize: 10,
+      pageTotal: 1,
+      total: null
+    },
+    list: []
+  },
+  methods: {
+    getList(id, init = false) {
+      let content = {
+        ...this.data.content,
+        "ownertable": this.data.ownertable,
+        "ownerid": this.data.ownerid,
+      };
+      if (init) {
+        content.pageNumber = 1
+        content.pageTotal = 1
+      }
+      _Http.basic({
+        "id": 20220930121501,
+        content
+      }).then(res => {
+        console.log("跟进动态", res)
+        if (res.msg != '成功') return wx.showToast({
+          title: res.data,
+          icon: "none"
+        });
+        let list = res.data.map(v => {
+          try {
+            v.names = v.contacts.map(n => n.name)
+          } catch (error) {
+            v.names = null
+          }
+          return v
+        })
+        this.setData({
+          "content.pageNumber": res.pageNumber + 1,
+          "content.pageTotal": res.pageTotal,
+          "content.total": res.total,
+          list: res.pageNumber == 1 ? list : this.data.list.concat(list)
+        })
+      })
+    },
+    editItem(e) {
+      let item = null;
+      try {
+        item = e.currentTarget.dataset.item;
+      } catch (error) {
+        item = e
+      }
+      let parems = {
+        ownertable: this.data.ownertable,
+        ownerid: this.data.ownerid,
+        ownerid1: this.data.ownerid1,
+        sys_datafollowupid: item.sys_datafollowupid,
+        content: item.content,
+        target: item.target,
+        results: item.results,
+        nextplan: item.nextplan,
+        contactsid: item.names ? [item.names, item.dataextend.contactsid] : "",
+        type: item.type,
+        attinfos: item.attinfos
+      }
+      wx.navigateTo({
+        url: '/pages/trace/insert?parems=' + JSON.stringify(parems),
+      })
+      _Http.changeItem = this.changeItem.bind(this)
+    },
+    changeItem(item) {
+      let list = this.data.list,
+        index = list.findIndex(v => v.sys_datafollowupid == item.sys_datafollowupid);
+      if (index != -1) {
+        list[index] = item;
+      } else {
+        list.unshift(item)
+        this.setData({
+          "content.total": this.data.content.total += 1
+        })
+      }
+      this.setData({
+        list
+      })
+    },
+    deleteItem(e) {
+      const {
+        item
+      } = e.currentTarget.dataset;
+      wx.navigateTo({
+        url: `/packageA/setclient/modules/trace/list/delete?item=${JSON.stringify({
                 "sys_datafollowupid": item.sys_datafollowupid,
                 "ownertable": this.data.ownertable,
                 "ownerid": this.data.ownerid
             })}`,
-            })
-        },
-        insetr() {
-            let parems = {
-                ownertable: this.data.ownertable,
-                ownerid: this.data.ownerid,
-                ownerid1: this.data.ownerid1,
-                sys_datafollowupid: 0,
-                content: ""
-            }
-            wx.navigateTo({
-                url: '/pages/trace/insert?parems=' + JSON.stringify(parems),
-            })
-        },
-        toDetail(e) {
-            const {
-                item
-            } = e.currentTarget.dataset;
-            wx.navigateTo({
-                url: `/pages/trace/detail?data=` + JSON.stringify({
-                    "sys_datafollowupid": item.sys_datafollowupid,
-                    "ownertable": this.data.ownertable,
-                    "ownerid": this.data.ownerid
-                }),
-            });
-            _Http.changeItem = this.changeItem.bind(this);
-            _Http.editItem = this.editItem.bind(this);
-        },
-        changeTotal() {
-            this.setData({
-                "content.total": this.data.content.total - 1
-            })
-        }
+      })
+    },
+    insetr() {
+      let parems = {
+        ownertable: this.data.ownertable,
+        ownerid: this.data.ownerid,
+        ownerid1: this.data.ownerid1,
+        sys_datafollowupid: 0,
+        content: ""
+      }
+      wx.navigateTo({
+        url: '/pages/trace/insert?parems=' + JSON.stringify(parems),
+      })
+    },
+    toDetail(e) {
+      const {
+        item
+      } = e.currentTarget.dataset;
+      wx.navigateTo({
+        url: `/pages/trace/detail?data=` + JSON.stringify({
+          "sys_datafollowupid": item.sys_datafollowupid,
+          "ownertable": this.data.ownertable,
+          "ownerid": this.data.ownerid
+        }),
+      });
+      _Http.changeItem = this.changeItem.bind(this);
+      _Http.editItem = this.editItem.bind(this);
+    },
+    changeTotal() {
+      this.setData({
+        "content.total": this.data.content.total - 1
+      })
     }
+  }
 })

+ 1 - 1
pages/trace/index.scss

@@ -87,7 +87,7 @@
 
         .text {
             width: 100%;
-            font-size: 28rpx;
+            font-size: 24rpx;
             font-family: PingFang SC-Regular, PingFang SC;
             color: #666666;
             word-break: break-all;

+ 10 - 1
pages/trace/index.wxml

@@ -33,7 +33,16 @@
             </view>
         </view>
         <view class="text">
-            {{item.content}}
+            目的:{{item.target||' --'}}
+        </view>
+        <view class="text">
+            过程:{{item.content||' --'}}
+        </view>
+        <view class="text">
+            结果:{{item.results||' --'}}
+        </view>
+        <view class="text">
+            下次跟进计划:{{item.nextplan||' --'}}
         </view>
     </navigator>
     <view class="bottom">

+ 200 - 168
pages/trace/insert.js

@@ -1,175 +1,207 @@
 const _Http = getApp().globalData.http;
 Page({
-    data: {
-        disabled: true,
-        loading: false
-    },
-    onLoad(options) {
-        let parems = JSON.parse(options.parems),
-            form = [{
-                label: "跟进类型",
-                error: false,
-                errMsg: "",
-                type: "option",
-                optionNmae: "followuptype",
-                optionType: "radio", //复选   radio 单选
-                value: "",
-                placeholder: "选择跟进方式",
-                valueName: "type",
-                checking: "base",
-                required: true
-            }, {
-                label: "跟进对象",
-                error: false,
-                errMsg: "",
-                type: "route",
-                url: "/packageA/select/linkman/select",
-                value: "",
-                placeholder: "选择跟进对象",
-                valueName: "contactsid",
-                checking: "base",
-                required: true
-            }];
-        if (parems.ownertable == "sa_project") {
-            form[1].params = {
-                "id": "20221111131004",
-                "content": {
-                    "nocache": true,
-                    "sa_projectid": parems.ownerid,
-                    "pageNumbe": 1,
-                    "pageTotal": 1,
-                    "total": null,
-                    "where": {
-                        "conditino": ""
-                    }
-                }
-            }
-        } else {
-            form[1].params = {
-                "id": "20221022165503",
-                "content": {
-                    "nacache": true,
-                    "pageNumber": 1,
-                    "pageSize": 10,
-                    "pageTotal": 1,
-                    "total": null,
-                    "where": {
-                        "condition": "",
-                        "workaddress": 0
-                    },
-                    "sys_enterpriseid": parems.ownerid1
-                }
-            }
+  data: {
+    disabled: true,
+    loading: false,
+    list: [{
+      label: "目的",
+      key: "target",
+      value: "",
+    }, {
+      label: "过程",
+      key: "content",
+      value: "",
+    }, {
+      label: "结果",
+      key: "results",
+      value: "",
+    }, {
+      label: "下次跟进计划",
+      key: "nextplan",
+      value: "",
+    }]
+  },
+  onLoad(options) {
+    let parems = JSON.parse(options.parems),
+      form = [{
+        label: "跟进类型",
+        error: false,
+        errMsg: "",
+        type: "option",
+        optionNmae: "followuptype",
+        optionType: "radio", //复选   radio 单选
+        value: "",
+        placeholder: "选择跟进方式",
+        valueName: "type",
+        checking: "base",
+        required: true
+      }, {
+        label: "跟进对象",
+        error: false,
+        errMsg: "",
+        type: "route",
+        url: "/packageA/select/linkman/select",
+        value: "",
+        placeholder: "选择跟进对象",
+        valueName: "contactsid",
+        checking: "base",
+        required: true
+      }];
+    if (parems.ownertable == "sa_project") {
+      form[1].params = {
+        "id": "20221111131004",
+        "content": {
+          "nocache": true,
+          "sa_projectid": parems.ownerid,
+          "pageNumbe": 1,
+          "pageTotal": 1,
+          "total": null,
+          "where": {
+            "conditino": ""
+          }
         }
-        if (parems.sys_datafollowupid != 0) {
-            form[0].value = parems.type;
-            form[1].value = parems.contactsid;
-            if (parems.attinfos.length) this.selectComponent("#Yl_files").handleFiles(parems.attinfos);
-            if (parems.type && parems.contactsid) this.setData({
-                disabled: false
-            })
+      }
+    } else {
+      form[1].params = {
+        "id": "20221022165503",
+        "content": {
+          "nacache": true,
+          "pageNumber": 1,
+          "pageSize": 10,
+          "pageTotal": 1,
+          "total": null,
+          "where": {
+            "condition": "",
+            "workaddress": 0
+          },
+          "sys_enterpriseid": parems.ownerid1
         }
-        this.setData({
-            parems,
-            form
-        })
-    },
-    /* 绑定媒体 */
-    insertImgEdit({
-        detail
-    }) {
-        this.handleFileLink(detail)
-    },
-    handleFileLink(attachmentids, ownertable = "temporary", ownerid = 1, data) {
-        _Http.basic({
-            "classname": "system.attachment.Attachment",
-            "method": "createFileLink",
-            "content": {
-                ownertable,
-                ownerid,
-                usetype: 'default',
-                attachmentids
-            }
-        }).then(res => {
-            console.log('跟进记录绑定附件', res)
-            if (res.msg != '成功') return wx.showToast({
-                title: res.msg,
-                icon: "none"
-            })
-            if (ownertable == 'temporary') {
-                this.selectComponent("#Yl_files").handleFiles(res.data)
-            } else {
-                if (res.data.length) data.attinfos = res.data;
-                this.changeItem(data)
-                setTimeout(() => {
-                    wx.navigateBack()
-                }, 500)
-            }
-        })
-    },
-    changeItem(data) {
-        this.setData({
-            loading: false
-        })
-        let page = getCurrentPages()[getCurrentPages().length - 2],
-            isDetail = page.__route__ == 'pages/trace/detail';
-        if (isDetail) {
-            page.getDetail();
-            page = getCurrentPages()[getCurrentPages().length - 3];
-        }
-        if (_Http.changeItem) {
-            _Http.changeItem(data)
-            delete(_Http.changeItem)
-        } else {
-            if (page) {
-                let model = page.selectComponent("#Trace");
-                if (model) model.getList(0, true)
-            }
-        }
-    },
-    //文本域输入
-    onInput(e) {
-        this.setData({
-            "parems.content": e.detail.value || ""
-        })
-    },
-    submit() {
-        this.setData({
-            loading: true
-        })
-        let content = Object.assign(this.data.parems, this.selectComponent("#Form").submit())
-        content.dataextend = {
-            contactsid: content.contactsid[1]
-        }
-        delete(content.contactsid)
-        _Http.basic({
-            "id": 20220930121601,
-            content
-        }).then(res => {
-            console.log("保存跟进内容", res)
-            wx.showToast({
-                title: res.msg != '成功' ? res.msg : content.sys_datafollowupid == 0 ? '保存成功' : '修改成功',
-                icon: "none",
-                mask: res.msg == '成功'
-            });
-            if (res.msg != '成功') return;
-            res.data.names = res.data.contacts.map(n => n.name)
-            let attachmentids = this.selectComponent("#Yl_files").getFiles().attachmentids;
-            if (attachmentids.length) return this.handleFileLink(attachmentids, 'sys_datafollowup', res.data.sys_datafollowupid, res.data);
-            this.changeItem(res.data)
-            setTimeout(() => {
-                wx.navigateBack()
-            }, 500)
-        })
-    },
-    onConfirm({
-        detail
-    }) {
-        this.setData({
-            disabled: detail
+      }
+    }
+    if (parems.sys_datafollowupid != 0) {
+      form[0].value = parems.type;
+      form[1].value = parems.contactsid;
+      if (parems.attinfos.length) this.selectComponent("#Yl_files").handleFiles(parems.attinfos);
+
+      this.setData({
+        list: this.data.list.map(v => {
+          v.value = parems[v.key]
+          return v
         })
-    },
-    onUnload() {
-        if (this.data.parems.sys_datafollowupid == 0) this.selectComponent("#Yl_files").deleteAll()
+      })
+    }
+    this.setData({
+      parems,
+      form
+    })
+  },
+  onInput(e) {
+    const {
+      index
+    } = e.target.dataset;
+    this.data.list[index].value = e.detail.value;
+  },
+  onVoiceInput(e) {
+    let {
+      index
+    } = e.target.dataset;
+    this.setData({
+      [`list[${index}].value`]: e.detail
+    })
+  },
+  /* 绑定媒体 */
+  insertImgEdit({
+    detail
+  }) {
+    this.handleFileLink(detail)
+  },
+  handleFileLink(attachmentids, ownertable = "temporary", ownerid = 1, data) {
+    _Http.basic({
+      "classname": "system.attachment.Attachment",
+      "method": "createFileLink",
+      "content": {
+        ownertable,
+        ownerid,
+        usetype: 'default',
+        attachmentids
+      }
+    }).then(res => {
+      console.log('跟进记录绑定附件', res)
+      if (res.msg != '成功') return wx.showToast({
+        title: res.msg,
+        icon: "none"
+      })
+      if (ownertable == 'temporary') {
+        this.selectComponent("#Yl_files").handleFiles(res.data)
+      } else {
+        if (res.data.length) data.attinfos = res.data;
+        this.changeItem(data)
+        setTimeout(() => {
+          wx.navigateBack()
+        }, 500)
+      }
+    })
+  },
+  changeItem(data) {
+    this.setData({
+      loading: false
+    })
+    let page = getCurrentPages()[getCurrentPages().length - 2],
+      isDetail = page.__route__ == 'pages/trace/detail';
+    if (isDetail) {
+      page.getDetail();
+      page = getCurrentPages()[getCurrentPages().length - 3];
+    }
+    if (_Http.changeItem) {
+      _Http.changeItem(data)
+      delete(_Http.changeItem)
+    } else {
+      if (page) {
+        let model = page.selectComponent("#Trace");
+        if (model) model.getList(0, true)
+      }
+    }
+  },
+  submit() {
+    this.setData({
+      loading: true
+    })
+    let content = Object.assign(this.data.parems, this.selectComponent("#Form").submit())
+    content.dataextend = {
+      contactsid: content.contactsid[1]
     }
+    delete(content.contactsid)
+    this.data.list.forEach(v => {
+      content[v.key] = v.value
+    })
+    _Http.basic({
+      "id": 20220930121601,
+      content
+    }).then(res => {
+      console.log("保存跟进内容", res)
+      wx.showToast({
+        title: res.msg != '成功' ? res.msg : content.sys_datafollowupid == 0 ? '保存成功' : '修改成功',
+        icon: "none",
+        mask: res.msg == '成功'
+      });
+      if (res.msg != '成功') return;
+      res.data.names = res.data.contacts.map(n => n.name)
+      let attachmentids = this.selectComponent("#Yl_files").getFiles().attachmentids;
+      if (attachmentids.length) return this.handleFileLink(attachmentids, 'sys_datafollowup', res.data.sys_datafollowupid, res.data);
+      this.changeItem(res.data)
+      setTimeout(() => {
+        wx.navigateBack()
+      }, 500)
+    })
+  },
+  onConfirm({
+    detail
+  }) {
+    this.setData({
+      disabled: detail
+    })
+  },
+  onUnload() {
+    if (this.data.parems.sys_datafollowupid == 0) this.selectComponent("#Yl_files").deleteAll()
+  }
 })

+ 2 - 1
pages/trace/insert.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": "跟进"
 }

+ 31 - 19
pages/trace/insert.scss

@@ -1,21 +1,13 @@
 .box {
     width: 100vw;
     box-sizing: border-box;
+    margin-top: 20rpx;
     background-color: #fff;
-    padding-top: 20rpx;
-    margin-top: -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;
-
-
 
         .upload {
             display: flex;
@@ -23,16 +15,12 @@
             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;
-                padding-left: 30rpx;
                 font-weight: bold;
             }
 
@@ -42,19 +30,43 @@
                 line-height: 80rpx;
                 text-align: center;
                 padding: 0;
-                background-color: #F4F5F7;
             }
         }
 
-        .textarea {
-            width: 625rpx;
-            height: 400rpx;
-            margin: 20rpx 0 20rpx 30rpx;
+    }
+}
+
+.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;

+ 23 - 17
pages/trace/insert.wxml

@@ -1,25 +1,31 @@
 <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>
+  <textarea value="{{item.value}}" placeholder="请输入..." auto-height maxlength='-1' data-index="{{index}}" bindinput='onInput' />
+</view>
 <view class="box">
-    <view class="content">
-        <view class="upload">
-            <view class="title">跟进内容</view>
-            <My_upload accept='media' binduploadCallback="insertImgEdit">
-                <navigator url="#">
-                    <text class="iconfont icon-a-tonggaofujian" />
-                </navigator>
-            </My_upload>
+  <view class="content">
+    <view class="upload">
+      <view class="title">跟进附件</view>
+      <My_upload accept='media' binduploadCallback="insertImgEdit">
+        <navigator url="#">
+          <text class="iconfont icon-a-tonggaofujian" />
+        </navigator>
+      </My_upload>
 
-            <My_upload accept='file' binduploadCallback="insertImgEdit">
-                <navigator url="#">
-                    <text class="iconfont icon-a-biaoqianlanzhiku" />
-                </navigator>
-            </My_upload>
-        </view>
-        <textarea class="textarea" maxlength='-1' placeholder='请填写' value="{{parems.content}}" bindinput='onInput' />
+      <My_upload accept='file' binduploadCallback="insertImgEdit">
+        <navigator url="#">
+          <text class="iconfont icon-a-biaoqianlanzhiku" />
+        </navigator>
+      </My_upload>
     </view>
-    <Yl_Files delete id="Yl_files" />
+  </view>
+  <Yl_Files delete id="Yl_files" />
 </view>
 <view style="height: 130rpx;" />
 <view class="footer">
-    <van-button custom-class='but' disabled='{{disabled || !parems.content.length}}' loading='{{loading}}' bindclick="submit">确定</van-button>
+  <van-button custom-class='but' disabled='{{disabled}}' loading='{{loading}}' bindclick="submit">确定</van-button>
 </view>