zouyu
2023-09-11 7965761658b890fce87de832a1ae76cc82a3c33b
src/components/view/standard.vue
@@ -7,15 +7,21 @@
          <el-button type="primary" icon="el-icon-plus" style="background: #004EA2;"
            @click="bomAddModelVisible = true">新增</el-button>
          <el-button icon="el-icon-plus">新增版本</el-button>
          <el-button icon="el-icon-edit-outline">修改</el-button>
          <el-button icon="el-icon-delete">删除</el-button>
          <el-button @click="bomRightUp=true" icon="el-icon-edit-outline">修改</el-button>
          <el-button @click="bomRightDl=true" icon="el-icon-delete">删除</el-button>
        </el-col>
      </el-row>
    </div>
    <div class="thing">
      <div class="left">
        <el-row>
          <el-col :span="21">
        <el-input v-model="search" suffix-icon="el-icon-search" placeholder="请输入搜索内容" size="small" clearable></el-input>
          </el-col>
          <el-col :span="2">
            <el-button  size="mini" icon="el-icon-plus" @click="bomLeftAdd=true"></el-button>
          </el-col>
        </el-row>
        <el-tree :data="list" ref="tree" default-expand-all :props="{ children: 'children', label: 'name' }"
          node-key="id" :filter-node-method="filterNode" @node-click="handleNodeClick" highlight-current>
          <div class="custom-tree-node" slot-scope="{ node, data }">
@@ -59,21 +65,55 @@
          <target :tableType="tableType" :tableData="tableData"></target>
        </div>
        <div v-if="this.typeselect == 2">
          <material  :tableType="tableType" :tableData="tableData"></material>
          <bom  :tableType="tableType" :tableData="tableData"></bom>
        </div>
        <div v-if="this.typeselect == 3">生产工艺</div>
      </div>
    </div>
    <div class="bom-add-model">
      <el-dialog title="BOM新增" :visible.sync="bomAddModelVisible" width="30%">
        <el-form>
        </el-form>
        <div>
          <!-- 物料清单新增 -->
          <bomClickAdd v-if="typeselect===2"/>
        </div>
        <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>
      <!-- 左侧点击+按钮 -->
      <el-dialog title="BOM新增" :visible.sync="bomLeftAdd" width="29%">
        <el-form ref="leftAdd" :model="leftAdd">
            <el-form-item label="类型">
              <el-cascader v-model="leftAdd.type" size="mini" style="width: 93%;" :options="formTypeOptions" :props="{ checkStrictly: true }" clearable></el-cascader>
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="bomLeftAdd = false">取 消</el-button>
          <el-button type="primary" @click="bomLeftAdd = false">确 定</el-button>
        </span>
      </el-dialog>
            <!-- 右上侧点击修改按钮 -->
      <el-dialog title="BOM修改" :visible.sync="bomRightUp" width="30%">
        <el-form>
            修改
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="bomRightUp = false">取 消</el-button>
          <el-button type="primary" @click="bomRightUp = false">确 定</el-button>
        </span>
      </el-dialog>
        <!-- 右上侧点击删除按钮 -->
      <el-dialog title="BOM删除" :visible.sync="bomRightDl" width="30%">
        <el-form>
            删除
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="bomRightDl = false">取 消</el-button>
          <el-button type="primary" @click="bomRightDl = false">确 定</el-button>
        </span>
      </el-dialog>
    </div>
@@ -83,9 +123,11 @@
<script>
import technology from "./standard-table/technology.vue"
import material from "./standard-table/material.vue"
import target from "./standard-table/target.vue"
import bom from "./standard-table/bom.vue"
import bomClickAdd from '@/components/view/standard-box/bomClickAdd'
export default {
  components: { technology,material,target },
  components: { technology,material,bom,bomClickAdd },
  data() {
    return {
      // BOM树数据结构
@@ -96,14 +138,25 @@
      checkTreeNode: {},// 点击选中树节点
      tableData: [],
      bomAddModelVisible: false,// 控制bom新增模态框是否显示
      bomLeftAdd: false,
      bomRightUp: false,
      bomRightDl: false,
      formTypeOptions: null,
      typeselect: 0,
      returntree: {
        id:28,
      },
      version: {},
      leftAdd:{
        type: null,
        father: null,
        standard: null,
        name: null,
        specifications: null
      },
      VER: {},
      verdata: {},
      character: 0,
      character: 0
    }
  },
  // watch: {
@@ -120,6 +173,9 @@
    this.selectVersion()
  },
  methods: {
    startLeftAdd(){
    },
    selectDataList() {
            this.list.forEach(a => {
               a.code = '[1]'
@@ -149,13 +205,14 @@
    },
    TYPE(val) {//类型.数据
      console.log(val);
      // console.log(val);
      this.typeselect = val
      // console.log(this.typeselect);
      this.selectVersion()
    },
    handleNodeClick(val) {//树的值
      console.log(val);
      // console.log(val);
      this.returntree = val
    },
    async selectVersion() {//版本
@@ -174,7 +231,6 @@
      })
      this.character=v
      this.VER="v"+v
      console.log(this.character);
      this.selectAll()
    },
    //右侧数据
@@ -187,7 +243,9 @@
        }
      }).then(res => {
        let arr = res.data;
        this.formatData(arr)
        for(var i=0;i<arr.length;i++){
            arr[i].id = "0" + i;
        }
        this.tableData = arr;
      })
    },
@@ -201,9 +259,9 @@
        }
    },
    verevent(val) {
      console.log(val);
      // console.log(val);
      let cc = val.replace('v', '')
      console.log(cc);
      // console.log(cc);
      this.character = cc
      this.selectAll()
      // const { v, ...newObj } = val;
@@ -240,6 +298,7 @@
      })
    },
    getDefault(arr, index) {
      console.log(arr);
         for (const item of arr) {
            if (item.children && item.children.length > 0) {
               // 有子节点
@@ -289,6 +348,32 @@
          this.tableData = productList
          break;
      }
    },
    replaceProp(arr){
      for (let index = 0; index < arr.length; index++) {
        let element = arr[index];
        element.label=element.name
        element.value=element.name
        // if()
      }
    }
  },
  watch:{
    leftAdd: {
      handler(newVal, oldVal) {
      console.log("新的",newVal);
      console.log("旧的",oldVal);
      },
     deep: true // 深度监听对象内部属性的变化,可选的
  },
  bomLeftAdd:{
    handler(newval,oldVal){
      if(newval){
       let treeOptions = JSON.parse(JSON.stringify(this.list));
       console.log(treeOptions);
      }
    }
    }
  }
}