From 9a0e4f1641f41a3dc1df4453ad416fb1522bd2ea Mon Sep 17 00:00:00 2001 From: 王震 <10952869+daywangzhen@user.noreply.gitee.com> Date: 星期四, 18 一月 2024 17:30:49 +0800 Subject: [PATCH] modified: src/page/wel.vue modified: src/views/quality/rawMaterial/rawMaterial-form.vue --- src/views/quality/packageinspect/packageInspect-form.vue | 90 +++++++++++++++++++++++++++++++++++---------- 1 files changed, 70 insertions(+), 20 deletions(-) diff --git a/src/views/quality/packageinspect/packageInspect-form.vue b/src/views/quality/packageinspect/packageInspect-form.vue index 5e46efd..2cf2980 100644 --- a/src/views/quality/packageinspect/packageInspect-form.vue +++ b/src/views/quality/packageinspect/packageInspect-form.vue @@ -66,13 +66,12 @@ <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> @@ -93,7 +92,10 @@ 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"> @@ -124,6 +126,7 @@ <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> @@ -194,7 +197,7 @@ updatePackageInspectById, getCustomer, } from '@/api/quality/packageInspect' -import {inspect1,inspect2} from '@/const/defaultPackageInspect' +import {getAllTemplateByEnable} from '@/api/quality/packageInspectTemp' export default { computed:{ }, @@ -202,7 +205,8 @@ }, data(){ return{ - isShow: false, + inspectMoulds: [], + isShow: true, submitData: { id:null, result: null, @@ -253,7 +257,9 @@ this.resultVal=val } } + this.getAllInspect() this.init() + }, watch:{ dialogVisible(newVal){ @@ -263,15 +269,34 @@ } }, 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 = '' @@ -344,6 +369,8 @@ clickAddLine() { this.list.push({ name: '', + isIndex : true, + parentIndex : this.list.length + 1, randomId: Math.random(), isEdit: true, children: [{ @@ -433,11 +460,35 @@ _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, @@ -462,9 +513,7 @@ _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(','), @@ -473,6 +522,7 @@ _than.$nextTick(()=>{ if(_than.list.length>0){ _than.changeResult() + _than.checkShowState() } }) }).catch(error=>{ -- Gitblit v1.9.3