| | |
| | | :page-size="pageSize" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="recordTotal" |
| | | style="text-align: right;margin-top: 20px;" |
| | | > |
| | | </el-pagination> |
| | | <el-dialog :title="title" :visible.sync="dialogVisible" width="40%"> |
| | |
| | | <el-input v-model="form.name"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="文件类型"> |
| | | <el-radio-group v-model="form.fileType"> |
| | | <el-radio-group v-model="form.fileType" @change="changeFileType"> |
| | | <el-radio :label=0 >图片</el-radio> |
| | | <el-radio :label=1 >文件</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.fileType==0" label="图片上传"> |
| | | <upload-img v-bind:imgList="form.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> |
| | | <upload-file v-bind:url="fileUrl" v-bind:name="fileName" @uploadFileSuccess="uploadFileSuccess" ></upload-file> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="remark"> |
| | | <el-input v-model="form.remark" :rows="5" type="textarea"></el-input> |
| | |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" class="btns" @click="addemergencyPlan()">确 定</el-button> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | <el-button @click="cancel()">取 消</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | |
| | | components: { uploadImg , uploadFile}, |
| | | data() { |
| | | return { |
| | | name:"111", |
| | | url:"222", |
| | | path:"emergencyPlan", |
| | | uploadDisabled:false, |
| | | |
| | | dialogVisible: false, |
| | | title: "", |
| | |
| | | }, |
| | | fileName:"", |
| | | fileUrl:"", |
| | | fileList:[], |
| | | list: [], |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: "预案名称不能为空", trigger: "change" }, |
| | | ], |
| | | remark: [ |
| | | { required: true, message: "责任人不能为空", trigger: "blur" }, |
| | | ], |
| | | // remark: [ |
| | | // { required: true, message: "备注不能为空", trigger: "blur" }, |
| | | // ], |
| | | }, |
| | | }; |
| | | }, |
| | |
| | | this.emergencyPlan(); |
| | | }, |
| | | methods: { |
| | | changeFileType(){ |
| | | this.fileUrl="" |
| | | this.fileName="" |
| | | this.fileList=[] |
| | | }, |
| | | |
| | | uploadFileSuccess(res){ |
| | | this.fileName=res.fileName |
| | | this.fileUrl=res.fileUrl |
| | | if (this.fileName=="" || this.fileUrl==""){ |
| | | this.form.fileList=[] |
| | | } |
| | | this.form.fileList=[{ |
| | | fileName: this.fileName, |
| | | fileUrl:this.fileUrl |
| | | }] |
| | | }, |
| | | |
| | | uploadImgSuccess(res){ |
| | |
| | | fileUrl : res.fileUrl, |
| | | fileName : res.fileName |
| | | } |
| | | this.form.fileList.push(file) |
| | | this.fileList.push(file) |
| | | }, |
| | | |
| | | removeImgSuccess(res){ |
| | | this.form.fileList=res.fileList |
| | | this.fileList=res.fileList |
| | | }, |
| | | |
| | | async emergencyPlan() { |
| | |
| | | } else { |
| | | this.title = "编辑"; |
| | | this.form = value; |
| | | this.fileUrl=value.fileList[0].fileUrl; |
| | | this.fileName=value.fileList[0].fileName |
| | | if (this.form.fileType==0){ |
| | | this.fileList=value.fileList |
| | | } else{ |
| | | this.fileUrl=value.fileList[0].fileUrl; |
| | | this.fileName=value.fileList[0].fileName |
| | | } |
| | | } |
| | | }, |
| | | addemergencyPlan() { |
| | | this.$refs["form"].validate((valid) => { |
| | | if (valid) { |
| | | console.log(132,this.form) |
| | | if (this.form.fileType==0){ |
| | | this.form.fileList=this.fileList |
| | | } |
| | | if (this.form.fileType==1){ |
| | | let file={ |
| | | fileUrl:this.fileUrl, |
| | | fileName:this.fileName |
| | | } |
| | | this.form.fileList=[file] |
| | | } |
| | | if (this.title === "新增") { |
| | | emergencyPlanAdd(this.form).then((res) => { |
| | | if (res.data.code === "200") { |
| | |
| | | duration: 2000, |
| | | message: "新增成功", |
| | | title: "成功", |
| | | }); |
| | | } else { |
| | | this.$message({ |
| | | type: "warning", |
| | | message: res.data.message, |
| | | }); |
| | | } |
| | | }); |
| | |
| | | message: "编辑成功", |
| | | title: "成功", |
| | | }); |
| | | } else { |
| | | this.$message({ |
| | | type: "warning", |
| | | message: res.data.message, |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | |
| | | }); |
| | | }, |
| | | deleteById(val) { |
| | | emergencyPlanDel({ id: val }).then(() => { |
| | | this.emergencyPlan(); |
| | | this.$notify({ |
| | | title: "成功", |
| | | message: "删除成功", |
| | | type: "success", |
| | | duration: 2000, |
| | | }); |
| | | }); |
| | | this.$confirm('确认删除吗','提示', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | .then(()=>{ |
| | | emergencyPlanDel({ id: val }).then(() => { |
| | | this.emergencyPlan(); |
| | | this.$notify({ |
| | | title: "成功", |
| | | message: "删除成功", |
| | | type: "success", |
| | | duration: 2000, |
| | | }); |
| | | }); |
| | | }) |
| | | .catch(error =>{ |
| | | }); |
| | | }, |
| | | cancel(){ |
| | | this.emergencyPlan(); |
| | | this.dialogVisible = false; |
| | | }, |
| | | find() { |
| | | this.emergencyPlan(); |
| | | }, |