Fixiaobai
2023-09-25 22b45a79b2ceab7625e0fe248458c398cc26110d
src/components/view/equipmentmaintain.vue
@@ -22,10 +22,7 @@
                <el-form-item label="类型">
                    <template>
                        <el-select v-model="edit.type" disabled placeholder="请选择"  style="width: 560px;">
                            <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-form-item>
@@ -108,17 +105,14 @@
            <!-- 新增弹窗 -->
        <div>
            <el-dialog
            title="技术指标新增"
            title="生产工艺新增"
            :visible.sync="dialogVisible"
            width="40%">
            <el-form ref="form" :model="form" label-width="80px">
                <el-form-item label="类型">
                    <template>
                        <el-select v-model="form.type" placeholder="请选择" @change="edittype" style="width: 480px;">
                            <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-select v-model="form.type" placeholder="请选择" @change="edittype" style="width: 100%;">
                            <el-option v-for="(a, ai) in bigType" :key="ai" :value="a"></el-option>
                        </el-select>
                        </template>
                    </el-form-item>
@@ -141,7 +135,7 @@
                    <el-col :span="11" :offset="2">
                        <el-form-item label="工艺名称">
                            <template>
                        <el-select v-model="form.craft" placeholder="请选择" >
                        <el-select v-model="form.craft" @change="carftapi" placeholder="请选择" >
                            <el-option
                            v-for="item in craftapi"
                            :key="item.id"
@@ -202,7 +196,7 @@
                    <el-col :span="11" :offset="2">
                        <el-form-item label="单位">
                            <template>
                        <el-input v-model="unitrow" :disabled="true" placeholder="请输入单位" style="width: 200px;"></el-input>
                        <el-input v-model="unitrow" :disabled="true" placeholder="请输入单位" style="width: 100%;"></el-input>
                        </template>
                        </el-form-item>
                     </el-col>
@@ -224,10 +218,7 @@
      <div class="choose">
            <span>类型:</span>
         <el-select v-model="search.type" size="small" @change="TYpe" placeholder="请选择" 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;">
@@ -261,10 +252,11 @@
            <!-- 主体右 -->
         <div class="right">
                <el-table
                height="calc(90vh - 200px)"
                    :data="tableData"
                    style="width: 100%;margin-bottom: 20px;height: 600px;overflow: auto;"
                    row-key="rowId"
                    border
                    @select-all="selectAll"
                    @select="selectTr"
                    @selection-change="handleSelectionChange"
                    default-expand-all
@@ -333,6 +325,7 @@
export default {
      data() {
         return {
              bigType: [],
              search: {
               type: 0,
               technology: null
@@ -351,6 +344,7 @@
              upData:{
              },
              checkTreeNode:{
                id:1,
              },
@@ -369,15 +363,25 @@
                tableData: [],
                higherlevel:{},
                quota:{},
                carftrow:"",
                unitrow:'',
            }
            
        },
        mounted() {
            this.chooseType()
         this.selectAllleft()
            this.selectAllTeque()        
      },
        methods:{
            chooseType() {
            this.$axios.get(this.$api.url.chooseType).then(res => {
               this.bigType = res.data
               this.typeselect = res.data[0]
               console.log(this.typeselect);
               this.search.type = res.data[0]
            })
         },
            selectDataList() {
            this.list.forEach(a => {
               a.code = '[1]'
@@ -398,27 +402,25 @@
            // //新增
            choosePro() {//项目
         this.$axios.get(this.$api.url.choosePro,{
                params:{techTemId:this.checkTreeNode.id}
                params:{techTemId:this.carftrow}
            }).then(res => {
            this.project = res.data;
                console.log(this.process);
         }, {
            headers: {
                      "Content-Type": "application/json"
                    }
            })
         })
            },
            carftapi(val) {
                console.log(val);
                this.carftrow = val
                this.chooseDeiv()
                this.choosePro()
            },
            chooseDeiv() {//设备
         this.$axios.get(this.$api.url.chooseDeiv,{
                params:{techTemId:this.checkTreeNode.id}
                params:{techTemId:this.carftrow}
            }).then(res => {
            this.higherlevel = res.data;
                console.log(this.process);
         }, {
            headers: {
                      "Content-Type": "application/json"
                    }
            })
         })
            },
            //新增
            edittype(val) {
@@ -539,9 +541,26 @@
                this.$nextTick(() => {
            this.$refs.tree.setCurrentKey(this.list[0].children[0].name) // 默认选中节点第一个
         })
                let one=this.list.filter(item=>{
                return item.children.length>0
                })[0]
                console.log(one);
                let name=one.children[0].id
                console.log(name);
                this.checkTreeNode.id = name
                this.selectAllTequeStart(name)
                this.selectDataList();
         })
         },
            selectAllTequeStart(name) {
         this.$axios.get(this.$api.url.selectAllTeque,{
            params:{id:this.checkTreeNode.id}
         }).then(res => {
            this.tableData = res.data;
                console.log(this.tableData);
                this.formatData(res.data)
         })
         },
            //主体右
            selectAllTeque() {
         this.$axios.get(this.$api.url.selectAllTeque,{
@@ -590,23 +609,17 @@
         },
            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
            })
                // cc.forEach((el,idx) =>{
                //     delete  idx[0]
                // })
                cc.splice(0,1)
                console.log(cc);
            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)
                        })
                    }
                })
                console.log(ee);
            this.delete = ee.join(',')
            console.log(this.delete);
            this.delAllQue()
            this.$message.success('删除完成')
@@ -623,6 +636,7 @@
            // },
            handleSelectionChange(val) {
                this.selects = val
                // console.log(this.selects);
                this.deleteList = [];
                val.forEach((v) => {
                if (v.id !== undefined) {
@@ -630,13 +644,15 @@
                }
                });
         },
             // 表格树全部选中配置
                // 全选/取消选操作
                selectAll(val) {
                    this.isAllSelect = !this.isAllSelect;
                    let data = this.tableData;
            // 全选/取消选操作
            selectAll(val) {
                // console.log(val);
                this.isAllSelect = !this.isAllSelect;
                let data = this.tableData;
                this.$nextTick(() =>{
                    this.toggleSelect(data, this.isAllSelect, "all");
                },
                })
            },
             //选择某行
          selectTr(selection, row) {
                console.log(selection,row);
@@ -647,10 +663,19 @@
                });
            },
            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) {
                if (type === "all") {
                    console.log('222');
                    if (data.length > 0) {
                        data.forEach((item) => {
                        this.toggleSelection(item, flag);
@@ -669,7 +694,6 @@
                    }
                }
            },
        }
    }
</script>
@@ -754,7 +778,9 @@
   .thing .right {
      width: calc(100% - 305px);
      height: calc(100% - 25px);
      overflow: hidden;
      /* overflow: hidden; */
        overflow-y: scroll;
        overflow-x: scroll;
      padding: 10px;
   }