123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460 |
- <!--整改-->
- <template>
- <div class="page-container initiateInspect-rectificationComponent">
- <!--当前整改-->
- <el-form class="add-form-box" :model="addForm" ref="addForm" :rules="rules" label-width="110px">
- <p class="content-right-title-min-p">
- 隐患整改
- <span :class="itemShowType?'el-icon-arrow-down':'el-icon-arrow-up'" @click="itemShowButton()"></span>
- </p>
- <div v-if="itemShowType" style="margin-top:20px;">
- <el-form-item label="整改结果" prop="rectifyResult">
- <div class="right-text-box">
- <div :class="addForm.rectifyResult == 1?'right-check-box':'right-no-check-box'" @click="checkButton(1)">
- <div>
- <p></p>
- </div>
- <p class="right-check-title-p">已整改</p>
- </div>
- <div :class="addForm.rectifyResult == 0?'right-check-box':'right-no-check-box'" @click="checkButton(0)">
- <div>
- <p></p>
- </div>
- <p class="right-check-title-p">暂无法整改</p>
- </div>
- </div>
- </el-form-item>
- <el-form-item label="整改措施" prop="rectifyMeasure">
- <el-input placeholder="立整立改的请填写相关文字及整改前后照片对比等,不能立整立改的请说明因并附整改计划、措施等" maxlength='500' type="textarea" style="width:704px;"
- resize="none" v-model="addForm.rectifyMeasure" :show-word-limit="true" :rows="3"></el-input>
- </el-form-item>
- <el-form-item label="现场照片" prop="rectifyUploadList">
- <div class="snapshotManagement-for-img-box" v-for="(img,imgIndex) in addForm.rectifyUploadList" :key="imgIndex">
- <img class="for-img" :src="img.fileUrl" @click="lookImg(addForm.rectifyUploadList,imgIndex)">
- <p class="for-del-button el-icon-circle-close" @click="delImg(imgIndex)"></p>
- </div>
- <el-upload
- v-if="addForm.rectifyUploadList.length<6"
- style="display: inline-block;overflow: hidden"
- class="avatar-uploader"
- :action="uploadImgUrl"
- :show-file-list="false"
- :on-success="(res)=>handleAvatarSuccess('img',res)"
- :headers="headers"
- :before-upload="(res)=>beforeAvatarUpload('img',res)">
- <p class="el-icon-plus up-img-p" style="display: inline-block"></p>
- </el-upload>
- <p class="up-img-text">支持jpg/png/bmp/gif格式,且不超过2M,最多上传6张</p>
- </el-form-item>
- <!--<div v-if="addForm.rectifyResult == 0">-->
- <!--<el-form-item label="整改方案" prop="rectifyMaterialUrl">-->
- <!--<div class="up-file-button" v-if="!addForm.rectifyMaterialUrl">-->
- <!--<el-upload-->
- <!--v-if="addForm.rectifyUploadList.length<6"-->
- <!--style="display: inline-block;overflow: hidden"-->
- <!--class="avatar-uploader"-->
- <!--:action="uploadImgUrl"-->
- <!--:show-file-list="false"-->
- <!--:on-success="(res)=>handleAvatarSuccess('file',res)"-->
- <!--:headers="headers"-->
- <!--:before-upload="(res)=>beforeAvatarUpload('file',res)">-->
- <!--<p class="up-file-min-button">+ 上传文件</p>-->
- <!--</el-upload>-->
- <!--<p class="up-file-text">支持docx/xlsx/pdf格式文件</p>-->
- <!--</div>-->
- <!--<div class="up-file-box" v-if="addForm.rectifyMaterialUrl">-->
- <!--<img src="@/assets/ZDimages/safetyCheck/icon_dr_wj.png">-->
- <!--<p @click="lookFile">{{addForm.rectifyMaterialName}}</p>-->
- <!--<p class="el-icon-close" @click="delFileButton"></p>-->
- <!--</div>-->
- <!--</el-form-item>-->
- <!--</div>-->
- </div>
- </el-form>
- </div>
- </template>
- <script>
- import { getToken } from "@/utils/auth";
- export default {
- name: 'rectificationComponent',
- props:{
- rectificationComponentPropsData:{},
- },
- data(){
- return{
- loading:false,
- //上传相关
- uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
- headers: {
- Authorization:getToken(),
- },
- //图片组件数据
- fullScreenViewProps:[],
- itemShowType:true,
- addForm:{
- rectifyResult:null,
- rectifyMeasure:'',
- rectifyUploadList:[],
- rectifyMaterialUrl:'',
- },
- rules:{
- rectifyResult: [
- { required: true, message: "请选择整改结果", trigger: "blur" },
- ],
- rectifyMeasure: [
- { required: true, message: "请输入整改措施", trigger: "blur" },
- { required: true, message: "请输入整改措施", validator: this.spaceJudgment, trigger: "blur" }
- ],
- rectifyUploadList: [
- { required: true, message: "请上传现场照片", trigger: "blur" },
- ],
- rectifyMaterialUrl: [
- { required: true, message: "请上传整改方案", trigger: "blur" },
- ],
- },
- upDataName:'',
- }
- },
- created(){
- },
- mounted(){
- },
- methods:{
- submitData(){
- return new Promise(resolve=>{
- this.$refs["addForm"].validate(valid => {
- if (valid) {
- resolve(this.addForm)
- }
- })
- })
- },
- //子项展开隐藏按钮
- itemShowButton(){
- this.$set(this,'itemShowType',!this.itemShowType);
- },
- //整改选择按钮
- checkButton(type){
- if(this.addForm.rectifyResult != type){
- this.$set(this.addForm,'rectifyResult',type);
- this.$forceUpdate();
- }
- },
- /*==========上传相关==========*/
- handleAvatarSuccess(srt,res) {
- this.$set(this,'loading',false);
- if(srt == 'img'){
- if(this.addForm.rectifyUploadList.length>5){
- this.msgError('最多只可上传6张')
- return
- }
- let suffixName= this.upDataName.split('.')[this.upDataName.split('.').length - 2]
- //判断文件名中是否有逗号和分号
- if(suffixName.indexOf(',')==-1 && suffixName.indexOf(';')==-1){
- }else{
- this.msgError('文件名里包含逗号或分号,请修改后重新上传!')
- return
- }
- let obj ={
- fileName:this.upDataName,
- fileUrl:res.data.url,
- fileType:2,
- };
- this.addForm.rectifyUploadList.push(obj);
- } else if(srt == 'file'){
- this.$set(this,'loading',false);
- let suffixName= this.upDataName.split('.')[this.upDataName.split('.').length - 2]
- //判断文件名中是否有逗号和分号
- if(suffixName.indexOf(',')==-1 && suffixName.indexOf(';')==-1){
- }else{
- this.msgError('文件名里包含逗号或分号,请修改后重新上传!')
- return
- }
- this.$set(this.addForm,'rectifyMaterialUrl',res.data.url);
- this.$set(this.addForm,'rectifyMaterialName',suffixName);
- }
- this.$forceUpdate()
- },
- beforeAvatarUpload(srt,file) {
- if(srt == 'img'){
- if(this.addForm.rectifyUploadList.length>5){
- this.msgError('最多只可上传6张')
- return false
- }
- let type = false;
- if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/jpg' || file.type == 'image/gif' || file.type == 'image/bmp') {
- if(file.size> 2100000){
- this.msgError('上传图片大小不能超过2M')
- return false
- }
- this.$set(this,'loading',true);
- this.upDataName = file.name;
- type = true;
- }else{
- this.msgError('仅支持jpeg/jpg/png/bmp/gif格式')
- type = false;
- }
- return type;
- }else if(srt == 'file'){
- let type = false;
- let num = 0;
- for(let i=0;i<file.name.length;i++){
- if(file.name[i] == '.'){
- num++
- }
- }
- if(num != 1){
- this.msgError('文件名称不能包含 " . "')
- return false
- }
- if (file.type == 'application/pdf' || file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' || file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
- if(file.size> 5250000){
- this.msgError('上传大小不能超过5M')
- return false
- }
- this.$set(this,'loading',true);
- this.upDataName = file.name;
- type = true;
- }else{
- this.msgError('只能上传docx/xlsx/pdf格式');
- type = false;
- }
- return type;
- }
- },
- //删除文件
- delFileButton(){
- this.$set(this.addForm,'rectifyMaterialUrl','');
- this.$set(this.addForm,'rectifyMaterialName','');
- },
- //删除照片
- delImg(imgIndex){
- this.addForm.rectifyUploadList.splice(imgIndex,1);
- },
- //照片预览
- lookImg(list,index){
- this.$parent.fullScreenViewClick(list,index);
- },
- //文件预览
- lookFile(){
- let obj = {
- fileName:this.addForm.rectifyMaterialName,
- fileUrl:this.addForm.rectifyMaterialUrl,
- };
- this.$parent.fullScreenFileLookClick(obj);
- },
- },
- }
- </script>
- <style scoped lang="scss">
- .initiateInspect-rectificationComponent{
- .add-form-box{
- border:1px solid #E0E0E0;
- border-top:none;
- .content-right-title-min-p{
- line-height:40px;
- background: #F5F5F5;
- padding-left:23px;
- border-top:1px solid #E0E0E0;
- border-bottom:1px solid #E0E0E0;
- span{
- float: right;
- font-size:20px;
- line-height:40px;
- margin-right:20px;
- cursor: pointer;
- }
- }
- .right-text-box{
- display: flex;
- .right-text-name-p{
- width:90px;
- line-height:40px;
- text-align: right;
- margin-right:14px;
- font-size:16px;
- }
- .right-text-title-box{
- font-size:14px;
- width:300px;
- padding:10px 20px;
- background-color: #f5f5f5;
- border: 1px solid #E0E0E0;
- border-radius: 4px 4px 4px 4px;
- p{
- line-height:20px;
- /*单行省略号*/
- display:block;
- overflow:hidden;
- text-overflow:ellipsis;
- white-space:nowrap;
- }
- }
- .right-text-text-box{
- font-size:14px;
- width:300px;
- padding:10px 20px;
- background-color: #f5f5f5;
- border: 1px solid #E0E0E0;
- border-radius: 4px 4px 4px 4px;
- p{
- line-height:20px;
- }
- }
- .right-no-check-box{
- height:40px;
- margin-right:20px;
- overflow: hidden;
- display: flex;
- cursor: pointer;
- div{
- margin:13px 0 0;
- width:16px;
- height:16px;
- border:1px solid #999;
- border-radius:50%;
- p{
- height:10px;
- width:10px;
- margin:2px;
- border-radius:50%;
- }
- }
- .right-check-title-p{
- margin-left:8px;
- height:40px;
- line-height:40px;
- color:#333;
- font-size:16px;
- }
- }
- .right-check-box{
- height:40px;
- margin-right:20px;
- overflow: hidden;
- display: flex;
- cursor: pointer;
- div{
- margin:13px 0 0;
- width:16px;
- height:16px;
- border:1px solid #0183FA;
- border-radius:50%;
- p{
- height:10px;
- width:10px;
- margin:2px;
- border-radius:50%;
- background-color: #0183FA;
- }
- }
- .right-check-title-p{
- margin-left:8px;
- height:40px;
- line-height:40px;
- color:#0183FA;
- font-size:16px;
- }
- }
- img{
- cursor: pointer;
- display: block;
- width:100px;
- height:100px;
- margin-right:20px;
- }
- }
- ::v-deep .snapshotManagement-for-img-box{
- width:80px;
- height:80px;
- border-radius:4px;
- display: inline-block;
- overflow: hidden;
- margin-right:20px;
- position: relative;
- .for-img{
- width:80px;
- height:80px;
- display: inline-block;
- overflow: hidden;
- }
- .for-del-button{
- background: rgba(0,0,0,0.7);
- width:20px;
- height:20px;
- line-height: 20px;
- text-align: center;
- color:#fff;
- border-bottom-left-radius:4px;
- cursor: pointer;
- position: absolute;
- top:0;
- right:0;
- }
- }
- ::v-deep .up-img-p{
- height:80px;
- width:80px;
- line-height:80px;
- text-align: center;
- font-size:16px;
- border-radius:4px;
- border:1px dashed #E0E0E0;
- }
- .up-img-text{
- line-height:40px;
- font-size:14px;
- color:#999;
- }
- .up-file-button{
- display: flex;
- }
- .up-file-min-button{
- border:1px solid #0183FA;
- color:#0183FA;
- border-radius:4px;
- height:30px;
- line-height:30px;
- width:100px;
- text-align: center;
- margin:5px 20px 0 0;
- }
- .up-file-text{
- color:#999;
- height:40px;
- line-height:40px;
- }
- .up-file-box{
- display: flex;
- height:40px;
- img{
- margin-top:12px;
- width:16px;
- height:16px;
- display: block;
- }
- p:nth-child(2){
- line-height:40px;
- font-size:14px;
- margin:0 30px 0 15px;
- cursor: pointer;
- }
- p:nth-child(3){
- cursor: pointer;
- color:red;
- font-size:16px;
- height:16px;
- width:16px;
- line-height:16px;
- margin-top:12px;
- text-align: center
- }
- }
- }
- }
- </style>
|