value
2023-09-21 7b2fffec6f45d2b5d4c827efbeee4a2e21c0adc0
src/components/view/Technicalindex.vue
@@ -35,7 +35,6 @@
                        </el-form-item>
                     </el-col>
                  </el-row>
                  <el-row>
                     <el-col :span="11">
                        <el-form-item label="项目组">
@@ -48,7 +47,6 @@
                        </el-form-item>
                     </el-col>
                  </el-row>
                  <el-form-item label="单位">
                     <el-input v-model="form.name" placeholder="请输入单位" style="width: 220px;"></el-input>
                  </el-form-item>
@@ -63,17 +61,8 @@
            <span>类型:</span>
            <el-select v-model="search.type" size="small" placeholder="请选择" @change="TYpe"
               style="width: 224px;margin-right: 30px;">
               <el-option label="橡胶连接器" :value="0"></el-option>
               <el-option label="金属连接器" :value="1"></el-option>
               <el-option label="湿插拔电连接器" :value="2"></el-option>
               <el-option label="分支组件" :value="3"></el-option>
               <el-option v-for="(a, ai) in bigType" :key="ai" :value="a"></el-option>
            </el-select>
            <!-- <span>工序:</span>
         <el-select v-model="search.name" size="small" placeholder="请选择" style="width: 224px;margin-right: 30px;">
            <el-option v-for="(a, ai) in process" key="ai" :label="a.name" :value="a.id"></el-option>
         </el-select>
         <el-button size="mini"><span>重 置</span></el-button>
         <el-button size="mini" type="primary" style="background: #004EA2;"><span>查询</span></el-button> -->
         </div>
         <div class="thing">
            <!-- 主体左 -->
@@ -85,20 +74,15 @@
                  <div class="custom-tree-node" slot-scope="{ node, data }">
                     <span><i :class="`node_i ${data.code != '[2]'?'el-icon-folder-opened':'el-icon-tickets'}`"></i>
                        {{data.code}} {{ data.name }}</span>
                     <!-- <el-button type="text" size="mini" @click.stop="remove(node, data)">
                     <i class="el-icon-delete"></i>
                  </el-button> -->
                  </div>
               </el-tree>
            </div>
            <!-- 主体右 -->
            <div class="right">
               <el-table :data="tableData" style="width: 100%;overflow-y: auto;min-height: 100%"
                  max-height="100%" row-key="name" border
                  @select="selectTr"
                  ref="multipleTable"
                  @selection-change="handleSelectionChange"
                  default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
               <el-table :data="tableData" style="width: 100%;overflow-y: auto;min-height: 100%" 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>
                  <el-table-column type="index" width="50">
@@ -128,17 +112,13 @@
            <div>
               <el-dialog title="编辑技术内容" :visible.sync="upDia" width="500px">
                  <div class="body">
                     <el-row style="line-height: 46px;">
                        <el-col :span="4" style="font-size: 14px;text-align: right;">类型:</el-col>
                        <el-col :span="16" :offset="1">
                           <template>
                              <el-select v-model="edit.type" disabled placeholder="请选择" @change="TYpe"
                                 style="width: 306px;margin-right: 30px;">
                                 <el-option label="橡胶连接器" :value="0"></el-option>
                                 <el-option label="金属连接器" :value="1"></el-option>
                                 <el-option label="湿插拔电连接器" :value="2"></el-option>
                                 <el-option label="分支组件" :value="3"></el-option>
                                 <el-option v-for="(a, ai) in bigType" :key="ai" :value="a"></el-option>
                              </el-select>
                           </template>
                        </el-col>
@@ -199,11 +179,8 @@
                     <el-form-item label="类型">
                        <template>
                           <el-select v-model="form.type" size="small" placeholder="请选择" @change="edittype"
                              style="width: 554px;margin-right: 30px;">
                              <el-option label="橡胶连接器" :value="0"></el-option>
                              <el-option label="金属连接器" :value="1"></el-option>
                              <el-option label="湿插拔电连接器" :value="2"></el-option>
                              <el-option label="分支组件" :value="3"></el-option>
                              style="width: 98%;margin-right: 30px;">
                              <el-option v-for="(a, ai) in bigType" :key="ai" :value="a"></el-option>
                           </el-select>
                        </template>
                     </el-form-item>
