From 181dc30a8174e88c6ceb2a99b609bd5af39e9966 Mon Sep 17 00:00:00 2001
From: cqf <1219224667@qq.com>
Date: 星期二, 17 五月 2022 22:31:57 +0800
Subject: [PATCH] 05172231
---
src/views/oneFromanother/exist.vue | 138 ++++++++++++++++++++++++++++------------------
1 files changed, 84 insertions(+), 54 deletions(-)
diff --git a/src/views/oneFromanother/exist.vue b/src/views/oneFromanother/exist.vue
index ab40f32..170a81d 100644
--- a/src/views/oneFromanother/exist.vue
+++ b/src/views/oneFromanother/exist.vue
@@ -96,7 +96,7 @@
<el-table-column type="index" width="55" align="center" label="序号"></el-table-column>
<el-table-column prop="ht_branch" align="center" label="隐患部门"></el-table-column>
<el-table-column prop="address" align="center" label="地点"></el-table-column>
- <el-table-column prop="ht_content" align="center" label="隐患内容"></el-table-column>
+ <el-table-column prop="ht_content" show-overflow-tooltip align="center" label="隐患内容"></el-table-column>
<el-table-column prop="measure" align="center" label="整改措施"></el-table-column>
<el-table-column prop="ht_typesub" align="center" label="隐患类别"></el-table-column>
<el-table-column prop="dangerousSource" align="center" label="关联危险源"></el-table-column>
@@ -300,13 +300,24 @@
</template>
<script>
-import Titlename from "../../components/Titlename/index.vue";
+ import Titlename from "../../components/Titlename/index.vue";
-import {initJCBM ,initYHLX, initBC ,initJCLB ,initYHBM ,initYHJB,initLlr,initReformStatus,initYwks,initWxy} from "@/api/sgyhpczl/initSelect";
-import {saveDanger,initDangerRebound,getDangerInfo,editDanger} from '@/api/sgyhpczl/hiddenDangerRegistration'
-import {deepClone} from '@/utils'
+ import {
+ initBC,
+ initJCBM,
+ initJCLB,
+ initLlr,
+ initReformStatus,
+ initWxy,
+ initYHBM,
+ initYHJB,
+ initYHLX,
+ initYwks
+ } from "@/api/sgyhpczl/initSelect";
+ import {initDangerRebound} from '@/api/sgyhpczl/hiddenDangerRegistration'
+ import {deepClone} from '@/utils'
-export default {
+ export default {
components: { Titlename },
name: "hiddenDangerList",
data() {
@@ -341,8 +352,8 @@
statusList:[],
YWKSList:[],
reboundList:[],
- ruleForm: {},
- rules: {
+ ruleForm: {},
+ rules: {
check_date: [{ required: true, message: '不能为空', trigger: 'blur' },],
check_class: [{ required: true, message: '不能为空', trigger: 'blur' },],
check_main_branch: [{ required: true, message: '不能为空', trigger: 'blur' },],
@@ -350,9 +361,11 @@
check_man: [{ required: true, message: '不能为空', trigger: 'blur' },],
checktype: [{ required: true, message: '不能为空', trigger: 'blur' },],
},
- tableData: [],
+ tableData: [],
+ paramsData: {},//上个页面参数
};
},
+
mounted(){
this.initBC()
this.initJCLB()
@@ -365,22 +378,28 @@
this.initWXY()
this.initDangerRebound()
this.id = this.$route.query.id;
- if( this.id!=null && this.id!=''){
- this.initInfo();
- this.addShow=false
- }
+ this.initInfo(this.$route.query.data);
},
methods: {
- async initInfo(){
- var res=await getDangerInfo(this.id)
- if (res.data.ok==1){
- this.ruleForm=res.data.data
- this.changeJCDW(res.data.data.check_main_branch)
- var obj=deepClone(res.data.data)
- this.tableData.push(obj)
-
- }
+ initInfo(data){
+ this.paramsData = this.$route.query.data;
+ this.ruleForm.jyfsId = data.id;
+ this.tableData[0] = {
+ address: data.address,
+ ht_content: data.ht_content,
+ ht_level: data.ht_level,
+ };
},
+
+ // async initInfo(){
+ // var res=await getDangerInfo(this.id)
+ // if (res.data.ok==1){
+ // this.ruleForm=res.data.data
+ // this.changeJCDW(res.data.data.check_main_branch)
+ // var obj=deepClone(res.data.data)
+ // this.tableData.push(obj)
+ // }
+ // },
initDangerRebound(){
initDangerRebound().then(res=>{
if (res.data.ok==1){
@@ -552,54 +571,65 @@
returnIndex(){
this.$router.push({
- path:"/hiddenDangerRegistration"
+ path:"/oneFromanother"
})
+ },
+ judge(obj){
+ console.log(obj)
+ if (obj != null || ('ht_branch' in obj) || ('address' in obj) || ('ht_typesub' in obj) || ('dangerousSource' in obj)
+ || ('alter_time' in obj) || ('duty_officer' in obj) || ('alter_status' in obj) || ('Review' in obj) || ('DTRisk_bankId' in obj)){
+ return true;
+ }else {
+ return false;
+ }
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
+
if (valid) {
- if(this.tableData==null || this.tableData.length==0){
- this.$message({type:'error', message:"请添加隐患", duration:2000})
- }
this.ruleForm.items=this.tableData
+ if(this.judge(this.tableData[0])){
+ this.$message({type:'error', message:"请完整录入隐患", duration:2000})
+ }
if(this.addShow){
+ console.log(this.ruleForm)
saveDanger(this.ruleForm).then(res=>{
if (res.data.ok==1){
- this.$message({type:'success', message:"新增成功", duration:3000})
+ this.$message({type:'success', message:"保存成功", duration:3000})
this.$router.push({
- path:"/hiddenDangerRegistration"
+ path:"/oneFromanother"
})
}else {
this.$message({type:'error', message:res.data.msg, duration:3000})
}
})
}else {
- var param=deepClone(this.ruleForm)
- var obj=deepClone(this.tableData[0])
- param.ht_branch=obj.ht_branch
- param.address=obj.address
- param.ht_content=obj.ht_content
- param.measure=obj.measure
- param.ht_typesub=obj.ht_typesub
- param.DTRisk_bankId=obj.DTRisk_bankId
- param.DTRisk_level=obj.mriskLevel
- param.dangerousSource=obj.mriskPoint
- param.ht_level=obj.ht_level
- param.alter_time=obj.alter_time
- param.duty_officer=obj.duty_officer
- param.alter_status=obj.alter_status
- param.Review=obj.Review
- param.repeatId=obj.repeatId
- editDanger(param).then(res=>{
- if (res.data.ok==1){
- this.$message({type:'success', message:"编辑成功", duration:3000})
- this.$router.push({
- path:"/hiddenDangerRegistration"
- })
- }else {
- this.$message({type:'error', message:res.data.msg, duration:3000})
- }
- })
+ // var param=deepClone(this.ruleForm)
+ // var obj=deepClone(this.tableData[0])
+ // param.ht_branch=obj.ht_branch
+ // param.address=obj.address
+ // param.ht_content=obj.ht_content
+ // param.measure=obj.measure
+ // param.ht_typesub=obj.ht_typesub
+ // param.DTRisk_bankId=obj.DTRisk_bankId
+ // param.DTRisk_level=obj.mriskLevel
+ // param.dangerousSource=obj.mriskPoint
+ // param.ht_level=obj.ht_level
+ // param.alter_time=obj.alter_time
+ // param.duty_officer=obj.duty_officer
+ // param.alter_status=obj.alter_status
+ // param.Review=obj.Review
+ // param.repeatId=obj.repeatId
+ // editDanger(param).then(res=>{
+ // if (res.data.ok==1){
+ // this.$message({type:'success', message:"编辑成功", duration:3000})
+ // this.$router.push({
+ // path:"/hiddenDangerRegistration"
+ // })
+ // }else {
+ // this.$message({type:'error', message:res.data.msg, duration:3000})
+ // }
+ // })
}
--
Gitblit v1.9.2