From 35c30ecf074b292e955d96df7a713a2166daff0e Mon Sep 17 00:00:00 2001
From: luobisheng <727299681@qq.com>
Date: 星期二, 22 十一月 2022 18:32:06 +0800
Subject: [PATCH] 上传处置结果处理

---
 src/views/operate/disposal/casepool/dispatch/updateUser/uploadResult/components/evidence/index.vue |  300 ++++++++----------------------------------------------------
 1 files changed, 40 insertions(+), 260 deletions(-)

diff --git a/src/views/operate/disposal/casepool/dispatch/updateUser/uploadResult/components/evidence/index.vue b/src/views/operate/disposal/casepool/dispatch/updateUser/uploadResult/components/evidence/index.vue
index dfad1d3..b4327cb 100644
--- a/src/views/operate/disposal/casepool/dispatch/updateUser/uploadResult/components/evidence/index.vue
+++ b/src/views/operate/disposal/casepool/dispatch/updateUser/uploadResult/components/evidence/index.vue
@@ -32,26 +32,13 @@
                 </el-form-item>
                 <!-- 鎯呭喌鎻忚堪 -->
                 <el-form-item label="澶勭疆缁撴灉:" prop="description">
-                    <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" maxlength="200" show-word-limit
+                    <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" maxlength="200" show-word-limit
                         v-model="evidence.description" placeholder="璇疯緭鍏ュ缃粨鏋�,闄愬埗200瀛椾互鍐�"></el-input>
                 </el-form-item>
                 <!-- 鐓х墖闄勪欢 -->
                 <el-form-item label="鐓х墖闄勪欢:" prop="pic">
                     <div class="upImg">
-                        <!-- <div class="img-list" v-if="evidence.pic.length!==0">
-                            <div class="img" v-for="(item,index) in evidence.pic" :key="index">
-                                <img :src="item" alt="">
-                                <i class="el-icon-close myicon" @click="handleRemove(index)"></i>
-                            </div>
-                        </div> -->
-                        <MyUpload  @setPictureUrl="setPicUrl" @delPictureUrl="delPicUrl"></MyUpload>
-                        <!-- <div class="upload" v-if="evidence.pic.length<4">
-                            <el-upload :file-list="fileList" class="upload-demo"
-                                action="/sccg/file/medias" multiple :show-file-list="false"
-                                :limit="4" :on-success="handleSuccess2" :headers="getToken()">
-                                <i class="el-icon-plus"></i>
-                            </el-upload>
-                        </div> -->
+                        <MyUpload :picture-list="evidence.pic" @setPictureUrl="setPicUrl" @delPictureUrl="delPicUrl"></MyUpload>
                         <div class="tip">{{evidence.pic.length}} / 4</div>
                     </div>
                 </el-form-item>
@@ -115,13 +102,11 @@
                     <div class="user-item">
                         <!-- 姘戞棌 -->
                         <el-form-item label="姘戞棌:" prop="nation">
-                            <!-- <el-select v-model="user.nation" placeholder="璇烽�夋嫨姘戞棌"> -->
                             <el-select v-model="user.nation" placeholder="璇烽�夋嫨">
                                 <el-option v-for="item in nationOptions" :key="item.id" :label="item.name"
                                     :value="item.id">
                                 </el-option>
                             </el-select>
-                            <!-- <el-input v-model="user.nation"></el-input> -->
                         </el-form-item>
                         <!-- 绫嶈疮 -->
                         <el-form-item label="绫嶈疮:" prop="nativePlace">
@@ -140,7 +125,7 @@
             </div>
             <div class="user-form-footer">
                 <el-button type="primary" @click="checkUser">纭畾</el-button>
-                <el-button>杩斿洖</el-button>
+                <el-button @click="userFlag = false">杩斿洖</el-button>
             </div>
         </div>
     </div>
