| | |
| | | trim: true |
| | | }) |
| | | } |
| | | |
| | | export function treeList (data) { |
| | | return request.post('/business/category/tree', data, { |
| | | trim: true |
| | | }) |
| | | } |
| | | // 导åºExcel |
| | | export function exportExcel (data) { |
| | | return request.post('/business/category/exportExcel', data, { |
| | |
| | | <script> |
| | | import BasePage from './BasePage' |
| | | import {mapState} from "vuex"; |
| | | import { isFunction } from 'element-ui' |
| | | |
| | | export default { |
| | | name: 'BaseTable', |
| | |
| | | this.$refs.searchForm.resetFields() |
| | | this.search() |
| | | }, |
| | | refresh () { |
| | | window.location.reload() |
| | | }, |
| | | /** |
| | | * 页容éåæ´å¤çï¼åæ¢é¡µå®¹éæ¶è§¦åï¼ |
| | | * |
| | |
| | | * @param row è¡å¯¹è±¡ |
| | | * @param childConfirm å é¤åèç¹æ¶æ¯å¦è¿è¡äºæ¬¡ç¡®è®¤ |
| | | */ |
| | | deleteById (row, childConfirm = true) { |
| | | deleteById (row, childConfirm = true, call) { |
| | | this.__checkApi() |
| | | let message = `确认å é¤${this.module}å?` |
| | | if (childConfirm && row.children != null && row.children.length > 0) { |
| | |
| | | this.api.deleteById(row[this.configData['field.id']]) |
| | | .then(() => { |
| | | this.__afterDelete() |
| | | if (call) { |
| | | call() |
| | | } |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | |
| | | * |
| | | * @param childConfirm å é¤åèç¹æ¶æ¯å¦è¿è¡äºæ¬¡ç¡®è®¤ |
| | | */ |
| | | deleteByIdInBatch (childConfirm = true) { |
| | | deleteByIdInBatch (childConfirm = true, call) { |
| | | this.__checkApi() |
| | | if (this.tableData.selectedRows.length === 0) { |
| | | this.$tip.warning('请è³å°éæ©ä¸æ¡æ°æ®') |
| | |
| | | this.api.deleteByIdInBatch(this.tableData.selectedRows.map(row => row[this.configData['field.id']]).join(',')) |
| | | .then(() => { |
| | | this.__afterDelete(this.tableData.selectedRows.length) |
| | | if (call) { |
| | | call() |
| | | } |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <GlobalWindow |
| | | :title="title" |
| | | :visible.sync="visible" |
| | | :confirm-working="isWorking" |
| | | @confirm="confirm" |
| | | > |
| | | <el-form :model="form" ref="form" :rules="rules"> |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input v-model="form.name" placeholder="请è¾å
¥åç§°" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="éæ©ç¶çº§" prop="parentId"> |
| | | <el-cascader v-model="form.categoryList" :options="categorys" @change="handleChangeCategory" :show-all-levels="false" |
| | | clearable filterable :props="categoryprops" > |
| | | <template slot-scope="{ node, data }"> |
| | | <span>{{ data.name }}</span> <!-- èªå®ä¹æ¾ç¤ºå
容 --> |
| | | </template> |
| | | </el-cascader> |
| | | </el-form-item> |
| | | <el-form-item label="æåºç " prop="sortnum"> |
| | | <el-input v-model="form.sortnum" placeholder="请è¾å
¥æåºç ï¼ååºï¼" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input v-model="form.remark" type="textarea" placeholder="请è¾å
¥å¤æ³¨" v-trim/> |
| | | </el-form-item> |
| | | </el-form> |
| | | </GlobalWindow> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseOpera from '@/components/base/BaseOpera' |
| | | import GlobalWindow from '@/components/common/GlobalWindow' |
| | | export default { |
| | | name: 'OperaCategoryWindow', |
| | | extends: BaseOpera, |
| | | components: { GlobalWindow }, |
| | | data () { |
| | | return { |
| | | // è¡¨åæ°æ® |
| | | form: { |
| | | id: null, |
| | | name: '', |
| | | type: '', |
| | | remark: '', |
| | | categoryList: [], |
| | | sortnum: null, |
| | | parentId: null |
| | | }, |
| | | categoryprops: { |
| | | label: 'name', |
| | | value: 'id', |
| | | checkStrictly: true, |
| | | lazyLoad: this.lazyLoad |
| | | }, |
| | | categorys: [], |
| | | // éªè¯è§å |
| | | rules: { |
| | | name: [{ required: true, message: '请è¾å
¥åç§°', trigger: 'blur' }] |
| | | } |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | api: '/business/category', |
| | | 'field.id': 'id' |
| | | }) |
| | | }, |
| | | methods: { |
| | | handleChangeCategory (value) { |
| | | if (this.form.categoryList && this.form.categoryList.length >= 1) { |
| | | this.form.parentId = this.form.categoryList[this.form.categoryList.length - 1] |
| | | } |
| | | if (!this.form.categoryList || this.form.categoryList.length == 0 || this.form.categoryList.length == 1) { |
| | | this.form.type = 4 |
| | | } else { |
| | | this.form.type = 6 |
| | | } |
| | | }, |
| | | getTreeData (data) { |
| | | if (!data) { |
| | | return data |
| | | } |
| | | for (let i = 0; i < data.length; i++) { |
| | | console.log(data) |
| | | if (data[i].childList) { |
| | | if (data[i].childList.length < 1) { |
| | | data[i].childList = [] // childrenè¥ä¸ºç©ºæ°ç»ï¼åå°children设为undefined |
| | | data[i].childern = [] // childrenè¥ä¸ºç©ºæ°ç»ï¼åå°children设为undefined |
| | | } else { |
| | | this.getTreeData(data[i].childList) // childrenè¥ä¸ä¸ºç©ºæ°ç»ï¼åç»§ç» éå½è°ç¨ æ¬æ¹æ³ |
| | | } |
| | | } |
| | | } |
| | | return data |
| | | }, |
| | | open (title, target, categorys, categoryType, parentIdPath) { |
| | | this.title = title |
| | | this.categorys = categorys || [] |
| | | this.categorys = this.getTreeData(this.categorys) |
| | | console.log(this.categorys) |
| | | this.visible = true |
| | | this.form = { |
| | | id: null, |
| | | name: '', |
| | | type: '', |
| | | categoryList: [], |
| | | sortnum: null, |
| | | remark: '', |
| | | parentId: null |
| | | } |
| | | this.form.type = categoryType |
| | | // æ°å»º |
| | | var that = this |
| | | if (target == null) { |
| | | this.$nextTick(() => { |
| | | this.$refs.form.resetFields() |
| | | this.form[this.configData['field.id']] = null |
| | | this.form.categoryList = [] |
| | | if (parentIdPath && parentIdPath != null) { |
| | | var array = parentIdPath.split('/') |
| | | array.forEach(item => { |
| | | if (item && item != null && item !== '') { |
| | | that.form.categoryList.push(parseInt(item)) |
| | | } |
| | | }) |
| | | that.handleChangeCategory() |
| | | } |
| | | }) |
| | | return |
| | | } |
| | | // ç¼è¾ |
| | | this.$nextTick(() => { |
| | | for (const key in this.form) { |
| | | this.form[key] = target[key] |
| | | } |
| | | this.form.categoryList = [] |
| | | if (target.parentId && target.idParentPath) { |
| | | var array = target.idParentPath.split('/') |
| | | array.forEach(item => { |
| | | if (item && item != null && item !== '') { |
| | | that.form.categoryList.push(parseInt(item)) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | @confirm="confirm" |
| | | > |
| | | <el-form :model="form" ref="form" :rules="rules"> |
| | | <el-form-item label="å建人ç¼ç " prop="creator"> |
| | | <el-input v-model="form.creator" placeholder="请è¾å
¥å建人ç¼ç " v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="å建æ¶é´" prop="createDate"> |
| | | <el-date-picker v-model="form.createDate" value-format="yyyy-MM-dd" placeholder="请è¾å
¥å建æ¶é´"></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item label="æ´æ°äººç¼ç " prop="editor"> |
| | | <el-input v-model="form.editor" placeholder="请è¾å
¥æ´æ°äººç¼ç " v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="æ´æ°æ¶é´" prop="editDate"> |
| | | <el-date-picker v-model="form.editDate" value-format="yyyy-MM-dd" placeholder="请è¾å
¥æ´æ°æ¶é´"></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item label="æ¯å¦å é¤0å¦ 1æ¯" prop="isdeleted"> |
| | | <el-input v-model="form.isdeleted" placeholder="请è¾å
¥æ¯å¦å é¤0å¦ 1æ¯" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input v-model="form.name" placeholder="请è¾å
¥åç§°" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input v-model="form.remark" placeholder="请è¾å
¥å¤æ³¨" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ 0å¯ç¨ 1ç¦ç¨" prop="status"> |
| | | <el-input v-model="form.status" placeholder="请è¾å
¥ç¶æ 0å¯ç¨ 1ç¦ç¨" v-trim/> |
| | | <el-form-item label="éæ©ç¶çº§" prop="parentId"> |
| | | <el-cascader v-model="form.categoryList" :options="categorys" @change="handleChangeCategory" :show-all-levels="false" |
| | | clearable filterable :props="categoryprops" > |
| | | <template slot-scope="{ node, data }"> |
| | | <span>{{ data.name }}</span> <!-- èªå®ä¹æ¾ç¤ºå
容 --> |
| | | </template> |
| | | </el-cascader> |
| | | </el-form-item> |
| | | <el-form-item label="æåºç " prop="sortnum"> |
| | | <el-input v-model="form.sortnum" placeholder="请è¾å
¥æåºç " v-trim/> |
| | | <el-input v-model="form.sortnum" placeholder="请è¾å
¥æåºç ï¼ååºï¼" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="徿 " prop="imgurl"> |
| | | <el-input v-model="form.imgurl" placeholder="请è¾å
¥å¾æ " v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="ç±»å 0SHE伤害类å 1å®å
¨é£é©ä¼¤å®³ç±»å 2å®å
¨é£é©åçå°ç¹ 3DCAä½ç½® 4DCAé®é¢ 5SHEé£é©å°ç¹" prop="type"> |
| | | <el-input v-model="form.type" placeholder="请è¾å
¥ç±»å 0SHE伤害类å 1å®å
¨é£é©ä¼¤å®³ç±»å 2å®å
¨é£é©åçå°ç¹ 3DCAä½ç½® 4DCAé®é¢ 5SHEé£é©å°ç¹" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶çº§ç¼ç ï¼èªå
³èï¼" prop="parentId"> |
| | | <el-input v-model="form.parentId" placeholder="请è¾å
¥ç¶çº§ç¼ç ï¼èªå
³èï¼" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="åç§°è·¯å¾" prop="namePath"> |
| | | <el-input v-model="form.namePath" placeholder="请è¾å
¥åç§°è·¯å¾" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="ç¼ç è·¯å¾" prop="idPath"> |
| | | <el-input v-model="form.idPath" placeholder="请è¾å
¥ç¼ç è·¯å¾" v-trim/> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input v-model="form.remark" type="textarea" placeholder="请è¾å
¥å¤æ³¨" v-trim/> |
| | | </el-form-item> |
| | | </el-form> |
| | | </GlobalWindow> |
| | |
| | | // è¡¨åæ°æ® |
| | | form: { |
| | | id: null, |
| | | creator: '', |
| | | createDate: '', |
| | | editor: '', |
| | | editDate: '', |
| | | isdeleted: '', |
| | | name: '', |
| | | remark: '', |
| | | status: '', |
| | | sortnum: '', |
| | | imgurl: '', |
| | | type: '', |
| | | parentId: '', |
| | | namePath: '', |
| | | idPath: '' |
| | | remark: '', |
| | | categoryList: [], |
| | | sortnum: null, |
| | | parentId: null |
| | | }, |
| | | categoryprops: { |
| | | label: 'name', |
| | | value: 'id', |
| | | checkStrictly: true, |
| | | lazyLoad: this.lazyLoad |
| | | }, |
| | | categorys: [], |
| | | // éªè¯è§å |
| | | rules: { |
| | | name: [{ required: true, message: '请è¾å
¥åç§°', trigger: 'blur' }] |
| | | } |
| | | } |
| | | }, |
| | |
| | | api: '/business/category', |
| | | 'field.id': 'id' |
| | | }) |
| | | }, |
| | | methods: { |
| | | handleChangeCategory (value) { |
| | | if (this.form.categoryList && this.form.categoryList.length >= 1) { |
| | | this.form.parentId = this.form.categoryList[this.form.categoryList.length - 1] |
| | | } |
| | | }, |
| | | getTreeData (data) { |
| | | if (!data) { |
| | | return data |
| | | } |
| | | for (let i = 0; i < data.length; i++) { |
| | | console.log(data) |
| | | if (data[i].childList) { |
| | | if (data[i].childList.length < 1) { |
| | | data[i].childList = [] // childrenè¥ä¸ºç©ºæ°ç»ï¼åå°children设为undefined |
| | | data[i].childern = [] // childrenè¥ä¸ºç©ºæ°ç»ï¼åå°children设为undefined |
| | | } else { |
| | | this.getTreeData(data[i].childList) // childrenè¥ä¸ä¸ºç©ºæ°ç»ï¼åç»§ç» éå½è°ç¨ æ¬æ¹æ³ |
| | | } |
| | | } |
| | | } |
| | | return data |
| | | }, |
| | | open (title, target, categorys, categoryType, parentIdPath) { |
| | | this.title = title |
| | | this.categorys = categorys || [] |
| | | this.categorys = this.getTreeData(this.categorys) |
| | | console.log(this.categorys) |
| | | this.visible = true |
| | | this.form = { |
| | | id: null, |
| | | name: '', |
| | | type: '', |
| | | remark: '', |
| | | categoryList: [], |
| | | sortnum: null, |
| | | parentId: null |
| | | } |
| | | this.form.type = categoryType |
| | | // æ°å»º |
| | | var that = this |
| | | if (target == null) { |
| | | this.$nextTick(() => { |
| | | this.$refs.form.resetFields() |
| | | this.form[this.configData['field.id']] = null |
| | | this.form.categoryList = [] |
| | | if (parentIdPath && parentIdPath != null) { |
| | | var array = parentIdPath.split('/') |
| | | array.forEach(item => { |
| | | if (item && item != null && item !== '') { |
| | | that.form.categoryList.push(parseInt(item)) |
| | | } |
| | | }) |
| | | that.handleChangeCategory() |
| | | } |
| | | }) |
| | | return |
| | | } |
| | | // ç¼è¾ |
| | | this.$nextTick(() => { |
| | | for (const key in this.form) { |
| | | this.form[key] = target[key] |
| | | } |
| | | this.form.categoryList = [] |
| | | if (target.parentId && target.idParentPath) { |
| | | var array = target.idParentPath.split('/') |
| | | array.forEach(item => { |
| | | if (item && item != null && item !== '') { |
| | | that.form.categoryList.push(parseInt(item)) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <div class="tree"> |
| | | <div v-for="(item, index) of list" :key="index" @click.stop="clickIten(item)"> |
| | | <div class="tree_item"> |
| | | <i class="el-icon-caret-bottom" :class="{ 'activeColor': item.fsStatus === 1 }" v-show="item.fsStatus === 1 && item.childList.length > 0"></i> |
| | | <i class="el-icon-caret-bottom" :class="{ 'activeColor': item.actived === 1 }" v-show="item.fsStatus === 1 && item.childList.length > 0"></i> |
| | | <i class="el-icon-caret-right color" v-show="item.childList.length > 0 && (item.fsStatus === 0 || !item.fsStatus)"></i> |
| | | <div class="tree_item_label long-title-style" :title="item.name" :class="{ 'activeColor': item.fsDate === 1 && item.childList.length === 0 }">{{ item.name }}</div> |
| | | <!-- <i class="el-icon-caret-bottom" :class="{ 'activeColor': item[defaultProps.status] }" v-show="item[defaultProps.status] && item[defaultProps.children]"></i>--> |
| | | <!-- <i class="el-icon-caret-right color" v-show="item[defaultProps.children] && !item[defaultProps.status]"></i>--> |
| | | <!-- <div class="tree_item_label long-title-style" :title="item[defaultProps.name]" :class="{ 'activeColor': item[defaultProps.status] && !item[defaultProps.children] }">{{ item[defaultProps.name] }}</div>--> |
| | | <div class="tree_item_label long-title-style" :title="item.name" :class="{ 'activeColor': item.actived === 1 }">{{ item.name }}</div> |
| | | </div> |
| | | <div class="tree_childern" v-show="item.fsStatus === 1"> |
| | | <tree |
| | | :list="item.childList" |
| | | :alllist="alllist" |
| | | :defaultProps="defaultProps" |
| | | @callback="callback" |
| | | /> |
| | |
| | | name: 'tree', |
| | | props: { |
| | | list: { |
| | | type: Array, |
| | | required: false, |
| | | default: () => [] |
| | | }, |
| | | alllist: { |
| | | type: Array, |
| | | required: false, |
| | | default: () => [] |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | listForList(){ |
| | | // console.log('===============================',this.alllist) |
| | | }, |
| | | // ç¹å»å½å项 |
| | | clickIten (item) { |
| | | // item[this.defaultProps.status] = !item[this.defaultProps.status] |
| | | // this.list.forEach(subItem => { |
| | | // if ((subItem[this.defaultProps.id] !== item[this.defaultProps.id] && subItem[this.defaultProps.status]) || (this.list.length === 1 && subItem[this.defaultProps.status] === false)) { |
| | | // subItem[this.defaultProps.status] = false |
| | | // if (subItem[this.defaultProps.children]) { |
| | | // this.recursion(subItem[this.defaultProps.children]) |
| | | // } |
| | | // } |
| | | // }) |
| | | // if (this.tempItem['id'] === item[this.defaultProps.id]) { |
| | | // this.tempItem = { |
| | | // id: null, |
| | | // name: null, |
| | | // erpId: null |
| | | // } |
| | | // } else { |
| | | // this.tempItem.id = item[this.defaultProps.id] |
| | | // this.tempItem.name = item[this.defaultProps.name] |
| | | // this.tempItem.erpId = item['erpId'] |
| | | // } |
| | | // item.fsDate === 0 || !item.fsDate ? item.fsDate = 1 : item.fsDate = 0 |
| | | // this.listForList() |
| | | const fsDate = item.fsDate === 0 || !item.fsDate ? 1 : 0 |
| | | this.list.forEach(i => { |
| | | this.alllist.forEach(i => { |
| | | i.fsDate = 0 |
| | | i.actived = 0 |
| | | this.recursion1(i.childList) |
| | | }) |
| | | item.fsDate = fsDate |
| | | item.actived = 1 |
| | | if (item.childList.length > 0) { |
| | | item.fsStatus === 0 || !item.fsStatus ? item.fsStatus = 1 : item.fsStatus = 0 |
| | | } |
| | | this.$emit('callback', item, item) |
| | | }, |
| | | // é彿¹æ³ |
| | | recursion (children) { |
| | | recursion1 (children) { |
| | | if (!children || children.length === 0){ |
| | | return |
| | | } |
| | | children.forEach(item => { |
| | | item.fsDate = 0 |
| | | if (item.childList.length > 0) { |
| | | this.recursion(item.childList) |
| | | item.actived = 0 |
| | | if (item.childList && item.childList.length > 0) { |
| | | this.recursion1(item.childList) |
| | | } |
| | | // item[this.defaultProps.status] = false |
| | | // if (item[this.defaultProps.children]) { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <TableLayout1 :permissions="['business:category:query']"> |
| | | <!-- æç´¢è¡¨å --> |
| | | <div ref="QueryFormRef" slot="search-form"> |
| | | <el-form ref="searchForm" :model="searchForm" inline> |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input v-model="searchForm.name" placeholder="请è¾å
¥åç§°" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <section> |
| | | <el-button type="primary" @click="search">æç´¢</el-button> |
| | | <el-button type="primary" @click="refresh">æ¾ç¤ºé¡¶å±</el-button> |
| | | <el-button @click="reset">éç½®</el-button> |
| | | </section> |
| | | </el-form> |
| | | </div> |
| | | <template v-slot:menu> |
| | | <div |
| | | style="width: 100%; height: 50px; background: rgba(242, 242, 242, 1); line-height: 50px; text-align: center; font-size: 14px;"> |
| | | è·ç»æ»é£é©åçå°ç¹</div> |
| | | <div style="width: 100%; height: calc(100vh - 170px); overflow-y: scroll;"> |
| | | <Tree :list="treeList" :alllist="treeList" :defaultProps="{ name: 'name', status: 'fsStatus', children: 'childList', id: 'id' }" |
| | | @callback="callback" /> |
| | | </div> |
| | | </template> |
| | | <!-- è¡¨æ ¼åå页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar" v-if="containPermissions(['business:category:create', 'business:category:delete' ])" > |
| | | <li><el-button type="primary" |
| | | @click="$refs.operaCategoryWindow.open('æ°å»ºDCAäºä»¶ä½ç½®ä¿¡æ¯', null,categoryList ,searchForm.type,searchForm.parentIdPath)" icon="el-icon-plus" |
| | | v-permissions="['business:category:create']">æ°å»º</el-button></li> |
| | | <li><el-button type="danger" @click="deleteByIdInBatch(true,getfindTreePage)" icon="el-icon-delete" v-permissions="['business:category:delete']">æ¹éå é¤</el-button></li> |
| | | </ul> |
| | | <el-table v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="name" label="åç§°" min-width="100px"></el-table-column> |
| | | <el-table-column prop="parentName" label="ç¶çº§" min-width="150px"></el-table-column> |
| | | <el-table-column prop="editorName" label="æä½äºº" min-width="100px"></el-table-column> |
| | | <el-table-column prop="editDate" label="æåæä½æ¶é´" min-width="150px"></el-table-column> |
| | | <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete' ])" label="æä½" min-width="280"> |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" icon="el-icon-edit" @click="$refs.operaCategoryWindow.open('ç¼è¾DCAäºä»¶ä½ç½®ä¿¡æ¯', row, categoryList,searchForm.type)" v-permissions="['business:category:update']">ç¼è¾</el-button> |
| | | <el-button type="text" icon="el-icon-delete" @click="deleteById(row,true, getfindTreePage)" style="color: red" v-permissions="['business:category:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> |
| | | </pagination> |
| | | <OperaCategoryWindow ref="operaCategoryWindow" @success="handlePageChangeDo"/> |
| | | </template> |
| | | </TableLayout1> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseTable from '@/components/base/BaseTable' |
| | | import TableLayout1 from '@/layouts/TableLayout1' |
| | | import OperaCategoryWindow from '@/components/business/OperaCategoryWindow' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import Tree from '@/components/common/Tree' |
| | | import { treeList } from '@/api/business/category' |
| | | export default { |
| | | name: 'categorySheType', |
| | | extends: BaseTable, |
| | | components: { TableLayout1, Pagination, Tree, OperaCategoryWindow }, |
| | | data () { |
| | | return { |
| | | TreeList: [], |
| | | // æç´¢ |
| | | searchForm: { |
| | | name: '', |
| | | keyword: '', |
| | | type: 2, |
| | | isRoot: 1, |
| | | parentId: '', |
| | | parentIdPath: null |
| | | }, |
| | | loading: false, |
| | | heading: false, |
| | | working: false, |
| | | treeList: [], |
| | | categoryList: [] |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | module: 'è·ç»æ»é£é©åçå°ç¹', |
| | | api: '/business/category', |
| | | 'field.id': 'id', |
| | | 'field.main': 'id' |
| | | }) |
| | | // this.search() |
| | | this.getfindTreePage() |
| | | }, |
| | | methods: { |
| | | handlePageChangeDo () { |
| | | this.searchForm.isRoot = 1 |
| | | this.searchForm.parentId = null |
| | | this.getfindTreePage() |
| | | this.handlePageChange() |
| | | }, |
| | | // è·åç»ç»æ |
| | | getfindTreePage () { |
| | | treeList({ type: this.searchForm.type }) |
| | | .then(res => { |
| | | if (res && res.length > 0) { |
| | | res[0].fsStatus = 1 |
| | | // var tree= [{id:null, name:'顶级', childList:res,fsStatus:1}] |
| | | this.treeList = res |
| | | this.search() |
| | | this.categoryList = this.getCategoryTree(res) |
| | | } |
| | | }) |
| | | }, |
| | | getCategoryTree (tree) { |
| | | if (tree == null) { |
| | | return [] |
| | | } |
| | | return tree.map(item => { |
| | | const newItem = { ...item } |
| | | if (newItem) { |
| | | newItem.children = newItem.childList |
| | | } |
| | | if (item.children && item.children.length === 0) { |
| | | this.$delete(newItem, 'children') |
| | | } else { |
| | | newItem.children = this.getCategoryTree(newItem.children) |
| | | } |
| | | // newItem.disabled = false |
| | | return newItem |
| | | }) |
| | | }, |
| | | callback (row) { |
| | | console.log(row) |
| | | this.searchForm.isRoot = null |
| | | this.searchForm.parentId = row.id |
| | | this.searchForm.parentIdPath = row.idPath |
| | | this.search() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .box { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .box_menu { |
| | | width: 100px; |
| | | height: 100%; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .box_tab { |
| | | flex: 1; |
| | | height: 100%; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <TableLayout1 :permissions="['business:category:query']"> |
| | | <!-- æç´¢è¡¨å --> |
| | | <div ref="QueryFormRef" slot="search-form"> |
| | | <el-form ref="searchForm" :model="searchForm" inline> |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input v-model="searchForm.name" placeholder="请è¾å
¥åç§°" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <section> |
| | | <el-button type="primary" @click="search">æç´¢</el-button> |
| | | <el-button type="primary" @click="refresh">æ¾ç¤ºé¡¶å±</el-button> |
| | | <el-button @click="reset">éç½®</el-button> |
| | | </section> |
| | | </el-form> |
| | | </div> |
| | | <template v-slot:menu> |
| | | <div |
| | | style="width: 100%; height: 50px; background: rgba(242, 242, 242, 1); line-height: 50px; text-align: center; font-size: 14px;"> |
| | | è·ç»æ»é£é©ç±»å</div> |
| | | <div style="width: 100%; height: calc(100vh - 170px); overflow-y: scroll;"> |
| | | <Tree :list="treeList" :alllist="treeList" :defaultProps="{ name: 'name', status: 'fsStatus', children: 'childList', id: 'id' }" |
| | | @callback="callback" /> |
| | | </div> |
| | | </template> |
| | | <!-- è¡¨æ ¼åå页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar" v-if="containPermissions(['business:category:create', 'business:category:delete' ])" > |
| | | <li><el-button type="primary" |
| | | @click="$refs.operaCategoryWindow.open('æ°å»ºè·ç»æ»é£é©ç±»å', null,categoryList ,searchForm.type,searchForm.parentIdPath)" icon="el-icon-plus" |
| | | v-permissions="['business:category:create']">æ°å»º</el-button></li> |
| | | <li><el-button type="danger" @click="deleteByIdInBatch(true,getfindTreePage)" icon="el-icon-delete" v-permissions="['business:category:delete']">æ¹éå é¤</el-button></li> |
| | | </ul> |
| | | <el-table v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="name" label="åç§°" min-width="100px"></el-table-column> |
| | | <el-table-column prop="parentName" label="ç¶çº§" min-width="150px"></el-table-column> |
| | | <el-table-column prop="editorName" label="æä½äºº" min-width="100px"></el-table-column> |
| | | <el-table-column prop="editDate" label="æåæä½æ¶é´" min-width="150px"></el-table-column> |
| | | <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete' ])" label="æä½" min-width="280"> |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" icon="el-icon-edit" @click="$refs.operaCategoryWindow.open('ç¼è¾è·ç»æ»é£é©ç±»å', row, categoryList,searchForm.type)" v-permissions="['business:category:update']">ç¼è¾</el-button> |
| | | <el-button type="text" icon="el-icon-delete" @click="deleteById(row,true, getfindTreePage)" style="color: red" v-permissions="['business:category:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> |
| | | </pagination> |
| | | <OperaCategoryWindow ref="operaCategoryWindow" @success="handlePageChangeDo"/> |
| | | </template> |
| | | </TableLayout1> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseTable from '@/components/base/BaseTable' |
| | | import TableLayout1 from '@/layouts/TableLayout1' |
| | | import OperaCategoryWindow from '@/components/business/OperaCategoryWindow' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import Tree from '@/components/common/Tree' |
| | | import { treeList } from '@/api/business/category' |
| | | export default { |
| | | name: 'categorySheType', |
| | | extends: BaseTable, |
| | | components: { TableLayout1, Pagination, Tree, OperaCategoryWindow }, |
| | | data () { |
| | | return { |
| | | TreeList: [], |
| | | // æç´¢ |
| | | searchForm: { |
| | | name: '', |
| | | keyword: '', |
| | | type: 1, |
| | | parentId: '', |
| | | isRoot: 1, |
| | | parentIdPath: null |
| | | }, |
| | | loading: false, |
| | | heading: false, |
| | | working: false, |
| | | treeList: [], |
| | | categoryList: [] |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | module: 'è·ç»æ»é£é©ç±»åé
ç½®', |
| | | api: '/business/category', |
| | | 'field.id': 'id', |
| | | 'field.main': 'id' |
| | | }) |
| | | // this.search() |
| | | this.getfindTreePage() |
| | | }, |
| | | methods: { |
| | | handlePageChangeDo () { |
| | | this.searchForm.parentId = null |
| | | this.searchForm.isRoot = 1 |
| | | this.getfindTreePage() |
| | | this.handlePageChange() |
| | | }, |
| | | // è·åç»ç»æ |
| | | getfindTreePage () { |
| | | treeList({ type: this.searchForm.type }) |
| | | .then(res => { |
| | | if (res && res.length > 0) { |
| | | res[0].fsStatus = 1 |
| | | // var tree= [{id:null, name:'顶级', childList:res,fsStatus:1}] |
| | | this.treeList = res |
| | | this.search() |
| | | this.categoryList = this.getCategoryTree(res) |
| | | } |
| | | }) |
| | | }, |
| | | getCategoryTree (tree) { |
| | | if (tree == null) { |
| | | return [] |
| | | } |
| | | return tree.map(item => { |
| | | const newItem = { ...item } |
| | | if (newItem) { |
| | | newItem.children = newItem.childList |
| | | } |
| | | if (item.children && item.children.length === 0) { |
| | | this.$delete(newItem, 'children') |
| | | } else { |
| | | newItem.children = this.getCategoryTree(newItem.children) |
| | | } |
| | | // newItem.disabled = false |
| | | return newItem |
| | | }) |
| | | }, |
| | | callback (row) { |
| | | console.log(row) |
| | | this.searchForm.isRoot = null |
| | | this.searchForm.parentId = row.id |
| | | this.searchForm.parentIdPath = row.idPath |
| | | this.search() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .box { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .box_menu { |
| | | width: 100px; |
| | | height: 100%; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .box_tab { |
| | | flex: 1; |
| | | height: 100%; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <TableLayout1 :permissions="['business:category:query']"> |
| | | <!-- æç´¢è¡¨å --> |
| | | <div ref="QueryFormRef" slot="search-form"> |
| | | <el-form ref="searchForm" :model="searchForm" inline> |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input v-model="searchForm.name" placeholder="请è¾å
¥åç§°" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <section> |
| | | <el-button type="primary" @click="search">æç´¢</el-button> |
| | | <el-button type="primary" @click="refresh">æ¾ç¤ºé¡¶å±</el-button> |
| | | <el-button @click="reset">éç½®</el-button> |
| | | </section> |
| | | </el-form> |
| | | </div> |
| | | <template v-slot:menu> |
| | | <div |
| | | style="width: 100%; height: 50px; background: rgba(242, 242, 242, 1); line-height: 50px; text-align: center; font-size: 14px;"> |
| | | DCAäºä»¶ä½ç½®</div> |
| | | <div style="width: 100%; height: calc(100vh - 170px); overflow-y: scroll;"> |
| | | <Tree :list="treeList" :alllist="treeList" :defaultProps="{ name: 'name', status: 'fsStatus', children: 'childList', id: 'id' }" |
| | | @callback="callback" /> |
| | | </div> |
| | | </template> |
| | | <!-- è¡¨æ ¼åå页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar" v-if="containPermissions(['business:category:create', 'business:category:delete' ])" > |
| | | <li><el-button type="primary" |
| | | @click="$refs.operaCategoryWindow.open('æ°å»ºDCAäºä»¶ä½ç½®ä¿¡æ¯', null,categoryList ,searchForm.type,searchForm.parentIdPath)" icon="el-icon-plus" |
| | | v-permissions="['business:category:create']">æ°å»º</el-button></li> |
| | | <li><el-button type="danger" @click="deleteByIdInBatch(true,getfindTreePage)" icon="el-icon-delete" v-permissions="['business:category:delete']">æ¹éå é¤</el-button></li> |
| | | </ul> |
| | | <el-table v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="name" label="åç§°" min-width="100px"></el-table-column> |
| | | <el-table-column prop="parentName" label="ç¶çº§" min-width="150px"></el-table-column> |
| | | <el-table-column prop="editorName" label="æä½äºº" min-width="100px"></el-table-column> |
| | | <el-table-column prop="editDate" label="æåæä½æ¶é´" min-width="150px"></el-table-column> |
| | | <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete' ])" label="æä½" min-width="280"> |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" icon="el-icon-edit" @click="$refs.operaCategoryWindow.open('ç¼è¾DCAäºä»¶ä½ç½®ä¿¡æ¯', row, categoryList,searchForm.type)" v-permissions="['business:category:update']">ç¼è¾</el-button> |
| | | <el-button type="text" icon="el-icon-delete" @click="deleteById(row,true, getfindTreePage)" style="color: red" v-permissions="['business:category:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> |
| | | </pagination> |
| | | <OperaCategoryWindow ref="operaCategoryWindow" @success="handlePageChangeDo"/> |
| | | </template> |
| | | </TableLayout1> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseTable from '@/components/base/BaseTable' |
| | | import TableLayout1 from '@/layouts/TableLayout1' |
| | | import OperaCategoryWindow from '@/components/business/OperaCategoryWindow' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import Tree from '@/components/common/Tree' |
| | | import { treeList } from '@/api/business/category' |
| | | export default { |
| | | name: 'categorySheType', |
| | | extends: BaseTable, |
| | | components: { TableLayout1, Pagination, Tree, OperaCategoryWindow }, |
| | | data () { |
| | | return { |
| | | TreeList: [], |
| | | // æç´¢ |
| | | searchForm: { |
| | | name: '', |
| | | keyword: '', |
| | | type: 3, |
| | | isRoot: 1, |
| | | parentId: '', |
| | | parentIdPath: null |
| | | }, |
| | | loading: false, |
| | | heading: false, |
| | | working: false, |
| | | treeList: [], |
| | | categoryList: [] |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | module: 'DCAäºä»¶ä½ç½®ä¿¡æ¯', |
| | | api: '/business/category', |
| | | 'field.id': 'id', |
| | | 'field.main': 'id' |
| | | }) |
| | | // this.search() |
| | | this.getfindTreePage() |
| | | }, |
| | | methods: { |
| | | handlePageChangeDo () { |
| | | this.searchForm.isRoot = 1 |
| | | this.searchForm.parentId = null |
| | | this.getfindTreePage() |
| | | this.handlePageChange() |
| | | }, |
| | | // è·åç»ç»æ |
| | | getfindTreePage () { |
| | | treeList({ type: this.searchForm.type }) |
| | | .then(res => { |
| | | if (res && res.length > 0) { |
| | | res[0].fsStatus = 1 |
| | | // var tree= [{id:null, name:'顶级', childList:res,fsStatus:1}] |
| | | this.treeList = res |
| | | this.search() |
| | | this.categoryList = this.getCategoryTree(res) |
| | | } |
| | | }) |
| | | }, |
| | | getCategoryTree (tree) { |
| | | if (tree == null) { |
| | | return [] |
| | | } |
| | | return tree.map(item => { |
| | | const newItem = { ...item } |
| | | if (newItem) { |
| | | newItem.children = newItem.childList |
| | | } |
| | | if (item.children && item.children.length === 0) { |
| | | this.$delete(newItem, 'children') |
| | | } else { |
| | | newItem.children = this.getCategoryTree(newItem.children) |
| | | } |
| | | // newItem.disabled = false |
| | | return newItem |
| | | }) |
| | | }, |
| | | callback (row) { |
| | | console.log(row) |
| | | this.searchForm.isRoot = null |
| | | this.searchForm.parentId = row.id |
| | | this.searchForm.parentIdPath = row.idPath |
| | | this.search() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .box { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .box_menu { |
| | | width: 100px; |
| | | height: 100%; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .box_tab { |
| | | flex: 1; |
| | | height: 100%; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <TableLayout1 :permissions="['business:category:query']"> |
| | | <!-- æç´¢è¡¨å --> |
| | | <div ref="QueryFormRef" slot="search-form"> |
| | | <el-form ref="searchForm" :model="searchForm" inline> |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input v-model="searchForm.name" placeholder="请è¾å
¥åç§°" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <section> |
| | | <el-button type="primary" @click="search">æç´¢</el-button> |
| | | <el-button type="primary" @click="refresh">æ¾ç¤ºé¡¶å±</el-button> |
| | | <el-button @click="reset">éç½®</el-button> |
| | | </section> |
| | | </el-form> |
| | | </div> |
| | | <template v-slot:menu> |
| | | <div |
| | | style="width: 100%; height: 50px; background: rgba(242, 242, 242, 1); line-height: 50px; text-align: center; font-size: 14px;"> |
| | | DCA主é¢</div> |
| | | <div style="width: 100%; height: calc(100vh - 170px); overflow-y: scroll;"> |
| | | <Tree :list="treeList" :alllist="treeList" :defaultProps="{ name: 'name', status: 'fsStatus', children: 'childList', id: 'id' }" |
| | | @callback="callback" /> |
| | | </div> |
| | | </template> |
| | | <!-- è¡¨æ ¼åå页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar" v-if="containPermissions(['business:category:create', 'business:category:delete' ])" > |
| | | <li><el-button type="primary" |
| | | @click="$refs.operaCategoryWindow.open('æ°å»ºDCA主é¢åè§å¯é¡¹', null,categoryList ,4,searchForm.parentIdPath)" icon="el-icon-plus" |
| | | v-permissions="['business:category:create']">æ°å»º</el-button></li> |
| | | <li><el-button type="danger" @click="deleteByIdInBatch(true,getfindTreePage)" icon="el-icon-delete" v-permissions="['business:category:delete']">æ¹éå é¤</el-button></li> |
| | | </ul> |
| | | <el-table v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="name" label="åç§°" min-width="100px"></el-table-column> |
| | | <el-table-column prop="parentName" label="æå±ç¶çº§" min-width="150px"></el-table-column> |
| | | <el-table-column prop="parentName" label="é
置类å" min-width="150px"> |
| | | <template slot-scope="{row}"> |
| | | <span v-if="row.type == 6" >è§å¯é¡¹</span> |
| | | <span v-else-if="level == 0" >ä¸çº§ä¸»é¢</span> |
| | | <span v-else-if="level == 1" >äºçº§ä¸»é¢</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="editorName" label="æä½äºº" min-width="100px"></el-table-column> |
| | | <el-table-column prop="editDate" label="æåæä½æ¶é´" min-width="150px"></el-table-column> |
| | | <el-table-column prop="remark" label="夿³¨" min-width="100px"></el-table-column> |
| | | <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete' ])" label="æä½" min-width="280"> |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" icon="el-icon-edit" @click="$refs.operaCategoryWindow.open('ç¼è¾DCA主é¢åè§å¯é¡¹', row, categoryList,row.type)" v-permissions="['business:category:update']">ç¼è¾</el-button> |
| | | <el-button type="text" icon="el-icon-delete" @click="deleteById(row,true, getfindTreePage)" style="color: red" v-permissions="['business:category:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> |
| | | </pagination> |
| | | <OperaCategoryDcaProblemWindow ref="operaCategoryWindow" @success="handlePageChangeDo"/> |
| | | </template> |
| | | </TableLayout1> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseTable from '@/components/base/BaseTable' |
| | | import TableLayout1 from '@/layouts/TableLayout1' |
| | | import OperaCategoryDcaProblemWindow from '@/components/business/OperaCategoryDcaProblemWindow' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import Tree from '@/components/common/Tree' |
| | | import { treeList } from '@/api/business/category' |
| | | export default { |
| | | name: 'categorySheType', |
| | | extends: BaseTable, |
| | | components: { TableLayout1, Pagination, Tree, OperaCategoryDcaProblemWindow }, |
| | | data () { |
| | | return { |
| | | TreeList: [], |
| | | level: 1, |
| | | // æç´¢ |
| | | searchForm: { |
| | | name: '', |
| | | keyword: '', |
| | | type: 4, |
| | | parentId: '', |
| | | isRoot: 1, |
| | | parentIdPath: null |
| | | }, |
| | | loading: false, |
| | | heading: false, |
| | | working: false, |
| | | treeList: [], |
| | | categoryList: [] |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | module: 'DCA主é¢åè§å¯é¡¹', |
| | | api: '/business/category', |
| | | 'field.id': 'id', |
| | | 'field.main': 'id' |
| | | }) |
| | | // this.search() |
| | | this.getfindTreePage() |
| | | }, |
| | | methods: { |
| | | handlePageChangeDo () { |
| | | this.searchForm.isRoot = 1 |
| | | this.searchForm.level = 1 |
| | | this.searchForm.type = 4 |
| | | this.searchForm.parentId = null |
| | | this.getfindTreePage() |
| | | this.handlePageChange() |
| | | }, |
| | | initTwoLevelList (res) { |
| | | return res.map(item => { |
| | | if (item && item.childList && item.childList.length > 0) { |
| | | item.childList.forEach(item1 => { |
| | | item1.childList = [] |
| | | item1.level = 2 |
| | | }) |
| | | } |
| | | const newItem = { ...item, level: 1 } |
| | | if (newItem) { |
| | | newItem.children = newItem.childList |
| | | } |
| | | if (item.childList && item.childList.length === 0) { |
| | | this.$delete(newItem, 'children') |
| | | } |
| | | return newItem |
| | | }) |
| | | }, |
| | | // è·åç»ç»æ |
| | | getfindTreePage () { |
| | | treeList({ type: 4 }) |
| | | .then(res => { |
| | | if (res && res.length > 0) { |
| | | res[0].fsStatus = 1 |
| | | // var tree= [{id:null, name:'顶级', childList:res,fsStatus:1}] |
| | | this.treeList = this.initTwoLevelList(res) |
| | | this.search() |
| | | this.categoryList = this.getCategoryTree(this.treeList) |
| | | } |
| | | }) |
| | | }, |
| | | getCategoryTree (tree) { |
| | | if (tree == null) { |
| | | return [] |
| | | } |
| | | return tree.map(item => { |
| | | const newItem = { ...item } |
| | | if (newItem) { |
| | | newItem.children = newItem.childList |
| | | } |
| | | if (item.children && item.children.length === 0) { |
| | | this.$delete(newItem, 'children') |
| | | } else { |
| | | newItem.children = this.getCategoryTree(newItem.children) |
| | | } |
| | | // newItem.disabled = false |
| | | |
| | | return newItem |
| | | }) |
| | | }, |
| | | callback (row) { |
| | | console.log(row) |
| | | this.searchForm.parentId = row.id |
| | | this.searchForm.isRoot = null |
| | | this.searchForm.parentIdPath = row.idPath |
| | | this.level= row.level |
| | | if (row.level === 2) { |
| | | this.searchForm.type = 6 |
| | | } else { |
| | | this.searchForm.type = 4 |
| | | } |
| | | this.search() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .box { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .box_menu { |
| | | width: 100px; |
| | | height: 100%; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .box_tab { |
| | | flex: 1; |
| | | height: 100%; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <TableLayout1 :permissions="['business:category:query']"> |
| | | <!-- æç´¢è¡¨å --> |
| | | <div ref="QueryFormRef" slot="search-form"> |
| | | <el-form ref="searchForm" :model="searchForm" inline> |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input v-model="searchForm.name" placeholder="请è¾å
¥åç§°" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <section> |
| | | <el-button type="primary" @click="search">æç´¢</el-button> |
| | | <el-button type="primary" @click="refresh">æ¾ç¤ºé¡¶å±</el-button> |
| | | <el-button @click="reset">éç½®</el-button> |
| | | </section> |
| | | </el-form> |
| | | </div> |
| | | <template v-slot:menu> |
| | | <div |
| | | style="width: 100%; height: 50px; background: rgba(242, 242, 242, 1); line-height: 50px; text-align: center; font-size: 14px;"> |
| | | SHEäºä»¶åçå°ç¹</div> |
| | | <div style="width: 100%; height: calc(100vh - 170px); overflow-y: scroll;"> |
| | | <Tree :list="treeList" :alllist="treeList" :defaultProps="{ name: 'name', status: 'fsStatus', children: 'childList', id: 'id' }" |
| | | @callback="callback" /> |
| | | </div> |
| | | </template> |
| | | <!-- è¡¨æ ¼åå页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar" v-if="containPermissions(['business:category:create', 'business:category:delete' ])" > |
| | | <li><el-button type="primary" |
| | | @click="$refs.operaCategoryWindow.open('æ°å»ºSHEäºä»¶åçå°ç¹', null,categoryList ,searchForm.type,searchForm.parentIdPath)" icon="el-icon-plus" |
| | | v-permissions="['business:category:create']">æ°å»º</el-button></li> |
| | | <li><el-button type="danger" @click="deleteByIdInBatch(true,getfindTreePage)" icon="el-icon-delete" v-permissions="['business:category:delete']">æ¹éå é¤</el-button></li> |
| | | </ul> |
| | | <el-table v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="name" label="åç§°" min-width="100px"></el-table-column> |
| | | <el-table-column prop="parentName" label="ç¶çº§" min-width="150px"></el-table-column> |
| | | <el-table-column prop="editorName" label="æä½äºº" min-width="100px"></el-table-column> |
| | | <el-table-column prop="editDate" label="æåæä½æ¶é´" min-width="150px"></el-table-column> |
| | | <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete' ])" label="æä½" min-width="280"> |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" icon="el-icon-edit" @click="$refs.operaCategoryWindow.open('ç¼è¾SHEäºä»¶åçå°ç¹', row, categoryList,searchForm.type)" v-permissions="['business:category:update']">ç¼è¾</el-button> |
| | | <el-button type="text" icon="el-icon-delete" @click="deleteById(row,true, getfindTreePage)" style="color: red" v-permissions="['business:category:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> |
| | | </pagination> |
| | | <OperaCategoryWindow ref="operaCategoryWindow" @success="handlePageChangeDo"/> |
| | | </template> |
| | | </TableLayout1> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseTable from '@/components/base/BaseTable' |
| | | import TableLayout1 from '@/layouts/TableLayout1' |
| | | import OperaCategoryWindow from '@/components/business/OperaCategoryWindow' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import Tree from '@/components/common/Tree' |
| | | import { treeList } from '@/api/business/category' |
| | | export default { |
| | | name: 'categorySheType', |
| | | extends: BaseTable, |
| | | components: { TableLayout1, Pagination, Tree, OperaCategoryWindow }, |
| | | data () { |
| | | return { |
| | | TreeList: [], |
| | | // æç´¢ |
| | | searchForm: { |
| | | name: '', |
| | | keyword: '', |
| | | type: 5, |
| | | parentId: '', |
| | | isRoot: 1, |
| | | parentIdPath: null |
| | | }, |
| | | loading: false, |
| | | heading: false, |
| | | working: false, |
| | | treeList: [], |
| | | categoryList: [] |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | module: 'SHEäºä»¶åçå°ç¹', |
| | | api: '/business/category', |
| | | 'field.id': 'id', |
| | | 'field.main': 'id' |
| | | }) |
| | | // this.search() |
| | | this.getfindTreePage() |
| | | }, |
| | | methods: { |
| | | handlePageChangeDo () { |
| | | this.searchForm.isRoot = 1 |
| | | this.searchForm.parentId = null |
| | | this.getfindTreePage() |
| | | this.handlePageChange() |
| | | }, |
| | | // è·åç»ç»æ |
| | | getfindTreePage () { |
| | | treeList({ type: this.searchForm.type }) |
| | | .then(res => { |
| | | if (res && res.length > 0) { |
| | | res[0].fsStatus = 1 |
| | | // var tree= [{id:null, name:'顶级', childList:res,fsStatus:1}] |
| | | this.treeList = res |
| | | this.search() |
| | | this.categoryList = this.getCategoryTree(res) |
| | | } |
| | | }) |
| | | }, |
| | | getCategoryTree (tree) { |
| | | if (tree == null) { |
| | | return [] |
| | | } |
| | | return tree.map(item => { |
| | | const newItem = { ...item } |
| | | if (newItem) { |
| | | newItem.children = newItem.childList |
| | | } |
| | | if (item.children && item.children.length === 0) { |
| | | this.$delete(newItem, 'children') |
| | | } else { |
| | | newItem.children = this.getCategoryTree(newItem.children) |
| | | } |
| | | // newItem.disabled = false |
| | | return newItem |
| | | }) |
| | | }, |
| | | callback (row) { |
| | | console.log(row) |
| | | this.searchForm.isRoot = null |
| | | this.searchForm.parentId = row.id |
| | | this.searchForm.parentIdPath = row.idPath |
| | | this.search() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .box { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .box_menu { |
| | | width: 100px; |
| | | height: 100%; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .box_tab { |
| | | flex: 1; |
| | | height: 100%; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <TableLayout1 :permissions="['business:category:query']"> |
| | | <!-- æç´¢è¡¨å --> |
| | | <div ref="QueryFormRef" slot="search-form"> |
| | | <el-form ref="searchForm" :model="searchForm" inline> |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input v-model="searchForm.name" placeholder="请è¾å
¥åç§°" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <section> |
| | | <el-button type="primary" @click="search">æç´¢</el-button> |
| | | <el-button type="primary" @click="refresh">æ¾ç¤ºé¡¶å±</el-button> |
| | | <el-button @click="reset">éç½®</el-button> |
| | | </section> |
| | | </el-form> |
| | | </div> |
| | | <template v-slot:menu> |
| | | <div |
| | | style="width: 100%; height: 50px; background: rgba(242, 242, 242, 1); line-height: 50px; text-align: center; font-size: 14px;"> |
| | | 伤害类å</div> |
| | | <div style="width: 100%; height: calc(100vh - 170px); overflow-y: scroll;"> |
| | | <Tree :list="treeList" :alllist="treeList" :defaultProps="{ name: 'name', status: 'fsStatus', children: 'childList', id: 'id' }" |
| | | @callback="callback" /> |
| | | </div> |
| | | </template> |
| | | <!-- è¡¨æ ¼åå页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar" v-if="containPermissions(['business:category:create', 'business:category:delete' ])" > |
| | | <li><el-button type="primary" |
| | | @click="$refs.operaCategoryWindow.open('æ°å»ºä¼¤å®³ç±»å', null,categoryList ,searchForm.type,searchForm.parentIdPath)" icon="el-icon-plus" |
| | | v-permissions="['business:category:create']">æ°å»º</el-button></li> |
| | | <li><el-button type="danger" @click="deleteByIdInBatch(true,getfindTreePage)" icon="el-icon-delete" v-permissions="['business:category:delete']">æ¹éå é¤</el-button></li> |
| | | </ul> |
| | | <el-table v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="name" label="åç§°" min-width="100px"></el-table-column> |
| | | <el-table-column prop="parentName" label="ç¶çº§" min-width="150px"></el-table-column> |
| | | <el-table-column prop="editorName" label="æä½äºº" min-width="100px"></el-table-column> |
| | | <el-table-column prop="editDate" label="æåæä½æ¶é´" min-width="150px"></el-table-column> |
| | | <el-table-column v-if="containPermissions(['business:category:update', 'business:category:delete' ])" label="æä½" min-width="280"> |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" icon="el-icon-edit" @click="$refs.operaCategoryWindow.open('ç¼è¾ä¼¤å®³é£é©ä¿¡æ¯', row, categoryList,searchForm.type)" v-permissions="['business:category:update']">ç¼è¾</el-button> |
| | | <el-button type="text" icon="el-icon-delete" @click="deleteById(row,true, getfindTreePage)" style="color: red" v-permissions="['business:category:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> |
| | | </pagination> |
| | | <OperaCategoryWindow ref="operaCategoryWindow" @success="handlePageChangeDo"/> |
| | | </template> |
| | | </TableLayout1> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseTable from '@/components/base/BaseTable' |
| | | import TableLayout1 from '@/layouts/TableLayout1' |
| | | import OperaCategoryWindow from '@/components/business/OperaCategoryWindow' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import Tree from '@/components/common/Tree' |
| | | import { treeList } from '@/api/business/category' |
| | | export default { |
| | | name: 'categorySheType', |
| | | extends: BaseTable, |
| | | components: { TableLayout1, Pagination, Tree, OperaCategoryWindow }, |
| | | data () { |
| | | return { |
| | | TreeList: [], |
| | | // æç´¢ |
| | | searchForm: { |
| | | name: '', |
| | | keyword: '', |
| | | type: 0, |
| | | parentId: '', |
| | | isRoot: 1, |
| | | parentIdPath: null |
| | | }, |
| | | loading: false, |
| | | heading: false, |
| | | working: false, |
| | | treeList: [], |
| | | categoryList: [] |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | module: '伤害åç±»é
ç½®', |
| | | api: '/business/category', |
| | | 'field.id': 'id', |
| | | 'field.main': 'id' |
| | | }) |
| | | // this.search() |
| | | this.getfindTreePage() |
| | | }, |
| | | methods: { |
| | | handlePageChangeDo () { |
| | | this.searchForm.parentId = null |
| | | this.searchForm.isRoot = 1 |
| | | this.getfindTreePage() |
| | | this.handlePageChange() |
| | | }, |
| | | // è·åç»ç»æ |
| | | getfindTreePage () { |
| | | treeList({ type: this.searchForm.type }) |
| | | .then(res => { |
| | | if (res && res.length > 0) { |
| | | res[0].fsStatus = 1 |
| | | // var tree= [{id:null, name:'顶级', childList:res,fsStatus:1}] |
| | | this.treeList = res |
| | | this.search() |
| | | this.categoryList = this.getCategoryTree(res) |
| | | } |
| | | }) |
| | | }, |
| | | getCategoryTree (tree) { |
| | | if (tree == null) { |
| | | return [] |
| | | } |
| | | return tree.map(item => { |
| | | const newItem = { ...item } |
| | | if (newItem) { |
| | | newItem.children = newItem.childList |
| | | } |
| | | if (item.children && item.children.length === 0) { |
| | | this.$delete(newItem, 'children') |
| | | } else { |
| | | newItem.children = this.getCategoryTree(newItem.children) |
| | | } |
| | | // newItem.disabled = false |
| | | return newItem |
| | | }) |
| | | }, |
| | | callback (row) { |
| | | console.log(row) |
| | | this.searchForm.isRoot = null |
| | | this.searchForm.parentId = row.id |
| | | this.searchForm.parentIdPath = row.idPath |
| | | this.search() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .box { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .box_menu { |
| | | width: 100px; |
| | | height: 100%; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .box_tab { |
| | | flex: 1; |
| | | height: 100%; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | }) |
| | | // this.search() |
| | | this.getfindCompanyTreePage() |
| | | this.getPositionList() |
| | | }, |
| | | methods: { |
| | | // è·åç»ç»æ |
| | |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.service.business.CategoryService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(categoryService.findById(id)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("åç±»æ æ¥è¯¢") |
| | | @PostMapping("/tree") |
| | | @RequiresPermissions("business:category:query") |
| | | public ApiResponse<List<Category>> tree (@RequestBody Category param){ |
| | | return ApiResponse.success(categoryService.treeList(param)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @since 2025/04/02 17:49 |
| | | */ |
| | | public interface CategoryMapper extends BaseMapper<Category> { |
| | | public interface CategoryMapper extends MPJBaseMapper<Category> { |
| | | |
| | | } |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelExportColumn; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | import lombok.Data; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å类信æ¯è¡¨ |
| | |
| | | @ExcelExportColumn(name="徿 ") |
| | | private String imgurl; |
| | | |
| | | @ApiModelProperty(value = "ç±»å 0SHE伤害类å 1å®å
¨é£é©ä¼¤å®³ç±»å 2å®å
¨é£é©åçå°ç¹ 3DCAä½ç½® 4DCAé®é¢ 5SHEé£é©å°ç¹", example = "1") |
| | | @ExcelExportColumn(name="ç±»å 0SHE伤害类å 1å®å
¨é£é©ä¼¤å®³ç±»å 2å®å
¨é£é©åçå°ç¹ 3DCAä½ç½® 4DCAé®é¢ 5SHEé£é©å°ç¹") |
| | | @ApiModelProperty(value = "ç±»å 0SHE伤害类å 1è·ç»æ»ä¼¤å®³ç±»å 2è·ç»æ»åçå°ç¹ 3DCAä½ç½® 4DCAä¸»é¢ 5SHEé£é©å°ç¹ 6DCAè§å¯é¡¹", example = "1") |
| | | @ExcelExportColumn(name="ç±»å 0SHE伤害类å 1è·ç»æ»ä¼¤å®³ç±»å 2è·ç»æ»åçå°ç¹ 3DCAä½ç½® 4DCAä¸»é¢ 5SHEé£é©å°ç¹ 6DCAè§å¯é¡¹") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "ç¶çº§ç¼ç ï¼èªå
³èï¼", example = "1") |
| | |
| | | @ApiModelProperty(value = "ç¼ç è·¯å¾") |
| | | @ExcelExportColumn(name="ç¼ç è·¯å¾") |
| | | private String idPath; |
| | | |
| | | @ApiModelProperty(value = "ä¸çº§åç§°") |
| | | @TableField(exist = false) |
| | | private String parentName; |
| | | @ApiModelProperty(value = "æä½äººåå") |
| | | @TableField(exist = false) |
| | | private String editorName; |
| | | @ApiModelProperty(value = "æä½äººåå") |
| | | @TableField(exist = false) |
| | | private String idParentPath; |
| | | @ApiModelProperty(value = "æ¯å¦æ ¹èç¹ 0å¦ 1æ¯") |
| | | @TableField(exist = false) |
| | | private Integer isRoot; |
| | | @ApiModelProperty(value = "æä½äººåå") |
| | | @TableField(exist = false) |
| | | private List<Category> childList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.business.vo; |
| | | |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.model.Company; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * Created by IntelliJ IDEA. |
| | | * |
| | | * @Author : Rk |
| | | * @create 2023/7/13 10:40 |
| | | */ |
| | | public class CategoryTree { |
| | | |
| | | // ä¿ååä¸æå»ºæ å½¢çæææ°æ®ï¼éå¸¸æ°æ®åºæ¥è¯¢ç»æï¼ |
| | | public List<Category> nodeList = new ArrayList<>(); |
| | | |
| | | |
| | | /** |
| | | * æé æ¹æ³ |
| | | * @param nodeList å°æ°æ®éåèµå¼ç»nodeListï¼å³æææ°æ®ä½ä¸ºææèç¹ã |
| | | */ |
| | | public CategoryTree(List<Category> nodeList){ |
| | | this.nodeList = nodeList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·åéæå»ºçæææ ¹èç¹ï¼é¡¶çº§èç¹ï¼ "0" |
| | | * @return æææ ¹èç¹Listéå |
| | | */ |
| | | public List<Category> getRootNode(){ |
| | | // ä¿åæææ ¹èç¹ï¼æææ ¹èç¹çæ°æ®ï¼ |
| | | List<Category> rootNodeList = new ArrayList<>(); |
| | | // treeNodeï¼æ¥è¯¢åºçæ¯ä¸æ¡æ°æ®ï¼èç¹ï¼ |
| | | for (Category treeNode : nodeList){ |
| | | // 夿å½åèç¹æ¯å¦ä¸ºæ ¹èç¹ï¼æ¤å¤æ³¨æï¼è¥parentIdç±»åæ¯Stringï¼åè¦éç¨equals()æ¹æ³å¤æã |
| | | if (Objects.isNull(treeNode.getParentId())) { |
| | | // æ¯ï¼æ·»å |
| | | rootNodeList.add(treeNode); |
| | | } |
| | | } |
| | | return rootNodeList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®æ¯ä¸ä¸ªé¡¶çº§èç¹ï¼æ ¹èç¹ï¼è¿è¡æå»ºæ å½¢ç»æ |
| | | * @return æå»ºæ´æ£µæ |
| | | */ |
| | | public List<Category> buildTree(){ |
| | | // treeNodesï¼ä¿åä¸ä¸ªé¡¶çº§èç¹ææå»ºåºæ¥ç宿´æ å½¢ |
| | | List<Category> treeNodes = new ArrayList<Category>(); |
| | | // getRootNode()ï¼è·åææçæ ¹èç¹ |
| | | for (Category treeRootNode : getRootNode()) { |
| | | // å°é¡¶çº§èç¹è¿è¡æå»ºåæ |
| | | treeRootNode = buildChildTree(treeRootNode); |
| | | // 宿ä¸ä¸ªé¡¶çº§èç¹ææå»ºçæ å½¢ï¼å¢å è¿æ¥ |
| | | treeNodes.add(treeRootNode); |
| | | } |
| | | return treeNodes; |
| | | } |
| | | |
| | | /** |
| | | * éå½-----æå»ºåæ å½¢ç»æ |
| | | * @param pNode æ ¹èç¹ï¼é¡¶çº§èç¹ï¼ |
| | | * @return æ´æ£µæ |
| | | */ |
| | | public Category buildChildTree(Category pNode){ |
| | | List<Category> childTree = new ArrayList<>(); |
| | | // nodeListï¼ææèç¹éåï¼æææ°æ®ï¼ |
| | | for (Category treeNode : nodeList) { |
| | | // 夿å½åèç¹çç¶èç¹IDæ¯å¦çäºæ ¹èç¹çIDï¼å³å½åèç¹ä¸ºå
¶ä¸çåèç¹ |
| | | if (!Objects.isNull(treeNode.getParentId())&&treeNode.getParentId().equals(pNode.getId())) { |
| | | // åéå½è¿è¡å¤æå½åèç¹çæ
åµï¼è°ç¨èªèº«æ¹æ³ |
| | | childTree.add(buildChildTree(treeNode)); |
| | | } |
| | | } |
| | | // for循ç¯ç»æï¼å³èç¹ä¸æ²¡æä»»ä½èç¹ï¼æ å½¢æå»ºç»æï¼è®¾ç½®æ ç»æ |
| | | pNode.setChildList(childTree); |
| | | return pNode; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | * @return long |
| | | */ |
| | | long count(Category category); |
| | | |
| | | List<Category> treeList(Category param ); |
| | | } |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.CategoryMapper; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.dao.business.model.Managers; |
| | | import com.doumee.dao.business.vo.CategoryTree; |
| | | import com.doumee.dao.business.vo.CompanyTree; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.CategoryService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * å类信æ¯è¡¨Serviceå®ç° |
| | |
| | | |
| | | @Override |
| | | public Integer create(Category category) { |
| | | if(StringUtils.isBlank(category.getName())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(category.getType()==null){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对ä¸èµ·ï¼ç»ç»ç±»å䏿£ç¡®ï¼è¯·æè¦æ±å¡«å~"); |
| | | } |
| | | /* //æ¥è¯¢åç§°ä¸è½éå¤ |
| | | if(categoryMapper.selectCount(new QueryWrapper<Category>().lambda() |
| | | .eq(Category::getName,category.getName()) |
| | | .eq(Category::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对ä¸èµ·ï¼åç§°ä¸è½éå¤~"); |
| | | }*/ |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | category.setIdPath(category.getId()+"/");//åç§°è·¯å¾ |
| | | category.setNamePath(category.getName());//åç§°è·¯å¾ |
| | | String idPath = ""; |
| | | if(category.getParentId() !=null){ |
| | | Category parent = findById(category.getParentId()); |
| | | if(parent == null || Constants.equalsInteger(parent.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对ä¸èµ·ï¼ç¶çº§ä¿¡æ¯ä¸åå¨~"); |
| | | } |
| | | |
| | | idPath = parent.getIdPath(); |
| | | category.setIdPath(parent.getIdPath()+category.getId()+"/"); |
| | | category.setNamePath(parent.getNamePath()+"/"+category.getName()); |
| | | } |
| | | category.setCreateDate(new Date()); |
| | | category.setCreator(user.getId()); |
| | | category.setIsdeleted(Constants.ZERO); |
| | | category.setStatus(Constants.ZERO); |
| | | category.setEditDate(category.getCreateDate()); |
| | | category.setEditor(category.getCreator()); |
| | | categoryMapper.insert(category); |
| | | |
| | | Category com = new Category(); |
| | | com.setId(category.getId()); |
| | | com.setIdPath(idPath+category.getId()+"/"); |
| | | categoryMapper.updateById(com); |
| | | return category.getId(); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
| | | categoryMapper.deleteById(id); |
| | | Category model = new Category(); |
| | | model.setId(id); |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | model.setEditor(user.getId()); |
| | | model.setEditDate(new Date()); |
| | | model.setIsdeleted(Constants.ONE); |
| | | categoryMapper.updateById(model); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | categoryMapper.deleteBatchIds(ids); |
| | | for(Integer id :ids){ |
| | | deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateById(Category category) { |
| | | if( category.getId() == null){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | category.setType(null);//ç±»å䏿¯æä¿®æ¹ |
| | | Category model = categoryMapper.selectById(category.getId()); |
| | | if(model ==null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)) { |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | /* //æ¥è¯¢åç§°ä¸è½éå¤ |
| | | if(categoryMapper.selectCount(new QueryWrapper<Category>().lambda() |
| | | .eq(Category::getName,category.getName()) |
| | | .eq(Category::getType,model.getType()) |
| | | .ne(Category::getId,category.getId()) |
| | | .eq(Category::getIsdeleted,Constants.ZERO)) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对ä¸èµ·ï¼åç§°ä¸è½éå¤~"); |
| | | }*/ |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | category.setIdPath(category.getId()+"/");//åç§°è·¯å¾ |
| | | category.setNamePath(category.getName());//åç§°è·¯å¾ |
| | | if(category.getParentId() !=null ){ |
| | | //妿ç¶çº§åçæ¹å |
| | | Category parent = findById(category.getParentId()); |
| | | if(parent == null || Constants.equalsInteger(parent.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对ä¸èµ·ï¼ç¶çº§ä¿¡æ¯ä¸åå¨~"); |
| | | } |
| | | category.setIdPath(parent.getIdPath()+category.getId()+"/"); |
| | | category.setNamePath(parent.getNamePath()+"/"+category.getName()); |
| | | } |
| | | category.setEditDate(new Date()); |
| | | category.setEditor(user.getId()); |
| | | categoryMapper.updateById(category); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<Category> findList(Category category) { |
| | | QueryWrapper<Category> wrapper = new QueryWrapper<>(category); |
| | | return categoryMapper.selectList(wrapper); |
| | | MPJLambdaWrapper<Category> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper.selectAll(Category.class); |
| | | queryWrapper.selectAs(SystemUser::getUsername,Category::getEditorName); |
| | | queryWrapper.select("t1.name",Category::getParentName); |
| | | queryWrapper.select("t1.id_path",Category::getIdParentPath); |
| | | queryWrapper.leftJoin(Category.class,Category::getId,Category::getParentId); |
| | | queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,Category::getEditor); |
| | | queryWrapper.eq(category.getId() != null, Category::getId, category.getId()) |
| | | .eq(category.getCreator() != null, Category::getCreator, category.getCreator()) |
| | | .ge(category.getCreateDate() != null, Category::getCreateDate, Utils.Date.getStart(category.getCreateDate())) |
| | | .le(category.getCreateDate() != null, Category::getCreateDate, Utils.Date.getEnd(category.getCreateDate())) |
| | | .eq(category.getEditor() != null, Category::getEditor, category.getEditor()) |
| | | .ge(category.getEditDate() != null, Category::getEditDate, Utils.Date.getStart(category.getEditDate())) |
| | | .le(category.getEditDate() != null, Category::getEditDate, Utils.Date.getEnd(category.getEditDate())) |
| | | .eq(category.getIsdeleted() != null, Category::getIsdeleted, category.getIsdeleted()) |
| | | .like(category.getName() != null, Category::getName, category.getName()) |
| | | .eq(category.getRemark() != null, Category::getRemark, category.getRemark()) |
| | | .eq(category.getStatus() != null, Category::getStatus, category.getStatus()) |
| | | .eq(category.getSortnum() != null, Category::getSortnum, category.getSortnum()) |
| | | .eq(category.getImgurl() != null, Category::getImgurl, category.getImgurl()) |
| | | .eq(category.getType() != null, Category::getType, category.getType()) |
| | | .eq(category.getParentId() != null, Category::getParentId, category.getParentId()) |
| | | .eq(category.getNamePath() != null, Category::getNamePath, category.getNamePath()) |
| | | .eq(category.getIdPath() != null, Category::getIdPath, category.getIdPath()) |
| | | .orderByAsc( Category::getSortnum); |
| | | return categoryMapper.selectJoinList(Category.class,queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public PageData<Category> findPage(PageWrap<Category> pageWrap) { |
| | | IPage<Category> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<Category> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | queryWrapper.lambda() |
| | | .eq(pageWrap.getModel().getId() != null, Category::getId, pageWrap.getModel().getId()) |
| | | pageWrap.getModel().setIsdeleted(Constants.ZERO); |
| | | MPJLambdaWrapper<Category> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper.selectAll(Category.class); |
| | | queryWrapper.selectAs(SystemUser::getUsername,Category::getEditorName); |
| | | queryWrapper.select("t1.name",Category::getParentName); |
| | | queryWrapper.select("t1.id_path",Category::getIdParentPath); |
| | | queryWrapper.leftJoin(Category.class,Category::getId,Category::getParentId); |
| | | queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,Category::getEditor); |
| | | queryWrapper.eq(pageWrap.getModel().getId() != null, Category::getId, pageWrap.getModel().getId()) |
| | | .eq(pageWrap.getModel().getCreator() != null, Category::getCreator, pageWrap.getModel().getCreator()) |
| | | .ge(pageWrap.getModel().getCreateDate() != null, Category::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())) |
| | | .le(pageWrap.getModel().getCreateDate() != null, Category::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())) |
| | |
| | | .ge(pageWrap.getModel().getEditDate() != null, Category::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())) |
| | | .le(pageWrap.getModel().getEditDate() != null, Category::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())) |
| | | .eq(pageWrap.getModel().getIsdeleted() != null, Category::getIsdeleted, pageWrap.getModel().getIsdeleted()) |
| | | .eq(pageWrap.getModel().getName() != null, Category::getName, pageWrap.getModel().getName()) |
| | | .like(pageWrap.getModel().getName() != null, Category::getName, pageWrap.getModel().getName()) |
| | | .eq(pageWrap.getModel().getRemark() != null, Category::getRemark, pageWrap.getModel().getRemark()) |
| | | .eq(pageWrap.getModel().getStatus() != null, Category::getStatus, pageWrap.getModel().getStatus()) |
| | | .eq(pageWrap.getModel().getSortnum() != null, Category::getSortnum, pageWrap.getModel().getSortnum()) |
| | | .eq(pageWrap.getModel().getImgurl() != null, Category::getImgurl, pageWrap.getModel().getImgurl()) |
| | | .eq(pageWrap.getModel().getType() != null, Category::getType, pageWrap.getModel().getType()) |
| | | .eq(pageWrap.getModel().getParentId() != null, Category::getParentId, pageWrap.getModel().getParentId()) |
| | | .isNull(pageWrap.getModel().getIsRoot() != null && pageWrap.getModel().getIsRoot().equals(Constants.ONE), Category::getParentId) |
| | | .eq(pageWrap.getModel().getNamePath() != null, Category::getNamePath, pageWrap.getModel().getNamePath()) |
| | | .eq(pageWrap.getModel().getIdPath() != null, Category::getIdPath, pageWrap.getModel().getIdPath()) |
| | | ; |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(categoryMapper.selectPage(page, queryWrapper)); |
| | | .orderByAsc( Category::getSortnum); |
| | | return PageData.from(categoryMapper.selectJoinPage(page,Category.class, queryWrapper)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | QueryWrapper<Category> wrapper = new QueryWrapper<>(category); |
| | | return categoryMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<Category> treeList(Category param ) { |
| | | MPJLambdaWrapper<Category> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper.selectAll(Category.class); |
| | | queryWrapper.selectAs(SystemUser::getUsername,Category::getEditorName); |
| | | queryWrapper.select("t1.name",Category::getParentName); |
| | | queryWrapper.select("t1.id_path",Category::getIdParentPath); |
| | | queryWrapper.leftJoin(Category.class,Category::getId,Category::getParentId); |
| | | queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,Category::getEditor); |
| | | queryWrapper.eq(Category::getIsdeleted, Constants.ZERO); |
| | | queryWrapper.eq(Category::getType, param.getType()); |
| | | queryWrapper.orderByAsc( Category::getSortnum); |
| | | List<Category> companyList = categoryMapper.selectJoinList(Category.class,queryWrapper); |
| | | CategoryTree treeBuild = new CategoryTree(companyList); |
| | | companyList = treeBuild.buildTree(); |
| | | return companyList; |
| | | } |
| | | |
| | | } |
| | |
| | | public List<Company> companyTree( ) { |
| | | MPJLambdaWrapper<Company> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper.selectAll(Company.class); |
| | | queryWrapper.selectAs(SystemUser::getRealname,Company::getEditorName); |
| | | queryWrapper.selectAs(SystemUser::getUsername,Company::getEditorName); |
| | | queryWrapper.select("t1.name",Company::getParentName); |
| | | queryWrapper.select("t1.name_path",Company::getParentCompanyPath); |
| | | queryWrapper.leftJoin(Company.class,Company::getId,Company::getParentId); |