zhaoxiaohai 3 лет назад
Родитель
Сommit
7b04b97a1a

+ 89 - 2
packageA/project/modules/task/add.js

@@ -5,7 +5,6 @@ Page({
     },
     onLoad(options) {
         let content = JSON.parse(options.content);
-        this.setData({})
         _Http.basic({
             "id": 20221129152304,
             "content": {
@@ -14,17 +13,105 @@ Page({
             }
         }).then(res => {
             console.log("获取评估项", res)
-            content.actionnotes = ''
+            content.actionnotes = '';
+            let isUser = res.data[0].option ? true : false;
+            if (res.data[0].option) {
+                res.data.map(v => {
+                    v.sa_projtaskmag_optionsid = v.option[0].sa_projtaskmag_optionsid,
+                        v.score = v.option[0].score
+                })
+            } else {
+                res.data = [{
+                    option: {
+                        ...res.data
+                    },
+                    sa_projtaskmag_optionsid: res.data[0].sa_projtaskmag_optionsid,
+                    score: res.data[0].score,
+                    sa_project_partiesid: 0,
+                }]
+            }
             this.setData({
+                isUser,
                 taskname: options.taskname,
                 content,
                 list: res.data
             })
+            if (this.data.isUser) this.getTags();
+        });
+    },
+    changeOption(e) {
+        const {
+            id,
+            index,
+            score
+        } = e.currentTarget.dataset;
+        this.setData({
+            [`list[${index}].sa_projtaskmag_optionsid`]: id,
+            [`list[${index}].score`]: score,
         });
     },
+    /* 获取列表标签 */
+    getTags() {
+        let list = this.data.list,
+            ownerids = list.map(v => v.sa_customersid);
+        _Http.basic({
+            "id": 20221018102001,
+            "content": {
+                nocache: true,
+                "ownertable": "sa_customers",
+                ownerids
+            }
+        }).then(res => {
+            console.log("标签", res)
+            for (let key in res.data) {
+                let index = list.findIndex(v => v.sa_customersid == key);
+                if (index != -1) list[index].tags = res.data[key]
+            };
+            console.log(list)
+            this.setData({
+                list
+            })
+        })
+    },
     onInput(e) {
         this.setData({
             'content.actionnotes': e.detail.value
         })
+    },
+    submit() {
+
+        const that = this;
+        wx.showModal({
+            title: '提示',
+            content: '是否确认提交本次评估?',
+            complete: ({
+                confirm
+            }) => {
+                if (confirm) _Http.basic({
+                    "id": "20221128145004",
+                    "content": {
+                        ...that.data.content,
+                        option: that.data.list.map(v => {
+                            return {
+                                sa_project_partiesid: v.sa_project_partiesid,
+                                sa_projtaskmag_optionsid: v.sa_projtaskmag_optionsid,
+                                score: v.score
+                            }
+                        })
+                    }
+                }).then(res => {
+                    console.log('提交评估', res)
+                    wx.showToast({
+                        title: res.msg == '成功' ? '提交成功' : res.msg,
+                        icon: "none"
+                    });
+                    if (res.msg == '成功') setTimeout(() => {
+                        let page = getCurrentPages().find(v => v.__route__ == 'packageA/project/detail');
+                        if (page) page.selectComponent("#Task").getList(that.data.content.sa_projectid, true);
+                        wx.navigateBack();
+                    }, 300);
+                })
+            }
+        })
     }
 })

+ 86 - 1
packageA/project/modules/task/add.scss

@@ -18,6 +18,92 @@
     }
 }
 
+.client {
+    background-color: #fff;
+    padding-bottom: 20rpx;
+    margin-bottom: 20rpx;
+
+    .user {
+        display: flex;
+        width: 100vw;
+        height: 136rpx;
+        box-sizing: border-box;
+        padding: 20rpx 30rpx;
+
+        .portrait {
+            width: 96rpx;
+            height: 96rpx;
+            background: #E7EEFF;
+            border-radius: 16rpx;
+            text-align: center;
+            line-height: 96rpx;
+            font-size: 24rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #3874F6;
+            margin-right: 20rpx;
+            flex-shrink: 0;
+        }
+
+        .right {
+            height: 100%;
+            flex: 1;
+            width: 0;
+
+            .title {
+                font-size: 28rpx;
+                font-family: PingFang SC-Bold, PingFang SC;
+                font-weight: bold;
+                color: #333333;
+                height: 40rpx;
+                line-height: 40rpx;
+            }
+
+            .tag-box {
+                display: flex;
+                align-items: center;
+                width: 100%;
+
+                .datatag,
+                .systemtag {
+                    flex-shrink: 0;
+                    margin-top: 12rpx;
+                    background: #FAAB16;
+                    color: #ffffff;
+                    margin-right: 10rpx;
+                    display: flex;
+                    align-items: center;
+                    height: 36rpx;
+                    font-size: 20rpx;
+                    padding: 0 10rpx;
+                    border-radius: 20rpx;
+                    font-family: PingFang SC-Regular, PingFang SC;
+                }
+
+                .systemtag {
+                    background: #FA8C16;
+                }
+            }
+        }
+    }
+
+    .option {
+        display: flex;
+        justify-content: space-between;
+        width: 100vw;
+        padding: 0 30rpx;
+        box-sizing: border-box;
+        font-size: 24rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #666666;
+        margin-bottom: 20rpx;
+
+        view {
+            line-height: 34rpx;
+        }
+    }
+
+}
+
 .label {
     width: 750rpx;
     height: 80rpx;
@@ -44,7 +130,6 @@
     }
 }
 
-
 .footer {
     display: flex;
     justify-content: space-between;

+ 19 - 2
packageA/project/modules/task/add.wxml

@@ -8,7 +8,24 @@
 <view class="label">
     评估内容
 </view>
-
+<view class="client" wx:for="{{list}}" wx:key="item.sa_project_partiesid">
+    <view wx:if="{{isUser}}" class="user">
+        <view class="portrait">
+            {{item.type}}
+        </view>
+        <view class="right">
+            <view class="title line-1">{{item.enterprisename}}</view>
+            <view class="tag-box">
+                <view class="systemtag" wx:for="{{item.tags.systemtag}}" wx:key="item">{{item}}</view>
+                <view class="datatag" wx:for="{{item.tags.datatag}}" wx:key="item">{{item}}</view>
+            </view>
+        </view>
+    </view>
+    <navigator class="option" url="#" wx:for="{{item.option}}" wx:for-item="i" wx:for-index="in" wx:key="in" data-index="{{index}}" data-score="{{i.score}}" data-id="{{i.sa_projtaskmag_optionsid}}" catchtap="changeOption">
+        <view>{{i.optionname}}</view>
+        <van-checkbox value='{{item.sa_projtaskmag_optionsid==i.sa_projtaskmag_optionsid}}' icon-size="30rpx" />
+    </navigator>
+</view>
 
 <view class="label">
     评估说明
@@ -20,5 +37,5 @@
 <view style="height: 130rpx;" />
 <view class="footer">
     <view />
-    <van-button custom-class='but' disabled='{{result.length==0}}' bind:click="submit">确定</van-button>
+    <van-button custom-class='but' disabled='{{!content.actionnotes}}' bind:click="submit">确定</van-button>
 </view>