左侧树角色id动态获取
This commit is contained in:
		
							parent
							
								
									6555f21d5d
								
							
						
					
					
						commit
						8acae94a24
					
				| 
						 | 
				
			
			@ -35,3 +35,12 @@ export function noBindKeeper(data) {
 | 
			
		|||
      data: data,
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//获取库管员树的角色数组
 | 
			
		||||
export function getKeeperIds(itemName) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/material/bm_config/list/',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
    params:{"itemName":itemName},
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -35,3 +35,12 @@ export function noBindKeeper(data) {
 | 
			
		|||
      data: data,
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//获取维修员树的角色数组
 | 
			
		||||
export function getRepairIds(itemName) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/material/bm_config/list/',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
    params:{"itemName":itemName},
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,162 @@
 | 
			
		|||
<template>
 | 
			
		||||
  <el-tabs v-model="activeName" @tab-click="handleClick" class="app-container">
 | 
			
		||||
    <el-tab-pane label="物资配置" name="first" onclick="handleQuery">
 | 
			
		||||
  <div>
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
  <h4 class="form-header h4">库管员配置</h4>
 | 
			
		||||
  <el-main>
 | 
			
		||||
    <el-checkbox-group v-model="selectedValues">
 | 
			
		||||
        <el-checkbox
 | 
			
		||||
      v-for="item in options"
 | 
			
		||||
      :key="item.id"
 | 
			
		||||
      :label="item.id"
 | 
			
		||||
      :value="item.id"
 | 
			
		||||
      :checked="item.check">
 | 
			
		||||
      {{ item.name }}
 | 
			
		||||
    </el-checkbox>
 | 
			
		||||
    </el-checkbox-group>
 | 
			
		||||
      <el-button
 | 
			
		||||
          type="primary"
 | 
			
		||||
          icon="el-icon-plus"
 | 
			
		||||
          size="mini"
 | 
			
		||||
          @click="handleQuery"
 | 
			
		||||
          >保存库管员配置</el-button
 | 
			
		||||
      >
 | 
			
		||||
  </el-main>
 | 
			
		||||
  </div>
 | 
			
		||||
     <div class="app-container">
 | 
			
		||||
    <h4 class="form-header h4">维修员配置</h4>
 | 
			
		||||
    <el-main>
 | 
			
		||||
    <el-checkbox-group v-model="selectedValues">
 | 
			
		||||
        <el-checkbox
 | 
			
		||||
      v-for="item in options"
 | 
			
		||||
      :key="item.id"
 | 
			
		||||
      :label="item.id"
 | 
			
		||||
      :value="item.id"
 | 
			
		||||
      :checked="item.check">
 | 
			
		||||
      {{ item.name }}
 | 
			
		||||
    </el-checkbox>
 | 
			
		||||
    </el-checkbox-group>
 | 
			
		||||
      <el-button
 | 
			
		||||
          type="primary"
 | 
			
		||||
          icon="el-icon-plus"
 | 
			
		||||
          size="mini"
 | 
			
		||||
          @click="handleQuery"
 | 
			
		||||
          >保存维修员配置</el-button
 | 
			
		||||
      >
 | 
			
		||||
    </el-main>
 | 
			
		||||
    </div>
 | 
			
		||||
   </div>
 | 
			
		||||
      </el-tab-pane>
 | 
			
		||||
      <el-tab-pane label="新购配置" name="second" >
 | 
			
		||||
          <div>
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
  <h4 class="form-header h4">库管员配置</h4>
 | 
			
		||||
  <el-main>
 | 
			
		||||
    <el-checkbox-group v-model="selectedValues">
 | 
			
		||||
        <el-checkbox
 | 
			
		||||
      v-for="item in options"
 | 
			
		||||
      :key="item.id"
 | 
			
		||||
      :label="item.id"
 | 
			
		||||
      :value="item.id"
 | 
			
		||||
      :checked="item.check">
 | 
			
		||||
      {{ item.name }}
 | 
			
		||||
    </el-checkbox>
 | 
			
		||||
    </el-checkbox-group>
 | 
			
		||||
      <el-button
 | 
			
		||||
          type="primary"
 | 
			
		||||
          icon="el-icon-plus"
 | 
			
		||||
          size="mini"
 | 
			
		||||
          @click="handleQuery"
 | 
			
		||||
          >保存库管员2配置</el-button
 | 
			
		||||
      >
 | 
			
		||||
  </el-main>
 | 
			
		||||
  </div>
 | 
			
		||||
     <div class="app-container">
 | 
			
		||||
    <h4 class="form-header h4">维修员配置</h4>
 | 
			
		||||
    <el-main>
 | 
			
		||||
    <el-checkbox-group v-model="selectedValues">
 | 
			
		||||
        <el-checkbox
 | 
			
		||||
      v-for="item in options"
 | 
			
		||||
      :key="item.id"
 | 
			
		||||
      :label="item.id"
 | 
			
		||||
      :value="item.id"
 | 
			
		||||
      :checked="item.check">
 | 
			
		||||
      {{ item.name }}
 | 
			
		||||
    </el-checkbox>
 | 
			
		||||
    </el-checkbox-group>
 | 
			
		||||
      <el-button
 | 
			
		||||
          type="primary"
 | 
			
		||||
          icon="el-icon-plus"
 | 
			
		||||
          size="mini"
 | 
			
		||||
          @click="handleQuery"
 | 
			
		||||
          >保存维修员配置2</el-button
 | 
			
		||||
      >
 | 
			
		||||
    </el-main>
 | 
			
		||||
    </div>
 | 
			
		||||
   </div>
 | 
			
		||||
      </el-tab-pane>
 | 
			
		||||
  </el-tabs>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'siteConfig',
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      activeName: 'first',
 | 
			
		||||
      // 模拟后端返回的对象数组
 | 
			
		||||
      options: [
 | 
			
		||||
        { id: 1, name: 'Option 1', check: true },
 | 
			
		||||
        { id: 2, name: 'Option 2', check: false },
 | 
			
		||||
        { id: 3, name: 'Option 3', check: true }
 | 
			
		||||
      ],
 | 
			
		||||
      // 记录选中的 id
 | 
			
		||||
      selectedValues: []
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    // 监听选中的值变化,更新后端数据
 | 
			
		||||
    selectedValues(newValues) {
 | 
			
		||||
      // 你可以根据需要将 newValues 更新到后端
 | 
			
		||||
      console.log('选中的ID:', newValues);
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    // 初始化选中的值,如果需要的话
 | 
			
		||||
    this.selectedValues = this.options
 | 
			
		||||
      .filter(item => item.check)  // 过滤出 check 为 true 的选项
 | 
			
		||||
      .map(item => item.id);       // 提取选中的 id
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
        handleClick(tab, event) {
 | 
			
		||||
          if(tab.name == 'first'){
 | 
			
		||||
            // this.resetForm("queryFormOne");
 | 
			
		||||
            // this.getList();
 | 
			
		||||
          }else if(tab.name == 'second'){
 | 
			
		||||
            // this.resetForm("queryForm");
 | 
			
		||||
            // this.getboxList();
 | 
			
		||||
          }
 | 
			
		||||
      },
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
/* .section {
 | 
			
		||||
  margin-bottom: 20px;
 | 
			
		||||
} */
 | 
			
		||||
  /* .el-header, .el-footer {
 | 
			
		||||
    background-color: #e1ebf8;
 | 
			
		||||
    color: #333;
 | 
			
		||||
    text-align: left;
 | 
			
		||||
    line-height: 60px;
 | 
			
		||||
  } */
 | 
			
		||||
    .el-main {
 | 
			
		||||
    background-color: white;
 | 
			
		||||
    color: #333;
 | 
			
		||||
    text-align: left;
 | 
			
		||||
    line-height: 120px;
 | 
			
		||||
  }
 | 
			
		||||
/* 这里可以写自定义样式 */
 | 
			
		||||
</style>
 | 
			
		||||
| 
						 | 
				
			
			@ -114,6 +114,16 @@
 | 
			
		|||
                </el-form>
 | 
			
		||||
 | 
			
		||||
                <el-row :gutter="10" class="mb8">
 | 
			
		||||
                      <el-col :span="1.5">
 | 
			
		||||
                        <el-button
 | 
			
		||||
                        type="primary"
 | 
			
		||||
                        plain
 | 
			
		||||
                        icon="el-icon-plus"
 | 
			
		||||
                        size="mini"
 | 
			
		||||
                        @click="handleAdd"
 | 
			
		||||
                        >新增</el-button
 | 
			
		||||
                        >
 | 
			
		||||
                      </el-col>
 | 
			
		||||
                     <el-col :span="1.5">
 | 
			
		||||
                        <el-button
 | 
			
		||||
                        type="warning"
 | 
			
		||||
| 
						 | 
				
			
			@ -133,10 +143,6 @@
 | 
			
		|||
         <el-table
 | 
			
		||||
          v-loading="loading"
 | 
			
		||||
          :data="typeList"
 | 
			
		||||
          ref="multipleTable"
 | 
			
		||||
          row-key="id"
 | 
			
		||||
          default-expand-all
 | 
			
		||||
          :tree-props="{ children: 'children' }"
 | 
			
		||||
          border
 | 
			
		||||
        >
 | 
			
		||||
          <el-table-column label="序号" align="center" width="80" type="index">
 | 
			
		||||
| 
						 | 
				
			
			@ -149,9 +155,21 @@
 | 
			
		|||
            </template>
 | 
			
		||||
          </el-table-column>
 | 
			
		||||
          <el-table-column
 | 
			
		||||
            label="名称"
 | 
			
		||||
            label="配件类型"
 | 
			
		||||
            align="center"
 | 
			
		||||
            prop="label"
 | 
			
		||||
            prop="label1"
 | 
			
		||||
            show-overflow-tooltip
 | 
			
		||||
          />
 | 
			
		||||
          <el-table-column
 | 
			
		||||
            label="配件名称"
 | 
			
		||||
            align="center"
 | 
			
		||||
            prop="label2"
 | 
			
		||||
            show-overflow-tooltip
 | 
			
		||||
          />
 | 
			
		||||
          <el-table-column
 | 
			
		||||
            label="规格型号"
 | 
			
		||||
            align="center"
 | 
			
		||||
            prop="label3"
 | 
			
		||||
            show-overflow-tooltip
 | 
			
		||||
          />
 | 
			
		||||
          <el-table-column
 | 
			
		||||
| 
						 | 
				
			
			@ -188,7 +206,6 @@
 | 
			
		|||
                icon="el-icon-edit"
 | 
			
		||||
                @click="handleUpdate(scope.row)"
 | 
			
		||||
                v-hasPermi="['machinery:type:edit']"
 | 
			
		||||
                v-if="scope.row.level==3 || scope.row.level==2"
 | 
			
		||||
              >
 | 
			
		||||
                修改
 | 
			
		||||
              </el-button>
 | 
			
		||||
| 
						 | 
				
			
			@ -198,7 +215,6 @@
 | 
			
		|||
                icon="el-icon-delete-solid"
 | 
			
		||||
                @click="handleDelete(scope.row)"
 | 
			
		||||
                v-hasPermi="['machinery:type:edit']"
 | 
			
		||||
                v-if="(!scope.row.children)"
 | 
			
		||||
              >
 | 
			
		||||
                删除
 | 
			
		||||
              </el-button>
 | 
			
		||||
| 
						 | 
				
			
			@ -216,49 +232,7 @@
 | 
			
		|||
        </el-table>
 | 
			
		||||
          </el-col>
 | 
			
		||||
      </el-row>
 | 
			
		||||
      <!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
 | 
			
		||||
        <el-form-item  prop="keyWord">
 | 
			
		||||
        <el-input
 | 
			
		||||
            v-model="queryParams.keyWord"
 | 
			
		||||
            placeholder="请输入关键词"
 | 
			
		||||
            clearable
 | 
			
		||||
            @keyup.enter.native="handleQuery"
 | 
			
		||||
            maxlength="20"
 | 
			
		||||
          />   
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
  
 | 
			
		||||
        <el-form-item>
 | 
			
		||||
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
 | 
			
		||||
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
      </el-form>
 | 
			
		||||
      <el-row :gutter="10" class="mb8">
 | 
			
		||||
                      <el-col :span="1.5">
 | 
			
		||||
                          <el-button
 | 
			
		||||
                              type="primary"
 | 
			
		||||
                              plain
 | 
			
		||||
                              icon="el-icon-plus"
 | 
			
		||||
                              size="mini"
 | 
			
		||||
                              @click="handleAdd"
 | 
			
		||||
                              v-hasPermi="['machinery:type:add']"
 | 
			
		||||
                              >新增</el-button
 | 
			
		||||
                          >
 | 
			
		||||
                      </el-col> 
 | 
			
		||||
                       <el-col :span="1.5">
 | 
			
		||||
                          <el-button
 | 
			
		||||
                          type="warning"
 | 
			
		||||
                          plain
 | 
			
		||||
                          icon="el-icon-download"
 | 
			
		||||
                          size="mini"
 | 
			
		||||
                          @click="handleExport"
 | 
			
		||||
                          >导出
 | 
			
		||||
                          </el-button>
 | 
			
		||||
                      </el-col> 
 | 
			
		||||
                      <right-toolbar
 | 
			
		||||
                          :showSearch.sync="showSearch"
 | 
			
		||||
                          @queryTable="getList"
 | 
			
		||||
                      ></right-toolbar>
 | 
			
		||||
      <
 | 
			
		||||
  
 | 
			
		||||
      <!-- <pagination
 | 
			
		||||
        v-show="total>0"
 | 
			
		||||
| 
						 | 
				
			
			@ -283,7 +257,7 @@
 | 
			
		|||
                        :disable-branch-nodes="false"
 | 
			
		||||
                        placeholder="选择上级菜单"
 | 
			
		||||
                        @select="onSelect"
 | 
			
		||||
                        disabled
 | 
			
		||||
                       
 | 
			
		||||
                      />
 | 
			
		||||
                      </el-form-item>
 | 
			
		||||
            </el-col>
 | 
			
		||||
| 
						 | 
				
			
			@ -339,6 +313,55 @@
 | 
			
		|||
        </div>
 | 
			
		||||
      </el-dialog>
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
        <!-- 左侧树新增弹框 -->
 | 
			
		||||
        <el-dialog
 | 
			
		||||
            :title="addTitle"
 | 
			
		||||
            :visible.sync="addTitleVisible"
 | 
			
		||||
            v-if="addTitleVisible"
 | 
			
		||||
            width="50%"
 | 
			
		||||
            append-to-body
 | 
			
		||||
            :close-on-click-modal="false"
 | 
			
		||||
        >
 | 
			
		||||
            <el-form
 | 
			
		||||
                label-width="80px"
 | 
			
		||||
                :model="addFormParams"
 | 
			
		||||
                :rules="addFormParamsRules"
 | 
			
		||||
                ref="addFormParamsRef"
 | 
			
		||||
            >
 | 
			
		||||
                <el-row :gutter="24">
 | 
			
		||||
                    <el-col :span="12" v-if="addTitle === '新增'">
 | 
			
		||||
                        <el-form-item label="所属上级">
 | 
			
		||||
                            <el-input
 | 
			
		||||
                                style="width: 100%"
 | 
			
		||||
                                disabled
 | 
			
		||||
                                v-model="addFormParams.label"
 | 
			
		||||
                            />
 | 
			
		||||
                        </el-form-item>
 | 
			
		||||
                    </el-col>
 | 
			
		||||
                    <el-col :span="12">
 | 
			
		||||
                        <el-form-item label="名称" prop="typeName">
 | 
			
		||||
                            <el-input
 | 
			
		||||
                                style="width: 100%"
 | 
			
		||||
                                v-model="addFormParams.typeName"
 | 
			
		||||
                            />
 | 
			
		||||
                        </el-form-item>
 | 
			
		||||
                    </el-col>
 | 
			
		||||
                </el-row>
 | 
			
		||||
 | 
			
		||||
                <el-row style="text-align: right">
 | 
			
		||||
                    <el-form-item>
 | 
			
		||||
                        <el-button size="small" type="primary" @click="onSubmit"
 | 
			
		||||
                            >确 定</el-button
 | 
			
		||||
                        >
 | 
			
		||||
                        <el-button size="small" @click="onCancel"
 | 
			
		||||
                            >取 消</el-button
 | 
			
		||||
                        >
 | 
			
		||||
                    </el-form-item>
 | 
			
		||||
                </el-row>
 | 
			
		||||
            </el-form>
 | 
			
		||||
        </el-dialog>
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
  </template> 
 | 
			
		||||
  
 | 
			
		||||
| 
						 | 
				
			
			@ -378,9 +401,7 @@
 | 
			
		|||
        showSearch: true,
 | 
			
		||||
        showHouse: false,
 | 
			
		||||
       
 | 
			
		||||
        //列表数据
 | 
			
		||||
        typeList: undefined,
 | 
			
		||||
 | 
			
		||||
        treeList:[],
 | 
			
		||||
        flagTemp:1,
 | 
			
		||||
        // 总条数
 | 
			
		||||
| 
						 | 
				
			
			@ -403,6 +424,16 @@
 | 
			
		|||
          pageSize: 10,
 | 
			
		||||
          keyWord:undefined
 | 
			
		||||
        },
 | 
			
		||||
        companyId: undefined,
 | 
			
		||||
        parentId:undefined,
 | 
			
		||||
        isMousemoveId: null,
 | 
			
		||||
        addTitleVisible: false,
 | 
			
		||||
        addTitle: '', // 新增弹框标题
 | 
			
		||||
        addFormParams: {
 | 
			
		||||
            label: '',
 | 
			
		||||
            typeName: '',
 | 
			
		||||
            companyId: 101,
 | 
			
		||||
        },
 | 
			
		||||
        treeOptions:undefined,
 | 
			
		||||
        defaultProps: {
 | 
			
		||||
            children: 'children',
 | 
			
		||||
| 
						 | 
				
			
			@ -564,31 +595,195 @@
 | 
			
		|||
        console.log('eeeee',e)
 | 
			
		||||
        this.form.id = e.id;
 | 
			
		||||
        this.form.level = e.level
 | 
			
		||||
      }
 | 
			
		||||
      },
 | 
			
		||||
 | 
			
		||||
       /* 树节点增加 */
 | 
			
		||||
        appendTreeNode(data) {
 | 
			
		||||
            this.levelTemp = data.level;
 | 
			
		||||
            this.idTemp = data.id;
 | 
			
		||||
            console.log('dataAdd',data)
 | 
			
		||||
            console.log('idTemp',data)
 | 
			
		||||
            if (data.level === 3) {
 | 
			
		||||
                this.reset()
 | 
			
		||||
                Object.assign(this.form, data)
 | 
			
		||||
                this.treeTemp=this.treeOptions[0].children,
 | 
			
		||||
                this.treeTemp.forEach(item=>{
 | 
			
		||||
                    item.children.forEach(itemTemp=>{
 | 
			
		||||
                    if(itemTemp.level==2 && itemTemp.id==data.parentId){
 | 
			
		||||
                        this.level2Temp=itemTemp.id
 | 
			
		||||
                        this.level2TempName=itemTemp.label
 | 
			
		||||
                        this.level1Temp=itemTemp.parentId
 | 
			
		||||
                    }
 | 
			
		||||
                    })
 | 
			
		||||
                })
 | 
			
		||||
                //  console.log('treeTemp',this.treeTemp)
 | 
			
		||||
                this.treeTemp.forEach(item=>{
 | 
			
		||||
                    if(item.level==1 && item.id==this.level1Temp){
 | 
			
		||||
                        this.level1TempName=item.label
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
                this.treeTemp.forEach(item=>{
 | 
			
		||||
                    if(item.level==0 && item.id==data.houseId){
 | 
			
		||||
                        this.level0TempName=item.label
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
                this.isLevel1Disabled=true
 | 
			
		||||
                this.isLevel2Disabled=true
 | 
			
		||||
                this.isLevel3Disabled=true
 | 
			
		||||
                this.isLevel4Disabled=true
 | 
			
		||||
                this.form.parentId = data.id
 | 
			
		||||
                this.form.houseName = this.level0TempName
 | 
			
		||||
                this.form.itemType = this.level1TempName
 | 
			
		||||
                this.form.materialType = this.level2TempName
 | 
			
		||||
                this.form.materialName = data.label
 | 
			
		||||
                this.open = true
 | 
			
		||||
                this.title = '新增'
 | 
			
		||||
            } else {
 | 
			
		||||
                Object.assign(this.addFormParams, data)
 | 
			
		||||
                this.addFormParams.typeName = ''
 | 
			
		||||
                this.addTitle = '新增'
 | 
			
		||||
                this.addTitleVisible = true
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        /* 树节点删除 */
 | 
			
		||||
        removeTreeNode(data) {
 | 
			
		||||
            // this.$message.success('删除--')
 | 
			
		||||
            console.log(data, '删除时的数据源--')
 | 
			
		||||
            const typeId = data.id
 | 
			
		||||
            this.$modal
 | 
			
		||||
                .confirm('是否确认删除数据项?')
 | 
			
		||||
                .then(function () {
 | 
			
		||||
                    return delMaType(typeId)
 | 
			
		||||
                })
 | 
			
		||||
                .then(() => {
 | 
			
		||||
                    this.$modal.msgSuccess('删除成功')
 | 
			
		||||
                    this.getTreeData()
 | 
			
		||||
                })
 | 
			
		||||
                .catch(() => {})
 | 
			
		||||
        },
 | 
			
		||||
        /* 树节点修改 */
 | 
			
		||||
        editTreeNode(data) {
 | 
			
		||||
            this.levelTemp = data.level;
 | 
			
		||||
            this.idTemp = data.id;
 | 
			
		||||
            this.parentId = data.parentId;
 | 
			
		||||
            console.log('data',data)
 | 
			
		||||
            Object.assign(this.addFormParams, data)
 | 
			
		||||
            this.addTitle = '修改'
 | 
			
		||||
            this.addFormParams.typeName = data.label
 | 
			
		||||
            this.addTitleVisible = true
 | 
			
		||||
        },
 | 
			
		||||
        /* 确定 */
 | 
			
		||||
        onSubmit() {
 | 
			
		||||
            const { id, typeName } = this.addFormParams
 | 
			
		||||
            const addParams = {
 | 
			
		||||
                parentId: this.levelTemp==0 ? 0:this.idTemp,
 | 
			
		||||
                typeName,
 | 
			
		||||
                level:this.levelTemp,
 | 
			
		||||
                houseId:this.levelTemp==0 ? id:null,
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            const editParams = {
 | 
			
		||||
                houseId: id,
 | 
			
		||||
                typeName,
 | 
			
		||||
                level:this.levelTemp,
 | 
			
		||||
                parentId: this.parentId,
 | 
			
		||||
                typeId: id,
 | 
			
		||||
            }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
            this.$refs['addFormParamsRef'].validate(async (valid) => {
 | 
			
		||||
                if (valid) {
 | 
			
		||||
                    if (this.addTitle === '新增') {
 | 
			
		||||
                        const res = await addMaType(addParams)
 | 
			
		||||
                        if (res.code === 200) {
 | 
			
		||||
                            this.$message.success('新增成功!')
 | 
			
		||||
                            this.addTitleVisible = false
 | 
			
		||||
                            this.getList()
 | 
			
		||||
                            this.getTreeData()
 | 
			
		||||
                        }
 | 
			
		||||
                    } else {
 | 
			
		||||
                        const res = await updateMaType(editParams)
 | 
			
		||||
                        if (res.code === 200) {
 | 
			
		||||
                            this.$message.success('修改成功!')
 | 
			
		||||
                            this.addTitleVisible = false
 | 
			
		||||
                            this.getList()
 | 
			
		||||
                            this.getTreeData()
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            })
 | 
			
		||||
        },
 | 
			
		||||
        /* 取消 */
 | 
			
		||||
        onCancel() {
 | 
			
		||||
            this.addTitleVisible = false
 | 
			
		||||
        },
 | 
			
		||||
        getParentName(list, id) {
 | 
			
		||||
            try {
 | 
			
		||||
                list.forEach((e) => {
 | 
			
		||||
                    if (e.id == id) {
 | 
			
		||||
                        this.form.label = e.label
 | 
			
		||||
                        throw new Error()
 | 
			
		||||
                    } else {
 | 
			
		||||
                        if (e.children && e.children.length > 0) {
 | 
			
		||||
                            this.getParentName(e.children, id)
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
            } catch (error) {}
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onMousemove(data) {
 | 
			
		||||
            this.isMousemoveId = data.id
 | 
			
		||||
        },
 | 
			
		||||
        onMouseleave() {
 | 
			
		||||
            this.isMousemoveId = null
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
  </script>
 | 
			
		||||
  <style lang="scss" scoped>
 | 
			
		||||
  .uploadImg {
 | 
			
		||||
    padding-top: 20px;
 | 
			
		||||
    display: flex;
 | 
			
		||||
    align-items: center;
 | 
			
		||||
    justify-content: center;
 | 
			
		||||
  }
 | 
			
		||||
  .deviceCode {
 | 
			
		||||
      margin-top: 10px;
 | 
			
		||||
      padding-bottom: 20px;
 | 
			
		||||
      font-size: 18px;
 | 
			
		||||
  }
 | 
			
		||||
  ::v-deep.el-table .fixed-width .el-button--mini {
 | 
			
		||||
      width: 60px !important;
 | 
			
		||||
      margin-bottom: 10px;
 | 
			
		||||
  }
 | 
			
		||||
  //隐藏图片上传框的css
 | 
			
		||||
  ::v-deep.disabled {
 | 
			
		||||
      .el-upload--picture-card {
 | 
			
		||||
          display: none;
 | 
			
		||||
      }
 | 
			
		||||
  }
 | 
			
		||||
  </style>
 | 
			
		||||
</script>
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
::v-deep.el-table .fixed-width .el-button--mini {
 | 
			
		||||
    width: 60px !important;
 | 
			
		||||
    margin-bottom: 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
::v-deep .btn-items .el-button + .el-button {
 | 
			
		||||
    margin-left: 6px;
 | 
			
		||||
}
 | 
			
		||||
.btn-items {
 | 
			
		||||
    margin-left: 4px;
 | 
			
		||||
    .el-button--text {
 | 
			
		||||
        font-size: 16px;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
::v-deep .el-tree .el-tree-node__expand-icon.expanded {
 | 
			
		||||
    -webkit-transform: rotate(0deg);
 | 
			
		||||
    transform: rotate(0deg);
 | 
			
		||||
}
 | 
			
		||||
::v-deep .el-tree .el-icon-caret-right:before {
 | 
			
		||||
    content: '\e783';
 | 
			
		||||
    font-size: 16px;
 | 
			
		||||
}
 | 
			
		||||
::v-deep
 | 
			
		||||
    .el-tree
 | 
			
		||||
    .el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
 | 
			
		||||
    content: '\e781';
 | 
			
		||||
    font-size: 16px;
 | 
			
		||||
    color: #1890ff;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
::v-deep .el-tree-node__content > .el-tree-node__expand-icon {
 | 
			
		||||
    color: #1890ff !important;
 | 
			
		||||
}
 | 
			
		||||
::v-deep .el-tree-node__expand-icon.is-leaf {
 | 
			
		||||
    color: transparent !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
::v-deep
 | 
			
		||||
    .el-tree--highlight-current
 | 
			
		||||
    .el-tree-node.is-current
 | 
			
		||||
    > .el-tree-node__content {
 | 
			
		||||
    background-color: #8decf1;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
| 
						 | 
				
			
			@ -246,10 +246,9 @@ import {
 | 
			
		|||
  getListByMaType,
 | 
			
		||||
} from "@/api/ma/base";
 | 
			
		||||
import {
 | 
			
		||||
  getMatConfigList,
 | 
			
		||||
  getListByMatConfig,
 | 
			
		||||
  bindKeeper,
 | 
			
		||||
  noBindKeeper
 | 
			
		||||
  noBindKeeper,
 | 
			
		||||
  getKeeperIds
 | 
			
		||||
} from "@/api/ma/typeConfigKeeper";
 | 
			
		||||
import { getUserList } from "@/api/basic/basic";
 | 
			
		||||
import { getInfo } from "@/api/login";
 | 
			
		||||
| 
						 | 
				
			
			@ -319,6 +318,7 @@ export default {
 | 
			
		|||
        children: "children",
 | 
			
		||||
        label: "label",
 | 
			
		||||
      },
 | 
			
		||||
      roleIdsTemp:[],
 | 
			
		||||
      userList:[],
 | 
			
		||||
      userNoList:[],
 | 
			
		||||
      userIdTemp: -1,
 | 
			
		||||
| 
						 | 
				
			
			@ -369,8 +369,6 @@ export default {
 | 
			
		|||
    //     this.getList();
 | 
			
		||||
    // },200)
 | 
			
		||||
   
 | 
			
		||||
    // this.getUserList()
 | 
			
		||||
    // this.getPropData()
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    // getInfo() {
 | 
			
		||||
| 
						 | 
				
			
			@ -446,12 +444,13 @@ export default {
 | 
			
		|||
      this.form.keeperDataPro = this.keeperProRange.value;
 | 
			
		||||
    },
 | 
			
		||||
    /** 查询新增页面-上级类型下拉树结构 */
 | 
			
		||||
   async getTreeData() {
 | 
			
		||||
      // getMatConfigList().then((response) => {
 | 
			
		||||
      //   this.treeOptions = response.data;
 | 
			
		||||
      // });
 | 
			
		||||
      const roleIds = [7,14];
 | 
			
		||||
      getUserList({ roleIds: roleIds}).then(response => {
 | 
			
		||||
   async getTreeData() {;
 | 
			
		||||
   const itemName = 'ku_guan_role_ids'
 | 
			
		||||
      await getKeeperIds(itemName).then((response) =>{
 | 
			
		||||
          const roleIds = response.rows[0].itemValue.split(',').map(item => Number(item))
 | 
			
		||||
          this.roleIdsTemp = roleIds
 | 
			
		||||
      })
 | 
			
		||||
      await getUserList({ roleIds: this.roleIdsTemp}).then(response => {
 | 
			
		||||
        this.treeOptions = response.data
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -246,10 +246,9 @@ import {
 | 
			
		|||
  getListByMaType,
 | 
			
		||||
} from "@/api/ma/base";
 | 
			
		||||
import {
 | 
			
		||||
  getMatConfigList,
 | 
			
		||||
  getListByMatConfig,
 | 
			
		||||
  bindKeeper,
 | 
			
		||||
  noBindKeeper
 | 
			
		||||
  noBindKeeper,
 | 
			
		||||
  getRepairIds
 | 
			
		||||
} from "@/api/ma/typeConfigRepair";
 | 
			
		||||
import { getUserList } from "@/api/basic/basic";
 | 
			
		||||
import { getInfo } from "@/api/login";
 | 
			
		||||
| 
						 | 
				
			
			@ -280,6 +279,7 @@ export default {
 | 
			
		|||
      keeperProRange: [],
 | 
			
		||||
      keeperMatRange: [],
 | 
			
		||||
      keeperNameRange: [],
 | 
			
		||||
      roleIdsTemp:[],
 | 
			
		||||
      //维修员用户数据
 | 
			
		||||
      repairUserList: null,
 | 
			
		||||
      //资产类型数据
 | 
			
		||||
| 
						 | 
				
			
			@ -399,11 +399,12 @@ export default {
 | 
			
		|||
 | 
			
		||||
    /** 查询新增页面-上级类型下拉树结构 */
 | 
			
		||||
   async getTreeData() {
 | 
			
		||||
      // getMatConfigList().then((response) => {
 | 
			
		||||
      //   this.treeOptions = response.data;
 | 
			
		||||
      // });
 | 
			
		||||
      const roleIds = [8,9,15,16];
 | 
			
		||||
      getUserList({ roleIds: roleIds}).then(response => {
 | 
			
		||||
   const itemName = 'wei_xiu_role_ids'
 | 
			
		||||
      await getRepairIds(itemName).then((response) =>{
 | 
			
		||||
          const roleIds = response.rows[0].itemValue.split(',').map(item => Number(item))
 | 
			
		||||
          this.roleIdsTemp = roleIds
 | 
			
		||||
      })
 | 
			
		||||
     await getUserList({ roleIds: this.roleIdsTemp}).then(response => {
 | 
			
		||||
        this.treeOptions = response.data
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
| 
						 | 
				
			
			@ -425,7 +426,6 @@ export default {
 | 
			
		|||
   async getList() {
 | 
			
		||||
        this.loading = true
 | 
			
		||||
        this.queryParams.displayBindRelationship="true";
 | 
			
		||||
        console.log('queryParams1',this.queryParams)
 | 
			
		||||
       await getListByMaType(this.queryParams).then((response) => {
 | 
			
		||||
            this.typeList = response.data.rows
 | 
			
		||||
            this.total = response.data.total
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue