| | |
| | | </el-table-column> |
| | | <el-table-column prop="father" label="检验项目" width="260"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-if="scope.row.children" style="width:120px" :disabled="dataForm.id!=null" v-model="scope.row.father" placeholder="请输入检验项目"></el-input> |
| | | <el-input v-if="scope.row.children" style="width:90%" :disabled="dataForm.id!=null" v-model="scope.row.father" placeholder="请输入检验项目"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="项目" width="260"> |
| | |
| | | <el-col v-else> |
| | | <el-select style="width: 100%;" |
| | | :disabled="scope.row.deviceId == null || (dataForm.id!=null&&resultVal!=null)" |
| | | v-model="scope.row.testValueList[index]" @change="aaa(scope.row)" |
| | | placeholder="请选择"> |
| | | v-model="scope.row.testValueList[index]" placeholder="请选择"> |
| | | <el-option v-for="item in dataVal" :key="item.value" :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | |
| | | </el-table-column> |
| | | <el-table-column fixed="right" v-if="dataForm.id != null" prop="testState" label="结论" min-width="150"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.testState == 0" style="color:#F56C6C">不合格</span> |
| | | <span v-else-if="scope.row.testState == 1" style="color:#67C23A">合格</span> |
| | | <span v-else>暂无结论</span> |
| | | <div v-if="!scope.row.children"> |
| | | <span v-if="scope.row.testState == 0" style="color:#F56C6C">不合格</span> |
| | | <span v-else-if="scope.row.testState == 1" style="color:#67C23A">合格</span> |
| | | <span v-else>暂无结论</span> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" style="background-color: white;" v-if="dataForm.id == null" label="操作" width="150"> |
| | | <template slot-scope="scope"> |
| | | <div v-if="!scope.row.children"> |
| | | <el-button type="text" @click="addwaydata(scope)">新增</el-button> |
| | | <el-button type="text" @click="clickDeleteline(scope)">取消</el-button> |
| | | <div> |
| | | <el-button v-if="scope.row.father!=null" type="text" @click="addChildren(scope.row)">添加项目</el-button> |
| | | <el-button v-else type="text" @click="delChildren(scope,scope.$index)">取消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | dataRule: {}, |
| | | deviceList: [], |
| | | restaurants:[], |
| | | whetherNot:'', |
| | | } |
| | | }, |
| | | beforeUpdate(){ |
| | |
| | | this.init() |
| | | this.getDeviceList() |
| | | this.restaurants = this.loadAll(); |
| | | |
| | | console.log(this.dataForm); |
| | | |
| | | }, |
| | | watch:{ |
| | | dialogVisible(newVal){ |
| | |
| | | this.unqualifiedNum = null |
| | | } |
| | | }, |
| | | |
| | | }, |
| | | methods:{ |
| | | querySearch(queryString, cb) { |
| | |
| | | this.dataForm.message = param.message |
| | | this.dataForm.projectName = param.projectName |
| | | this.projectList = param.rawInsProducts == null ? [] : param.rawInsProducts |
| | | console.log(param.rawInsProducts); |
| | | param.rawInsProducts.forEach(item =>{ |
| | | item.iid = Math.random() |
| | | console.log(item); |
| | | }) |
| | | param.rawInsProducts.forEach(o=>{ |
| | | this.clickAddLine(o) |
| | | }) |
| | |
| | | this.showPart = true |
| | | }, |
| | | updateDevice(row,index){ |
| | | console.log(row); |
| | | return |
| | | if(this.dataForm.id != null){ |
| | | updateDeviceById({deviceId:row.deviceId,rpId:row.rpId}).then(res=>{ |
| | | this.list[index].testValue = '' |
| | |
| | | this.resultVal = resultVal |
| | | this.conclusionTable[0].testState = resultVal |
| | | sessionStorage.setItem("raw-resultVal-"+this.dataForm.id,resultVal) |
| | | }, |
| | | aaa(row){ |
| | | console.log(row); |
| | | }, |
| | | showDialog(){ |
| | | let pro = this.list.filter(item => { |
| | |
| | | if(row){ |
| | | let userNameList = [] |
| | | row.children.forEach(item => { |
| | | console.log("item--",item); |
| | | item.iid = Math.random() |
| | | let arr = [] |
| | | item.testValue = '' |
| | |
| | | if (arr.length > this.empiricalValueAdd) { |
| | | this.empiricalValueAdd = arr.length |
| | | } |
| | | console.log("aaaa----",row); |
| | | this.list.push(row) |
| | | }) |
| | | }else{ |
| | |
| | | this.conclusionTable = [] |
| | | } |
| | | }, |
| | | // 删除行 |
| | | clickDeleteline(scope) { |
| | | console.log(scope); |
| | | let index = this.list.findIndex(el =>{ |
| | | return el.children.find(ele => ele.iid == scope.row.iid) |
| | | }) |
| | | |
| | | let childrenIndex = this.list[index].children.findIndex(el => { |
| | | return el.iid == scope.row.iid |
| | | }) |
| | | // console.log(this.list); |
| | | console.log(index); |
| | | console.log(childrenIndex); |
| | | |
| | | this.list[index].children.splice(childrenIndex , 1); |
| | | if(childrenIndex == 0){ |
| | | this.list.splice(scope.row,1) |
| | | } |
| | | // 删除子项目 |
| | | delChildren(scope,index) { |
| | | console.log(scope,index); |
| | | |
| | | }, |
| | | addwaydata(row){ |
| | | console.log(row.row); |
| | | let index = this.list.findIndex(el =>{ |
| | | return el.children.find(ele => ele.iid == row.row.iid) |
| | | }) |
| | | console.log(index); |
| | | //添加子项目 |
| | | addChildren(row){ |
| | | console.log(row); |
| | | let obj = { |
| | | iid:Math.random(), |
| | | name:'', |
| | | required:'', |
| | | unit:'' |
| | | deviceId: null, |
| | | deviceName: null, |
| | | iid: Math.random(), |
| | | required: null, |
| | | rpId: null, |
| | | name: null, |
| | | unit: null, |
| | | userName: null, |
| | | testValue: null, |
| | | testValueList: [], |
| | | note: null, |
| | | testState: null |
| | | } |
| | | this.list[index].children.push(obj) |
| | | row.children.push(obj) |
| | | }, |
| | | save(){ |
| | | console.log(this.dataForm); |
| | |
| | | console.log(data); |
| | | console.log(this.list); |
| | | data.rawInsProducts = this.list |
| | | // console.log(data.rawInsProducts); |
| | | // data.rawInsProducts.forEach(item=>{ |
| | | // console.log(item); |
| | | // let val = item.testValueList.join(",") |
| | | // item.testValue = val |
| | | // console.log(item.testValue); |
| | | // }) |
| | | // console.log(data); |
| | | console.log('=====>'); |
| | | addRawInspects(data).then(res=>{ |
| | | // this.$message.success("保存成功") |
| | | this.$message.success("保存成功") |
| | | this.$router.go(-1) |
| | | }).catch(error=>{ |
| | | // this.$message.error(error||'error') |
| | | this.$message.error(error) |
| | | }) |
| | | }, |
| | | getDeviceList(){ |