From f8cb4519363640a36cf5c5818f7f647ad13b507f Mon Sep 17 00:00:00 2001 From: lyfO_o <764716047@qq.com> Date: 星期六, 02 四月 2022 10:29:24 +0800 Subject: [PATCH] Merge remote-tracking branch 'remotes/origin/shf' into master --- src/views/safetyproduction/gojudging.vue | 9 +-- src/views/safetyproduction/checklistself.vue | 2 src/views/safetyproduction/feature.vue | 4 - src/views/safetyproduction/reviewXG.vue | 23 ++++++- src/views/safetyproduction/review.vue | 9 ++ src/views/safetyproduction/new.vue | 43 ++++++++++---- src/views/contingencyplan/index.vue | 29 +++++---- src/views/safetyproduction/checklist.vue | 24 +++++-- 8 files changed, 93 insertions(+), 50 deletions(-) diff --git a/src/views/contingencyplan/index.vue b/src/views/contingencyplan/index.vue index ff3fd23..8caf0b3 100644 --- a/src/views/contingencyplan/index.vue +++ b/src/views/contingencyplan/index.vue @@ -126,9 +126,6 @@ name: [ { required: true, message: "预案名称不能为空", trigger: "change" }, ], - // remark: [ - // { required: true, message: "备注不能为空", trigger: "blur" }, - // ], }, }; }, @@ -176,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; @@ -200,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) => { @@ -217,6 +216,8 @@ message: "新增成功", title: "成功", }); + }else{ + this.$message.error(res.data.message); } }); } @@ -231,6 +232,8 @@ message: "编辑成功", title: "成功", }); + }else{ + this.$message.error(res.data.message); } }); } diff --git a/src/views/safetyproduction/checklist.vue b/src/views/safetyproduction/checklist.vue index 7c44497..64deeee 100644 --- a/src/views/safetyproduction/checklist.vue +++ b/src/views/safetyproduction/checklist.vue @@ -267,8 +267,8 @@ </div> <el-dialog :title="titleN" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%"> - <el-form ref="form" :model="formInline" label-width="80px"> - <el-form-item label="名称"> + <el-form ref="form" :rules="rules" :model="formInline" label-width="80px"> + <el-form-item label="名称" prop="name"> <el-input v-model="formInline.name"></el-input> </el-form-item> <el-form-item label="说明"> @@ -280,7 +280,7 @@ </el-form-item> </el-form> <span slot="footer" class="dialog-footer"> - <el-button @click="dialogVisible = false">取 消</el-button> + <el-button @click="listCel">取 消</el-button> <el-button type="primary" class="btns" @click="listAdd" >确 定</el-button > @@ -336,6 +336,10 @@ children: "children", label: "label", }, + rules: { + name: [ + { required: true, message: "名称不能为空", trigger: "change" }, + ],} }; }, created() { @@ -353,15 +357,12 @@ }, beforTree() { safetyInspectionItemTree().then((res) => { - console.log(res); this.tree = res.data.result; }); }, safetyInspectionItemL(data) { - // console.log(data) this.listQuery.filter.elementB = data.value; safetyInspectionItemList(this.listQuery).then((res) => { - // console.log(res.data.result.records); this.list = res.data.result.records; }); }, @@ -382,7 +383,6 @@ } else { this.disabled = true; var i = this.list.findIndex((item) => item.id == id); - console.log(id); this.form = this.list[i]; } }, @@ -435,6 +435,9 @@ } }, coAdd(val, type) { + this.$nextTick(() => { + this.$refs["form"].clearValidate(); + }); this.titleN = type; if (type == "新增") { this.dialogVisible = true; @@ -451,6 +454,8 @@ } }, listAdd() { + this.$refs["form"].validate((valid) => { + if (valid) { if (this.titleN == "新增") { this.form.deductionList.push(this.formInline); this.dialogVisible = false; @@ -459,6 +464,8 @@ this.form.deductionList[this.index].space = this.formInline.space; this.dialogVisible = false; } + } + }); }, listDel(val) { var i = this.form.deductionList.findIndex( @@ -481,6 +488,9 @@ } }); }, + listCel(){ + this.dialogVisible = false; + }, btnsQX() { this.show = true; }, diff --git a/src/views/safetyproduction/checklistself.vue b/src/views/safetyproduction/checklistself.vue index ecde465..dc7b8f3 100644 --- a/src/views/safetyproduction/checklistself.vue +++ b/src/views/safetyproduction/checklistself.vue @@ -120,7 +120,6 @@ async safetySelfInspectionL() { var res = await safetySelfInspectionList(this.listQuery).then((res) => { if (res.data.code == 200) { - console.log(res.data); this.list = res.data.result.records; this.recordTotal = res.data.result.total; this.pageSize = res.data.result.size; @@ -129,7 +128,6 @@ }); }, handleClick(val) { - console.log(val) if(val.status==-1){ this.$router.push({ path:"/new", diff --git a/src/views/safetyproduction/feature.vue b/src/views/safetyproduction/feature.vue index 312c285..06d47a3 100644 --- a/src/views/safetyproduction/feature.vue +++ b/src/views/safetyproduction/feature.vue @@ -110,6 +110,7 @@ v-model="form.parentId" placeholder="请选择" style="width: 100%" + :disabled="title=='编辑'?true:false" > <el-option v-for="item in parent" @@ -209,7 +210,6 @@ methods: { async elementManagementL() { var res = await elementManagementList(this.listQuery); - console.log(res); if (res.data.code == 200) { this.list = res.data.result.records; this.recordTotal = res.data.result.total @@ -223,7 +223,6 @@ this.$refs["form"].clearValidate(); }); getParentElement().then(res=>{ - // console.log('父类:',res) this.parent=res.data.result }) if (type == "新增") { @@ -304,7 +303,6 @@ }); }, deleteById(val) { - console.log(123,val) this.$confirm('确认删除吗','提示', { confirmButtonText: '确认', cancelButtonText: '取消', diff --git a/src/views/safetyproduction/gojudging.vue b/src/views/safetyproduction/gojudging.vue index 6230be4..1f376a2 100644 --- a/src/views/safetyproduction/gojudging.vue +++ b/src/views/safetyproduction/gojudging.vue @@ -1,7 +1,7 @@ <template> <div> <div class="box-right"> - <div v-for="(item, index) in lists" :key="index"> + <div v-for="(item, index) in lists" :key="index" style="padding:0 0 20px 0"> <div class="title"> A级要素:<span>{{ item.elementAName }}</span> </div> @@ -40,10 +40,10 @@ ></el-table-column> <el-table-column align="center" label="评审结果"> <template slot-scope="scope"> - <span v-if="(scope.row.safetyInspectionItemResult = 0)" + <span v-if="(scope.row.safetyInspectionItemResult== 0)" >是</span > - <span v-if="(scope.row.safetyInspectionItemResult = 1)" + <span v-if="(scope.row.safetyInspectionItemResult == 1)" >否</span > </template> @@ -124,14 +124,12 @@ methods: { safeInitem(id) { safetySelfInspectionInfo({ id: id }).then((res) => { - // console.log("数据", res); if (res.data.code == 200) this.list = res.data.result; var arr = this.checkSameDataA(this.list.itemList); for (var i = 0; i < arr.length; i++) { arr[i].child = this.checkSameData(arr[i].child); } this.lists = arr; - console.log(this.lists) }); }, checkSameDataA(resData) { @@ -165,7 +163,6 @@ return list; }, handleClick(data) { - console.log(data.id); this.$router.push({ path: "/review", query: { diff --git a/src/views/safetyproduction/new.vue b/src/views/safetyproduction/new.vue index 9ad7b6f..0ab20d8 100644 --- a/src/views/safetyproduction/new.vue +++ b/src/views/safetyproduction/new.vue @@ -15,7 +15,7 @@ ></el-tree> </div> </div> - <div class="box-right" v-if="list == '' ? false : true"> + <div class="box-right" v-if="lists == '' ? false : true"> <div class="btns"> <el-button type="primary" class="btn" @click="open(0)" >添加</el-button @@ -24,7 +24,7 @@ >暂存</el-button > </div> - <div v-for="(item, i) in lists" :key="i"> + <div v-for="(item, i) in lists" :key="i" style="padding:0 0 20px 0"> <div class="title"> A级要素:<span>{{ item.elementAName }}</span> </div> @@ -33,9 +33,9 @@ <el-col :span="6" :offset="1" ><p><span>B级要素:</span>{{ item.elementBName }}</p></el-col > - <el-col :span="6" :offset="4" + <!-- <el-col :span="6" :offset="4" ><p><span>得分:</span>50</p></el-col - > + > --> </el-row> <el-row> <el-col :span="22" :offset="1"> @@ -112,12 +112,12 @@ </div> </div> </div> - <el-dialog title="添加" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%"> - <el-form ref="form" :model="form" label-width="100px"> - <el-form-item label="自查清单名称"> + <el-dialog :title="id" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%"> + <el-form ref="form" :rules="rules" :model="form" label-width="110px"> + <el-form-item label="自查清单名称" prop="name"> <el-input v-model="form.inspectionName"></el-input> </el-form-item> - <el-form-item label="检查人名称"> + <el-form-item label="检查人名称" prop="type"> <el-select v-model="form.inspector" style="width: 100%" @@ -132,7 +132,7 @@ </el-option> </el-select> </el-form-item> - <el-form-item label="时间"> + <el-form-item label="时间" prop="time"> <el-col :span="11"> <el-date-picker type="date" @@ -199,6 +199,18 @@ label: "label", }, itemId: "", + parent: [], + rules: { + name: [ + { required: true, message: "要素名称不能为空", trigger: "change" }, + ], + type: [ + { required: true, message: "级别不能为空", trigger: "change" }, + ], + time: [ + { required: true, message: "父要素不能为空", trigger: "change" }, + ] + }, }; }, created() { @@ -212,7 +224,6 @@ safetySelfInspectionInfo({ id: id }).then((res) => { if (res.data.code == 200) { this.form = res.data.result; - console.log(res.data.result); this.list = res.data.result; var trees = []; for (var i = 0; i < this.list.itemList.length; i++) { @@ -232,11 +243,9 @@ cser.push(capB) } arr[i].id=cser - console.log('tag', capB) arr[i].child = this.checkSameData(arr[i].child); } this.lists = arr; - console.log(this.lists); } }); }, @@ -281,6 +290,7 @@ } } else if (this.id == "编辑") { this.list = res.data.result; + if(this.list.length!=0){ var capA = { elementAName: "", id: [], child: [] }; var atte = []; capA.elementAName = this.list[0].elementAName; @@ -307,6 +317,7 @@ ); this.lists.splice(i, 1); } + } } }); }, @@ -362,10 +373,12 @@ } }, open(type) { + this.$nextTick(() => { + this.$refs["form"].clearValidate(); + }); this.dialogVisible = true; this.form.status = type; var arr = []; - console.log("数据", this.lists); for (var i = 0; i < this.lists.length; i++) { this.lists[i].id; for (var j = 0; j < this.lists[i].id.length; j++) { @@ -380,6 +393,8 @@ }); }, addC() { + this.$refs["form"].validate((valid) => { + if (valid) { if (this.id == "添加") { safetySelfInspectionAdd(this.form).then((res) => { if (res.data.code == 200) { @@ -409,6 +424,8 @@ path:"/checklistself" }); } + } + }); }, btnsQX() { this.show = true; diff --git a/src/views/safetyproduction/review.vue b/src/views/safetyproduction/review.vue index 9539081..80d9bdc 100644 --- a/src/views/safetyproduction/review.vue +++ b/src/views/safetyproduction/review.vue @@ -250,6 +250,7 @@ }); }, modItem() { + if(this.list.safetyInspectionItemResult!=null){ safetySelfInspectionModItemInfo(this.list).then((res) => { if (res.data.code == 200) { this.$notify({ @@ -266,6 +267,13 @@ }); } }); + }else{ + this.$confirm('是否否决项未选择','提示', { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning' + }) + } }, back() { this.$router.push({ @@ -278,7 +286,6 @@ handleClick(data) { this.dialogVisible = true; this.form = data; - console.log(data); }, lost() { this.dialogVisible = false; diff --git a/src/views/safetyproduction/reviewXG.vue b/src/views/safetyproduction/reviewXG.vue index 838d985..572ea86 100644 --- a/src/views/safetyproduction/reviewXG.vue +++ b/src/views/safetyproduction/reviewXG.vue @@ -151,8 +151,8 @@ </div> <el-dialog title="扣分详情" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%"> - <el-form ref="form" :model="formInline" label-width="54px"> - <el-form-item label="说明"> + <el-form ref="form" :rules="rules" :model="formInline" label-width="54px"> + <el-form-item label="说明" prop="name"> <el-input v-model="formInline.name"></el-input> </el-form-item> <el-form-item label="备注"> @@ -171,7 +171,7 @@ <el-button type="primary" class="btns" @click="listAdd" >确 定</el-button > - <el-button @click="dialogVisible = false">取 消</el-button> + <el-button @click="bacQx">取 消</el-button> </span> </el-dialog> </div> @@ -192,11 +192,14 @@ name: "", remark: "", }, + rules: { + name: [ + { required: true, message: "说明不能为空", trigger: "change" }, + ],} }; }, created() { this.id = this.$route.query.id; - console.log('tagee',this.$route.query) this.safeT(this.id); }, methods: { @@ -208,6 +211,9 @@ }); }, coAdd(val, type) { + this.$nextTick(() => { + this.$refs["form"].clearValidate(); + }); this.titleN = type; if (type == "新增") { this.dialogVisible = true; @@ -224,6 +230,8 @@ } }, listAdd() { + this.$refs["form"].validate((valid) => { + if (valid) { if (this.titleN == "新增") { this.form.deductionList.push(this.formInline); this.dialogVisible = false; @@ -232,6 +240,8 @@ this.form.deductionList[this.index].space = this.formInline.space; this.dialogVisible = false; } + } + }); }, listDel(val) { var i = this.form.deductionList.findIndex( @@ -241,7 +251,6 @@ }, safetyInspectionItemA() { safetyInspectionItemMod(this.form).then((res) => { - console.log(res) if (res.data.code == 200) { this.$notify({ type: "success", @@ -265,6 +274,10 @@ path:"/new" }) }, + bacQx(){ + this.dialogVisible = false; + this.safeT(this.id); + }, handleClick() { this.dialogVisible = true; }, -- Gitblit v1.9.2