| | |
| | | <el-row :gutter="10" style="width:100%;z-index: 10;height:30px;"> |
| | | <el-col :span="12">检验项目</el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-dropdown @command="handleCommand" v-if="!isShow && resultVal==null"> |
| | | <el-dropdown @command="handleCommand" v-if="isShow"> |
| | | <el-button size="mini" style="margin-right: 10px;" type="primary" > |
| | | 切换默认检验项<i class="el-icon-arrow-down el-icon--right"></i> |
| | | 切换检验项模板<i class="el-icon-arrow-down el-icon--right"></i> |
| | | </el-button> |
| | | <el-dropdown-menu slot="dropdown"> |
| | | <el-dropdown-item command="1">检验项目1</el-dropdown-item> |
| | | <el-dropdown-item divided command="2">检验项目2</el-dropdown-item> |
| | | <el-dropdown-item :key="index" v-for="(item,index) in inspectMoulds" :command="item.father">{{item.father}}</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | | <el-button v-if="resultVal=='' || resultVal==null" size="mini" @click="clickAddLine()">添加检验项目</el-button> |
| | |
| | | row-key="randomId" class="l-mes" |
| | | default-expand-all |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> |
| | | <el-table-column type="index" label="序号" width="60"> |
| | | <el-table-column type="index" prop="parentIndex" label="序号" width="60"> |
| | | <template scope="scope"> |
| | | <span v-if="scope.row.isIndex">{{scope.row.parentIndex}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="项目" width="160"> |
| | | <template slot-scope="scope"> |
| | |
| | | <el-select style="width:100%" :disabled="resultVal!=null" @change="changeResult" v-model="scope.row.result" v-if="!scope.row.children"> |
| | | <el-option label="合格" value="合格"></el-option> |
| | | <el-option label="不合格" value="不合格"></el-option> |
| | | <el-option label="不适用" value="不适用"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | updatePackageInspectById, |
| | | getCustomer, |
| | | } from '@/api/quality/packageInspect' |
| | | import {inspect1,inspect2} from '@/const/defaultPackageInspect' |
| | | import {getAllTemplateByEnable} from '@/api/quality/packageInspectTemp' |
| | | export default { |
| | | computed:{ |
| | | }, |
| | |
| | | }, |
| | | data(){ |
| | | return{ |
| | | isShow: false, |
| | | inspectMoulds: [], |
| | | isShow: true, |
| | | submitData: { |
| | | id:null, |
| | | result: null, |
| | |
| | | this.resultVal=val |
| | | } |
| | | } |
| | | this.getAllInspect() |
| | | this.init() |
| | | |
| | | }, |
| | | watch:{ |
| | | dialogVisible(newVal){ |
| | |
| | | } |
| | | }, |
| | | methods:{ |
| | | checkShowState(){ |
| | | let num = 0 |
| | | this.list.forEach(ele=>{ |
| | | if(ele.children){ |
| | | ele.children.forEach(c=>{ |
| | | if(c.pid){ |
| | | num+=1 |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | this.isShow = num==0 |
| | | }, |
| | | getAllInspect(){ |
| | | getAllTemplateByEnable().then(res=>{ |
| | | if(res.status===200){ |
| | | this.inspectMoulds = res.data.data |
| | | } |
| | | }).catch(error=>{ |
| | | console.error(error) |
| | | }) |
| | | }, |
| | | handleCommand(command) { |
| | | switch(command){ |
| | | case "1": |
| | | this.init(inspect1) |
| | | break; |
| | | case "2": |
| | | this.init(inspect2) |
| | | break; |
| | | } |
| | | this.inspectMoulds.forEach(ele=>{ |
| | | if(ele.father==command){ |
| | | this.init(ele.children) |
| | | } |
| | | }) |
| | | }, |
| | | changeResult(){ |
| | | let result = '' |
| | |
| | | clickAddLine() { |
| | | this.list.push({ |
| | | name: '', |
| | | isIndex : true, |
| | | parentIndex : this.list.length + 1, |
| | | randomId: Math.random(), |
| | | isEdit: true, |
| | | children: [{ |
| | |
| | | _than.list = [] |
| | | let userNameList = [] |
| | | if(dataList){ |
| | | _than.list = JSON.parse(JSON.stringify(dataList)) |
| | | let tempList = [] |
| | | dataList.forEach((ele,index)=>{ |
| | | let obj = { |
| | | randomId: Math.random(), |
| | | name: ele.inspectName, |
| | | isIndex: true, |
| | | parentIndex: index+1, |
| | | children: [] |
| | | } |
| | | if(ele.children){ |
| | | ele.children.forEach(e=>{ |
| | | obj.children.push({ |
| | | required: e.inspectRequired, |
| | | randomId: Math.random(), |
| | | isEdit: false, |
| | | note: '', |
| | | result: '' |
| | | }) |
| | | }) |
| | | } |
| | | tempList.push(obj) |
| | | }) |
| | | _than.list = tempList |
| | | } |
| | | data.packageInsProductS.forEach(item => { |
| | | data.packageInsProductS.forEach((item,index) => { |
| | | if (item.children) { |
| | | let ele = { |
| | | isIndex: true, |
| | | parentIndex: index+1, |
| | | isEdit: true, |
| | | randomId: Math.random(), |
| | | name: null, |
| | |
| | | _than.list.push(ele) |
| | | } |
| | | }) |
| | | let find1 = this.list.find(ele=>ele.name===inspect1[0].name&&ele.isEdit) !=undefined; |
| | | let find2 = this.list.find(ele=>ele.name===inspect2[0].name&&ele.isEdit) !=undefined; |
| | | this.isShow = find1||find2 |
| | | |
| | | _than.conclusionTable = [{ |
| | | packageNo: data.packageNo, |
| | | userName: Array.from(new Set(userNameList)).join(','), |
| | |
| | | _than.$nextTick(()=>{ |
| | | if(_than.list.length>0){ |
| | | _than.changeResult() |
| | | _than.checkShowState() |
| | | } |
| | | }) |
| | | }).catch(error=>{ |