فهرست منبع

工作汇报模块

xiaohaizhao 2 سال پیش
والد
کامیت
195bab270d

+ 36 - 0
packageA/report/detail.js

@@ -0,0 +1,36 @@
+let sys_workreportid = null;
+const _Http = getApp().globalData.http;
+
+Page({
+    data: {
+
+    },
+    onLoad(options) {
+        sys_workreportid = options.id;
+        console.log(sys_workreportid)
+        _Http.basic({
+            "id": "20230524092002",
+            "content": {
+                sys_workreportid
+            },
+        }).then(res => {
+            console.log("汇报详情", res)
+            if (res.msg != '成功') {
+                wx.showToast({
+                    title: res.msg,
+                    icon: "none",
+                    mask: true
+                })
+                setTimeout(() => {
+                    wx.navigateBack()
+                }, 500)
+            } else {
+                if (res.data.attinfos.length != 0) this.selectComponent("#Yl_Files").handleFiles(res.data.attinfos)
+                this.setData({
+                    detail: res.data,
+                    type: res.data.userid == wx.getStorageSync('userMsg').userid ? '我发出的' : '我收到的'
+                })
+            }
+        })
+    }
+})

+ 4 - 0
packageA/report/detail.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "汇报详情"
+}

+ 57 - 0
packageA/report/detail.scss

@@ -0,0 +1,57 @@
+.header {
+    position: sticky;
+    top: 0;
+    width: 100vw;
+    padding: 20rpx 30rpx;
+    background-color: #fff;
+    font-size: 24rpx;
+    color: #999999;
+    box-sizing: border-box;
+    box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 5px 0px, rgba(0, 0, 0, 0.1) 0px 0px 1px 0px;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+
+    .title {
+        font-size: 36rpx;
+        font-weight: 600;
+        color: #333333;
+        margin-bottom: 10rpx;
+    }
+
+    .badeg {
+        flex-shrink: 0;
+        height: 118rpx;
+        width: 48rpx;
+        line-height: 48rpx;
+        text-align: center;
+        background: #F0F3FF;
+        border-radius: 8rpx 0rpx 0rpx 8rpx;
+        font-size: 24rpx;
+        color: #3874F6;
+        writing-mode: vertical-lr;
+        margin: -20rpx -30rpx;
+        margin-left: 20rpx;
+    }
+}
+
+.rows {
+    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;
+
+    .main {
+        font-size: 28rpx !important;
+        font-weight: 400;
+        width: 100%;
+        white-space: pre-line;
+        word-break: break-all;
+        margin-top: -10rpx !important;
+    }
+}

+ 28 - 0
packageA/report/detail.wxml

@@ -0,0 +1,28 @@
+<view class="header">
+    <view>
+        <view class="title">
+            {{detail.createby}}的{{detail.reportname}}
+        </view>
+        {{detail.position}} {{detail.createdate}}
+    </view>
+    <view class="badeg">
+        {{type}}
+    </view>
+</view>
+<view style="height: 20rpx;" />
+<view class="rows" wx:for="{{detail.items}}" wx:key="rowindex">
+    <view style="margin-bottom: 0rpx;">
+        {{item.title}}
+    </view>
+    <view class="main">
+        {{item.content[0].content||'空'}}
+    </view>
+</view>
+
+
+<view class="rows">
+    附件:
+</view>
+<view style="background-color: #fff; width: 100vw;margin-top: -40rpx;padding-top: 20rpx;">
+    <Yl_Files id="Yl_Files" />
+</view>

+ 59 - 0
packageA/report/index.js

