| <template> | 
|   <TableLayout v-permissions="['ext:categoryunionext:query']"> | 
|     <!-- 搜索表单 --> | 
|     <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline> | 
|       <el-form-item label="组合名称:" prop="combinationName"> | 
|         <el-input | 
|           v-model="searchForm.combinationName" | 
|           placeholder="请输入" | 
|           @keypress.enter.native="search" | 
|         ></el-input> | 
|       </el-form-item> | 
|       <el-form-item label="分类类型:" prop="bmodelCateType"> | 
|         <el-select v-model="searchForm.bmodelCateType" clearable filterable placeholder="请选择" @change="seletType"> | 
|           <el-option | 
|             v-for="item in types" | 
|             :key="item.id" | 
|             :label="item.name" | 
|             :value="item.id" | 
|           ></el-option> | 
|         </el-select> | 
|       </el-form-item> | 
|       <el-form-item | 
|         label="所属大类:" | 
|         prop="cateBigId" | 
|       > | 
|         <el-select v-model="searchForm.cateBigId" clearable filterable placeholder="请选择" @change="selectBig"> | 
|           <el-option | 
|             v-for="item in cateBig" | 
|             :key="item.id" | 
|             :label="item.name" | 
|             :value="item.id" | 
|           ></el-option> | 
|         </el-select> | 
|       </el-form-item> | 
|       <el-form-item | 
|         label="所属中类:" | 
|         prop="cateMiddleId" | 
|       > | 
|         <el-select v-model="searchForm.cateMiddleId" clearable filterable placeholder="请选择" @change="selectMiddle"> | 
|           <el-option | 
|             v-for="item in cateMiddle" | 
|             :key="item.id" | 
|             :label="item.name" | 
|             :value="item.id" | 
|           ></el-option> | 
|         </el-select> | 
|       </el-form-item> | 
|       <el-form-item | 
|         label="所属小类:" | 
|         prop="cateSmallId" | 
|       > | 
|         <el-select v-model="searchForm.cateSmallId" clearable filterable placeholder="请选择"> | 
|           <el-option | 
|             v-for="item in cateSmall" | 
|             :key="item.id" | 
|             :label="item.name" | 
|             :value="item.id" | 
|           ></el-option> | 
|         </el-select> | 
|       </el-form-item> | 
|       <section> | 
|         <el-button type="primary" @click="search">搜索</el-button> | 
|         <el-button @click="reset">重置</el-button> | 
|       </section> | 
|     </el-form> | 
|     <!-- 表格和分页 --> | 
|     <template v-slot:table-wrap> | 
|       <!-- <ul | 
|         class="toolbar" | 
|         v-permissions="[ | 
|           'ext:categoryunionext:create', | 
|           'ext:categoryunionext:delete', | 
|         ]" | 
|       > | 
|         <li> | 
|           <el-button | 
|             type="primary" | 
|             @click="$refs.operaCategoryUnionExtWindow.open('新建分类组合信息')" | 
|             icon="el-icon-plus" | 
|             v-permissions="['ext:categoryunionext:create']" | 
|             >新建</el-button | 
|           > | 
|         </li> | 
|         <li> | 
|           <el-button | 
|             @click="deleteByIdInBatch" | 
|             icon="el-icon-delete" | 
|             v-permissions="['ext:categoryunionext:delete']" | 
|             >删除</el-button | 
|           > | 
|         </li> | 
|       </ul> --> | 
|       <ul class="toolbar" v-permissions="['ext:categoryunionext:create']"> | 
|         <li> | 
|           <el-button | 
|             type="primary" | 
|             @click="$refs.operaCategoryUnionExtWindow.open('新增组合')" | 
|           >新增</el-button> | 
|         </li> | 
|       </ul> | 
|       <el-table | 
|         v-loading="isWorking.search" | 
|         :data="tableData.list" | 
|         stripe | 
|         border | 
|         @selection-change="handleSelectionChange" | 
|       > | 
|         <!-- <el-table-column type="selection" width="55"></el-table-column> --> | 
|         <el-table-column | 
|           prop="combinationName" | 
|           label="组合名称" | 
|           min-width="140px" | 
|           show-overflow-tooltip | 
|         > | 
|           <template slot-scope="{ row }"> | 
|             <span class="long-title-style">{{ row.combinationName }}</span> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column | 
|           prop="rootDepartId" | 
|           label="分类类型" | 
|           min-width="60px" | 
|         > | 
|           <template slot-scope="{ row }"> | 
|             {{ typeToStr(row.unionCateType) }} | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column | 
|           prop="cateBigId" | 
|           label="所属大类" | 
|           min-width="140px" | 
|           show-overflow-tooltip | 
|         > | 
|           <template slot-scope="{ row }"> | 
|             <span class="long-title-style">{{ row.bmodel ? row.bmodel.name : '-' }}</span> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column | 
|           prop="cateMiddleId" | 
|           label="所属中类" | 
|           min-width="140px" | 
|           show-overflow-tooltip | 
|         > | 
|           <template slot-scope="{ row }"> | 
|             <span class="long-title-style">{{ row.mmodel ? row.mmodel.name : '-' }}</span> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column | 
|           prop="cateSmallId" | 
|           label="所属小类" | 
|           min-width="100px" | 
|           show-overflow-tooltip | 
|         > | 
|           <template slot-scope="{ row }"> | 
|             <span class="long-title-style">{{ row.cmodel ? row.cmodel.name : '-' }}</span> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column | 
|           prop="createTime" | 
|           label="创建时间" | 
|           min-width="140px" | 
|         ></el-table-column> | 
|         <!-- <el-table-column | 
|           v-if=" | 
|             containPermissions([ | 
|               'ext:categoryunionext:update', | 
|               'ext:categoryunionext:delete', | 
|             ]) | 
|           " | 
|           label="操作" | 
|           min-width="120" | 
|           fixed="right" | 
|         > | 
|           <template slot-scope="{ row }"> | 
|             <el-button | 
|               type="text" | 
|               @click=" | 
|                 $refs.operaCategoryUnionExtWindow.open('编辑分类组合信息', row) | 
|               " | 
|               icon="el-icon-edit" | 
|               v-permissions="['ext:categoryunionext:update']" | 
|               >编辑</el-button | 
|             > | 
|             <el-button | 
|               type="text" | 
|               @click="deleteById(row)" | 
|               icon="el-icon-delete" | 
|               v-permissions="['ext:categoryunionext:delete']" | 
|               >删除</el-button | 
|             > | 
|           </template> | 
|         </el-table-column> --> | 
|         <el-table-column | 
|           label="操作" | 
|           min-width="80px" | 
|           fixed="right" | 
|         > | 
|           <template slot-scope="{ row }"> | 
|             <el-button | 
|               v-permissions="['ext:categoryunionext:update']" | 
|               type="text" | 
|               @click="$refs.operaCategoryUnionExtWindow.open('编辑组合', row)" | 
|               >编辑</el-button> | 
|             <span v-permissions="['ext:categoryunionext:delete']" style="margin-left:8px"> | 
|               <el-button | 
|                 type="text" | 
|                 @click="deleteById(row)" | 
|               >删除</el-button> | 
|             </span> | 
|           </template> | 
|         </el-table-column> | 
|       </el-table> | 
|       <pagination | 
|         @size-change="handleSizeChange" | 
|         @current-change="handlePageChange" | 
|         :pagination="tableData.pagination" | 
|       > | 
|       </pagination> | 
|     </template> | 
|     <!-- 新建/修改 --> | 
|     <OperaCategoryUnionExtWindow | 
|       ref="operaCategoryUnionExtWindow" | 
|       @success="handlePageChange" | 
|     /> | 
|   </TableLayout> | 
| </template> | 
|   | 
| <script> | 
| import BaseTable from '@/components/base/BaseTable' | 
| import TableLayout from '@/layouts/TableLayout' | 
| import Pagination from '@/components/common/Pagination' | 
| import OperaCategoryUnionExtWindow from '@/components/ext/OperaCategoryUnionExtWindow' | 
| import { getListByType } from '@/api/ext/categoryExt' | 
| export default { | 
|   name: 'CategoryUnionExt', | 
|   extends: BaseTable, | 
|   components: { | 
|     TableLayout, | 
|     Pagination, | 
|     OperaCategoryUnionExtWindow | 
|   }, | 
|   data () { | 
|     return { | 
|       // 搜索 | 
|       searchForm: { | 
|         combinationName: '', | 
|         bmodelCateType: '', | 
|         cateBigId: '', | 
|         cateMiddleId: '', | 
|         cateSmallId: '' | 
|       }, | 
|       types: [ | 
|         { name: '物料', id: '0' }, | 
|         { name: '客户', id: '1' }, | 
|         { name: '工装器具', id: '2' }, | 
|         { name: '不良原因', id: '3' } | 
|       ], | 
|       cateBig: [], | 
|       cateMiddle: [], | 
|       cateSmall: [] | 
|     } | 
|   }, | 
|   created () { | 
|     this.config({ | 
|       module: '分类组合信息', | 
|       api: '/ext/categoryUnionExt', | 
|       'field.id': 'id', | 
|       'field.main': 'combinationName', | 
|       sorts: [{ direction: 'desc', property: 'CREATE_TIME' }] | 
|     }) | 
|     this.search() | 
|   }, | 
|   methods: { | 
|     reset () { | 
|       this.cateBig = [] | 
|       this.cateMiddle = [] | 
|       this.cateSmall = [] | 
|       this.$refs.searchForm.resetFields() | 
|       this.search() | 
|     }, | 
|     typeToStr (type) { | 
|       for (const item of this.types) { | 
|         if (item.id === type) { | 
|           return item.name | 
|         } | 
|       } | 
|       return '' | 
|     }, | 
|     getCategory (type, id) { | 
|       let qurey = '?cateType=' + this.searchForm.bmodelCateType + '&type=' + type | 
|       if (id) { | 
|         qurey = qurey + '&id=' + id | 
|       } | 
|       getListByType( | 
|         qurey | 
|       ).then(res => { | 
|         // console.log(res) | 
|         switch (type) { | 
|         case 0: { | 
|           this.cateBig = res | 
|           break | 
|         } | 
|         case 1: { | 
|           this.cateMiddle = res | 
|           break | 
|         } | 
|         case 2: { | 
|           this.cateSmall = res | 
|           break | 
|         } | 
|         default: break | 
|         } | 
|         this.parent = res | 
|       }).catch(err => { | 
|         console.log(err) | 
|       }) | 
|     }, | 
|     seletType (v) { | 
|       this.getCategory(0) | 
|       this.searchForm.cateBigId = '' | 
|       this.searchForm.cateMiddleId = '' | 
|       this.searchForm.cateSmallId = '' | 
|     }, | 
|     selectBig (v) { | 
|       this.getCategory(1, v) | 
|       this.searchForm.cateMiddleId = '' | 
|       this.searchForm.cateSmallId = '' | 
|     }, | 
|     selectMiddle (v) { | 
|       this.getCategory(2, v) | 
|       this.searchForm.cateSmallId = '' | 
|     } | 
|   } | 
| } | 
| </script> |