parent
616bfd55d8
commit
8cd62f2d58
11 changed files with 860 additions and 376 deletions
@ -0,0 +1,228 @@ |
|||||||
|
<template> |
||||||
|
<basic-container> |
||||||
|
<avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel" |
||||||
|
v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen" |
||||||
|
@search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" |
||||||
|
@current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> |
||||||
|
<template slot-scope="{row}" slot="menu"> |
||||||
|
<el-button type="text" icon="el-icon-circle-plus-outline" size="small" @click="handleDelete">取消黑名单 |
||||||
|
</el-button> |
||||||
|
</template> |
||||||
|
<template slot-scope="{row}" slot="status"> |
||||||
|
<el-tag>{{ row.status == 1 ? '已拉黑' : '已取消' }}</el-tag> |
||||||
|
</template> |
||||||
|
</avue-crud> |
||||||
|
</basic-container> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import { getList, remove, update, add, getNotice } from "@/api/desk/notice"; |
||||||
|
import { mapGetters } from "vuex"; |
||||||
|
|
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
form: {}, |
||||||
|
query: {}, |
||||||
|
loading: true, |
||||||
|
page: { |
||||||
|
pageSize: 10, |
||||||
|
currentPage: 1, |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
selectionList: [], |
||||||
|
option: { |
||||||
|
height: 'auto', |
||||||
|
calcHeight: 30, |
||||||
|
tip: false, |
||||||
|
searchShow: true, |
||||||
|
searchMenuSpan: 6, |
||||||
|
border: true, |
||||||
|
index: true, |
||||||
|
addBtn: false, |
||||||
|
viewBtn: false, |
||||||
|
editBtn: false, |
||||||
|
delBtn: false, |
||||||
|
column: [ |
||||||
|
{ |
||||||
|
label: "体检人姓名", |
||||||
|
prop: "title", |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "身份证号码", |
||||||
|
prop: "releaseTimeRange", |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "联系方式", |
||||||
|
prop: "content", |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "预约时间", |
||||||
|
prop: "releaseTime", |
||||||
|
type: "date", |
||||||
|
format: "yyyy-MM-dd hh:mm:ss", |
||||||
|
valueFormat: "yyyy-MM-dd hh:mm:ss", |
||||||
|
search: true |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "状态", |
||||||
|
prop: "status", |
||||||
|
slot: true, |
||||||
|
}, |
||||||
|
] |
||||||
|
}, |
||||||
|
data: [] |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
...mapGetters(["permission"]), |
||||||
|
permissionList() { |
||||||
|
return { |
||||||
|
addBtn: this.vaildData(this.permission.notice_add, false), |
||||||
|
viewBtn: this.vaildData(this.permission.notice_view, false), |
||||||
|
delBtn: this.vaildData(this.permission.notice_delete, false), |
||||||
|
editBtn: this.vaildData(this.permission.notice_edit, false) |
||||||
|
}; |
||||||
|
}, |
||||||
|
ids() { |
||||||
|
let ids = []; |
||||||
|
this.selectionList.forEach(ele => { |
||||||
|
ids.push(ele.id); |
||||||
|
}); |
||||||
|
return ids.join(","); |
||||||
|
} |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
//发布 |
||||||
|
publish(row, done, loading) { |
||||||
|
console.log(row, done, loading) |
||||||
|
}, |
||||||
|
rowSave(row, done, loading) { |
||||||
|
add(row).then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
done(); |
||||||
|
}, error => { |
||||||
|
window.console.log(error); |
||||||
|
loading(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
rowUpdate(row, index, done, loading) { |
||||||
|
update(row).then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
done(); |
||||||
|
}, error => { |
||||||
|
window.console.log(error); |
||||||
|
loading(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
rowDel(row) { |
||||||
|
this.$confirm("确定将选择数据删除?", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
return remove(row.id); |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
}); |
||||||
|
}, |
||||||
|
searchReset() { |
||||||
|
this.query = {}; |
||||||
|
this.onLoad(this.page); |
||||||
|
}, |
||||||
|
searchChange(params, done) { |
||||||
|
this.query = params; |
||||||
|
this.page.currentPage = 1; |
||||||
|
this.onLoad(this.page, params); |
||||||
|
done(); |
||||||
|
}, |
||||||
|
selectionChange(list) { |
||||||
|
this.selectionList = list; |
||||||
|
}, |
||||||
|
selectionClear() { |
||||||
|
this.selectionList = []; |
||||||
|
this.$refs.crud.toggleSelection(); |
||||||
|
}, |
||||||
|
handleDelete() { |
||||||
|
if (this.selectionList.length === 0) { |
||||||
|
this.$message.warning("请选择至少一条数据"); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm("确定将选择数据删除?", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
return remove(this.ids); |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
this.$refs.crud.toggleSelection(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
beforeOpen(done, type) { |
||||||
|
if (["edit", "view"].includes(type)) { |
||||||
|
getNotice(this.form.id).then(res => { |
||||||
|
this.form = res.data.data; |
||||||
|
}); |
||||||
|
} |
||||||
|
done(); |
||||||
|
}, |
||||||
|
currentChange(currentPage) { |
||||||
|
this.page.currentPage = currentPage; |
||||||
|
}, |
||||||
|
sizeChange(pageSize) { |
||||||
|
this.page.pageSize = pageSize; |
||||||
|
}, |
||||||
|
refreshChange() { |
||||||
|
this.onLoad(this.page, this.query); |
||||||
|
}, |
||||||
|
onLoad(page, params = {}) { |
||||||
|
const { releaseTimeRange } = this.query; |
||||||
|
let values = { |
||||||
|
...params, |
||||||
|
...this.query |
||||||
|
}; |
||||||
|
if (releaseTimeRange) { |
||||||
|
values = { |
||||||
|
...values, |
||||||
|
releaseTime_datege: releaseTimeRange[0], |
||||||
|
releaseTime_datelt: releaseTimeRange[1], |
||||||
|
}; |
||||||
|
values.releaseTimeRange = null; |
||||||
|
} |
||||||
|
this.loading = true; |
||||||
|
getList(page.currentPage, page.pageSize, values).then(res => { |
||||||
|
const data = res.data.data; |
||||||
|
this.page.total = data.total; |
||||||
|
this.data = data.records; |
||||||
|
this.loading = false; |
||||||
|
this.selectionClear(); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<style> |
||||||
|
|
||||||
|
</style> |
||||||
@ -0,0 +1,272 @@ |
|||||||
|
<template> |
||||||
|
<basic-container> |
||||||
|
<avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel" |
||||||
|
v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen" |
||||||
|
@search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" |
||||||
|
@current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> |
||||||
|
<template slot-scope="{row}" slot="menu"> |
||||||
|
<el-button type="text" icon="el-icon-circle-plus-outline" size="small" @click="handleDelete">取消发布 |
||||||
|
</el-button> |
||||||
|
</template> |
||||||
|
<template slot-scope="{row}" slot="status"> |
||||||
|
<el-tag>{{ row.status == 1 ? '已发布' : '已取消' }}</el-tag> |
||||||
|
</template> |
||||||
|
<!-- 自定义弹窗按钮 --> |
||||||
|
<template slot-scope="{row,index,type}" slot="menuForm"> |
||||||
|
<el-button icon="el-icon-circle-plus-outline" size="small" v-if="type == 'add'" @click="$refs.crud.rowSave()">保存</el-button> |
||||||
|
<el-button icon="el-icon-edit" size="small" v-if="type == 'edit'" @click="$refs.crud.rowUpdate()">修改</el-button> |
||||||
|
<el-button type="primary" icon="el-icon-check" size="small" @click="$refs.crud.publish()">发布</el-button> |
||||||
|
</template> |
||||||
|
</avue-crud> |
||||||
|
</basic-container> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import { getList, remove, update, add, getNotice } from "@/api/desk/notice"; |
||||||
|
import { mapGetters } from "vuex"; |
||||||
|
|
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
form: {}, |
||||||
|
query: {}, |
||||||
|
loading: true, |
||||||
|
page: { |
||||||
|
pageSize: 10, |
||||||
|
currentPage: 1, |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
selectionList: [], |
||||||
|
option: { |
||||||
|
height: 'auto', |
||||||
|
calcHeight: 30, |
||||||
|
tip: false, |
||||||
|
searchShow: true, |
||||||
|
searchMenuSpan: 6, |
||||||
|
border: true, |
||||||
|
index: true, |
||||||
|
viewBtn: false, |
||||||
|
selection: true, |
||||||
|
saveBtn:false, |
||||||
|
updateBtn:false, |
||||||
|
cancelBtn:false, |
||||||
|
dialogType: 'drawer', |
||||||
|
dialogClickModal: false, |
||||||
|
column: [ |
||||||
|
{ |
||||||
|
label: "注意事项标题", |
||||||
|
labelWidth:120, |
||||||
|
prop: "title", |
||||||
|
span: 24, |
||||||
|
row: true, |
||||||
|
search: true, |
||||||
|
searchLabelWidth:100, |
||||||
|
rules: [{ |
||||||
|
required: true, |
||||||
|
message: "请输入注意事项标题", |
||||||
|
trigger: "blur" |
||||||
|
}] |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "通知时间", |
||||||
|
prop: "releaseTimeRange", |
||||||
|
type: "datetime", |
||||||
|
format: "yyyy-MM-dd hh:mm:ss", |
||||||
|
valueFormat: "yyyy-MM-dd hh:mm:ss", |
||||||
|
searchRange: true, |
||||||
|
hide: true, |
||||||
|
addDisplay: false, |
||||||
|
editDisplay: false, |
||||||
|
viewDisplay: false, |
||||||
|
search: true, |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "内容", |
||||||
|
labelWidth:120, |
||||||
|
prop: "content", |
||||||
|
component: 'AvueUeditor', |
||||||
|
options: { |
||||||
|
action: '/api/blade-resource/oss/endpoint/put-file', |
||||||
|
props: { |
||||||
|
res: "data", |
||||||
|
url: "link", |
||||||
|
} |
||||||
|
}, |
||||||
|
minRows: 6, |
||||||
|
span: 24, |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "状态", |
||||||
|
prop: "status", |
||||||
|
slot: true, |
||||||
|
addDisplay: false, |
||||||
|
editDisplay: false, |
||||||
|
viewDisplay: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "发布时间", |
||||||
|
prop: "releaseTime", |
||||||
|
type: "date", |
||||||
|
format: "yyyy-MM-dd hh:mm:ss", |
||||||
|
valueFormat: "yyyy-MM-dd hh:mm:ss", |
||||||
|
addDisplay: false, |
||||||
|
editDisplay: false, |
||||||
|
viewDisplay: false, |
||||||
|
}, |
||||||
|
] |
||||||
|
}, |
||||||
|
data: [] |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
...mapGetters(["permission"]), |
||||||
|
permissionList() { |
||||||
|
return { |
||||||
|
addBtn: this.vaildData(this.permission.notice_add, false), |
||||||
|
viewBtn: this.vaildData(this.permission.notice_view, false), |
||||||
|
delBtn: this.vaildData(this.permission.notice_delete, false), |
||||||
|
editBtn: this.vaildData(this.permission.notice_edit, false) |
||||||
|
}; |
||||||
|
}, |
||||||
|
ids() { |
||||||
|
let ids = []; |
||||||
|
this.selectionList.forEach(ele => { |
||||||
|
ids.push(ele.id); |
||||||
|
}); |
||||||
|
return ids.join(","); |
||||||
|
} |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
//发布 |
||||||
|
publish(row, done, loading) { |
||||||
|
console.log(row,done,loading) |
||||||
|
}, |
||||||
|
rowSave(row, done, loading) { |
||||||
|
add(row).then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
done(); |
||||||
|
}, error => { |
||||||
|
window.console.log(error); |
||||||
|
loading(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
rowUpdate(row, index, done, loading) { |
||||||
|
update(row).then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
done(); |
||||||
|
}, error => { |
||||||
|
window.console.log(error); |
||||||
|
loading(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
rowDel(row) { |
||||||
|
this.$confirm("确定将选择数据删除?", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
return remove(row.id); |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
}); |
||||||
|
}, |
||||||
|
searchReset() { |
||||||
|
this.query = {}; |
||||||
|
this.onLoad(this.page); |
||||||
|
}, |
||||||
|
searchChange(params, done) { |
||||||
|
this.query = params; |
||||||
|
this.page.currentPage = 1; |
||||||
|
this.onLoad(this.page, params); |
||||||
|
done(); |
||||||
|
}, |
||||||
|
selectionChange(list) { |
||||||
|
this.selectionList = list; |
||||||
|
}, |
||||||
|
selectionClear() { |
||||||
|
this.selectionList = []; |
||||||
|
this.$refs.crud.toggleSelection(); |
||||||
|
}, |
||||||
|
handleDelete() { |
||||||
|
if (this.selectionList.length === 0) { |
||||||
|
this.$message.warning("请选择至少一条数据"); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm("确定将选择数据删除?", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
return remove(this.ids); |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
this.$refs.crud.toggleSelection(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
beforeOpen(done, type) { |
||||||
|
if (["edit", "view"].includes(type)) { |
||||||
|
getNotice(this.form.id).then(res => { |
||||||
|
this.form = res.data.data; |
||||||
|
}); |
||||||
|
} |
||||||
|
done(); |
||||||
|
}, |
||||||
|
currentChange(currentPage) { |
||||||
|
this.page.currentPage = currentPage; |
||||||
|
}, |
||||||
|
sizeChange(pageSize) { |
||||||
|
this.page.pageSize = pageSize; |
||||||
|
}, |
||||||
|
refreshChange() { |
||||||
|
this.onLoad(this.page, this.query); |
||||||
|
}, |
||||||
|
onLoad(page, params = {}) { |
||||||
|
const { releaseTimeRange } = this.query; |
||||||
|
let values = { |
||||||
|
...params, |
||||||
|
...this.query |
||||||
|
}; |
||||||
|
if (releaseTimeRange) { |
||||||
|
values = { |
||||||
|
...values, |
||||||
|
releaseTime_datege: releaseTimeRange[0], |
||||||
|
releaseTime_datelt: releaseTimeRange[1], |
||||||
|
}; |
||||||
|
values.releaseTimeRange = null; |
||||||
|
} |
||||||
|
this.loading = true; |
||||||
|
getList(page.currentPage, page.pageSize, values).then(res => { |
||||||
|
const data = res.data.data; |
||||||
|
this.page.total = data.total; |
||||||
|
this.data = data.records; |
||||||
|
this.loading = false; |
||||||
|
this.selectionClear(); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<style> |
||||||
|
|
||||||
|
</style> |
||||||
@ -1,363 +1,337 @@ |
|||||||
<template> |
<template> |
||||||
<basic-container> |
<basic-container> |
||||||
<avue-crud :option="option" |
<avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form" |
||||||
:table-loading="loading" |
:permission="permissionList" :before-open="beforeOpen" :before-close="beforeClose" @row-del="rowDel" |
||||||
:data="data" |
@row-update="rowUpdate" @row-save="rowSave" @search-change="searchChange" @search-reset="searchReset" |
||||||
ref="crud" |
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" |
||||||
v-model="form" |
@refresh-change="refreshChange" @on-load="onLoad" @tree-load="treeLoad"> |
||||||
:permission="permissionList" |
|
||||||
:before-open="beforeOpen" |
|
||||||
:before-close="beforeClose" |
|
||||||
@row-del="rowDel" |
|
||||||
@row-update="rowUpdate" |
|
||||||
@row-save="rowSave" |
|
||||||
@search-change="searchChange" |
|
||||||
@search-reset="searchReset" |
|
||||||
@selection-change="selectionChange" |
|
||||||
@current-change="currentChange" |
|
||||||
@size-change="sizeChange" |
|
||||||
@refresh-change="refreshChange" |
|
||||||
@on-load="onLoad" |
|
||||||
@tree-load="treeLoad"> |
|
||||||
<template slot="menuLeft"> |
<template slot="menuLeft"> |
||||||
<el-button type="danger" |
<el-button type="danger" size="small" icon="el-icon-delete" v-if="permission.dept_delete" plain |
||||||
size="small" |
@click="handleDelete">删 除 |
||||||
icon="el-icon-delete" |
|
||||||
v-if="permission.dept_delete" |
|
||||||
plain |
|
||||||
@click="handleDelete">删 除 |
|
||||||
</el-button> |
</el-button> |
||||||
</template> |
</template> |
||||||
<template slot-scope="scope" slot="menu"> |
<template slot-scope="scope" slot="menu"> |
||||||
<el-button |
<el-button type="text" icon="el-icon-circle-plus-outline" size="small" |
||||||
type="text" |
@click.stop="handleAdd(scope.row, scope.index)" v-if="userInfo.role_name.includes('admin')">新增子项 |
||||||
icon="el-icon-circle-plus-outline" |
|
||||||
size="small" |
|
||||||
@click.stop="handleAdd(scope.row,scope.index)" |
|
||||||
v-if="userInfo.role_name.includes('admin')" |
|
||||||
>新增子项 |
|
||||||
</el-button> |
</el-button> |
||||||
</template> |
</template> |
||||||
<template slot-scope="{row}" |
<template slot-scope="{row}" slot="deptCategory"> |
||||||
slot="deptCategory"> |
<el-tag>{{ row.deptCategoryName }}</el-tag> |
||||||
<el-tag>{{row.deptCategoryName}}</el-tag> |
|
||||||
</template> |
</template> |
||||||
</avue-crud> |
</avue-crud> |
||||||
</basic-container> |
</basic-container> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<script> |
<script> |
||||||
import { |
import { |
||||||
getLazyList, |
getLazyList, |
||||||
remove, |
remove, |
||||||
update, |
update, |
||||||
add, |
add, |
||||||
getDept, |
getDept, |
||||||
getDeptTree |
getDeptTree |
||||||
} from "@/api/system/dept"; |
} from "@/api/system/dept"; |
||||||
import {mapGetters} from "vuex"; |
import { mapGetters } from "vuex"; |
||||||
import website from '@/config/website'; |
import website from '@/config/website'; |
||||||
|
|
||||||
export default { |
export default { |
||||||
data() { |
data() { |
||||||
return { |
return { |
||||||
form: {}, |
form: {}, |
||||||
selectionList: [], |
selectionList: [], |
||||||
query: {}, |
query: {}, |
||||||
loading: true, |
loading: true, |
||||||
parentId: 0, |
parentId: 0, |
||||||
page: { |
page: { |
||||||
pageSize: 10, |
pageSize: 10, |
||||||
currentPage: 1, |
currentPage: 1, |
||||||
total: 0, |
total: 0, |
||||||
}, |
}, |
||||||
option: { |
option: { |
||||||
lazy: true, |
lazy: true, |
||||||
tip: false, |
tip: false, |
||||||
simplePage: true, |
simplePage: true, |
||||||
searchShow: true, |
searchShow: true, |
||||||
searchMenuSpan: 6, |
searchMenuSpan: 6, |
||||||
tree: true, |
tree: true, |
||||||
border: true, |
border: true, |
||||||
index: true, |
index: true, |
||||||
selection: true, |
selection: true, |
||||||
viewBtn: true, |
viewBtn: true, |
||||||
menuWidth: 300, |
menuWidth: 300, |
||||||
dialogClickModal: false, |
dialogType: 'drawer', |
||||||
column: [ |
dialogClickModal: false, |
||||||
{ |
column: [ |
||||||
label: "机构名称", |
{ |
||||||
prop: "deptName", |
label: "机构名称", |
||||||
search: true, |
prop: "deptName", |
||||||
rules: [{ |
search: true, |
||||||
required: true, |
rules: [{ |
||||||
message: "请输入机构名称", |
required: true, |
||||||
trigger: "blur" |
message: "请输入机构名称", |
||||||
}] |
trigger: "blur" |
||||||
}, |
}] |
||||||
{ |
}, |
||||||
label: "所属租户", |
{ |
||||||
prop: "tenantId", |
label: "机构logo", |
||||||
type: "tree", |
prop: "deptName", |
||||||
dicUrl: "/api/blade-system/tenant/select", |
html: true, |
||||||
addDisplay: false, |
formatter: (val) => { |
||||||
editDisplay: false, |
return `${val.logo ? '<img src="' + val.logo + '"/>' : ''}` |
||||||
viewDisplay: website.tenantMode, |
|
||||||
span: 24, |
|
||||||
props: { |
|
||||||
label: "tenantName", |
|
||||||
value: "tenantId" |
|
||||||
}, |
|
||||||
hide: !website.tenantMode, |
|
||||||
search: website.tenantMode, |
|
||||||
rules: [{ |
|
||||||
required: true, |
|
||||||
message: "请输入所属租户", |
|
||||||
trigger: "click" |
|
||||||
}] |
|
||||||
}, |
|
||||||
{ |
|
||||||
label: "机构全称", |
|
||||||
prop: "fullName", |
|
||||||
search: true, |
|
||||||
rules: [{ |
|
||||||
required: true, |
|
||||||
message: "请输入机构全称", |
|
||||||
trigger: "blur" |
|
||||||
}] |
|
||||||
}, |
}, |
||||||
{ |
type: 'upload', |
||||||
label: "上级机构", |
listType: 'picture-img', |
||||||
prop: "parentId", |
span: 24, |
||||||
dicData: [], |
fileType: 'img',//img/video/audio |
||||||
type: "tree", |
propsHttp: { |
||||||
hide: true, |
res: 'data' |
||||||
addDisabled: false, |
|
||||||
props: { |
|
||||||
label: "title" |
|
||||||
}, |
|
||||||
rules: [{ |
|
||||||
required: false, |
|
||||||
message: "请选择上级机构", |
|
||||||
trigger: "click" |
|
||||||
}] |
|
||||||
}, |
}, |
||||||
{ |
tip: '只能上传jpg/png用户头像,且不超过500kb', |
||||||
label: "机构类型", |
action: 'https://api.avuejs.com/imgupload' |
||||||
type: "select", |
}, |
||||||
dicUrl: "/api/blade-system/dict/dictionary?code=org_category", |
{ |
||||||
props: { |
label: "机构全称", |
||||||
label: "dictValue", |
prop: "fullName", |
||||||
value: "dictKey" |
search: true, |
||||||
}, |
rules: [{ |
||||||
dataType: "number", |
required: true, |
||||||
width: 120, |
message: "请输入机构全称", |
||||||
prop: "deptCategory", |
trigger: "blur" |
||||||
slot: true, |
}] |
||||||
rules: [{ |
}, |
||||||
required: true, |
{ |
||||||
message: "请输入机构类型", |
label: "上级机构", |
||||||
trigger: "blur" |
prop: "parentId", |
||||||
}] |
dicData: [], |
||||||
|
type: "tree", |
||||||
|
hide: true, |
||||||
|
addDisabled: false, |
||||||
|
props: { |
||||||
|
label: "title" |
||||||
}, |
}, |
||||||
{ |
rules: [{ |
||||||
label: "排序", |
required: false, |
||||||
prop: "sort", |
message: "请选择上级机构", |
||||||
type: "number", |
trigger: "click" |
||||||
align: "right", |
}] |
||||||
width: 80, |
}, |
||||||
rules: [{ |
{ |
||||||
required: true, |
label: "机构类型", |
||||||
message: "请输入排序", |
type: "select", |
||||||
trigger: "blur" |
dicUrl: "/api/blade-system/dict/dictionary?code=org_category", |
||||||
}] |
props: { |
||||||
|
label: "dictValue", |
||||||
|
value: "dictKey" |
||||||
}, |
}, |
||||||
{ |
dataType: "number", |
||||||
label: "备注", |
width: 120, |
||||||
prop: "remark", |
prop: "deptCategory", |
||||||
rules: [{ |
slot: true, |
||||||
required: false, |
rules: [{ |
||||||
message: "请输入备注", |
required: true, |
||||||
trigger: "blur" |
message: "请输入机构类型", |
||||||
}], |
trigger: "blur" |
||||||
hide: true |
}] |
||||||
} |
}, |
||||||
] |
{ |
||||||
}, |
label: "排序", |
||||||
data: [] |
prop: "sort", |
||||||
|
type: "number", |
||||||
|
align: "right", |
||||||
|
width: 80, |
||||||
|
rules: [{ |
||||||
|
required: true, |
||||||
|
message: "请输入排序", |
||||||
|
trigger: "blur" |
||||||
|
}] |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "备注", |
||||||
|
prop: "remark", |
||||||
|
rules: [{ |
||||||
|
required: false, |
||||||
|
message: "请输入备注", |
||||||
|
trigger: "blur" |
||||||
|
}], |
||||||
|
hide: true |
||||||
|
} |
||||||
|
] |
||||||
|
}, |
||||||
|
data: [] |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
...mapGetters(["userInfo", "permission"]), |
||||||
|
permissionList() { |
||||||
|
return { |
||||||
|
addBtn: this.vaildData(this.permission.dept_add, false), |
||||||
|
viewBtn: this.vaildData(this.permission.dept_view, false), |
||||||
|
delBtn: this.vaildData(this.permission.dept_delete, false), |
||||||
|
editBtn: this.vaildData(this.permission.dept_edit, false) |
||||||
}; |
}; |
||||||
}, |
}, |
||||||
computed: { |
ids() { |
||||||
...mapGetters(["userInfo", "permission"]), |
let ids = []; |
||||||
permissionList() { |
this.selectionList.forEach(ele => { |
||||||
return { |
ids.push(ele.id); |
||||||
addBtn: this.vaildData(this.permission.dept_add, false), |
}); |
||||||
viewBtn: this.vaildData(this.permission.dept_view, false), |
return ids.join(","); |
||||||
delBtn: this.vaildData(this.permission.dept_delete, false), |
} |
||||||
editBtn: this.vaildData(this.permission.dept_edit, false) |
}, |
||||||
}; |
methods: { |
||||||
}, |
initData() { |
||||||
ids() { |
getDeptTree().then(res => { |
||||||
let ids = []; |
const column = this.findObject(this.option.column, "parentId"); |
||||||
this.selectionList.forEach(ele => { |
column.dicData = res.data.data; |
||||||
ids.push(ele.id); |
}); |
||||||
|
}, |
||||||
|
handleAdd(row) { |
||||||
|
this.parentId = row.id; |
||||||
|
const column = this.findObject(this.option.column, "parentId"); |
||||||
|
column.value = row.id; |
||||||
|
column.addDisabled = true; |
||||||
|
this.$refs.crud.rowAdd(); |
||||||
|
}, |
||||||
|
rowSave(row, done, loading) { |
||||||
|
add(row).then((res) => { |
||||||
|
// 获取新增数据的相关字段 |
||||||
|
const data = res.data.data; |
||||||
|
row.id = data.id; |
||||||
|
row.deptCategoryName = data.deptCategoryName; |
||||||
|
row.tenantId = data.tenantId; |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
}); |
}); |
||||||
return ids.join(","); |
// 数据回调进行刷新 |
||||||
} |
done(row); |
||||||
|
}, error => { |
||||||
|
window.console.log(error); |
||||||
|
loading(); |
||||||
|
}); |
||||||
}, |
}, |
||||||
methods: { |
rowUpdate(row, index, done, loading) { |
||||||
initData() { |
update(row).then(() => { |
||||||
getDeptTree().then(res => { |
this.$message({ |
||||||
const column = this.findObject(this.option.column, "parentId"); |
type: "success", |
||||||
column.dicData = res.data.data; |
message: "操作成功!" |
||||||
}); |
}); |
||||||
}, |
// 数据回调进行刷新 |
||||||
handleAdd(row) { |
done(row); |
||||||
this.parentId = row.id; |
}, error => { |
||||||
const column = this.findObject(this.option.column, "parentId"); |
window.console.log(error); |
||||||
column.value = row.id; |
loading(); |
||||||
column.addDisabled = true; |
}); |
||||||
this.$refs.crud.rowAdd(); |
}, |
||||||
}, |
rowDel(row, index, done) { |
||||||
rowSave(row, done, loading) { |
this.$confirm("确定将选择数据删除?", { |
||||||
add(row).then((res) => { |
confirmButtonText: "确定", |
||||||
// 获取新增数据的相关字段 |
cancelButtonText: "取消", |
||||||
const data = res.data.data; |
type: "warning" |
||||||
row.id = data.id; |
}) |
||||||
row.deptCategoryName = data.deptCategoryName; |
.then(() => { |
||||||
row.tenantId = data.tenantId; |
return remove(row.id); |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
this.$message({ |
this.$message({ |
||||||
type: "success", |
type: "success", |
||||||
message: "操作成功!" |
message: "操作成功!" |
||||||
}); |
}); |
||||||
// 数据回调进行刷新 |
// 数据回调进行刷新 |
||||||
done(row); |
done(row); |
||||||
}, error => { |
|
||||||
window.console.log(error); |
|
||||||
loading(); |
|
||||||
}); |
}); |
||||||
}, |
}, |
||||||
rowUpdate(row, index, done, loading) { |
handleDelete() { |
||||||
update(row).then(() => { |
if (this.selectionList.length === 0) { |
||||||
|
this.$message.warning("请选择至少一条数据"); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm("确定将选择数据删除?", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
return remove(this.ids); |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
// 刷新表格数据并重载 |
||||||
|
this.data = []; |
||||||
|
this.parentId = 0; |
||||||
|
this.$refs.crud.refreshTable(); |
||||||
|
this.$refs.crud.toggleSelection(); |
||||||
|
// 表格数据重载 |
||||||
|
this.onLoad(this.page); |
||||||
this.$message({ |
this.$message({ |
||||||
type: "success", |
type: "success", |
||||||
message: "操作成功!" |
message: "操作成功!" |
||||||
}); |
}); |
||||||
// 数据回调进行刷新 |
|
||||||
done(row); |
|
||||||
}, error => { |
|
||||||
window.console.log(error); |
|
||||||
loading(); |
|
||||||
}); |
|
||||||
}, |
|
||||||
rowDel(row, index, done) { |
|
||||||
this.$confirm("确定将选择数据删除?", { |
|
||||||
confirmButtonText: "确定", |
|
||||||
cancelButtonText: "取消", |
|
||||||
type: "warning" |
|
||||||
}) |
|
||||||
.then(() => { |
|
||||||
return remove(row.id); |
|
||||||
}) |
|
||||||
.then(() => { |
|
||||||
this.$message({ |
|
||||||
type: "success", |
|
||||||
message: "操作成功!" |
|
||||||
}); |
|
||||||
// 数据回调进行刷新 |
|
||||||
done(row); |
|
||||||
}); |
|
||||||
}, |
|
||||||
handleDelete() { |
|
||||||
if (this.selectionList.length === 0) { |
|
||||||
this.$message.warning("请选择至少一条数据"); |
|
||||||
return; |
|
||||||
} |
|
||||||
this.$confirm("确定将选择数据删除?", { |
|
||||||
confirmButtonText: "确定", |
|
||||||
cancelButtonText: "取消", |
|
||||||
type: "warning" |
|
||||||
}) |
|
||||||
.then(() => { |
|
||||||
return remove(this.ids); |
|
||||||
}) |
|
||||||
.then(() => { |
|
||||||
// 刷新表格数据并重载 |
|
||||||
this.data = []; |
|
||||||
this.parentId = 0; |
|
||||||
this.$refs.crud.refreshTable(); |
|
||||||
this.$refs.crud.toggleSelection(); |
|
||||||
// 表格数据重载 |
|
||||||
this.onLoad(this.page); |
|
||||||
this.$message({ |
|
||||||
type: "success", |
|
||||||
message: "操作成功!" |
|
||||||
}); |
|
||||||
}); |
|
||||||
}, |
|
||||||
searchReset() { |
|
||||||
this.query = {}; |
|
||||||
this.parentId = 0; |
|
||||||
this.onLoad(this.page); |
|
||||||
}, |
|
||||||
searchChange(params, done) { |
|
||||||
this.query = params; |
|
||||||
this.parentId = ''; |
|
||||||
this.page.currentPage = 1; |
|
||||||
this.onLoad(this.page, params); |
|
||||||
done(); |
|
||||||
}, |
|
||||||
selectionChange(list) { |
|
||||||
this.selectionList = list; |
|
||||||
}, |
|
||||||
selectionClear() { |
|
||||||
this.selectionList = []; |
|
||||||
this.$refs.crud.toggleSelection(); |
|
||||||
}, |
|
||||||
beforeOpen(done, type) { |
|
||||||
if (["add", "edit"].includes(type)) { |
|
||||||
this.initData(); |
|
||||||
} |
|
||||||
if (["edit", "view"].includes(type)) { |
|
||||||
getDept(this.form.id).then(res => { |
|
||||||
this.form = res.data.data; |
|
||||||
}); |
|
||||||
} |
|
||||||
done(); |
|
||||||
}, |
|
||||||
beforeClose(done) { |
|
||||||
this.parentId = ""; |
|
||||||
const column = this.findObject(this.option.column, "parentId"); |
|
||||||
column.value = ""; |
|
||||||
column.addDisabled = false; |
|
||||||
done(); |
|
||||||
}, |
|
||||||
currentChange(currentPage) { |
|
||||||
this.page.currentPage = currentPage; |
|
||||||
}, |
|
||||||
sizeChange(pageSize) { |
|
||||||
this.page.pageSize = pageSize; |
|
||||||
}, |
|
||||||
refreshChange() { |
|
||||||
this.onLoad(this.page, this.query); |
|
||||||
}, |
|
||||||
onLoad(page, params = {}) { |
|
||||||
this.loading = true; |
|
||||||
getLazyList(this.parentId, Object.assign(params, this.query)).then(res => { |
|
||||||
this.data = res.data.data; |
|
||||||
this.loading = false; |
|
||||||
this.selectionClear(); |
|
||||||
}); |
}); |
||||||
}, |
}, |
||||||
treeLoad(tree, treeNode, resolve) { |
searchReset() { |
||||||
const parentId = tree.id; |
this.query = {}; |
||||||
getLazyList(parentId).then(res => { |
this.parentId = 0; |
||||||
resolve(res.data.data); |
this.onLoad(this.page); |
||||||
|
}, |
||||||
|
searchChange(params, done) { |
||||||
|
this.query = params; |
||||||
|
this.parentId = ''; |
||||||
|
this.page.currentPage = 1; |
||||||
|
this.onLoad(this.page, params); |
||||||
|
done(); |
||||||
|
}, |
||||||
|
selectionChange(list) { |
||||||
|
this.selectionList = list; |
||||||
|
}, |
||||||
|
selectionClear() { |
||||||
|
this.selectionList = []; |
||||||
|
this.$refs.crud.toggleSelection(); |
||||||
|
}, |
||||||
|
beforeOpen(done, type) { |
||||||
|
if (["add", "edit"].includes(type)) { |
||||||
|
this.initData(); |
||||||
|
} |
||||||
|
if (["edit", "view"].includes(type)) { |
||||||
|
getDept(this.form.id).then(res => { |
||||||
|
this.form = res.data.data; |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
done(); |
||||||
|
}, |
||||||
|
beforeClose(done) { |
||||||
|
this.parentId = ""; |
||||||
|
const column = this.findObject(this.option.column, "parentId"); |
||||||
|
column.value = ""; |
||||||
|
column.addDisabled = false; |
||||||
|
done(); |
||||||
|
}, |
||||||
|
currentChange(currentPage) { |
||||||
|
this.page.currentPage = currentPage; |
||||||
|
}, |
||||||
|
sizeChange(pageSize) { |
||||||
|
this.page.pageSize = pageSize; |
||||||
|
}, |
||||||
|
refreshChange() { |
||||||
|
this.onLoad(this.page, this.query); |
||||||
|
}, |
||||||
|
onLoad(page, params = {}) { |
||||||
|
this.loading = true; |
||||||
|
getLazyList(this.parentId, Object.assign(params, this.query)).then(res => { |
||||||
|
this.data = res.data.data; |
||||||
|
this.loading = false; |
||||||
|
this.selectionClear(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
treeLoad(tree, treeNode, resolve) { |
||||||
|
const parentId = tree.id; |
||||||
|
getLazyList(parentId).then(res => { |
||||||
|
resolve(res.data.data); |
||||||
|
}); |
||||||
} |
} |
||||||
}; |
} |
||||||
|
}; |
||||||
</script> |
</script> |
||||||
|
|
||||||
<style> |
<style> |
||||||
|
|
||||||
</style> |
</style> |
||||||
|
|||||||
Loading…
Reference in new issue