接口联调

main
xuechunyuan 3 years ago
parent 0d28ef4a8a
commit a5e408e00b
  1. 52
      src/api/desk/article.js
  2. 8
      src/page/index/top/index.vue
  3. 77
      src/views/articlelist/index.vue
  4. 9
      src/views/system/dept.vue
  5. 296
      src/views/system/user.vue

@ -0,0 +1,52 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
return request({
url: '/api/blade-business/article/page',
method: 'get',
params: {
...params,
current,
size,
}
})
}
export const remove = (ids) => {
return request({
url: '/api/blade-business/article/remove',
method: 'post',
params: {
ids,
}
})
}
export const add = (row) => {
return request({
url: '/api/blade-business/article/save',
method: 'post',
data: row
})
}
export const getNotice = (id) => {
return request({
url: '/api/blade-business/article/detail-by-id',
method: 'get',
params: {
id
}
})
}
export const doPublish = (id, publishFlag) => {
return request({
url: '/api/blade-business/article/publish',
method: 'post',
params: {
id,
publishFlag,
}
})
}

@ -13,13 +13,13 @@
v-if="showMenu">
<top-menu ref="topMenu"></top-menu>
</div>
<span class="top-bar__item"
<!-- <span class="top-bar__item"
v-if="showSearch">
<top-search></top-search>
</span>
</span> -->
</div>
<div class="top-bar__right">
<el-tooltip v-if="showColor"
<!-- <el-tooltip v-if="showColor"
effect="dark"
:content="$t('navbar.color')"
placement="bottom">
@ -64,7 +64,7 @@
<div class="top-bar__item top-bar__item--show">
<top-lang></top-lang>
</div>
</el-tooltip>
</el-tooltip> -->
<el-tooltip v-if="showFullScren"
effect="dark"
:content="isFullScren?$t('navbar.screenfullF'):$t('navbar.screenfull')"