@@ -0,0 +1,59 @@
+const _Http = getApp().globalData.http;
+Page({
+    data: {
+        tabs: [{
+            title: "我收到的",
+            id: "Receive"
+        }, {
+            title: "我发出的",
+            id: "SendOut"
+        }],
+        active: "Receive"
+    },
+    onLoad(options) {
+        this.getList();
+    },
+    onChange(e) {
+        this.setData({
+            active: e.detail.name
+        });
+        this.getList();
+    },
+    getList(init = false) {
+        if (init.detail != undefined) init = init.detail;
+        this.selectComponent("#" + this.data.active).getList(init);
+        this.getModel();
+    },
+    /* 获取模版列表 */
+    getModel() {
+        _Http.basic({
+            "id": "20230524091902",
+            "content": {
+                "hrid": wx.getStorageSync('userMsg').hrid
+            }
+        }).then(res => {
+            console.log("可创建模版列表", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.msg,
+                icon: 'none',
+                mask: true
+            })
+            this.setData({
+                modelList: res.data
+            })
+        })
+    },
+    onReady() {
+        this.selectComponent("#ListBox").setHeight(".head", this);
+    },
+    /* 新建汇报 */
+    newData(e, i = 0) {
+        wx.navigateTo({
+            url: '/packageA/report/insert?model=' + JSON.stringify(this.data.modelList[i]),
+        })
+    },
+    /* Picker选择器选择新建模版 */
+    onPickerSelected(e) {
+        this.newData("", e.detail.value)
+    }
+})

+ 7 - 0
packageA/report/index.json

@@ -0,0 +1,7 @@
+{
+    "usingComponents": {
+        "Receive": "./modules/receive/index",
+        "SendOut": "./modules/sendOut/index"
+    },
+    "navigationBarTitleText": "工作汇报"
+}

+ 1 - 0
packageA/report/index.scss

@@ -0,0 +1 @@
+/* packageA/report/index.wxss */

+ 20 - 0
packageA/report/index.wxml

@@ -0,0 +1,20 @@
+<van-tabs active="{{ active }}" title-active-color='var(--assist)' color='var(--assist)' bind:change="onChange">
+    <van-tab wx:for="{{tabs}}" wx:key="id" title="{{item.title}}" name='{{item.id}}' />
+</van-tabs>
+<view class="head" />
+<Yl_ListBox id='ListBox' bind:getlist='getList'>
+    <view hidden="{{active!='Receive'}}">
+        <Receive id="Receive" />
+    </view>
+    <view hidden="{{active!='SendOut'}}">
+        <SendOut id='SendOut' />
+    </view>
+</Yl_ListBox>
+
+<block wx:if="{{modelList.length}}">
+    <!-- 浮动按钮 -->
+    <Yl_FloatingButton wx:if="{{modelList.length==1}}" bindtap="newData" />
+    <picker mode="selector" wx:else range="{{modelList}}" range-key='reportname' bindchange='onPickerSelected'>
+        <Yl_FloatingButton />
+    </picker>
+</block>

+ 153 - 0
packageA/report/insert.js

