|
|
@ -7,24 +7,12 @@ |
|
|
|
<!--表单组件--> |
|
|
|
<!--表单组件--> |
|
|
|
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
|
|
|
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
|
|
|
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
|
|
|
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
|
|
|
<el-form-item label="id" prop="id"> |
|
|
|
<el-form-item style="" label="上级分类" prop="pid"> |
|
|
|
<el-input v-model="form.id" style="width: 370px;" /> |
|
|
|
<treeselect v-model="form.parentId" :options="depts" style="width: 370px;" placeholder="选择上级分类" /> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="分类名称"> |
|
|
|
<el-form-item label="分类名称"> |
|
|
|
<el-input v-model="form.cagetoryName" style="width: 370px;" /> |
|
|
|
<el-input v-model="form.cagetoryName" style="width: 370px;" /> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="分类图标"> |
|
|
|
|
|
|
|
<el-input v-model="form.cagetoryLogo" style="width: 370px;" /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="createTime"> |
|
|
|
|
|
|
|
<el-input v-model="form.createTime" style="width: 370px;" /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="updateTime"> |
|
|
|
|
|
|
|
<el-input v-model="form.updateTime" style="width: 370px;" /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="isDel"> |
|
|
|
|
|
|
|
<el-input v-model="form.isDel" style="width: 370px;" /> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</el-form> |
|
|
|
</el-form> |
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="text" @click="crud.cancelCU">取消</el-button> |
|
|
|
<el-button type="text" @click="crud.cancelCU">取消</el-button> |
|
|
@ -32,12 +20,17 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
<!--表格渲染--> |
|
|
|
<!--表格渲染--> |
|
|
|
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
|
|
|
<el-table ref="table" |
|
|
|
|
|
|
|
v-loading="crud.loading" |
|
|
|
|
|
|
|
:data="tableData" |
|
|
|
|
|
|
|
size="small" |
|
|
|
|
|
|
|
style="width: 100%;" |
|
|
|
|
|
|
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" |
|
|
|
|
|
|
|
row-key="id" |
|
|
|
|
|
|
|
@selection-change="crud.selectionChangeHandler"> |
|
|
|
<el-table-column type="selection" width="55" /> |
|
|
|
<el-table-column type="selection" width="55" /> |
|
|
|
<el-table-column v-if="columns.visible('id')" prop="id" label="id" /> |
|
|
|
|
|
|
|
<el-table-column v-if="columns.visible('cagetoryName')" prop="cagetoryName" label="分类名称" /> |
|
|
|
<el-table-column v-if="columns.visible('cagetoryName')" prop="cagetoryName" label="分类名称" /> |
|
|
|
<el-table-column v-if="columns.visible('cagetoryLogo')" prop="cagetoryLogo" label="分类图标" /> |
|
|
|
<el-table-column v-if="columns.visible('cagetoryLogo')" prop="cagetoryLogo" label="分类图标" /> |
|
|
|
<el-table-column v-if="columns.visible('isDel')" prop="isDel" label="isDel" /> |
|
|
|
|
|
|
|
<el-table-column v-permission="['admin','ResourcesCagetory:edit','ResourcesCagetory:del']" label="操作" width="150px" align="center"> |
|
|
|
<el-table-column v-permission="['admin','ResourcesCagetory:edit','ResourcesCagetory:del']" label="操作" width="150px" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<udOperation |
|
|
|
<udOperation |
|
|
@ -61,16 +54,20 @@ import crudOperation from '@crud/CRUD.operation' |
|
|
|
import udOperation from '@crud/UD.operation' |
|
|
|
import udOperation from '@crud/UD.operation' |
|
|
|
import pagination from '@crud/Pagination' |
|
|
|
import pagination from '@crud/Pagination' |
|
|
|
import MaterialList from "@/components/material"; |
|
|
|
import MaterialList from "@/components/material"; |
|
|
|
|
|
|
|
import Treeselect from '@riophae/vue-treeselect' |
|
|
|
|
|
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
|
|
|
|
|
|
|
import { initData } from '@/api/data' |
|
|
|
|
|
|
|
|
|
|
|
// crud交由presenter持有 |
|
|
|
// crud交由presenter持有 |
|
|
|
const defaultCrud = CRUD({ title: '资源分类表', url: 'api/ResourcesCagetory', sort: 'id,desc', crudMethod: { ...crudResourcesCagetory }}) |
|
|
|
const defaultCrud = CRUD({ title: '资源分类表', url: 'api/ResourcesCagetory', sort: 'id,desc', crudMethod: { ...crudResourcesCagetory }}) |
|
|
|
const defaultForm = { id: null, cagetoryName: null, cagetoryLogo: null, createTime: null, updateTime: null, isDel: null } |
|
|
|
const defaultForm = { id: null, cagetoryName: null, cagetoryLogo: null, createTime: null, updateTime: null, isDel: null } |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: 'ResourcesCagetory', |
|
|
|
name: 'ResourcesCagetory', |
|
|
|
components: { pagination, crudOperation, rrOperation, udOperation ,MaterialList}, |
|
|
|
components: { pagination, crudOperation, rrOperation, udOperation ,MaterialList, Treeselect}, |
|
|
|
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()], |
|
|
|
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()], |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
|
|
|
|
tableData:[], |
|
|
|
permission: { |
|
|
|
permission: { |
|
|
|
add: ['admin', 'ResourcesCagetory:add'], |
|
|
|
add: ['admin', 'ResourcesCagetory:add'], |
|
|
|
edit: ['admin', 'ResourcesCagetory:edit'], |
|
|
|
edit: ['admin', 'ResourcesCagetory:edit'], |
|
|
@ -80,17 +77,64 @@ export default { |
|
|
|
id: [ |
|
|
|
id: [ |
|
|
|
{ required: true, message: '不能为空', trigger: 'blur' } |
|
|
|
{ required: true, message: '不能为空', trigger: 'blur' } |
|
|
|
] |
|
|
|
] |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
depts:[] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
mounted(){ |
|
|
|
|
|
|
|
initData('/api/ResourcesCagetory',{ |
|
|
|
|
|
|
|
page: 1, |
|
|
|
|
|
|
|
size: 100, |
|
|
|
|
|
|
|
sort: ['id,desc'], |
|
|
|
|
|
|
|
}).then((res)=>{ |
|
|
|
|
|
|
|
console.log(res) |
|
|
|
|
|
|
|
// this.categoryList = res.content |
|
|
|
|
|
|
|
this.depts = [] |
|
|
|
|
|
|
|
const dept = { id: 0, label: '顶级类目', children: [] } |
|
|
|
|
|
|
|
res.content.forEach((item)=>{ |
|
|
|
|
|
|
|
item.label = item.cagetoryName |
|
|
|
|
|
|
|
item.children = item.categoryList |
|
|
|
|
|
|
|
item.categoryList.forEach((child)=>{ |
|
|
|
|
|
|
|
child.label = child.cagetoryName |
|
|
|
|
|
|
|
child.children = child.categoryList |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.tableData = res.content |
|
|
|
|
|
|
|
console.log(this.tableData) |
|
|
|
|
|
|
|
dept.children = res.content |
|
|
|
|
|
|
|
this.depts.push(dept) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
// 获取数据前设置好接口地址 |
|
|
|
// 获取数据前设置好接口地址 |
|
|
|
[CRUD.HOOK.beforeRefresh]() { |
|
|
|
[CRUD.HOOK.beforeRefresh]() { |
|
|
|
return true |
|
|
|
return true |
|
|
|
}, // 新增与编辑前做的操作 |
|
|
|
}, // 新增与编辑前做的操作 |
|
|
|
[CRUD.HOOK.afterToCU](crud, form) { |
|
|
|
[CRUD.HOOK.afterToCU](crud, form) { |
|
|
|
|
|
|
|
initData('/api/ResourcesCagetory',{ |
|
|
|
|
|
|
|
page: 1, |
|
|
|
|
|
|
|
size: 100, |
|
|
|
|
|
|
|
sort: ['id,desc'], |
|
|
|
|
|
|
|
}).then((res)=>{ |
|
|
|
|
|
|
|
console.log(res) |
|
|
|
|
|
|
|
// this.categoryList = res.content |
|
|
|
|
|
|
|
this.depts = [] |
|
|
|
|
|
|
|
const dept = { id: 0, label: '顶级类目', children: [] } |
|
|
|
|
|
|
|
res.content.forEach((item)=>{ |
|
|
|
|
|
|
|
item.label = item.cagetoryName |
|
|
|
|
|
|
|
item.children = item.categoryList |
|
|
|
|
|
|
|
item.categoryList.forEach((child)=>{ |
|
|
|
|
|
|
|
child.label = child.cagetoryName |
|
|
|
|
|
|
|
child.children = child.categoryList |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.tableData = res.content |
|
|
|
|
|
|
|
console.log(this.tableData) |
|
|
|
|
|
|
|
dept.children = res.content |
|
|
|
|
|
|
|
this.depts.push(dept) |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|