@ -5,24 +5,31 @@
@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 type="text" icon="el-icon-circle-plus-outline" size="small" @click="rowPublish(row)">{{
row.publishSta == 1 ? '取消发布' : row.publishSta == 2 ? '重新发布'
: '发布'
}}
</el-button>
</template>
<template slot-scope="{row}" slot="status">
<el-tag>{{ row.status == 1 ? '已发布' : '已取消' }}</el-tag>
<template slot-scope="{row}" slot="publishSta">
<el-tag size="small" :type="row.publishSta == 1 ? '' : row.publishSta == 2 ? 'danger' : 'info'">{{
row.publishSta == 1 ? '已发布' : row.publishSta == 2 ? '已保存'
: '已保存'
}}</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-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>
<el-button type="primary" icon="el-icon-check" size="small" @click="addPublish()">发布</el-button>
</template>
</avue-crud>
</basic-container>
</template>
<script>
import { getList, remove, update, add, getNotice } from "@/api/desk/notice";
import { getList, remove, add, getNotice, doPublish } from "@/api/desk/article";
import { mapGetters } from "vuex";
export default {
@ -46,21 +53,20 @@ export default {
border: true,
index: true,
viewBtn: false,
selection: true,
saveBtn:false,
updateBtn:false,
cancelBtn:false,
saveBtn: false,
updateBtn: false,
cancelBtn: false,
dialogType: 'drawer',
dialogClickModal: false,
column: [
{
label: "注意事项标题",
labelWidth:120,
labelWidth: 120,
prop: "title",
span: 24,
row: true,
search: true,
searchLabelWidth:100,
searchLabelWidth: 100,
rules: [{
required: true,
message: "请输入注意事项标题",
@ -68,7 +74,7 @@ export default {
}]
},
{
label: "通知时间",
label: "发布时间",
prop: "releaseTimeRange",
type: "datetime",
format: "yyyy-MM-dd hh:mm:ss",
@ -82,9 +88,10 @@ export default {
},
{
label: "内容",
labelWidth:120,
labelWidth: 120,
prop: "content",
component: 'AvueUeditor',
overHidden: true,
options: {
action: '/api/blade-resource/oss/endpoint/put-file',
props: {
@ -97,7 +104,7 @@ export default {
},
{
label: "状态",
prop: "status",
prop: "publishSta",
slot: true,
addDisplay: false,
editDisplay: false,
@ -105,7 +112,7 @@ export default {
},
{
label: "发布时间",
prop: "releaseTime",
prop: "publishTime",
type: "date",
format: "yyyy-MM-dd hh:mm:ss",
valueFormat: "yyyy-MM-dd hh:mm:ss",
@ -119,15 +126,7 @@ export default {
};
},
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)
};
},
...mapGetters(["userInfo"]),
ids() {
let ids = [];
this.selectionList.forEach(ele => {
@ -136,12 +135,22 @@ export default {
return ids.join(",");
}
},
mounted() {
},
methods: {
//
publish(row, done, loading) {
console.log(row,done,loading)
rowPublish(row) {
console.log(row)
doPublish(row.id, row.publishSta == 1 ? 0 : 1).then(res => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
},
rowSave(row, done, loading) {
row.createDept = this.userInfo.dept_id;
add(row).then(() => {
this.onLoad(this.page);
this.$message({
@ -155,7 +164,7 @@ export default {
});
},
rowUpdate(row, index, done, loading) {
update(row).then(() => {
add(row).then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
@ -241,7 +250,8 @@ export default {
this.onLoad(this.page, this.query);
},
onLoad(page, params = {}) {
const { releaseTimeRange } = this.query;
console.log(this.userInfo)
const { releaseTimeRange, title } = this.query;
let values = {
...params,
...this.query
@ -249,11 +259,16 @@ export default {
if (releaseTimeRange) {
values = {
...values,
releaseTime_datege: releaseTimeRange[0],
releaseTime_datelt: releaseTimeRange[1],
startTime: releaseTimeRange[0],
endTime: releaseTimeRange[1],
};
values.releaseTimeRange = null;
} else {
values.startTime = '';
values.endTime = '';
}
values.title = title ? title : '';
values.createDept = this.userInfo.dept_id;
this.loading = true;
getList(page.currentPage, page.pageSize, values).then(res => {
const data = res.data.data;

@ -16,7 +16,7 @@
</el-button>
</template>
<template slot-scope="{row}" slot="deptCategory">
<el-tag>{{ row.deptCategoryName }}</el-tag>
{{ row.deptCategoryName }}
</template>
</avue-crud>
</basic-container>
@ -77,17 +77,18 @@ export default {
prop: "imgUrl",
html: true,
formatter: (val) => {
return `${val.logo ? '<img src="' + val.logo + '"/>' : ''}`
return `${val.imgUrl ? '<img src="' + val.imgUrl + '"/>' : ''}`
},
type: 'upload',
listType: 'picture-img',
span: 24,
fileType: 'img',//img/video/audio
propsHttp: {
res: 'data'
res: 'data',
url: "link",
},
tip: '只能上传jpg/png用户头像,且不超过500kb',
action: 'https://api.avuejs.com/imgupload'
action: '/api/blade-resource/oss/endpoint/put-file'
},
{
label: "机构全称",

@ -16,6 +16,33 @@
:before-open="beforeOpen" :page.sync="page" @search-change="searchChange" @search-reset="searchReset"
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
@refresh-change="refreshChange" @on-load="onLoad">
<template slot="menuLeft">
<el-button type="danger"
size="small"
plain
icon="el-icon-delete"
v-if="permission.user_delete"
@click="handleDelete">
</el-button>
<el-button type="info"
size="small"
plain
v-if="permission.user_reset"
icon="el-icon-refresh"
@click="handleReset">密码重置
</el-button>
<el-button type="info"
size="small"
plain
v-if="userInfo.role_name.includes('admin')"
icon="el-icon-coordinate"
@click="handleLock">账号解封
</el-button>
</template>
<template slot-scope="{row}" slot="status">
<el-tag size="small" :type="row.status == 1 ? '' : 'danger'">{{ row.status == 1 ? '启用' : '禁用' }}</el-tag>
</template>
<template slot-scope="scope" slot="menu">
<el-button type="text" icon="el-icon-circle-plus-outline" size="small"
@click.stop="handleUpdate(scope.row, scope.index)" v-if="userInfo.role_name.includes('admin')">封禁
@ -36,30 +63,6 @@
<el-button type="primary" @click="submitRole"> </el-button>
</span>
</el-dialog>
<el-dialog title="用户数据导入" append-to-body :visible.sync="excelBox" width="555px">
<avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
<template slot="excelTemplate">
<el-button type="primary" @click="handleTemplate">
点击下载<i class="el-icon-download el-icon--right"></i>
</el-button>
</template>
</avue-form>
</el-dialog>
<el-dialog title="用户平台配置" append-to-body :visible.sync="platformBox">
<avue-crud :option="platformOption" :table-loading="platformLoading" :data="platformData" ref="platformCrud"
v-model="platformForm" :before-open="platformBeforeOpen" :page.sync="platformPage"
:permission="platformPermissionList" @row-update="platformRowUpdate" @search-change="platformSearchChange"
@search-reset="platformSearchReset" @selection-change="platformSelectionChange"
@current-change="platformCurrentChange" @size-change="platformSizeChange"
@refresh-change="platformRefreshChange" @on-load="platformOnLoad">
<template slot-scope="{row}" slot="tenantName">
<el-tag>{{ row.tenantName }}</el-tag>
</template>
<template slot-scope="{row}" slot="userTypeName">
<el-tag>{{ row.userTypeName }}</el-tag>
</template>
</avue-crud>
</el-dialog>
<!-- 打印 -->
<van-button v-print="printObj">打印测试</van-button>
<div id="pintHtml" class="prin_table"
@ -281,10 +284,8 @@
import {
getList,
getUser,
getUserPlatform,
remove,
update,
updatePlatform,
add,
grant,
resetPassword, unlock
@ -292,11 +293,9 @@ import {
import { exportBlob } from "@/api/common";
import { getDeptTree, getDeptLazyTree } from "@/api/system/dept";
import { getRoleTree } from "@/api/system/role";
import { getPostList } from "@/api/system/post";
import { mapGetters } from "vuex";
import website from '@/config/website';
import { getToken } from '@/util/auth';
import { downloadXls } from "@/util/util";
import { dateNow } from "@/util/date";
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
@ -327,24 +326,15 @@ export default {
},
form: {},
search: {},
roleBox: false,
excelBox: false,
platformBox: false,
initFlag: true,
selectionList: [],
query: {},
loading: true,
platformLoading: false,
page: {
pageSize: 10,
currentPage: 1,
total: 0
},
platformPage: {
pageSize: 10,
currentPage: 1,
total: 0
},
init: {
roleTree: [],
deptTree: [],
@ -353,8 +343,6 @@ export default {
label: "title",
value: "key"
},
roleGrantList: [],
roleTreeObj: [],
treeDeptId: '',
treeData: [],
treeOption: {
@ -682,129 +670,6 @@ export default {
// ]
},
data: [],
platformQuery: {},
platformSelectionList: [],
platformData: [],
platformForm: {},
platformOption: {
tip: false,
searchShow: true,
searchMenuSpan: 6,
border: true,
index: true,
selection: true,
viewBtn: true,
dialogClickModal: false,
menuWidth: 120,
editBtnText: '配置',
column: [
{
label: "登录账号",
prop: "account",
search: true,
display: false
},
// {
// label: "",
// prop: "tenantName",
// slot: true,
// display: false
// },
{
label: "用户姓名",
prop: "realName",
search: true,
display: false
},
// {
// label: "",
// prop: "userTypeName",
// slot: true,
// display: false
// },
// {
// label: "",
// type: "select",
// dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
// props: {
// label: "dictValue",
// value: "dictKey"
// },
// dataType: "number",
// search: true,
// hide: true,
// display: false,
// prop: "userType",
// rules: [{
// required: true,
// message: "",
// trigger: "blur"
// }]
// },
// {
// label: "",
// prop: "userExt",
// type: "textarea",
// minRows: 8,
// span: 24,
// overHidden: true,
// row: true,
// hide: true,
// },
],
},
excelForm: {},
excelOption: {
submitBtn: false,
emptyBtn: false,
column: [
{
label: '模板上传',
prop: 'excelFile',
type: 'upload',
drag: true,
loadText: '模板上传中,请稍等',
span: 24,
propsHttp: {
res: 'data'
},
tip: '请上传 .xls,.xlsx 标准格式文件',
action: "/api/blade-user/import-user"
},
{
label: "数据覆盖",
prop: "isCovered",
type: "switch",
align: "center",
width: 80,
dicData: [
{
label: "否",
value: 0
},
{
label: "是",
value: 1
}
],
value: 0,
slot: true,
rules: [
{
required: true,
message: "请选择是否覆盖",
trigger: "blur"
}
]
},
{
label: '模板下载',
prop: 'excelTemplate',
formslot: true,
span: 24,
}
]
},
sex: ''
};
},
@ -814,12 +679,6 @@ export default {
this.initData(this.form.tenantId);
}
},
'excelForm.isCovered'() {
if (this.excelForm.isCovered !== '') {
const column = this.findObject(this.excelOption.column, "excelFile");
column.action = `/api/blade-user/import-user?isCovered=${this.excelForm.isCovered}`;
}
}
},
directives: {
print
@ -834,14 +693,6 @@ export default {
editBtn: this.vaildData(this.permission.user_edit, false)
};
},
platformPermissionList() {
return {
addBtn: false,
viewBtn: false,
delBtn: false,
editBtn: this.vaildData(this.permission.user_edit, false)
};
},
ids() {
let ids = [];
this.selectionList.forEach(ele => {
@ -873,10 +724,6 @@ export default {
const column = this.findObject(this.option.column, "deptId");
column.dicData = res.data.data;
});
getPostList(tenantId).then(res => {
const column = this.findObject(this.option.group, "postId");
column.dicData = res.data.data;
});
},
submitRole() {
const roleList = this.$refs.treeRole.getCheckedKeys().join(",");
@ -1015,9 +862,6 @@ export default {
this.roleBox = true;
});
},
handlePlatform() {
this.platformBox = true;
},
handleLock() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
@ -1038,35 +882,6 @@ export default {
});
});
},
handleImport() {
this.excelBox = true;
},
uploadAfter(res, done, loading, column) {
window.console.log(column);
this.excelBox = false;
this.refreshChange();
done();
},
handleExport() {
const account = func.toStr(this.search.account);
const realName = func.toStr(this.search.realName);
this.$confirm("是否导出用户数据?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
NProgress.start();
exportBlob(`/api/blade-user/export-user?${this.website.tokenHeader}=${getToken()}&account=${account}&realName=${realName}`).then(res => {
downloadXls(res.data, `用户数据表${dateNow()}.xlsx`);
NProgress.done();
})
});
},
handleTemplate() {
exportBlob(`/api/blade-user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
downloadXls(res.data, "用户数据模板.xlsx");
})
},
beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
getUser(this.form.id).then(res => {
@ -1104,63 +919,6 @@ export default {
this.selectionClear();
});
},
platformRowUpdate(row, index, done, loading) {
updatePlatform(row.id, row.userType, row.userExt).then(() => {
this.platformOnLoad(this.platformPage);
this.$message({
type: "success",
message: "操作成功!"
});
done();
}, error => {
window.console.log(error);
loading();
});
},
platformBeforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
getUserPlatform(this.platformForm.id).then(res => {
this.platformForm = res.data.data;
});
}
done();
},
platformSearchReset() {
this.platformQuery = {};
this.platformOnLoad(this.platformPage);
},
platformSearchChange(params, done) {
this.platformQuery = params;
this.platformPage.currentPage = 1;
this.platformOnLoad(this.platformPage, params);
done();
},
platformSelectionChange(list) {
this.platformSelectionList = list;
},
platformSelectionClear() {
this.platformSelectionList = [];
this.$refs.platformCrud.toggleSelection();
},
platformCurrentChange(currentPage) {
this.platformPage.currentPage = currentPage;
},
platformSizeChange(pageSize) {
this.platformPage.pageSize = pageSize;
},
platformRefreshChange() {
this.platformOnLoad(this.platformPage, this.platformQuery);
},
platformOnLoad(page, params = {}) {
this.platformLoading = true;
getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
const data = res.data.data;
this.platformPage.total = data.total;
this.platformData = data.records;
this.platformLoading = false;
this.selectionClear();
});
}
}
};
</script>

Loading…
Cancel
Save