@@ -211,7 +188,7 @@
                        <el-col :span="11">
                           <el-form-item label="工序">
                              <template>
                                 <el-select v-model="form.work" placeholder="请选择" allow-create filterable @change="workevent">
                                 <el-select v-model="form.work" placeholder="请选择" @change="workevent">
                                    <el-option v-for="(item,index) in process" :key="item.name" :label="item.name"
                                       :value="item.name">
                                    </el-option>
@@ -222,7 +199,7 @@
                        <el-col :span="11" :offset="2">
                           <el-form-item label="工艺">
                              <template>
                                 <el-select v-model="form.name" placeholder="请选择" @change="craftrow" allow-create filterable>
                                 <el-select v-model="form.name" style="width: 95%;" placeholder="请选择" @change="craftrow">
                                    <el-option v-for="item in craftapi" :key="item.id" :label="item.name" :value="item.id">
                                    </el-option>
                                 </el-select>
@@ -230,7 +207,6 @@
                           </el-form-item>
                        </el-col>
                     </el-row>
                     <el-row>
                        <el-col :span="11">
                           <el-form-item label="项目组">
@@ -239,35 +215,17 @@
                                    <el-option v-for="item in higherlevel" :key="item" :label="item" :value="item">
                                    </el-option>
                                 </el-select>
                                 <!-- <el-autocomplete
                                popper-class="my-autocomplete"
                                v-model="form.father"
                                :fetch-suggestions="higherlevel"
                                placeholder="请输入内容"
                                @select="electadd">
                                <i
                                    class="el-icon-edit el-input__icon"
                                    slot="suffix"
                                    @click="handleIconClick">
                                </i>
                                <template slot-scope="{ item }">
                                    <div class="name">{{ item }}</div>
                                    <span class="addr">{{ item}}</span>
                                </template>
                                </el-autocomplete> -->
                              </template>
                           </el-form-item>
                        </el-col>
                        <el-col :span="11" :offset="2">
                           <el-form-item label="项目">
                              <el-input v-model="form.project" style="width: 200px;" placeholder="请输入项目"></el-input>
                              <el-input v-model="form.project" style="width: 95%;" placeholder="请输入项目"></el-input>
                           </el-form-item>
                        </el-col>
                     </el-row>
                     <el-form-item label="单位">
                        <el-input v-model="form.unit" placeholder="请输入单位" style="width: 200px;"></el-input>
                        <el-input v-model="form.unit" placeholder="请输入单位" style="width: 35.95%;"></el-input>
                     </el-form-item>
                  </el-form>
                  <span slot="footer" class="dialog-footer">
