master
lion 1 year ago
parent ca9b5d387c
commit 3fe155ecda

@ -213,11 +213,13 @@ export default {
let clientHeight = document.documentElement.clientHeight; let clientHeight = document.documentElement.clientHeight;
let lxheader = document.querySelector(".v-header")?.getBoundingClientRect(); let lxheader = document.querySelector(".v-header")?.getBoundingClientRect();
let lxHeader_height = lxheader.height + 25; // let lxHeader_height = lxheader.height + 25; //
let paginationHeight = 37; // console.log("this.isPage",this.isPage)
let topHeight = 50; // let paginationHeight = this.isPage ? 37 : 0; //
let topHeight = 20; //
this.tableHeight = this.tableHeight =
clientHeight - lxHeader_height - topHeight - paginationHeight - 20 - 25; clientHeight - lxHeader_height - topHeight - paginationHeight - 20 - 25;
//console.log(this.tableHeight) //console.log(this.tableHeight)
this.$emit("getHeight",this.tableHeight)
}, },
async getTableData(isRefresh = false) { async getTableData(isRefresh = false) {
if (isRefresh) { if (isRefresh) {

@ -92,7 +92,9 @@
color: $subMenuActiveText; color: $subMenuActiveText;
} }
.el-menu-item.is-active{
color:$menuActiveBg!important
}
& .nest-menu .el-submenu>.el-submenu__title, & .nest-menu .el-submenu>.el-submenu__title,
& .el-submenu .el-menu-item { & .el-submenu .el-menu-item {
min-width: $sideBarWidth !important; min-width: $sideBarWidth !important;

@ -8,7 +8,13 @@
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>上级目录 <span style="color: red;font-weight: bold;padding-right: 4px;"></span>上级目录
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-input v-model="form.pName" disabled clearable style="width: 100%;"></el-input> <el-input v-if="type==='add'" v-model="form.pName" disabled clearable style="width: 100%;"></el-input>
<div v-else style="height:150px;overflow: scroll;">
<el-tree v-if="isShow" :default-checked-keys="checkArr" :check-strictly="true" @check="getSelectedNodes"
:data="catalogList" show-checkbox default-expand-all node-key="id" ref="tree" highlight-current
:props="defaultProps">
</el-tree>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -40,7 +46,8 @@
<script> <script>
import { import {
save, save,
show show,
index
} from "@/api/system/baseForm.js" } from "@/api/system/baseForm.js"
import { import {
deepCopy, deepCopy,
@ -55,6 +62,12 @@
isShow: false, isShow: false,
type: 'add', type: 'add',
id: '', id: '',
catalogList: [],
checkArr: [],
defaultProps: {
children: 'children',
label: 'name'
},
table_name: 'catalogs', table_name: 'catalogs',
form: { form: {
pName: '根目录', pName: '根目录',
@ -70,12 +83,41 @@
} }
} }
}, },
created() {}, created() {
methods: {
},
methods: {
async getCatalogList() {
const res = await index({
page_size: 999,
page: 1,
sort_type: 'ASC',
sort_name: 'sort',
table_name: 'catalogs',
is_auth: 1
})
if (res.data.length > 0) {
this.catalogList = this.base.buildTree(res.data)
this.catalogList.unshift({
id:0,
name:'根目录'
})
}
},
getSelectedNodes(data, node) {
console.log("data", data)
this.$refs.tree.setCheckedKeys([]); //
this.$refs.tree.setCheckedNodes([data]); //
this.form.pName = data.name
this.form.pid = data.id
this.$forceUpdate()
},
// //
setPid(pid, pName) { setPid(pid, pName) {
console.log("pid", pid, pName)
this.form.pid = pid ? pid : 0 this.form.pid = pid ? pid : 0
this.form.pName = pName ? pName : '根目录' this.form.pName = pName ? pName : '根目录'
this.checkArr = pid ? [pid] : []
}, },
submit() { submit() {
if (this.id) { if (this.id) {
@ -83,6 +125,12 @@
} }
if (this.type == 'add' || this.type == "child") { if (this.type == 'add' || this.type == "child") {
this.form.id = '' this.form.id = ''
}
if(this.type==='editor'){
if(this.form.pid===this.form.id){
this.$Message.warning("上级目录不能为自身")
return
}
} }
console.log("this.form", this.form) console.log("this.form", this.form)
save({ save({
@ -103,13 +151,15 @@
id: this.id, id: this.id,
table_name: this.table_name, table_name: this.table_name,
}).then(res => { }).then(res => {
this.form = this.base.requestToForm(res, this.form) this.form = this.base.requestToForm(res, this.form)
this.checkArr = res.pid ? [res.pid] : []
}) })
} }
}, },
watch: { watch: {
isShow(newVal) { isShow(newVal) {
if (newVal) { if (newVal) {
this.getCatalogList()
if (this.type === 'editor') { if (this.type === 'editor') {
this.getDetail() this.getDetail()
} else if (this.type === 'add') { } else if (this.type === 'add') {
@ -118,7 +168,8 @@
} }
} else { } else {
this.id = '' this.id = ''
this.type = "add" this.type = "add"
this.checkArr = []
this.form = { this.form = {
pName: '根目录', pName: '根目录',
name: '', name: '',
@ -144,4 +195,8 @@
::v-deep .xy-table-item-content { ::v-deep .xy-table-item-content {
width: calc(100% - 140px); width: calc(100% - 140px);
} }
::v-deep .el-checkbox__input .el-checkbox__inner {
border-radius: 50%;
}
</style> </style>

@ -66,6 +66,11 @@
prop: 'name', prop: 'name',
label: '目录名称', label: '目录名称',
align: 'left', align: 'left',
},{
prop: 'sort',
label: '排序',
align: 'center',
width:50
}] }]
} }

@ -90,7 +90,6 @@
isShow(newVal) { isShow(newVal) {
if (newVal) { if (newVal) {
this.getDetail() this.getDetail()
} else { } else {
this.id = '' this.id = ''
this.form = {} this.form = {}

@ -26,13 +26,14 @@
</div> </div>
<div class="catalog"> <div class="catalog">
<div class="catalog_left"> <div class="catalog_left" :style="{'height': myHeight+'px',overflow:'scroll'}">
<el-tree @node-click="getSelectedNodes" :data="catalogList" default-expand-all node-key="id" ref="tree" <el-tree @node-click="getSelectedNodes" :data="catalogList" default-expand-all node-key="id" ref="tree"
highlight-current :props="defaultProps"> highlight-current :props="defaultProps">
</el-tree> </el-tree>
</div> </div>
<div class="catalog_right"> <div class="catalog_right">
<xy-table :list="list" :total="total" @pageIndexChange="pageIndexChange" @pageSizeChange="pageSizeChange" <xy-table @getHeight="initHeight" :list="list" :total="total" @pageIndexChange="pageIndexChange" @pageSizeChange="pageSizeChange"
:table-item="table_item"> :table-item="table_item">
<template v-slot:catalog_name> <template v-slot:catalog_name>
<el-table-column align='left' label="所属目录" width="120" header-align="center"> <el-table-column align='left' label="所属目录" width="120" header-align="center">
@ -110,6 +111,7 @@
page_size: 10, page_size: 10,
catalog_id: '' catalog_id: ''
}, },
myHeight:0,
stateObj:{}, stateObj:{},
total: 0, total: 0,
list: [], list: [],
@ -163,7 +165,12 @@
this.getCatalogList() this.getCatalogList()
this.getList() this.getList()
}, },
methods: { methods: {
initHeight(e){
console.log("e",e)
this.myHeight = e + 37
},
async getCatalogList() { async getCatalogList() {
const res = await index({ const res = await index({
page_size: 999, page_size: 999,

@ -25,7 +25,7 @@ module.exports = {
* Detail: https://cli.vuejs.org/config/#publicpath * Detail: https://cli.vuejs.org/config/#publicpath
*/ */
publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin', publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin',
outputDir: '/Users/mac/Documents/朗业/2024/s-四世同堂-档案/sstt_dangan/public/admin', outputDir: '/Users/mac/Documents/朗业/2024/s-四世同堂-档案/sstt_dangan/public/admin_test',
assetsDir: 'static', assetsDir: 'static',
css: { css: {
loaderOptions: { // 向 CSS 相关的 loader 传递选项 loaderOptions: { // 向 CSS 相关的 loader 传递选项

Loading…
Cancel
Save