lct
Your Name
2022-09-01 3947c8a497ac1b08399cebd7b81ce387332fbba9
src/views/doublePreventAction/hiddenDanger/hiddenDangerReform/rectify/components/rectifyDialog.vue
@@ -44,6 +44,42 @@
                            <el-input class="analyseUnit_input" type="number" v-model="dataForm.cost" readonly> </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                        <el-form-item label="隐患上报图" prop="img">
                            <el-image
                                class="upload-img img-wrapper"
                                v-for='item in fileOneList'
                                :key='item.$index'
                                :src="item"
                                :preview-src-list="fileOneList"
                            >
                            </el-image>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                        <el-form-item label="隐患整改图" prop="img">
                            <el-image
                                class="upload-img img-wrapper"
                                v-for='item in fileTwoList'
                                :key='item.$index'
                                :src="item"
                                :preview-src-list="fileTwoList"
                            >
                            </el-image>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                        <el-form-item label="隐患验收图" prop="img">
                            <el-image
                                class="upload-img img-wrapper"
                                v-for='item in fileThreeList'
                                :key='item.$index'
                                :src="item"
                                :preview-src-list="fileThreeList"
                            >
                            </el-image>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
@@ -60,6 +96,47 @@
                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                        <el-form-item label="整改时间" prop="applyTime">
                            <el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss" class="analyseUnit_input" v-model="rectifyForm.applyTime" placeholder="请选择整改时间" clearable> </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                        <el-form-item label="隐患整改图" prop="img">
                            <el-upload
                                accept=".pdf,.jpg,.png"
                                :action="fileRoad"
                                class="upload-demo"
                                ref="upload"
                                :headers="header"
                                :data="uploadForm"
                                list-type="picture-card"
                                :file-list="fileList"
                                v-model="dataForm.paths"
                                :on-change="handleChangeFile"
                                :on-success="onFileSuccess"
                                :multiple="false"
                                :auto-upload="true">
                                <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="handleFile(file)"
                                >
                                  <i class="el-icon-zoom-in"></i>
                                </span>
                                <span
                                    v-if="!disabled"
                                    class="el-upload-list__item-delete"
                                    @click="handleRemove(file,file.$index)"
                                >
                                  <i class="el-icon-delete"></i>
                                </span>
                              </span>
                                </div>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                </el-row>
@@ -99,16 +176,18 @@
    import {getDepartmentList} from "../../../../../../api/departmentManage";
    import {safetyInspectionItemName} from "../../../../../../api/safetySelfInspection";
    import {delayHiddenDangerReport, submitHiddenDangerReport} from "../../../../../../api/hiddenDanger";
    import Cookies from "_js-cookie@2.2.0@js-cookie";
    export default {
        name: "rectifyDialog",
        data(){
            return {
                disabled:false,
                dialogFormVisible:false,
                baseUrl: process.env.BASE_API + 'hiddenDanger/report',
                headers: {
                    'Authorization': getToken()
                fileRoad:process.env.BASE_API + '/task/web/upload',
                uploadForm:{
                },
                header:{Authorization:''},
                userList:[],
                departmentList:[],
                rectifyTypeList: [
@@ -118,6 +197,9 @@
                imgPreviewUrls:[],
                imgPreviewUrls2:[],
                fileList:[],
                fileOneList:[],
                fileTwoList:[],
                fileThreeList:[],
                isView:false,
                submiting:false,
                dataFormRules:{},
@@ -144,7 +226,8 @@
                    id: null,
                    dangerManagerId: null,
                    rectifyInfo: null,
                    applyTime: null
                    applyTime: null,
                    rectifyImages:[]
                },
                delayForm: {
                    id: null,
@@ -199,6 +282,15 @@
                }else{
                    this.dialogFormVisible = true
                    this.dataForm = row
                    this.fileOneList = row.reportImages.map(item => {
                        return  process.env.IMG_API + item
                    })
                    this.fileTwoList = row.rectifyImages.map(item => {
                        return  process.env.IMG_API + item
                    })
                    this.fileThreeList = row.acceptImages.map(item => {
                        return  process.env.IMG_API + item
                    })
                }
            },
@@ -206,6 +298,9 @@
            submitRectify () {
                this.$refs['rectifyFormRef'].validate( async(valid) => {
                    if (valid) {
                        this.rectifyForm.rectifyImages = this.fileList.map(item => {
                            return item.url.substring(process.env.IMG_API.length)
                        })
                        let res = await submitHiddenDangerReport(this.rectifyForm);
                        if (res.data.code === '200') {
                            this.$message({
@@ -313,8 +408,40 @@
                }
            },
            handleChange(file, fileList) {
                this.fileList = fileList
            handleChangeFile(){
                this.header.Authorization = Cookies.get('token')
            },
            onFileSuccess(response){
                if(response.code === '200'){
                    this.fileList.push({url:process.env.IMG_API + response.result.path})
                    this.$notify({
                        type:'success',
                        duration:2000,
                        message:'上传成功',
                        title:'成功',
                    })
                }else{
                    this.$message({
                        message:res.data.message,
                        type:'warning'
                    })
                }
            },
            handleFile(file){
                this.dialogImageUrl = file.url;
                this.dialogVisible = true;
            },
            showImg(file){
                window.open(file, '_blank')
            },
            handleRemove(file,value){
                return this.$confirm(`确定移除 ${ file.uid }?`,'提示',{
                    confirmButtonText:'确定',
                    cancelButtonText:'取消',
                    type:'warning',
                }).then(()=> {
                    this.fileList.splice(value,1)
                })
            },
        }
    }
@@ -331,4 +458,15 @@
.analyseUnit_box{
    width:200px;
}
.img-wrapper{
    width:100px;
    height: 100px;
    margin: 10px;
    border-radius: 2px
}
.img-wrapper:first-child{
    margin-left: unset !important;
}
</style>