Ver código fonte

提交尝试线上调试

Lijy 2 anos atrás
pai
commit
706a5d81cf

+ 58 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -589,6 +589,14 @@
                             <el-input v-model="domain.content" type="textarea" :rows="4" :placeholder="$t('defaultText.pleaseFillOut')" clearable style="width:75%;margin-right:7%"
                             :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"></el-input>
                         </el-form-item>
+                        <!-- 拍照上传 -->
+                        <el-form-item label="拍照上传" v-if="user.companyId == '7' || user.companyId == '10'">
+                            <div class="photos">
+                                <div @click="addImg(index)" class="photos_img">
+                                    <img src="../../assets/image/aacbc.png" />
+                                </div>
+                            </div>
+                        </el-form-item>
                         </div>
                         <!--多个工作事项填报的情况 -->
                         <div v-if="reportTimeType.multiWorktime==1">
@@ -2105,6 +2113,44 @@
                     })
                 })
             },
+            // 图片上传
+            addImg(index) {
+                var that = this;
+                wx.chooseImage({
+                    count: 3, // 默认9
+                    sizeType: ['compressed'],
+                    sourceType: ['album'],
+                    defaultCameraMode: "batch",
+                    success: function (res) {
+                        console.log(res, '数据')
+                        var localIds = res.localIds;
+                        if (that.workForm.domains[index].pics == null) {
+                            that.workForm.domains[index].pics = [];
+                            that.workForm.domains[index].iospics = [];
+                        }
+                        if (that.user.companyId == 7) {
+                            that.workForm.domains[index].pics = that.workForm.domains[index].pics.concat(localIds); 
+                        } else {
+                            that.workForm.domains[index].pics = localIds;
+                        }
+                        that.$forceUpdate(); 
+                        if (that.workForm.domains[index].serverPics == null) {
+                            that.workForm.domains[index].serverPics = [];
+                        }
+                        for (var i=0;i<localIds.length; i++) {
+                            wx.uploadImage({
+                                localId: localIds[i], // 需要上传的图片的本地ID,由chooseImage接口获得
+                                isShowProgressTips: 1, // 默认为1,显示进度提示
+                                success: function (res) {
+                                    var serverId = res.serverId; // 返回图片的服务器端ID
+                                    // serverIdList.push(serverId);
+                                    that.workForm.domains[index].serverPics.push(serverId);
+                                }
+                            });
+                        }
+                    }
+                })
+            },
             test(){
                 console.log('test',this.workForm.domains);
             },
@@ -6684,6 +6730,18 @@
 </script>
 
 <style lang="scss" scoped>
+.photos {
+    position: relative;
+}
+.photos_img {
+    width: 120px;
+    height: 120px;
+    cursor: pointer;
+    img {
+        width: 100%;
+        height: 100%;
+    }
+}
 .paginatis {
     padding: 10px 10px;
     background: #f2f2f2;