xiaohaizhao пре 2 година
родитељ
комит
3daf56244d

+ 17 - 1
packageA/clockIn/index.js

@@ -27,6 +27,19 @@ Page({
         day = day < 10 ? "0" + day : day;
         this.querySignIn(year + '-' + month + '-' + day) */
     },
+    isShowAtt(e) {
+        console.log(e)
+        const {
+            index,
+            item
+        } = e.currentTarget.dataset;
+        item.unfold = !item.unfold;
+        this.selectComponent("#Yl_Files" + item.sys_signinid).initData()
+        this.selectComponent("#Yl_Files" + item.sys_signinid).handleFiles(item.unfold ? [] : item.attinfos)
+        this.setData({
+            [`list[${index}]`]: item
+        })
+    },
     /* 日期发生变化 */
     handleCalendarDateChange({
         detail
@@ -86,7 +99,10 @@ Page({
                 icon: "none"
             })
             this.setData({
-                list: res.data,
+                list: res.data.map(v => {
+                    v.unfold = true;
+                    return v
+                }),
                 signindate
             })
         })

+ 99 - 82
packageA/clockIn/index.scss

@@ -1,104 +1,121 @@
 page {
-  height: 100vh;
-  overflow: hidden;
+    height: 100vh;
+    overflow: hidden;
 }
 
 .float-but {
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  width: 120rpx;
-  height: 120rpx;
-  background-color: var(--assist);
-  border-radius: 50%;
-  color: #ffffff;
-  transform: translate(-50%, -50%);
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    width: 120rpx;
+    height: 120rpx;
+    background-color: var(--assist);
+    border-radius: 50%;
+    color: #ffffff;
+    transform: translate(-50%, -50%);
 }
 
 .history {
-  background-color: #F4F5F7;
-
-  .item {
-    width: 100vw;
-    padding: 20rpx 30rpx;
-    box-sizing: border-box;
-    background-color: #ffffff;
-    margin: 10rpx 0;
-
-    .time {
-      height: 40rpx;
-      line-height: 40rpx;
-      font-size: 28rpx;
-      color: #333333;
-    }
+    background-color: #F4F5F7;
 
-    .location {
-      margin-top: 10rpx;
+    .item {
+        width: 100vw;
+        padding: 20rpx 30rpx;
+        box-sizing: border-box;
+        background-color: #ffffff;
+        margin: 10rpx 0;
 
-      .iconfont {
-        margin-right: 4rpx;
-      }
+        .time {
+            height: 40rpx;
+            line-height: 40rpx;
+            font-size: 28rpx;
+            color: #333333;
+        }
 
-      line-height: 34rpx;
-      font-size: 24rpx;
-      color: #666666;
-    }
+        .location {
+            margin-top: 10rpx;
 
-    .exp {
-      line-height: 34rpx;
-      font-size: 24rpx;
-      color: #999999;
-      margin-top: 10rpx;
-    }
+            .iconfont {
+                margin-right: 4rpx;
+            }
 
-    .user {
-      height: 64rpx;
-      margin-top: 12rpx;
-      display: flex;
-
-      .portrait {
-        width: 64rpx;
-        height: 64rpx;
-        font-size: 0;
-        border-radius: 50rpx;
-        margin-right: 10rpx;
-        overflow: hidden;
-
-        image {
-          width: 100%;
-          height: 100%;
+            line-height: 34rpx;
+            font-size: 24rpx;
+            color: #666666;
         }
 
-        .text {
-          width: 100%;
-          height: 100%;
-          line-height: 64rpx;
-          text-align: center;
-          background: #F0F3FF;
-          font-size: 24rpx;
-          font-family: PingFang SC-Regular, PingFang SC;
-          color: #3874F6;
+        .exp {
+            line-height: 34rpx;
+            font-size: 24rpx;
+            color: #999999;
+            margin-top: 10rpx;
         }
-      }
 
-      .main {
-        flex: 1;
+        .user {
+            height: 64rpx;
+            margin-top: 12rpx;
+            display: flex;
+
+            .portrait {
+                width: 64rpx;
+                height: 64rpx;
+                font-size: 0;
+                border-radius: 50rpx;
+                margin-right: 10rpx;
+                overflow: hidden;
+
+                image {
+                    width: 100%;
+                    height: 100%;
+                }
 
-        .name {
-          height: 34rpx;
-          line-height: 34rpx;
-          font-size: 24rpx;
-          color: #333333;
+                .text {
+                    width: 100%;
+                    height: 100%;
+                    line-height: 64rpx;
+                    text-align: center;
+                    background: #F0F3FF;
+                    font-size: 24rpx;
+                    font-family: PingFang SC-Regular, PingFang SC;
+                    color: #3874F6;
+                }
+            }
+
+            .main {
+                flex: 1;
+
+                .name {
+                    height: 34rpx;
+                    line-height: 34rpx;
+                    font-size: 24rpx;
+                    color: #333333;
+                }
+
+                .text {
+                    height: 28rpx;
+                    line-height: 28rpx;
+                    font-size: 20rpx;
+                    color: #999999;
+                    margin-top: 2rpx;
+                }
+            }
         }
+    }
+}
+
+.attachment {
+    .label {
+        display: flex;
+        justify-content: space-between;
+        line-height: 34rpx;
+        font-size: 24rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #333333;
+        margin-top: 20rpx;
 
-        .text {
-          height: 28rpx;
-          line-height: 28rpx;
-          font-size: 20rpx;
-          color: #999999;
-          margin-top: 2rpx;
+        navigator {
+            color: #3874F6;
+            padding-left: 20rpx;
         }
-      }
     }
-  }
 }

+ 16 - 0
packageA/clockIn/index.wxml

@@ -26,6 +26,22 @@
                             <view class="text">{{item.depname}} {{item.position}}</view>
                         </view>
                     </view>
+                    <view class="attachment" wx:if="{{item.attinfos.length}}">
+                        <view class="label">
+                            <view>附件:{{item.attinfos.length}}个</view>
+                            <navigator url="#" class="right" data-item="{{item}}" data-index="{{index}}" bindtap="isShowAtt">
+                                <block wx:if="{{item.unfold}}">
+                                    展开
+                                    <van-icon name="arrow-down" />
+                                </block>
+                                <block wx:else>
+                                    收起
+                                    <van-icon name="arrow-up" />
+                                </block>
+                            </navigator>
+                        </view>
+                        <Yl_Files padding='0' id="{{'Yl_Files'+item.sys_signinid}}" />
+                    </view>
                 </view>
                 <My_empty wx:if="{{list.length==0}}" />
                 <view style="height: 40rpx;" />

+ 60 - 5
packageA/clockIn/signIn.js

@@ -6,7 +6,6 @@ const QQMapWX = require('../../utils/qqmap-wx-jssdk.min'),
 import {
     formatTime
 } from "../../utils/getTime";
-
 let timing = null;
 Page({
     data: {
@@ -15,6 +14,7 @@ Page({
         time: formatTime(new Date(), '-'),
         form: null,
         continue1: null,
+        count: 0
     },
     onLoad(options) {
         this.getLocation();
@@ -32,7 +32,6 @@ Page({
         content.remarks = data.remarks;
         if (data.sys_enterprise) content.sys_enterpriseid = data.sys_enterprise[1][0];
         if (data.sa_project) content.sa_projectid = data.sa_project[1][0];
-        console.log(content)
         wx.showModal({
             title: '提示',
             content: '是否确认本次签到',
@@ -53,10 +52,36 @@ Page({
                 title: res.msg == '成功' ? '签到成功' : res.msg,
                 icon: "none"
             })
-            if (res.msg == '成功') setTimeout(() => {
+            if (res.msg != '成功') return;
+
+            let {
+                attachmentids
+            } = this.selectComponent("#Yl_Files").getFiles();
+            if (attachmentids.length == 0) return setTimeout(() => {
                 getCurrentPages()[getCurrentPages().length - 2].toDate(this.data.time.split(" ")[0]);
                 wx.navigateBack();
             }, 500)
+            _Http.basic({
+                "classname": "system.attachment.Attachment",
+                "method": "createFileLink",
+                "content": {
+                    "ownertable": "sys_signin",
+                    "ownerid": res.data.sys_signinid,
+                    "usetype": "default",
+                    attachmentids
+                }
+            }).then(s => {
+                console.log('附件改绑', s)
+                if (s.msg != '成功') wx.showToast({
+                    title: s.msg,
+                    icon: "none",
+                    mask: true
+                });
+                setTimeout(() => {
+                    getCurrentPages()[getCurrentPages().length - 2].toDate(this.data.time.split(" ")[0]);
+                    wx.navigateBack();
+                }, 500)
+            })
         })
     },
     rander() {
@@ -286,7 +311,37 @@ Page({
     onUnload() {
         clearInterval(timing)
     },
-    onReady() {
-
+    /* 绑定媒体 */
+    insertImgEdit({
+        detail
+    }) {
+        _Http.basic({
+            "classname": "system.attachment.Attachment",
+            "method": "createFileLink",
+            "content": {
+                "ownertable": "sys_signin",
+                "ownerid": 0,
+                "usetype": "default",
+                "attachmentids": detail
+            }
+        }).then(res => {
+            console.log('跟进记录绑定附件', res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.msg,
+                icon: "none"
+            })
+            this.selectComponent("#Yl_Files").handleFiles(res.data)
+            this.setData({
+                count: this.data.count + detail.length
+            })
+        })
     },
+    /* 监听删除附件 */
+    onDeteleFiles({
+        detail
+    }) {
+        this.setData({
+            count: detail.attachmentids.length
+        })
+    }
 })

+ 3 - 1
packageA/clockIn/signIn.json

@@ -1,4 +1,6 @@
 {
-    "usingComponents": {},
+    "usingComponents": {
+        "My_upload": "/components/My_upload/index"
+    },
     "navigationBarTitleText": "签到"
 }

+ 39 - 0
packageA/clockIn/signIn.scss

@@ -52,6 +52,45 @@
 
 }
 
+.attachment {
+    background-color: #fff;
+    width: 100vw;
+    padding: 20rpx 0rpx;
+    box-sizing: border-box;
+
+    .title {
+        padding: 0 30rpx;
+        box-sizing: border-box;
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        height: 40rpx;
+        font-size: 28rpx;
+        font-family: PingFang SC-Medium, PingFang SC;
+        font-weight: 600;
+        color: #333333;
+
+        .text {
+            font-size: 24rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #999999;
+            font-weight: 400;
+        }
+    }
+
+    .upload-but {
+        width: 690rpx;
+        height: 90rpx;
+        text-align: center;
+        line-height: 90rpx;
+        border-radius: 8rpx;
+        border: 1rpx dashed #3874F6;
+        font-size: 24rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #3874F6;
+        margin-left: 30rpx;
+    }
+}
 
 
 .footer {

+ 16 - 0
packageA/clockIn/signIn.wxml

@@ -16,6 +16,22 @@
 <view style="height: 20rpx;" />
 <Yl_field id='Form' form='{{form}}' bind:interrupt="interrupt" />
 
+<view class="attachment" style="margin-top: 20rpx;">
+    <view class="title">
+        <view>
+            附件
+        </view>
+        <view wx:if="{{count}}" class="text">
+            已上传{{count}}个
+        </view>
+    </view>
+    <Yl_Files delete bindonDeteleFiles='onDeteleFiles' id="Yl_Files" />
+    <My_upload accept='image' binduploadCallback="insertImgEdit">
+        <navigator url="#" class="upload-but">
+            <text class="iconfont icon-a-tuiguangsucaishangchuan1" style="margin-right:10rpx;" /> 点击上传附件
+        </navigator>
+    </My_upload>
+</view>
 <view class="footer">
     <view class="count" />
     <view class="but-box">