@@ -0,0 +1,153 @@
+const _Http = getApp().globalData.http;
+let sys_workreportmodelid = null;
+import {
+    formatTime
+} from "../../utils/getTime"
+
+Page({
+    data: {
+        date: formatTime(new Date(), "-").split(" ")[0]
+    },
+    onLoad(options) {
+        let model = JSON.parse(options.model)
+        sys_workreportmodelid = model.sys_workreportmodelid;
+        wx.setNavigationBarTitle({
+            title: model.reportname,
+        })
+        _Http.basic({
+            "id": "20230523131702",
+            "content": {
+                sys_workreportmodelid
+            }
+        }).then(res => {
+            console.log("查询模板数据", res)
+            if (res.msg != '成功') {
+                wx.showToast({
+                    title: res.msg,
+                    icon: "none",
+                    mask: true
+                })
+                setTimeout(() => {
+                    wx.navigateBack()
+                }, 500)
+            } else {
+                this.setData({
+                    reportname: model.reportname,
+                    list: res.data.map(v => {
+                        v.content = v.content.map(s => {
+                            return v.editable == 1 && s.content != "" ? `${s.rowindex}、${s.content}` : s.content
+                        }).join('\n\n');
+                        return v
+                    })
+                })
+            }
+        })
+    },
+    /* 绑定媒体 */
+    insertImgEdit({
+        detail
+    }) {
+        _Http.basic({
+            "classname": "system.attachment.Attachment",
+            "method": "createFileLink",
+            "content": {
+                "ownertable": "sys_workreport",
+                "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)
+        })
+    },
+    onInput(e) {
+        let {
+            item,
+            index
+        } = e.currentTarget.dataset;
+        item.content = e.detail.value;
+        this.setData({
+            [`list[${index}]`]: item
+        })
+    },
+    /* 取消汇报 */
+    onCancel() {
+        wx.showModal({
+            title: '提示',
+            content: '是否确定取消汇报,确认后将丢失填写/修改进度',
+            complete: (res) => {
+                if (res.confirm) wx.navigateBack()
+            }
+        })
+    },
+    /* 提交汇报 */
+    submit() {
+        console.log()
+        const that = this;
+        wx.showModal({
+            title: '提示',
+            content: '是否确认提交汇报?',
+            complete: ({
+                confirm
+            }) => {
+                if (confirm) _Http.basic({
+                    "id": "20230523094702",
+                    "content": {
+                        sys_workreportmodelid,
+                        "items": that.data.list.map(v => {
+                            v.content = [{
+                                rouindex: 1,
+                                content: v.content
+                            }]
+                            return v
+                        })
+                    },
+                }).then(res => {
+                    console.log("提交汇报", res)
+                    wx.showToast({
+                        title: res.msg == '成功' ? '提交成功' : res.msg,
+                        icon: "none",
+                        mask: true
+                    });
+                    let {
+                        attachmentids
+                    } = this.selectComponent("#Yl_Files").getFiles();
+
+                    if (attachmentids.length == 0) return setTimeout(() => {
+                        wx.redirectTo({
+                            url: '/packageA/report/detail?id=' + res.data.sys_workreportid,
+                        })
+                    }, 500)
+
+                    _Http.basic({
+                        "classname": "system.attachment.Attachment",
+                        "method": "createFileLink",
+                        "content": {
+                            "ownertable": "sys_workreport",
+                            "ownerid": res.data.sys_workreportid,
+                            "usetype": "default",
+                            attachmentids
+                        }
+                    }).then(s => {
+                        console.log('附件改绑', s)
+                        if (s.msg != '成功') wx.showToast({
+                            title: s.msg,
+                            icon: "none",
+                            mask: true
+                        });
+                        setTimeout(() => {
+                            wx.redirectTo({
+                                url: '/packageA/report/detail?id=' + res.data.sys_workreportid,
+                            })
+                        }, 300)
+                    })
+                })
+            }
+        })
+    }
+})

+ 6 - 0
packageA/report/insert.json

@@ -0,0 +1,6 @@
+{
+    "usingComponents": {
+        "My_upload": "/components/My_upload/index"
+    },
+    "navigationBarTitleText": "汇报"
+}

+ 83 - 0
packageA/report/insert.scss

@@ -0,0 +1,83 @@
+.header {
+    width: 100vw;
+    padding: 20rpx 30rpx;
+    background-color: #fff;
+    font-size: 24rpx;
+    color: #999999;
+    box-sizing: border-box;
+    margin-bottom: 20rpx;
+
+    .title {
+        font-size: 36rpx;
+        font-weight: 600;
+        color: #333333;
+        margin-bottom: 10rpx;
+    }
+}
+
+.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;
+
+    textarea {
+        font-size: 28rpx !important;
+        font-weight: 400;
+        width: 100%;
+        white-space: pre-wrap;
+        word-break: break-all;
+    }
+}
+
+.disabled {
+    color: #999;
+}
+
+.footer {
+    display: flex;
+    justify-content: space-between;
+    padding: 0 30rpx;
+    position: fixed;
+    width: 100vw;
+    height: 136rpx;
+    background: #FFFFFF;
+    box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    bottom: 0;
+    box-sizing: border-box;
+    z-index: 9999;
+    padding-top: 10rpx;
+
+    .but-box {
+        .but {
+            min-width: 156rpx;
+            height: 90rpx;
+            border-radius: 8rpx;
+            font-size: 28rpx;
+            font-family: PingFang SC-Bold, PingFang SC;
+            font-weight: bold;
+        }
+
+        .submit1 {
+            margin-left: 20rpx;
+            color: #FFFFFF;
+        }
+    }
+}
+
+.files-box {
+    display: flex;
+    justify-content: space-between;
+
+    >view {
+        display: flex;
+        justify-content: space-between;
+        width: 110rpx;
+        font-size: 40rpx !important;
+    }
+}