@@ -154,48 +139,6 @@
         MyUpload
     },
     data() {
-        const checkName = (rule, value, callback) => {
-            if (value) {
-                callback()
-            } else {
-                callback(new Error('鎵垮姙闃熷憳鍚嶅瓧涓嶈兘涓虹┖'));
-            }
-        }
-        const checkName2 = (rule, value, callback) => {
-            if (value) {
-                callback()
-            } else {
-                callback(new Error('鍗忓姙闃熷憳鍚嶅瓧涓嶈兘涓虹┖'));
-            }
-        }
-        const checkTime2 = (rule, value, callback) => {
-            if (value) {
-                callback()
-            } else {
-                callback(new Error('姝ゅ鏃堕棿涓嶈兘涓虹┖'));
-            }
-        }
-        const checkAddress2 = (rule, value, callback) => {
-            if (value) {
-                callback()
-            } else {
-                callback(new Error('姝ゅ鍦板潃涓嶈兘涓虹┖'));
-            }
-        }
-        const checkCase = (rule, value, callback) => {
-            if (value) {
-                callback()
-            } else {
-                callback(new Error('妗堢敱涓嶈兘绌�'));
-            }
-        }
-        const checkDesc = (rule, value, callback) => {
-            if (value) {
-                callback()
-            } else {
-                callback(new Error('鎯呭喌鎻忚堪涓嶈兘涓虹┖'));
-            }
-        }
         const checkPic = (rule, value, callback) => {
             if (value.length !== 0) {
                 callback()
@@ -203,14 +146,7 @@
                 callback(new Error('璇蜂笂浼犵収鐗囬檮浠�'));
             }
         }
-        const checkIll = (rule, value, callback) => {
-            if (value) {
-                callback()
-            } else {
-                callback(new Error('妗堜欢绫诲瀷涓嶈兘涓虹┖'));
-            }
-        }
-        const checkName3 = (rule, value, callback) => {
+        const checkUserName = (rule, value, callback) => {
             if (value) {
                 validateName(value) ? callback() : callback(new Error('璇疯緭鍏ユ纭殑濮撳悕'))
             } else {
@@ -238,55 +174,6 @@
                 callback(new Error('璇佷欢鍙风爜涓嶈兘涓虹┖'));
             }
         }
-        const checkWh = (rule, value, callback) => {
-            if (value) {
-                callback()
-            } else {
-                callback(new Error('鏂囧寲绋嬪害涓嶈兘涓虹┖'));
-            }
-        }
-        // const checkCareer = (rule, value, callback) => {
-        //     if (value) {
-        //         callback()
-        //     } else {
-        //         callback();
-        //     }
-        // }
-        // const checkWork = (rule, value, callback) => {
-        //     if (value) {
-        //         callback()
-        //     } else {
-        //         callback(new Error('宸ヤ綔鍗曚綅鍙婅亴鍔′笉鑳戒负绌�'));
-        //     }
-        // }
-        const checkNation = (rule, value, callback) => {
-            if (value) {
-                callback()
-            } else {
-                callback(new Error('姘戞棌涓嶈兘涓虹┖'));
-            }
-        }
-        // const checkNaP = (rule, value, callback) => {
-        //     if (value) {
-        //         callback()
-        //     } else {
-        //         callback(new Error('绫嶈疮涓嶈兘涓虹┖'));
-        //     }
-        // }
-        const checkLiveAdd = (rule, value, callback) => {
-            if (value) {
-                callback()
-            } else {
-                callback(new Error('鐜颁綇鍧�涓嶈兘涓虹┖'));
-            }
-        }
-        // const checkRegAdd = (rule, value, callback) => {
-        //     if (value) {
-        //         callback()
-        //     } else {
-        //         callback(new Error('鎴风睄鎵�鍦ㄥ湴涓嶈兘涓虹┖'));
-        //     }
-        // }
         const checkFlag = (rule, value, callback) => {
             if (value) {
                 callback();
@@ -296,48 +183,24 @@
         }
         return {
             evidence: {
+                undertaker: null,
+                assistant: null,
+                investigationTime: null,
+                address: null,
+                caseAction: null,
+                description: null,
                 pic: [],
-                userInfo: '',
+                userInfo: null
             },
             evidenceRules: {
-                userInfo: [
-                    { trigger: 'change', validator: checkFlag }
-                ],
-                undertaker: [
-                    {
-                        trigger: 'blur', validator: checkName
-                    }
-                ],
-                assistant: [
-                    {
-                        trigger: 'blur', validator: checkName2
-                    }
-                ],
-                investigationTime: [
-                    {
-                        trigger: 'change', validator: checkTime2
-                    }
-                ],
-                address: [
-                    {
-                        trigger: 'blur', validator: checkAddress2
-                    }
-                ],
-                caseAction: [
-                    {
-                        trigger: 'blur', validator: checkCase
-                    }
-                ],
-                description: [
-                    {
-                        trigger: 'blur', validator: checkDesc
-                    }
-                ],
-                pic: [
-                    {
-                        trigger: 'blur', validator: checkPic
-                    }
-                ],
+                userInfo: [{ trigger: ['change', 'blur'], validator: checkFlag }],
+                undertaker: [{ trigger: ['change', 'blur'], message: '鎵垮姙闃熷憳鍚嶅瓧涓嶈兘涓虹┖', required: true }],
+                assistant: [{ trigger: ['change', 'blur'], message: '鍗忓姙闃熷憳鍚嶅瓧涓嶈兘涓虹┖', required: true }],
+                investigationTime: [{ trigger: ['change', 'blur'], message: '姝ゅ鏃堕棿涓嶈兘涓虹┖', required: true }],
+                address: [{ trigger: ['change', 'blur'], message: '姝ゅ鍦板潃涓嶈兘涓虹┖', required: true }],
+                caseAction: [{ trigger: ['change', 'blur'], message: '妗堢敱涓嶈兘绌�', required: true }],
+                description: [{ trigger: ['change', 'blur'], message: '鎯呭喌鎻忚堪涓嶈兘涓虹┖', required: true }],
+                pic: [{ trigger: ['change', 'blur'], validator: checkPic }],
             },
             fileList: [],
             user: {
@@ -355,66 +218,14 @@
                 registerAddress: '',
             },
             userRules: {
-                illegalType: [
-                    {
-                        trigger: 'change', validator: checkIll,
-                    }
-                ],
-                name: [
-                    {
-                        required:true,trigger: 'blur', validator: checkName3
-                    }
-                ],
-                phoneCode: [
-                    {
-                        required:true,trigger: 'blur', validator: checkPhone
-                    }
-                ],
-                certificateType: [
-                    {
-                        trigger: 'change', validator: checkCard
-                    }
-                ],
-                certificateCode: [
-                    {
-                        required:true,trigger: 'blur', validator: checkCode
-                    }
-                ],
-                educationDegree: [
-                    {
-                        trigger: 'change', validator: checkWh
-                    }
-                ],
-                // career: [
-                //     {
-                //         trigger: 'blur', validator: checkCareer
-                //     }
-                // ],
-                // work: [
-                //     {
-                //         trigger: 'blur', validator: checkWork
-                //     }
-                // ],
-                nation: [
-                    {
-                        trigger: 'change', validator: checkNation
-                    }
-                ],
-                // nativePlace: [
-                //     {
-                //         trigger: 'blur', validator: checkNaP
-                //     }
-                // ],
-                liveAddress: [
-                    {
-                        required:true,trigger: 'blur', validator: checkLiveAdd
-                    }
-                ],
-                // registerAddress: [
-                //     {
-                //         trigger: 'blur', validator: checkRegAdd
-                //     }
-                // ],
+                illegalType: [{ trigger: ['change', 'blur'], message: '妗堜欢绫诲瀷涓嶈兘涓虹┖', required: true }],
+                name: [{ required: true,trigger: ['change', 'blur'], validator: checkUserName }],
+                phoneCode: [{ required: true,trigger: ['change', 'blur'], validator: checkPhone }],
+                certificateType: [{ trigger: ['change', 'blur'], validator: checkCard }],
+                certificateCode: [{ required: true,trigger: ['change', 'blur'], validator: checkCode }],
+                educationDegree: [{ required: true, trigger: ['change', 'blur'], message: '鏂囧寲绋嬪害涓嶈兘涓虹┖' }],
+                nation: [{ required: true, trigger: ['change', 'blur'], message: '姘戞棌涓嶈兘涓虹┖' }],
+                liveAddress: [{ required: true, trigger: ['change', 'blur'], message: '鐜颁綇鍧�涓嶈兘涓虹┖' }],
             },
             userFlag: false,
             typeOptions: [
@@ -456,34 +267,23 @@
                     value: 4
                 },
             ],
-            basecase:""
+            basecase: null
         }
     },
-    created() {
-        this.getCardTypeList();
-        this.getSchoolList();
-        this.getNationList();
-        console.log(this.mytype);
+    async created() {
+        await this.getCardTypeList();
+        await this.getSchoolList();
+        await this.getNationList();
         this.user.illegalType = JSON.parse(JSON.stringify(this.mytype));
-        const {mycode}=this;
-        this.getEventInfo(mycode)
+        if (this.evienceData) {
+          this.evidence = this.evienceData;
+          this.evidence.pic = this.evidence.pic.split(',');
+          this.user = this.evidence.partyInfo;
+          this.evidence.investigationTime = this.evidence.createTime;
+          this.evidence.userInfo = this.evidence.partyInfo.name;
+        }
     },
     methods: {
-           // 鑾峰彇妗堜欢淇℃伅
-           async getEventInfo(mycode) {
-            await this.$axios({
-                method: 'get',
-                url: `sccg/base_case/baseCaseDetail/${mycode}`
-            })
-                .then(res => {
-                    if(this.mytype == 1){
-                        this.basecase = res.data.baseCase.violations.typeText;
-                    }else{
-                        this.basecase = res.data.baseCase.illegalBuilding.categoryText;
-                    }
-                    console.log(this.basecase)
-                })
-        },
         handleSuccess2(res, file, filelist) {
             const baseUrl = 'http://140.143.152.226:8410/';
             if (this.evidence.pic.length < 4) {
@@ -504,11 +304,8 @@
         },
         // 妫�楠寀ser
         checkUser() {
-            // console.log(this.$refs.userForm.validate);
             this.$refs.userForm.validate((valid) => {
-                console.log(valid);
                 if (valid) {
-                    this.evidence.userInfo = this.user.name;
                     this.userFlag = false;
                 } else {
                     this.evidence.userInfo = false;
@@ -547,31 +344,14 @@
             if (this.evidence.pic.length < 4) {
                 this.evidence.pic.push(baseUrl + url)
             }
-            console.log(url);
         },
         //鍒犻櫎鍥剧墖
         delPicUrl({url}){
             const baseUrl = 'http://140.143.152.226:8410/';
-            console.log(url);
             this.evidence.pic.splice(this.evidence.pic.indexOf(baseUrl + url),1);
-            console.log(this.evidence.pic);
         }
     },
-    watch: {
-        'evidence.pic.length': {
-            handler(newLen, oldLen) {
-                if (newLen !== 0) {
-                    this.$refs.evidenceForm.validate((valid) => {
-                        if (valid) {
-
-                        } else { return false }
-                    })
-                }
-            },
-            deep: true,
-        }
-    },
-    props:['mytype','mycode']
+    props:['mytype','mycode', 'evienceData']
 }
 </script>
 <style lang="scss" scoped>

--
Gitblit v1.8.0