From 1b3b9e0bb02144949c49702d27884ad0d6b3e7e2 Mon Sep 17 00:00:00 2001 From: songhuangfeng123 <shf18767906695@163.com> Date: 星期四, 31 三月 2022 16:46:10 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/shf' into shf --- src/views/contingencyplan/index.vue | 41 +++++++++++++++++++++++++---------------- 1 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/views/contingencyplan/index.vue b/src/views/contingencyplan/index.vue index 7df3d1b..8caf0b3 100644 --- a/src/views/contingencyplan/index.vue +++ b/src/views/contingencyplan/index.vue @@ -54,9 +54,10 @@ :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-dialog :title="title" :visible.sync="dialogVisible":close-on-click-modal="false" width="40%"> <el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form-item label="预案名称" prop="name"> <el-input v-model="form.name"></el-input> @@ -79,7 +80,7 @@ </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> @@ -125,9 +126,6 @@ name: [ { required: true, message: "预案名称不能为空", trigger: "change" }, ], - remark: [ - { required: true, message: "备注不能为空", trigger: "blur" }, - ], }, }; }, @@ -149,7 +147,8 @@ uploadImgSuccess(res){ let file = { fileUrl : res.fileUrl, - fileName : res.fileName + fileName : res.fileName, + url:res.url } this.fileList.push(file) }, @@ -174,12 +173,10 @@ }); if (type === "新增") { this.title = "新增"; - this.form = { - name: "", - fileType: 0, - fileList: [], - remark: "", - }; + this.form = {}; + this.fileUrl=""; + this.fileName=""; + this.fileList=[] } else { this.title = "编辑"; this.form = value; @@ -198,11 +195,15 @@ this.form.fileList=this.fileList } if (this.form.fileType==1){ - let file={ - fileUrl:this.fileUrl, - fileName:this.fileName + let fileList = [] + if (this.fileUrl!=""){ + let file={ + fileUrl:this.fileUrl, + fileName:this.fileName + } + fileList.push(file) } - this.form.fileList=[file] + this.form.fileList=fileList } if (this.title === "新增") { emergencyPlanAdd(this.form).then((res) => { @@ -215,6 +216,8 @@ message: "新增成功", title: "成功", }); + }else{ + this.$message.error(res.data.message); } }); } @@ -229,6 +232,8 @@ message: "编辑成功", title: "成功", }); + }else{ + this.$message.error(res.data.message); } }); } @@ -255,6 +260,10 @@ .catch(error =>{ }); }, + cancel(){ + this.emergencyPlan(); + this.dialogVisible = false; + }, find() { this.emergencyPlan(); }, -- Gitblit v1.9.2