| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | components: {technology}, |
| | | data() { |
| | | return { |
| | | // BOM树数据结构 |
| | | list: [{ |
| | | id: 0, |
| | | name: "原材料", |
| | |
| | | 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() { |
| | |
| | | }, |
| | | methods: { |
| | | handleNodeClick(data) { |
| | | console.log(data); |
| | | // console.log(data); |
| | | this.checkTreeNode = data |
| | | // this.selectMaterialTree() |
| | | this.selectProductTableData() |
| | | }, |
| | | filterNode(value, data) { |
| | | if (!value) return true; |
| | |
| | | }) |
| | | }) |
| | | |
| | | }, |
| | | 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) |
| | | } |
| | | } |
| | | } |