+ 43 - 0
packageA/report/insert.wxml

@@ -0,0 +1,43 @@
+<view class="header">
+    <view class="title">
+        {{reportname}}
+    </view>
+    {{date}}
+</view>
+
+<view class="inputs {{item.editable==0?'disabled':''}}" wx:for="{{list}}" wx:key="rowindex">
+    <view style="margin-bottom: 20rpx;">
+        {{item.title}}
+    </view>
+    <textarea value="{{item.content}}" disabled='{{item.editable==0}}' placeholder="请输入..." auto-height maxlength='-1' data-index="{{index}}" data-item="{{item}}" bindinput='onInput' />
+</view>
+
+<view class="inputs">
+    <view class="files-box">
+        附件:
+        <view>
+            <My_upload accept='media' binduploadCallback="insertImgEdit">
+                <navigator url="#" class="but">
+                    <van-icon name="photo-o" />
+                </navigator>
+            </My_upload>
+            <My_upload accept='file' binduploadCallback="insertImgEdit">
+                <navigator url="#" class="but">
+                    <van-icon name="description" />
+                </navigator>
+            </My_upload>
+        </view>
+    </view>
+</view>
+<view style="background-color: #fff; width: 100vw;margin-top: -40rpx;padding-top: 20rpx;">
+    <Yl_Files delete id="Yl_Files" />
+</view>
+
+<view style="height: 136rpx;" />
+<view class="footer">
+    <view />
+    <view class="but-box">
+        <van-button custom-class='but' plain type="default" bind:click="onCancel">取消</van-button>
+        <van-button custom-class='but submit1' color='#3874F6' bind:click="submit">提交</van-button>
+    </view>
+</view>

+ 22 - 0
packageA/report/modules/list/index.js

@@ -0,0 +1,22 @@
+Component({
+    properties: {
+        list: {
+            type: Array,
+            value: []
+        },
+        onClick: {
+            type: Function
+        }
+    },
+    methods: {
+        toDetail(e) {
+            const {
+                item
+            } = e.currentTarget.dataset;
+            wx.navigateTo({
+                url: '/packageA/report/detail?id=' + item.sys_workreportid,
+            })
+            if (item.readstatus == '未读') this.triggerEvent("onClick", item)
+        }
+    }
+})

+ 4 - 0
packageA/report/modules/list/index.json

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

+ 50 - 0
packageA/report/modules/list/index.scss

@@ -0,0 +1,50 @@
+.item {
+    display: flex;
+    position: relative;
+    width: 690rpx;
+    background: #FFFFFF;
+    border-radius: 8rpx;
+    margin: 20rpx auto 0;
+    padding: 20rpx;
+    box-sizing: border-box;
+
+    .user {
+        flex: 1;
+
+        .name {
+            font-size: 30rpx;
+            color: #333333;
+        }
+
+        .text {
+            font-size: 24rpx;
+            color: #999999;
+        }
+    }
+
+    .template {
+        display: flex;
+        height: 80rpx;
+        align-items: center;
+        flex-shrink: 0;
+
+        text {
+            background: #F0F3FF;
+            border-radius: 8rpx;
+            font-size: 24rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #3874F6;
+            padding: 8rpx 16rpx;
+        }
+    }
+
+    .badge {
+        position: absolute;
+        top: 0;
+        right: 0;
+        width: 16rpx;
+        height: 16rpx;
+        background: #FF3B30;
+        border-radius: 50%;
+    }
+}

+ 15 - 0
packageA/report/modules/list/index.wxml

@@ -0,0 +1,15 @@
+<navigator url="#" class="item" wx:for="{{list}}" wx:key="sys_workreportid" data-item="{{item}}" bindtap="toDetail">
+    <view class="user">
+        <view class="name">
+            {{item.name}}<text class="text" style="margin-left: 20rpx;">{{item.createdate}}</text>
+        </view>
+        <view class="text" style="margin-top: 10rpx;">
+            {{item.position}} {{item.phonenumber}}
+        </view>
+    </view>
+    <view class="template">
+        <text>{{item.reportname}}</text>
+    </view>
+    <view class="badge" wx:if="{{item.readstatus=='未读'}}" />
+</navigator>
+<My_empty wx:if="{{!list.length}}" />

