From 16bdd567df324e05cfd137fb57b07ac23400a175 Mon Sep 17 00:00:00 2001 From: hailin <1356886193@qq.com> Date: 星期二, 01 八月 2023 16:55:38 +0800 Subject: [PATCH] 标准库的二次修改和检查详情页的编写来自锅炉组长 --- src/components/view/standard.vue | 71 ++++++++++++++++++++++++++++++----- 1 files changed, 61 insertions(+), 10 deletions(-) diff --git a/src/components/view/standard.vue b/src/components/view/standard.vue index 0ee0fae..883e3f1 100644 --- a/src/components/view/standard.vue +++ b/src/components/view/standard.vue @@ -111,7 +111,7 @@ <el-row> <el-col :span="12" style="line-height: 32px;">鏍囧噯BOM</el-col> <el-col :span="12" style="text-align: right;"> - <el-button type="primary" icon="el-icon-plus" style="background: #004EA2;">鏂板</el-button> + <el-button type="primary" icon="el-icon-plus" style="background: #004EA2;" @click="bomAddModelVisible= true">鏂板</el-button> <el-button icon="el-icon-edit-outline">淇敼</el-button> <el-button icon="el-icon-delete">鍒犻櫎</el-button> </el-col> @@ -136,18 +136,33 @@ <div class="choose"> <span>绫诲瀷锛�</span> <el-select v-model="tableType" size="small" placeholder="璇烽�夋嫨" style="width: 224px;margin-right: 52px;"> - <el-option value="宸ヨ壓鏂囦欢"></el-option> - <el-option value="鎶�鏈寚鏍�"></el-option> + <el-option :value="0" label="宸ヨ壓鏂囦欢"></el-option> + <el-option :value="1" label="鎶�鏈寚鏍�"></el-option> </el-select> - <span>{{tableType=='鎶�鏈寚鏍�'?'椤圭洰锛�':'宸ヨ壓鍚嶇О锛�'}}</span> + <span>{{tableType==1?'椤圭洰锛�':'宸ヨ壓鍚嶇О锛�'}}</span> <el-input v-model="searchName" size="small" placeholder="璇疯緭鍏�" style="width: 224px;margin-right: 24px;" clearable></el-input> - <el-button size="mini"><span>閲� 缃�</span></el-button> - <el-button size="mini" type="primary" style="background: #004EA2;"><span>鏌� 璇�</span></el-button> + <el-button size="mini" @click="()=>{searchName='';selectProductTableData()}"><span>閲� 缃�</span></el-button> + <el-button size="mini" type="primary" style="background: #004EA2;" @click="selectProductTableData"><span>鏌� 璇�</span></el-button> </div> <div class="table"> - <technology></technology> + <technology v-if="tableData.length!==0" :tableType="tableType" :tableData="tableData"></technology> </div> </div> + </div> + <div class="bom-add-model"> + <el-dialog + title="BOM鏂板" + :visible.sync="bomAddModelVisible" + width="30%" + :before-close="handleClose"> + <el-form> + + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="bomAddModelVisible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="bomAddModelVisible = false">纭� 瀹�</el-button> + </span> + </el-dialog> </div> </div> </template> @@ -158,6 +173,7 @@ components: {technology}, data() { return { + // BOM鏍戞暟鎹粨鏋� list: [{ id: 0, name: "鍘熸潗鏂�", @@ -175,13 +191,24 @@ children: [] }], search: null, - tableType: "鎶�鏈寚鏍�", - searchName: "" + // 琛ㄦ牸绫诲瀷 1锛氭妧鏈寚鏍囷紝0锛氬伐鑹鸿矾绾� + tableType: 1, + // 鏌ヨ鏉′欢-鍚嶇О + searchName: "", + // 鐐瑰嚮閫変腑鏍戣妭鐐� + checkTreeNode: {}, + tableData:[], + // 鎺у埗bom鏂板妯℃�佹鏄惁鏄剧ず + bomAddModelVisible: false } }, watch: { search(val) { this.$refs.tree.filter(val); + }, + tableType(val){ + console.log(val) + this.selectProductTableData() } }, mounted() { @@ -189,7 +216,10 @@ }, methods: { handleNodeClick(data) { - console.log(data); + // console.log(data); + this.checkTreeNode = data + // this.selectMaterialTree() + this.selectProductTableData() }, filterNode(value, data) { if (!value) return true; @@ -225,6 +255,27 @@ }) }) + }, + async selectProductTableData() { + switch (this.tableType) { + case 0: + const {data:technologyList} = await this.$axios.get(this.$api.url.selectTechnologyByMaterial,{params:{specificationId:this.checkTreeNode.id,technologyName:this.searchName}}) + this.tableData = technologyList + break; + case 1: + const {data:productList} = await this.$axios.get(this.$api.url.selectProductByMaterial,{params:{specifications:this.checkTreeNode.id,project:this.searchName}}) + productList.forEach((item,index)=>{ + item.name = item.father + item.index = index+1 + item.id = item.father + if(item.children.length===1){ + productList[index] = {...item.children[0],index: index+1,name:item.father} + } + }) + this.tableData = productList + break; + } + console.log(this.tableData) } } } -- Gitblit v1.9.3