| | |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="零件号" prop="code"> |
| | | <el-input v-model="dataForm.code"> |
| | | <el-input v-model="dataForm.code" :disabled="dataForm&&dataForm.id!==null&&dataForm.id!==''"> |
| | | <el-button |
| | | slot="append" |
| | | icon="el-icon-search" |
| | | :disabled="(resultVal!=null && resultVal!='')" |
| | | :disabled="dataForm&&dataForm.id!==null&&dataForm.id!==''" |
| | | @click="queryCode"></el-button> |
| | | <el-button |
| | | slot="append" |
| | | icon="el-icon-full-screen" |
| | | :disabled="(resultVal!=null && resultVal!='')" |
| | | :disabled="dataForm&&dataForm.id!==null&&dataForm.id!==''" |
| | | @click="Turnonthecamera"></el-button> |
| | | </el-input> |
| | | </el-form-item> |
| | |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="数量" prop="number"> |
| | | <el-input v-model="dataForm.number" :disabled="(resultVal!=null && resultVal!='')" /> |
| | | <el-input v-model="dataForm.number" :disabled="dataForm&&dataForm.id!==null&&dataForm.id!==''" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="6"> |
| | | <el-form-item label="报检日期" prop="createTime"> |
| | | <el-form-item label="报检日期" prop="startTime"> |
| | | <el-date-picker |
| | | :disabled="dataForm.id!=null" |
| | | v-model="dataForm.createTime" |
| | | disabled |
| | | v-model="dataForm.startTime" |
| | | type="datetime" |
| | | format="yyyy-MM-dd HH:mm:ss" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="报检日期"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="报检人" prop="createUser" v-if="dataForm.id!=null"> |
| | | <el-col :span="6" v-if="dataForm.id!=null"> |
| | | <el-form-item label="报检人" prop="createUser" > |
| | | <el-input v-model="dataForm.createUser" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item prop="projectName" label="项目名称" v-if="dataForm.id!=null"> |
| | | <el-col :span="6" v-if="dataForm.id!=null"> |
| | | <el-form-item prop="projectName" label="项目名称" > |
| | | <el-tooltip :disabled="dataForm.projectName==null" :content="dataForm.projectName"> |
| | | <el-input v-model="dataForm.projectName" disabled ></el-input> |
| | | </el-tooltip> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="备注" prop="remark"> |
| | | <el-input :disabled="dataForm&&dataForm.id!==null&&dataForm.id!==''" v-model="dataForm.remark" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </div> |
| | |
| | | <el-row style="width:100%;z-index: 10;height:50px;" v-if="resultVal==null"> |
| | | <el-col :span="12"></el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-button v-if="dataForm.id&&resultVal==null" size="small" |
| | | type="primary" |
| | | @click="saveTable()">保存</el-button> |
| | | <el-button v-if="dataForm.id==null" size="small" @click="clickAddLine()">添加检验项目</el-button> |
| | | <el-button class="pad-addcol-btn" v-if="resultVal==null || dataForm.id==null" size="small" @click="addTeatValueColumn()">添加检测值列</el-button> |
| | | <el-button v-if="resultVal==null || dataForm.id==null" size="small" @click="delTeatValueColumn()">删除检测值列</el-button> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="father" label="检验项目" width="160"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-if="scope.row.children" style="width:80%" :disabled="dataForm.id!=null" v-model="scope.row.father" placeholder="请输入检验项目"></el-input> |
| | | <el-input v-if="scope.row.children" style="width:80%" :disabled="dataForm.id!=null&&(resultVal!=null && resultVal!='')" v-model="scope.row.father" placeholder="请输入检验项目" |
| | | :ref="'inspectProject'+scope.$index" |
| | | :id="'inspectProject'+scope.$index" |
| | | @keyup.native="moveFocus($event, scope.$index, 'inspectProject')"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="项目" width="160"> |
| | | <template slot-scope="scope"> |
| | | <div v-if="!scope.row.children"> |
| | | <el-input class="inline-input" :disabled="dataForm.id!=null" v-model="scope.row.name" |
| | | placeholder="请输入项目名称"></el-input> |
| | | <el-input class="inline-input" :disabled="dataForm.id!=null&&(resultVal!=null && resultVal!='')" v-model="scope.row.name" |
| | | placeholder="请输入项目名称" |
| | | :ref="'project'+scope.$index" |
| | | :id="'project'+scope.$index" |
| | | @keyup.native="moveFocus($event, scope.$index, 'project')"></el-input> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="unit" label="单位" width="160"> |
| | | <template slot-scope="scope"> |
| | | <div v-if="!scope.row.children"> |
| | | <el-input :disabled="dataForm.id != null" v-model="scope.row.unit" placeholder="请输入单位"></el-input> |
| | | <el-input :disabled="dataForm.id!=null&&(resultVal!=null && resultVal!='')" v-model="scope.row.unit" placeholder="请输入单位" |
| | | :ref="'unit'+scope.$index" |
| | | :id="'unit'+scope.$index" |
| | | @keyup.native="moveFocus($event, scope.$index, 'unit')"></el-input> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | <el-table-column prop="required" label="标准值" width="160"> |
| | | <template slot-scope="scope"> |
| | | <div v-if="!scope.row.children"> |
| | | <el-input :disabled="dataForm.id != null" v-model="scope.row.required" |
| | | placeholder="请输入标准值"></el-input> |
| | | <el-input :disabled="dataForm.id!=null&&(resultVal!=null && resultVal!='')" v-model="scope.row.required" |
| | | placeholder="请输入标准值" |
| | | :ref="'standard'+scope.$index" |
| | | :id="'standard'+scope.$index" |
| | | @keyup.native="moveFocus($event, scope.$index, 'standard')"></el-input> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="testValue" label="检测值" min-width="160" v-for="(item,index) in empiricalValueAdd" :key="index"> |
| | | <template slot-scope="scope"> |
| | | <div v-if="!scope.row.children"> |
| | | <el-tooltip :disabled="scope.row.deviceId != null" class="item" effect="dark" content="请先选择设备!" placement="top-start"> |
| | | <el-dropdown> |
| | | <el-input placeholder="检测值"/> |
| | | <i style="line-height: normal;padding: 10px 7px;" class="el-icon-arrow-down el-icon--right"></i> |
| | | <el-dropdown-menu slot="dropdown"> |
| | | <el-dropdown-item>黄金糕</el-dropdown-item> |
| | | <el-dropdown-item>狮子头</el-dropdown-item> |
| | | <el-dropdown-item>螺蛳粉</el-dropdown-item> |
| | | <el-dropdown-item>双皮奶</el-dropdown-item> |
| | | <el-dropdown-item>蚵仔煎</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | | <!-- <el-autocomplete clearable |
| | | :disabled="scope.row.deviceId == null || (dataForm.id!=null&&(resultVal!=null && resultVal!=''))" |
| | | @blur.stop="changeState(scope.row,scope.$index)" |
| | | @select="changeState(scope.row,scope.$index)" |
| | | v-model="scope.row.testValueList[index]" |
| | | :fetch-suggestions="querySearch" |
| | | placeholder="请输入或选择检测值" > |
| | | <i style="line-height: normal;padding: 10px 7px;" class="el-icon-arrow-down" slot="suffix"></i> |
| | | <template slot-scope="{ item }"> |
| | | <div>{{ item.value }}</div> |
| | | </template> |
| | | </el-autocomplete> --> |
| | | <!-- :disabled="scope.row.deviceId == null || (dataForm.id!=null&&(resultVal!=null && resultVal!=''))" --> |
| | | <!-- @input="$nextTick(()=>{checkTestValues(scope.row)})" --> |
| | | <!-- @blur.capture.native="changeState(scope.row)" --> |
| | | <el-tooltip :disabled="scope.row.deviceId != null" class="item" effect="dark" content="请先选择设备!" placement="top-start"> |
| | | <el-autocomplete clearable |
| | | cache="false" |
| | | @blur="checkTestValues(scope.row,'blur',$event)" |
| | | @select="checkTestValues(scope.row,'select',$event)" |
| | | :disabled="scope.row.deviceId == null || (dataForm.id!=null&&(resultVal!=null && resultVal!=''))" |
| | | v-model="scope.row.testValueList[index]" |
| | | :fetch-suggestions="querySearch" |
| | | placeholder="请输入或选择检测值" |
| | | :ref="`detectionValue${index}`+scope.$index" |
| | | :id="`detectionValue${index}`+scope.$index" |
| | | @keyup.native="moveFocus($event, scope.$index, `detectionValue${index}`)" |
| | | popper-class="no-keyboard-events"> |
| | | <template slot-scope="{ item }"> |
| | | <div>{{ item.value }}</div> |
| | | </template> |
| | | </el-autocomplete> |
| | | </el-tooltip> |
| | | </div> |
| | | </template> |
| | |
| | | <el-table-column prop="note" label="检验描述" width="160" > |
| | | <template slot-scope="scope"> |
| | | <div v-if="!scope.row.children"> |
| | | <el-input @blur="changeState(scope.row, scope.$index)" :disabled="scope.row.deviceId == null || (dataForm.id!=null&&(resultVal!=null && resultVal!=''))" v-model="scope.row.note" placeholder="检验描述"></el-input> |
| | | <el-input @blur="checkTestValues(scope.row,'blur',$event)" :disabled="scope.row.deviceId == null || (dataForm.id!=null&&(resultVal!=null && resultVal!=''))" v-model="scope.row.note" placeholder="检验描述" |
| | | :ref="`remark`+scope.$index" |
| | | :id="`remark`+scope.$index" |
| | | @keyup.native="moveFocus($event, scope.$index, `remark`)"></el-input> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | :disabled="dataForm.rawInsNo==null || (resultVal!=null && resultVal!='')" |
| | | drag |
| | | ref="upload" |
| | | action="/mes/rawInsProduct/upload" |
| | | action="/mes/attachment/upload" |
| | | :auto-upload="true" |
| | | :headers="headers" |
| | | :before-upload="submitUpload" |
| | |
| | | </div> |
| | | </el-upload> |
| | | </div> |
| | | |
| | | <el-table :data="processConfigFileTableData" height="260px"> |
| | | <el-table-column |
| | | prop="rawInsNo" |
| | |
| | | getObj, |
| | | updateRawInsProduct, |
| | | updateRawInspectsById, |
| | | getProcessConfigFiles, |
| | | downloadProcessConfigFile, |
| | | deleteProcessConfigFile, |
| | | updateRawInsProduct2, |
| | | updateDeviceById, chooseIFS} from '@/api/quality/rawMaterial' |
| | | import { |
| | | getProcessConfigFiles, |
| | | deleteProcessConfigFile, |
| | | downloadProcessConfigFile |
| | | } from '@/api/quality/attachment' |
| | | import rawMaterialPartDialog from '@/views/common/rawMaterial-part' |
| | | import { getStore } from '@/util/store' |
| | | import qrCodeApp from '@/views/common/qrCodeApp' |
| | | import transformImage from '@/util/fileTransform' |
| | | export default { |
| | | components:{ |
| | | rawMaterialPartDialog, |
| | | qrCodeApp |
| | | qrCodeApp, |
| | | }, |
| | | computed:{}, |
| | | data(){ |
| | |
| | | Authorization: 'Bearer ' + getStore({ name: 'access_token' }) |
| | | }, |
| | | paramData: { |
| | | rawInsNo: '', |
| | | lineNumber: '' |
| | | no: '', |
| | | lineNumber: '', |
| | | type: 0 |
| | | }, |
| | | row: null, |
| | | proIndex: 0, |
| | |
| | | unit: '', |
| | | number: '', |
| | | supplier: '', |
| | | remark:'', |
| | | rawInsProducts: [{ |
| | | deviceId: 0, |
| | | father:'', |
| | |
| | | }], |
| | | dataRule: { |
| | | code:[{ required: true, message: '请扫描选择零件', trigger: 'blur' }], |
| | | createTime: [{ required: true, message: '请选择报检日期', trigger: 'change' }] |
| | | // startTime: [{ required: true, message: '请选择报检日期', trigger: 'blur' }] |
| | | }, |
| | | deviceList: [], |
| | | keyfield:['inspectProject','project','unit','standard','remark'], |
| | | keyfield0:['detectionValue0'] |
| | | } |
| | | }, |
| | | beforeUpdate(){ |
| | |
| | | this.unqualifiedNum = null |
| | | } |
| | | }, |
| | | empiricalValueAdd(newVal){ |
| | | if(newVal!=this.keyfield0.length){ |
| | | if(newVal>this.keyfield0.length){ |
| | | this.keyfield0 = [] |
| | | for(let i=0;i<newVal;i++){ |
| | | this.keyfield0.push('detectionValue'+i) |
| | | } |
| | | }else{ |
| | | this.keyfield0.splice(this.keyfield0.length-1,1); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | methods:{ |
| | | querySearch(queryString, cb){ |
| | |
| | | }, |
| | | getConfigFiles() { |
| | | const param = { |
| | | rawInsNo: this.dataForm.rawInsNo, |
| | | lineNumber: this.dataForm.id |
| | | no: this.dataForm.rawInsNo, |
| | | lineNumber: this.dataForm.id, |
| | | type: 0 |
| | | } |
| | | getProcessConfigFiles(param).then((res) => { |
| | | this.processConfigFileTableData = res.data.data |
| | |
| | | }) |
| | | }, |
| | | submitUpload() { |
| | | this.paramData.rawInsNo = this.dataForm.rawInsNo |
| | | this.paramData.no = this.dataForm.rawInsNo |
| | | this.paramData.lineNumber = this.dataForm.id |
| | | this.progrecessFileLoading = true |
| | | }, |
| | |
| | | this.dataForm.code = param.code |
| | | this.dataForm.name = param.name |
| | | this.dataForm.formTime = param.formTime |
| | | this.dataForm.startTime = param.formTime |
| | | this.dataForm.unit = param.unit |
| | | this.dataForm.specs = param.specs |
| | | this.dataForm.supplier = param.supplier |
| | |
| | | }); |
| | | }, |
| | | addTeatValueColumn(){ |
| | | this.empiricalValueAdd = this.empiricalValueAdd + 1; |
| | | this.$nextTick(()=>{ |
| | | this.empiricalValueAdd = this.empiricalValueAdd + 1; |
| | | }) |
| | | }, |
| | | // 添加行 |
| | | clickAddLine(row,index) { |
| | |
| | | required: null, |
| | | rpId: null, |
| | | name: null, |
| | | unit: 'mm', |
| | | unit: '', |
| | | userName: null, |
| | | testValue: '', |
| | | testValueList: [], |
| | |
| | | if(this.list){ |
| | | this.list.forEach(e=>{ |
| | | if(e.children){ |
| | | e.children.forEach(i=>{ |
| | | e.children.map(i=>{ |
| | | if(i.testValueList.length>1){ |
| | | let arr = i.testValue.split(",") |
| | | arr.splice((arr.length-1),1) |
| | | let obj = { |
| | | deviceId: i.deviceId, |
| | | rpId: i.rpId, |
| | | testValue: arr.join(","), |
| | | note: i.note |
| | | } |
| | | updateRawInsProduct(obj).then(res=>{ |
| | | if(res.data.code === 0){ |
| | | this.init(this.dataForm.id) |
| | | } |
| | | }) |
| | | i.testValueList = i.testValueList.splice(i.testValueList.length-1,1) |
| | | return i |
| | | // let arr = i.testValue.split(",") |
| | | // arr.splice((arr.length-1),1) |
| | | // let obj = { |
| | | // deviceId: i.deviceId, |
| | | // rpId: i.rpId, |
| | | // testValue: arr.join(","), |
| | | // note: i.note |
| | | // } |
| | | // updateRawInsProduct(obj).then(res=>{ |
| | | // if(res.data.code === 0){ |
| | | // this.init(this.dataForm.id) |
| | | // } |
| | | // }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | this.saveTable() |
| | | } |
| | | }, |
| | | delTeatValueColumn(){ |
| | | if (this.empiricalValueAdd - 1 > 0) { |
| | | if (this.empiricalValueAddMaxNumber != this.empiricalValueAdd - 1) { |
| | | this.empiricalValueAdd = this.empiricalValueAdd - 1; |
| | | this.changeRowResult() |
| | | // this.changeRowResult() |
| | | this.list.forEach(i => { |
| | | if(i.children){ |
| | | i.children.forEach(ele=>{ |
| | |
| | | }) |
| | | } |
| | | }); |
| | | this.saveTable() |
| | | } |
| | | } |
| | | }, |
| | |
| | | this.dataForm.rawInsNo = data.rawInsNo |
| | | this.dataForm.name = data.name |
| | | this.dataForm.formTime = data.formTime |
| | | this.dataForm.startTime = data.startTime |
| | | this.dataForm.remark = data.remark |
| | | this.dataForm.code = data.code |
| | | this.dataForm.specs = data.specs |
| | | this.dataForm.unit = data.runit |
| | |
| | | console.log(e,e.target.tabIndex); |
| | | console.log(e.target.value); |
| | | }, |
| | | changeState(row, index) { |
| | | this.$nextTick(()=>{ |
| | | if(row){ |
| | | let isTrue = true |
| | | for(var i=0;i<row.testValueList.length;i++){ |
| | | let val = row.testValueList[i] |
| | | if(!['是','否'].includes(val)){ |
| | | let reg = /(^-?[0-9]{1,6}$)|(^-?[0-9]{1,6}[\.]{1}[0-9]{1,3}$)/ |
| | | if(!reg.test(val)){ |
| | | row.testValueList = '' |
| | | this.$message.error("请输入6位数字或选择是否") |
| | | isTrue = false |
| | | checkTestValues(row,currentOption,event){ |
| | | if(row){ |
| | | let isTrue = true |
| | | if(currentOption==='blur'){ |
| | | let targetVal = event.target.value |
| | | if( (targetVal && ['是','否'].includes(targetVal)) || !targetVal){ |
| | | isTrue = false |
| | | }else{ |
| | | for(var i=0;i<row.testValueList.length;i++){ |
| | | let val = row.testValueList[i] |
| | | if(val != '' && val != null){ |
| | | if(!['是','否'].includes(val)){ |
| | | let reg = /(^-?[0-9]{1,6}$)|(^-?[0-9]{1,6}[\.]{1}[0-9]{1,3}$)/ |
| | | if(!reg.test(val)){ |
| | | row.testValueList[i] = '' |
| | | event.target.value = '' |
| | | this.$message.error("请输入6位数字或选择是否") |
| | | isTrue = false |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if(!isTrue){ |
| | | return |
| | | } |
| | | // this.changeState(row) |
| | | } |
| | | }, |
| | | saveTable() { |
| | | let rawInsProducts = []; |
| | | this.$nextTick(()=>{ |
| | | this.list.forEach(item=>{ |
| | | if(item.children){ |
| | | item.children.forEach(ele=>{ |
| | | let obj = JSON.parse(JSON.stringify(ele)) |
| | | obj.testValue = obj.testValueList.join(",") |
| | | obj.id = obj.rpId |
| | | delete obj.testValueList; |
| | | obj.name = ele.name; |
| | | obj.father = item.father; |
| | | obj.unit = ele.unit; |
| | | rawInsProducts.push(obj) |
| | | }) |
| | | } |
| | | if(!isTrue){ |
| | | return |
| | | } |
| | | } |
| | | console.log(row.testValueList.join(",")); |
| | | return |
| | | if (row.rpId != null && row.rpId != '') { |
| | | let val = row.testValueList.join(",") |
| | | if (val === undefined || val === '' || val === null) { |
| | | return |
| | | } |
| | | let obj = { |
| | | deviceId: row.deviceId, |
| | | rpId: row.rpId, |
| | | testValue: val, |
| | | note: row.note |
| | | } |
| | | updateRawInsProduct(obj).then(res => { |
| | | if (res.data.code == 0) { |
| | | this.$message.success("更新成功") |
| | | } else { |
| | | this.$message.error("更新失败") |
| | | } |
| | | this.init(this.dataForm.id) |
| | | }) |
| | | }) |
| | | if(rawInsProducts.length>0){ |
| | | updateRawInsProduct2(rawInsProducts).then(res => { |
| | | if (res.data.code == 0) { |
| | | this.$message.success("更新成功") |
| | | } else { |
| | | this.$message.error("更新失败") |
| | | } |
| | | this.init(this.dataForm.id) |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | |
| | | this.list.forEach(item=>{ |
| | | item.children.forEach(c=>{ |
| | | c.testValue=c.testValueList.join(",") |
| | | c.required = c.required.replace(',',',').replace('(','(').replace(')',')') |
| | | }) |
| | | }) |
| | | data.rawInsProducts = this.list |
| | | addRawInspects(data).then(res=>{ |
| | | this.$message.success("保存成功") |
| | | // this.$router.go(-1) |
| | | this.$router.go(-1) |
| | | }).catch(error=>{ |
| | | this.$message.error(error) |
| | | }) |
| | |
| | | this.deviceList = res.data.data |
| | | }) |
| | | }, |
| | | }, |
| | | moveFocus(event, index, key) { |
| | | console.log(key, index,key) |
| | | let keyfield = this.insertArrayAt(this.keyfield,4,this.keyfield0); |
| | | // enter键 |
| | | // if (event.keyCode === 13) { // 回车 |
| | | // if (index === this.getLen() - 1 && key === keyfield[keyfield.length - 1]) { // 最后一行最后一个 |
| | | // console.log('最后一行最后一个无法回车') |
| | | // return |
| | | // } |
| | | // this.$nextTick(() => { |
| | | // event.target.blur() |
| | | // }) |
| | | // if (key === keyfield[keyfield.length - 1]) { // 当前行最后一个,跳转下一行第一个 |
| | | |
| | | // } else { // 跳转下一个 |
| | | // const nextkeyindex = keyfield.findIndex(k => k === key) + 1 |
| | | // this.$nextTick(() => { |
| | | // document.getElementById(keyfield[nextkeyindex] + index).focus() |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | // 向上 =38 |
| | | if (event.keyCode === 38) { |
| | | console.log('向上') |
| | | if (index === 0) { // 第一行 |
| | | console.log('第一行无法向上') |
| | | return |
| | | } |
| | | document.getElementById(key + index).blur() |
| | | if(key.includes('detectionValue')){ |
| | | this.$refs[key + index][0].activated = false; |
| | | } |
| | | let i = 0; |
| | | while (true){ |
| | | let dom = document.getElementById(key + (index - 1-i)) |
| | | if(dom){ |
| | | dom.focus() |
| | | return |
| | | }else if((index-1-i)==0){ |
| | | return |
| | | } |
| | | i++ |
| | | } |
| | | } |
| | | |
| | | // 下 = 40 |
| | | if (event.keyCode === 40) { |
| | | console.log('向下') |
| | | if (index === this.getLen() - 1) { // 最后一行 |
| | | console.log('最后一行无法向下') |
| | | return |
| | | } |
| | | document.getElementById(key + index).blur() |
| | | if(key.includes('detectionValue')){ |
| | | this.$refs[key + index][0].activated = false; |
| | | } |
| | | this.$nextTick(() => { |
| | | let i = 0; |
| | | while (true){ |
| | | let dom = document.getElementById(key + (index + 1+i)) |
| | | console.log(dom,key + (index + 1+i)) |
| | | if(dom){ |
| | | dom.focus() |
| | | return |
| | | }else if((index+1+i)==this.getLen() - 1){ |
| | | return |
| | | } |
| | | i++ |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 左 = 37 |
| | | if (event.keyCode === 37) { |
| | | console.log('向左') |
| | | if (index === 0 && key === keyfield[0]) { // 第一行第一个 |
| | | console.log('第一行第一个无法向左') |
| | | return |
| | | } |
| | | document.getElementById(key + index).blur() |
| | | const prevkeyindex = keyfield.findIndex(k => k === key) - 1 |
| | | this.$nextTick(() => { |
| | | let dom = document.getElementById(keyfield[prevkeyindex] + index) |
| | | if(dom){ |
| | | dom.focus() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 右 = 39 |
| | | if (event.keyCode === 39) { |
| | | console.log('向右') |
| | | if (index === this.getLen() - 1 && key === keyfield[keyfield.length - 1]) { // 最后一行最后一个 |
| | | console.log('最后一行最后一个无法向右') |
| | | return |
| | | } |
| | | document.getElementById(key + index).blur() |
| | | const nextkeyindex = keyfield.findIndex(k => k === key) + 1 |
| | | this.$nextTick(() => { |
| | | let dom = document.getElementById(keyfield[nextkeyindex] + index) |
| | | if(dom){ |
| | | dom.focus() |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | insertArrayAt(arr1, index, arr2) { |
| | | return arr1.slice(0, index).concat(arr2, arr1.slice(index)); |
| | | }, |
| | | getLen(){ |
| | | let arr = [] |
| | | this.list.forEach(item => { |
| | | arr.push(item) |
| | | item.children.forEach(child => { |
| | | arr.push(child) |
| | | }) |
| | | }) |
| | | return arr.length |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | /* .no-keyboard-events * { |
| | | pointer-events: none; |
| | | } */ |
| | | .rawMaterial-detail { |
| | | width: 100%; |
| | | height: 530px; |
| | |
| | | border: 1px solid #e4e7ed; |
| | | border-bottom: none; |
| | | } |
| | | .dropdown{ |
| | | position: relative; |
| | | right: 30px; |
| | | top: 5px; |
| | | color: #C0C4CC; |
| | | font-size: 14px; |
| | | } |
| | | @media (max-width: 767px) { |
| | | .pad-addcol-btn{ |
| | | font-size:12px; |