mg
2022-10-27 0a1d2fe85a280f5543b9b3241aaf8d8a39a32f8c
src/views/operate/disposal/casepool/dispatch/updateUser/uploadResult/components/book/index.vue
@@ -7,8 +7,8 @@
                    <!-- 文书种类 -->
                    <el-form-item label="文书种类:" prop="writType">
                        <el-select v-model="book.writType" placeholder="请输入文书种类">
                            <el-option v-for="item in kindList" :key="item.value" :label="item.label"
                                :value="item.value">
                            <el-option v-for="item in kindList" :key="item.id" :label="item.name"
                                :value="item.id">
                            </el-option>
                        </el-select>
                    </el-form-item>
@@ -59,7 +59,7 @@
                        </div>
                        <div class="upload" v-if="book.writPic.length<4">
                            <el-upload :file-list="fileList" class="upload-demo"
                                action="http://42.193.1.25:8082/sccg/file/medias" multiple :show-file-list="false"
                                action="/sccg/file/medias" multiple :show-file-list="false"
                                :limit="4" :on-success="handleSuccess1" :headers="getToken()">
                                <i class="el-icon-plus"></i>
                            </el-upload>
@@ -78,7 +78,7 @@
                        </div>
                        <div class="upload" v-if="book.originalPic.length<4">
                            <el-upload :file-list="fileList" class="upload-demo"
                                action="http://42.193.1.25:8082/sccg/file/medias" multiple :show-file-list="false"
                                action="/sccg/file/medias" multiple :show-file-list="false"
                                :limit="4" :on-success="handleSuccess2" :headers="getToken()">
                                <i class="el-icon-plus"></i>
                            </el-upload>
@@ -89,19 +89,20 @@
                <!-- 整改后照片 -->
                <el-form-item label="整改后照片:" prop="rectifiedPic">
                    <div class="upImg">
                        <div class="img-list" v-if="book.rectifiedPic.length!==0">
                        <!-- <div class="img-list" v-if="book.rectifiedPic.length!==0">
                            <div class="img" v-for="(item,index) in book.rectifiedPic" :key="index">
                                <img :src="item" alt="">
                                <i class="el-icon-close myicon" @click="handleRemove(index,3)"></i>
                            </div>
                        </div>
                        <div class="upload" v-if="book.rectifiedPic.length<4">
                        </div> -->
                        <!-- <div class="upload" v-if="book.rectifiedPic.length<4">
                            <el-upload :file-list="fileList" class="upload-demo"
                                action="http://42.193.1.25:8082/sccg/file/medias" multiple :show-file-list="false"
                                action="/sccg/file/medias" multiple :show-file-list="false"
                                :limit="4" :on-success="handleSuccess3" :headers="getToken()">
                                <i class="el-icon-plus"></i>
                            </el-upload>
                        </div>
                        </div> -->
                        <MyUpload  @setPictureUrl="setPicUrl" @delPictureUrl="delPicUrl"></MyUpload>
                        <div class="tip">{{book.rectifiedPic.length}} / 4</div>
                    </div>
                </el-form-item>
@@ -116,7 +117,7 @@
                        </div>
                        <div class="upload" v-if="book.otherPic.length<4">
                            <el-upload :file-list="fileList" class="upload-demo"
                                action="http://42.193.1.25:8082/sccg/file/medias" multiple :show-file-list="false"
                                action="/sccg/file/medias" multiple :show-file-list="false"
                                :limit="4" :on-success="handleSuccess4" :headers="getToken()">
                                <i class="el-icon-plus"></i>
                            </el-upload>
@@ -129,7 +130,12 @@
    </div>
</template>
<script>
import {getCodeList} from '@/utils/helper'
import MyUpload from "@/components/myUpload"
export default {
    components: {
        MyUpload
    },
    data() {
        const checkKind = (rule, value, callback) => {
            if (value) {
@@ -296,36 +302,31 @@
        }
    },
    created() {
        console.log(this.book.writPic)
        const {getBookType} = this
        getBookType();
    },
    props: ['caseId', 'closeDialog'],
    methods: {
        handleSuccess1(res, file, filelist) {
            const baseUrl = 'http://140.143.152.226:8410/';
            console.log(res);
            // this.$set(this.book, 'writPic', baseUrl + res.data.url1);
            // console.log(this.book.writPic);
            if (this.book.writPic.length < 4) {
                this.book.writPic.push(baseUrl + res.data.url1)
            }
        },
        handleSuccess2(res, file, filelist) {
            const baseUrl = 'http://140.143.152.226:8410/';
            console.log(res);
            if (this.book.originalPic.length < 4) {
                this.book.originalPic.push(baseUrl + res.data.url1)
            }
        },
        handleSuccess3(res, file, filelist) {
            const baseUrl = 'http://140.143.152.226:8410/';
            console.log(res);
            if (this.book.rectifiedPic.length < 4) {
                this.book.rectifiedPic.push(baseUrl + res.data.url1)
            }
        },
        handleSuccess4(res, file, filelist) {
            const baseUrl = 'http://140.143.152.226:8410/';
            console.log(res);
            if (this.book.otherPic.length < 4) {
                this.book.otherPic.push(baseUrl + res.data.url1)
            }
@@ -349,6 +350,27 @@
                this.book.otherPic.splice(index, 1);
            }
        },
            // 设置上传成功之后的图片地址
            setPicUrl({ url }) {
            const baseUrl = 'http://140.143.152.226:8410/';
            if (this.book.originalPic.length < 4) {
                this.book.originalPic.push(baseUrl + url)
            }
            console.log(url);
        },
        //删除图片
        delPicUrl({url}){
            const baseUrl = 'http://140.143.152.226:8410/';
            console.log(url);
            this.book.originalPic.splice(this.book.originalPic.indexOf(baseUrl + url),1);
            console.log(this.book.originalPic);
        },
        // 获取文书种类
        async getBookType(){
            let arr
            arr = await getCodeList('15');
            this.kindList = arr;
        }
    },
    watch: {
@@ -428,6 +450,7 @@
        .img {
            height: 60px;
            position: relative;
            margin-right: 10px;
        }
        .myicon {