فهرست منبع

提交概览中要显示出自定义字段,并编辑时也要支持修改

Lijy 1 سال پیش
والد
کامیت
2392462310

+ 171 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/project/info.vue

@@ -59,6 +59,20 @@
                         <el-col :span="5" ><span class="gray_label">{{yonghuUser.customDegreeName}}:</span></el-col>
                         <el-col :span="18" ><span>{{project.associateDegreeNames}}</span></el-col>
                     </el-row>
+
+                    <div v-if="user.timeType.projectCustom">
+                        <el-row :gutter="10" v-for="(item,index) in dataListTwo" :key="index">
+                            <el-col :span="5" ><span class="gray_label">{{ item.customName }}:</span></el-col>
+                            <el-col :span="18" v-if="item.customType != 1">
+                                <span>{{item.value}}</span>
+                            </el-col>
+                            <el-col :span="18" v-if="item.customType == 1">
+                                <viewer :images="item.value" class="detailsPicture">
+                                    <img :src="list.url" alt="" v-for="list,idx in item.value" :key="idx">
+                                </viewer>
+                            </el-col>
+                        </el-row>
+                    </div>
                     
 
                     <!-- this.project  -->
@@ -420,6 +434,46 @@
                         <el-input v-model="addForm.projectSeparate.projectCategorySub" :placeholder="$t('peaseenterthe')" maxlength="50" show-word-limit clearable></el-input>
                     </el-form-item>
                 </div> -->
+
+                <!-- 用户自己定义的字段 -->
+                <div style="margin-top: 20px" v-if="dataList.length > 0 && user.timeType.projectCustom">
+                    <el-form-item v-for="(item, index) in dataList" :key="item.id" :label="item.customName">
+                        <div v-if="item.customType == 0">
+                            <el-input v-model="item.value" clearable placeholder="请输入内容" @input="ipts(item.value, index)"></el-input>
+                        </div>
+                        <div v-if="item.customType == 1">
+                            <el-upload
+                                list-type="picture-card"
+                                ref="upload" :file-list="item.value" :action="index" :auto-upload="true" :limit="2" :disabled="item.valuelist.length == '2'" :http-request="fileUpload">
+                                    <i slot="default" class="el-icon-plus"></i>
+                                    <div slot="file" slot-scope="{file}">
+                                    <img
+                                        class="el-upload-list__item-thumbnail"
+                                        :src="file.url" alt=""
+                                    >
+                                    <span class="el-upload-list__item-actions">
+                                        <span
+                                        class="el-upload-list__item-preview"
+                                        @click="handlePictureCardPreview(file)"
+                                        >
+                                        <i class="el-icon-zoom-in"></i>
+                                        </span>
+                                        <span
+                                        v-if="!disabled"
+                                        class="el-upload-list__item-delete"
+                                        @click="handleRemove(file, index)"
+                                        >
+                                        <i class="el-icon-delete"></i>
+                                        </span>
+                                    </span>
+                                    </div>
+                                </el-upload>
+                        </div>
+                        <div v-if="item.customType == 2">
+                            <el-date-picker v-model="item.value" type="date" placeholder="请选择日期"  value-format="yyyy-MM-dd"></el-date-picker>
+                        </div>
+                    </el-form-item>
+                </div>
                
             </el-form>
             <div slot="footer" class="dialog-footer">
@@ -608,6 +662,10 @@
                 <el-button type="primary" @click="submitKeyNodeaddForm()">{{ $t('btn.determine') }}</el-button>
             </span>
         </el-dialog>
+        <!-- 图片放大弹窗 -->
+        <el-dialog :visible.sync="imgUrlListFlg" width="70%" :before-close="xhutDown">
+            <img width="100%" :src="imgUrlLists" alt="">
+        </el-dialog>
         
         <!-- 按部门选择相关领导,弃用 -->
         <!-- <el-dialog title="选择相关领导"  v-if="chooseLeaderVisible" :visible.sync="chooseLeaderVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
@@ -671,6 +729,12 @@
     overflow: hidden;
     text-overflow: ellipsis;
 }
+.detailsPicture img{
+    display: inline-block;
+    width: 60px;
+    height: 60px;
+    margin-right: 10px;
+}
 </style>
 <script>
     // 自定义select组件
@@ -753,6 +817,12 @@
                 keyNodesList: [],
                 projectKeyNodesData: [],
                 keyNodeIsShow: false,
+
+                projectCustomList: [],
+                dataList: [],
+                dataListTwo: [],
+                imgUrlListFlg: false,
+                imgUrlLists: []
             };
         },
         filters: {
@@ -1636,6 +1706,16 @@
                                 formData.append("deptId", this.addForm.deptId[this.addForm.deptId.length - 1]);
                             }
                         }