+ 51 - 0
packageA/report/modules/receive/index.js

@@ -0,0 +1,51 @@
+const _Http = getApp().globalData.http;
+Component({
+    properties: {
+
+    },
+    data: {
+        content: {
+            "pageNumber": 1,
+            "pageTotal": 1,
+            "pageSize": 20,
+            "where": {
+                "condition": "",
+                "sys_workreportmodelid": ""
+            }
+        },
+    },
+    methods: {
+        getList(init = false) {
+            let content = this.data.content;
+            if (init) content.pageNumber = 1;
+            if (content.pageNumber > content.pageTotal) return;
+            _Http.basic({
+                "id": "20230524103102",
+                content
+            }).then(res => {
+                console.log("我收到的", res)
+                if (res.msg != '成功') return wx.showToast({
+                    title: res.msg,
+                    icon: 'none',
+                    mask: true
+                })
+                content.pageTotal = res.pageTotal;
+                content.pageNumber = res.pageNumber + 1;
+                this.setData({
+                    list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
+                    content
+                })
+                getCurrentPages().find(v => v.__route__ == 'packageA/report/index').selectComponent('#ListBox').RefreshToComplete();
+            })
+        },
+        onRead({
+            detail
+        }) {
+            detail.readstatus = "已读"
+            let index = this.data.list.findIndex(v => v.sys_workreportid == detail.sys_workreportid)
+            this.setData({
+                [`list[${index}]`]: detail
+            })
+        }
+    }
+})

+ 6 - 0
packageA/report/modules/receive/index.json

@@ -0,0 +1,6 @@
+{
+    "component": true,
+    "usingComponents": {
+        "List": "../list/index"
+    }
+}

+ 1 - 0
packageA/report/modules/receive/index.scss

@@ -0,0 +1 @@
+/* packageA/report/modules/receive/index.wxss */

+ 1 - 0
packageA/report/modules/receive/index.wxml

@@ -0,0 +1 @@
+<List list="{{list}}" bind:onClick='onRead' />

+ 43 - 0
packageA/report/modules/sendOut/index.js

@@ -0,0 +1,43 @@
+const _Http = getApp().globalData.http;
+Component({
+    properties: {
+
+    },
+    data: {
+        content: {
+            "pageNumber": 1,
+            "pageTotal": 1,
+            "pageSize": 20,
+            "where": {
+                "condition": "",
+                "sys_workreportmodelid": ""
+            }
+        },
+        list: []
+    },
+    methods: {
+        getList(init = false) {
+            let content = this.data.content;
+            if (init) content.pageNumber = 1;
+            if (content.pageNumber > content.pageTotal) return;
+            _Http.basic({
+                "id": "20230524102802",
+                content
+            }).then(res => {
+                console.log("我发出的", res)
+                if (res.msg != '成功') return wx.showToast({
+                    title: res.msg,
+                    icon: 'none',
+                    mask: true
+                })
+                content.pageTotal = res.pageTotal;
+                content.pageNumber = res.pageNumber + 1;
+                this.setData({
+                    list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
+                    content
+                })
+                getCurrentPages().find(v => v.__route__ == 'packageA/report/index').selectComponent('#ListBox').RefreshToComplete();
+            })
+        }
+    }
+})

+ 6 - 0
packageA/report/modules/sendOut/index.json

@@ -0,0 +1,6 @@
+{
+    "component": true,
+    "usingComponents": {
+        "List": "../list/index"
+    }
+}

+ 1 - 0
packageA/report/modules/sendOut/index.scss

@@ -0,0 +1 @@
+/* packageA/report/modules/sendOut/index.wxss */

+ 1 - 0
packageA/report/modules/sendOut/index.wxml

@@ -0,0 +1 @@
+<List list="{{list}}" />