| | |
| | | </el-col> |
| | | <el-col :span="5" style="text-align: center"> |
| | | <el-button type="primary" class="btns" icon="el-icon-search" @click="find()" |
| | | >搜索</el-button |
| | | >搜索 |
| | | </el-button |
| | | > |
| | | <el-button |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | @click="emergencyPlanC('', '新增')" |
| | | class="btns" |
| | | >新增</el-button |
| | | >新增 |
| | | </el-button |
| | | > |
| | | <el-button |
| | | type="primary" |
| | | class="btns" |
| | | @click="reset()" |
| | | >重置</el-button |
| | | >重置 |
| | | </el-button |
| | | > |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-table-column align="center" label="附件"> |
| | | <template slot-scope="scope"> |
| | | <div v-if="scope.row.fileType==0"> |
| | | <img :src="envUrl+scope.row.fileList[0].fileUrl" @click="showViewer=true" style="max-width: 100px;height: auto"/> |
| | | <img :src="envUrl+scope.row.fileList[0].fileUrl" @click="showViewer=true" |
| | | style="max-width: 100px;height: auto"/> |
| | | <el-image-viewer |
| | | v-if="showViewer" |
| | | :on-close="()=>showViewer=false" |
| | |
| | | /> |
| | | </div> |
| | | <div v-if="scope.row.fileType==1"> |
| | | <span @click="downLoadFile(scope.row.fileList[0].fileUrl)" style="color: #3A71A8 ; cursor: pointer;">{{ scope.row.fileList[0].fileName }}</span> |
| | | <span @click="downLoadFile(scope.row.fileList[0].fileUrl)" |
| | | style="color: #3A71A8 ; cursor: pointer;">{{ scope.row.fileList[0].fileName }}</span> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | @click="emergencyPlanC(scope.row, '编辑')" |
| | | type="text" |
| | | size="small" |
| | | >编辑</el-button |
| | | >编辑 |
| | | </el-button |
| | | > |
| | | <el-button |
| | | type="text" |
| | | size="small" |
| | | @click="deleteById(scope.row.id)" |
| | | style="color: red" |
| | | >删除</el-button |
| | | >删除 |
| | | </el-button |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.fileType==0" label="图片上传"> |
| | | <upload-img :imgList="fileList" @uploadImgSuccess="uploadImgSuccess" @removeImgSuccess="removeImgSuccess"></upload-img> |
| | | <upload-img :imgList="fileList" @uploadImgSuccess="uploadImgSuccess" |
| | | @removeImgSuccess="removeImgSuccess"></upload-img> |
| | | </el-form-item> |
| | | <el-form-item label="文件链接" v-if="form.fileType==1"> |
| | | <upload-file v-bind:url="fileUrl" v-bind:name="fileName" @uploadFileSuccess="uploadFileSuccess" ></upload-file> |
| | | |
| | | <el-form-item label="文件链接" v-if="form.fileType==1" class="multiFile" v-for="(items,index) in files"> |
| | | <upload-file v-bind:url="items.fileUrl" v-bind:name="items.fileName" |
| | | @uploadFileSuccess="uploadFileSuccess($event,items)" |
| | | @fileNameChange="fileNameChange($event,items)"></upload-file> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="" v-if="form.fileType==1" class="multiFile"> |
| | | <el-button @click="addFile">添加文件</el-button> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="备注" prop="remark"> |
| | | <el-input v-model="form.remark" :rows="5" type="textarea"></el-input> |
| | | </el-form-item> |
| | |
| | | emergencyPlanMod, |
| | | emergencyPlanDel, |
| | | } from "@/api/emergencyplan.js"; |
| | | |
| | | export default { |
| | | components: { uploadImg , uploadFile ,elImageViewer}, |
| | | data() { |
| | |
| | | fileUrl:"", |
| | | fileList:[], |
| | | list: [], |
| | | fileIndex: 1, |
| | | files: [ |
| | | { |
| | | fileName: "", |
| | | fileUrl: "" |
| | | } |
| | | ], |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: "预案名称不能为空", trigger: "change" }, |
| | |
| | | this.fileList=[] |
| | | }, |
| | | |
| | | uploadFileSuccess(res){ |
| | | this.fileName=res.fileName |
| | | this.fileUrl=res.fileUrl |
| | | uploadFileSuccess(res, item) { |
| | | item.fileName = res.fileName |
| | | item.fileUrl = res.fileUrl |
| | | }, |
| | | |
| | | fileNameChange(res, item) { |
| | | item.fileName = res; |
| | | }, |
| | | |
| | | uploadImgSuccess(res){ |
| | |
| | | this.form = {}; |
| | | this.fileUrl=""; |
| | | this.fileName=""; |
| | | this.files = [] |
| | | this.fileList=[] |
| | | } else { |
| | | this.title = "编辑"; |
| | | this.form=JSON.parse(JSON.stringify(value)); |
| | | this.files = this.form.fileList; |
| | | if (this.form.fileType==0){ |
| | | this.fileList=value.fileList |
| | | } else{ |
| | |
| | | } |
| | | }, |
| | | addemergencyPlan() { |
| | | console.log(this.files); |
| | | // return ; |
| | | this.$refs["form"].validate((valid) => { |
| | | if (valid) { |
| | | if (this.form.fileType==0){ |
| | | this.form.fileList=this.fileList |
| | | } |
| | | if (this.form.fileType==1){ |
| | | let fileList = [] |
| | | if (this.fileUrl!=""){ |
| | | let file={ |
| | | fileUrl:this.fileUrl, |
| | | fileName:this.fileName |
| | | } |
| | | fileList.push(file) |
| | | } |
| | | this.form.fileList=fileList |
| | | // let fileList = [] |
| | | // if (this.fileUrl != "") { |
| | | // let file = { |
| | | // fileUrl: this.fileUrl, |
| | | // fileName: this.fileName |
| | | // } |
| | | // fileList.push(file) |
| | | // } |
| | | this.form.fileList = this.files.filter(n => { |
| | | return n.fileUrl != null && n.fileUrl != '' && n.fileName != null && n.fileName != ''; |
| | | }) |
| | | } |
| | | if (this.title === "新增") { |
| | | emergencyPlanAdd(this.form).then((res) => { |
| | |
| | | this.$message.error(res.data.message); |
| | | } |
| | | }); |
| | | } |
| | | else { |
| | | } else { |
| | | emergencyPlanMod(this.form).then((res) => { |
| | | if (res.data.code === "200") { |
| | | this.dialogVisible = false; |
| | |
| | | this.listQuery.pageSize = val |
| | | this.emergencyPlan(); |
| | | }, |
| | | addFile() { |
| | | this.files.push({ |
| | | fileUrl: "", |
| | | fileName: "" |
| | | }) |
| | | }, |
| | | handleCurrentChange(val){ |
| | | this.listQuery.pageIndex = val |
| | | this.emergencyPlan(); |
| | |
| | | background-color: #034EA2; |
| | | border: 1px solid #034EA2; |
| | | } |
| | | |
| | | >>> .el-input.is-disabled .el-input__inner { |
| | | background-color: white; |
| | | } |
| | | </style> |