+                        // 用户自己定义的字段
+                        for(var i in this.dataList) {
+                             var str = 'plate' + (+i + 1)
+                             if(this.dataList[i].customType != '1') {
+                                 formData.append(str,this.dataList[i].value==null?'':this.dataList[i].value);
+                             } else {
+                                formData.append(str,this.dataList[i].valuelist.join('@'));
+                             }
+                         }
+                         
                         // return
                         this.http.uploadFile(this.port.project.add,formData,
                         res => {
@@ -1667,6 +1747,7 @@
             
             showEdit() {
                 this.addForm = JSON.parse(JSON.stringify(this.project));
+                this.dataList = JSON.parse(JSON.stringify(this.dataListTwo));
                 // console.log('---'+this.project);
                 // console.log(this.addForm.projectCode);
                 
@@ -1909,9 +1990,10 @@
                         } else {
                             this.project = res.data;
                         }
-                        // console.log('看看值')
-                        // console.log('test123',this.project);
                         this.participator = this.project.participationList;
+                        if(this.user.timeType.projectCustom) {
+                            this.chulishuju(this.project)
+                        }
                     } else {
                         this.$message({
                         message: res.msg,
@@ -1928,6 +2010,64 @@
                 });
                 this.getProjectProfessionList();
             },
+            // 获取表单设置
+            getProjectCustom() {
+                this.http.post('/project-custom/getProjectCustom', {},
+                res => {
+                    if (res.code == "ok") {
+                        var yaunz = []
+                        for(var i in res.data) {
+                            if(res.data[i].customType == '1') {
+                                this.$set(res.data[i], 'value', [])
+                                this.$set(res.data[i], 'valuelist', [])
+                            } else {
+                                this.$set(res.data[i], 'value', '')
+                                this.$set(res.data[i], 'valuelist', [])
+                            }
+                            yaunz.push(res.data[i])
+                        }
+                        this.projectCustomList = yaunz
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                })
+            },
+            // 处理数据
+            chulishuju(data) {
+                let arrLists = JSON.parse(JSON.stringify(this.projectCustomList))
+                var arr = []
+                for(var s in arrLists) {
+                    for(var p in data.plateMap) {
+                        if(arrLists[s].customName == p && arrLists[s].customType != '1') {
+                            arrLists[s].value = data.plateMap[p]
+                        } 
+                        if(arrLists[s].customName == p && arrLists[s].customType == '1' && data.plateMap[p] != null && data.plateMap[p] != ''){
+                            var sel = data.plateMap[p].split(',')
+                            var live = []
+                            for(var dd in sel) {
+                                var obj = {}
+                                obj.name = p
+                                obj.url = '/upload/' + sel[dd]
+                                live.push(obj)
+                            }
+                            console.log('值值hi', this.pictureAddress)
+                            arrLists[s].value = live
+                            arrLists[s].valuelist = sel
+                        }
+                    }
+                }
+                this.dataList = arrLists
+                this.dataListTwo = JSON.parse(JSON.stringify(arrLists))
+                console.log(this.dataList, 8888)
+            },
             // 获取部门
             getDepartmentList() {
                 this.http.post( this.port.manage.depList, {},
@@ -2017,7 +2157,32 @@
                     }
                     this.addMembForm.userId = arr
                 }
-            }
+            },
+            ipts(i, item) {
+                this.$forceUpdate()
+            },
+            handlePictureCardPreview(file) {
+                console.log(file)
+                this.imgUrlLists = file.url;
+                this.imgUrlListFlg = true;
+                // this.$set(this, 'imgUrlListFlg', true)
+                // console.log(this.imgUrlListFlg)
+                this.$forceUpdate()
+            },
+            handleRemove(file, index) {
+                let uploadFiles = this.$refs.upload[0].uploadFiles
+                for (var i = 0; i < uploadFiles.length; i++) {
+                    if (uploadFiles[i]['url'] == file.url) {
+                        uploadFiles.splice(i, 1)
+                        this.dataList[index].valuelist.splice(i, 1)
+                    }
+                }
+            },
+            xhutDown(done) {
+                this.imgUrlListFlg = false
+                done()
+                this.$forceUpdate()
+            },
         },
         created() {
             // console.log('created===');
@@ -2029,6 +2194,9 @@
             };
         },
         mounted() {
+            if(this.user.timeType.projectCustom) {
+                this.getProjectCustom()
+            }
             // console.log('mounted===');
             this.curProjectId = parseInt(this.$route.params.id);
             this.getDepartment();

+ 3 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -3944,6 +3944,7 @@ a {
             // 处理数据
             chulishuju(data) {
                 console.log(data, 12345)
+                console.log(this.dataListBf, '看看')
                 let arrLists = JSON.parse(JSON.stringify(this.dataListBf))
                 var arr = []
                 for(var s in arrLists) {
@@ -3957,7 +3958,8 @@ a {
                             for(var dd in sel) {
                                 var obj = {}
                                 obj.name = p
-                                obj.url = this.pictureAddress + '/upload/' + sel[dd]
+                                // obj.url = this.pictureAddress + '/upload/' + sel[dd]
+                                obj.url = '/upload/' + sel[dd]
                                 live.push(obj)
                             }
                             console.log('值值hi', this.pictureAddress)