| | |
| | | }, |
| | | created() { |
| | | this.TreeA(); |
| | | safetyInspectionItemName().then((res) => { |
| | | if (res.data.code == 200) { |
| | | this.nameList = res.data.result; |
| | | } |
| | | }); |
| | | this.id = this.$route.query.name; |
| | | this.itemId = this.$route.query.id; |
| | | this.itemInfo(this.$route.query.id); |
| | |
| | | this.treeList = Array.from(new Set(trees)); |
| | | var arr = this.checkSameDataA(this.list.itemList); |
| | | for (var i = 0; i < arr.length; i++) { |
| | | var cser=[] |
| | | for(var j=0;j<arr[i].child.length;j++){ |
| | | var capB = { |
| | | safetySelfInspectionId: "", |
| | | safetyInspectionItemId: "", |
| | | } |
| | | var cser=[] |
| | | for(var j=0;j<arr[i].child.length;j++){ |
| | | capB.safetySelfInspectionId=arr[i].child[j].safetySelfInspectionId |
| | | capB.safetyInspectionItemId=arr[i].child[j].safetyInspectionItemId |
| | | cser.push(capB) |
| | |
| | | }, |
| | | TreeB(id) { |
| | | safetyInspectionItemTreeB({ id: id }).then((res) => { |
| | | this.list = []; |
| | | // this.list = []; |
| | | if (this.id == "添加") { |
| | | if (res.data.code == 200) { |
| | | this.list = res.data.result; |
| | |
| | | if(this.list.length!=0){ |
| | | var capA = { elementAName: "", id: [], child: [] }; |
| | | var atte = []; |
| | | |
| | | capA.elementAName = this.list[0].elementAName; |
| | | for (var i = 0; i < this.list.length; i++) { |
| | | var capB = { |
| | |
| | | open(type) { |
| | | this.dialogVisible = true; |
| | | this.form.status = type; |
| | | console.log("xxxxx",this.lists) |
| | | 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]); |
| | | } |
| | | } |
| | | this.form.itemList = arr; |
| | | safetyInspectionItemName().then((res) => { |
| | | if (res.data.code == 200) { |
| | | this.nameList = res.data.result; |
| | | } |
| | | }); |
| | | }, |
| | | closeDialog(){ |
| | | this.dialogVisible = false |
| | | console.log(123,this.form) |
| | | }, |
| | | addC() { |
| | | this.$refs["form"].validate((valid) => { |
| | | if (valid) { |
| | | if (this.id == "添加") { |
| | | console.log("添加",this.form) |
| | | safetySelfInspectionAdd(this.form).then((res) => { |
| | | if (res.data.code == 200) { |
| | | this.dialogVisible = false; |
| | |
| | | } |
| | | }); |
| | | } else if (this.id == "编辑") { |
| | | console.log('编辑',this.form) |
| | | safetySelfInspectionMod(this.form).then((res) => { |
| | | this.dialogVisible = false; |
| | | this.$notify({ |