diff --git a/src/pages/regulatoryRepository/localProductsOrProjectLibrary/pages/details.vue b/src/pages/regulatoryRepository/localProductsOrProjectLibrary/pages/details.vue index 10b8a91f7..04b1c3912 100644 --- a/src/pages/regulatoryRepository/localProductsOrProjectLibrary/pages/details.vue +++ b/src/pages/regulatoryRepository/localProductsOrProjectLibrary/pages/details.vue @@ -699,115 +699,52 @@ export default { cancelStand() { this.standModel = false; }, - //如果张宇欢改好了就把这个放开,然后把底下那个注释了 - // okStand() { - // let _this = this; - // if (this.standList.length < 1) { - // _this.$message.warning("请选择标准"); - // } else { - // for (let i = 0; i < this.dataList.length; i++) { - // let newStand = false; - // for (let j = 0; j < this.standList.length; j++) { - // if (this.standList[j].id == this.dataList[i].standId) { - // newStand = true; - // this.standList.splice(j, 1) - // j-- - // } - // } - // if (newStand) { - // _this.$message.warning("请勿重复添加数据"); - // } else { - // // _this.dataList.push(item); - // } - // } - // this.standardData = [] - // _this.standModel = false; - // for (var i = 0; i < this.standList.length; i++) { - // this.standList1.push({ - // standId: this.standList[i].id, - // projectId: this.localProEO.id - // }) - // } - // if (this.standList1 != '') { - // this.$http.postData("sarStandProjectLibrary/batchInsert", this.standList1, { - // _this: this - // }, res => { - // if (res.ok) { - // // this.$message.success(res.message) - // this.getDataList() - // } - // }, e => { - // }); - // } - // this.standList = [] - // this.standList1 = [] - // _this.standModel = false; - // } - // }, - //添加标准确定事件 - okStand(){ - if(this.standList.length > 0){ - this.standList.forEach(item => { - let addIndex - addIndex = this.dataList.findIndex(items => { - return items.standId === item.id - }) - if(addIndex > -1){ - this.$message.warning('请勿重复添加数据') - }else{ - this.dataList.push(item) - } - }) - this.detailedListModel = false - this.standModel = false - }else{ - this.$message.warning('请至少选择一条数据进行添加') - } + + okStand() { + let _this = this; + if (this.standList.length < 1) { + _this.$message.warning("请选择标准"); + } else { + for (let i = 0; i < this.dataList.length; i++) { + let newStand = false; + for (let j = 0; j < this.standList.length; j++) { + if (this.standList[j].id == this.dataList[i].standId) { + newStand = true; + this.standList.splice(j, 1) + j-- + } + } + if (newStand) { + _this.$message.warning("请勿重复添加数据"); + } else { + // _this.dataList.push(item); + } + } + this.standardData = [] + _this.standModel = false; + for (var i = 0; i < this.standList.length; i++) { + this.standList1.push({ + standId: this.standList[i].id, + projectId: this.localProEO.id + }) + } + if (this.standList1 != '') { + this.$http.postData("sarStandProjectLibrary/batchInsert", this.standList1, { + _this: this + }, res => { + if (res.ok) { + // this.$message.success(res.message) + this.getDataList() + } + }, e => { + }); + } + this.standList = [] + this.standList1 = [] + _this.detailedListModel = false; + _this.standModel = false; + } }, - // okStand() { - // let _this = this; - // if (this.standList.length < 1) { - // _this.$message.warning("请选择标准"); - // } else { - // for (let i = 0; i < this.dataList.length; i++) { - // let newStand = false; - // for (let j = 0; j < this.standList.length; j++) { - // if (this.standList[j].id == this.dataList[i].standId) { - // newStand = true; - // this.standList.splice(j, 1) - // j-- - // } - // } - // if (newStand) { - // _this.$message.warning("请勿重复添加数据"); - // } else { - // // _this.dataList.push(item); - // } - // } - // this.standardData = [] - // _this.standModel = false; - // for (var i = 0; i < this.standList.length; i++) { - // this.standList1.push({ - // standId: this.standList[i].id, - // projectId: this.localProEO.id - // }) - // } - // if (this.standList1 != '') { - // this.$http.postData("sarStandProjectLibrary/batchInsert", this.standList1, { - // _this: this - // }, res => { - // if (res.ok) { - // // this.$message.success(res.message) - // this.getDataList() - // } - // }, e => { - // }); - // } - // this.standList = [] - // this.standList1 = [] - // _this.standModel = false; - // } - // }, //获取标准 getStandrd(data){ this.detailedId = data.id