zouyu
2023-09-15 a6a4092ce1899bd020bc15cff43f0977c87e6be8
src/components/view/Technicalindex.vue
@@ -94,7 +94,11 @@
            <!-- 主体右 -->
            <div class="right">
               <el-table :data="tableData" style="width: 100%;overflow-y: auto;min-height: 100%"
                  max-height="100%" row-key="name" border @selection-change="handleSelectionChange"
                  max-height="100%" row-key="name" border
                  @select-all="selectAll"
                  @select="selectTr"
                  ref="multipleTable"
                  @selection-change="handleSelectionChange"
                  default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
                  <el-table-column type="selection" width="55">
                  </el-table-column>
@@ -219,7 +223,7 @@
                        <el-col :span="11" :offset="2">
                           <el-form-item label="工艺">
                              <template>
                                 <el-select v-model="form.name" placeholder="请选择" allow-create filterable>
                                 <el-select v-model="form.name" placeholder="请选择" @change="craftrow" allow-create filterable>
                                    <el-option v-for="item in craftapi" :key="item.id" :label="item.name" :value="item.id">
                                    </el-option>
                                 </el-select>
@@ -306,6 +310,7 @@
                modifyevent:false,
                dialogVisible:false,
                tableData: [],
            crafval:'',
                typeselect:0,
                upData:{},
                upDia:false,
@@ -328,26 +333,43 @@
         this.selectAllright()
      },
        methods:{
              // 表格树全部选中配置
                // 全选/取消选操作
                selectAll(val) {
                    this.isAllSelect = !this.isAllSelect;
                    let data = this.tableData;
                    this.toggleSelect(data, this.isAllSelect, "all");
                },
         handleSelectionChange(val) {
            this.selects = val;
            this.deleteList = [];
                val.forEach((v) => {
                if (v.id !== undefined) {
                    this.deleteList.push(v.id);
                }
                });
         },
            // 全选/取消选操作
            selectAll(val) {
                this.isAllSelect = !this.isAllSelect;
                let data = this.tableData;
                this.toggleSelect(data, this.isAllSelect, "all");
            },
             //选择某行
          selectTr(selection, row) {
                console.log(selection,row);
                this.$set(row, "isChecked", !row.isChecked);
                this.$nextTick(() => {
                    this.isAllSelect = row.isChecked;
                    this.toggleSelect(row, row.isChecked, "tr");
                });
            },
         toggleSelection(row, flag) {
            this.$set(row, "isChecked", flag);
            this.$nextTick(() => {
            if (flag) {
               this.$refs.multipleTable.toggleRowSelection(row, flag);
            } else {
               this.$refs.multipleTable.clearSelection();
            }
            });
         },
             //递归子级
            toggleSelect(data, flag, type) {
            // console.log('222');
                if (type === "all") {
                    console.log('222');
                    if (data.length > 0) {
                        data.forEach((item) => {
                        this.toggleSelection(item, flag);
@@ -366,9 +388,8 @@
                    }
                }
            },
            handleClose(){
         },
//---------------------------------------------------------------------------------------------------------------------------------------
            handleClose(){},
         selectDataList() {
            this.list.forEach(a => {
               a.code = '[1]'
@@ -413,7 +434,8 @@
                  "Content-Type": "application/json"
               }
            }).then(res => {
               this.selectAllright()
               /* this.selectAllright() */
                 this.$parent.removeAllTab()
            })
         },
         submitUpData() { //确定
@@ -426,8 +448,9 @@
            this.$axios.post(this.$api.url.delTechBy, {
               id: this.upData.id
            }).then(res => {
               this.selectAllright()
               /* this.selectAllright() */
               this.$message.success('删除完成')
               this.$parent.removeAllTab()
            })
         },
         deleteRow(index, rows) {
@@ -441,22 +464,23 @@
            this.$axios.post(this.$api.url.delAllTechskill, {
               ids: this.delete
            }).then(res => {
               this.selectAllright()
               /* this.selectAllright() */
               this.$parent.removeAllTab()
            })
         },
         dels() {
            this.selects.forEach(a => {
               for (var b = 0; b < this.tableData.length; b++) {
                  if (this.tableData[b].id == a.id) {
                     this.tableData.splice(b, 1)
                     b--
                  }
               }
            })
            let cc = this.selects.map(el => {
               return el.id
            })
            this.delete = cc.join(',')
            let ee = []
                console.log(this.selects);
                this.selects.forEach(el =>{
                    if(el.children){
                        el.children.forEach(ele =>{
                            ee.push(ele.id)
                        })
                    }
                })
            // cc.splice(0,1)
            this.delete = ee.join(',')
            console.log(this.delete);
            this.delAllTechskill()
            this.$message.success('删除完成')
@@ -515,6 +539,7 @@
               })[0]
               console.log(one);
               let name = one.children[0].id
               this.checkTreeNode.id = name
               console.log(name);
               this.selectAllrightStart(name)
               this.selectDataList();
@@ -546,12 +571,16 @@
               console.log(this.tableData);
            });
         },
         craftrow(val){
            this.crafval = val
            this.chooseProFath()
         },
         //上级
         chooseProFath() {
            console.log(this.checkTreeNode.id);
            this.$axios.get(this.$api.url.chooseProFath, {
               params: {
                  techTemId: this.checkTreeNode.id
                  techTemId:this.crafval
               }
            }).then(res => {
               this.higherlevel = res.data;
@@ -595,13 +624,6 @@
         },
         modify() {
            this.modifyevent = true
         },
         // deleteRow(index, rows) {
         // console.log();
         // rows.splice(index, 1);
         // },
         handleSelectionChange(val) {
            this.selects = val;
         },
         //编辑