|
|
|
@ -147,9 +147,17 @@ export default {
|
|
|
|
return { width: "100%", marginBottom: "20px" };
|
|
|
|
return { width: "100%", marginBottom: "20px" };
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
btnToMore: {
|
|
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
|
|
default: false
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
moreAuths: {
|
|
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
|
|
default: () => ['edit','delete']
|
|
|
|
|
|
|
|
},
|
|
|
|
btnWidth: {
|
|
|
|
btnWidth: {
|
|
|
|
type: Number,
|
|
|
|
type: Number,
|
|
|
|
default: 140,
|
|
|
|
default: 220,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 分页相关
|
|
|
|
// 分页相关
|
|
|
|
@ -204,10 +212,9 @@ export default {
|
|
|
|
return metrics.width;
|
|
|
|
return metrics.width;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
initLoad() {
|
|
|
|
initLoad() {
|
|
|
|
|
|
|
|
if (this.height) return;
|
|
|
|
let clientHeight = document.documentElement.clientHeight;
|
|
|
|
let clientHeight = document.documentElement.clientHeight;
|
|
|
|
let lxheader = document
|
|
|
|
let lxheader = document.querySelector(".v-header")?.getBoundingClientRect();
|
|
|
|
.querySelector(".v-header")
|
|
|
|
|
|
|
|
.getBoundingClientRect();
|
|
|
|
|
|
|
|
let lxHeader_height = lxheader.height + 25; //查询 头部
|
|
|
|
let lxHeader_height = lxheader.height + 25; //查询 头部
|
|
|
|
let paginationHeight = 37; //分页的高度
|
|
|
|
let paginationHeight = 37; //分页的高度
|
|
|
|
let topHeight = 50; //页面 头部
|
|
|
|
let topHeight = 50; //页面 头部
|
|
|
|
@ -242,6 +249,7 @@ export default {
|
|
|
|
.then((res) => {
|
|
|
|
.then((res) => {
|
|
|
|
this.listData = this.getByStrkey(res.data, this.resProp);
|
|
|
|
this.listData = this.getByStrkey(res.data, this.resProp);
|
|
|
|
this.totalData = res.data.total;
|
|
|
|
this.totalData = res.data.total;
|
|
|
|
|
|
|
|
this.$emit('loaded')
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.loading = false;
|
|
|
|
this.loading = false;
|
|
|
|
|
|
|
|
|
|
|
|
@ -261,6 +269,7 @@ export default {
|
|
|
|
.then((res) => {
|
|
|
|
.then((res) => {
|
|
|
|
this.listData = this.getByStrkey(res, this.resProp);
|
|
|
|
this.listData = this.getByStrkey(res, this.resProp);
|
|
|
|
this.totalData = res.total;
|
|
|
|
this.totalData = res.total;
|
|
|
|
|
|
|
|
this.$emit('loaded')
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.loading = false;
|
|
|
|
this.loading = false;
|
|
|
|
|
|
|
|
|
|
|
|
@ -368,7 +377,7 @@ export default {
|
|
|
|
this.$refs.table.toggleRowExpansion(row, expanded);
|
|
|
|
this.$refs.table.toggleRowExpansion(row, expanded);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
setCurrentRow(row) {
|
|
|
|
setCurrentRow(row) {
|
|
|
|
this.$refs.table.toggleRowExpansion(row);
|
|
|
|
this.$refs.table.setCurrentRow(row);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
clearSort() {
|
|
|
|
clearSort() {
|
|
|
|
this.$refs.table.clearSort();
|
|
|
|
this.$refs.table.clearSort();
|
|
|
|
@ -385,6 +394,9 @@ export default {
|
|
|
|
getSelection(){
|
|
|
|
getSelection(){
|
|
|
|
return this.$refs.table?.store?.states?.selection ?? []
|
|
|
|
return this.$refs.table?.store?.states?.selection ?? []
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
getListData () {
|
|
|
|
|
|
|
|
return this.listData
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//table通讯事件
|
|
|
|
//table通讯事件
|
|
|
|
delete(row, type) {
|
|
|
|
delete(row, type) {
|
|
|
|
@ -444,6 +456,7 @@ export default {
|
|
|
|
expandChange(row, expanded) {
|
|
|
|
expandChange(row, expanded) {
|
|
|
|
this.$emit("expand-change", row, expanded);
|
|
|
|
this.$emit("expand-change", row, expanded);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
deleteClick(row) {
|
|
|
|
deleteClick(row) {
|
|
|
|
this.$emit("delete", row);
|
|
|
|
this.$emit("delete", row);
|
|
|
|
if (this.destroyAction) {
|
|
|
|
if (this.destroyAction) {
|
|
|
|
@ -571,12 +584,68 @@ export default {
|
|
|
|
let _this = this;
|
|
|
|
let _this = this;
|
|
|
|
if (_this.auths?.length > 0) {
|
|
|
|
if (_this.auths?.length > 0) {
|
|
|
|
let btns = new Map();
|
|
|
|
let btns = new Map();
|
|
|
|
|
|
|
|
btns.set(
|
|
|
|
|
|
|
|
"more",
|
|
|
|
|
|
|
|
<el-dropdown size="small" type="primary" placement="bottom" on={{
|
|
|
|
|
|
|
|
['command']:command => {
|
|
|
|
|
|
|
|
if (command === 'edit') {
|
|
|
|
|
|
|
|
this.editorClick(scope.row)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (command === 'delete') {
|
|
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
|
|
this.$confirm("确认删除吗?",{
|
|
|
|
|
|
|
|
beforeClose(action,instance,done){
|
|
|
|
|
|
|
|
if (action === 'confirm') {
|
|
|
|
|
|
|
|
that.deleteClick(scope.row);
|
|
|
|
|
|
|
|
done();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
done();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
|
|
type: 'success',
|
|
|
|
|
|
|
|
message: '删除成功'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.load()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.$emit(command, scope.row)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}}>
|
|
|
|
|
|
|
|
<i-button
|
|
|
|
|
|
|
|
type="default"
|
|
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
|
|
style="margin-left: 6px;"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
更多
|
|
|
|
|
|
|
|
</i-button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
(() => {
|
|
|
|
|
|
|
|
let dom = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.moreAuths.forEach(i => {
|
|
|
|
|
|
|
|
this.$scopedSlots[i] ? dom.push((<el-dropdown-item command={i}>{ this.$scopedSlots[i](scope) }</el-dropdown-item>)) : ''
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.auths.indexOf('edit') !== -1) {
|
|
|
|
|
|
|
|
dom.push(<el-dropdown-item divided command="edit">编辑</el-dropdown-item>)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.auths.indexOf('delete') !== -1) {
|
|
|
|
|
|
|
|
dom.push(<el-dropdown-item command="delete"><span style="color: red;">删除</span></el-dropdown-item>)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return dom;
|
|
|
|
|
|
|
|
})()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
|
|
)
|
|
|
|
btns.set(
|
|
|
|
btns.set(
|
|
|
|
"detail",
|
|
|
|
"detail",
|
|
|
|
<i-button
|
|
|
|
<i-button
|
|
|
|
style={{
|
|
|
|
|
|
|
|
"margin-right": "6px",
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
type="primary"
|
|
|
|
size="small"
|
|
|
|
size="small"
|
|
|
|
ghost={true}
|
|
|
|
ghost={true}
|
|
|
|
@ -588,9 +657,6 @@ export default {
|
|
|
|
btns.set(
|
|
|
|
btns.set(
|
|
|
|
"edit",
|
|
|
|
"edit",
|
|
|
|
<i-button
|
|
|
|
<i-button
|
|
|
|
style={{
|
|
|
|
|
|
|
|
"margin-right": "6px",
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
type="primary"
|
|
|
|
size="small"
|
|
|
|
size="small"
|
|
|
|
onClick={() => _this.editorClick(scope.row, "edit")}
|
|
|
|
onClick={() => _this.editorClick(scope.row, "edit")}
|
|
|
|
@ -673,17 +739,25 @@ export default {
|
|
|
|
"flex-wrap": "wrap",
|
|
|
|
"flex-wrap": "wrap",
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{_this.auths.map((item, index) => {
|
|
|
|
{ (() => {
|
|
|
|
|
|
|
|
let dom = [];
|
|
|
|
|
|
|
|
_this.auths.forEach((item, index) => {
|
|
|
|
|
|
|
|
if (this.btnToMore && _this.moreAuths.find(j => j === item)) return
|
|
|
|
if (_this.$scopedSlots[item]) {
|
|
|
|
if (_this.$scopedSlots[item]) {
|
|
|
|
flag = index;
|
|
|
|
flag = index;
|
|
|
|
return _this.$scopedSlots[item](scope, item, index);
|
|
|
|
dom.push(_this.$scopedSlots[item](scope, item, index));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (btns.get(item)) {
|
|
|
|
if (btns.get(item)) {
|
|
|
|
flag = index;
|
|
|
|
flag = index;
|
|
|
|
return btns.get(item);
|
|
|
|
dom.push(btns.get(item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})}
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.btnToMore? dom.push(btns.get('more')) : ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return dom;
|
|
|
|
|
|
|
|
})() }
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
return { dom, flag };
|
|
|
|
return { dom, flag };
|
|
|
|
@ -711,7 +785,7 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},{
|
|
|
|
},{
|
|
|
|
deep: true,
|
|
|
|
deep: true,
|
|
|
|
immediate: false
|
|
|
|
immediate: true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if(this.action) this.getTableData();
|
|
|
|
if(this.action) this.getTableData();
|
|
|
|
@ -921,6 +995,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
::v-deep .el-table {
|
|
|
|
::v-deep .el-table {
|
|
|
|
margin-bottom: 0 !important;
|
|
|
|
margin-bottom: 0 !important;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.xy-table__setting {
|
|
|
|
.xy-table__setting {
|
|
|
|
font-size: 14px;
|
|
|
|
font-size: 14px;
|
|
|
|
@ -933,6 +1008,7 @@ export default {
|
|
|
|
.xy-table__page {
|
|
|
|
.xy-table__page {
|
|
|
|
display: flex;
|
|
|
|
display: flex;
|
|
|
|
justify-content: right;
|
|
|
|
justify-content: right;
|
|
|
|
|
|
|
|
align-items: center;
|
|
|
|
border-bottom-right-radius: 4px;
|
|
|
|
border-bottom-right-radius: 4px;
|
|
|
|
border-bottom-left-radius: 4px;
|
|
|
|
border-bottom-left-radius: 4px;
|
|
|
|
background: rgba(140, 140, 140, 0.6);
|
|
|
|
background: rgba(140, 140, 140, 0.6);
|
|
|
|
@ -1055,4 +1131,8 @@ export default {
|
|
|
|
opacity: 1;
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Button + Button {
|
|
|
|
|
|
|
|
margin-left: 6px;
|
|
|
|
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|
|