@@ -284,95 +242,117 @@
   export default {
      data() {
         return {
              search:{
                type:0,
                technology:null,
              },
            //   handleClose:[],
                checkTreeNode :{
                    id:'',
                },
                higherlevel:[],
                value:{},
                options:[],
                process:[],
                filterNode:[],
                list: [],
                form:{
                    father:'',
                    work:'',
                    name:'',
                    unit:'',
                    project:'',
                },
                children:[],
                modifyevent:false,
                dialogVisible:false,
                tableData: [],
            crafval:'',
                typeselect:0,
                upData:{},
                upDia:false,
                craftapi:[],
                edit:{
                    techFather:'',
                    techName:'',
                    father:'',
                    name:'',
                    unit:'',
                    id:'',
                },
                isAllSelect:false,
            }
        },
        mounted() {
         this.selectAllleft()
         this.selectAllright()
            search: {
               type: 0,
               technology: null,
            },
            checkTreeNode: {
               id: '',
            },
            higherlevel: [],
            value: {},
            options: [],
            process: [],
            filterNode: [],
            list: [],
            form: {
               father: '',
               work: '',
               name: '',
               unit: '',
               project: '',
            },
            children: [],
            modifyevent: false,
            dialogVisible: false,
            tableData: [],
            crafval: '',
            typeselect: 0,
            upData: {},
            upDia: false,
            craftapi: [],
            edit: {
               techFather: '',
               techName: '',
               father: '',
               name: '',
               unit: '',
               id: '',
            },
            isAllSelect: false,
            bigType: []
         }
      },
        methods:{
              // 表格树全部选中配置
                // 全选/取消选操作
                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");
                });
            },
             //递归子级
            toggleSelect(data, flag, type) {
                if (type === "all") {
                    console.log('222');
                    if (data.length > 0) {
                        data.forEach((item) => {
                        this.toggleSelection(item, flag);
                        if (item.children && item.children.length > 0) {
                            this.toggleSelect(item.children, flag, type);
                        }
                        });
                    }
                } else {
                    if (data.children && data.children.length > 0) {
                        data.children.forEach((item) => {
                        item.isChecked = !item.isChecked;
                        this.$refs.multipleTable.toggleRowSelection(item, flag);
                        this.toggleSelect(item, flag, type);
                        });
                    }
                }
            },
            handleClose(){
      mounted() {
         this.chooseType()
      },
      methods: {
         chooseType() {
            this.$axios.get(this.$api.url.chooseType).then(res => {
               this.bigType = res.data
               this.typeselect = res.data[0]
               this.search.type = res.data[0]
               this.selectAllleft()
               this.selectAllright()
            })
         },
         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) {
            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") {
               if (data.length > 0) {
                  data.forEach((item) => {
                     this.toggleSelection(item, flag);
                     if (item.children && item.children.length > 0) {
                        this.toggleSelect(item.children, flag, type);
                     }
                  });
               }
            } else {
               if (data.children && data.children.length > 0) {
                  data.children.forEach((item) => {
                     item.isChecked = !item.isChecked;
                     this.$refs.multipleTable.toggleRowSelection(item, flag);
                     this.toggleSelect(item, flag, type);
                  });
               }
            }
         },
         //---------------------------------------------------------------------------------------------------------------------------------------
         handleClose() {},
         selectDataList() {
            this.list.forEach(a => {
               a.code = '[1]'
@@ -418,7 +398,7 @@
               }
            }).then(res => {
               /* this.selectAllright() */
                 this.$parent.removeAllTab()
               this.$parent.removeAllTab()
            })
         },
         submitUpData() { //确定
@@ -433,7 +413,7 @@
            }).then(res => {
               /* this.selectAllright() */
               this.$message.success('删除完成')
               this.$parent.removeAllTab()
               this.$parent.removeAllTab()
            })
         },
         deleteRow(index, rows) {
@@ -448,23 +428,22 @@
               ids: this.delete
            }).then(res => {
               /* this.selectAllright() */
               this.$parent.removeAllTab()
               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 ee = []
            console.log(this.selects);
            this.selects.forEach(el => {
               if (el.children) {
                  el.children.forEach(ele => {
                     ee.push(ele.id)
                  })
               }
            })
            let cc = this.selects.map(el => {
               return el.id
            })
            cc.splice(0,1)
            this.delete = cc.join(',')
            // cc.splice(0,1)
            this.delete = ee.join(',')
            console.log(this.delete);
            this.delAllTechskill()
            this.$message.success('删除完成')
@@ -555,7 +534,7 @@
               console.log(this.tableData);
            });
         },
         craftrow(val){
         craftrow(val) {
            this.crafval = val
            this.chooseProFath()
         },
@@ -564,7 +543,7 @@
            console.log(this.checkTreeNode.id);
            this.$axios.get(this.$api.url.chooseProFath, {
               params: {
                  techTemId:this.crafval
                  techTemId: this.crafval
               }
            }).then(res => {
               this.higherlevel = res.data;
@@ -608,16 +587,6 @@
         },
         modify() {
            this.modifyevent = true
         },
         handleSelectionChange(val) {
            this.selects = val;
            this.deleteList = [];
                val.forEach((v) => {
                if (v.id !== undefined) {
                    this.deleteList.push(v.id);
                }
                });
         },
         //编辑
@@ -750,4 +719,4 @@
      height: 30px;
      border-radius: 2px;
   }
</style>
</style>