| | |
| | | </div> |
| | | <div class="box-right" v-if="list == '' ? false : true"> |
| | | <div class="btns"> |
| | | <el-button type="primary" class="btn" @click="open(0)">添加</el-button> |
| | | <el-button type="primary" class="btn" @click="open(-1)">暂存</el-button> |
| | | <el-button type="primary" class="btn" @click="open(0)" |
| | | >添加</el-button |
| | | > |
| | | <el-button type="primary" class="btn" @click="open(-1)" |
| | | >暂存</el-button |
| | | > |
| | | </div> |
| | | <div v-for="(item, i) in lists" :key="i"> |
| | | <div class="title"> |
| | |
| | | label="扣分项" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column prop="date" align="center" label="扣分"> |
| | | <el-table-column |
| | | prop="date" |
| | | align="center" |
| | | label="扣分" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="date" |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <el-dialog |
| | | title="添加" |
| | | :visible.sync="dialogVisible" |
| | | width="30%" |
| | | > |
| | | <el-dialog title="添加" :visible.sync="dialogVisible" width="30%"> |
| | | <el-form ref="form" :model="form" label-width="100px"> |
| | | <el-form-item label="自查清单名称"> |
| | | <el-input v-model="form.inspectionName"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="检查人名称"> |
| | | <el-select v-model="form.inspector" style="width:100%" placeholder="请选择"> |
| | | <el-select |
| | | v-model="form.inspector" |
| | | style="width: 100%" |
| | | placeholder="请选择" |
| | | > |
| | | <el-option |
| | | v-for="item in nameList" |
| | | :key="item.id" |
| | | :label="item.realname" |
| | | :value="item.id"> |
| | | :value="item.id" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="时间"> |
| | | <el-col :span="11"> |
| | | <el-date-picker type="date" format="yyyy 年 MM 月 dd 日" placeholder="开始时间" v-model="form.inspectionTime" style="width: 100%;"></el-date-picker> |
| | | <el-date-picker |
| | | type="date" |
| | | format="yyyy 年 MM 月 dd 日" |
| | | placeholder="开始时间" |
| | | v-model="form.inspectionTime" |
| | | style="width: 100%" |
| | | ></el-date-picker> |
| | | </el-col> |
| | | <!-- <el-col style="text-align:center" :span="2">-</el-col> |
| | | <el-col :span="11"> |
| | |
| | | </el-col> --> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" style="text-align:center;display:block;" class="dialog-footer"> |
| | | <span |
| | | slot="footer" |
| | | style="text-align: center; display: block" |
| | | class="dialog-footer" |
| | | > |
| | | <el-button type="primary" class="btn" @click="addC">确 定</el-button> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | </span> |
| | |
| | | inspector:"", |
| | | inspectionTime:"", |
| | | status:"", |
| | | itemList:[] |
| | | itemList: [], |
| | | }, |
| | | formInline: { |
| | | user: "", |
| | |
| | | arr:[], |
| | | treeList:[], |
| | | defaultProps: { |
| | | children: 'children', |
| | | label: 'label' |
| | | children: "children", |
| | | label: "label", |
| | | }, |
| | | itemId:"" |
| | | itemId: "", |
| | | }; |
| | | }, |
| | | created() { |
| | | this.TreeA(); |
| | | this.id=this.$route.query.name |
| | | this.itemId=this.$route.query.id |
| | | this.itemInfo(this.$route.query.id) |
| | | this.id = this.$route.query.name; |
| | | this.itemId = this.$route.query.id; |
| | | this.itemInfo(this.$route.query.id); |
| | | }, |
| | | methods: { |
| | | itemInfo(id) { |
| | | safetySelfInspectionInfo({id:id}).then((res) => { |
| | | if (res.data.code == 200){ |
| | | this.form=res.data.result |
| | | console.log(res.data.result) |
| | | this.form = res.data.result; |
| | | console.log(res.data.result); |
| | | this.list = res.data.result; |
| | | var trees=[] |
| | | var trees = []; |
| | | for(var i=0;i<this.list.itemList.length;i++){ |
| | | trees.push(this.list.itemList[i].elementA) |
| | | trees.push(this.list.itemList[i].elementA); |
| | | } |
| | | this.treeList=Array.from(new Set(trees)) |
| | | this.treeList = Array.from(new Set(trees)); |
| | | var arr = this.checkSameDataA(this.list.itemList); |
| | | console.log('tag', arr) |
| | | console.log("tag", arr); |
| | | for (var i = 0; i < arr.length; i++) { |
| | | arr[i].child = this.checkSameData(arr[i].child); |
| | | arr[i].id={safetySelfInspectionId:arr[i].child.safetySelfInspectionId,safetyInspectionItemId:arr[i].child.safetyInspectionItemId} |
| | | arr[i].id = { |
| | | safetySelfInspectionId: arr[i].child.safetySelfInspectionId, |
| | | safetyInspectionItemId: arr[i].child.safetyInspectionItemId, |
| | | }; |
| | | } |
| | | this.lists = arr; |
| | | console.log(this.lists) |
| | | console.log(this.lists); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | }, |
| | | TreeB(id) { |
| | | safetyInspectionItemTreeB({ id: id }).then((res) => { |
| | | this.list=[] |
| | | this.list = []; |
| | | if(this.id=="添加"){ |
| | | if (res.data.code == 200) { |
| | | this.list = res.data.result; |
| | | var capA={elementAName:'',id:[],child:[]} |
| | | var atte=[] |
| | | var capA = { elementAName: "", id: [], child: [] }; |
| | | var atte = []; |
| | | capA.elementAName = this.list[0].elementAName; |
| | | for(var i=0;i<this.list.length;i++){ |
| | | var capB={safetySelfInspectionId:"",safetyInspectionItemId:""} |
| | | capB.safetyInspectionItemId=this.list[i].id |
| | | atte.push(capB) |
| | | var capB = { |
| | | safetySelfInspectionId: "", |
| | | safetyInspectionItemId: "", |
| | | }; |
| | | capB.safetyInspectionItemId = this.list[i].id; |
| | | atte.push(capB); |
| | | } |
| | | capA.id=atte |
| | | capA.id = atte; |
| | | capA.child= this.checkSameData(this.list); |
| | | if(this.lists.findIndex(item=>item.elementAName===capA.elementAName)==-1){ |
| | | this.lists.push(capA) |
| | | |
| | | if ( |
| | | this.lists.findIndex( |
| | | (item) => item.elementAName === capA.elementAName |
| | | ) == -1 |
| | | ) { |
| | | this.lists.push(capA); |
| | | }else{ |
| | | var i=this.lists.findIndex(item=>item.elementAName===capA.elementAName) |
| | | this.lists.splice(i,1) |
| | | var i = this.lists.findIndex( |
| | | (item) => item.elementAName === capA.elementAName |
| | | ); |
| | | this.lists.splice(i, 1); |
| | | } |
| | | } |
| | | }else if(this.id=="编辑"){ |
| | | this.list = res.data.result; |
| | | var capA={elementAName:'',id:[],child:[]} |
| | | var atte=[] |
| | | var capA = { elementAName: "", id: [], child: [] }; |
| | | var atte = []; |
| | | capA.elementAName = this.list[0].elementAName; |
| | | for(var i=0;i<this.list.length;i++){ |
| | | var capB={safetySelfInspectionId:"",safetyInspectionItemId:""} |
| | | capB.safetyInspectionItemId=this.list[i].id |
| | | capB.safetySelfInspectionId=this.itemId |
| | | atte.push(capB) |
| | | var capB = { |
| | | safetySelfInspectionId: "", |
| | | safetyInspectionItemId: "", |
| | | }; |
| | | capB.safetyInspectionItemId = this.list[i].id; |
| | | capB.safetySelfInspectionId = this.itemId; |
| | | atte.push(capB); |
| | | } |
| | | console.log("数据",this.lists) |
| | | capA.id=atte |
| | | console.log("数据", this.lists); |
| | | capA.id = atte; |
| | | capA.child= this.checkSameData(this.list); |
| | | if(this.lists.findIndex(item=>item.elementAName===capA.elementAName)==-1){ |
| | | this.lists.push(capA) |
| | | |
| | | if ( |
| | | this.lists.findIndex( |
| | | (item) => item.elementAName === capA.elementAName |
| | | ) == -1 |
| | | ) { |
| | | this.lists.push(capA); |
| | | }else{ |
| | | var i=this.lists.findIndex(item=>item.elementAName===capA.elementAName) |
| | | this.lists.splice(i,1) |
| | | var i = this.lists.findIndex( |
| | | (item) => item.elementAName === capA.elementAName |
| | | ); |
| | | this.lists.splice(i, 1); |
| | | } |
| | | } |
| | | }); |
| | |
| | | this.TreeB(currentObj.value); |
| | | }, |
| | | handleClick(data) { |
| | | console.log('tag', data.id) |
| | | if (data.safetyInspectionItemId!=undefined) { |
| | | this.$router.push({ |
| | | path: "/reviewXG", |
| | | query: { |
| | | id: data, |
| | | id: data.safetyInspectionItemId, |
| | | }, |
| | | }); |
| | | } else{ |
| | | this.$router.push({ |
| | | path: "/reviewXG", |
| | | query: { |
| | | id:data.id |
| | | }, |
| | | }); |
| | | } |
| | | }, |
| | | open(type){ |
| | | this.dialogVisible = true |
| | | this.form.status=type |
| | | var arr=[] |
| | | this.dialogVisible = true; |
| | | this.form.status = type; |
| | | var arr = []; |
| | | for(var i=0;i<this.lists.length;i++){ |
| | | this.lists[i].id |
| | | this.lists[i].id; |
| | | for(var j=0;j<this.lists[i].id.length;j++){ |
| | | arr.push(this.lists[i].id[j]) |
| | | arr.push(this.lists[i].id[j]); |
| | | } |
| | | } |
| | | this.form.itemList=arr |
| | | safetyInspectionItemName().then(res=>{ |
| | | this.form.itemList = arr; |
| | | safetyInspectionItemName().then((res) => { |
| | | if(res.data.code==200){ |
| | | this.nameList=res.data.result |
| | | this.nameList = res.data.result; |
| | | } |
| | | }) |
| | | |
| | | }); |
| | | }, |
| | | addC(){ |
| | | if(this.id=='添加'){ |
| | | safetySelfInspectionAdd(this.form).then(res=>{ |
| | | if (this.id == "添加") { |
| | | safetySelfInspectionAdd(this.form).then((res) => { |
| | | if(res.data.code==200){ |
| | | this.dialogVisible=false |
| | | this.dialogVisible = false; |
| | | this.$notify({ |
| | | type: "success", |
| | | duration: 2000, |
| | |
| | | title: "成功", |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | }else if(this.id=='编辑'){ |
| | | safetySelfInspectionMod(this.form).then(res=>{ |
| | | this.dialogVisible=false |
| | | }); |
| | | } else if (this.id == "编辑") { |
| | | safetySelfInspectionMod(this.form).then((res) => { |
| | | this.dialogVisible = false; |
| | | this.$notify({ |
| | | type: "success", |
| | | duration: 2000, |
| | | message: "编辑成功", |
| | | title: "成功", |
| | | }); |
| | | }) |
| | | }); |
| | | } |
| | | }, |
| | | btnsQX() { |